diff --git a/.gitignore b/.gitignore index e914bb79..ffc7ad08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ build node_modules -package-lock.json .DS_Store **/.tsbuildinfo **/src/**/*.js.map diff --git a/docs/Makefile b/docs/Makefile index d0c3cbf1..e4b6cbe7 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -18,3 +18,7 @@ help: # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +# Watch target: automatically rebuild documentation on changes +watch: + @sphinx-autobuild "$(SOURCEDIR)" "$(BUILDDIR)" \ No newline at end of file diff --git a/docs/source/logic.rst b/docs/source/logic.rst index c1b281de..b14f1919 100644 --- a/docs/source/logic.rst +++ b/docs/source/logic.rst @@ -322,14 +322,6 @@ Functions const wallet = await initWallet(); const logicDriver = await getLogicDriver(logicId, wallet); -.. warning:: - When the logic driver is initialized with a provider, - any attempt to execute a mutating routine will trigger the SDK to - raise an exception. The error message associated with this exception - will state: **"Mutating routine calls require a signer to be initialized"**. - Developers should ensure they should pass signer instance while - doing mutating routine calls to avoid encountering this exception. - .. autofunction:: createRoutineOption Usage diff --git a/docs/source/manifest-call-encoder.rst b/docs/source/manifest-call-encoder.rst index 766526bd..e1cd3392 100644 --- a/docs/source/manifest-call-encoder.rst +++ b/docs/source/manifest-call-encoder.rst @@ -170,18 +170,29 @@ Methods >> "0x0e4f065...50000" +.. autofunction:: decodeManifest + +.. code-block:: javascript + + // Example + const decodedManifest = ManifestCoder.decodeManifest(encodedManifest, ManifestFormat.JSON); + console.log(decodedManifest) + + >> { syntax: 1, engine: { kind: "PISA", flags: [] }, elements: [...] } + .. autofunction:: encodeArguments .. code-block:: javascript // Example - const args = ["MOI", 100_000_000]; - const calldata = manifestCoder.encodeArguments("Seeder", args); + const calldata = manifestCoder.encodeArguments("Seeder", "MOI", 100_000_000); console.log(calldata) >> "0x0d6f0665...d4f49" +.. autofunction:: decodeArguments + .. autofunction:: decodeOutput .. code-block:: javascript @@ -218,22 +229,6 @@ Methods .. autofunction:: decodeEventOutput -.. autofunction:: decodeState - -.. code-block:: javascript - - // Example - const data = "0x064c4f4749432d546f6b656e"; - - const state = manifest.elements.find(element => - element.kind === "state" - ) - - const output = manifestCoder.decodeState(data, "name", state.data.fields) - console.log(output) - - >> "RIO" - Schema ------ diff --git a/docs/source/providers.rst b/docs/source/providers.rst index 06636339..4a2afaa9 100644 --- a/docs/source/providers.rst +++ b/docs/source/providers.rst @@ -299,29 +299,17 @@ The ``CallorEstimateIxObject`` interface extends ``InteractionObject`` and repre * ``nonce`` - ``number | bigint``: The nonce value. * ``sender`` - ``string``: The sender of the interaction. -**WsReconnectOptions** +**WebsocketConnection** -The ``WsReconnectOptions`` interface represents options for websocket reconnection. It has the following properties: +The ``WebsocketConnection`` interface represents options for a websocket provider. It has the following properties: -* ``auto`` - ``boolean``: Specifies if automatic reconnection should be enabled (optional). -* ``delay`` - ``number``: The delay duration in milliseconds between reconnection attempts (optional). -* ``maxAttempts`` - ``number``: The maximum number of reconnection attempts (optional). -* ``onTimeout`` - ``boolean``: Specifies whether the reconnection attempts should be triggered on timeout (optional). - -**WebsocketProviderOptions** - -The ``WebsocketProviderOptions`` interface represents options for a websocket provider. It has the following properties: - -* ``host`` - ``string``: The host of the websocket connection (optional). -* ``timeout`` - ``number``: The timeout value for the connection (optional). -* ``reconnect`` - ``any``: Reconnection options for the websocket connection (optional). -* ``reconnectDelay`` - ``number``: The delay duration for reconnection attempts (optional). -* ``reconnectOptions`` - ``WsReconnectOptions``: Additional options for reconnection (optional). -* ``headers`` - ``any``: Custom headers for the websocket connection (optional). -* ``protocol`` - ``string``: The protocol to be used for the connection (optional). +* ``protocols`` - ``object``: The protocols for the websocket connection (optional). +* ``headers`` - ``object``: The headers for the websocket connection (optional). +* ``requestOptions`` - ``object``: The request options for the websocket connection (optional). * ``clientConfig`` - ``object``: Configuration options for the websocket client (optional). -* ``requestOptions`` - ``any``: Additional options for the websocket connection request (optional). -* ``origin`` - ``string``: The origin for the websocket connection (optional). +* ``reconnect`` - ``object``: Configuration options for websocket reconnection (optional). +* ``timeout`` - ``number``: The timeout duration in milliseconds for the websocket connection (optional). + .. note:: @@ -544,11 +532,11 @@ WebSocket connection, facilitating real-time interaction with the blockchain. .. code-block:: javascript // Example - const provider = new WebSocketProvider("ws://localhost:1600/ws", { - reconnectOptions: { - auto: true, - delay: 5000, - maxAttempts: 50 + const provider = new WebsocketProvider("wss://localhost:8080", { + timeout: 20000, + reconnect: { + delay: 1000, + maxAttempts: 5000 } }); @@ -557,22 +545,18 @@ WebSocket Events The event's listed below are related to the WebSocketProvider itself and its connection status and operation. These are not specific to blockchain data. -``CONNECT`` - This event is triggered when the WebSocketProvider successfully +``WebSocketEvent.Connect`` - This event is triggered when the WebSocketProvider successfully establishes a connection with the MOI node. It indicates that the WebSocket connection has been established and is ready for sending and receiving data. -``RECONNECT`` - This event occurs when the WebSocketProvider attempts to +``WebSocketEvent.Reconnect`` - This event occurs when the WebSocketProvider attempts to reconnect to the MOI node after a disconnection. -``CLOSE`` - This event is emitted when the WebSocket connection is closed +``WebSocketEvent.Close`` - This event is emitted when the WebSocket connection is closed intentionally or due to an error. It provides information about the reason for the closure, such as a manual disconnection or a network failure. -``DEBUG`` - This event is primarily used for debugging purposes. It provides -additional information or logs related to the WebSocketProvider's internal -operations, network communication, or any other relevant debugging details. - -``ERROR`` - This event is emitted when an error occurs during the +``WebSocketEvent.Error`` - This event is emitted when an error occurs during the WebSocketProvider's operation. It indicates that something unexpected or erroneous has happened, such as a network error, an invalid response from the MOI node, or any other unforeseen issue. @@ -581,17 +565,19 @@ Protocol Events ~~~~~~~~~~~~~~~ The event's listed below are specific to blockchain data. -``ALL_TESSERACTS`` - This event is triggered when a new tesseract is mined on +``WebSocketEvent.NewTesseracts`` - This event is triggered when a new tesseract is mined on the blockchain. It provides information about the tesseract, such as its height, hash, timestamp, and other relevant data. -``0x...`` (address) - This event is triggered when a new tesseract belonging to +``WebSocketEvent.NewTesseractsByAccount`` - This event is triggered when a new tesseract belonging to the given address is mined on the blockchain. It provides information about the tesseract. -``PENDING_INTERACTIONS`` - This event is emitted when a new interaction is added to +``WebSocketEvent.NewPendingInteractions`` - This event is emitted when a new interaction is added to interaction pool. It provides an interaction hash. +``WebSocketEvent.NewLogs`` - This event is triggered when new logs are added for a given address and topics. + Usage ~~~~~ @@ -605,70 +591,47 @@ Subscribing to all tesseracts console.log("New tesseract finalized", tesseract); }; - // Listen for "connect" event - provider.on(WebSocketEvents.CONNECT, () => { - console.log("WebSocket connection established successfully"); - - // Listen for "tesseracts" event - provider.on(WebSocketEvents.ALL_TESSERACTS, handleTesseracts); - - // Listen for "pending_interactions" event - provider.on(WebSocketEvents.PENDING_INTERACTIONS, handleInteraction); - }); - - // Listen for "debug" event - provider.on(WebSocketEvents.DEBUG, (info) => { - console.log("WebSocket provider debug info:", info); - }); + provider.on(WebSocketEvent.NewTesseracts, handleTesseracts); - // Handle WebSocket connection errors - provider.on(WebSocketEvents.ERROR, (err) => { + provider.on(WebSocketEvent.Error, (err) => { console.log("WebSocket connection error:", err); }); - // Handle WebSocket connection close - provider.on(WebSocketEvents.CLOSE, (info) => { + provider.on(WebSocketEvent.Close, (info) => { console.log("WebSocket connection closed: ", info); // Remove "tesseracts" event listener - provider.off(WebSocketEvents.ALL_TESSERACTS, handleTesseracts); + provider.off(WebSocketEvent.NewTesseracts, handleTesseracts); }); -Subscribing to account specific tesseracts -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Subscribing to tesseracts by address +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: javascript // Example - const adddress = "0xf350520ebca8c09efa19f2ed13012ceb70b2e710241748f4ac11bd4a9b43949b"; - const handleTesseracts = async (tesseract) => { - console.log("New tesseract finalized", tesseract); - }; + const ws = new WebsocketProvider("ws://localhost:8080"); - // Listen for "connect" event - provider.on(WebSocketEvents.CONNECT, () => { - console.log("WebSocket connection established successfully"); - - // Listen for "tesseracts" event - provider.on(adddress, handleTesseracts); + ws.on({ event: WebSocketEvent.NewTesseractsByAccount, params: { address: "0x...abc" } }, (tesseract) => { + console.log(tesseract); }); - // Listen for "debug" event - provider.on(WebSocketEvents.DEBUG, (info) => { - console.log("WebSocket provider debug info:", info); - }); +Subscribing to new logs +^^^^^^^^^^^^^^^^^^^^^^^ - // Handle WebSocket connection errors - provider.on(WebSocketEvents.ERROR, (err) => { - console.log("WebSocket connection error:", err); +.. code-block:: javascript + + provider.on({ event: WebSocketEvent.NewLog, params: { address: "0x..abc", height: [-1, -1], topics: [] } }, (log) => { + console.log("New log", log); }); - // Handle WebSocket connection close - provider.on(WebSocketEvents.CLOSE, (info) => { - console.log("WebSocket connection closed: ", info); +Subscribing to pending interactions +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - // Remove "tesseracts" event listener - provider.off(adddress, handleTesseracts); +.. code-block:: javascript + + provider.on(WebSocketEvent.NewPendingInteractions, (log) => { + console.log("New log", log); }); Websocket enabled JSON-RPC communication @@ -677,19 +640,18 @@ Websocket enabled JSON-RPC communication .. code-block:: javascript // Example - const address = "0x102e973bc33200fdb3383b4c8e490433743211edb33e53b8915d5a4b2668cf5e"; - const contextInfo = await provider.getContextInfo(address) - console.log(contextInfo) + const address = "0x...abc"; + const tdu = await provider.getTDU(address) + console.log(tdu) // Output /* - { - "behaviour_nodes": [ - "3WwLTp3WztxoLKKdPSLn9PRDPyB5mvVfGCpahP9kYaiqjrE8LwH1.16Uiu2HAm6wumV4gJkAAqTkfowUcbF1i1yQmLFcAhjbbJuDu2hURC" - ], - "random_nodes": [], - "storage_nodes": [] - } + [ + { + "asset_id": "0x...xyz", + "amount": "0xF4161" + } + ] */ Voyage Provider diff --git a/jest.config.ts b/jest.config.ts index 5bf3f110..84b6d9ce 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -50,6 +50,14 @@ const configuration: Config = { // transform: { // '^.+\\.tsx?$': 'ts-jest', // }, + // }, + // { + // displayName: 'js-moi-logic', + // testEnvironment: 'ts-node', + // testMatch: ['/packages/js-moi-logic/__tests__/*.test.ts'], + // transform: { + // '^.+\\.tsx?$': 'ts-jest', + // }, // } ], testTimeout: 700000, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..f4f02598 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,5090 @@ +{ + "name": "moi", + "version": "0.4.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "moi", + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "workspaces": [ + "packages/*" + ], + "dependencies": { + "@noble/hashes": "^1.1.5", + "@noble/secp256k1": "^1.7.1", + "@scure/bip32": "^1.4.0", + "aes-js": "4.0.0-beta.5", + "assert": "^2.0.0", + "bn.js": "^5.2.1", + "buffer": "^6.0.3", + "cross-fetch": "^4.0.0", + "elliptic": "^6.5.4", + "js-polo": "0.1.4", + "stream": "npm:stream-browserify", + "websocket": "^1.0.34" + }, + "devDependencies": { + "@types/aes-js": "^3.1.4", + "@types/jest": "^29.4.0", + "jest": "^29.4.3", + "jsdoc": "^4.0.2", + "ts-jest": "^29.0.5", + "ts-node": "10.9.2", + "typescript": "^5.6.3" + } + }, + "node_modules/@ampproject/remapping": { + "version": "2.3.0", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/highlight": "^7.25.7", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.25.7", + "@babel/generator": "^7.25.7", + "@babel/helper-compilation-targets": "^7.25.7", + "@babel/helper-module-transforms": "^7.25.7", + "@babel/helpers": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/template": "^7.25.7", + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.7", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.25.7", + "@babel/helper-validator-option": "^7.25.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.25.7", + "@babel/helper-simple-access": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.7", + "@babel/traverse": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.7", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.25.7" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-attributes": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-jsx": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/types": "^7.25.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.25.7", + "@babel/generator": "^7.25.7", + "@babel/parser": "^7.25.7", + "@babel/template": "^7.25.7", + "@babel/types": "^7.25.7", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.25.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.7", + "@babel/helper-validator-identifier": "^7.25.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "dev": true, + "license": "ISC", + "dependencies": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/@jest/console": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/core": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/environment": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/fake-timers": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/globals": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/reporters": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/@jest/schemas": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/source-map": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-result": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/test-sequencer": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/transform": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/types": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@jsdoc/salty": { + "version": "0.2.8", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "lodash": "^4.17.21" + }, + "engines": { + "node": ">=v12.0.0" + } + }, + "node_modules/@noble/curves": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.2.tgz", + "integrity": "sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==", + "dependencies": { + "@noble/hashes": "1.4.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/hashes": { + "version": "1.5.0", + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/secp256k1": { + "version": "1.7.1", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "license": "MIT" + }, + "node_modules/@scure/base": { + "version": "1.1.9", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.4.0.tgz", + "integrity": "sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==", + "dependencies": { + "@noble/curves": "~1.4.0", + "@noble/hashes": "~1.4.0", + "@scure/base": "~1.1.6" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", + "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "dev": true, + "license": "MIT" + }, + "node_modules/@sinonjs/commons": { + "version": "3.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "type-detect": "4.0.8" + } + }, + "node_modules/@sinonjs/fake-timers": { + "version": "10.3.0", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@sinonjs/commons": "^3.0.0" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/aes-js": { + "version": "3.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.6.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.20.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.20.7" + } + }, + "node_modules/@types/bn.js": { + "version": "5.1.6", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/graceful-fs": { + "version": "4.1.9", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.6", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/istanbul-lib-report": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-coverage": "*" + } + }, + "node_modules/@types/istanbul-reports": { + "version": "3.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/istanbul-lib-report": "*" + } + }, + "node_modules/@types/jest": { + "version": "29.5.14", + "dev": true, + "license": "MIT", + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/linkify-it": { + "version": "5.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/markdown-it": { + "version": "14.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/linkify-it": "^5", + "@types/mdurl": "^2" + } + }, + "node_modules/@types/mdurl": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "22.7.5", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/stack-utils": { + "version": "2.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/websocket": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@types/yargs": { + "version": "17.0.33", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/yargs-parser": { + "version": "21.0.3", + "dev": true, + "license": "MIT" + }, + "node_modules/acorn": { + "version": "8.12.1", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "license": "MIT" + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/anymatch": { + "version": "3.1.3", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/argparse": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/asn1.js": { + "version": "4.10.1", + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/asn1.js/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/assert": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" + } + }, + "node_modules/async": { + "version": "3.2.6", + "dev": true, + "license": "MIT" + }, + "node_modules/available-typed-arrays": { + "version": "1.0.7", + "license": "MIT", + "dependencies": { + "possible-typed-array-names": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/babel-jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.8.0" + } + }, + "node_modules/babel-plugin-istanbul": { + "version": "6.1.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-istanbul/node_modules/istanbul-lib-instrument": { + "version": "5.2.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/babel-plugin-jest-hoist": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/babel-preset-current-node-syntax": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-import-attributes": "^7.24.7", + "@babel/plugin-syntax-import-meta": "^7.10.4", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/babel-preset-jest": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "dependencies": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/base-x": { + "version": "3.0.10", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bluebird": { + "version": "3.7.2", + "dev": true, + "license": "MIT" + }, + "node_modules/bn.js": { + "version": "5.2.1", + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/brorand": { + "version": "1.1.0", + "license": "MIT" + }, + "node_modules/browserify-aes": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/browserify-cipher": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "node_modules/browserify-des": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/browserify-rsa": { + "version": "4.1.1", + "license": "MIT", + "dependencies": { + "bn.js": "^5.2.1", + "randombytes": "^2.1.0", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/browserify-sign": { + "version": "4.2.3", + "license": "ISC", + "dependencies": { + "bn.js": "^5.2.1", + "browserify-rsa": "^4.1.0", + "create-hash": "^1.2.0", + "create-hmac": "^1.1.7", + "elliptic": "^6.5.5", + "hash-base": "~3.0", + "inherits": "^2.0.4", + "parse-asn1": "^5.1.7", + "readable-stream": "^2.3.8", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, + "node_modules/browserify-sign/node_modules/readable-stream": { + "version": "2.3.8", + "license": "MIT", + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "node_modules/browserify-sign/node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "node_modules/browserify-sign/node_modules/string_decoder": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/browserify-sign/node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.1.2", + "license": "MIT" + }, + "node_modules/browserslist": { + "version": "4.24.0", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "caniuse-lite": "^1.0.30001663", + "electron-to-chromium": "^1.5.28", + "node-releases": "^2.0.18", + "update-browserslist-db": "^1.1.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs-logger": { + "version": "0.2.6", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-json-stable-stringify": "2.x" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/bs58": { + "version": "4.0.1", + "license": "MIT", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bs58check": { + "version": "2.1.2", + "license": "MIT", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/bser": { + "version": "2.1.1", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "node-int64": "^0.4.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/buffer-xor": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/bufferutil": { + "version": "4.0.8", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/call-bind": { + "version": "1.0.7", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "set-function-length": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "5.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001667", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/catharsis": { + "version": "0.9.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.15" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/char-regex": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ci-info": { + "version": "3.9.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/cipher-base": { + "version": "1.0.4", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/cjs-module-lexer": { + "version": "1.4.1", + "dev": true, + "license": "MIT" + }, + "node_modules/cliui": { + "version": "8.0.1", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/co": { + "version": "4.6.0", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">= 1.0.0", + "node": ">= 0.12.0" + } + }, + "node_modules/collect-v8-coverage": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/color-convert": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "license": "MIT" + }, + "node_modules/create-ecdh": { + "version": "4.0.4", + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "elliptic": "^6.5.3" + } + }, + "node_modules/create-ecdh/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/create-hash": { + "version": "1.2.0", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "license": "MIT", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/create-jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + }, + "bin": { + "create-jest": "bin/create-jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/create-require": { + "version": "1.1.1", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-fetch": { + "version": "4.0.0", + "license": "MIT", + "dependencies": { + "node-fetch": "^2.6.12" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto": { + "name": "crypto-browserify", + "version": "3.12.0", + "license": "MIT", + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, + "node_modules/d": { + "version": "1.0.2", + "license": "ISC", + "dependencies": { + "es5-ext": "^0.10.64", + "type": "^2.7.2" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/debug": { + "version": "4.3.7", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/dedent": { + "version": "1.5.3", + "dev": true, + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/define-data-property": { + "version": "1.1.4", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0", + "es-errors": "^1.3.0", + "gopd": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/define-properties": { + "version": "1.2.1", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.0.1", + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/des.js": { + "version": "1.1.0", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "node_modules/detect-newline": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/diff": { + "version": "4.0.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/diff-sequences": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/diffie-hellman": { + "version": "5.0.3", + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "node_modules/diffie-hellman/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/ejs": { + "version": "3.1.10", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "jake": "^10.8.5" + }, + "bin": { + "ejs": "bin/cli.js" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.33", + "dev": true, + "license": "ISC" + }, + "node_modules/elliptic": { + "version": "6.5.7", + "license": "MIT", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/emittery": { + "version": "0.13.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sindresorhus/emittery?sponsor=1" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/entities": { + "version": "4.5.0", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-define-property": { + "version": "1.0.0", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.2.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es5-ext": { + "version": "0.10.64", + "hasInstallScript": true, + "license": "ISC", + "dependencies": { + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.3", + "esniff": "^2.0.1", + "next-tick": "^1.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/es6-iterator": { + "version": "2.0.3", + "license": "MIT", + "dependencies": { + "d": "1", + "es5-ext": "^0.10.35", + "es6-symbol": "^3.1.1" + } + }, + "node_modules/es6-symbol": { + "version": "3.1.4", + "license": "ISC", + "dependencies": { + "d": "^1.0.2", + "ext": "^1.7.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esniff": { + "version": "2.0.1", + "license": "ISC", + "dependencies": { + "d": "^1.0.1", + "es5-ext": "^0.10.62", + "event-emitter": "^0.3.5", + "type": "^2.7.2" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/event-emitter": { + "version": "0.3.5", + "license": "MIT", + "dependencies": { + "d": "1", + "es5-ext": "~0.10.14" + } + }, + "node_modules/events": { + "version": "3.3.0", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/evp_bytestokey": { + "version": "1.0.3", + "license": "MIT", + "dependencies": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "node_modules/execa": { + "version": "5.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/execa?sponsor=1" + } + }, + "node_modules/exit": { + "version": "0.1.2", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/expect": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/ext": { + "version": "1.7.0", + "license": "ISC", + "dependencies": { + "type": "^2.7.2" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/fb-watchman": { + "version": "2.0.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "bser": "2.1.1" + } + }, + "node_modules/filelist": { + "version": "1.0.4", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "minimatch": "^5.0.1" + } + }, + "node_modules/filelist/node_modules/brace-expansion": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/filelist/node_modules/minimatch": { + "version": "5.1.6", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/for-each": { + "version": "0.3.3", + "license": "MIT", + "dependencies": { + "is-callable": "^1.1.3" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "dev": true, + "license": "ISC", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.2.4", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3", + "hasown": "^2.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-package-type": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/get-stream": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/glob": { + "version": "7.2.3", + "dev": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/gopd": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "get-intrinsic": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "es-define-property": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-proto": { + "version": "1.0.3", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.0.3", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.0.4", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash.js": { + "version": "1.1.7", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hdkey": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "bs58check": "^2.1.2", + "ripemd160": "^2.0.2", + "safe-buffer": "^5.1.1", + "secp256k1": "^4.0.0" + } + }, + "node_modules/hdkey/node_modules/node-addon-api": { + "version": "2.0.2", + "license": "MIT" + }, + "node_modules/hdkey/node_modules/secp256k1": { + "version": "4.0.3", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "license": "MIT", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/human-signals": { + "version": "2.1.0", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=10.17.0" + } + }, + "node_modules/ieee754": { + "version": "1.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/import-local": { + "version": "3.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" + }, + "bin": { + "import-local-fixture": "fixtures/cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "dev": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "license": "ISC" + }, + "node_modules/is-arguments": { + "version": "1.1.1", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "dev": true, + "license": "MIT" + }, + "node_modules/is-callable": { + "version": "1.2.7", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.15.1", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-generator-fn": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "license": "MIT", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-nan": { + "version": "1.3.2", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-stream": { + "version": "2.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-typed-array": { + "version": "1.1.13", + "license": "MIT", + "dependencies": { + "which-typed-array": "^1.1.14" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/isarray": { + "version": "1.0.0", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.2", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-instrument": { + "version": "6.0.3", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "@babel/core": "^7.23.9", + "@babel/parser": "^7.23.9", + "@istanbuljs/schema": "^0.1.3", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-instrument/node_modules/semver": { + "version": "7.6.3", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-lib-source-maps": { + "version": "4.0.1", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.7", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jake": { + "version": "10.9.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "async": "^3.2.3", + "chalk": "^4.0.2", + "filelist": "^1.0.4", + "minimatch": "^3.1.2" + }, + "bin": { + "jake": "bin/cli.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-changed-files": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-circus": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-cli": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + }, + "bin": { + "jest": "bin/jest.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "node-notifier": "^8.0.1 || ^9.0.0 || ^10.0.0" + }, + "peerDependenciesMeta": { + "node-notifier": { + "optional": true + } + } + }, + "node_modules/jest-config": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "peerDependencies": { + "@types/node": "*", + "ts-node": ">=9.0.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "ts-node": { + "optional": true + } + } + }, + "node_modules/jest-diff": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-docblock": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-newline": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-each": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-environment-node": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-get-type": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-haste-map": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, + "optionalDependencies": { + "fsevents": "^2.3.2" + } + }, + "node_modules/jest-leak-detector": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-matcher-utils": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-message-util": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-mock": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-pnp-resolver": { + "version": "1.2.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + }, + "peerDependencies": { + "jest-resolve": "*" + }, + "peerDependenciesMeta": { + "jest-resolve": { + "optional": true + } + } + }, + "node_modules/jest-regex-util": { + "version": "29.6.3", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-resolve-dependencies": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runner": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-runtime": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-snapshot/node_modules/semver": { + "version": "7.6.3", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/jest-util": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-validate/node_modules/camelcase": { + "version": "6.3.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/jest-watcher": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/jest-worker/node_modules/supports-color": { + "version": "8.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/js-moi-bip39": { + "resolved": "packages/js-moi-bip39", + "link": true + }, + "node_modules/js-moi-constants": { + "resolved": "packages/js-moi-constants", + "link": true + }, + "node_modules/js-moi-hdnode": { + "resolved": "packages/js-moi-hdnode", + "link": true + }, + "node_modules/js-moi-logic": { + "resolved": "packages/js-moi-logic", + "link": true + }, + "node_modules/js-moi-manifest": { + "resolved": "packages/js-moi-manifest", + "link": true + }, + "node_modules/js-moi-providers": { + "resolved": "packages/js-moi-providers", + "link": true + }, + "node_modules/js-moi-sdk": { + "resolved": "packages/js-moi", + "link": true + }, + "node_modules/js-moi-signer": { + "resolved": "packages/js-moi-signer", + "link": true + }, + "node_modules/js-moi-utils": { + "resolved": "packages/js-moi-utils", + "link": true + }, + "node_modules/js-moi-wallet": { + "resolved": "packages/js-moi-wallet", + "link": true + }, + "node_modules/js-polo": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/js-polo/-/js-polo-0.1.4.tgz", + "integrity": "sha512-EK+7iXBWl1xcZf08Fc03l8Od0TB+J7gOf3HThTdX5edeJqfDGj/0NRrFKFdbZgcd9JronAHQp2VQgp8TVmEfJQ==", + "dependencies": { + "bn.js": "^5.2.1", + "buffer": "^6.0.3" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/js2xmlparser": { + "version": "4.0.2", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "xmlcreate": "^2.0.4" + } + }, + "node_modules/jsdoc": { + "version": "4.0.3", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/parser": "^7.20.15", + "@jsdoc/salty": "^0.2.1", + "@types/markdown-it": "^14.1.1", + "bluebird": "^3.7.2", + "catharsis": "^0.9.0", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.2", + "klaw": "^3.0.0", + "markdown-it": "^14.1.0", + "markdown-it-anchor": "^8.6.7", + "marked": "^4.0.10", + "mkdirp": "^1.0.4", + "requizzle": "^0.2.3", + "strip-json-comments": "^3.1.0", + "underscore": "~1.13.2" + }, + "bin": { + "jsdoc": "jsdoc.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/jsesc": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/json5": { + "version": "2.2.3", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/klaw": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.9" + } + }, + "node_modules/kleur": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/leven": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "dev": true, + "license": "MIT" + }, + "node_modules/linkify-it": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash.memoize": { + "version": "4.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/make-dir": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.5.3" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "7.6.3", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-error": { + "version": "1.3.6", + "dev": true, + "license": "ISC" + }, + "node_modules/makeerror": { + "version": "1.0.12", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tmpl": "1.0.5" + } + }, + "node_modules/markdown-it": { + "version": "14.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/markdown-it-anchor": { + "version": "8.6.7", + "dev": true, + "license": "Unlicense", + "peerDependencies": { + "@types/markdown-it": "*", + "markdown-it": "*" + } + }, + "node_modules/markdown-it/node_modules/argparse": { + "version": "2.0.1", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/marked": { + "version": "4.3.0", + "dev": true, + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/mdurl": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/merge-stream": { + "version": "2.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/micromatch": { + "version": "4.0.8", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/miller-rabin": { + "version": "4.0.1", + "license": "MIT", + "dependencies": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + }, + "bin": { + "miller-rabin": "bin/miller-rabin" + } + }, + "node_modules/miller-rabin/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "license": "ISC" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/next-tick": { + "version": "1.1.0", + "license": "ISC" + }, + "node_modules/node-addon-api": { + "version": "5.1.0", + "license": "MIT" + }, + "node_modules/node-fetch": { + "version": "2.7.0", + "license": "MIT", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.2", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-int64": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/node-releases": { + "version": "2.0.18", + "dev": true, + "license": "MIT" + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm-run-path": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/object-is": { + "version": "1.1.6", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.5", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "define-properties": "^1.2.1", + "has-symbols": "^1.0.3", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "dev": true, + "license": "MIT", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-locate/node_modules/p-limit": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/parse-asn1": { + "version": "5.1.7", + "license": "ISC", + "dependencies": { + "asn1.js": "^4.10.1", + "browserify-aes": "^1.2.0", + "evp_bytestokey": "^1.0.3", + "hash-base": "~3.0", + "pbkdf2": "^3.1.2", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "dev": true, + "license": "MIT" + }, + "node_modules/pbkdf2": { + "version": "3.1.2", + "license": "MIT", + "dependencies": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/picocolors": { + "version": "1.1.0", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.6", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.0.0", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/pretty-format": { + "version": "29.7.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/process": { + "version": "0.11.10", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/process-nextick-args": { + "version": "2.0.1", + "license": "MIT" + }, + "node_modules/prompts": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/public-encrypt": { + "version": "4.0.3", + "license": "MIT", + "dependencies": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/public-encrypt/node_modules/bn.js": { + "version": "4.12.0", + "license": "MIT" + }, + "node_modules/punycode.js": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pure-rand": { + "version": "6.1.0", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT" + }, + "node_modules/randombytes": { + "version": "2.1.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/randomfill": { + "version": "1.0.4", + "license": "MIT", + "dependencies": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "node_modules/react-is": { + "version": "18.3.1", + "dev": true, + "license": "MIT" + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/requizzle": { + "version": "0.2.4", + "dev": true, + "license": "MIT", + "dependencies": { + "lodash": "^4.17.21" + } + }, + "node_modules/resolve": { + "version": "1.22.8", + "dev": true, + "license": "MIT", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-cwd": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve.exports": { + "version": "2.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "license": "MIT", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/secp256k1": { + "version": "5.0.0", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "elliptic": "^6.5.4", + "node-addon-api": "^5.0.0", + "node-gyp-build": "^4.2.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/set-function-length": { + "version": "1.2.2", + "license": "MIT", + "dependencies": { + "define-data-property": "^1.1.4", + "es-errors": "^1.3.0", + "function-bind": "^1.1.2", + "get-intrinsic": "^1.2.4", + "gopd": "^1.0.1", + "has-property-descriptors": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/sha.js": { + "version": "2.4.11", + "license": "(MIT AND BSD-3-Clause)", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "dev": true, + "license": "ISC" + }, + "node_modules/sisteransi": { + "version": "1.0.5", + "dev": true, + "license": "MIT" + }, + "node_modules/slash": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.6.1", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.13", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/stack-utils": { + "version": "2.0.6", + "dev": true, + "license": "MIT", + "dependencies": { + "escape-string-regexp": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/stream": { + "name": "stream-browserify", + "version": "3.0.0", + "license": "MIT", + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-length": { + "version": "4.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-final-newline": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tmpl": { + "version": "1.0.5", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "license": "MIT" + }, + "node_modules/ts-jest": { + "version": "29.2.5", + "dev": true, + "license": "MIT", + "dependencies": { + "bs-logger": "^0.2.6", + "ejs": "^3.1.10", + "fast-json-stable-stringify": "^2.1.0", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "^4.1.2", + "make-error": "^1.3.6", + "semver": "^7.6.3", + "yargs-parser": "^21.1.1" + }, + "bin": { + "ts-jest": "cli.js" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.0.0-beta.0 <8", + "@jest/transform": "^29.0.0", + "@jest/types": "^29.0.0", + "babel-jest": "^29.0.0", + "jest": "^29.0.0", + "typescript": ">=4.3 <6" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@jest/transform": { + "optional": true + }, + "@jest/types": { + "optional": true + }, + "babel-jest": { + "optional": true + }, + "esbuild": { + "optional": true + } + } + }, + "node_modules/ts-jest/node_modules/semver": { + "version": "7.6.3", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ts-node": { + "version": "10.9.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/type": { + "version": "2.7.3", + "license": "ISC" + }, + "node_modules/type-detect": { + "version": "4.0.8", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.21.3", + "dev": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "license": "MIT", + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "5.6.3", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/uc.micro": { + "version": "2.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/underscore": { + "version": "1.13.7", + "dev": true, + "license": "MIT" + }, + "node_modules/undici-types": { + "version": "6.19.8", + "dev": true, + "license": "MIT" + }, + "node_modules/update-browserslist-db": { + "version": "1.1.1", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.0" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "hasInstallScript": true, + "license": "MIT", + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, + "node_modules/util": { + "version": "0.12.5", + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "license": "MIT" + }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "dev": true, + "license": "MIT" + }, + "node_modules/v8-to-istanbul": { + "version": "9.3.0", + "dev": true, + "license": "ISC", + "dependencies": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/walker": { + "version": "1.0.8", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "makeerror": "1.0.12" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "license": "BSD-2-Clause" + }, + "node_modules/websocket": { + "version": "1.0.35", + "license": "Apache-2.0", + "dependencies": { + "bufferutil": "^4.0.1", + "debug": "^2.2.0", + "es5-ext": "^0.10.63", + "typedarray-to-buffer": "^3.1.5", + "utf-8-validate": "^5.0.2", + "yaeti": "^0.0.6" + }, + "engines": { + "node": ">=4.0.0" + } + }, + "node_modules/websocket/node_modules/debug": { + "version": "2.6.9", + "license": "MIT", + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/websocket/node_modules/ms": { + "version": "2.0.0", + "license": "MIT" + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "license": "MIT", + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-typed-array": { + "version": "1.1.15", + "license": "MIT", + "dependencies": { + "available-typed-arrays": "^1.0.7", + "call-bind": "^1.0.7", + "for-each": "^0.3.3", + "gopd": "^1.0.1", + "has-tostringtag": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/write-file-atomic": { + "version": "4.0.2", + "dev": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/xmlcreate": { + "version": "2.0.4", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/y18n": { + "version": "5.0.8", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/yaeti": { + "version": "0.0.6", + "license": "MIT", + "engines": { + "node": ">=0.10.32" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "dev": true, + "license": "ISC" + }, + "node_modules/yaml": { + "version": "2.6.0", + "license": "ISC", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "dev": true, + "license": "MIT", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "packages/js-moi": { + "name": "js-moi-sdk", + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "js-moi-bip39": "^0.4.1", + "js-moi-constants": "^0.4.1", + "js-moi-hdnode": "^0.4.1", + "js-moi-logic": "^0.4.1", + "js-moi-manifest": "^0.4.1", + "js-moi-providers": "^0.4.1", + "js-moi-signer": "^0.4.1", + "js-moi-utils": "^0.4.1", + "js-moi-wallet": "^0.4.1" + } + }, + "packages/js-moi-bip39": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@noble/hashes": "^1.1.5", + "buffer": "^6.0.3", + "js-moi-constants": "^0.4.1", + "js-moi-hdnode": "^0.4.1", + "js-moi-signer": "^0.4.1", + "js-moi-utils": "^0.4.1" + } + }, + "packages/js-moi-constants": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT" + }, + "packages/js-moi-hdnode": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@scure/bip32": "^1.3.3", + "assert": "^2.0.0", + "buffer": "^6.0.3", + "crypto": "npm:crypto-browserify", + "hdkey": "^2.1.0", + "js-moi-utils": "^0.4.1", + "process": "^0.11.10", + "secp256k1": "^5.0.0", + "stream": "npm:stream-browserify" + } + }, + "packages/js-moi-logic": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@noble/hashes": "^1.1.5", + "buffer": "^6.0.3", + "js-moi-manifest": "^0.4.1", + "js-moi-providers": "^0.4.1", + "js-moi-signer": "^0.4.1", + "js-moi-utils": "^0.4.1" + } + }, + "packages/js-moi-manifest": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "js-moi-utils": "^0.4.1", + "js-polo": "0.1.4", + "yaml": "^2.6.0" + } + }, + "packages/js-moi-providers": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "cross-fetch": "^4.0.0", + "crypto": "npm:crypto-browserify", + "events": "npm:events@^3.3.0", + "js-moi-manifest": "^0.4.1", + "js-moi-utils": "^0.4.1", + "websocket": "^1.0.35" + }, + "devDependencies": { + "@types/websocket": "^1.0.10" + } + }, + "packages/js-moi-signer": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@noble/hashes": "^1.1.5", + "@noble/secp256k1": "^1.7.1", + "buffer": "^6.0.3", + "js-moi-providers": "^0.4.1", + "js-moi-utils": "^0.4.1" + } + }, + "packages/js-moi-utils": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "bn.js": "^5.2.1", + "buffer": "^6.0.3" + }, + "devDependencies": { + "@types/bn.js": "^5.1.5" + } + }, + "packages/js-moi-wallet": { + "version": "0.4.1", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@noble/hashes": "^1.1.5", + "aes-js": "4.0.0-beta.5", + "buffer": "^6.0.3", + "elliptic": "^6.5.4", + "js-moi-bip39": "^0.4.1", + "js-moi-constants": "^0.4.1", + "js-moi-hdnode": "^0.4.1", + "js-moi-providers": "^0.4.1", + "js-moi-signer": "^0.4.1", + "js-moi-utils": "^0.4.1", + "js-polo": "0.1.4" + } + } + } +} diff --git a/package.json b/package.json index 9e655f1d..1e56c833 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ "build": "tsc -b && rm -rf dist", "watch": "tsc -b -w", "test": "jest --env=node --colors --verbose", + "check-types": "tsc --noEmit", "test:coverage": "jest --coverage --env=node --colors --verbose", "docs": "make -C docs html", + "watch:docs": "make -C docs watch", "prebuild": "npm run clean" }, "repository": { @@ -44,14 +46,14 @@ "dependencies": { "@noble/hashes": "^1.1.5", "@noble/secp256k1": "^1.7.1", - "@scure/bip32": "^1.3.3", + "@scure/bip32": "^1.4.0", "aes-js": "4.0.0-beta.5", "assert": "^2.0.0", "bn.js": "^5.2.1", "buffer": "^6.0.3", "cross-fetch": "^4.0.0", "elliptic": "^6.5.4", - "js-polo": "^0.1.3", + "js-polo": "0.1.4", "stream": "npm:stream-browserify", "websocket": "^1.0.34" }, diff --git a/packages/js-moi-hdnode/dist/hdnode.d.ts b/packages/js-moi-hdnode/dist/hdnode.d.ts deleted file mode 100644 index 67e30d32..00000000 --- a/packages/js-moi-hdnode/dist/hdnode.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -/// -import HDKey from "hdkey"; -import { Buffer } from "buffer"; -/** - * This class represents a Hierarchical Deterministic (HD) Node used in - cryptographic key generation and derivation. - */ -export declare class HDNode { - private node; - constructor(node: HDKey); - /** - * Generates an HDNode from a seed buffer. - * - * @param {Buffer} seed - The seed buffer. - * @throws {Error} If an error occurs during the HDNode generation. - */ - static fromSeed(seed: Buffer): HDNode; - /** - * Generates an HDNode from an extended key. - * - * @param {string} extendedKey - The extended key. - * @throws {Error} If an error occurs during the HDNode generation. - */ - static fromExtendedKey(extendedKey: string): HDNode; - /** - * Derives a child HDNode from the current HDNode using the specified path. - * - * @param {string} path - The derivation path for the child HDNode. - * @returns {HDNode} The derived child HDNode. - * @throws {Error} If the HDNode is not initialized. - */ - derivePath(path: string): HDNode; - /** - * Derives a child HDNode from the current HDNode using the specified index. - * - * @param {number} index - The child index. - * @returns {HDNode} The derived child HDNode. - * @throws {Error} If the HDNode is not initialized. - */ - deriveChild(index: number): HDNode; - /** - * Retrieves the public key associated with the HDNode. - * - * @returns {Buffer} The public key. - * @throws {Error} If the HDNode is not initialized. - */ - publicKey(): Buffer; - /** - * Retrieves the private key associated with the HDNode. - * - * @returns {Buffer} The private key. - * @throws {Error} If the HDNode is not initialized or private key is not available. - */ - privateKey(): Buffer; -} diff --git a/packages/js-moi-hdnode/dist/hdnode.js b/packages/js-moi-hdnode/dist/hdnode.js deleted file mode 100644 index 19d0ba93..00000000 --- a/packages/js-moi-hdnode/dist/hdnode.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.HDNode = void 0; -const hdkey_1 = __importDefault(require("hdkey")); -const js_moi_utils_1 = require("js-moi-utils"); -/** - * This class represents a Hierarchical Deterministic (HD) Node used in - cryptographic key generation and derivation. - */ -class HDNode { - node; - constructor(node) { - this.node = node; - } - /** - * Generates an HDNode from a seed buffer. - * - * @param {Buffer} seed - The seed buffer. - * @throws {Error} If an error occurs during the HDNode generation. - */ - static fromSeed(seed) { - try { - // Generate the master HDNode from the seed buffer - const node = hdkey_1.default.fromMasterSeed(seed, undefined); - // Derive the child HDNode using the specified path or default path - return new HDNode(node); - } - catch (err) { - js_moi_utils_1.ErrorUtils.throwError("Failed to generate HDNode from seed", js_moi_utils_1.ErrorCode.UNKNOWN_ERROR, { originalError: err }); - } - } - /** - * Generates an HDNode from an extended key. - * - * @param {string} extendedKey - The extended key. - * @throws {Error} If an error occurs during the HDNode generation. - */ - static fromExtendedKey(extendedKey) { - try { - const node = hdkey_1.default.fromExtendedKey(extendedKey, undefined); - return new HDNode(node); - } - catch (err) { - js_moi_utils_1.ErrorUtils.throwError("Failed to generate HDNode from extended key", js_moi_utils_1.ErrorCode.UNKNOWN_ERROR, { originalError: err }); - } - } - /** - * Derives a child HDNode from the current HDNode using the specified path. - * - * @param {string} path - The derivation path for the child HDNode. - * @returns {HDNode} The derived child HDNode. - * @throws {Error} If the HDNode is not initialized. - */ - derivePath(path) { - if (!this.node) { - js_moi_utils_1.ErrorUtils.throwError("HDNode not initialized", js_moi_utils_1.ErrorCode.NOT_INITIALIZED); - } - const childNode = this.node.derive(path); - return new HDNode(childNode); - } - /** - * Derives a child HDNode from the current HDNode using the specified index. - * - * @param {number} index - The child index. - * @returns {HDNode} The derived child HDNode. - * @throws {Error} If the HDNode is not initialized. - */ - deriveChild(index) { - if (!this.node) { - js_moi_utils_1.ErrorUtils.throwError('HDNode not initialized', js_moi_utils_1.ErrorCode.NOT_INITIALIZED); - } - const childNode = this.node.deriveChild(index); - return new HDNode(childNode); - } - /** - * Retrieves the public key associated with the HDNode. - * - * @returns {Buffer} The public key. - * @throws {Error} If the HDNode is not initialized. - */ - publicKey() { - if (!this.node) { - js_moi_utils_1.ErrorUtils.throwError("HDNode not initialized", js_moi_utils_1.ErrorCode.NOT_INITIALIZED); - } - return this.node._publicKey; - } - /** - * Retrieves the private key associated with the HDNode. - * - * @returns {Buffer} The private key. - * @throws {Error} If the HDNode is not initialized or private key is not available. - */ - privateKey() { - if (!this.node) { - js_moi_utils_1.ErrorUtils.throwError("HDNode not initialized", js_moi_utils_1.ErrorCode.NOT_INITIALIZED); - } - if (!this.node.privateKey) { - js_moi_utils_1.ErrorUtils.throwError("Private key not available in the HDNode", js_moi_utils_1.ErrorCode.PROPERTY_NOT_DEFINED); - } - return this.node._privateKey; - } -} -exports.HDNode = HDNode; diff --git a/packages/js-moi-hdnode/dist/index.d.ts b/packages/js-moi-hdnode/dist/index.d.ts deleted file mode 100644 index 9a7f9042..00000000 --- a/packages/js-moi-hdnode/dist/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./hdnode"; diff --git a/packages/js-moi-hdnode/dist/index.js b/packages/js-moi-hdnode/dist/index.js deleted file mode 100644 index 6607d468..00000000 --- a/packages/js-moi-hdnode/dist/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./hdnode"), exports); diff --git a/packages/js-moi-logic/__tests__/logic.test.ts b/packages/js-moi-logic/__tests__/logic.test.ts index 7df6fe73..be95bac3 100644 --- a/packages/js-moi-logic/__tests__/logic.test.ts +++ b/packages/js-moi-logic/__tests__/logic.test.ts @@ -8,12 +8,12 @@ import { loadManifestFromFile } from "js-moi-manifest/__tests__/utils/helper"; import { JsonRpcProvider, type InteractionReceipt, type InteractionResponse } from "js-moi-providers"; import { createRoutineOption } from "../src.ts/routine-options"; -const HOST = ""; -const MNEMONIC = ""; +const HOST = ""; +const MNEMONIC = ""; const INITIAL_SUPPLY = 100000000; const SYMBOL = "MOI"; const RECEIVER = "0x4cdc9a1430ca00cbaaab5dcd858236ba75e64b863d69fa799d31854e103ddf72"; -const PATH = "m/44'/6174'/7020'/0/1"; +const PATH = "m/44'/6174'/7020'/0/0"; const PROVIDER = new JsonRpcProvider(HOST); let wallet: Wallet; @@ -147,46 +147,6 @@ describe("Logic", () => { }); }); - describe("logic driver initialized using provider", () => { - let logic: LogicDriver; - - beforeAll(async () => { - if (logicId == null) { - expect(logicId).toBeDefined(); - } - - logic = await getLogicDriver(logicId!, PROVIDER); - }); - - it("should able to retrieve balance of the account", async () => { - const { balance } = await logic.routines.BalanceOf(wallet.getAddress()); - - expect(balance).toBeGreaterThan(0); - }); - - it("should throw an exception in mutating routine call", async () => { - const amount = Math.floor(Math.random() * 1000); - - expect(async () => { - await logic.routines.Transfer(amount, RECEIVER); - }).rejects.toThrow("Mutating routine calls require a signer to be initialized."); - }); - - it("should be able to read from persistent storage", async () => { - const symbol = await logic.persistentState.get((b) => b.entity("symbol")); - - expect(symbol).toBe(SYMBOL); - }); - - it("should throw an exception when reading from persistent storage with invalid key", async () => { - const invalidKey = "invalid-key"; - - expect(async () => { - await logic.persistentState.get((b) => b.entity(invalidKey)); - }).rejects.toThrow(`'${invalidKey}' is not member of persistent state`); - }); - }); - let logic: LogicDriver; beforeAll(async () => { diff --git a/packages/js-moi-logic/__tests__/persistant-state.test.ts b/packages/js-moi-logic/__tests__/persistant-state.test.ts index 87c2f903..6c14fb22 100644 --- a/packages/js-moi-logic/__tests__/persistant-state.test.ts +++ b/packages/js-moi-logic/__tests__/persistant-state.test.ts @@ -8,9 +8,10 @@ import { LogicFactory } from "../src.ts/logic-factory"; import { ArrayIndexAccessor, ClassFieldAccessor, generateStorageKey, LengthAccessor, PropertyAccessor, StorageKey } from "../src.ts/state/accessor"; import { loadManifestFromFile } from "./utils/utils"; -const MNEMONIC = "laptop hybrid ripple unaware entire cover flag rally deliver adjust nerve ready"; -const PATH = "m/44'/6174'/0'/0/1"; -const PROVIDER = new JsonRpcProvider("http://localhost:1600"); +const HOST = ""; +const MNEMONIC = ""; +const PATH = "m/44'/6174'/7020'/0/0"; +const PROVIDER = new JsonRpcProvider(HOST); const wallet = Wallet.fromMnemonicSync(MNEMONIC, PATH); wallet.connect(PROVIDER); @@ -125,11 +126,11 @@ describe("Accessing Persistance Storage", () => { await new Promise((resolve) => setTimeout(resolve, 3000)); // This is wait time as instantly fetching logic causing logic not found error - logic = await getLogicDriver(result.logic_id, PROVIDER); + logic = await getLogicDriver(result.logic_id, wallet); }); test("it should return the size of the map", async () => { - const length = await logic.persistentState.get((accessor) => accessor.entity("balances")); + const length = await logic.persistentState.get((accessor) => accessor.entity("Balances")); expect(typeof length).toBe("number"); expect(length).toBe(1); @@ -137,14 +138,14 @@ describe("Accessing Persistance Storage", () => { test("it should able access value of map", async () => { const address = hexToBytes(wallet.address); - const balance = await logic.persistentState.get((accessor) => accessor.entity("balances").property(address)); + const balance = await logic.persistentState.get((accessor) => accessor.entity("Balances").property(address)); expect(typeof balance).toBe("number"); expect(balance).toBe(supply); }); test("it should be able to access primitive in state", async () => { - const value = await logic.persistentState.get((accessor) => accessor.entity("symbol")); + const value = await logic.persistentState.get((accessor) => accessor.entity("Symbol")); expect(typeof value).toBe("string"); expect(value).toBe(symbol); diff --git a/packages/js-moi-logic/lib.cjs/logic-base.d.ts b/packages/js-moi-logic/lib.cjs/logic-base.d.ts index f5935f47..36127cf3 100644 --- a/packages/js-moi-logic/lib.cjs/logic-base.d.ts +++ b/packages/js-moi-logic/lib.cjs/logic-base.d.ts @@ -16,7 +16,7 @@ export declare abstract class LogicBase extends ElementDescriptor { protected signer?: Signer; protected provider: AbstractProvider; protected manifestCoder: ManifestCoder; - constructor(manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider); + constructor(manifest: LogicManifest.Manifest, signer: Signer); protected abstract createPayload(ixObject: LogicIxObject): LogicPayload; protected abstract processResult(response: LogicIxResponse, timeout?: number): Promise; /** @@ -34,9 +34,9 @@ export declare abstract class LogicBase extends ElementDescriptor { /** * Updates the signer and provider instances for the LogicBase instance. * - * @param {Signer | AbstractProvider} arg - The signer or provider instance. + * @param {Signer | AbstractProvider} signer - The signer or provider instance. */ - connect(arg: AbstractProvider | Signer): void; + connect(signer: Signer): void; /** * Executes a routine with the given arguments and returns the interaction response. * diff --git a/packages/js-moi-logic/lib.cjs/logic-base.d.ts.map b/packages/js-moi-logic/lib.cjs/logic-base.d.ts.map index bc53435e..2ac4d079 100644 --- a/packages/js-moi-logic/lib.cjs/logic-base.d.ts.map +++ b/packages/js-moi-logic/lib.cjs/logic-base.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-base.d.ts","sourceRoot":"","sources":["../src.ts/logic-base.ts"],"names":[],"mappings":"AAAA,OAAO,E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AAC;IAC1B,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC;IACrC,SAAS,CAAC,aAAa,EAAE,aAAa,CAAC;gBAG3B,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;IAQ5D,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAGvE,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAEtG;;;;OAIG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B;;;;OAIG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAazC;;;;OAIG;IACI,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUpC;;;;;;;;;;OAUG;cACa,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,mBAAmB,CAAC;IAwDxK;;;;;;;OAOG;IACH,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,gBAAgB;IAc1G;;;;;OAKG;IACH,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,cAAc;IAsBlE;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,cAAc;CA6B3F"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-base.js b/packages/js-moi-logic/lib.cjs/logic-base.js index 0fef97c3..3db149b8 100644 --- a/packages/js-moi-logic/lib.cjs/logic-base.js +++ b/packages/js-moi-logic/lib.cjs/logic-base.js @@ -19,10 +19,10 @@ class LogicBase extends js_moi_manifest_1.ElementDescriptor { signer; provider; manifestCoder; - constructor(manifest, arg) { - super(manifest); + constructor(manifest, signer) { + super(manifest.elements); this.manifestCoder = new js_moi_manifest_1.ManifestCoder(manifest); - this.connect(arg); + this.connect(signer); } /** * Returns the logic ID associated with the LogicBase instance. @@ -52,15 +52,15 @@ class LogicBase extends js_moi_manifest_1.ElementDescriptor { /** * Updates the signer and provider instances for the LogicBase instance. * - * @param {Signer | AbstractProvider} arg - The signer or provider instance. + * @param {Signer | AbstractProvider} signer - The signer or provider instance. */ - connect(arg) { - if (arg instanceof js_moi_signer_1.Signer) { - this.signer = arg; - this.provider = arg.getProvider(); + connect(signer) { + if (signer instanceof js_moi_signer_1.Signer) { + this.signer = signer; + this.provider = signer.getProvider(); return; } - this.provider = arg; + this.provider = signer; } /** * Executes a routine with the given arguments and returns the interaction response. diff --git a/packages/js-moi-logic/lib.cjs/logic-base.js.map b/packages/js-moi-logic/lib.cjs/logic-base.js.map index 51380105..52544f33 100644 --- a/packages/js-moi-logic/lib.cjs/logic-base.js.map +++ b/packages/js-moi-logic/lib.cjs/logic-base.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-base.js","sourceRoot":"","sources":["../src.ts/logic-base.ts"],"names":[],"mappings":";;;AAAA,qDAAkF;AAGlF,iDAAuC;AACvC,+CAA6D;AAG7D,yCAAqC;AACrC,uDAAkD;AAElD;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;GAIG;AACH,MAAsB,SAAU,SAAQ,mCAAiB;IAC3C,MAAM,CAAU;IAChB,QAAQ,CAAmB;IAC3B,aAAa,CAAgB;IAGvC,YAAY,QAAgC,EAAE,GAA8B;QACxE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACf,IAAI,CAAC,aAAa,GAAG,IAAI,+BAAa,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,CA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MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,kBAAkB,CAAC;YAE1D,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAiC,CAAA;QACxF,CAAC,CAAA;QAED,QAAQ,CAAC,YAAY,GAAG,GAA2B,EAAE;YACjD,OAAO,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,UAAU,EAAE,MAAM,CAA6B,CAAA;QACxF,CAAC,CAAA;QAED,QAAQ,CAAC,aAAa,GAAG,GAAiB,EAAE;YACxC,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QACvC,CAAC,CAAA;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;CACJ;AAtND,8BAsNC"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts b/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts index 3c83d01a..da8502df 100644 --- a/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts +++ b/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts @@ -1,5 +1,4 @@ import { LogicManifest } from "js-moi-manifest"; -import type { AbstractProvider } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { LogicBase } from "./logic-base"; import { LogicId } from "./logic-id"; @@ -18,7 +17,7 @@ export declare abstract class LogicDescriptor extends LogicBase { protected engine: EngineKind; protected sealed: boolean; protected assetLogic: boolean; - constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider); + constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer); /** * Returns the logic id of the logic. * diff --git a/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts.map b/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts.map index 433aa602..e17f5f6d 100644 --- a/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts.map +++ b/packages/js-moi-logic/lib.cjs/logic-descriptor.d.ts.map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CAAC;IAU9C;;;;;;OAMG;IACI,iBAAiB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;CAShD"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-descriptor.js b/packages/js-moi-logic/lib.cjs/logic-descriptor.js index 52d5b028..377e499d 100644 --- a/packages/js-moi-logic/lib.cjs/logic-descriptor.js +++ b/packages/js-moi-logic/lib.cjs/logic-descriptor.js @@ -20,8 +20,8 @@ class LogicDescriptor extends logic_base_1.LogicBase { engine; sealed; assetLogic; - constructor(logicId, manifest, arg) { - super(manifest, arg); + constructor(logicId, manifest, signer) { + super(manifest, signer); this.logicId = new logic_id_1.LogicId(logicId); this.manifest = manifest; this.encodedManifest = js_moi_manifest_1.ManifestCoder.encodeManifest(this.manifest); diff --git a/packages/js-moi-logic/lib.cjs/logic-descriptor.js.map b/packages/js-moi-logic/lib.cjs/logic-descriptor.js.map index 622eec30..c68800a0 100644 --- a/packages/js-moi-logic/lib.cjs/logic-descriptor.js.map +++ b/packages/js-moi-logic/lib.cjs/logic-descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-descriptor.js","sourceRoot":"","sources":["../src.ts/logic-descriptor.ts"],"names":[],"mappings":";;;AAAA,qDAAiF;AAGjF,6CAAyC;AACzC,yCAAqC;AAErC,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,sBAAS;IACzC,OAAO,CAAU;IACjB,QAAQ,CAAyB;IACjC,eAAe,CAAS;IACxB,MAAM,CAAa;IACnB,MAAM,CAAU;IAChB,UAAU,CAAU;IAE9B,YAAY,OAAe,EAAE,QAAgC,EAAE,GAA8B;QACzF,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,OAAO,CAAC,CAA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;OAMG;IACI,iBAAiB;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,kCAAgB,CAAC,cAAc,CAAC,CAAC;QAElE,IAAG,GAAG,KAAK,SAAS,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtB,CAAC;CACJ;AA3HD,0CA2HC"} \ No newline at end of file +{"version":3,"file":"logic-descriptor.js","sourceRoot":"","sources":["../src.ts/logic-descriptor.ts"],"names":[],"mappings":";;;AAAA,qDAAiF;AAEjF,6CAAyC;AACzC,yCAAqC;AAErC,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,0BAAV,UAAU,QAGrB;AAED;;;GAGG;AACH,MAAsB,eAAgB,SAAQ,sBAAS;IACzC,OAAO,CAAU;IACjB,QAAQ,CAAyB;IACjC,eAAe,CAAS;IACxB,MAAM,CAAa;IACnB,MAAM,CAAU;IAChB,UAAU,CAAU;IAE9B,YAAY,OAAe,EAAE,QAAgC,EAAE,MAAc;QACzE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,kBAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,+BAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAkB,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,C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.cjs/logic-driver.d.ts index 24b9bbdb..855f5054 100644 --- a/packages/js-moi-logic/lib.cjs/logic-driver.d.ts +++ b/packages/js-moi-logic/lib.cjs/logic-driver.d.ts @@ -1,5 +1,5 @@ import { LogicManifest } from "js-moi-manifest"; -import { LogicPayload, Options, type AbstractProvider } from "js-moi-providers"; +import { LogicPayload, Options } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { LogicIxObject, LogicIxResponse } from "../types/interaction"; import { Routines } from "../types/logic"; @@ -12,8 +12,7 @@ export declare class LogicDriver any> readonly routines: Routines; readonly persistentState: PersistentState; readonly ephemeralState: EphemeralState; - constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer); - constructor(logicId: string, manifest: LogicManifest.Manifest, provider: AbstractProvider); + constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer); /** * Creates the persistent and ephemeral states for the logic driver, if available in logic manifest. @@ -48,38 +47,14 @@ export declare class LogicDriver any> */ protected processResult(response: LogicIxResponse, timeout?: number): Promise; } -type LogicRoutines = Record any>; -interface GetLogicDriver { - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {Signer} signer - The signer instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, signer: Signer, options?: Options): Promise>; - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {AbstractProvider} provider - The provider instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, provider: AbstractProvider, options?: Options): Promise>; -} /** * Returns a logic driver instance based on the given logic id. * * @param {string} logicId - The logic id of the logic. - * @param {Signer | AbstractProvider} signerOrProvider - The instance of the `Signer` or `AbstractProvider`. + * @param {Signer} signer - The signer instance for the logic driver. * @param {Options} options - The custom tesseract options for retrieving * * @returns {Promise} A promise that resolves to a LogicDriver instance. */ -export declare const getLogicDriver: GetLogicDriver; -export {}; +export declare const getLogicDriver: any>>(logicId: string, signer: Signer, options?: Options) => Promise>; //# sourceMappingURL=logic-driver.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-driver.d.ts.map b/packages/js-moi-logic/lib.cjs/logic-driver.d.ts.map index cc9c1956..08b52198 100644 --- a/packages/js-moi-logic/lib.cjs/logic-driver.d.ts.map +++ b/packages/js-moi-logic/lib.cjs/logic-driver.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-driver.d.ts","sourceRoot":"","sources":["../src.ts/logic-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,CAAE,SAAQ,eAAe;IACnG,SAAgB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAqB;IAC1D,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,cAAc,EAAE,cAAc,CAAC;gBAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;gBACjE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE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-logic/lib.cjs/logic-driver.js +++ b/packages/js-moi-logic/lib.cjs/logic-driver.js @@ -1,7 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLogicDriver = exports.LogicDriver = void 0; -const js_moi_signer_1 = require("js-moi-signer"); const js_moi_utils_1 = require("js-moi-utils"); const logic_descriptor_1 = require("./logic-descriptor"); const routine_options_1 = require("./routine-options"); @@ -94,7 +93,7 @@ class LogicDriver extends logic_descriptor_1.LogicDescriptor { }; if (ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments(ixObject.routine.accepts, ixObject.arguments); + const calldata = this.manifestCoder.encodeArguments(ixObject.routine.name, ...ixObject.arguments); payload.calldata = (0, js_moi_utils_1.hexToBytes)(calldata); } return payload; @@ -110,9 +109,8 @@ class LogicDriver extends logic_descriptor_1.LogicDescriptor { */ async processResult(response, timeout) { try { - const routine = this.getRoutineElement(response.routine_name); const result = await response.result(timeout); - return this.manifestCoder.decodeOutput(routine.data["returns"], result.outputs); + return this.manifestCoder.decodeOutput(response.routine_name, result.outputs); } catch (err) { throw err; @@ -124,21 +122,17 @@ exports.LogicDriver = LogicDriver; * Returns a logic driver instance based on the given logic id. * * @param {string} logicId - The logic id of the logic. - * @param {Signer | AbstractProvider} signerOrProvider - The instance of the `Signer` or `AbstractProvider`. + * @param {Signer} signer - The signer instance for the logic driver. * @param {Options} options - The custom tesseract options for retrieving * * @returns {Promise} A promise that resolves to a LogicDriver instance. */ -const getLogicDriver = async (logicId, signerOrProvider, options) => { - const provider = signerOrProvider instanceof js_moi_signer_1.Signer ? signerOrProvider.getProvider() : signerOrProvider; - const manifest = await provider.getLogicManifest(logicId, "JSON", options); +const getLogicDriver = async (logicId, signer, options) => { + const manifest = await signer.getProvider().getLogicManifest(logicId, "JSON", options); if (typeof manifest !== "object") { js_moi_utils_1.ErrorUtils.throwError("Invalid logic manifest", js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); } - // below check added for type safety - return signerOrProvider instanceof js_moi_signer_1.Signer - ? new LogicDriver(logicId, manifest, signerOrProvider) - : new LogicDriver(logicId, manifest, signerOrProvider); + return new LogicDriver(logicId, manifest, signer); }; exports.getLogicDriver = getLogicDriver; //# sourceMappingURL=logic-driver.js.map \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-driver.js.map b/packages/js-moi-logic/lib.cjs/logic-driver.js.map index dcb6b4a6..7f42078c 100644 --- a/packages/js-moi-logic/lib.cjs/logic-driver.js.map +++ b/packages/js-moi-logic/lib.cjs/logic-driver.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-driver.js","sourceRoot":"","sources":["../src.ts/logic-driver.ts"],"names":[],"mappings":";;;AAEA,iDAAuC;AACvC,+CAAiF;AAGjF,yDAAqD;AACrD,uDAAkD;AAClD,mCAA0D;AAE1D;;GAEG;AACH,MAAa,WAAmE,SAAQ,kCAAe;IACnF,QAAQ,GAAgB,EAAiB,CAAC;IAC1C,eAAe,CAAkB;IACjC,cAAc,CAAiB;IAI/C,YAAY,OAAe,EAAE,QAAgC,EAAE,GAA8B;QACzF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,WAAW;QACf,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAElD,IAAG,cAAc,EAAE,CAAC;YAChB,MAAM,eAAe,GAAG,IAAI,uBAAe,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjE,IAAA,6BAAc,EAAC,IAAI,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAA;QAC5D,CAAC;QAED,IAAG,YAAY,EAAE,CAAC;YACd,MAAM,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CAAC,QAAQ,GAAG,IAAA,yBAAU,EAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,aAAa,CAAC,QAAyB,EAAE,OAAgB;QACrE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClF,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CACJ;AArID,kCAqIC;AAED;;;;;;;;GAQG;AACI,MAAM,cAAc,GAAG,KAAK,EAAmD,OAAe,EAAE,MAAc,EAAE,OAAiB,EAA2B,EAAE;IACjK,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,yBAAU,CAAC,UAAU,CACjB,wBAAwB,EACxB,wBAAS,CAAC,gBAAgB,CAC7B,CAAC;IACN,CAAC;IAED,OAAO,IAAI,WAAW,CAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC,CAAA;AAXY,QAAA,cAAc,kBAW1B"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-factory.d.ts.map b/packages/js-moi-logic/lib.cjs/logic-factory.d.ts.map index db977505..098ac5bc 100644 --- a/packages/js-moi-logic/lib.cjs/logic-factory.d.ts.map +++ b/packages/js-moi-logic/lib.cjs/logic-factory.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-factory.d.ts","sourceRoot":"","sources":["../src.ts/logic-factory.ts"],"names":[],"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AE,MAAM,sBAAsB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACvC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,eAAe,CAAS;gBAEpB,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;IAM5D;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAc9D;;;;;;OAMG;cACa,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAalG;;;;OAIG;IACI,kBAAkB,IAAI,MAAM;IAInC;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAgC9G"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/logic-factory.js b/packages/js-moi-logic/lib.cjs/logic-factory.js index a11c47b7..02d35ff7 100644 --- a/packages/js-moi-logic/lib.cjs/logic-factory.js +++ b/packages/js-moi-logic/lib.cjs/logic-factory.js @@ -28,7 +28,7 @@ class LogicFactory extends logic_base_1.LogicBase { callsite: ixObject.routine.name }; if (ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments(ixObject.routine.accepts, ixObject.arguments); + const calldata = this.manifestCoder.encodeArguments(payload.callsite, ...ixObject.arguments); payload.calldata = (0, js_moi_utils_1.hexToBytes)(calldata); } return payload; diff --git a/packages/js-moi-logic/lib.cjs/logic-factory.js.map b/packages/js-moi-logic/lib.cjs/logic-factory.js.map index 306e93b0..a8d9e997 100644 --- a/packages/js-moi-logic/lib.cjs/logic-factory.js.map +++ b/packages/js-moi-logic/lib.cjs/logic-factory.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-factory.js","sourceRoot":"","sources":["../src.ts/logic-factory.ts"],"names":[],"mappings":";;;AAAA,qDAA+D;AAG/D,+CAAiE;AAEjE,6CAAyC;AACzC,uDAAkD;AAElD;;GAEG;AACH,MAAa,YAAa,SAAQ,sBAAS;IAC/B,QAAQ,CAAyB;IACjC,eAAe,CAAS;IAEhC,YAAY,QAAgC,EAAE,MAAc;QACxD,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,+BAAa,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;IAED;;;;;OAKG;IACO,aAAa,CAAC,QAAuB;QAC3C,MAAM,OAAO,GAAG;YACZ,QAAQ,EAAE,IAAA,yBAAU,EAAC,IAAI,CAAC,eAAe,CAAC;YAC1C,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI;SAClB,CAAC;QAElB,IAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC9E,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,eAAe,CAC/C,QAAQ,CAAC,OAAO,CAAC,OAAO,EACxB,QAAQ,CAAC,SAAS,CACrB,CAAC;YACF,OAAO,CAAC,QAAQ,GAAG,IAAA,yBAAU,EAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;;;OAMG;IACO,KAAK,CAAC,aAAa,CAAC,QAAyB,EAAE,OAAgB;QACrE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MA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EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,+BAAa,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAGpG,IAAG,cAAc,CAAC,OAAO,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClF,yBAAU,CAAC,UAAU,CACjB,6CAA6C,EAC7C,wBAAS,CAAC,gBAAgB,CAC7B,CAAC;YACN,CAAC;YAED,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/D,CAAC;QAED,yBAAU,CAAC,UAAU,CACjB,0CAA0C,EAC1C,wBAAS,CAAC,gBAAgB,CAC7B,CAAC;IACN,CAAC;CACJ;AAnGD,oCAmGC"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/routine-options.d.ts.map b/packages/js-moi-logic/lib.cjs/routine-options.d.ts.map index 5ece0f7d..36598885 100644 --- a/packages/js-moi-logic/lib.cjs/routine-options.d.ts.map +++ b/packages/js-moi-logic/lib.cjs/routine-options.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"routine-options.d.ts","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AACA,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,YAAW,cAAc;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;gBACd,OAAO,GAAE,cAAmB;CAK3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAY,cAAc,KAAG,aAE5D,CAAA"} \ No newline at end of file +{"version":3,"file":"routine-options.d.ts","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AACA,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,YAAW,cAAc;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEd,OAAO,GAAE,cAAmB;CAM3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAY,cAAc,KAAG,aAE5D,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.cjs/routine-options.js b/packages/js-moi-logic/lib.cjs/routine-options.js index 8a57e178..d7f85fad 100644 --- a/packages/js-moi-logic/lib.cjs/routine-options.js +++ b/packages/js-moi-logic/lib.cjs/routine-options.js @@ -7,7 +7,8 @@ class RoutineOption { fuelLimit; fuelPrice; constructor(options = {}) { - for (const key of Object.keys(options)) { + const keys = Object.keys(options); + for (const key of keys) { this[key] = options[key]; } } diff --git a/packages/js-moi-logic/lib.cjs/routine-options.js.map b/packages/js-moi-logic/lib.cjs/routine-options.js.map index 5dc65a13..ec1be6d8 100644 --- a/packages/js-moi-logic/lib.cjs/routine-options.js.map +++ b/packages/js-moi-logic/lib.cjs/routine-options.js.map @@ -1 +1 @@ -{"version":3,"file":"routine-options.js","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAa;IACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,SAAS,CAAU;IAC1B,YAAY,UAA0B,EAAE;QACpC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;IACL,CAAC;CACJ;AAVD,sCAUC;AAED;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAsB,EAAiB,EAAE;IACzE,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B"} \ No newline at end of file +{"version":3,"file":"routine-options.js","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAa;IACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,SAAS,CAAU;IAE1B,YAAY,UAA0B,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAgC,CAAA;QAChE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,GAAiC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1D,CAAC;IACL,CAAC;CACJ;AAZD,sCAYC;AAED;;;;;GAKG;AACI,MAAM,mBAAmB,GAAG,CAAC,MAAsB,EAAiB,EAAE;IACzE,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-base.d.ts b/packages/js-moi-logic/lib.esm/logic-base.d.ts index f5935f47..36127cf3 100644 --- a/packages/js-moi-logic/lib.esm/logic-base.d.ts +++ b/packages/js-moi-logic/lib.esm/logic-base.d.ts @@ -16,7 +16,7 @@ export declare abstract class LogicBase extends ElementDescriptor { protected signer?: Signer; protected provider: AbstractProvider; protected manifestCoder: ManifestCoder; - constructor(manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider); + constructor(manifest: LogicManifest.Manifest, signer: Signer); protected abstract createPayload(ixObject: LogicIxObject): LogicPayload; protected abstract processResult(response: LogicIxResponse, timeout?: number): Promise; /** @@ -34,9 +34,9 @@ export declare abstract class LogicBase extends ElementDescriptor { /** * Updates the signer and provider instances for the LogicBase instance. * - * @param {Signer | AbstractProvider} arg - The signer or provider instance. + * @param {Signer | AbstractProvider} signer - The signer or provider instance. */ - connect(arg: AbstractProvider | Signer): void; + connect(signer: Signer): void; /** * Executes a routine with the given arguments and returns the interaction response. * diff --git a/packages/js-moi-logic/lib.esm/logic-base.d.ts.map b/packages/js-moi-logic/lib.esm/logic-base.d.ts.map index bc53435e..2ac4d079 100644 --- a/packages/js-moi-logic/lib.esm/logic-base.d.ts.map +++ b/packages/js-moi-logic/lib.esm/logic-base.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-base.d.ts","sourceRoot":"","sources":["../src.ts/logic-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAA0B,uBAAuB,EAAqB,mBAAmB,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzI,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAyB,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAOlD;;;;GAIG;AACH,8BAAsB,SAAU,SAAQ,iBAAiB;IACr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;cACa,cAAc,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,mBAAmB,CAAC;IAwDxK;;;;;;;OAOG;IACH,SAAS,CAAC,gBAAgB,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,gBAAgB;IAc1G;;;;;OAKG;IACH,SAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,cAAc;IAsBlE;;;;;;OAMG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,cAAc;CA6B3F"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-base.js b/packages/js-moi-logic/lib.esm/logic-base.js index b5f01be6..7b481c8e 100644 --- a/packages/js-moi-logic/lib.esm/logic-base.js +++ b/packages/js-moi-logic/lib.esm/logic-base.js @@ -16,10 +16,10 @@ export class LogicBase extends ElementDescriptor { signer; provider; manifestCoder; - constructor(manifest, arg) { - super(manifest); + constructor(manifest, signer) { + super(manifest.elements); this.manifestCoder = new ManifestCoder(manifest); - this.connect(arg); + this.connect(signer); } /** * Returns the logic ID associated with the LogicBase instance. @@ -49,15 +49,15 @@ export class LogicBase extends ElementDescriptor { /** * Updates the signer and provider instances for the LogicBase instance. * - * @param {Signer | AbstractProvider} arg - The signer or provider instance. + * @param {Signer | AbstractProvider} signer - The signer or provider instance. */ - connect(arg) { - if (arg instanceof Signer) { - this.signer = arg; - this.provider = arg.getProvider(); + connect(signer) { + if (signer instanceof Signer) { + this.signer = signer; + this.provider = signer.getProvider(); return; } - this.provider = arg; + this.provider = signer; } /** * Executes a routine with the given arguments and returns the interaction response. diff --git a/packages/js-moi-logic/lib.esm/logic-base.js.map b/packages/js-moi-logic/lib.esm/logic-base.js.map index c3859e58..050872b5 100644 --- a/packages/js-moi-logic/lib.esm/logic-base.js.map +++ b/packages/js-moi-logic/lib.esm/logic-base.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-base.js","sourceRoot":"","sources":["../src.ts/logic-base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGlF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG7D,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B;;;;GAIG;AACH,MAAM,OAAgB,SAAU,SAAQ,iBAAiB;IAC3C,MAAM,CAAU;IAChB,QAAQ,CAAmB;IAC3B,aAAa,CAAgB;IAGvC,YAAY,QAAgC,EAAE,GAA8B;QACxE,KAAK,CAAC,QAAQ,CAAC,CAAA;QACf,IAAI,CAAC,aAAa,GAAG,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;QACjD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IACrB,CAAC;IASD;;;;OAIG;IACO,UAAU;QAChB,OAAO,IAAI,OAAO,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED;;;;OAIG;IACO,SAAS,CAAC,IAAY;QAC5B,QAAO,IAAI,EAAC,CAAC;YACT,KAAK,QAAQ;gBACT,OAAO,MAAM,CAAC,YAAY,CAAC;YAC/B,KAAK,QAAQ;gBACT,OAAO,MAAM,CAAC,YAAY,CAAC;YAC/B,KAAK,QAAQ;gBACT,OAAO,MAAM,CAAC,YAAY,CAAC;YAC/B;gBACI,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;IA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CAAA;QACxF,CAAC,CAAA;QAED,QAAQ,CAAC,aAAa,GAAG,GAAiB,EAAE;YACxC,OAAO,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;QACvC,CAAC,CAAA;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts b/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts index 3c83d01a..da8502df 100644 --- a/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts +++ b/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts @@ -1,5 +1,4 @@ import { LogicManifest } from "js-moi-manifest"; -import type { AbstractProvider } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { LogicBase } from "./logic-base"; import { LogicId } from "./logic-id"; @@ -18,7 +17,7 @@ export declare abstract class LogicDescriptor extends LogicBase { protected engine: EngineKind; protected sealed: boolean; protected assetLogic: boolean; - constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider); + constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer); /** * Returns the logic id of the logic. * diff --git a/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts.map b/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts.map index 433aa602..e17f5f6d 100644 --- a/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts.map +++ b/packages/js-moi-logic/lib.esm/logic-descriptor.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-descriptor.d.ts","sourceRoot":"","sources":["../src.ts/logic-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AACjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC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M,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,IAAI,SAAS;CAChB;AAED;;;GAGG;AACH,8BAAsB,eAAgB,SAAQ,SAAS;IACnD,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,CAAC;IAC3C,SAAS,CAAC,eAAe,EAAE,MAAM,CAAC;IAClC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC;IAC7B,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,UAAU,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;IAU7E;;;;OAIG;IACI,UAAU,IAAI,OAAO;IAI5B;;;;OAIG;IACI,SAAS,IAAI,UAAU;IAI9B;;;;OAIG;IACI,WAAW,IAAI,aAAa,CAAC,QAAQ;IAI5C;;;;OAIG;IACI,kBAAkB,IAAI,MAAM;IAInC;;;;OAIG;IACI,QAAQ,IAAI,OAAO;IAI1B;;;;OAIG;IACI,YAAY,IAAI,OAAO;IAI9B;;;;OAIG;IACI,kBAAkB,IAAI,OAAO;IAIpC;;;;OAIG;IACI,UAAU,IAAI,OAAO;IAI5B;;;;;;OAMG;IACI,kBAAkB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;IAU9C;;;;;;OAMG;IACI,iBAAiB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;CAShD"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-descriptor.js b/packages/js-moi-logic/lib.esm/logic-descriptor.js index 54656743..a06d1c05 100644 --- a/packages/js-moi-logic/lib.esm/logic-descriptor.js +++ b/packages/js-moi-logic/lib.esm/logic-descriptor.js @@ -17,8 +17,8 @@ export class LogicDescriptor extends LogicBase { engine; sealed; assetLogic; - constructor(logicId, manifest, arg) { - super(manifest, arg); + constructor(logicId, manifest, signer) { + super(manifest, signer); this.logicId = new LogicId(logicId); this.manifest = manifest; this.encodedManifest = ManifestCoder.encodeManifest(this.manifest); diff --git a/packages/js-moi-logic/lib.esm/logic-descriptor.js.map b/packages/js-moi-logic/lib.esm/logic-descriptor.js.map index 2ae9f31c..93361620 100644 --- a/packages/js-moi-logic/lib.esm/logic-descriptor.js.map +++ b/packages/js-moi-logic/lib.esm/logic-descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-descriptor.js","sourceRoot":"","sources":["../src.ts/logic-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGjF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED;;;GAGG;AACH,MAAM,OAAgB,eAAgB,SAAQ,SAAS;IACzC,OAAO,CAAU;IACjB,QAAQ,CAAyB;IACjC,eAAe,CAAS;IACxB,MAAM,CAAa;IACnB,MAAM,CAAU;IAChB,UAAU,CAAU;IAE9B,YAAY,OAAe,EAAE,QAAgC,EAAE,GAA8B;QACzF,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAkB,CAA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AC;QAED,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtB,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"logic-descriptor.js","sourceRoot":"","sources":["../src.ts/logic-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IAClB,2BAAa,CAAA;IACb,2BAAa,CAAA;AACjB,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB;AAED;;;GAGG;AACH,MAAM,OAAgB,eAAgB,SAAQ,SAAS;IACzC,OAAO,CAAU;IACjB,QAAQ,CAAyB;IACjC,eAAe,CAAS;IACxB,MAAM,CAAa;IACnB,MAAM,CAAU;IAChB,UAAU,CAAU;IAE9B,YAAY,OAAe,EAAE,QAAgC,EAAE,MAAc;QACzE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,aAAa,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAkB,CAAC;QACtD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;OAIG;IACI,SAAS;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,WAAW;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACI,kBAAkB;QACrB,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,YAAY;QACf,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,kBAAkB;QACrB,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,UAAU;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;OAMG;IACI,kBAAkB;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;QAEnE,IAAG,GAAG,KAAK,SAAS,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACI,iBAAiB;QACpB,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAElE,IAAG,GAAG,KAAK,SAAS,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC;QAED,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IACtB,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-driver.d.ts b/packages/js-moi-logic/lib.esm/logic-driver.d.ts index 24b9bbdb..855f5054 100644 --- a/packages/js-moi-logic/lib.esm/logic-driver.d.ts +++ b/packages/js-moi-logic/lib.esm/logic-driver.d.ts @@ -1,5 +1,5 @@ import { LogicManifest } from "js-moi-manifest"; -import { LogicPayload, Options, type AbstractProvider } from "js-moi-providers"; +import { LogicPayload, Options } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { LogicIxObject, LogicIxResponse } from "../types/interaction"; import { Routines } from "../types/logic"; @@ -12,8 +12,7 @@ export declare class LogicDriver any> readonly routines: Routines; readonly persistentState: PersistentState; readonly ephemeralState: EphemeralState; - constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer); - constructor(logicId: string, manifest: LogicManifest.Manifest, provider: AbstractProvider); + constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer); /** * Creates the persistent and ephemeral states for the logic driver, if available in logic manifest. @@ -48,38 +47,14 @@ export declare class LogicDriver any> */ protected processResult(response: LogicIxResponse, timeout?: number): Promise; } -type LogicRoutines = Record any>; -interface GetLogicDriver { - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {Signer} signer - The signer instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, signer: Signer, options?: Options): Promise>; - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {AbstractProvider} provider - The provider instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, provider: AbstractProvider, options?: Options): Promise>; -} /** * Returns a logic driver instance based on the given logic id. * * @param {string} logicId - The logic id of the logic. - * @param {Signer | AbstractProvider} signerOrProvider - The instance of the `Signer` or `AbstractProvider`. + * @param {Signer} signer - The signer instance for the logic driver. * @param {Options} options - The custom tesseract options for retrieving * * @returns {Promise} A promise that resolves to a LogicDriver instance. */ -export declare const getLogicDriver: GetLogicDriver; -export {}; +export declare const getLogicDriver: any>>(logicId: string, signer: Signer, options?: Options) => Promise>; //# sourceMappingURL=logic-driver.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-driver.d.ts.map b/packages/js-moi-logic/lib.esm/logic-driver.d.ts.map index cc9c1956..08b52198 100644 --- a/packages/js-moi-logic/lib.esm/logic-driver.d.ts.map +++ b/packages/js-moi-logic/lib.esm/logic-driver.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-driver.d.ts","sourceRoot":"","sources":["../src.ts/logic-driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,CAAE,SAAQ,eAAe;IACnG,SAAgB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAqB;IAC1D,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,cAAc,EAAE,cAAc,CAAC;gBAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;gBACjE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,gBAAgB;IAOzF;;;OAGG;IACH,OAAO,CAAC,WAAW;IAenB;;OAEG;IACH,OAAO,CAAC,cAAc;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AAErD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,GAAG,GAAG,CAAE,SAAQ,eAAe;IACnG,SAAgB,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAqB;IAC1D,SAAgB,eAAe,EAAE,eAAe,CAAC;IACjD,SAAgB,cAAc,EAAE,cAAc,CAAC;gBAEnC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM;IAM1E;;;OAGG;IACH,OAAO,CAAC,WAAW;IAenB;;OAEG;IACH,OAAO,CAAC,cAAc;IAoDtB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAe9D;;;;;;;;OAQG;cACa,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;CAQtG;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC,WAAW,MAAM,UAAU,MAAM,YAAY,OAAO,KAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAWhK,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-driver.js b/packages/js-moi-logic/lib.esm/logic-driver.js index 944a03f4..8fdf6e9d 100644 --- a/packages/js-moi-logic/lib.esm/logic-driver.js +++ b/packages/js-moi-logic/lib.esm/logic-driver.js @@ -1,4 +1,3 @@ -import { Signer } from "js-moi-signer"; import { ErrorCode, ErrorUtils, defineReadOnly, hexToBytes } from "js-moi-utils"; import { LogicDescriptor } from "./logic-descriptor"; import { RoutineOption } from "./routine-options"; @@ -91,7 +90,7 @@ export class LogicDriver extends LogicDescriptor { }; if (ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments(ixObject.routine.accepts, ixObject.arguments); + const calldata = this.manifestCoder.encodeArguments(ixObject.routine.name, ...ixObject.arguments); payload.calldata = hexToBytes(calldata); } return payload; @@ -107,9 +106,8 @@ export class LogicDriver extends LogicDescriptor { */ async processResult(response, timeout) { try { - const routine = this.getRoutineElement(response.routine_name); const result = await response.result(timeout); - return this.manifestCoder.decodeOutput(routine.data["returns"], result.outputs); + return this.manifestCoder.decodeOutput(response.routine_name, result.outputs); } catch (err) { throw err; @@ -120,20 +118,16 @@ export class LogicDriver extends LogicDescriptor { * Returns a logic driver instance based on the given logic id. * * @param {string} logicId - The logic id of the logic. - * @param {Signer | AbstractProvider} signerOrProvider - The instance of the `Signer` or `AbstractProvider`. + * @param {Signer} signer - The signer instance for the logic driver. * @param {Options} options - The custom tesseract options for retrieving * * @returns {Promise} A promise that resolves to a LogicDriver instance. */ -export const getLogicDriver = async (logicId, signerOrProvider, options) => { - const provider = signerOrProvider instanceof Signer ? signerOrProvider.getProvider() : signerOrProvider; - const manifest = await provider.getLogicManifest(logicId, "JSON", options); +export const getLogicDriver = async (logicId, signer, options) => { + const manifest = await signer.getProvider().getLogicManifest(logicId, "JSON", options); if (typeof manifest !== "object") { ErrorUtils.throwError("Invalid logic manifest", ErrorCode.INVALID_ARGUMENT); } - // below check added for type safety - return signerOrProvider instanceof Signer - ? new LogicDriver(logicId, manifest, signerOrProvider) - : new LogicDriver(logicId, manifest, signerOrProvider); + return new LogicDriver(logicId, manifest, signer); }; //# sourceMappingURL=logic-driver.js.map \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-driver.js.map b/packages/js-moi-logic/lib.esm/logic-driver.js.map index a9262e85..34dea2d0 100644 --- a/packages/js-moi-logic/lib.esm/logic-driver.js.map +++ b/packages/js-moi-logic/lib.esm/logic-driver.js.map @@ -1 +1 @@ -{"version":3,"file":"logic-driver.js","sourceRoot":"","sources":["../src.ts/logic-driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGjF,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,WAAmE,SAAQ,eAAe;IACnF,QAAQ,GAAgB,EAAiB,CAAC;IAC1C,eAAe,CAAkB;IACjC,cAAc,CAAiB;IAI/C,YAAY,OAAe,EAAE,QAAgC,EAAE,GAA8B;QACzF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,WAAW;QACf,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,CAAC;QACrD,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAElD,IAAG,cAAc,EAAE,CAAC;YAChB,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;YACjE,cAAc,CAAC,IAAI,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAA;QAC5D,CAAC;QAED,IAAG,YAAY,EAAE,CAAC;YACd,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,C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C,SAAS,CAAC,CAAC;YAClG,OAAO,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;;;;;;OAQG;IACO,KAAK,CAAC,aAAa,CAAC,QAAyB,EAAE,OAAgB;QACrE,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC9C,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAClF,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;CACJ;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAmD,OAAe,EAAE,MAAc,EAAE,OAAiB,EAA2B,EAAE;IACjK,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvF,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC/B,UAAU,CAAC,UAAU,CACjB,wBAAwB,EACxB,SAAS,CAAC,gBAAgB,CAC7B,CAAC;IACN,CAAC;IAED,OAAO,IAAI,WAAW,CAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-factory.d.ts.map b/packages/js-moi-logic/lib.esm/logic-factory.d.ts.map index db977505..098ac5bc 100644 --- a/packages/js-moi-logic/lib.esm/logic-factory.d.ts.map +++ b/packages/js-moi-logic/lib.esm/logic-factory.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logic-factory.d.ts","sourceRoot":"","sources":["../src.ts/logic-factory.ts"],"names":[],"mappings":"AAA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sBAAsB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;IACvC,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,eAAe,CAAS;gBAEpB,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM;IAM5D;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,aAAa,GAAG,YAAY;IAc9D;;;;;;OAMG;cACa,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAalG;;;;OAIG;IACI,kBAAkB,IAAI,MAAM;IAInC;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,GAAG,GAAG,EAAE,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAgC9G"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/logic-factory.js b/packages/js-moi-logic/lib.esm/logic-factory.js index 2941ee9b..85a1509e 100644 --- a/packages/js-moi-logic/lib.esm/logic-factory.js +++ b/packages/js-moi-logic/lib.esm/logic-factory.js @@ -25,7 +25,7 @@ export class LogicFactory extends LogicBase { callsite: ixObject.routine.name }; if (ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments(ixObject.routine.accepts, ixObject.arguments); + const calldata = this.manifestCoder.encodeArguments(payload.callsite, ...ixObject.arguments); payload.calldata = hexToBytes(calldata); } return payload; diff --git a/packages/js-moi-logic/lib.esm/logic-factory.js.map b/packages/js-moi-logic/lib.esm/logic-factory.js.map index 3cc3c105..cf9f06a7 100644 --- a/packages/js-moi-logic/lib.esm/logic-factory.js.map +++ b/pack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AC,IAAI,CAAC;YACjC,CAAC;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC,CAAC;QAEH,IAAG,OAAO,EAAE,CAAC;YACT,MAAM,cAAc,GAAG,OAAO,CAAC,IAA6B,CAAC;YAE7D,MAAM,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;YAGpG,IAAG,cAAc,CAAC,OAAO,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAClF,UAAU,CAAC,UAAU,CACjB,6CAA6C,EAC7C,SAAS,CAAC,gBAAgB,CAC7B,CAAC;YACN,CAAC;YAED,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/D,CAAC;QAED,UAAU,CAAC,UAAU,CACjB,0CAA0C,EAC1C,SAAS,CAAC,gBAAgB,CAC7B,CAAC;IACN,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/routine-options.d.ts.map b/packages/js-moi-logic/lib.esm/routine-options.d.ts.map index 5ece0f7d..36598885 100644 --- a/packages/js-moi-logic/lib.esm/routine-options.d.ts.map +++ b/packages/js-moi-logic/lib.esm/routine-options.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"routine-options.d.ts","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AACA,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,YAAW,cAAc;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;gBACd,OAAO,GAAE,cAAmB;CAK3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAY,cAAc,KAAG,aAE5D,CAAA"} \ No newline at end of file +{"version":3,"file":"routine-options.d.ts","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AACA,UAAU,cAAc;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,YAAW,cAAc;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEd,OAAO,GAAE,cAAmB;CAM3C;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,WAAY,cAAc,KAAG,aAE5D,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-logic/lib.esm/routine-options.js b/packages/js-moi-logic/lib.esm/routine-options.js index 343646f5..e53e7b72 100644 --- a/packages/js-moi-logic/lib.esm/routine-options.js +++ b/packages/js-moi-logic/lib.esm/routine-options.js @@ -4,7 +4,8 @@ export class RoutineOption { fuelLimit; fuelPrice; constructor(options = {}) { - for (const key of Object.keys(options)) { + const keys = Object.keys(options); + for (const key of keys) { this[key] = options[key]; } } diff --git a/packages/js-moi-logic/lib.esm/routine-options.js.map b/packages/js-moi-logic/lib.esm/routine-options.js.map index 00400375..8ac028d9 100644 --- a/packages/js-moi-logic/lib.esm/routine-options.js.map +++ b/packages/js-moi-logic/lib.esm/routine-options.js.map @@ -1 +1 @@ -{"version":3,"file":"routine-options.js","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,aAAa;IACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,SAAS,CAAU;IAC1B,YAAY,UAA0B,EAAE;QACpC,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YACrC,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC5B,CAAC;IACL,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAsB,EAAiB,EAAE;IACzE,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"routine-options.js","sourceRoot":"","sources":["../src.ts/routine-options.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,aAAa;IACf,KAAK,CAAU;IACf,MAAM,CAAU;IAChB,SAAS,CAAU;IACnB,SAAS,CAAU;IAE1B,YAAY,UAA0B,EAAE;QACpC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAgC,CAAA;QAChE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACrB,IAAI,CAAC,GAAiC,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;QAC1D,CAAC;IACL,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAsB,EAAiB,EAAE;IACzE,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,CAAA;AACpC,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-logic/src.ts/logic-base.ts b/packages/js-moi-logic/src.ts/logic-base.ts index 8c726b64..e585c1cc 100644 --- a/packages/js-moi-logic/src.ts/logic-base.ts +++ b/packages/js-moi-logic/src.ts/logic-base.ts @@ -24,10 +24,10 @@ export abstract class LogicBase extends ElementDescriptor { protected manifestCoder: ManifestCoder; - constructor(manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider) { - super(manifest) + constructor(manifest: LogicManifest.Manifest, signer: Signer) { + super(manifest.elements) this.manifestCoder = new ManifestCoder(manifest); - this.connect(arg) + this.connect(signer) } // abstract methods to be implemented by subclasses @@ -67,15 +67,16 @@ export abstract class LogicBase extends ElementDescriptor { /** * Updates the signer and provider instances for the LogicBase instance. * - * @param {Signer | AbstractProvider} arg - The signer or provider instance. + * @param {Signer | AbstractProvider} signer - The signer or provider instance. */ - public connect(arg: AbstractProvider | Signer): void { - if (arg instanceof Signer) { - this.signer = arg; - this.provider = arg.getProvider(); + public connect(signer: Signer): void { + if (signer instanceof Signer) { + this.signer = signer; + this.provider = signer.getProvider(); return; } - this.provider = arg; + + this.provider = signer; } /** @@ -232,3 +233,5 @@ export abstract class LogicBase extends ElementDescriptor { return this.createIxRequest(ixObject); } } + + diff --git a/packages/js-moi-logic/src.ts/logic-descriptor.ts b/packages/js-moi-logic/src.ts/logic-descriptor.ts index b88e1201..259912d2 100644 --- a/packages/js-moi-logic/src.ts/logic-descriptor.ts +++ b/packages/js-moi-logic/src.ts/logic-descriptor.ts @@ -1,5 +1,4 @@ import { ContextStateKind, LogicManifest, ManifestCoder } from "js-moi-manifest"; -import type { AbstractProvider } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { LogicBase } from "./logic-base"; import { LogicId } from "./logic-id"; @@ -21,8 +20,8 @@ export abstract class LogicDescriptor extends LogicBase { protected sealed: boolean; protected assetLogic: boolean; - constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider) { - super(manifest, arg) + constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer) { + super(manifest, signer) this.logicId = new LogicId(logicId); this.manifest = manifest; this.encodedManifest = ManifestCoder.encodeManifest(this.manifest); diff --git a/packages/js-moi-logic/src.ts/logic-driver.ts b/packages/js-moi-logic/src.ts/logic-driver.ts index cbc5fb27..2bb08d77 100644 --- a/packages/js-moi-logic/src.ts/logic-driver.ts +++ b/packages/js-moi-logic/src.ts/logic-driver.ts @@ -1,5 +1,5 @@ import { LogicManifest } from "js-moi-manifest"; -import { LogicPayload, Options, type AbstractProvider } from "js-moi-providers"; +import { LogicPayload, Options } from "js-moi-providers"; import { Signer } from "js-moi-signer"; import { ErrorCode, ErrorUtils, defineReadOnly, hexToBytes } from "js-moi-utils"; import { LogicIxObject, LogicIxResponse } from "../types/interaction"; @@ -16,9 +16,7 @@ export class LogicDriver any> = any> public readonly persistentState: PersistentState; public readonly ephemeralState: EphemeralState; - constructor(logicId: string, manifest: LogicManifest.Manifest, signer: Signer); - constructor(logicId: string, manifest: LogicManifest.Manifest, provider: AbstractProvider); - constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer | AbstractProvider) { + constructor(logicId: string, manifest: LogicManifest.Manifest, arg: Signer) { super(logicId, manifest, arg) this.createState(); this.createRoutines(); @@ -122,10 +120,7 @@ export class LogicDriver any> = any> if(ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments( - ixObject.routine.accepts, - ixObject.arguments - ); + const calldata = this.manifestCoder.encodeArguments(ixObject.routine.name, ...ixObject.arguments); payload.calldata = hexToBytes(calldata); } @@ -143,54 +138,25 @@ export class LogicDriver any> = any> */ protected async processResult(response: LogicIxResponse, timeout?: number): Promise { try { - const routine = this.getRoutineElement(response.routine_name) const result = await response.result(timeout); - - return this.manifestCoder.decodeOutput(routine.data["returns"], result.outputs); + return this.manifestCoder.decodeOutput(response.routine_name, result.outputs); } catch(err) { throw err; } } } -type LogicRoutines = Record any>; - -interface GetLogicDriver { - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {Signer} signer - The signer instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, signer: Signer, options?: Options): Promise>; - - /** - * Returns a logic driver instance based on the given logic id. - * - * @param {string} logicId - The logic id of the logic. - * @param {AbstractProvider} provider - The provider instance. - * @param {Options} options - The custom tesseract options for retrieving - * logic manifest. (optional) - * @returns {Promise} A promise that resolves to a LogicDriver instance. - */ - (logicId: string, provider: AbstractProvider, options?: Options): Promise>; -} - /** * Returns a logic driver instance based on the given logic id. * * @param {string} logicId - The logic id of the logic. - * @param {Signer | AbstractProvider} signerOrProvider - The instance of the `Signer` or `AbstractProvider`. + * @param {Signer} signer - The signer instance for the logic driver. * @param {Options} options - The custom tesseract options for retrieving * * @returns {Promise} A promise that resolves to a LogicDriver instance. */ -export const getLogicDriver: GetLogicDriver = async any>>(logicId: string, signerOrProvider: Signer | AbstractProvider, options?: Options): Promise> => { - const provider = signerOrProvider instanceof Signer ? signerOrProvider.getProvider() : signerOrProvider; - const manifest = await provider.getLogicManifest(logicId, "JSON", options); +export const getLogicDriver = async any>>(logicId: string, signer: Signer, options?: Options): Promise> => { + const manifest = await signer.getProvider().getLogicManifest(logicId, "JSON", options); if (typeof manifest !== "object") { ErrorUtils.throwError( @@ -199,8 +165,5 @@ export const getLogicDriver: GetLogicDriver = async (logicId, manifest, signerOrProvider) - : new LogicDriver(logicId, manifest, signerOrProvider); + return new LogicDriver(logicId, manifest, signer); } \ No newline at end of file diff --git a/packages/js-moi-logic/src.ts/logic-factory.ts b/packages/js-moi-logic/src.ts/logic-factory.ts index 9f855fe5..a822a921 100644 --- a/packages/js-moi-logic/src.ts/logic-factory.ts +++ b/packages/js-moi-logic/src.ts/logic-factory.ts @@ -32,10 +32,7 @@ export class LogicFactory extends LogicBase { } as LogicPayload; if(ixObject.routine.accepts && Object.keys(ixObject.routine.accepts).length > 0) { - const calldata = this.manifestCoder.encodeArguments( - ixObject.routine.accepts, - ixObject.arguments - ); + const calldata = this.manifestCoder.encodeArguments(payload.callsite, ...ixObject.arguments); payload.calldata = hexToBytes(calldata); } diff --git a/packages/js-moi-logic/src.ts/routine-options.ts b/packages/js-moi-logic/src.ts/routine-options.ts index b40959ec..eed254c5 100644 --- a/packages/js-moi-logic/src.ts/routine-options.ts +++ b/packages/js-moi-logic/src.ts/routine-options.ts @@ -11,9 +11,11 @@ export class RoutineOption implements IRoutineOption { public sender?: string; public fuelLimit?: number; public fuelPrice?: number; + constructor(options: IRoutineOption = {}) { - for (const key of Object.keys(options)) { - this[key] = options[key] + const keys = Object.keys(options) as Array + for (const key of keys) { + this[key as keyof typeof RoutineOption] = options[key] } } } diff --git a/packages/js-moi-manifest/__tests__/abi.test.ts b/packages/js-moi-manifest/__tests__/abi.test.ts index 04eaef4a..6ea3205d 100644 --- a/packages/js-moi-manifest/__tests__/abi.test.ts +++ b/packages/js-moi-manifest/__tests__/abi.test.ts @@ -1,5 +1,6 @@ -import type { LogicManifest } from "../lib.cjs"; +import { type LogicManifest } from "../lib.cjs"; import { ManifestCoder } from "../src.ts/manifest"; +import { ManifestCoderFormat } from "../src.ts/manifest-coder/serialization-format"; import { loadFile, loadManifestFromFile } from "./utils/helper"; describe("Test ManifestCoder", () => { @@ -13,29 +14,57 @@ describe("Test ManifestCoder", () => { test("Encode ABI/Manifest into polo format", async () => { - const encodedABI = ManifestCoder.encodeManifest(await loadManifestFromFile("../../manifests/tokenledger.json")); - expect(encodedABI).toBe(await loadFile("../../manifests/tokenledger-polo.txt")); + const testcases = [ + { + manifest: "../../manifests/tokenledger.json", + expected: "../../manifests/tokenledger.polo", + }, + { + manifest: "../../manifests/flipper.json", + expected: "../../manifests/flipper.polo", + }, + { + manifest: "../../manifests/guardian.json", + expected: "../../manifests/guardian.polo", + }, + { + manifest: "../../manifests/lock-ledger.json", + expected: "../../manifests/lock-ledger.polo", + } + ] + + + await Promise.all(testcases.map(async (testCase) => { + const [manifest, expected] = await Promise.all([ + loadManifestFromFile(testCase.manifest), + loadFile(testCase.expected), + ]); + const polo = ManifestCoder.encodeManifest(manifest); + + expect(polo).toBe(expected); + })); }); describe("Encode arguments into polo format", () => { test("When the field is passed as a routine name", () => { - const args = ["MOI", 100_000_000]; - const calldata = manifestCoder.encodeArguments("Seed", args); + const calldata = manifestCoder.encodeArguments("Seed", "MOI", 100_000_000); expect(calldata).toBe("0x0d6f0665b6019502737570706c790305f5e10073796d626f6c064d4f49"); }); + }); - test("When the field is passed as a routine schema", () => { - const routineElement = manifest.elements.find((element: LogicManifest.Element) => { - element.data = element.data as LogicManifest.Routine; - return element.data.name === "Seed"; - }); - const routine = routineElement?.data as LogicManifest.Routine; - const fields = routine.accepts ? routine.accepts : []; - const args = ["MOI", 100000000]; - const calldata = manifestCoder.encodeArguments(fields, args); + describe("Decode polo encoded arguments", () => { + test("When the field is passed as a routine name", () => { + const calldata = "0x0d6f0665b6019502737570706c790305f5e10073796d626f6c064d4f49"; + const args = ["MOI", 100_000_000]; + const decoded = manifestCoder.decodeArguments<[symbol: string, supply: number]>("Seed", calldata); + + if (decoded) { + for (let i = 0; i < args.length; i++) { + expect(decoded[i]).toEqual(args[i]); + } + } - expect(calldata).toBe("0x0d6f0665b6019502737570706c790305f5e10073796d626f6c064d4f49"); }); }); @@ -48,19 +77,6 @@ describe("Test ManifestCoder", () => { expect(args).toEqual({ balance: expect.any(Number) }); }); - - test("When the field is passed as a routine schema", () => { - const output = "0x0e1f0305f5e100"; - const routineElement = manifest.elements.find((element: LogicManifest.Element) => { - element.data = element.data as LogicManifest.Routine; - return element.data.name === callsite; - }); - const routine = routineElement?.data as LogicManifest.Routine; - const fields = routine.returns ? routine.returns : []; - const decodedOutput = manifestCoder.decodeOutput(fields, output); - - expect(decodedOutput).toEqual({ balance: expect.any(Number) }); - }); }); test("Decode polo encoded exception", () => { @@ -77,15 +93,7 @@ describe("Test ManifestCoder", () => { }); }); - test("Decode polo encoded property of a state", () => { - const data = "0x0652494f"; - const state: any = manifest.elements.find((element) => element.kind === "state"); - const output = manifestCoder.decodeState(data, "Symbol", state?.data.fields); - - expect(output).toBe("RIO"); - }); - - test("Decode event log", () => { + test("Decode polo encoded event log", () => { const testTable = [ { event: "builtin.Log", @@ -111,5 +119,64 @@ describe("Test ManifestCoder", () => { expect(decoded).toEqual(test.expected); } }); - + + test("Decode polo-encoded manifest", async () => { + const testCases = [ + { + manifest: "../../manifests/tokenledger.polo", + expected: "../../manifests/tokenledger.json", + }, + { + manifest: "../../manifests/flipper.polo", + expected: "../../manifests/flipper.json", + }, + { + manifest: "../../manifests/guardian.polo", + expected: "../../manifests/guardian.json", + }, + { + manifest: "../../manifests/lock-ledger.polo", + expected: "../../manifests/lock-ledger.json", + } + ]; + + await Promise.all(testCases.map(async (testCase) => { + const [polo, expected] = await Promise.all([ + loadFile(testCase.manifest), + loadManifestFromFile(testCase.expected), + ]); + + const manifest = ManifestCoder.decodeManifest(polo, ManifestCoderFormat.JSON); + expect(manifest).toEqual(expected); + })); + }); + + test("Encoding JSON into YAML", async () => { + const testCases = [ + { + manifest: "../../manifests/tokenledger.polo", + expected: "../../manifests/tokenledger.json", + }, + { + manifest: "../../manifests/flipper.polo", + expected: "../../manifests/flipper.json", + }, + { + manifest: "../../manifests/guardian.polo", + expected: "../../manifests/guardian.json", + }, + { + manifest: "../../manifests/lock-ledger.polo", + expected: "../../manifests/lock-ledger.json", + } + ]; + + await Promise.all(testCases.map(async (testCase) => { + const polo= await loadFile(testCase.manifest) + const yaml = ManifestCoder.decodeManifest(polo, ManifestCoderFormat.YAML); + + expect(ManifestCoder.encodeManifest(yaml)).toBe(polo); + expect(ManifestCoder.decodeManifest(polo, ManifestCoderFormat.YAML)).toEqual(yaml); + })); + }); }); diff --git a/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts b/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts index f3dd628a..c73b0df5 100644 --- a/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts +++ b/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts @@ -1,28 +1,16 @@ import type { LogicManifest } from "../types/manifest"; import { ContextStateMatrix } from "./context-state-matrix"; -export interface EventDef { - ptr: number; - topics: number; -} -export interface MethodDef { - ptr: number; - class: string; -} -export interface CallSite { - ptr: number; - kind: string; -} /** * This class represents a descriptor for elements in the logic manifest. */ export declare class ElementDescriptor { protected stateMatrix: ContextStateMatrix; protected elements: Map; - protected callSites: Map; + protected callSites: Map; protected classDefs: Map; - protected methodDefs: Map; - protected eventsDef: Map; - constructor(elements: LogicManifest.Element[] | LogicManifest.Manifest); + protected methodDefs: Map; + protected eventsDefs: Map; + constructor(elements: LogicManifest.Element[]); /** * Retrieves the state matrix associated with the ElementDescriptor. * @@ -40,20 +28,20 @@ export declare class ElementDescriptor { * * @returns {Map} The call sites map. */ - getCallsites(): Map; + getCallsites(): Map; /** * Retrieves the map of class definitions associated with the ElementDescriptor. * * @returns {Map} The class definitions map. */ getClassDefs(): Map; - getEvents(): Map; + getEvents(): Map; /** * Retrieves the map of method definitions associated with the ElementDescriptor. * * @returns {Map} The method definitions map. */ - getMethodDefs(): Map; + getMethodDefs(): Map; /** * Retrieves the methods of a class based on the given class name. * diff --git a/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts.map b/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts.map index b67b834e..f0631cd4 100644 --- a/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts.map +++ b/packages/js-moi-manifest/lib.cjs/element-descriptor.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"element-descriptor.d.ts","sourceRoot":"","sources":["../src.ts/element-descriptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAA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GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAI5D;;;;;;OAMG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC;IAkB5E;;;;;;;OAOG;IACI,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO;IAUpE;;;;;;OAMG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO;IAUhE;;;;;;;OAOG;IACI,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO;IAUlE;;;;;;;;OAQG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM;CAS3C"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/element-descriptor.js b/packages/js-moi-manifest/lib.cjs/element-descriptor.js index a4739963..b37be371 100644 --- a/packages/js-moi-manifest/lib.cjs/element-descriptor.js +++ b/packages/js-moi-manifest/lib.cjs/element-descriptor.js @@ -12,12 +12,11 @@ class ElementDescriptor { callSites = new Map(); classDefs = new Map(); methodDefs = new Map(); - eventsDef = new Map(); + eventsDefs = new Map(); constructor(elements) { - const elementsArr = Array.isArray(elements) ? elements : elements.elements; - this.stateMatrix = new context_state_matrix_1.ContextStateMatrix(elementsArr); + this.stateMatrix = new context_state_matrix_1.ContextStateMatrix(elements); // Populate the maps for elements, call sites, class and method definitions. - elementsArr.forEach((element) => { + for (const element of elements) { this.elements.set(element.ptr, element); switch (element.kind) { case "class": @@ -42,12 +41,12 @@ class ElementDescriptor { break; case "event": const eventData = element.data; - this.eventsDef.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); + this.eventsDefs.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); break; default: break; } - }); + } } /** * Retrieves the state matrix associated with the ElementDescriptor. @@ -82,7 +81,7 @@ class ElementDescriptor { return this.classDefs; } getEvents() { - return this.eventsDef; + return this.eventsDefs; } /** * Retrieves the map of method definitions associated with the ElementDescriptor. @@ -167,7 +166,7 @@ class ElementDescriptor { * @throws {Error} if the event name is invalid. */ getEventElement(eventName) { - const eventDef = this.eventsDef.get(eventName); + const eventDef = this.eventsDefs.get(eventName); if (!eventDef) { return js_moi_utils_1.ErrorUtils.throwError(`Invalid event name: ${eventName}`, js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); } diff --git a/packages/js-moi-manifest/lib.cjs/element-descriptor.js.map b/packages/js-moi-manifest/lib.cjs/element-descriptor.js.map index c933583c..2dc518ba 100644 --- a/packages/js-moi-manifest/lib.cjs/element-descriptor.js.map +++ b/packages/js-moi-manifest/lib.cjs/element-descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"element-descriptor.js","sourceRoot":"","sources":["../src.ts/element-descriptor.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AAErD,iEAA4D;AAiB5D;;GAEG;AACH,MAAa,iBAAiB;IAChB,WAAW,CAAqB;IAChC,QAAQ,GAAuC,IAAI,GAAG,EAAE,CAAC;IACzD,SAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC7C,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;IAC3C,UAAU,GAA2B,IAAI,GAAG,EAAE,CAAC;IAC/C,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IAElD,YAAY,QAA0D;QAClE,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC3E,IAAI,CAAC,WAAW,GAAG,IAAI,yCAAkB,CAAC,WAAW,CAAC,CAAC;QAEvD,4EAA4E;QAC5E,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAExC,QAAQ,OAAO,CAAC,IAAI,EAAE,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CAAC,UAAU,CAAC,yBAAyB,UAAU,EAAE,EAAE,wBAAS,CAAC,gBAAgB,CAAC,CAAC;QACpG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,SAAiB;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,yBAAU,CAAC,UAAU,CAAC,uBAAuB,SAAS,EAAE,EAAE,wBAAS,CAAC,gBAAgB,CAAC,CAAC;QACjG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAA+C,CAAC;IACzF,CAAC;CACJ;AA/LD,8CA+LC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/index.d.ts b/packages/js-moi-manifest/lib.cjs/index.d.ts index 5d9d24fb..179ca0ff 100644 --- a/packages/js-moi-manifest/lib.cjs/index.d.ts +++ b/packages/js-moi-manifest/lib.cjs/index.d.ts @@ -1,7 +1,8 @@ export type * from "../types/manifest"; export type * from "../types/response"; +export * from "./manifest"; +export { ManifestCoderFormat } from "./manifest-coder/serialization-format"; export * from "./context-state-matrix"; export * from "./element-descriptor"; -export * from "./manifest"; export * from "./schema"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/index.d.ts.map b/packages/js-moi-manifest/lib.cjs/index.d.ts.map index e37082e9..6a3baded 100644 --- a/packages/js-moi-manifest/lib.cjs/index.d.ts.map +++ b/packages/js-moi-manifest/lib.cjs/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AAEvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AACvC,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/index.js b/packages/js-moi-manifest/lib.cjs/index.js index 390270c6..f64dcd12 100644 --- a/packages/js-moi-manifest/lib.cjs/index.js +++ b/packages/js-moi-manifest/lib.cjs/index.js @@ -14,8 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.ManifestCoderFormat = void 0; +__exportStar(require("./manifest"), exports); +var serialization_format_1 = require("./manifest-coder/serialization-format"); +Object.defineProperty(exports, "ManifestCoderFormat", { enumerable: true, get: function () { return serialization_format_1.ManifestCoderFormat; } }); __exportStar(require("./context-state-matrix"), exports); __exportStar(require("./element-descriptor"), exports); -__exportStar(require("./manifest"), exports); __exportStar(require("./schema"), exports); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/index.js.map b/packages/js-moi-manifest/lib.cjs/index.js.map index 39b2f7da..662ec314 100644 --- a/packages/js-moi-manifest/lib.cjs/index.js.map +++ b/packages/js-moi-manifest/lib.cjs/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGA,yDAAuC;AACvC,uDAAqC;AACrC,6CAA2B;AAC3B,2CAAyB"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAEA,6CAA2B;AAE3B,8EAA4E;AAAnE,2HAAA,mBAAmB,OAAA;AAE5B,yDAAuC;AACvC,uDAAqC;AACrC,2CAAyB"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts new file mode 100644 index 00000000..d1698a92 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts @@ -0,0 +1,5 @@ +import type { LogicManifest } from "../../types/manifest"; +export declare abstract class BaseManifestCoder { + protected validate(manifest: unknown): manifest is LogicManifest.Manifest; +} +//# sourceMappingURL=base-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts.map new file mode 100644 index 00000000..32612c5e --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/base-manifest-coder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,8BAAsB,iBAAiB;IACnC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,aAAa,CAAC,QAAQ;CAW5E"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js new file mode 100644 index 00000000..c29bef3a --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BaseManifestCoder = void 0; +class BaseManifestCoder { + validate(manifest) { + if (typeof manifest !== "object" || manifest === null) { + return false; + } + if (!("elements" in manifest) || !Array.isArray(manifest.elements)) { + return false; + } + return true; + } +} +exports.BaseManifestCoder = BaseManifestCoder; +//# sourceMappingURL=base-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js.map new file mode 100644 index 00000000..5be9aadd --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/base-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/base-manifest-coder.ts"],"names":[],"mappings":";;;AAEA,MAAsB,iBAAiB;IACzB,QAAQ,CAAC,QAAiB;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,CAAC,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjE,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAZD,8CAYC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts new file mode 100644 index 00000000..5d6ff445 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts @@ -0,0 +1,35 @@ +import type { LogicManifest } from "../../types/manifest"; +import { BaseManifestCoder } from "./base-manifest-coder"; +export declare class JsonManifestCoder extends BaseManifestCoder { + private static MANIFEST_SCHEMA; + private static readonly SCHEMA_CONFIG; + /** + * Serializes a given LogicManifest.Element into a Polorizer instance. + * + * @param element - The LogicManifest.Element to be serialized. + * @returns A Polorizer instance containing the serialized data. + * + * @throws Will throw an error if the element kind is unknown. + */ + private serializeElement; + private deserializeElement; + /** + * Serializes an array of elements from the given manifest. + * + * @param {LogicManifest.Manifest} manifest - The manifest containing the elements to be serialized. + * @returns - The polorizer containing the serialized elements. + */ + private serializeElementArray; + private deserializeElements; + /** + * Serializes a given LogicManifest.Manifest object into a POLO Uint8Array. + * + * @param {LogicManifest.Manifest} manifest - The manifest object to be serialized. + * @returns {Uint8Array} The POLO serialized manifest as a Uint8Array. + * @throws {Error} If the manifest is invalid. + */ + encode(manifest: LogicManifest.Manifest): Uint8Array; + private getPoloBytes; + decode(data: string | Uint8Array): LogicManifest.Manifest; +} +//# sourceMappingURL=json-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts.map new file mode 100644 index 00000000..1281c188 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/json-manifest-coder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,qBAAa,iBAAkB,SAAQ,iBAAiB;IACpD,OAAO,CAAC,MAAM,CAAC,eAAe,CA4B5B;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CA6BnC;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,kBAAkB;IAmC1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,mBAAmB;IAM3B;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,UAAU;IAqBpD,OAAO,CAAC,YAAY;IAIpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC,QAAQ;CAW5D"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js new file mode 100644 index 00000000..43e74975 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js @@ -0,0 +1,161 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JsonManifestCoder = void 0; +const js_moi_utils_1 = require("js-moi-utils"); +const js_polo_1 = require("js-polo"); +const schema_1 = require("../schema"); +const base_manifest_coder_1 = require("./base-manifest-coder"); +class JsonManifestCoder extends base_manifest_coder_1.BaseManifestCoder { + static MANIFEST_SCHEMA = { + kind: "struct", + fields: { + syntax: { + kind: "integer", + }, + engine: schema_1.Schema.PISA_ENGINE_SCHEMA, + elements: { + kind: "array", + fields: { + values: { + kind: "struct", + fields: { + ptr: { + kind: "integer", + }, + deps: schema_1.Schema.PISA_DEPS_SCHEMA, + kind: { + kind: "string", + }, + data: { + kind: "raw", + }, + }, + }, + }, + }, + }, + }; + static SCHEMA_CONFIG = { + constant: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_CONSTANT_SCHEMA, + }, + typedef: { + wireType: js_polo_1.WireType.WIRE_WORD, + schema: schema_1.Schema.PISA_TYPEDEF_SCHEMA, + }, + state: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_STATE_SCHEMA, + }, + routine: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_ROUTINE_SCHEMA, + }, + method: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_METHOD_SCHEMA, + }, + class: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_CLASS_SCHEMA, + }, + event: { + wireType: js_polo_1.WireType.WIRE_PACK, + schema: schema_1.Schema.PISA_EVENT_SCHEMA, + }, + }; + /** + * Serializes a given LogicManifest.Element into a Polorizer instance. + * + * @param element - The LogicManifest.Element to be serialized. + * @returns A Polorizer instance containing the serialized data. + * + * @throws Will throw an error if the element kind is unknown. + */ + serializeElement(element) { + const polorizer = new js_polo_1.Polorizer(); + polorizer.polorizeInteger(element.ptr); + polorizer.polorize(element.deps, schema_1.Schema.PISA_DEPS_SCHEMA); + polorizer.polorizeString(element.kind); + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + if (config == null) { + js_moi_utils_1.ErrorUtils.throwError(`Unknown element kind: ${element.kind}`, js_moi_utils_1.ErrorCode.UNEXPECTED_ARGUMENT); + } + polorizer.polorize(element.data, config.schema); + return polorizer; + } + deserializeElement(element) { + if (element.deps.length == 0) { + delete element.deps; + } + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + if (config == null) { + js_moi_utils_1.ErrorUtils.throwError(`Unknown element kind: ${element.kind}`, js_moi_utils_1.ErrorCode.UNEXPECTED_ARGUMENT); + } + const blob = new Uint8Array([config.wireType, ...element.data]); + element.data = new js_polo_1.Depolorizer(blob).depolorize(config.schema); + const isRoutineOrMethod = element.kind === "routine" || element.kind === "method"; + if (!isRoutineOrMethod) { + return element; + } + for (const [key, value] of Object.entries(element.data.executes)) { + if (value === "" || (Array.isArray(value) && value.length === 0)) { + delete element.data.executes[key]; + } + if (value instanceof Uint8Array) { + element.data.executes[key] = Array.from(value); + } + } + } + /** + * Serializes an array of elements from the given manifest. + * + * @param {LogicManifest.Manifest} manifest - The manifest containing the elements to be serialized. + * @returns - The polorizer containing the serialized elements. + */ + serializeElementArray(manifest) { + const polorizer = new js_polo_1.Polorizer(); + for (const element of manifest.elements) { + polorizer.polorizePacked(this.serializeElement(element)); + } + return polorizer; + } + deserializeElements(elements) { + for (const element of elements) { + this.deserializeElement(element); + } + } + /** + * Serializes a given LogicManifest.Manifest object into a POLO Uint8Array. + * + * @param {LogicManifest.Manifest} manifest - The manifest object to be serialized. + * @returns {Uint8Array} The POLO serialized manifest as a Uint8Array. + * @throws {Error} If the manifest is invalid. + */ + encode(manifest) { + if (!super.validate(manifest)) { + js_moi_utils_1.ErrorUtils.throwArgumentError("Invalid manifest.", "manifest", manifest); + } + const polorizer = new js_polo_1.Polorizer(); + polorizer.polorizeInteger(manifest.syntax); + polorizer.polorize(manifest.engine, schema_1.Schema.PISA_ENGINE_SCHEMA); + const elements = this.serializeElementArray(manifest); + polorizer.polorizePacked(elements); + return polorizer.bytes(); + } + getPoloBytes(data) { + return typeof data === "string" ? (0, js_moi_utils_1.hexToBytes)(data) : data; + } + decode(data) { + const depolorizer = new js_polo_1.Depolorizer(this.getPoloBytes(data)); + const decoded = depolorizer.depolorize(JsonManifestCoder.MANIFEST_SCHEMA); + if (!super.validate(decoded)) { + js_moi_utils_1.ErrorUtils.throwArgumentError("Invalid manifest.", "data", data); + } + this.deserializeElements(decoded.elements); + return decoded; + } +} +exports.JsonManifestCoder = JsonManifestCoder; +//# sourceMappingURL=json-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js.map new file mode 100644 index 00000000..8a748d9a --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/json-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/json-manifest-coder.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,qCAA2D;AAE3D,sCAAmC;AACnC,+DAA0D;A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newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts new file mode 100644 index 00000000..4d05740f --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts @@ -0,0 +1,8 @@ +/** + * Represents the format of a manifest. + */ +export declare enum ManifestCoderFormat { + JSON = "JSON", + YAML = "YAML" +} +//# sourceMappingURL=serialization-format.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts.map new file mode 100644 index 00000000..749aa95a --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"serialization-format.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/serialization-format.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,IAAI,SAAS;IACb,IAAI,SAAS;CAChB"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js new file mode 100644 index 00000000..3b3f6894 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ManifestCoderFormat = void 0; +/** + * Represents the format of a manifest. + */ +var ManifestCoderFormat; +(function (ManifestCoderFormat) { + ManifestCoderFormat["JSON"] = "JSON"; + ManifestCoderFormat["YAML"] = "YAML"; +})(ManifestCoderFormat || (exports.ManifestCoderFormat = ManifestCoderFormat = {})); +//# sourceMappingURL=serialization-format.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js.map new file mode 100644 index 00000000..96c2e889 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/serialization-format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serialization-format.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/serialization-format.ts"],"names":[],"mappings":";;;AACA;;GAEG;AACH,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,oCAAa,CAAA;IACb,oCAAa,CAAA;AACjB,CAAC,EAHW,mBAAmB,mCAAnB,mBAAmB,QAG9B"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts new file mode 100644 index 00000000..1f080c1e --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts @@ -0,0 +1,6 @@ +import { BaseManifestCoder } from "./base-manifest-coder"; +export declare class YamlManifestCoder extends BaseManifestCoder { + encode(yamlManifest: string): Uint8Array; + decode(data: string | Uint8Array): string; +} +//# sourceMappingURL=yaml-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts.map new file mode 100644 index 00000000..da4a9c35 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"yaml-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/yaml-manifest-coder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,qBAAa,iBAAkB,SAAQ,iBAAiB;IAC7C,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU;IAMxC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;CAInD"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js new file mode 100644 index 00000000..d1ca85e4 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.YamlManifestCoder = void 0; +const yaml_1 = require("yaml"); +const base_manifest_coder_1 = require("./base-manifest-coder"); +const json_manifest_coder_1 = require("./json-manifest-coder"); +class YamlManifestCoder extends base_manifest_coder_1.BaseManifestCoder { + encode(yamlManifest) { + const json = (0, yaml_1.parse)(yamlManifest); + return new json_manifest_coder_1.JsonManifestCoder().encode(json); + } + decode(data) { + const coder = new json_manifest_coder_1.JsonManifestCoder(); + return (0, yaml_1.stringify)(coder.decode(data)); + } +} +exports.YamlManifestCoder = YamlManifestCoder; +//# sourceMappingURL=yaml-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js.map b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js.map new file mode 100644 index 00000000..a1e96cb9 --- /dev/null +++ b/packages/js-moi-manifest/lib.cjs/manifest-coder/yaml-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"yaml-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/yaml-manifest-coder.ts"],"names":[],"mappings":";;;AAAA,+BAAwC;AAExC,+DAA0D;AAC1D,+DAA0D;AAG1D,MAAa,iBAAkB,SAAQ,uCAAiB;IAC7C,MAAM,CAAC,YAAoB;QAC9B,MAAM,IAAI,GAAG,IAAA,YAAK,EAAC,YAAY,CAAC,CAAC;QACjC,OAAO,IAAI,uCAAiB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEhD,CAAC;IAEM,MAAM,CAAC,IAAyB;QACnC,MAAM,KAAK,GAAG,IAAI,uCAAiB,EAAE,CAAC;QACtC,OAAO,IAAA,gBAAS,EAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ;AAXD,8CAWC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest.d.ts b/packages/js-moi-manifest/lib.cjs/manifest.d.ts index 069dbd48..35e7ec9c 100644 --- a/packages/js-moi-manifest/lib.cjs/manifest.d.ts +++ b/packages/js-moi-manifest/lib.cjs/manifest.d.ts @@ -1,6 +1,6 @@ import { LogicManifest } from "../types/manifest"; import { Exception } from "../types/response"; -import { ElementDescriptor } from "./element-descriptor"; +import { ManifestCoderFormat } from "./manifest-coder/serialization-format"; /** * ManifestCoder is a class that provides encoding and decoding functionality * for Logic Interface.It allows encoding manifests and arguments, as well as @@ -11,13 +11,6 @@ import { ElementDescriptor } from "./element-descriptor"; */ export declare class ManifestCoder { private readonly elementDescriptor; - /** - * Creates an instance of ManifestCoder. - * - * @param {LogicManifest.Manifest} elementDescriptor - The element descriptor. - * @constructor - */ - constructor(elementDescriptor: ElementDescriptor); /** * Creates an instance of ManifestCoder. * @@ -26,16 +19,6 @@ export declare class ManifestCoder { */ constructor(manifest: LogicManifest.Manifest); private get schema(); - /** - * Encodes a logic manifest into POLO format. The manifest is processed and - * serialized according to the predefined schema. - * Returns the POLO-encoded data as a hexadecimal string prefixed with "0x". - * - * @static - * @param {LogicManifest.Manifest} manifest - The logic manifest to encode. - * @returns {string} The POLO-encoded data. - */ - static encodeManifest(manifest: LogicManifest.Manifest): string; /** * Parses the calldata arguments based on the provided POLO Schema. * The calldata arguments is recursively processed and transformed according to the schema. @@ -48,53 +31,31 @@ export declare class ManifestCoder { */ private parseCalldata; /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. + * Encodes the arguments for a specified routine into a hexadecimal string. * - * @param {LogicManifest.TypeField[]} fields - The fields associated with the routine parameters (arguments). - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @param routine - The name of the routine for which the arguments are being encoded. + * @param args - The arguments to be encoded, passed as a variadic parameter. + * @returns A hexadecimal string representing the encoded arguments. */ - encodeArguments(fields: LogicManifest.TypeField[], args: any[]): string; + encodeArguments(routine: string, ...args: any[]): string; /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). + * Decodes the provided calldata into the expected arguments for a given routine. * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. - * - * @param {string} fields - The name of the routine associated with the arguments. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @template T - The type of the decoded arguments. + * @param {string} routine - The name of the routine whose arguments are to be decoded. + * @param {string} calldata - The calldata to decode. + * @returns {T | null} - The decoded arguments as an object of type T, or null if the routine accepts no arguments. */ - encodeArguments(fields: string, args: any[]): string; + decodeArguments(routine: string, calldata: string): T | null; /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the predefined schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} callsite - The name of the routine associated with the output data. + * Decodes the output of a routine. * - * @returns {T | null} The decoded output data, or null if the output is empty. + * @template T - The type to which the output should be decoded. + * @param {string} routine - The name of the routine whose output is to be decoded. + * @param {string} output - The output string to decode. + * @returns {T | null} - The decoded output as type T, or null if the output is invalid or the routine has no return schema. */ - decodeOutput(callsite: string, output: string): T | null; - /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {LogicManifest.TypeField[]} fields - The fields associated with the output data. - * @returns {unknown | null} The decoded output data, or null if the output is empty. - */ - decodeOutput(field: LogicManifest.TypeField[], output: string): T | null; + decodeOutput(routine: string, output: string): T | null; /** * Decodes a log data from an event emitted in a logic. * @@ -124,17 +85,39 @@ export declare class ManifestCoder { */ static decodeException(error: string): Exception | null; /** - * Decodes a specific state field from the data retrieved from a logic. - * The state data is decoded using the provided fields and schema. - * Returns the decoded value of the specified field, or null if the data is empty. + * Encodes a manifest into a hexadecimal string. * - * @param {string} data - The state data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {string} field - The field to be decoded from the state data. - * @param {LogicManifest.TypeField[]} fields - The fields associated with the state data. - * @returns {unknown | null} The decoded value of the specified field, or - null if the data is empty. + * This function supports encoding both JSON and YAML manifest formats. + * If the input manifest is an object, it is assumed to be a JSON manifest and + * is encoded using the `JsonManifestCoder`. If the input manifest is a string, + * it is assumed to be a YAML manifest and is encoded using the `YamlManifestCoder`. + * + * @param manifest - The manifest to encode. It can be either a string (YAML) or an object (JSON). + * @returns The encoded manifest as a hexadecimal string prefixed with "0x". + * @throws Will throw an error if the manifest type is unsupported. */ - decodeState(data: string, field: string, fields: LogicManifest.TypeField[]): unknown | null; + static encodeManifest(manifest: string | LogicManifest.Manifest): string; + /** + * Decodes a given manifest in either JSON format. + * + * @param manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param format - The format of the manifest in JSON string. + * + * @returns Returns a JSON manifest object. + * + * @throws Throws an error if the format is unsupported. + */ + static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.JSON): LogicManifest.Manifest; + /** + * Decodes a given manifest in either YAML format. + * + * @param {string | Uint8Array} manifest The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format The format of the manifest in YAML string. + * + * @returns {string} Returns a YAML string representation. + * + * @throws {Error} Throws an error if the format is unsupported. + */ + static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.YAML): string; } //# sourceMappingURL=manifest.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest.d.ts.map b/packages/js-moi-manifest/lib.cjs/manifest.d.ts.map index a05e0047..eaf45426 100644 --- a/packages/js-moi-manifest/lib.cjs/manifest.d.ts.map +++ b/packages/js-moi-manifest/lib.cjs/manifest.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src.ts/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;;;;;;GAOG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;IAEtD;;;;;OAKG;gBACS,iBAAiB,EAAE,iBAAiB;IAChD;;;;;OAKG;gBACS,QAAQ,EAAE,aAAa,CAAC,QAAQ;IAQ5C,OAAO,KAAK,MAAM,GAEjB;IAED;;;;;;;;OAQG;WACW,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,MAAM;IAuDtE;;;;;;;;;OASG;IACH,OAAO,CAAC,aAAa;IA4FrB;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM;IAC9E;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM;IA4B3D;;;;;;;;;OASG;IACI,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAClE;;;;;;;;;OASG;IACI,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,aAAa,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAwBlF;;;;;;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AE,MAAM,GAAG,CAAC,GAAG,IAAI;IAYjE;;;;;;OAMG;IACI,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IACrE;;;;;OAKG;IACI,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IA4BzF;;;;;;;;;OASG;WACW,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAU9D;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC,QAAQ,GAAG,MAAM;IAc/E;;;;;;;;;OASG;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ;IACpH;;;;;;;;;MASE;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,GAAG,MAAM;CAwBxG"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/manifest.js b/packages/js-moi-manifest/lib.cjs/manifest.js index 26f4d525..97b245ea 100644 --- a/packages/js-moi-manifest/lib.cjs/manifest.js +++ b/packages/js-moi-manifest/lib.cjs/manifest.js @@ -4,6 +4,9 @@ exports.ManifestCoder = void 0; const js_moi_utils_1 = require("js-moi-utils"); const js_polo_1 = require("js-polo"); const element_descriptor_1 = require("./element-descriptor"); +const json_manifest_coder_1 = require("./manifest-coder/json-manifest-coder"); +const serialization_format_1 = require("./manifest-coder/serialization-format"); +const yaml_manifest_coder_1 = require("./manifest-coder/yaml-manifest-coder"); const schema_1 = require("./schema"); /** * ManifestCoder is a class that provides encoding and decoding functionality @@ -18,64 +21,12 @@ class ManifestCoder { /** * Creates an instance of ManifestCoder. */ - constructor(descriptorOrManifest) { - this.elementDescriptor = descriptorOrManifest instanceof element_descriptor_1.ElementDescriptor ? descriptorOrManifest : new element_descriptor_1.ElementDescriptor(descriptorOrManifest); + constructor(manifest) { + this.elementDescriptor = new element_descriptor_1.ElementDescriptor(manifest.elements); } get schema() { return new schema_1.Schema(this.elementDescriptor.getElements(), this.elementDescriptor.getClassDefs()); } - /** - * Encodes a logic manifest into POLO format. The manifest is processed and - * serialized according to the predefined schema. - * Returns the POLO-encoded data as a hexadecimal string prefixed with "0x". - * - * @static - * @param {LogicManifest.Manifest} manifest - The logic manifest to encode. - * @returns {string} The POLO-encoded data. - */ - static encodeManifest(manifest) { - const polorizer = new js_polo_1.Polorizer(); - polorizer.polorizeInteger(manifest.syntax); - polorizer.polorize(manifest.engine, schema_1.Schema.PISA_ENGINE_SCHEMA); - if (manifest.elements) { - const elements = new js_polo_1.Polorizer(); - manifest.elements.forEach((value) => { - const element = new js_polo_1.Polorizer(); - element.polorizeInteger(value.ptr); - element.polorize(value.deps, schema_1.Schema.PISA_DEPS_SCHEMA); - element.polorizeString(value.kind); - switch (value.kind) { - case "constant": - element.polorize(value.data, schema_1.Schema.PISA_CONSTANT_SCHEMA); - break; - case "typedef": - element.polorize(value.data, schema_1.Schema.PISA_TYPEDEF_SCHEMA); - break; - case "class": - element.polorize(value.data, schema_1.Schema.PISA_CLASS_SCHEMA); - break; - case "method": - element.polorize(value.data, schema_1.Schema.PISA_METHOD_SCHEMA); - break; - case "routine": - element.polorize(value.data, schema_1.Schema.PISA_ROUTINE_SCHEMA); - break; - case "event": - element.polorize(value.data, schema_1.Schema.PISA_EVENT_SCHEMA); - break; - case "state": - element.polorize(value.data, schema_1.Schema.PISA_STATE_SCHEMA); - break; - default: - js_moi_utils_1.ErrorUtils.throwError(`Unsupported kind: ${value.kind}`, js_moi_utils_1.ErrorCode.UNSUPPORTED_OPERATION); - } - elements.polorizePacked(element); - }); - polorizer.polorizePacked(elements); - } - const bytes = polorizer.bytes(); - return "0x" + (0, js_moi_utils_1.bytesToHex)(bytes); - } /** * Parses the calldata arguments based on the provided POLO Schema. * The calldata arguments is recursively processed and transformed according to the schema. @@ -147,45 +98,50 @@ class ManifestCoder { return arg; } /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. + * Encodes the arguments for a specified routine into a hexadecimal string. * - * @param {(LogicManifest.TypeField[] | string)} fields - The fields associated with the routine parameters (arguments) or the name of the routine. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @param routine - The name of the routine for which the arguments are being encoded. + * @param args - The arguments to be encoded, passed as a variadic parameter. + * @returns A hexadecimal string representing the encoded arguments. */ - encodeArguments(fields, args) { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data; - fields = element.accepts; - } - const schema = this.schema.parseFields(fields); - const calldata = Object.values(fields).reduce((acc, field) => { + encodeArguments(routine, ...args) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + const schema = this.schema.parseFields(element.accepts ?? []); + const calldata = Object.values(element.accepts).reduce((acc, field) => { acc[field.label] = this.parseCalldata(schema.fields[field.label], args[field.slot]); return acc; }, {}); return "0x" + (0, js_moi_utils_1.bytesToHex)(((0, js_polo_1.documentEncode)(calldata, schema).bytes())); } /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. + * Decodes the provided calldata into the expected arguments for a given routine. * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} fields - The name of the routine associated with the output data. - * @returns {T | null} The decoded output data, or null if the output is empty. + * @template T - The type of the decoded arguments. + * @param {string} routine - The name of the routine whose arguments are to be decoded. + * @param {string} calldata - The calldata to decode. + * @returns {T | null} - The decoded arguments as an object of type T, or null if the routine accepts no arguments. */ - decodeOutput(fields, output) { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data; - fields = element.returns; + decodeArguments(routine, calldata) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + if (element && element.accepts.length === 0) { + return null; } - if (output && output != "0x" && fields && fields.length) { - const schema = this.schema.parseFields(fields); + const schema = this.schema.parseFields(element.accepts ?? []); + const decodedCalldata = new js_polo_1.Depolorizer((0, js_moi_utils_1.hexToBytes)(calldata)).depolorize(schema); + return element.accepts.map((field) => decodedCalldata[field.label]); + } + /** + * Decodes the output of a routine. + * + * @template T - The type to which the output should be decoded. + * @param {string} routine - The name of the routine whose output is to be decoded. + * @param {string} output - The output string to decode. + * @returns {T | null} - The decoded output as type T, or null if the output is invalid or the routine has no return schema. + */ + decodeOutput(routine, output) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + if (output && output != "0x" && element.returns && element.returns.length) { + const schema = this.schema.parseFields(element.returns); return new js_polo_1.Depolorizer((0, js_moi_utils_1.hexToBytes)(output)).depolorize(schema); } return null; @@ -199,7 +155,7 @@ class ManifestCoder { */ decodeEventOutput(event, logData) { if (event === "builtin.Log") { - return new js_polo_1.Depolorizer((0, js_moi_utils_1.hexToBytes)(logData)).depolorize(js_moi_utils_1.DEFAULT_EVENT_SCHEMA); + return new js_polo_1.Depolorizer((0, js_moi_utils_1.hexToBytes)(logData)).depolorize(js_moi_utils_1.builtInLogEventSchema); } const element = this.elementDescriptor.getEventElement(event); if (element == null) { @@ -231,25 +187,48 @@ class ManifestCoder { return null; } /** - * Decodes a specific state field from the data retrieved from a logic. - * The state data is decoded using the provided fields and schema. - * Returns the decoded value of the specified field, or null if the data is empty. + * Encodes a manifest into a hexadecimal string. * - * @param {string} data - The state data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {string} field - The field to be decoded from the state data. - * @param {LogicManifest.TypeField[]} fields - The fields associated with the state data. - * @returns {unknown | null} The decoded value of the specified field, or - null if the data is empty. + * This function supports encoding both JSON and YAML manifest formats. + * If the input manifest is an object, it is assumed to be a JSON manifest and + * is encoded using the `JsonManifestCoder`. If the input manifest is a string, + * it is assumed to be a YAML manifest and is encoded using the `YamlManifestCoder`. + * + * @param manifest - The manifest to encode. It can be either a string (YAML) or an object (JSON). + * @returns The encoded manifest as a hexadecimal string prefixed with "0x". + * @throws Will throw an error if the manifest type is unsupported. */ - decodeState(data, field, fields) { - if (data && data != "0x") { - const decodedData = (0, js_moi_utils_1.hexToBytes)(data); - const depolorizer = new js_polo_1.Depolorizer(decodedData); - const schema = this.schema.parseFields(fields); - return depolorizer.depolorize(schema.fields[field]); + static encodeManifest(manifest) { + if (typeof manifest === "object" && manifest !== null) { + const serializer = new json_manifest_coder_1.JsonManifestCoder(); + return "0x" + (0, js_moi_utils_1.bytesToHex)(serializer.encode(manifest)); } - return null; + if (typeof manifest === "string") { + const serializer = new yaml_manifest_coder_1.YamlManifestCoder(); + return "0x" + (0, js_moi_utils_1.bytesToHex)(serializer.encode(manifest)); + } + js_moi_utils_1.ErrorUtils.throwError("Unsupported manifest type", js_moi_utils_1.ErrorCode.UNSUPPORTED_OPERATION); + } + /** + * Decodes a given manifest in either JSON or YAML format. + * + * @param {string | Uint8Array} manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format - The format of the manifest, either JSON or YAML. + * + * @returns {LogicManifest.Manifest | string} - Returns a `LogicManifest.Manifest` object if JSON format is used or a string representation if YAML format is used. + * + * @throws {Error} - Throws an error if the format is unsupported. + */ + static decodeManifest(manifest, format) { + if (format === serialization_format_1.ManifestCoderFormat.JSON) { + const serializer = new json_manifest_coder_1.JsonManifestCoder(); + return serializer.decode(manifest); + } + if (format === serialization_format_1.ManifestCoderFormat.YAML) { + const serializer = new yaml_manifest_coder_1.YamlManifestCoder(); + return serializer.decode(manifest); + } + js_moi_utils_1.ErrorUtils.throwError("Unsupported manifest format", js_moi_utils_1.ErrorCode.UNSUPPORTED_OPERATION); } } exports.ManifestCoder = ManifestCoder; diff --git a/packages/js-moi-manifest/lib.cjs/manifest.js.map b/packages/js-moi-manifest/lib.cjs/manifest.js.map index 367f3681..8625dfa4 100644 --- a/packages/js-moi-manifest/lib.cjs/manifest.js.map +++ b/packages/js-moi-manifest/lib.cjs/manifest.js.map @@ -1 +1 @@ -{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src.ts/manifest.ts"],"names":[],"mappings":";;;AAAA,+CAA4H;AAC5H,qCAAuF;AAGvF,6DAAyD;AACzD,qCAAkC;AAElC;;;;;;;GAOG;AACH,MAAa,aAAa;IACL,iBAAiB,CAAoB;IAgBtD;;OAEG;IACH,YAAY,oBAAgE;QACxE,IAAI,CAAC,iBAAiB,GAAG,oBAAoB,YAAY,sCAAiB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,sCAAiB,CAAC,oBAAoB,CAAC,CAAC;IACpJ,CAAC;IAED,IAAY,MAAM;QACd,OAAO,IAAI,eAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc,CAAC,QAAgC;QACzD,MAAM,SAAS,GAAG,IAAI,mBAAS,EAAE,CAAC;QAClC,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAM,CAAC,kBAAkB,CAAC,CAAC;QAE/D,IAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,IAAI,mBAAS,EAAE,CAAC;YAEjC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChC,MAAM,OAAO,GAAG,IAAI,mBAAS,EAAE,CAAC;gBAEhC,OAAO,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnC,OAAO,CAAC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F,IAAI,MAAM,KAAK,0CAAmB,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,uCAAiB,EAAE,CAAC;YAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,MAAM,KAAK,0CAAmB,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,uCAAiB,EAAE,CAAC;YAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,yBAAU,CAAC,UAAU,CAAC,6BAA6B,EAAE,wBAAS,CAAC,qBAAqB,CAAC,CAAC;IAC1F,CAAC;CACJ;AA3TD,sCA2TC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.cjs/schema.js b/packages/js-moi-manifest/lib.cjs/schema.js index 85325828..700cc211 100644 --- a/packages/js-moi-manifest/lib.cjs/schema.js +++ b/packages/js-moi-manifest/lib.cjs/schema.js @@ -48,7 +48,7 @@ class Schema { kind: "string", }, }, - }, + } }, }; static PISA_DEPS_SCHEMA = { diff --git a/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts b/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts index f3dd628a..c73b0df5 100644 --- a/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts +++ b/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts @@ -1,28 +1,16 @@ import type { LogicManifest } from "../types/manifest"; import { ContextStateMatrix } from "./context-state-matrix"; -export interface EventDef { - ptr: number; - topics: number; -} -export interface MethodDef { - ptr: number; - class: string; -} -export interface CallSite { - ptr: number; - kind: string; -} /** * This class represents a descriptor for elements in the logic manifest. */ export declare class ElementDescriptor { protected stateMatrix: ContextStateMatrix; protected elements: Map; - protected callSites: Map; + protected callSites: Map; protected classDefs: Map; - protected methodDefs: Map; - protected eventsDef: Map; - constructor(elements: LogicManifest.Element[] | LogicManifest.Manifest); + protected methodDefs: Map; + protected eventsDefs: Map; + constructor(elements: LogicManifest.Element[]); /** * Retrieves the state matrix associated with the ElementDescriptor. * @@ -40,20 +28,20 @@ export declare class ElementDescriptor { * * @returns {Map} The call sites map. */ - getCallsites(): Map; + getCallsites(): Map; /** * Retrieves the map of class definitions associated with the ElementDescriptor. * * @returns {Map} The class definitions map. */ getClassDefs(): Map; - getEvents(): Map; + getEvents(): Map; /** * Retrieves the map of method definitions associated with the ElementDescriptor. * * @returns {Map} The method definitions map. */ - getMethodDefs(): Map; + getMethodDefs(): Map; /** * Retrieves the methods of a class based on the given class name. * diff --git a/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts.map b/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts.map index b67b834e..f0631cd4 100644 --- a/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts.map +++ b/packages/js-moi-manifest/lib.esm/element-descriptor.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"element-descriptor.d.ts","sourceRoot":"","sources":["../src.ts/element-descriptor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,SAAS;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAA;CACf;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC1B,SAAS,CAAC,WAAW,EAAE,kBAAkB,CAAC;IAC1C,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAa;IACnE,SAAS,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE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;;;;OAOG;IACI,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,CAAC,OAAO;IAUlE;;;;;;;;OAQG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM;CAS3C"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/element-descriptor.js b/packages/js-moi-manifest/lib.esm/element-descriptor.js index 2593e2c2..0c8ebd92 100644 --- a/packages/js-moi-manifest/lib.esm/element-descriptor.js +++ b/packages/js-moi-manifest/lib.esm/element-descriptor.js @@ -9,12 +9,11 @@ export class ElementDescriptor { callSites = new Map(); classDefs = new Map(); methodDefs = new Map(); - eventsDef = new Map(); + eventsDefs = new Map(); constructor(elements) { - const elementsArr = Array.isArray(elements) ? elements : elements.elements; - this.stateMatrix = new ContextStateMatrix(elementsArr); + this.stateMatrix = new ContextStateMatrix(elements); // Populate the maps for elements, call sites, class and method definitions. - elementsArr.forEach((element) => { + for (const element of elements) { this.elements.set(element.ptr, element); switch (element.kind) { case "class": @@ -39,12 +38,12 @@ export class ElementDescriptor { break; case "event": const eventData = element.data; - this.eventsDef.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); + this.eventsDefs.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); break; default: break; } - }); + } } /** * Retrieves the state matrix associated with the ElementDescriptor. @@ -79,7 +78,7 @@ export class ElementDescriptor { return this.classDefs; } getEvents() { - return this.eventsDef; + return this.eventsDefs; } /** * Retrieves the map of method definitions associated with the ElementDescriptor. @@ -164,7 +163,7 @@ export class ElementDescriptor { * @throws {Error} if the event name is invalid. */ getEventElement(eventName) { - const eventDef = this.eventsDef.get(eventName); + const eventDef = this.eventsDefs.get(eventName); if (!eventDef) { return ErrorUtils.throwError(`Invalid event name: ${eventName}`, ErrorCode.INVALID_ARGUMENT); } diff --git a/packages/js-moi-manifest/lib.esm/element-descriptor.js.map b/packages/js-moi-manifest/lib.esm/element-descriptor.js.map index 862797d1..8cf74f78 100644 --- a/packages/js-moi-manifest/lib.esm/element-descriptor.js.map +++ b/packages/js-moi-manifest/lib.esm/element-descriptor.js.map @@ -1 +1 @@ -{"version":3,"file":"element-descriptor.js","sourceRoot":"","sources":["../src.ts/element-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAiB5D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAChB,WAAW,CAAqB;IAChC,QAAQ,GAAuC,IAAI,GAAG,EAAE,CAAC;IACzD,SAAS,GAA0B,IAAI,GAAG,EAAE,CAAC;IAC7C,SAAS,GAAwB,IAAI,GAAG,EAAE,CAAC;IAC3C,UAAU,GAA2B,IAAI,GAAG,EAAE,CAAC;IAC/C,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAC;IAElD,YAAY,QAA0D;QAClE,MAAM,WAAW,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC3E,IAAI,CAAC,WAAW,GAAG,IAAI,kBAAkB,CAAC,WAAW,CAAC,CAAC;QAEvD,4EAA4E;QAC5E,WAAW,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC5B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAExC,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACnB,KAAK,OAAO;oBACR,MAAM,SAAS,GAAG,OAAO,CAAC,IAA2B,CAAC;oBACtD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;oBAC3D,MAAM;gBACV,KAAK,QAAQ;oBACT,MAAM,UAAU,GAAG,OAAO,CAAC,IAA4B,CAAC;oBACxD,MAAM,SA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,yBAAyB,SAAS,EAAE,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACnG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClC,CAAC;IAED;;;;;;;OAOG;IACI,gBAAgB,CAAC,UAAkB;QACtC,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAElD,IAAI,CAAC,SAAS,EAAE,CAAC;YACb,OAAO,UAAU,CAAC,UAAU,CAAC,yBAAyB,UAAU,EAAE,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACpG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;OAQG;IACI,eAAe,CAAC,SAAiB;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,UAAU,CAAC,UAAU,CAAC,uBAAuB,SAAS,EAAE,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACjG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAA+C,CAAC;IACzF,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"element-descriptor.js","sourceRoot":"","sources":["../src.ts/element-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAI5D;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAChB,WAAW,CAAqB;IAChC,QAAQ,GAAuC,IAAI,GAAG,EAAE,CAAC;IACzD,SAAS,GAAwC,IAAI,GAAG,EAAE,CAAC;IAC3D,SAAS,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AM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEhD,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,UAAU,CAAC,UAAU,CAAC,uBAAuB,SAAS,EAAE,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;QACjG,CAAC;QAED,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAA+C,CAAC;IACzF,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/index.d.ts b/packages/js-moi-manifest/lib.esm/index.d.ts index 5d9d24fb..179ca0ff 100644 --- a/packages/js-moi-manifest/lib.esm/index.d.ts +++ b/packages/js-moi-manifest/lib.esm/index.d.ts @@ -1,7 +1,8 @@ export type * from "../types/manifest"; export type * from "../types/response"; +export * from "./manifest"; +export { ManifestCoderFormat } from "./manifest-coder/serialization-format"; export * from "./context-state-matrix"; export * from "./element-descriptor"; -export * from "./manifest"; export * from "./schema"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/index.d.ts.map b/packages/js-moi-manifest/lib.esm/index.d.ts.map index e37082e9..6a3baded 100644 --- a/packages/js-moi-manifest/lib.esm/index.d.ts.map +++ b/packages/js-moi-manifest/lib.esm/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AAEvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AACvC,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/index.js b/packages/js-moi-manifest/lib.esm/index.js index 4bf81375..f00f0339 100644 --- a/packages/js-moi-manifest/lib.esm/index.js +++ b/packages/js-moi-manifest/lib.esm/index.js @@ -1,5 +1,6 @@ +export * from "./manifest"; +export { ManifestCoderFormat } from "./manifest-coder/serialization-format"; export * from "./context-state-matrix"; export * from "./element-descriptor"; -export * from "./manifest"; export * from "./schema"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/index.js.map b/packages/js-moi-manifest/lib.esm/index.js.map index 41801e9a..5fbeb56d 100644 --- a/packages/js-moi-manifest/lib.esm/index.js.map +++ b/packages/js-moi-manifest/lib.esm/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAGA,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAE3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts new file mode 100644 index 00000000..d1698a92 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts @@ -0,0 +1,5 @@ +import type { LogicManifest } from "../../types/manifest"; +export declare abstract class BaseManifestCoder { + protected validate(manifest: unknown): manifest is LogicManifest.Manifest; +} +//# sourceMappingURL=base-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts.map new file mode 100644 index 00000000..32612c5e --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/base-manifest-coder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,8BAAsB,iBAAiB;IACnC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,aAAa,CAAC,QAAQ;CAW5E"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js new file mode 100644 index 00000000..6f16d4b6 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js @@ -0,0 +1,12 @@ +export class BaseManifestCoder { + validate(manifest) { + if (typeof manifest !== "object" || manifest === null) { + return false; + } + if (!("elements" in manifest) || !Array.isArray(manifest.elements)) { + return false; + } + return true; + } +} +//# sourceMappingURL=base-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js.map b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js.map new file mode 100644 index 00000000..85ab426e --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/base-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/base-manifest-coder.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,iBAAiB;IACzB,QAAQ,CAAC,QAAiB;QAChC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpD,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,IAAI,CAAC,CAAC,UAAU,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjE,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts new file mode 100644 index 00000000..5d6ff445 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts @@ -0,0 +1,35 @@ +import type { LogicManifest } from "../../types/manifest"; +import { BaseManifestCoder } from "./base-manifest-coder"; +export declare class JsonManifestCoder extends BaseManifestCoder { + private static MANIFEST_SCHEMA; + private static readonly SCHEMA_CONFIG; + /** + * Serializes a given LogicManifest.Element into a Polorizer instance. + * + * @param element - The LogicManifest.Element to be serialized. + * @returns A Polorizer instance containing the serialized data. + * + * @throws Will throw an error if the element kind is unknown. + */ + private serializeElement; + private deserializeElement; + /** + * Serializes an array of elements from the given manifest. + * + * @param {LogicManifest.Manifest} manifest - The manifest containing the elements to be serialized. + * @returns - The polorizer containing the serialized elements. + */ + private serializeElementArray; + private deserializeElements; + /** + * Serializes a given LogicManifest.Manifest object into a POLO Uint8Array. + * + * @param {LogicManifest.Manifest} manifest - The manifest object to be serialized. + * @returns {Uint8Array} The POLO serialized manifest as a Uint8Array. + * @throws {Error} If the manifest is invalid. + */ + encode(manifest: LogicManifest.Manifest): Uint8Array; + private getPoloBytes; + decode(data: string | Uint8Array): LogicManifest.Manifest; +} +//# sourceMappingURL=json-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts.map new file mode 100644 index 00000000..1281c188 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/json-manifest-coder.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,qBAAa,iBAAkB,SAAQ,iBAAiB;IACpD,OAAO,CAAC,MAAM,CAAC,eAAe,CA4B5B;IAEF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CA6BnC;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,kBAAkB;IAmC1B;;;;;OAKG;IACH,OAAO,CAAC,qBAAqB;IAU7B,OAAO,CAAC,mBAAmB;IAM3B;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,UAAU;IAqBpD,OAAO,CAAC,YAAY;IAIpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,CAAC,QAAQ;CAW5D"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js new file mode 100644 index 00000000..d553b4c5 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js @@ -0,0 +1,157 @@ +import { ErrorCode, ErrorUtils, hexToBytes } from "js-moi-utils"; +import { Depolorizer, Polorizer, WireType } from "js-polo"; +import { Schema } from "../schema"; +import { BaseManifestCoder } from "./base-manifest-coder"; +export class JsonManifestCoder extends BaseManifestCoder { + static MANIFEST_SCHEMA = { + kind: "struct", + fields: { + syntax: { + kind: "integer", + }, + engine: Schema.PISA_ENGINE_SCHEMA, + elements: { + kind: "array", + fields: { + values: { + kind: "struct", + fields: { + ptr: { + kind: "integer", + }, + deps: Schema.PISA_DEPS_SCHEMA, + kind: { + kind: "string", + }, + data: { + kind: "raw", + }, + }, + }, + }, + }, + }, + }; + static SCHEMA_CONFIG = { + constant: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_CONSTANT_SCHEMA, + }, + typedef: { + wireType: WireType.WIRE_WORD, + schema: Schema.PISA_TYPEDEF_SCHEMA, + }, + state: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_STATE_SCHEMA, + }, + routine: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_ROUTINE_SCHEMA, + }, + method: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_METHOD_SCHEMA, + }, + class: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_CLASS_SCHEMA, + }, + event: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_EVENT_SCHEMA, + }, + }; + /** + * Serializes a given LogicManifest.Element into a Polorizer instance. + * + * @param element - The LogicManifest.Element to be serialized. + * @returns A Polorizer instance containing the serialized data. + * + * @throws Will throw an error if the element kind is unknown. + */ + serializeElement(element) { + const polorizer = new Polorizer(); + polorizer.polorizeInteger(element.ptr); + polorizer.polorize(element.deps, Schema.PISA_DEPS_SCHEMA); + polorizer.polorizeString(element.kind); + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + if (config == null) { + ErrorUtils.throwError(`Unknown element kind: ${element.kind}`, ErrorCode.UNEXPECTED_ARGUMENT); + } + polorizer.polorize(element.data, config.schema); + return polorizer; + } + deserializeElement(element) { + if (element.deps.length == 0) { + delete element.deps; + } + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + if (config == null) { + ErrorUtils.throwError(`Unknown element kind: ${element.kind}`, ErrorCode.UNEXPECTED_ARGUMENT); + } + const blob = new Uint8Array([config.wireType, ...element.data]); + element.data = new Depolorizer(blob).depolorize(config.schema); + const isRoutineOrMethod = element.kind === "routine" || element.kind === "method"; + if (!isRoutineOrMethod) { + return element; + } + for (const [key, value] of Object.entries(element.data.executes)) { + if (value === "" || (Array.isArray(value) && value.length === 0)) { + delete element.data.executes[key]; + } + if (value instanceof Uint8Array) { + element.data.executes[key] = Array.from(value); + } + } + } + /** + * Serializes an array of elements from the given manifest. + * + * @param {LogicManifest.Manifest} manifest - The manifest containing the elements to be serialized. + * @returns - The polorizer containing the serialized elements. + */ + serializeElementArray(manifest) { + const polorizer = new Polorizer(); + for (const element of manifest.elements) { + polorizer.polorizePacked(this.serializeElement(element)); + } + return polorizer; + } + deserializeElements(elements) { + for (const element of elements) { + this.deserializeElement(element); + } + } + /** + * Serializes a given LogicManifest.Manifest object into a POLO Uint8Array. + * + * @param {LogicManifest.Manifest} manifest - The manifest object to be serialized. + * @returns {Uint8Array} The POLO serialized manifest as a Uint8Array. + * @throws {Error} If the manifest is invalid. + */ + encode(manifest) { + if (!super.validate(manifest)) { + ErrorUtils.throwArgumentError("Invalid manifest.", "manifest", manifest); + } + const polorizer = new Polorizer(); + polorizer.polorizeInteger(manifest.syntax); + polorizer.polorize(manifest.engine, Schema.PISA_ENGINE_SCHEMA); + const elements = this.serializeElementArray(manifest); + polorizer.polorizePacked(elements); + return polorizer.bytes(); + } + getPoloBytes(data) { + return typeof data === "string" ? hexToBytes(data) : data; + } + decode(data) { + const depolorizer = new Depolorizer(this.getPoloBytes(data)); + const decoded = depolorizer.depolorize(JsonManifestCoder.MANIFEST_SCHEMA); + if (!super.validate(decoded)) { + ErrorUtils.throwArgumentError("Invalid manifest.", "data", data); + } + this.deserializeElements(decoded.elements); + return decoded; + } +} +//# sourceMappingURL=json-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js.map b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js.map new file mode 100644 index 00000000..ff49aa85 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/json-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/json-manifest-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAC5C,MAAM,CAAC,eAAe,GAAG;QAC7B,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE;YACJ,MAAM,EAAE;gBACJ,IAAI,EAAE,SAAS;aAClB;YACD,MAAM,EAAE,MAAM,CAAC,kBAAkB;YACjC,QAAQ,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,MAAM,EAAE;oBACJ,MAAM,EAAE;wBACJ,IAAI,EAAE,QAAQ;wBACd,MAAM,EAAE;4BACJ,GAAG,EAAE;gCACD,IAAI,EAAE,SAAS;6BAClB;4BACD,IAAI,EAAE,MAAM,CAAC,gBAAgB;4BAC7B,IAAI,EAAE;gCACF,IAAI,EAAE,QAAQ;6BACjB;4BACD,IAAI,EAAE;gCACF,IAAI,EAAE,KAAK;6BACd;yBACJ;qBACJ;iBACJ;aACJ;SACJ;KACJ,CAAC;IAEM,MAAM,CAAU,aAAa,GAAiB;QAClD,QAAQ,EAAE;YACN,QAAQ,EAAE,QAAQ,CAAC,SAAS;YAC5B,MAAM,EAAE,MAAM,CAAC,oBAAoB;SACtC;QACD,OAAO,EAAE;YACL,QAAQ,EAAE,QAAQ,C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,CAAC,IAAyB;QAC5B,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,MAAM,OAAO,GAAG,WAAW,CAAC,UAAU,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;QAE1E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,UAAU,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACrE,CAAC;QAED,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3C,OAAO,OAAO,CAAC;IACnB,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts new file mode 100644 index 00000000..4d05740f --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts @@ -0,0 +1,8 @@ +/** + * Represents the format of a manifest. + */ +export declare enum ManifestCoderFormat { + JSON = "JSON", + YAML = "YAML" +} +//# sourceMappingURL=serialization-format.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts.map b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts.map new file mode 100644 index 00000000..749aa95a --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"serialization-format.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/serialization-format.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,oBAAY,mBAAmB;IAC3B,IAAI,SAAS;IACb,IAAI,SAAS;CAChB"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js new file mode 100644 index 00000000..63ef28db --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js @@ -0,0 +1,9 @@ +/** + * Represents the format of a manifest. + */ +export var ManifestCoderFormat; +(function (ManifestCoderFormat) { + ManifestCoderFormat["JSON"] = "JSON"; + ManifestCoderFormat["YAML"] = "YAML"; +})(ManifestCoderFormat || (ManifestCoderFormat = {})); +//# sourceMappingURL=serialization-format.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js.map b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js.map new file mode 100644 index 00000000..3815877e --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/serialization-format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serialization-format.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/serialization-format.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC3B,oCAAa,CAAA;IACb,oCAAa,CAAA;AACjB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts new file mode 100644 index 00000000..1f080c1e --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts @@ -0,0 +1,6 @@ +import { BaseManifestCoder } from "./base-manifest-coder"; +export declare class YamlManifestCoder extends BaseManifestCoder { + encode(yamlManifest: string): Uint8Array; + decode(data: string | Uint8Array): string; +} +//# sourceMappingURL=yaml-manifest-coder.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts.map b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts.map new file mode 100644 index 00000000..da4a9c35 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"yaml-manifest-coder.d.ts","sourceRoot":"","sources":["../../src.ts/manifest-coder/yaml-manifest-coder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAI1D,qBAAa,iBAAkB,SAAQ,iBAAiB;IAC7C,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU;IAMxC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM;CAInD"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js new file mode 100644 index 00000000..a7733efb --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js @@ -0,0 +1,14 @@ +import { parse, stringify } from "yaml"; +import { BaseManifestCoder } from "./base-manifest-coder"; +import { JsonManifestCoder } from "./json-manifest-coder"; +export class YamlManifestCoder extends BaseManifestCoder { + encode(yamlManifest) { + const json = parse(yamlManifest); + return new JsonManifestCoder().encode(json); + } + decode(data) { + const coder = new JsonManifestCoder(); + return stringify(coder.decode(data)); + } +} +//# sourceMappingURL=yaml-manifest-coder.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js.map b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js.map new file mode 100644 index 00000000..7c9e0887 --- /dev/null +++ b/packages/js-moi-manifest/lib.esm/manifest-coder/yaml-manifest-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"yaml-manifest-coder.js","sourceRoot":"","sources":["../../src.ts/manifest-coder/yaml-manifest-coder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,MAAM,OAAO,iBAAkB,SAAQ,iBAAiB;IAC7C,MAAM,CAAC,YAAoB;QAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC;QACjC,OAAO,IAAI,iBAAiB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAEhD,CAAC;IAEM,MAAM,CAAC,IAAyB;QACnC,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest.d.ts b/packages/js-moi-manifest/lib.esm/manifest.d.ts index 069dbd48..35e7ec9c 100644 --- a/packages/js-moi-manifest/lib.esm/manifest.d.ts +++ b/packages/js-moi-manifest/lib.esm/manifest.d.ts @@ -1,6 +1,6 @@ import { LogicManifest } from "../types/manifest"; import { Exception } from "../types/response"; -import { ElementDescriptor } from "./element-descriptor"; +import { ManifestCoderFormat } from "./manifest-coder/serialization-format"; /** * ManifestCoder is a class that provides encoding and decoding functionality * for Logic Interface.It allows encoding manifests and arguments, as well as @@ -11,13 +11,6 @@ import { ElementDescriptor } from "./element-descriptor"; */ export declare class ManifestCoder { private readonly elementDescriptor; - /** - * Creates an instance of ManifestCoder. - * - * @param {LogicManifest.Manifest} elementDescriptor - The element descriptor. - * @constructor - */ - constructor(elementDescriptor: ElementDescriptor); /** * Creates an instance of ManifestCoder. * @@ -26,16 +19,6 @@ export declare class ManifestCoder { */ constructor(manifest: LogicManifest.Manifest); private get schema(); - /** - * Encodes a logic manifest into POLO format. The manifest is processed and - * serialized according to the predefined schema. - * Returns the POLO-encoded data as a hexadecimal string prefixed with "0x". - * - * @static - * @param {LogicManifest.Manifest} manifest - The logic manifest to encode. - * @returns {string} The POLO-encoded data. - */ - static encodeManifest(manifest: LogicManifest.Manifest): string; /** * Parses the calldata arguments based on the provided POLO Schema. * The calldata arguments is recursively processed and transformed according to the schema. @@ -48,53 +31,31 @@ export declare class ManifestCoder { */ private parseCalldata; /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. + * Encodes the arguments for a specified routine into a hexadecimal string. * - * @param {LogicManifest.TypeField[]} fields - The fields associated with the routine parameters (arguments). - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @param routine - The name of the routine for which the arguments are being encoded. + * @param args - The arguments to be encoded, passed as a variadic parameter. + * @returns A hexadecimal string representing the encoded arguments. */ - encodeArguments(fields: LogicManifest.TypeField[], args: any[]): string; + encodeArguments(routine: string, ...args: any[]): string; /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). + * Decodes the provided calldata into the expected arguments for a given routine. * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. - * - * @param {string} fields - The name of the routine associated with the arguments. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @template T - The type of the decoded arguments. + * @param {string} routine - The name of the routine whose arguments are to be decoded. + * @param {string} calldata - The calldata to decode. + * @returns {T | null} - The decoded arguments as an object of type T, or null if the routine accepts no arguments. */ - encodeArguments(fields: string, args: any[]): string; + decodeArguments(routine: string, calldata: string): T | null; /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the predefined schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} callsite - The name of the routine associated with the output data. + * Decodes the output of a routine. * - * @returns {T | null} The decoded output data, or null if the output is empty. + * @template T - The type to which the output should be decoded. + * @param {string} routine - The name of the routine whose output is to be decoded. + * @param {string} output - The output string to decode. + * @returns {T | null} - The decoded output as type T, or null if the output is invalid or the routine has no return schema. */ - decodeOutput(callsite: string, output: string): T | null; - /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {LogicManifest.TypeField[]} fields - The fields associated with the output data. - * @returns {unknown | null} The decoded output data, or null if the output is empty. - */ - decodeOutput(field: LogicManifest.TypeField[], output: string): T | null; + decodeOutput(routine: string, output: string): T | null; /** * Decodes a log data from an event emitted in a logic. * @@ -124,17 +85,39 @@ export declare class ManifestCoder { */ static decodeException(error: string): Exception | null; /** - * Decodes a specific state field from the data retrieved from a logic. - * The state data is decoded using the provided fields and schema. - * Returns the decoded value of the specified field, or null if the data is empty. + * Encodes a manifest into a hexadecimal string. * - * @param {string} data - The state data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {string} field - The field to be decoded from the state data. - * @param {LogicManifest.TypeField[]} fields - The fields associated with the state data. - * @returns {unknown | null} The decoded value of the specified field, or - null if the data is empty. + * This function supports encoding both JSON and YAML manifest formats. + * If the input manifest is an object, it is assumed to be a JSON manifest and + * is encoded using the `JsonManifestCoder`. If the input manifest is a string, + * it is assumed to be a YAML manifest and is encoded using the `YamlManifestCoder`. + * + * @param manifest - The manifest to encode. It can be either a string (YAML) or an object (JSON). + * @returns The encoded manifest as a hexadecimal string prefixed with "0x". + * @throws Will throw an error if the manifest type is unsupported. */ - decodeState(data: string, field: string, fields: LogicManifest.TypeField[]): unknown | null; + static encodeManifest(manifest: string | LogicManifest.Manifest): string; + /** + * Decodes a given manifest in either JSON format. + * + * @param manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param format - The format of the manifest in JSON string. + * + * @returns Returns a JSON manifest object. + * + * @throws Throws an error if the format is unsupported. + */ + static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.JSON): LogicManifest.Manifest; + /** + * Decodes a given manifest in either YAML format. + * + * @param {string | Uint8Array} manifest The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format The format of the manifest in YAML string. + * + * @returns {string} Returns a YAML string representation. + * + * @throws {Error} Throws an error if the format is unsupported. + */ + static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.YAML): string; } //# sourceMappingURL=manifest.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest.d.ts.map b/packages/js-moi-manifest/lib.esm/manifest.d.ts.map index a05e0047..eaf45426 100644 --- a/packages/js-moi-manifest/lib.esm/manifest.d.ts.map +++ b/packages/js-moi-manifest/lib.esm/manifest.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src.ts/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD;;;;;;;GAOG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAoB;IAEtD;;;;;OAKG;gBACS,iBAAiB,EAAE,iBAAiB;IAChD;;;;;OAKG;gBACS,QAAQ,EAAE,aAAa,CAAC,QAAQ;IAQ5C,OAAO,KAAK,MAAM,GAEjB;IAED;;;;;;;;OAQG;WACW,cAAc,CAAC,QAAQ,EAAE,aAAa,CAAC,QAAQ,GAAG,MAAM;IAuDtE;;;;;;;;;OASG;IACH,OAAO,CAAC,aAAa;IA4FrB;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM;IAC9E;;;;;;;;;;;OAWG;IACI,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAA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IACI,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM;IAY/D;;;;;;;OAOG;IACI,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAYtE;;;;;;;OAOG;IACI,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAYjE;;;;;;OAMG;IACI,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IACrE;;;;;OAKG;IACI,iBAAiB,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IA4BzF;;;;;;;;;OASG;WACW,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAU9D;;;;;;;;;;;OAWG;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAC,QAAQ,GAAG,MAAM;IAc/E;;;;;;;;;OASG;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,GAAG,aAAa,CAAC,QAAQ;IACpH;;;;;;;;;MASE;WACW,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,MAAM,EAAE,mBAAmB,CAAC,IAAI,GAAG,MAAM;CAwBxG"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest.js b/packages/js-moi-manifest/lib.esm/manifest.js index 8f0105b2..92c9779d 100644 --- a/packages/js-moi-manifest/lib.esm/manifest.js +++ b/packages/js-moi-manifest/lib.esm/manifest.js @@ -1,6 +1,9 @@ -import { bytesToHex, deepCopy, DEFAULT_EVENT_SCHEMA, ErrorCode, ErrorUtils, hexToBytes, trimHexPrefix } from "js-moi-utils"; -import { Depolorizer, documentEncode, Polorizer } from "js-polo"; +import { builtInLogEventSchema, bytesToHex, deepCopy, ErrorCode, ErrorUtils, hexToBytes, trimHexPrefix } from "js-moi-utils"; +import { Depolorizer, documentEncode } from "js-polo"; import { ElementDescriptor } from "./element-descriptor"; +import { JsonManifestCoder } from "./manifest-coder/json-manifest-coder"; +import { ManifestCoderFormat } from "./manifest-coder/serialization-format"; +import { YamlManifestCoder } from "./manifest-coder/yaml-manifest-coder"; import { Schema } from "./schema"; /** * ManifestCoder is a class that provides encoding and decoding functionality @@ -15,64 +18,12 @@ export class ManifestCoder { /** * Creates an instance of ManifestCoder. */ - constructor(descriptorOrManifest) { - this.elementDescriptor = descriptorOrManifest instanceof ElementDescriptor ? descriptorOrManifest : new ElementDescriptor(descriptorOrManifest); + constructor(manifest) { + this.elementDescriptor = new ElementDescriptor(manifest.elements); } get schema() { return new Schema(this.elementDescriptor.getElements(), this.elementDescriptor.getClassDefs()); } - /** - * Encodes a logic manifest into POLO format. The manifest is processed and - * serialized according to the predefined schema. - * Returns the POLO-encoded data as a hexadecimal string prefixed with "0x". - * - * @static - * @param {LogicManifest.Manifest} manifest - The logic manifest to encode. - * @returns {string} The POLO-encoded data. - */ - static encodeManifest(manifest) { - const polorizer = new Polorizer(); - polorizer.polorizeInteger(manifest.syntax); - polorizer.polorize(manifest.engine, Schema.PISA_ENGINE_SCHEMA); - if (manifest.elements) { - const elements = new Polorizer(); - manifest.elements.forEach((value) => { - const element = new Polorizer(); - element.polorizeInteger(value.ptr); - element.polorize(value.deps, Schema.PISA_DEPS_SCHEMA); - element.polorizeString(value.kind); - switch (value.kind) { - case "constant": - element.polorize(value.data, Schema.PISA_CONSTANT_SCHEMA); - break; - case "typedef": - element.polorize(value.data, Schema.PISA_TYPEDEF_SCHEMA); - break; - case "class": - element.polorize(value.data, Schema.PISA_CLASS_SCHEMA); - break; - case "method": - element.polorize(value.data, Schema.PISA_METHOD_SCHEMA); - break; - case "routine": - element.polorize(value.data, Schema.PISA_ROUTINE_SCHEMA); - break; - case "event": - element.polorize(value.data, Schema.PISA_EVENT_SCHEMA); - break; - case "state": - element.polorize(value.data, Schema.PISA_STATE_SCHEMA); - break; - default: - ErrorUtils.throwError(`Unsupported kind: ${value.kind}`, ErrorCode.UNSUPPORTED_OPERATION); - } - elements.polorizePacked(element); - }); - polorizer.polorizePacked(elements); - } - const bytes = polorizer.bytes(); - return "0x" + bytesToHex(bytes); - } /** * Parses the calldata arguments based on the provided POLO Schema. * The calldata arguments is recursively processed and transformed according to the schema. @@ -144,45 +95,50 @@ export class ManifestCoder { return arg; } /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. + * Encodes the arguments for a specified routine into a hexadecimal string. * - * @param {(LogicManifest.TypeField[] | string)} fields - The fields associated with the routine parameters (arguments) or the name of the routine. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @param routine - The name of the routine for which the arguments are being encoded. + * @param args - The arguments to be encoded, passed as a variadic parameter. + * @returns A hexadecimal string representing the encoded arguments. */ - encodeArguments(fields, args) { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data; - fields = element.accepts; - } - const schema = this.schema.parseFields(fields); - const calldata = Object.values(fields).reduce((acc, field) => { + encodeArguments(routine, ...args) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + const schema = this.schema.parseFields(element.accepts ?? []); + const calldata = Object.values(element.accepts).reduce((acc, field) => { acc[field.label] = this.parseCalldata(schema.fields[field.label], args[field.slot]); return acc; }, {}); return "0x" + bytesToHex((documentEncode(calldata, schema).bytes())); } /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. + * Decodes the provided calldata into the expected arguments for a given routine. * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} fields - The name of the routine associated with the output data. - * @returns {T | null} The decoded output data, or null if the output is empty. + * @template T - The type of the decoded arguments. + * @param {string} routine - The name of the routine whose arguments are to be decoded. + * @param {string} calldata - The calldata to decode. + * @returns {T | null} - The decoded arguments as an object of type T, or null if the routine accepts no arguments. */ - decodeOutput(fields, output) { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data; - fields = element.returns; + decodeArguments(routine, calldata) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + if (element && element.accepts.length === 0) { + return null; } - if (output && output != "0x" && fields && fields.length) { - const schema = this.schema.parseFields(fields); + const schema = this.schema.parseFields(element.accepts ?? []); + const decodedCalldata = new Depolorizer(hexToBytes(calldata)).depolorize(schema); + return element.accepts.map((field) => decodedCalldata[field.label]); + } + /** + * Decodes the output of a routine. + * + * @template T - The type to which the output should be decoded. + * @param {string} routine - The name of the routine whose output is to be decoded. + * @param {string} output - The output string to decode. + * @returns {T | null} - The decoded output as type T, or null if the output is invalid or the routine has no return schema. + */ + decodeOutput(routine, output) { + const element = this.elementDescriptor.getRoutineElement(routine).data; + if (output && output != "0x" && element.returns && element.returns.length) { + const schema = this.schema.parseFields(element.returns); return new Depolorizer(hexToBytes(output)).depolorize(schema); } return null; @@ -196,7 +152,7 @@ export class ManifestCoder { */ decodeEventOutput(event, logData) { if (event === "builtin.Log") { - return new Depolorizer(hexToBytes(logData)).depolorize(DEFAULT_EVENT_SCHEMA); + return new Depolorizer(hexToBytes(logData)).depolorize(builtInLogEventSchema); } const element = this.elementDescriptor.getEventElement(event); if (element == null) { @@ -228,25 +184,48 @@ export class ManifestCoder { return null; } /** - * Decodes a specific state field from the data retrieved from a logic. - * The state data is decoded using the provided fields and schema. - * Returns the decoded value of the specified field, or null if the data is empty. + * Encodes a manifest into a hexadecimal string. * - * @param {string} data - The state data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {string} field - The field to be decoded from the state data. - * @param {LogicManifest.TypeField[]} fields - The fields associated with the state data. - * @returns {unknown | null} The decoded value of the specified field, or - null if the data is empty. + * This function supports encoding both JSON and YAML manifest formats. + * If the input manifest is an object, it is assumed to be a JSON manifest and + * is encoded using the `JsonManifestCoder`. If the input manifest is a string, + * it is assumed to be a YAML manifest and is encoded using the `YamlManifestCoder`. + * + * @param manifest - The manifest to encode. It can be either a string (YAML) or an object (JSON). + * @returns The encoded manifest as a hexadecimal string prefixed with "0x". + * @throws Will throw an error if the manifest type is unsupported. */ - decodeState(data, field, fields) { - if (data && data != "0x") { - const decodedData = hexToBytes(data); - const depolorizer = new Depolorizer(decodedData); - const schema = this.schema.parseFields(fields); - return depolorizer.depolorize(schema.fields[field]); + static encodeManifest(manifest) { + if (typeof manifest === "object" && manifest !== null) { + const serializer = new JsonManifestCoder(); + return "0x" + bytesToHex(serializer.encode(manifest)); } - return null; + if (typeof manifest === "string") { + const serializer = new YamlManifestCoder(); + return "0x" + bytesToHex(serializer.encode(manifest)); + } + ErrorUtils.throwError("Unsupported manifest type", ErrorCode.UNSUPPORTED_OPERATION); + } + /** + * Decodes a given manifest in either JSON or YAML format. + * + * @param {string | Uint8Array} manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format - The format of the manifest, either JSON or YAML. + * + * @returns {LogicManifest.Manifest | string} - Returns a `LogicManifest.Manifest` object if JSON format is used or a string representation if YAML format is used. + * + * @throws {Error} - Throws an error if the format is unsupported. + */ + static decodeManifest(manifest, format) { + if (format === ManifestCoderFormat.JSON) { + const serializer = new JsonManifestCoder(); + return serializer.decode(manifest); + } + if (format === ManifestCoderFormat.YAML) { + const serializer = new YamlManifestCoder(); + return serializer.decode(manifest); + } + ErrorUtils.throwError("Unsupported manifest format", ErrorCode.UNSUPPORTED_OPERATION); } } //# sourceMappingURL=manifest.js.map \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/manifest.js.map b/packages/js-moi-manifest/lib.esm/manifest.js.map index 8bfe196f..ebe8b50f 100644 --- a/packages/js-moi-manifest/lib.esm/manifest.js.map +++ b/packages/js-moi-manifest/lib.esm/manifest.js.map @@ -1 +1 @@ -{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src.ts/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC5H,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAwB,MAAM,SAAS,CAAC;AAGvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IACL,iBAAiB,CAAoB;IAgBtD;;OAEG;IACH,YAAY,oBAAgE;QACxE,IAAI,CAAC,iBAAiB,GAAG,oBAAoB,YAAY,iBAAiB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;IACpJ,CAAC;IAED,IAAY,MAAM;QACd,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE,CAAC,CAAC;IACnG,CAAC;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,cAAc,CAAC,QAAgC;QACzD,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;QAClC,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC3C,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAE/D,IAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,QAAQ,GAAG,IAAI,SAAS,E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AAQ,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;YAC3C,OAAO,IAAI,GAAG,UAAU,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC1D,CAAC;QAED,UAAU,CAAC,UAAU,CAAC,2BAA2B,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;IACxF,CAAC;IAwBA;;;;;;;;;MASE;IACI,MAAM,CAAC,cAAc,CAAC,QAA6B,EAAE,MAA2B;QACnF,IAAI,MAAM,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;YAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,MAAM,KAAK,mBAAmB,CAAC,IAAI,EAAE,CAAC;YACtC,MAAM,UAAU,GAAG,IAAI,iBAAiB,EAAE,CAAC;YAC3C,OAAO,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;QAED,UAAU,CAAC,UAAU,CAAC,6BAA6B,EAAE,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAC1F,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-manifest/lib.esm/schema.js b/packages/js-moi-manifest/lib.esm/schema.js index df007f57..813cc0b3 100644 --- a/packages/js-moi-manifest/lib.esm/schema.js +++ b/packages/js-moi-manifest/lib.esm/schema.js @@ -41,7 +41,7 @@ export class Schema { kind: "string", }, }, - }, + } }, }; static PISA_DEPS_SCHEMA = { diff --git a/packages/js-moi-manifest/manifests/flipper.json b/packages/js-moi-manifest/manifests/flipper.json new file mode 100644 index 00000000..c1066acd --- /dev/null +++ b/packages/js-moi-manifest/manifests/flipper.json @@ -0,0 +1,227 @@ +{ + "syntax": 1, + "engine": { + "kind": "PISA", + "flags": [] + }, + "elements": [ + { + "ptr": 0, + "kind": "state", + "data": { + "mode": "persistent", + "fields": [ + { + "slot": 0, + "label": "value", + "type": "bool" + } + ] + } + }, + { + "ptr": 1, + "deps": [ + 0 + ], + "kind": "routine", + "data": { + "name": "Init", + "mode": "persistent", + "kind": "deploy", + "accepts": [], + "returns": [], + "executes": { + "bin": [] + }, + "catches": [] + } + }, + { + "ptr": 2, + "deps": [ + 6, + 0 + ], + "kind": "routine", + "data": { + "name": "Seed", + "mode": "persistent", + "kind": "deploy", + "accepts": [ + { + "slot": 0, + "label": "initial", + "type": "bool" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 4, + 1, + 0, + 83, + 0, + 0, + 1, + 17, + 1, + 6, + 12, + 0, + 1, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 3, + "deps": [ + 0 + ], + "kind": "routine", + "data": { + "name": "Get", + "mode": "readonly", + "kind": "invoke", + "accepts": [], + "returns": [ + { + "slot": 0, + "label": "value", + "type": "bool" + } + ], + "executes": { + "bin": [ + 128, + 0, + 0, + 5, + 0, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 4, + "deps": [ + 6, + 0 + ], + "kind": "routine", + "data": { + "name": "Set", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "value", + "type": "bool" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 4, + 1, + 0, + 83, + 0, + 0, + 1, + 17, + 1, + 6, + 12, + 0, + 1, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 5, + "deps": [ + 0 + ], + "kind": "routine", + "data": { + "name": "Toggle", + "mode": "persistent", + "kind": "invoke", + "accepts": [], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 0, + 55, + 1, + 0, + 98, + 1, + 1, + 54, + 0, + 1, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 6, + "deps": [ + 0 + ], + "kind": "routine", + "data": { + "name": "set", + "mode": "persistent", + "kind": "internal", + "accepts": [ + { + "slot": 0, + "label": "value", + "type": "bool" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 0, + 4, + 1, + 0, + 54, + 0, + 1, + 129, + 0 + ] + }, + "catches": [] + } + } + ] +} \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/flipper.polo b/packages/js-moi-manifest/manifests/flipper.polo new file mode 100644 index 00000000..8e2d49e7 --- /dev/null +++ b/packages/js-moi-manifest/manifests/flipper.polo @@ -0,0 +1 @@ +0x0e4f031e9e01012f064e504953410fdf010efe048e0cde17be21de2c8e364f0300065e73746174653f06ae0170657273697374656e741f0e3f03065676616c7565626f6f6c5f031e36ae01011f03726f7574696e65cf010646e601ce02de02ee02ae03496e697470657273697374656e746465706c6f790f0f3f0606000f5f031e56ce01022f031306726f7574696e65cf010646e601ce02de04ee04ce075365656470657273697374656e746465706c6f791f0e3f030676696e697469616c626f6f6c0f5f06860280020a00040100530000011101060c0001000f5f031e36ae01031f03726f7574696e65cf010636b6019e02ae029e04fe05476574726561646f6e6c79696e766f6b650f1f0e3f03065676616c7565626f6f6c5f068601800180000005000082000f5f031e56ce01042f031306726f7574696e65cf010636d601be02ae04be049e0753657470657273697374656e74696e766f6b651f0e3f03065676616c7565626f6f6c0f5f06860280020a00040100530000011101060c0001000f5f031e36ae01051f03726f7574696e65cf0106668602ee02fe028e03ce05546f67676c6570657273697374656e74696e766f6b650f0f5f06e601e00180000037010062010136000181000f5f031e36ae01061f03726f7574696e65cf010636d601de02ce04de04ee0673657470657273697374656e74696e7465726e616c1f0e3f03065676616c7565626f6f6c0f5f06b601b00180000004010036000181000f \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/guardian.json b/packages/js-moi-manifest/manifests/guardian.json new file mode 100644 index 00000000..dfe50e52 --- /dev/null +++ b/packages/js-moi-manifest/manifests/guardian.json @@ -0,0 +1,3162 @@ +{ + "syntax": 1, + "engine": { + "kind": "PISA", + "flags": [] + }, + "elements": [ + { + "ptr": 0, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c696420726566657272616c7320696e707574733a206d69736d6174636865642073697a65" + } + }, + { + "ptr": 1, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c696420677561726469616e20696e707574733a206d69736d6174636865642073697a65" + } + }, + { + "ptr": 2, + "kind": "constant", + "data": { + "type": "string", + "value": "0x066f70657261746f7220616c726561647920657869737473" + } + }, + { + "ptr": 3, + "kind": "constant", + "data": { + "type": "u64", + "value": "0x0302" + } + }, + { + "ptr": 4, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0673656e646572206973206e6f7420746865206f70657261746f72206f662074686520677561726469616e" + } + }, + { + "ptr": 5, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0673656e646572206973206e6f742061207665726966696564206f70657261746f723a20" + } + }, + { + "ptr": 6, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06677561726469616e20616c726561647920657869737473" + } + }, + { + "ptr": 7, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06677561726469616e206b72616d61206964206973206e6f7420617070726f766564" + } + }, + { + "ptr": 8, + "kind": "constant", + "data": { + "type": "string", + "value": "0x066b7963" + } + }, + { + "ptr": 9, + "kind": "constant", + "data": { + "type": "string", + "value": "0x066b7962" + } + }, + { + "ptr": 10, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06756e657870656374656420766572696669636174696f6e206b696e6420656e636f756e7465726564" + } + }, + { + "ptr": 11, + "kind": "constant", + "data": { + "type": "string", + "value": "0x066e6f6465206c696d6974207265616368656420666f72206f70657261746f72" + } + }, + { + "ptr": 12, + "kind": "constant", + "data": { + "type": "u64", + "value": "0x0364" + } + }, + { + "ptr": 13, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c696420726566657272616c2070657263656e74616765" + } + }, + { + "ptr": 14, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c696420696e63656e7469766520696e707574733a206d69736d6174636865642073697a65" + } + }, + { + "ptr": 15, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06677561726469616e20646f6573206e6f74206578697374" + } + }, + { + "ptr": 16, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0675706461746564206c696d69742063616e6e6f74206265206265206c657373207468616e206578697374696e67" + } + }, + { + "ptr": 17, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c6964206c696d6974206b696e64" + } + }, + { + "ptr": 18, + "kind": "constant", + "data": { + "type": "string", + "value": "0x066163636573732064656e69656421206e6f7420616e2061646d696e" + } + }, + { + "ptr": 19, + "deps": [ + 28 + ], + "kind": "typedef", + "data": "map[string]class.Guardian" + }, + { + "ptr": 20, + "kind": "typedef", + "data": "[]string" + }, + { + "ptr": 21, + "deps": [ + 26 + ], + "kind": "typedef", + "data": "map[string]class.Operator" + }, + { + "ptr": 22, + "kind": "typedef", + "data": "map[string]bool" + }, + { + "ptr": 23, + "kind": "typedef", + "data": "map[address]u64" + }, + { + "ptr": 24, + "kind": "typedef", + "data": "map[address]bool" + }, + { + "ptr": 25, + "kind": "class", + "data": { + "name": "Master", + "fields": [ + { + "slot": 0, + "label": "MOIID", + "type": "string" + }, + { + "slot": 1, + "label": "Wallet", + "type": "address" + }, + { + "slot": 2, + "label": "PubKey", + "type": "bytes" + } + ], + "methods": [] + } + }, + { + "ptr": 26, + "deps": [ + 27 + ], + "kind": "class", + "data": { + "name": "Operator", + "fields": [ + { + "slot": 0, + "label": "Identifier", + "type": "string" + }, + { + "slot": 1, + "label": "Verification", + "type": "class.VerifyProof" + }, + { + "slot": 2, + "label": "Guardians", + "type": "[]string" + } + ], + "methods": [] + } + }, + { + "ptr": 27, + "kind": "class", + "data": { + "name": "VerifyProof", + "fields": [ + { + "slot": 0, + "label": "Kind", + "type": "string" + }, + { + "slot": 1, + "label": "Proof", + "type": "bytes" + } + ], + "methods": [] + } + }, + { + "ptr": 28, + "deps": [ + 29 + ], + "kind": "class", + "data": { + "name": "Guardian", + "fields": [ + { + "slot": 0, + "label": "KramaID", + "type": "string" + }, + { + "slot": 1, + "label": "OperatorID", + "type": "string" + }, + { + "slot": 2, + "label": "Incentive", + "type": "class.Incentive" + }, + { + "slot": 3, + "label": "PublicKey", + "type": "bytes" + }, + { + "slot": 4, + "label": "ExtraData", + "type": "bytes" + } + ], + "methods": [] + } + }, + { + "ptr": 29, + "kind": "class", + "data": { + "name": "Incentive", + "fields": [ + { + "slot": 0, + "label": "Amount", + "type": "u64" + }, + { + "slot": 1, + "label": "Wallet", + "type": "address" + }, + { + "slot": 2, + "label": "ReferralPercent", + "type": "u64" + }, + { + "slot": 3, + "label": "ReferralWallet", + "type": "address" + } + ], + "methods": [] + } + }, + { + "ptr": 30, + "deps": [ + 28, + 26, + 25 + ], + "kind": "state", + "data": { + "mode": "persistent", + "fields": [ + { + "slot": 0, + "label": "Guardians", + "type": "map[string]class.Guardian" + }, + { + "slot": 1, + "label": "KnownGuardians", + "type": "[]string" + }, + { + "slot": 2, + "label": "Operators", + "type": "map[string]class.Operator" + }, + { + "slot": 3, + "label": "KnownOperators", + "type": "[]string" + }, + { + "slot": 4, + "label": "Approved", + "type": "map[string]bool" + }, + { + "slot": 5, + "label": "ReferralRewards", + "type": "map[address]u64" + }, + { + "slot": 6, + "label": "NodeLimitKYC", + "type": "u64" + }, + { + "slot": 7, + "label": "NodeLimitKYB", + "type": "u64" + }, + { + "slot": 8, + "label": "MasterOperator", + "type": "class.Master" + }, + { + "slot": 9, + "label": "Administrators", + "type": "map[address]bool" + }, + { + "slot": 10, + "label": "TotalIncentives", + "type": "u64" + } + ] + } + }, + { + "ptr": 31, + "deps": [ + 0, + 25, + 28, + 26, + 30 + ], + "kind": "routine", + "data": { + "name": "Import", + "mode": "persistent", + "kind": "deploy", + "accepts": [ + { + "slot": 0, + "label": "master", + "type": "class.Master" + }, + { + "slot": 1, + "label": "admins", + "type": "[]address" + }, + { + "slot": 2, + "label": "guardians", + "type": "[]class.Guardian" + }, + { + "slot": 3, + "label": "operators", + "type": "[]class.Operator" + }, + { + "slot": 4, + "label": "approved", + "type": "[]string" + }, + { + "slot": 5, + "label": "referralAddrs", + "type": "[]address" + }, + { + "slot": 6, + "label": "referralAmounts", + "type": "[]u64" + }, + { + "slot": 7, + "label": "knownGs", + "type": "[]string" + }, + { + "slot": 8, + "label": "knownOs", + "type": "[]string" + }, + { + "slot": 9, + "label": "nodeLimitKYC", + "type": "u64" + }, + { + "slot": 10, + "label": "nodeLimitKYB", + "type": "u64" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 8, + 4, + 1, + 0, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 9, + 4, + 1, + 1, + 43, + 2, + 5, + 48, + 3, + 1, + 1, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 21, + 3, + 5, + 4, + 80, + 4, + 1, + 2, + 43, + 6, + 1, + 98, + 6, + 6, + 87, + 0, + 4, + 6, + 1, + 99, + 2, + 17, + 5, + 8, + 2, + 5, + 1, + 129, + 0, + 128, + 0, + 10, + 55, + 1, + 0, + 128, + 2, + 0, + 4, + 3, + 2, + 43, + 4, + 5, + 48, + 5, + 3, + 1, + 68, + 6, + 4, + 5, + 98, + 6, + 6, + 17, + 7, + 47, + 3, + 7, + 6, + 80, + 6, + 3, + 4, + 82, + 8, + 6, + 0, + 85, + 9, + 2, + 8, + 54, + 9, + 6, + 87, + 2, + 8, + 9, + 82, + 8, + 6, + 2, + 82, + 8, + 8, + 0, + 101, + 8, + 1, + 8, + 36, + 1, + 8, + 1, + 99, + 4, + 17, + 7, + 29, + 2, + 7, + 1, + 129, + 2, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 2, + 4, + 1, + 3, + 43, + 2, + 5, + 48, + 3, + 1, + 1, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 69, + 3, + 5, + 4, + 80, + 4, + 1, + 2, + 82, + 6, + 4, + 0, + 85, + 7, + 0, + 6, + 54, + 7, + 4, + 87, + 0, + 6, + 7, + 1, + 99, + 2, + 17, + 5, + 55, + 2, + 5, + 1, + 129, + 0, + 128, + 0, + 4, + 4, + 1, + 4, + 43, + 2, + 5, + 48, + 3, + 1, + 1, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 88, + 3, + 5, + 4, + 80, + 4, + 1, + 2, + 43, + 6, + 1, + 98, + 6, + 6, + 87, + 0, + 4, + 6, + 1, + 99, + 2, + 17, + 5, + 75, + 2, + 5, + 1, + 129, + 0, + 4, + 0, + 5, + 48, + 1, + 0, + 4, + 2, + 6, + 48, + 3, + 2, + 70, + 1, + 1, + 3, + 17, + 3, + 100, + 3, + 3, + 1, + 17, + 1, + 0, + 16, + 1, + 1, + 7, + 1, + 1, + 128, + 1, + 5, + 43, + 3, + 5, + 48, + 4, + 0, + 1, + 68, + 5, + 3, + 4, + 98, + 5, + 5, + 17, + 6, + 116, + 3, + 6, + 5, + 80, + 5, + 0, + 3, + 80, + 7, + 2, + 3, + 87, + 1, + 5, + 7, + 1, + 99, + 3, + 17, + 6, + 104, + 2, + 6, + 1, + 129, + 1, + 128, + 1, + 1, + 4, + 3, + 7, + 43, + 4, + 5, + 48, + 5, + 3, + 1, + 68, + 6, + 4, + 5, + 98, + 6, + 6, + 17, + 7, + 133, + 3, + 7, + 6, + 80, + 6, + 3, + 4, + 52, + 1, + 6, + 1, + 99, + 4, + 17, + 7, + 122, + 2, + 7, + 1, + 129, + 1, + 128, + 1, + 3, + 4, + 3, + 8, + 43, + 4, + 5, + 48, + 5, + 3, + 1, + 68, + 6, + 4, + 5, + 98, + 6, + 6, + 17, + 7, + 150, + 3, + 7, + 6, + 80, + 6, + 3, + 4, + 52, + 1, + 6, + 1, + 99, + 4, + 17, + 7, + 139, + 2, + 7, + 1, + 129, + 1, + 128, + 0, + 6, + 4, + 1, + 9, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 7, + 4, + 1, + 10, + 54, + 0, + 1, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 32, + "deps": [ + 1, + 20, + 25, + 26, + 28, + 29, + 43, + 30 + ], + "kind": "routine", + "data": { + "name": "Setup", + "mode": "persistent", + "kind": "deploy", + "accepts": [ + { + "slot": 0, + "label": "master", + "type": "class.Master" + }, + { + "slot": 1, + "label": "guardians", + "type": "[]string" + }, + { + "slot": 2, + "label": "pubkeys", + "type": "[]bytes" + }, + { + "slot": 3, + "label": "incentives", + "type": "[]u64" + }, + { + "slot": 4, + "label": "admins", + "type": "[]address" + }, + { + "slot": 5, + "label": "preApproved", + "type": "[]string" + }, + { + "slot": 6, + "label": "limitKYC", + "type": "u64" + }, + { + "slot": 7, + "label": "limitKYB", + "type": "u64" + } + ], + "returns": [], + "executes": { + "bin": [ + 43, + 0, + 1, + 4, + 1, + 1, + 48, + 2, + 1, + 4, + 3, + 2, + 48, + 4, + 3, + 70, + 2, + 2, + 4, + 98, + 2, + 2, + 97, + 0, + 0, + 2, + 17, + 2, + 18, + 3, + 2, + 0, + 48, + 4, + 1, + 4, + 5, + 3, + 48, + 6, + 5, + 70, + 4, + 4, + 6, + 98, + 4, + 4, + 97, + 0, + 0, + 4, + 17, + 2, + 18, + 3, + 2, + 0, + 1, + 98, + 0, + 0, + 17, + 2, + 25, + 3, + 2, + 0, + 17, + 0, + 1, + 16, + 0, + 0, + 7, + 0, + 1, + 128, + 0, + 8, + 4, + 2, + 0, + 54, + 0, + 2, + 129, + 0, + 128, + 0, + 3, + 4, + 2, + 0, + 82, + 2, + 2, + 0, + 52, + 0, + 2, + 129, + 0, + 128, + 0, + 2, + 17, + 2, + 26, + 42, + 2, + 2, + 4, + 4, + 0, + 82, + 6, + 4, + 0, + 83, + 2, + 0, + 6, + 17, + 6, + 27, + 42, + 6, + 6, + 83, + 2, + 1, + 6, + 17, + 6, + 20, + 42, + 6, + 6, + 83, + 2, + 2, + 6, + 82, + 4, + 4, + 0, + 85, + 6, + 0, + 4, + 54, + 6, + 2, + 87, + 0, + 4, + 6, + 129, + 0, + 128, + 0, + 6, + 4, + 2, + 6, + 54, + 0, + 2, + 129, + 0, + 128, + 0, + 7, + 4, + 4, + 7, + 54, + 0, + 4, + 129, + 0, + 128, + 0, + 9, + 4, + 6, + 4, + 43, + 7, + 5, + 48, + 8, + 6, + 1, + 68, + 9, + 7, + 8, + 98, + 9, + 9, + 17, + 10, + 77, + 3, + 10, + 9, + 80, + 9, + 6, + 7, + 43, + 11, + 1, + 98, + 11, + 11, + 87, + 0, + 9, + 11, + 1, + 99, + 7, + 17, + 10, + 64, + 2, + 10, + 1, + 129, + 0, + 10, + 0, + 4, + 6, + 5, + 83, + 0, + 0, + 6, + 17, + 7, + 43, + 12, + 0, + 7, + 0, + 43, + 0, + 5, + 48, + 7, + 1, + 1, + 68, + 8, + 0, + 7, + 98, + 8, + 8, + 17, + 9, + 140, + 3, + 9, + 8, + 80, + 8, + 1, + 0, + 128, + 10, + 4, + 43, + 11, + 1, + 98, + 11, + 11, + 87, + 10, + 8, + 11, + 129, + 10, + 128, + 10, + 2, + 4, + 11, + 0, + 82, + 11, + 11, + 0, + 86, + 12, + 10, + 11, + 82, + 13, + 12, + 2, + 52, + 13, + 8, + 83, + 12, + 2, + 13, + 87, + 10, + 11, + 12, + 129, + 10, + 128, + 10, + 10, + 55, + 11, + 10, + 128, + 12, + 0, + 17, + 13, + 28, + 42, + 13, + 13, + 83, + 13, + 0, + 8, + 4, + 14, + 0, + 82, + 15, + 14, + 0, + 83, + 13, + 1, + 15, + 17, + 15, + 29, + 42, + 15, + 15, + 80, + 16, + 5, + 0, + 83, + 15, + 0, + 16, + 82, + 14, + 14, + 1, + 83, + 15, + 1, + 14, + 83, + 13, + 2, + 15, + 80, + 14, + 3, + 0, + 83, + 13, + 3, + 14, + 85, + 14, + 12, + 8, + 54, + 14, + 13, + 87, + 12, + 8, + 14, + 80, + 13, + 5, + 0, + 101, + 13, + 11, + 13, + 36, + 11, + 13, + 129, + 12, + 54, + 10, + 11, + 129, + 10, + 128, + 10, + 1, + 52, + 10, + 8, + 129, + 10, + 1, + 99, + 0, + 17, + 9, + 86, + 2, + 9, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 33, + "deps": [ + 45, + 43, + 30 + ], + "kind": "routine", + "data": { + "name": "Approve", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "kramaIDs", + "type": "[]string" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 17, + 1, + 45, + 12, + 0, + 1, + 0, + 10, + 0, + 4, + 1, + 0, + 83, + 0, + 0, + 1, + 17, + 1, + 43, + 12, + 0, + 1, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 34, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "IsApproved", + "mode": "readonly", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "kramaID", + "type": "string" + } + ], + "returns": [ + { + "slot": 0, + "label": "ok", + "type": "bool" + } + ], + "executes": { + "bin": [ + 128, + 0, + 4, + 4, + 1, + 0, + 84, + 1, + 0, + 1, + 98, + 1, + 1, + 17, + 2, + 9, + 3, + 2, + 1, + 98, + 1, + 1, + 17, + 2, + 11, + 2, + 2, + 1, + 98, + 1, + 1, + 1, + 5, + 1, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 35, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "IsVerified", + "mode": "readonly", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "moiID", + "type": "string" + } + ], + "returns": [ + { + "slot": 0, + "label": "ok", + "type": "bool" + } + ], + "executes": { + "bin": [ + 128, + 0, + 2, + 4, + 1, + 0, + 84, + 1, + 0, + 1, + 98, + 1, + 1, + 17, + 2, + 9, + 3, + 2, + 1, + 98, + 1, + 1, + 17, + 2, + 11, + 2, + 2, + 1, + 98, + 1, + 1, + 1, + 5, + 1, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 36, + "deps": [ + 2, + 20, + 27, + 26, + 45, + 30 + ], + "kind": "routine", + "data": { + "name": "RegisterOperator", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "moiID", + "type": "string" + }, + { + "slot": 1, + "label": "verification", + "type": "class.VerifyProof" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 17, + 1, + 45, + 12, + 0, + 1, + 0, + 128, + 0, + 2, + 4, + 1, + 0, + 84, + 2, + 0, + 1, + 98, + 2, + 2, + 17, + 3, + 12, + 3, + 3, + 2, + 98, + 2, + 2, + 17, + 3, + 14, + 2, + 3, + 1, + 98, + 2, + 2, + 1, + 98, + 2, + 2, + 17, + 3, + 21, + 3, + 3, + 2, + 17, + 2, + 2, + 16, + 2, + 2, + 8, + 2, + 1, + 17, + 2, + 26, + 42, + 2, + 2, + 83, + 2, + 0, + 1, + 4, + 3, + 1, + 83, + 2, + 1, + 3, + 43, + 3, + 5, + 17, + 4, + 20, + 44, + 3, + 4, + 3, + 83, + 2, + 2, + 3, + 85, + 3, + 0, + 1, + 54, + 3, + 2, + 87, + 0, + 1, + 3, + 129, + 0, + 128, + 0, + 3, + 4, + 1, + 0, + 52, + 0, + 1, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 37, + "deps": [ + 3, + 4, + 5, + 6, + 28, + 44, + 38, + 30 + ], + "kind": "routine", + "data": { + "name": "RegisterGuardian", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "guardian", + "type": "class.Guardian" + } + ], + "returns": [], + "executes": { + "bin": [ + 4, + 0, + 0, + 82, + 1, + 0, + 1, + 115, + 2, + 73, + 2, + 2, + 72, + 2, + 2, + 17, + 3, + 3, + 16, + 3, + 3, + 74, + 4, + 1, + 10, + 5, + 83, + 5, + 0, + 3, + 83, + 5, + 1, + 4, + 13, + 3, + 1, + 26, + 5, + 82, + 3, + 3, + 0, + 70, + 2, + 2, + 3, + 17, + 3, + 19, + 3, + 3, + 2, + 17, + 2, + 4, + 16, + 2, + 2, + 7, + 2, + 1, + 17, + 2, + 26, + 42, + 2, + 2, + 128, + 3, + 2, + 84, + 4, + 3, + 1, + 98, + 4, + 4, + 17, + 5, + 30, + 3, + 5, + 4, + 98, + 4, + 4, + 17, + 5, + 32, + 2, + 5, + 1, + 98, + 4, + 4, + 1, + 17, + 5, + 39, + 3, + 5, + 4, + 17, + 4, + 5, + 16, + 4, + 4, + 67, + 4, + 4, + 1, + 7, + 4, + 1, + 86, + 4, + 3, + 1, + 37, + 2, + 4, + 130, + 3, + 82, + 3, + 0, + 0, + 128, + 4, + 0, + 84, + 5, + 4, + 3, + 98, + 5, + 5, + 17, + 6, + 52, + 3, + 6, + 5, + 98, + 5, + 5, + 17, + 6, + 54, + 2, + 6, + 1, + 98, + 5, + 5, + 1, + 98, + 5, + 5, + 17, + 6, + 61, + 3, + 6, + 5, + 17, + 5, + 6, + 16, + 5, + 5, + 7, + 5, + 1, + 130, + 4, + 10, + 4, + 83, + 4, + 0, + 1, + 17, + 5, + 44, + 12, + 4, + 5, + 4, + 82, + 4, + 4, + 0, + 17, + 5, + 75, + 3, + 5, + 4, + 10, + 4, + 83, + 4, + 0, + 2, + 83, + 4, + 1, + 0, + 17, + 5, + 38, + 12, + 4, + 5, + 4, + 1, + 128, + 4, + 2, + 82, + 5, + 2, + 2, + 52, + 5, + 3, + 83, + 2, + 2, + 5, + 87, + 4, + 1, + 2, + 129, + 4, + 128, + 1, + 0, + 85, + 2, + 1, + 3, + 54, + 2, + 0, + 87, + 1, + 3, + 2, + 129, + 1, + 128, + 0, + 1, + 52, + 0, + 3, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 38, + "deps": [ + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 26, + 28, + 30 + ], + "kind": "routine", + "data": { + "name": "CanRegisterGuardian", + "mode": "readonly", + "kind": "internal", + "accepts": [ + { + "slot": 0, + "label": "operator", + "type": "class.Operator" + }, + { + "slot": 1, + "label": "guardian", + "type": "class.Guardian" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 4, + 4, + 1, + 1, + 82, + 1, + 1, + 0, + 84, + 1, + 0, + 1, + 98, + 1, + 1, + 17, + 2, + 10, + 3, + 2, + 1, + 98, + 1, + 1, + 17, + 2, + 12, + 2, + 2, + 1, + 98, + 1, + 1, + 1, + 17, + 2, + 18, + 3, + 2, + 1, + 17, + 1, + 7, + 16, + 1, + 1, + 7, + 1, + 1, + 130, + 0, + 4, + 0, + 0, + 82, + 1, + 0, + 1, + 82, + 1, + 1, + 0, + 43, + 2, + 5, + 17, + 3, + 8, + 16, + 3, + 3, + 70, + 3, + 1, + 3, + 98, + 3, + 3, + 17, + 4, + 35, + 3, + 4, + 3, + 128, + 3, + 6, + 55, + 2, + 3, + 130, + 3, + 17, + 4, + 52, + 2, + 4, + 1, + 17, + 3, + 9, + 16, + 3, + 3, + 70, + 1, + 1, + 3, + 98, + 1, + 1, + 17, + 3, + 47, + 3, + 3, + 1, + 128, + 1, + 7, + 55, + 2, + 1, + 130, + 1, + 17, + 3, + 51, + 2, + 3, + 1, + 17, + 1, + 10, + 16, + 1, + 1, + 7, + 1, + 1, + 1, + 43, + 1, + 5, + 70, + 1, + 2, + 1, + 17, + 3, + 66, + 3, + 3, + 1, + 82, + 0, + 0, + 2, + 48, + 0, + 0, + 68, + 0, + 0, + 2, + 17, + 1, + 65, + 3, + 1, + 0, + 17, + 0, + 11, + 16, + 0, + 0, + 7, + 0, + 1, + 1, + 4, + 0, + 1, + 82, + 0, + 0, + 2, + 82, + 0, + 0, + 2, + 17, + 1, + 12, + 16, + 1, + 1, + 69, + 0, + 0, + 1, + 98, + 0, + 0, + 17, + 1, + 79, + 3, + 1, + 0, + 17, + 0, + 13, + 16, + 0, + 0, + 7, + 0, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 39, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "GetIncentives", + "mode": "readonly", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "kramaID", + "type": "string" + } + ], + "returns": [ + { + "slot": 0, + "label": "incentive", + "type": "u64" + } + ], + "executes": { + "bin": [ + 128, + 0, + 0, + 4, + 1, + 0, + 86, + 1, + 0, + 1, + 82, + 1, + 1, + 2, + 82, + 1, + 1, + 0, + 5, + 1, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 40, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "GetReferralRewards", + "mode": "readonly", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "addr", + "type": "address" + } + ], + "returns": [ + { + "slot": 0, + "label": "incentive", + "type": "u64" + } + ], + "executes": { + "bin": [ + 128, + 0, + 5, + 4, + 1, + 0, + 86, + 1, + 0, + 1, + 5, + 1, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 41, + "deps": [ + 14, + 15, + 12, + 45, + 30 + ], + "kind": "routine", + "data": { + "name": "AddIncentives", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "incentiveIDs", + "type": "[]string" + }, + { + "slot": 1, + "label": "incentiveAmounts", + "type": "[]u64" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 17, + 1, + 45, + 12, + 0, + 1, + 0, + 4, + 0, + 0, + 48, + 1, + 0, + 4, + 2, + 1, + 48, + 3, + 2, + 70, + 1, + 1, + 3, + 17, + 3, + 13, + 3, + 3, + 1, + 17, + 1, + 14, + 16, + 1, + 1, + 7, + 1, + 1, + 128, + 1, + 10, + 55, + 3, + 1, + 128, + 4, + 0, + 43, + 5, + 5, + 48, + 6, + 0, + 1, + 68, + 7, + 5, + 6, + 98, + 7, + 7, + 17, + 8, + 108, + 3, + 8, + 7, + 80, + 7, + 0, + 5, + 84, + 9, + 4, + 7, + 98, + 9, + 9, + 17, + 10, + 32, + 3, + 10, + 9, + 98, + 9, + 9, + 17, + 10, + 34, + 2, + 10, + 1, + 98, + 9, + 9, + 1, + 17, + 10, + 40, + 3, + 10, + 9, + 17, + 9, + 15, + 16, + 9, + 9, + 8, + 9, + 1, + 86, + 9, + 4, + 7, + 80, + 10, + 2, + 5, + 43, + 11, + 5, + 82, + 12, + 9, + 2, + 82, + 12, + 12, + 2, + 55, + 12, + 12, + 43, + 13, + 5, + 70, + 13, + 12, + 13, + 17, + 14, + 56, + 3, + 14, + 13, + 103, + 13, + 10, + 12, + 17, + 14, + 12, + 16, + 14, + 14, + 104, + 13, + 13, + 14, + 36, + 11, + 13, + 1, + 102, + 13, + 10, + 11, + 36, + 10, + 13, + 82, + 13, + 9, + 2, + 82, + 14, + 13, + 0, + 101, + 15, + 14, + 10, + 54, + 14, + 15, + 83, + 13, + 0, + 14, + 83, + 9, + 2, + 13, + 101, + 10, + 3, + 10, + 36, + 3, + 10, + 43, + 10, + 5, + 70, + 10, + 12, + 10, + 17, + 12, + 102, + 3, + 12, + 10, + 128, + 10, + 5, + 82, + 12, + 9, + 2, + 82, + 12, + 12, + 3, + 84, + 12, + 10, + 12, + 98, + 12, + 12, + 17, + 13, + 81, + 3, + 13, + 12, + 98, + 12, + 12, + 17, + 13, + 83, + 2, + 13, + 1, + 98, + 12, + 12, + 1, + 98, + 12, + 12, + 17, + 13, + 96, + 3, + 13, + 12, + 82, + 12, + 9, + 2, + 82, + 12, + 12, + 3, + 86, + 12, + 10, + 12, + 101, + 12, + 12, + 11, + 82, + 14, + 9, + 2, + 82, + 14, + 14, + 3, + 87, + 10, + 14, + 12, + 17, + 13, + 100, + 2, + 13, + 1, + 82, + 12, + 9, + 2, + 82, + 12, + 12, + 3, + 87, + 10, + 12, + 11, + 1, + 129, + 10, + 1, + 87, + 4, + 7, + 9, + 1, + 99, + 5, + 17, + 8, + 19, + 2, + 8, + 1, + 129, + 4, + 54, + 1, + 3, + 129, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 42, + "deps": [ + 8, + 16, + 9, + 17, + 45, + 30 + ], + "kind": "routine", + "data": { + "name": "ChangeNodeLimit", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "kind", + "type": "string" + }, + { + "slot": 1, + "label": "updated", + "type": "u64" + } + ], + "returns": [], + "executes": { + "bin": [ + 10, + 0, + 17, + 1, + 45, + 12, + 0, + 1, + 0, + 4, + 0, + 0, + 17, + 1, + 8, + 16, + 1, + 1, + 70, + 1, + 0, + 1, + 98, + 1, + 1, + 17, + 2, + 26, + 3, + 2, + 1, + 128, + 1, + 6, + 55, + 3, + 1, + 4, + 4, + 1, + 68, + 5, + 4, + 3, + 98, + 5, + 5, + 17, + 6, + 20, + 3, + 6, + 5, + 17, + 5, + 16, + 16, + 5, + 5, + 8, + 5, + 1, + 36, + 3, + 4, + 54, + 1, + 3, + 129, + 1, + 17, + 2, + 54, + 2, + 2, + 1, + 17, + 1, + 9, + 16, + 1, + 1, + 70, + 0, + 0, + 1, + 98, + 0, + 0, + 17, + 1, + 49, + 3, + 1, + 0, + 128, + 0, + 7, + 55, + 2, + 0, + 4, + 3, + 1, + 68, + 4, + 3, + 2, + 98, + 4, + 4, + 17, + 5, + 43, + 3, + 5, + 4, + 17, + 4, + 16, + 16, + 4, + 4, + 8, + 4, + 1, + 36, + 2, + 3, + 54, + 0, + 2, + 129, + 0, + 17, + 1, + 53, + 2, + 1, + 1, + 17, + 0, + 17, + 16, + 0, + 0, + 8, + 0, + 1, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 43, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "ApproveKramaIDs", + "mode": "persistent", + "kind": "internal", + "accepts": [ + { + "slot": 0, + "label": "kramaIDs", + "type": "[]string" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 4, + 4, + 1, + 0, + 43, + 2, + 5, + 48, + 3, + 1, + 1, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 17, + 3, + 5, + 4, + 80, + 4, + 1, + 2, + 43, + 6, + 1, + 98, + 6, + 6, + 87, + 0, + 4, + 6, + 1, + 99, + 2, + 17, + 5, + 4, + 2, + 5, + 1, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 44, + "deps": [ + 30 + ], + "kind": "routine", + "data": { + "name": "IsMaster", + "mode": "readonly", + "kind": "internal", + "accepts": [ + { + "slot": 0, + "label": "moiID", + "type": "string" + } + ], + "returns": [ + { + "slot": 0, + "label": "ok", + "type": "bool" + } + ], + "executes": { + "bin": [ + 128, + 0, + 8, + 82, + 1, + 0, + 0, + 4, + 2, + 0, + 70, + 1, + 1, + 2, + 5, + 1, + 0, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 45, + "deps": [ + 18, + 30 + ], + "kind": "routine", + "data": { + "name": "AuthenticateAdmin", + "mode": "readonly", + "kind": "internal", + "accepts": [], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 9, + 115, + 1, + 73, + 1, + 1, + 84, + 1, + 0, + 1, + 98, + 1, + 1, + 17, + 2, + 10, + 3, + 2, + 1, + 98, + 1, + 1, + 17, + 2, + 12, + 2, + 2, + 1, + 98, + 1, + 1, + 1, + 17, + 2, + 18, + 3, + 2, + 1, + 17, + 1, + 18, + 16, + 1, + 1, + 7, + 1, + 1, + 130, + 0 + ] + }, + "catches": [] + } + } + ] +} \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/guardian.polo b/packages/js-moi-manifest/manifests/guardian.polo new file mode 100644 index 00000000..37150bc0 --- /dev/null +++ b/packages/js-moi-manifest/manifests/guardian.polo @@ -0,0 +1 @@ +0x0e4f031e9e01012f064e504953410fbf0f0ede0d9e1bbe24ee27ee358e42ae4b8e57ae5bce5f8e6dae78de7bfe8501de9301fe9c01deab01deb301febd019ec301fec5019ecb01eece01bed2019ed601fedf01aeee018ef601ee8802be9702aec802ceab03be8104ee8f049ea004aeb004decf049eff04beae05aebe05cecd05fe87069ea906cebb06bec9065f0300068e01636f6e7374616e742f0666737472696e6730783036363936653736363136633639363432303732363536363635373237323631366337333230363936653730373537343733336132303664363937333664363137343633363836353634323037333639376136355f0310169e0101636f6e7374616e742f0666737472696e673078303636393665373636313663363936343230363737353631373236343639363136653230363936653730373537343733336132303664363937333664363137343633363836353634323037333639376136355f0310169e0102636f6e7374616e742f0666737472696e6730783036366637303635373236313734366637323230363136633732363536313634373932303635373836393733373437335f0310169e0103636f6e7374616e742f06367536343078303330325f0310169e0104636f6e7374616e742f0666737472696e67307830363733363536653634363537323230363937333230366536663734323037343638363532303666373036353732363137343666373232303666363632303734363836353230363737353631373236343639363136655f0310169e0105636f6e7374616e742f0666737472696e6730783036373336353665363436353732323036393733323036653666373432303631323037363635373236393636363936353634323036663730363537323631373436663732336132305f0310169e0106636f6e7374616e742f0666737472696e6730783036363737353631373236343639363136653230363136633732363536313634373932303635373836393733373437335f0310169e0107636f6e7374616e742f0666737472696e67307830363637373536313732363436393631366532303662373236313664363132303639363432303639373332303665366637343230363137303730373236663736363536345f0310169e0108636f6e7374616e742f0666737472696e67307830363662373936335f0310169e0109636f6e7374616e742f0666737472696e67307830363662373936325f0310169e010a636f6e7374616e742f0666737472696e673078303637353665363537383730363536333734363536343230373636353732363936363639363336313734363936663665323036623639366536343230363536653633366637353665373436353732363536345f0310169e010b636f6e7374616e742f0666737472696e673078303636653666363436353230366336393664363937343230373236353631363336383635363432303636366637323230366637303635373236313734366637325f0310169e010c636f6e7374616e742f06367536343078303336345f0310169e010d636f6e7374616e742f0666737472696e67307830363639366537363631366336393634323037323635363636353732373236313663323037303635373236333635366537343631363736355f0310169e010e636f6e7374616e742f0666737472696e6730783036363936653736363136633639363432303639366536333635366537343639373636353230363936653730373537343733336132303664363937333664363137343633363836353634323037333639376136355f0310169e010f636f6e7374616e742f0666737472696e6730783036363737353631373236343639363136653230363436663635373332303665366637343230363537383639373337345f0310169e0110636f6e7374616e742f0666737472696e67307830363735373036343631373436353634323036633639366436393734323036333631366536653666373432303632363532303632363532303663363537333733323037343638363136653230363537383639373337343639366536375f0310169e0111636f6e7374616e742f0666737472696e67307830363639366537363631366336393634323036633639366436393734323036623639366536345f0310169e0112636f6e7374616e742f0666737472696e67307830363631363336333635373337333230363436353665363936353634323132303665366637343230363136653230363136343664363936655f031e46b601131f031c747970656465666d61705b737472696e675d636c6173732e477561726469616e5f031016860114747970656465665b5d737472696e675f031e46b601151f031a747970656465666d61705b737472696e675d636c6173732e4f70657261746f725f031016860116747970656465666d61705b737472696e675d626f6f6c5f031016860117747970656465666d61705b616464726573735d7536345f031016860118747970656465666d61705b616464726573735d626f6f6c4f0310166e19636c6173734f066ede074d61737465725f0efe019e043f0306564d4f494944737472696e673f0316760157616c6c6574616464726573733f031676025075624b657962797465730f5f031e469e011a1f031b636c6173735f068e01de0b4f70657261746f725f0ede028e074f0306a6014964656e746966696572737472696e674f0316d60101566572696669636174696f6e636c6173732e56657269667950726f6f664f0316a60102477561726469616e735b5d737472696e670f4f0310166e1b636c6173735f06be01ce0556657269667950726f6f663f0eee013f0306464b696e64737472696e673f0316660150726f6f6662797465730f5f031e469e011c1f031d636c6173735f068e018e10477561726469616e9f010e9e02fe04de089e0b3f0306764b72616d614944737472696e674f0316b601014f70657261746f724944737472696e674f0316a60102496e63656e74697665636c6173732e496e63656e746976654f0316a601035075626c69634b657962797465734f0316a6010445787472614461746162797465730f4f0310166e1d636c6173735f069e01be0c496e63656e746976657f0ede01fe03fe063f030666416d6f756e747536343f0316760157616c6c6574616464726573734f0316860202526566657272616c50657263656e747536344f0316f60103526566657272616c57616c6c6574616464726573730f6f031e8601de011e3f0313231c1a1973746174653f06ae0170657273697374656e74df020efe04be08be0dfe10ce148e19de1bae1eae22ee264f03069601477561726469616e736d61705b737472696e675d636c6173732e477561726469616e4f0316f601014b6e6f776e477561726469616e735b5d737472696e674f0316a601024f70657261746f72736d61705b737472696e675d636c6173732e4f70657261746f724f0316f601034b6e6f776e4f70657261746f72735b5d737472696e674f0316960104417070726f7665646d61705b737472696e675d626f6f6c4f0316860205526566657272616c526577617264736d61705b616464726573735d7536344f0316d601064e6f64654c696d69744b59437536344f0316d601074e6f64654c696d69744b59427536344f0316f601084d61737465724f70657261746f72636c6173732e4d61737465724f0316f6010941646d696e6973747261746f72736d61705b616464726573735d626f6f6c4f031686020a546f74616c496e63656e74697665737536346f031eb601ae021f5f0303132333191c1a1e726f7574696e65cf0106668602ee02de26ee26ae5e496d706f727470657273697374656e746465706c6f79df020eee02ae059e098e0dee0fae13ce169e19ee1bbe1e3f0306666d6173746572636c6173732e4d61737465723f0316760161646d696e735b5d616464726573734f0316a60102677561726469616e735b5d636c6173732e477561726469616e4f0316a601036f70657261746f72735b5d636c6173732e4f70657261746f724f0316960104617070726f7665645b5d737472696e674f0316e60105726566657272616c41646472735b5d616464726573734f0316860206726566657272616c416d6f756e74735b5d7536344f03168601076b6e6f776e47735b5d737472696e674f03168601086b6e6f776e4f735b5d737472696e674f0316d601096e6f64654c696d69744b59437536344f0316d6010a6e6f64654c696d69744b59427536340f5f06e636e03680000804010036000181008000090401012b02053003010144040203620404110515030504500401022b060162060657000406016302110508020501810080000a3701008002000403022b0405300503014406040562060611072f0307065006030452080600550902083609065702080952080602520808006508010824010801630411071d020701810236000181008000020401032b020530030101440402036204041105450305045004010252060400550700063607045700060701630211053702050181008000040401042b02053003010144040203620404110558030504500401022b06016206065700040601630211054b0205018100040005300100040206300302460101031103640303011101001001010701018001052b0305300400014405030462050511067403060550050003500702035701050701630311066802060181018001010403072b040530050301440604056206061107850307065006030434010601630411077a02070181018001030403082b040530050301440604056206061107960307065006030434010601630411078b0207018101800006040109360001810080000704010a36000181000f6f031eb602ae03208f0103132333435363730114191a1c1d2b1e726f7574696e65cf010656f601de02be19ce19fe4f536574757070657273697374656e746465706c6f79ff010eee02de059e08ee0aae0dbe10ce123f0306666d6173746572636c6173732e4d61737465724f0316a60101677561726469616e735b5d737472696e674f03168601027075626b6579735b5d62797465734f0316b60103696e63656e74697665735b5d7536343f0316760461646d696e735b5d616464726573734f0316c60105707265417070726f7665645b5d737472696e674f03169601066c696d69744b59437536344f03169601076c696d69744b59427536340f5f06d635d0352b00010401013002010403023004034602020462020261000002110212030200300401040503300605460404066204046100000411021203020001620000110219030200110001100000070001800008040200360002810080000304020052020200340002810080000211021a2a0202040400520604005302000611061b2a0606530201061106142a0606530202065204040055060004360602570004068100800006040206360002810080000704040736000481008000090406042b07053008060144090708620909110a4d030a09500906072b0b01620b0b5700090b016307110a40020a0181000a000406055300000611072b0c0007002b0005300701014408000762080811098c03090850080100800a042b0b01620b0b570a080b810a800a02040b00520b0b00560c0a0b520d0c02340d08530c020d570a0b0c810a800a0a370b0a800c00110d1c2a0d0d530d0008040e00520f0e00530d010f110f1d2a0f0f50100500530f0010520e0e01530f010e530d020f500e0300530d030e550e0c08360e0d570c080e500d0500650d0b0d240b0d810c360a0b810a800a01340a08810a0163001109560209010f6f031e8601fe01213f0313232d2b1e726f7574696e65cf0106769602fe02ee05fe05ee09417070726f766570657273697374656e74696e766f6b651f0e4f030686016b72616d614944735b5d737472696e670f5f06960390030a0011012d0c0001000a000401005300000111012b0c0001000f5f031e46be01221f031e726f7574696e65df0106a601a6028e03be05fe06ae0c4973417070726f766564726561646f6e6c79696e766f6b651f0e3f0306766b72616d614944737472696e671f0e3f0306266f6b626f6f6c5f06d604d0048000040401005401000162010111020903020162010111020b0202016201010105010082000f5f031e46be01231f031e726f7574696e65df0106a601a6028e039e05de068e0c49735665726966696564726561646f6e6c79696e766f6b651f0e3f0306566d6f694944737472696e671f0e3f0306266f6b626f6f6c5f06d604d0048000020401005401000162010111020903020162010111020b0202016201010105010082000f6f031ee601de02246f03132333435302141b1a2d1e726f7574696e65df01068602a6038e04ee0afe0afe1952656769737465724f70657261746f7270657273697374656e74696e766f6b653f0efe013f0306566d6f694944737472696e674f0316d60101766572696669636174696f6e636c6173732e56657269667950726f6f660f5f06a60ea00e0a0011012d0c0001008000020401005402000162020211030c03030262020211030e0203016202020162020211031503030211020210020208020111021a2a020253020001040301530201032b03051104142c030403530202035503000136030257000103810080000304010034000181000f6f031eb602ae03258f010313233343536373030405061c2c261e726f7574696e65df01068602a6038e04de07ee07be295265676973746572477561726469616e70657273697374656e74696e766f6b651f0e4f03068601677561726469616e636c6173732e477561726469616e0f5f06f620f0200400005201000173024902024802021103031003034a04010a0553050003530501040d03011a05520303004602020311031303030211020410020207020111021a2a02028003025404030162040411051e030504620404110520020501620404011105270305041104051004044304040107040156040301250204820352030000800400540504036205051106340306056205051106360206016205050162050511063d03060511050610050507050182040a045304000111052c0c0405045204040011054b0305040a0453040002530401001105260c0405040180040252050202340503530202055704010281048001005502010336020057010302810180000134000381000f6f031e96038e0426cf010313233343536373830193010708090a0b0c0d1a1c1e726f7574696e65df0106b602b603be04ee0bfe0bbe2843616e5265676973746572477561726469616e726561646f6e6c79696e7465726e616c3f0ebe034f030686016f70657261746f72636c6173732e4f70657261746f724f0316960101677561726469616e636c6173732e477561726469616e0f5f06e61be01b800004040101520101005401000162010111020a03020162010111020c02020162010101110212030201110107100101070101820004000052010001520101002b02051103081003034603010362030311042303040380030637020382031104340204011103091003034601010362010111032f030301800107370201820111033302030111010a100101070101012b010546010201110342030301520000023000004400000211014103010011000b10000007000101040001520000025200000211010c1001014500000162000011014f03010011000d1000000700010f5f031e46be01271f031e726f7574696e65df0106d601d602be03ee059e08ee0b476574496e63656e7469766573726561646f6e6c79696e766f6b651f0e3f0306766b72616d614944737472696e671f0e4f03069601696e63656e746976657536345f06f602f00280000004010056010001520101025201010005010082000f5f031e46be01281f031e726f7574696e65df0106a602a6038e049e06ce089e0b476574526566657272616c52657761726473726561646f6e6c79696e766f6b651f0e3f03064661646472616464726573731f0e4f03069601696e63656e746976657536345f06f601f0018000050401005601000105010082000f6f031ec601be02295f03132333430e0f0c2d1e726f7574696e65df0106d601f602de03de0aee0a9e35416464496e63656e746976657370657273697374656e74696e766f6b653f0e9e034f0306c601696e63656e746976654944735b5d737472696e674f0316960201696e63656e74697665416d6f756e74735b5d7536340f5f06d629d0290a0011012d0c0001000400003001000402013003024601010311030d03030111010e10010107010180010a3703018004002b0505300600014407050662070711086c0308075007000554090407620909110a20030a09620909110a22020a0162090901110a28030a0911090f10090908090156090407500a02052b0b05520c0902520c0c02370c0c2b0d05460d0c0d110e38030e0d670d0a0c110e0c100e0e680d0d0e240b0d01660d0a0b240a0d520d0902520e0d00650f0e0a360e0f530d000e5309020d650a030a24030a2b0a05460a0c0a110c66030c0a800a05520c0902520c0c03540c0a0c620c0c110d51030d0c620c0c110d53020d01620c0c01620c0c110d60030d0c520c0902520c0c03560c0a0c650c0c0b520e0902520e0e03570a0e0c110d64020d01520c0902520c0c03570a0c0b01810a0157040709016305110813020801810436010381010f6f031ee601de022a6f031323334353081009112d1e726f7574696e65df0106f6019603fe039e08ae08ee1b4368616e67654e6f64654c696d697470657273697374656e74696e766f6b653f0eee013f0306466b696e64737472696e674f0316860101757064617465647536340f5f06e612e0120a0011012d0c0001000400001101081001014601000162010111021a030201800106370301040401440504036205051106140306051105101005050805012403043601038101110236020201110109100101460000016200001101310301008000073702000403014404030262040411052b0305041104101004040804012402033600028100110135020101110011100000080001010f5f031e46be012b1f031e726f7574696e65df0106f60196039e048e079e07ae0e417070726f76654b72616d6149447370657273697374656e74696e7465726e616c1f0e4f030686016b72616d614944735b5d737472696e670f5f06b606b0068000040401002b02053003010144040203620404110511030504500401022b06016206065700040601630211050402050181000f5f031e46be012c1f031e726f7574696e65df0106860186028e039e05de06ee0949734d6173746572726561646f6e6c79696e7465726e616c1f0e3f0306566d6f694944737472696e671f0e3f0306266f6b626f6f6c5f06b602b002800008520100000402004601010205010082000f5f031e66de012d2f0313121e726f7574696e65df0106960296039e04ae04be04ce0b41757468656e74696361746541646d696e726561646f6e6c79696e7465726e616c0f0f5f06b606b00680000973014901015401000162010111020a03020162010111020c0202016201010111021203020111011210010107010182000f \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/lock-ledger.json b/packages/js-moi-manifest/manifests/lock-ledger.json new file mode 100644 index 00000000..9c6af9ea --- /dev/null +++ b/packages/js-moi-manifest/manifests/lock-ledger.json @@ -0,0 +1,372 @@ +{ + "syntax": 1, + "engine": { + "kind": "PISA", + "flags": [] + }, + "elements": [ + { + "ptr": 0, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e73756666696369656e742062616c616e6365" + } + }, + { + "ptr": 1, + "kind": "state", + "data": { + "mode": "ephemeral", + "fields": [ + { + "slot": 0, + "label": "Spendable", + "type": "u256" + }, + { + "slot": 1, + "label": "Lockedup", + "type": "u256" + } + ] + } + }, + { + "ptr": 2, + "kind": "state", + "data": { + "mode": "persistent", + "fields": [ + { + "slot": 0, + "label": "Name", + "type": "string" + }, + { + "slot": 1, + "label": "Symbol", + "type": "string" + }, + { + "slot": 2, + "label": "Supply", + "type": "u256" + }, + { + "slot": 3, + "label": "Owner", + "type": "address" + } + ] + } + }, + { + "ptr": 3, + "deps": [ + 2, + 1 + ], + "kind": "routine", + "data": { + "name": "Seed", + "mode": "persistent", + "kind": "deploy", + "accepts": [ + { + "slot": 0, + "label": "name", + "type": "string" + }, + { + "slot": 1, + "label": "symbol", + "type": "string" + }, + { + "slot": 2, + "label": "supply", + "type": "u256" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 0, + 4, + 1, + 0, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 1, + 4, + 1, + 1, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 2, + 4, + 1, + 2, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 3, + 115, + 2, + 73, + 2, + 2, + 54, + 0, + 2, + 129, + 0, + 115, + 0, + 131, + 2, + 0, + 0, + 54, + 2, + 1, + 132, + 2, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 4, + "deps": [ + 1 + ], + "kind": "routine", + "data": { + "name": "Register", + "mode": "ephemeral", + "kind": "enlist", + "accepts": [], + "returns": [], + "executes": { + "bin": [ + 115, + 0, + 131, + 1, + 0, + 0, + 43, + 2, + 7, + 54, + 1, + 2, + 132, + 1, + 0, + 115, + 0, + 131, + 1, + 1, + 0, + 43, + 2, + 7, + 54, + 1, + 2, + 132, + 1, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 5, + "deps": [ + 0, + 1 + ], + "kind": "routine", + "data": { + "name": "Lockup", + "mode": "ephemeral", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "amount", + "type": "u256" + } + ], + "returns": [], + "executes": { + "bin": [ + 115, + 0, + 131, + 1, + 0, + 0, + 55, + 2, + 1, + 4, + 3, + 0, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 11, + 3, + 5, + 4, + 17, + 4, + 0, + 16, + 4, + 4, + 7, + 4, + 1, + 102, + 3, + 2, + 3, + 36, + 2, + 3, + 54, + 1, + 2, + 132, + 1, + 0, + 115, + 0, + 131, + 1, + 1, + 0, + 55, + 2, + 1, + 4, + 3, + 0, + 101, + 3, + 2, + 3, + 36, + 2, + 3, + 54, + 1, + 2, + 132, + 1, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 6, + "deps": [ + 2, + 1 + ], + "kind": "routine", + "data": { + "name": "Mint", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "amount", + "type": "u256" + } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 2, + 55, + 1, + 0, + 4, + 2, + 0, + 101, + 1, + 1, + 2, + 54, + 0, + 1, + 129, + 0, + 115, + 0, + 131, + 1, + 0, + 0, + 55, + 2, + 1, + 4, + 3, + 0, + 101, + 2, + 2, + 3, + 54, + 1, + 2, + 132, + 1, + 0 + ] + }, + "catches": [] + } + } + ] +} \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/lock-ledger.polo b/packages/js-moi-manifest/manifests/lock-ledger.polo new file mode 100644 index 00000000..4e2145d6 --- /dev/null +++ b/packages/js-moi-manifest/manifests/lock-ledger.polo @@ -0,0 +1 @@ +0x0e4f031e9e01012f064e504953410fdf010ebe08be10be1cee31ce3d9e505f0300068e01636f6e7374616e742f0666737472696e6730783036363936653733373536363636363936333639363536653734323036323631366336313665363336354f0310166e0173746174653f069e01657068656d6572616c3f0eae024f030696015370656e6461626c65753235364f03169601014c6f636b65647570753235364f0310166e0273746174653f06ae0170657273697374656e747f0eee01fe03ee053f0306464e616d65737472696e673f0316760153796d626f6c737472696e673f03167602537570706c79753235363f031666034f776e6572616464726573735f031e66de01032f03130201726f7574696e65cf010646e601ce028e099e099e115365656470657273697374656e746465706c6f795f0eee01fe033f0306466e616d65737472696e673f0316760173796d626f6c737472696e673f03167602737570706c79753235360f5f06a607a007800000040100360001810080000104010136000181008000020401023600018100800003730249020236000281007300830200003602018402000f5f031e46be01041f0301726f7574696e65df010686019602fe028e039e03de075265676973746572657068656d6572616c656e6c6973740f0f5f06e603e0037300830100002b02073601028401007300830101002b02073601028401000f5f031e56ce01052f030301726f7574696e65cf010666f601de02de04ee04ce0e4c6f636b7570657068656d6572616c696e766f6b651f0e3f030666616d6f756e74753235360f5f06860980097300830100003702010403004404020362040411050b03050411040010040407040166030203240203360102840100730083010100370201040300650302032402033601028401000f5f031e66de01062f03130201726f7574696e65cf010646e601ce02ce04de04be0a4d696e7470657273697374656e74696e766f6b651f0e3f030666616d6f756e74753235360f5f0686058005800002370100040200650101023600018100730083010000370201040300650202033601028401000f \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/tokenledger.json b/packages/js-moi-manifest/manifests/tokenledger.json index 9ebaf76a..93e95505 100644 --- a/packages/js-moi-manifest/manifests/tokenledger.json +++ b/packages/js-moi-manifest/manifests/tokenledger.json @@ -1,865 +1,865 @@ { "syntax": 1, "engine": { - "kind": "PISA", - "flags": [] + "kind": "PISA", + "flags": [] }, "elements": [ - { - "ptr": 0, - "kind": "constant", - "data": { - "type": "string", - "value": "0x0673656564656420" - } - }, - { - "ptr": 1, - "kind": "constant", - "data": { - "type": "string", - "value": "0x06207769746820" - } - }, - { - "ptr": 2, - "kind": "constant", - "data": { - "type": "string", - "value": "0x0620" - } - }, - { - "ptr": 3, - "kind": "constant", - "data": { - "type": "u64", - "value": "0x0312" - } - }, - { - "ptr": 4, - "kind": "constant", - "data": { - "type": "string", - "value": "0x0673656e64657220686173206e6f2062616c616e6365" - } - }, - { - "ptr": 5, - "kind": "constant", - "data": { - "type": "string", - "value": "0x0673656e6465722068617320696e73756666696369656e742062616c616e6365" - } - }, - { - "ptr": 6, - "kind": "constant", - "data": { - "type": "string", - "value": "0x06696e76616c6964206275726e20616d6f756e743a206578636565647320737570706c79" - } - }, - { - "ptr": 7, - "kind": "constant", - "data": { - "type": "string", - "value": "0x06696e76616c6964206275726e20616d6f756e743a2073656e64657220686173206e6f2062616c616e6365" - } - }, - { - "ptr": 8, - "kind": "constant", - "data": { - "type": "string", - "value": "0x06696e76616c6964206275726e20616d6f756e743a20696e73756666696369656e742062616c616e6365" + { + "ptr": 0, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0673656564656420" + } + }, + { + "ptr": 1, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06207769746820" + } + }, + { + "ptr": 2, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0620" + } + }, + { + "ptr": 3, + "kind": "constant", + "data": { + "type": "u64", + "value": "0x0312" + } + }, + { + "ptr": 4, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0673656e64657220686173206e6f2062616c616e6365" + } + }, + { + "ptr": 5, + "kind": "constant", + "data": { + "type": "string", + "value": "0x0673656e6465722068617320696e73756666696369656e742062616c616e6365" + } + }, + { + "ptr": 6, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c6964206275726e20616d6f756e743a206578636565647320737570706c79" + } + }, + { + "ptr": 7, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c6964206275726e20616d6f756e743a2073656e64657220686173206e6f2062616c616e6365" + } + }, + { + "ptr": 8, + "kind": "constant", + "data": { + "type": "string", + "value": "0x06696e76616c6964206275726e20616d6f756e743a20696e73756666696369656e742062616c616e6365" + } + }, + { + "ptr": 9, + "kind": "typedef", + "data": "map[address]u256" + }, + { + "ptr": 10, + "kind": "event", + "data": { + "name": "Transfer", + "topics": 2, + "fields": [ + { + "slot": 0, + "label": "sender", + "type": "address" + }, + { + "slot": 1, + "label": "receiver", + "type": "address" + }, + { + "slot": 2, + "label": "amount", + "type": "u256" } - }, - { - "ptr": 9, - "kind": "typedef", - "data": "map[address]u256" - }, - { - "ptr": 10, - "kind": "event", - "data": { - "name": "Transfer", - "topics": 2, - "fields": [ - { - "slot": 0, - "label": "sender", - "type": "address" - }, - { - "slot": 1, - "label": "receiver", - "type": "address" - }, - { - "slot": 2, - "label": "amount", - "type": "u256" - } - ] + ] + } + }, + { + "ptr": 11, + "kind": "state", + "data": { + "mode": "persistent", + "fields": [ + { + "slot": 0, + "label": "Symbol", + "type": "string" + }, + { + "slot": 1, + "label": "Supply", + "type": "u256" + }, + { + "slot": 2, + "label": "Balances", + "type": "map[address]u256" } - }, - { - "ptr": 11, - "kind": "state", - "data": { - "mode": "persistent", - "fields": [ - { - "slot": 0, - "label": "Symbol", - "type": "string" - }, - { - "slot": 1, - "label": "Supply", - "type": "u256" - }, - { - "slot": 2, - "label": "Balances", - "type": "map[address]u256" - } - ] + ] + } + }, + { + "ptr": 12, + "deps": [ + 0, + 1, + 2, + 11 + ], + "kind": "routine", + "data": { + "name": "Seed", + "mode": "persistent", + "kind": "deploy", + "accepts": [ + { + "slot": 0, + "label": "symbol", + "type": "string" + }, + { + "slot": 1, + "label": "supply", + "type": "u256" } - }, - { - "ptr": 12, - "deps": [ - 0, - 1, - 2, - 11 - ], - "kind": "routine", - "data": { - "name": "Seed", - "mode": "persistent", - "kind": "deploy", - "accepts": [ - { - "slot": 0, - "label": "symbol", - "type": "string" - }, - { - "slot": 1, - "label": "supply", - "type": "u256" - } - ], - "returns": [], - "executes": { - "bin": [ - 128, - 0, - 0, - 4, - 1, - 0, - 54, - 0, - 1, - 129, - 0, - 128, - 0, - 1, - 4, - 2, - 1, - 54, - 0, - 2, - 129, - 0, - 128, - 0, - 2, - 115, - 3, - 73, - 3, - 3, - 87, - 0, - 3, - 2, - 129, - 0, - 17, - 0, - 0, - 16, - 0, - 0, - 115, - 3, - 73, - 3, - 3, - 72, - 3, - 3, - 67, - 0, - 0, - 3, - 17, - 3, - 1, - 16, - 3, - 3, - 67, - 0, - 0, - 3, - 72, - 2, - 2, - 67, - 0, - 0, - 2, - 17, - 2, - 2, - 16, - 2, - 2, - 67, - 0, - 0, - 2, - 67, - 0, - 0, - 1, - 66, - 0, - 0, - 114, - 1, - 73, - 1, - 1, - 6, - 0, - 1 - ] - }, - "catches": [] + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 0, + 4, + 1, + 0, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 1, + 4, + 2, + 1, + 54, + 0, + 2, + 129, + 0, + 128, + 0, + 2, + 115, + 3, + 73, + 3, + 3, + 87, + 0, + 3, + 2, + 129, + 0, + 17, + 0, + 0, + 16, + 0, + 0, + 115, + 3, + 73, + 3, + 3, + 72, + 3, + 3, + 67, + 0, + 0, + 3, + 17, + 3, + 1, + 16, + 3, + 3, + 67, + 0, + 0, + 3, + 72, + 2, + 2, + 67, + 0, + 0, + 2, + 17, + 2, + 2, + 16, + 2, + 2, + 67, + 0, + 0, + 2, + 67, + 0, + 0, + 1, + 66, + 0, + 0, + 114, + 1, + 73, + 1, + 1, + 6, + 0, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 13, + "deps": [ + 3 + ], + "kind": "routine", + "data": { + "name": "Decimals", + "mode": "readonly", + "kind": "invoke", + "accepts": [], + "returns": [ + { + "slot": 0, + "label": "decimals", + "type": "u64" } - }, - { - "ptr": 13, - "deps": [ - 3 - ], - "kind": "routine", - "data": { - "name": "Decimals", - "mode": "readonly", - "kind": "invoke", - "accepts": [], - "returns": [ - { - "slot": 0, - "label": "decimals", - "type": "u64" - } - ], - "executes": { - "bin": [ - 17, - 0, - 3, - 16, - 0, - 0, - 5, - 0, - 0 - ] - }, - "catches": [] + ], + "executes": { + "bin": [ + 17, + 0, + 3, + 16, + 0, + 0, + 5, + 0, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 14, + "deps": [ + 11 + ], + "kind": "routine", + "data": { + "name": "BalanceOf", + "mode": "readonly", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "addr", + "type": "address" } - }, - { - "ptr": 14, - "deps": [ - 11 - ], - "kind": "routine", - "data": { - "name": "BalanceOf", - "mode": "readonly", - "kind": "invoke", - "accepts": [ - { - "slot": 0, - "label": "addr", - "type": "address" - } - ], - "returns": [ - { - "slot": 0, - "label": "balance", - "type": "u256" - } - ], - "executes": { - "bin": [ - 128, - 0, - 2, - 4, - 1, - 0, - 84, - 2, - 0, - 1, - 98, - 2, - 2, - 17, - 3, - 9, - 3, - 3, - 2, - 98, - 2, - 2, - 17, - 3, - 11, - 2, - 3, - 1, - 98, - 2, - 2, - 1, - 98, - 2, - 2, - 17, - 3, - 17, - 3, - 3, - 2, - 86, - 1, - 0, - 1, - 5, - 1, - 0, - 1, - 130, - 0 - ] - }, - "catches": [] + ], + "returns": [ + { + "slot": 0, + "label": "balance", + "type": "u256" } - }, - { - "ptr": 15, - "deps": [ - 4, - 5, - 10, - 11 - ], - "kind": "routine", - "data": { - "name": "Transfer", - "mode": "persistent", - "kind": "invoke", - "accepts": [ - { - "slot": 0, - "label": "amount", - "type": "u256" - }, - { - "slot": 1, - "label": "receiver", - "type": "address" - } - ], - "returns": [], - "executes": { - "bin": [ - 115, - 0, - 73, - 0, - 0, - 128, - 1, - 2, - 84, - 2, - 1, - 0, - 98, - 2, - 2, - 17, - 3, - 10, - 3, - 3, - 2, - 98, - 2, - 2, - 17, - 3, - 12, - 2, - 3, - 1, - 98, - 2, - 2, - 1, - 17, - 3, - 18, - 3, - 3, - 2, - 17, - 2, - 4, - 16, - 2, - 2, - 7, - 2, - 1, - 86, - 2, - 1, - 0, - 4, - 3, - 0, - 68, - 4, - 2, - 3, - 98, - 4, - 4, - 17, - 5, - 28, - 3, - 5, - 4, - 17, - 4, - 5, - 16, - 4, - 4, - 7, - 4, - 1, - 4, - 4, - 1, - 84, - 5, - 1, - 4, - 98, - 5, - 5, - 17, - 6, - 37, - 3, - 6, - 5, - 98, - 5, - 5, - 17, - 6, - 39, - 2, - 6, - 1, - 98, - 5, - 5, - 1, - 17, - 6, - 44, - 3, - 6, - 5, - 43, - 5, - 7, - 87, - 1, - 4, - 5, - 1, - 102, - 2, - 2, - 3, - 87, - 1, - 0, - 2, - 86, - 2, - 1, - 4, - 101, - 2, - 2, - 3, - 87, - 1, - 4, - 2, - 129, - 1, - 10, - 1, - 83, - 1, - 0, - 0, - 4, - 0, - 1, - 83, - 1, - 1, - 0, - 4, - 0, - 0, - 83, - 1, - 2, - 0, - 17, - 0, - 10, - 46, - 0, - 0, - 1, - 114, - 1, - 73, - 1, - 1, - 6, - 0, - 1 - ] - }, - "catches": [] + ], + "executes": { + "bin": [ + 128, + 0, + 2, + 4, + 1, + 0, + 84, + 2, + 0, + 1, + 98, + 2, + 2, + 17, + 3, + 9, + 3, + 3, + 2, + 98, + 2, + 2, + 17, + 3, + 11, + 2, + 3, + 1, + 98, + 2, + 2, + 1, + 98, + 2, + 2, + 17, + 3, + 17, + 3, + 3, + 2, + 86, + 1, + 0, + 1, + 5, + 1, + 0, + 1, + 130, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 15, + "deps": [ + 4, + 5, + 10, + 11 + ], + "kind": "routine", + "data": { + "name": "Transfer", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "amount", + "type": "u256" + }, + { + "slot": 1, + "label": "receiver", + "type": "address" } - }, - { - "ptr": 16, - "deps": [ - 11 - ], - "kind": "routine", - "data": { - "name": "Mint", - "mode": "persistent", - "kind": "invoke", - "accepts": [ - { - "slot": 0, - "label": "amount", - "type": "u256" - } - ], - "returns": [], - "executes": { - "bin": [ - 128, - 0, - 1, - 55, - 1, - 0, - 4, - 2, - 0, - 101, - 2, - 1, - 2, - 36, - 1, - 2, - 54, - 0, - 1, - 129, - 0, - 128, - 0, - 2, - 115, - 1, - 73, - 1, - 1, - 84, - 2, - 0, - 1, - 98, - 2, - 2, - 17, - 3, - 17, - 3, - 3, - 2, - 98, - 2, - 2, - 17, - 3, - 19, - 2, - 3, - 1, - 98, - 2, - 2, - 1, - 17, - 3, - 24, - 3, - 3, - 2, - 43, - 2, - 7, - 87, - 0, - 1, - 2, - 1, - 86, - 2, - 0, - 1, - 4, - 3, - 0, - 101, - 2, - 2, - 3, - 87, - 0, - 1, - 2, - 129, - 0 - ] - }, - "catches": [] + ], + "returns": [], + "executes": { + "bin": [ + 115, + 0, + 73, + 0, + 0, + 128, + 1, + 2, + 84, + 2, + 1, + 0, + 98, + 2, + 2, + 17, + 3, + 10, + 3, + 3, + 2, + 98, + 2, + 2, + 17, + 3, + 12, + 2, + 3, + 1, + 98, + 2, + 2, + 1, + 17, + 3, + 18, + 3, + 3, + 2, + 17, + 2, + 4, + 16, + 2, + 2, + 7, + 2, + 1, + 86, + 2, + 1, + 0, + 4, + 3, + 0, + 68, + 4, + 2, + 3, + 98, + 4, + 4, + 17, + 5, + 28, + 3, + 5, + 4, + 17, + 4, + 5, + 16, + 4, + 4, + 7, + 4, + 1, + 4, + 4, + 1, + 84, + 5, + 1, + 4, + 98, + 5, + 5, + 17, + 6, + 37, + 3, + 6, + 5, + 98, + 5, + 5, + 17, + 6, + 39, + 2, + 6, + 1, + 98, + 5, + 5, + 1, + 17, + 6, + 44, + 3, + 6, + 5, + 43, + 5, + 7, + 87, + 1, + 4, + 5, + 1, + 102, + 2, + 2, + 3, + 87, + 1, + 0, + 2, + 86, + 2, + 1, + 4, + 101, + 2, + 2, + 3, + 87, + 1, + 4, + 2, + 129, + 1, + 10, + 1, + 83, + 1, + 0, + 0, + 4, + 0, + 1, + 83, + 1, + 1, + 0, + 4, + 0, + 0, + 83, + 1, + 2, + 0, + 17, + 0, + 10, + 46, + 0, + 0, + 1, + 114, + 1, + 73, + 1, + 1, + 6, + 0, + 1 + ] + }, + "catches": [] + } + }, + { + "ptr": 16, + "deps": [ + 11 + ], + "kind": "routine", + "data": { + "name": "Mint", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "amount", + "type": "u256" } - }, - { - "ptr": 17, - "deps": [ - 6, - 7, - 8, - 11 - ], - "kind": "routine", - "data": { - "name": "Burn", - "mode": "persistent", - "kind": "invoke", - "accepts": [ - { - "slot": 0, - "label": "amount", - "type": "u256" - } - ], - "returns": [], - "executes": { - "bin": [ - 128, - 0, - 1, - 55, - 1, - 0, - 4, - 2, - 0, - 68, - 3, - 1, - 2, - 98, - 3, - 3, - 17, - 4, - 10, - 3, - 4, - 3, - 17, - 3, - 6, - 16, - 3, - 3, - 7, - 3, - 1, - 102, - 2, - 1, - 2, - 36, - 1, - 2, - 54, - 0, - 1, - 129, - 0, - 128, - 0, - 2, - 115, - 1, - 73, - 1, - 1, - 84, - 2, - 0, - 1, - 98, - 2, - 2, - 17, - 3, - 25, - 3, - 3, - 2, - 98, - 2, - 2, - 17, - 3, - 27, - 2, - 3, - 1, - 98, - 2, - 2, - 1, - 17, - 3, - 33, - 3, - 3, - 2, - 17, - 2, - 7, - 16, - 2, - 2, - 7, - 2, - 1, - 86, - 2, - 0, - 1, - 4, - 3, - 0, - 68, - 2, - 2, - 3, - 98, - 2, - 2, - 17, - 4, - 43, - 3, - 4, - 2, - 17, - 2, - 8, - 16, - 2, - 2, - 7, - 2, - 1, - 86, - 2, - 0, - 1, - 102, - 2, - 2, - 3, - 87, - 0, - 1, - 2, - 129, - 0 - ] - }, - "catches": [] + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 1, + 55, + 1, + 0, + 4, + 2, + 0, + 101, + 2, + 1, + 2, + 36, + 1, + 2, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 2, + 115, + 1, + 73, + 1, + 1, + 84, + 2, + 0, + 1, + 98, + 2, + 2, + 17, + 3, + 17, + 3, + 3, + 2, + 98, + 2, + 2, + 17, + 3, + 19, + 2, + 3, + 1, + 98, + 2, + 2, + 1, + 17, + 3, + 24, + 3, + 3, + 2, + 43, + 2, + 7, + 87, + 0, + 1, + 2, + 1, + 86, + 2, + 0, + 1, + 4, + 3, + 0, + 101, + 2, + 2, + 3, + 87, + 0, + 1, + 2, + 129, + 0 + ] + }, + "catches": [] + } + }, + { + "ptr": 17, + "deps": [ + 6, + 7, + 8, + 11 + ], + "kind": "routine", + "data": { + "name": "Burn", + "mode": "persistent", + "kind": "invoke", + "accepts": [ + { + "slot": 0, + "label": "amount", + "type": "u256" } + ], + "returns": [], + "executes": { + "bin": [ + 128, + 0, + 1, + 55, + 1, + 0, + 4, + 2, + 0, + 68, + 3, + 1, + 2, + 98, + 3, + 3, + 17, + 4, + 10, + 3, + 4, + 3, + 17, + 3, + 6, + 16, + 3, + 3, + 7, + 3, + 1, + 102, + 2, + 1, + 2, + 36, + 1, + 2, + 54, + 0, + 1, + 129, + 0, + 128, + 0, + 2, + 115, + 1, + 73, + 1, + 1, + 84, + 2, + 0, + 1, + 98, + 2, + 2, + 17, + 3, + 25, + 3, + 3, + 2, + 98, + 2, + 2, + 17, + 3, + 27, + 2, + 3, + 1, + 98, + 2, + 2, + 1, + 17, + 3, + 33, + 3, + 3, + 2, + 17, + 2, + 7, + 16, + 2, + 2, + 7, + 2, + 1, + 86, + 2, + 0, + 1, + 4, + 3, + 0, + 68, + 2, + 2, + 3, + 98, + 2, + 2, + 17, + 4, + 43, + 3, + 4, + 2, + 17, + 2, + 8, + 16, + 2, + 2, + 7, + 2, + 1, + 86, + 2, + 0, + 1, + 102, + 2, + 2, + 3, + 87, + 0, + 1, + 2, + 129, + 0 + ] + }, + "catches": [] } + } ] } \ No newline at end of file diff --git a/packages/js-moi-manifest/manifests/tokenledger-polo.txt b/packages/js-moi-manifest/manifests/tokenledger.polo similarity index 100% rename from packages/js-moi-manifest/manifests/tokenledger-polo.txt rename to packages/js-moi-manifest/manifests/tokenledger.polo diff --git a/packages/js-moi-manifest/package.json b/packages/js-moi-manifest/package.json index 4564eb0d..6c306c0e 100644 --- a/packages/js-moi-manifest/package.json +++ b/packages/js-moi-manifest/package.json @@ -24,6 +24,7 @@ "license": "Apache-2.0 OR MIT", "dependencies": { "js-moi-utils": "^0.4.1", - "js-polo": "^0.1.3" + "js-polo": "0.1.4", + "yaml": "^2.6.0" } -} \ No newline at end of file +} diff --git a/packages/js-moi-manifest/src.ts/element-descriptor.ts b/packages/js-moi-manifest/src.ts/element-descriptor.ts index 4f5c1dea..c2e29908 100644 --- a/packages/js-moi-manifest/src.ts/element-descriptor.ts +++ b/packages/js-moi-manifest/src.ts/element-descriptor.ts @@ -2,20 +2,7 @@ import { ErrorCode, ErrorUtils } from "js-moi-utils"; import type { LogicManifest } from "../types/manifest"; import { ContextStateMatrix } from "./context-state-matrix"; -export interface EventDef { - ptr: number; - topics: number; -} - -export interface MethodDef { - ptr: number; - class: string; -} -export interface CallSite { - ptr: number, - kind: string -} /** * This class represents a descriptor for elements in the logic manifest. @@ -23,17 +10,16 @@ export interface CallSite { export class ElementDescriptor { protected stateMatrix: ContextStateMatrix; protected elements: Map = new Map(); - protected callSites: Map = new Map(); + protected callSites: Map = new Map(); protected classDefs: Map = new Map(); - protected methodDefs: Map = new Map(); - protected eventsDef = new Map(); + protected methodDefs: Map = new Map(); + protected eventsDefs = new Map(); - constructor(elements: LogicManifest.Element[] | LogicManifest.Manifest) { - const elementsArr = Array.isArray(elements) ? elements : elements.elements; - this.stateMatrix = new ContextStateMatrix(elementsArr); + constructor(elements: LogicManifest.Element[]) { + this.stateMatrix = new ContextStateMatrix(elements); // Populate the maps for elements, call sites, class and method definitions. - elementsArr.forEach((element) => { + for (const element of elements) { this.elements.set(element.ptr, element); switch (element.kind) { @@ -43,7 +29,7 @@ export class ElementDescriptor { break; case "method": const methodData = element.data as LogicManifest.Method; - const methodDef: MethodDef = { + const methodDef: LogicManifest.MethodDef = { ptr: element.ptr, class: methodData.class, }; @@ -51,20 +37,20 @@ export class ElementDescriptor { break; case "routine": const routineData = element.data as LogicManifest.Routine; - const callsite: CallSite = { + const callsite: LogicManifest.CallSite = { ptr: element.ptr, kind: routineData.kind, }; this.callSites.set(routineData.name, callsite); - break; + break; case "event": const eventData = element.data as LogicManifest.Event; - this.eventsDef.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); + this.eventsDefs.set(eventData.name, { ptr: element.ptr, topics: eventData.topics }); break; default: break; } - }); + } } /** @@ -90,7 +76,7 @@ export class ElementDescriptor { * * @returns {Map} The call sites map. */ - public getCallsites(): Map { + public getCallsites(): Map { return this.callSites; } @@ -103,8 +89,8 @@ export class ElementDescriptor { return this.classDefs; } - public getEvents(): Map { - return this.eventsDef; + public getEvents(): Map { + return this.eventsDefs; } /** @@ -112,7 +98,7 @@ export class ElementDescriptor { * * @returns {Map} The method definitions map. */ - public getMethodDefs(): Map { + public getMethodDefs(): Map { return this.methodDefs; } @@ -204,7 +190,7 @@ export class ElementDescriptor { * @throws {Error} if the event name is invalid. */ public getEventElement(eventName: string) { - const eventDef = this.eventsDef.get(eventName); + const eventDef = this.eventsDefs.get(eventName); if (!eventDef) { return ErrorUtils.throwError(`Invalid event name: ${eventName}`, ErrorCode.INVALID_ARGUMENT); diff --git a/packages/js-moi-manifest/src.ts/index.ts b/packages/js-moi-manifest/src.ts/index.ts index 16720528..1dd352ab 100644 --- a/packages/js-moi-manifest/src.ts/index.ts +++ b/packages/js-moi-manifest/src.ts/index.ts @@ -1,8 +1,10 @@ export type * from "../types/manifest"; export type * from "../types/response"; +export * from "./manifest"; + +export { ManifestCoderFormat } from "./manifest-coder/serialization-format"; export * from "./context-state-matrix"; export * from "./element-descriptor"; -export * from "./manifest"; export * from "./schema"; diff --git a/packages/js-moi-manifest/src.ts/manifest-coder/base-manifest-coder.ts b/packages/js-moi-manifest/src.ts/manifest-coder/base-manifest-coder.ts new file mode 100644 index 00000000..fea99e8d --- /dev/null +++ b/packages/js-moi-manifest/src.ts/manifest-coder/base-manifest-coder.ts @@ -0,0 +1,15 @@ +import type { LogicManifest } from "../../types/manifest"; + +export abstract class BaseManifestCoder { + protected validate(manifest: unknown): manifest is LogicManifest.Manifest { + if (typeof manifest !== "object" || manifest === null) { + return false; + } + + if (!("elements" in manifest) || !Array.isArray(manifest.elements)) { + return false; + } + + return true; + } +} diff --git a/packages/js-moi-manifest/src.ts/manifest-coder/json-manifest-coder.ts b/packages/js-moi-manifest/src.ts/manifest-coder/json-manifest-coder.ts new file mode 100644 index 00000000..7ced3cbb --- /dev/null +++ b/packages/js-moi-manifest/src.ts/manifest-coder/json-manifest-coder.ts @@ -0,0 +1,199 @@ +import { ErrorCode, ErrorUtils, hexToBytes } from "js-moi-utils"; +import { Depolorizer, Polorizer, WireType } from "js-polo"; +import type { LogicManifest } from "../../types/manifest"; +import { Schema } from "../schema"; +import { BaseManifestCoder } from "./base-manifest-coder"; + +type SchemaConfig = Record; + +export class JsonManifestCoder extends BaseManifestCoder { + private static MANIFEST_SCHEMA = { + kind: "struct", + fields: { + syntax: { + kind: "integer", + }, + engine: Schema.PISA_ENGINE_SCHEMA, + elements: { + kind: "array", + fields: { + values: { + kind: "struct", + fields: { + ptr: { + kind: "integer", + }, + deps: Schema.PISA_DEPS_SCHEMA, + kind: { + kind: "string", + }, + data: { + kind: "raw", + }, + }, + }, + }, + }, + }, + }; + + private static readonly SCHEMA_CONFIG: SchemaConfig = { + constant: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_CONSTANT_SCHEMA, + }, + typedef: { + wireType: WireType.WIRE_WORD, + schema: Schema.PISA_TYPEDEF_SCHEMA, + }, + state: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_STATE_SCHEMA, + }, + routine: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_ROUTINE_SCHEMA, + }, + method: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_METHOD_SCHEMA, + }, + class: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_CLASS_SCHEMA, + }, + event: { + wireType: WireType.WIRE_PACK, + schema: Schema.PISA_EVENT_SCHEMA, + }, + }; + + /** + * Serializes a given LogicManifest.Element into a Polorizer instance. + * + * @param element - The LogicManifest.Element to be serialized. + * @returns A Polorizer instance containing the serialized data. + * + * @throws Will throw an error if the element kind is unknown. + */ + private serializeElement(element: LogicManifest.Element): Polorizer { + const polorizer = new Polorizer(); + + polorizer.polorizeInteger(element.ptr); + polorizer.polorize(element.deps, Schema.PISA_DEPS_SCHEMA); + polorizer.polorizeString(element.kind); + + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + + if (config == null) { + ErrorUtils.throwError( + `Unknown element kind: ${element.kind}`, + ErrorCode.UNEXPECTED_ARGUMENT + ); + } + + polorizer.polorize(element.data, config.schema); + return polorizer; + } + + private deserializeElement(element) { + if (element.deps.length == 0) { + delete element.deps; + } + + const config = JsonManifestCoder.SCHEMA_CONFIG[element.kind]; + + if (config == null) { + ErrorUtils.throwError( + `Unknown element kind: ${element.kind}`, + ErrorCode.UNEXPECTED_ARGUMENT + ); + } + + const blob = new Uint8Array([config.wireType, ...element.data]); + element.data = new Depolorizer(blob).depolorize(config.schema); + + const isRoutineOrMethod = + element.kind === "routine" || element.kind === "method"; + + if (!isRoutineOrMethod) { + return element; + } + + for (const [key, value] of Object.entries(element.data.executes)) { + if (value === "" || (Array.isArray(value) && value.length === 0)) { + delete element.data.executes[key]; + } + + if (value instanceof Uint8Array) { + element.data.executes[key] = Array.from(value); + } + } + } + + /** + * Serializes an array of elements from the given manifest. + * + * @param {LogicManifest.Manifest} manifest - The manifest containing the elements to be serialized. + * @returns - The polorizer containing the serialized elements. + */ + private serializeElementArray(manifest: LogicManifest.Manifest) { + const polorizer = new Polorizer(); + + for (const element of manifest.elements) { + polorizer.polorizePacked(this.serializeElement(element)); + } + + return polorizer; + } + + private deserializeElements(elements: any[]) { + for (const element of elements) { + this.deserializeElement(element); + } + } + + /** + * Serializes a given LogicManifest.Manifest object into a POLO Uint8Array. + * + * @param {LogicManifest.Manifest} manifest - The manifest object to be serialized. + * @returns {Uint8Array} The POLO serialized manifest as a Uint8Array. + * @throws {Error} If the manifest is invalid. + */ + encode(manifest: LogicManifest.Manifest): Uint8Array { + if (!super.validate(manifest)) { + ErrorUtils.throwArgumentError( + "Invalid manifest.", + "manifest", + manifest + ); + } + + const polorizer = new Polorizer(); + + polorizer.polorizeInteger(manifest.syntax); + polorizer.polorize(manifest.engine, Schema.PISA_ENGINE_SCHEMA); + + const elements = this.serializeElementArray(manifest); + + polorizer.polorizePacked(elements); + + return polorizer.bytes(); + } + + private getPoloBytes(data: string | Uint8Array): Uint8Array { + return typeof data === "string" ? hexToBytes(data) : data; + } + + decode(data: string | Uint8Array): LogicManifest.Manifest { + const depolorizer = new Depolorizer(this.getPoloBytes(data)); + const decoded = depolorizer.depolorize(JsonManifestCoder.MANIFEST_SCHEMA); + + if (!super.validate(decoded)) { + ErrorUtils.throwArgumentError("Invalid manifest.", "data", data); + } + + this.deserializeElements(decoded.elements); + return decoded; + } +} diff --git a/packages/js-moi-manifest/src.ts/manifest-coder/serialization-format.ts b/packages/js-moi-manifest/src.ts/manifest-coder/serialization-format.ts new file mode 100644 index 00000000..d0795742 --- /dev/null +++ b/packages/js-moi-manifest/src.ts/manifest-coder/serialization-format.ts @@ -0,0 +1,8 @@ + +/** + * Represents the format of a manifest. + */ +export enum ManifestCoderFormat { + JSON = "JSON", + YAML = "YAML", +} \ No newline at end of file diff --git a/packages/js-moi-manifest/src.ts/manifest-coder/yaml-manifest-coder.ts b/packages/js-moi-manifest/src.ts/manifest-coder/yaml-manifest-coder.ts new file mode 100644 index 00000000..e341adaa --- /dev/null +++ b/packages/js-moi-manifest/src.ts/manifest-coder/yaml-manifest-coder.ts @@ -0,0 +1,18 @@ +import { parse, stringify } from "yaml"; + +import { BaseManifestCoder } from "./base-manifest-coder"; +import { JsonManifestCoder } from "./json-manifest-coder"; + + +export class YamlManifestCoder extends BaseManifestCoder { + public encode(yamlManifest: string): Uint8Array { + const json = parse(yamlManifest); + return new JsonManifestCoder().encode(json); + + } + + public decode(data: string | Uint8Array): string { + const coder = new JsonManifestCoder(); + return stringify(coder.decode(data)); + } +} \ No newline at end of file diff --git a/packages/js-moi-manifest/src.ts/manifest.ts b/packages/js-moi-manifest/src.ts/manifest.ts index 138950eb..570e5a00 100644 --- a/packages/js-moi-manifest/src.ts/manifest.ts +++ b/packages/js-moi-manifest/src.ts/manifest.ts @@ -1,8 +1,11 @@ -import { bytesToHex, deepCopy, DEFAULT_EVENT_SCHEMA, ErrorCode, ErrorUtils, hexToBytes, trimHexPrefix } from "js-moi-utils"; -import { Depolorizer, documentEncode, Polorizer, Schema as PoloSchema } from "js-polo"; +import { builtInLogEventSchema, bytesToHex, deepCopy, ErrorCode, ErrorUtils, hexToBytes, trimHexPrefix } from "js-moi-utils"; +import { Depolorizer, documentEncode, Schema as PoloSchema } from "js-polo"; import { LogicManifest } from "../types/manifest"; import { Exception } from "../types/response"; import { ElementDescriptor } from "./element-descriptor"; +import { JsonManifestCoder } from "./manifest-coder/json-manifest-coder"; +import { ManifestCoderFormat } from "./manifest-coder/serialization-format"; +import { YamlManifestCoder } from "./manifest-coder/yaml-manifest-coder"; import { Schema } from "./schema"; /** @@ -16,13 +19,6 @@ import { Schema } from "./schema"; export class ManifestCoder { private readonly elementDescriptor: ElementDescriptor; - /** - * Creates an instance of ManifestCoder. - * - * @param {LogicManifest.Manifest} elementDescriptor - The element descriptor. - * @constructor - */ - constructor(elementDescriptor: ElementDescriptor); /** * Creates an instance of ManifestCoder. * @@ -33,78 +29,14 @@ export class ManifestCoder { /** * Creates an instance of ManifestCoder. */ - constructor(descriptorOrManifest: LogicManifest.Manifest | ElementDescriptor) { - this.elementDescriptor = descriptorOrManifest instanceof ElementDescriptor ? descriptorOrManifest : new ElementDescriptor(descriptorOrManifest); + constructor(manifest: LogicManifest.Manifest) { + this.elementDescriptor = new ElementDescriptor(manifest.elements); } private get schema(): Schema { return new Schema(this.elementDescriptor.getElements(), this.elementDescriptor.getClassDefs()); } - /** - * Encodes a logic manifest into POLO format. The manifest is processed and - * serialized according to the predefined schema. - * Returns the POLO-encoded data as a hexadecimal string prefixed with "0x". - * - * @static - * @param {LogicManifest.Manifest} manifest - The logic manifest to encode. - * @returns {string} The POLO-encoded data. - */ - public static encodeManifest(manifest: LogicManifest.Manifest): string { - const polorizer = new Polorizer(); - polorizer.polorizeInteger(manifest.syntax); - polorizer.polorize(manifest.engine, Schema.PISA_ENGINE_SCHEMA); - - if(manifest.elements) { - const elements = new Polorizer(); - - manifest.elements.forEach((value) => { - const element = new Polorizer(); - - element.polorizeInteger(value.ptr); - element.polorize(value.deps, Schema.PISA_DEPS_SCHEMA); - element.polorizeString(value.kind); - - switch(value.kind) { - case "constant": - element.polorize(value.data, Schema.PISA_CONSTANT_SCHEMA); - break; - case "typedef": - element.polorize(value.data, Schema.PISA_TYPEDEF_SCHEMA); - break; - case "class": - element.polorize(value.data, Schema.PISA_CLASS_SCHEMA); - break; - case "method": - element.polorize(value.data, Schema.PISA_METHOD_SCHEMA); - break; - case "routine": - element.polorize(value.data, Schema.PISA_ROUTINE_SCHEMA); - break; - case "event": - element.polorize(value.data, Schema.PISA_EVENT_SCHEMA); - break; - case "state": - element.polorize(value.data, Schema.PISA_STATE_SCHEMA); - break; - default: - ErrorUtils.throwError( - `Unsupported kind: ${value.kind}`, - ErrorCode.UNSUPPORTED_OPERATION, - ); - } - - elements.polorizePacked(element); - }) - - polorizer.polorizePacked(elements); - } - - const bytes = polorizer.bytes(); - - return "0x" + bytesToHex(bytes); - } - /** * Parses the calldata arguments based on the provided POLO Schema. * The calldata arguments is recursively processed and transformed according to the schema. @@ -120,16 +52,16 @@ export class ManifestCoder { const reconstructSchema = (schema: PoloSchema): PoloSchema => { Object.keys(schema.fields).forEach(key => { - if(schema.fields[key].kind === "struct") { + if (schema.fields[key].kind === "struct") { schema.fields[key].kind = "document"; } }); - + return schema; } const parseArray = (schema: PoloSchema, arg: any[]) => { - return arg.map((value: any, index: number) => + return arg.map((value: any, index: number) => this.parseCalldata(schema, value, arg.length - 1 === index) ); } @@ -139,18 +71,18 @@ export class ManifestCoder { const entries = Array.from(arg.entries()); // Loop through the entries of the Map - entries.forEach((entry:[any, any], index: number) => { + entries.forEach((entry: [any, any], index: number) => { const [key, value] = entry; map.set( this.parseCalldata( - schema.fields.keys, - key, + schema.fields.keys, + key, entries.length - 1 === index - ), + ), this.parseCalldata( - schema.fields.values, - value, + schema.fields.values, + value, entries.length - 1 === index ) ); @@ -166,7 +98,7 @@ export class ManifestCoder { const doc = documentEncode(arg, reconstructSchema(deepCopy(schema))) - if(updateType) { + if (updateType) { schema.kind = "document"; delete schema.fields; } @@ -174,7 +106,7 @@ export class ManifestCoder { return doc.getData(); } - switch(schema.kind) { + switch (schema.kind) { case "string": return trimHexPrefix(arg); @@ -191,8 +123,8 @@ export class ManifestCoder { break; case "map": - if((parsableKinds.includes(schema.fields.keys.kind) || - parsableKinds.includes(schema.fields.values.kind))) { + if ((parsableKinds.includes(schema.fields.keys.kind) || + parsableKinds.includes(schema.fields.values.kind))) { return parseMap(schema, arg); } break; @@ -208,51 +140,16 @@ export class ManifestCoder { } /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. + * Encodes the arguments for a specified routine into a hexadecimal string. * - * @param {LogicManifest.TypeField[]} fields - The fields associated with the routine parameters (arguments). - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". - */ - public encodeArguments(fields: LogicManifest.TypeField[], args: any[]): string; - /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. - * - * @param {string} fields - The name of the routine associated with the arguments. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". - */ - public encodeArguments(fields: string, args: any[]): string; - /** - * Encodes the provided arguments based on the given manifest routine - * parameters and its types (the accepts property in routine). - * - * The arguments are mapped to their corresponding fields, and the calldata - * is generated by parsing and encoding the arguments based on the dynamically - * created schema from fields. - * - * @param {(LogicManifest.TypeField[] | string)} fields - The fields associated with the routine parameters (arguments) or the name of the routine. - * @param {any[]} args - The arguments to encode. - * @returns {string} The POLO-encoded calldata as a hexadecimal string prefixed with "0x". + * @param routine - The name of the routine for which the arguments are being encoded. + * @param args - The arguments to be encoded, passed as a variadic parameter. + * @returns A hexadecimal string representing the encoded arguments. */ - public encodeArguments(fields: LogicManifest.TypeField[] | string, args: any[]): string { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data as LogicManifest.Routine - fields = element.accepts - } - - const schema = this.schema.parseFields(fields); - const calldata = Object.values(fields).reduce((acc, field: LogicManifest.TypeField) => { + public encodeArguments(routine: string, ...args: any[]): string { + const element = this.elementDescriptor.getRoutineElement(routine).data as LogicManifest.Routine + const schema = this.schema.parseFields(element.accepts ?? []); + const calldata = Object.values(element.accepts).reduce((acc, field: LogicManifest.TypeField) => { acc[field.label] = this.parseCalldata(schema.fields[field.label], args[field.slot]); return acc; }, {}); @@ -260,45 +157,41 @@ export class ManifestCoder { return "0x" + bytesToHex((documentEncode(calldata, schema).bytes())) } + /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the predefined schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} callsite - The name of the routine associated with the output data. - * - * @returns {T | null} The decoded output data, or null if the output is empty. - */ - public decodeOutput(callsite: string, output: string): T | null; - /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. + * Decodes the provided calldata into the expected arguments for a given routine. * - * @param {string} output - The output data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {LogicManifest.TypeField[]} fields - The fields associated with the output data. - * @returns {unknown | null} The decoded output data, or null if the output is empty. + * @template T - The type of the decoded arguments. + * @param {string} routine - The name of the routine whose arguments are to be decoded. + * @param {string} calldata - The calldata to decode. + * @returns {T | null} - The decoded arguments as an object of type T, or null if the routine accepts no arguments. */ - public decodeOutput(field: LogicManifest.TypeField[], output: string): T | null; + public decodeArguments(routine: string, calldata: string): T | null { + const element = this.elementDescriptor.getRoutineElement(routine).data as LogicManifest.Routine + + if (element && element.accepts.length === 0) { + return null + } + + const schema = this.schema.parseFields(element.accepts ?? []); + const decodedCalldata = new Depolorizer(hexToBytes(calldata)).depolorize(schema); + return element.accepts.map((field: LogicManifest.TypeField) => decodedCalldata[field.label]) as T; + } + /** - * Decodes the output data returned from a logic routine call. - * The output data is decoded using the provided fields and schema. - * Returns the decoded output data as an unknown type, or null if the output is empty. - * - * @param {string} output - The output data to decode, represented as a hexadecimal string prefixed with "0x". - * @param {string} fields - The name of the routine associated with the output data. - * @returns {T | null} The decoded output data, or null if the output is empty. + * Decodes the output of a routine. + * + * @template T - The type to which the output should be decoded. + * @param {string} routine - The name of the routine whose output is to be decoded. + * @param {string} output - The output string to decode. + * @returns {T | null} - The decoded output as type T, or null if the output is invalid or the routine has no return schema. */ - public decodeOutput(fields: LogicManifest.TypeField[] | string, output: string): T | null { - if (typeof fields === "string") { - const element = this.elementDescriptor.getRoutineElement(fields).data as LogicManifest.Routine - fields = element.returns - } + public decodeOutput(routine: string, output: string): T | null { + const element = this.elementDescriptor.getRoutineElement(routine).data as LogicManifest.Routine + - if(output && output != "0x" && fields && fields.length) { - const schema = this.schema.parseFields(fields); + if (output && output != "0x" && element.returns && element.returns.length) { + const schema = this.schema.parseFields(element.returns); return new Depolorizer(hexToBytes(output)).depolorize(schema) as T } @@ -329,7 +222,7 @@ export class ManifestCoder { */ public decodeEventOutput(event: string, logData: string): T | null { if (event === "builtin.Log") { - return new Depolorizer(hexToBytes(logData)).depolorize(DEFAULT_EVENT_SCHEMA) as T; + return new Depolorizer(hexToBytes(logData)).depolorize(builtInLogEventSchema) as T; } const element = this.elementDescriptor.getEventElement(event); @@ -341,7 +234,7 @@ export class ManifestCoder { if (logData && logData !== "0x") { const element = this.elementDescriptor.getEventElement(event); const schema = this.schema.parseFields(element.data.fields); - return new Depolorizer(hexToBytes(logData)).depolorize(schema) as T; + return new Depolorizer(hexToBytes(logData)).depolorize(schema) as T; } return null @@ -358,7 +251,7 @@ export class ManifestCoder { the error is empty. */ public static decodeException(error: string): Exception | null { - if(error && error !== "0x") { + if (error && error !== "0x") { const decodedError = hexToBytes(error) const depolorizer = new Depolorizer(decodedError) return depolorizer.depolorize(Schema.PISA_EXCEPTION_SCHEMA) as Exception @@ -368,25 +261,74 @@ export class ManifestCoder { } /** - * Decodes a specific state field from the data retrieved from a logic. - * The state data is decoded using the provided fields and schema. - * Returns the decoded value of the specified field, or null if the data is empty. - * - * @param {string} data - The state data to decode, represented as a - hexadecimal string prefixed with "0x". - * @param {string} field - The field to be decoded from the state data. - * @param {LogicManifest.TypeField[]} fields - The fields associated with the state data. - * @returns {unknown | null} The decoded value of the specified field, or - null if the data is empty. + * Encodes a manifest into a hexadecimal string. + * + * This function supports encoding both JSON and YAML manifest formats. + * If the input manifest is an object, it is assumed to be a JSON manifest and + * is encoded using the `JsonManifestCoder`. If the input manifest is a string, + * it is assumed to be a YAML manifest and is encoded using the `YamlManifestCoder`. + * + * @param manifest - The manifest to encode. It can be either a string (YAML) or an object (JSON). + * @returns The encoded manifest as a hexadecimal string prefixed with "0x". + * @throws Will throw an error if the manifest type is unsupported. */ - public decodeState(data: string, field: string, fields: LogicManifest.TypeField[]): unknown | null { - if (data && data != "0x") { - const decodedData = hexToBytes(data) - const depolorizer = new Depolorizer(decodedData) - const schema = this.schema.parseFields(fields); - return depolorizer.depolorize(schema.fields[field]) + public static encodeManifest(manifest: string | LogicManifest.Manifest): string { + if (typeof manifest === "object" && manifest !== null) { + const serializer = new JsonManifestCoder(); + return "0x" + bytesToHex(serializer.encode(manifest)); + } + + if (typeof manifest === "string") { + const serializer = new YamlManifestCoder(); + return "0x" + bytesToHex(serializer.encode(manifest)); + } + + ErrorUtils.throwError("Unsupported manifest type", ErrorCode.UNSUPPORTED_OPERATION); + } + + /** + * Decodes a given manifest in either JSON format. + * + * @param manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param format - The format of the manifest in JSON string. + * + * @returns Returns a JSON manifest object. + * + * @throws Throws an error if the format is unsupported. + */ + public static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.JSON): LogicManifest.Manifest; + /** + * Decodes a given manifest in either YAML format. + * + * @param {string | Uint8Array} manifest The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format The format of the manifest in YAML string. + * + * @returns {string} Returns a YAML string representation. + * + * @throws {Error} Throws an error if the format is unsupported. + */ + public static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat.YAML): string; + /** + * Decodes a given manifest in either JSON or YAML format. + * + * @param {string | Uint8Array} manifest - The manifest data to decode, provided as a string or Uint8Array. + * @param {ManifestCoderFormat} format - The format of the manifest, either JSON or YAML. + * + * @returns {LogicManifest.Manifest | string} - Returns a `LogicManifest.Manifest` object if JSON format is used or a string representation if YAML format is used. + * + * @throws {Error} - Throws an error if the format is unsupported. + */ + public static decodeManifest(manifest: string | Uint8Array, format: ManifestCoderFormat): LogicManifest.Manifest | string { + if (format === ManifestCoderFormat.JSON) { + const serializer = new JsonManifestCoder(); + return serializer.decode(manifest); + } + + if (format === ManifestCoderFormat.YAML) { + const serializer = new YamlManifestCoder(); + return serializer.decode(manifest); } - return null; + ErrorUtils.throwError("Unsupported manifest format", ErrorCode.UNSUPPORTED_OPERATION); } } diff --git a/packages/js-moi-manifest/src.ts/schema.ts b/packages/js-moi-manifest/src.ts/schema.ts index 3f535f9a..1c5916cd 100644 --- a/packages/js-moi-manifest/src.ts/schema.ts +++ b/packages/js-moi-manifest/src.ts/schema.ts @@ -52,7 +52,7 @@ export class Schema { kind: "string", }, }, - }, + } }, }; diff --git a/packages/js-moi-manifest/types/manifest.d.ts b/packages/js-moi-manifest/types/manifest.d.ts index a45f098f..7aa7bfff 100644 --- a/packages/js-moi-manifest/types/manifest.d.ts +++ b/packages/js-moi-manifest/types/manifest.d.ts @@ -1,82 +1,120 @@ export declare module LogicManifest { - export interface EngineConfig { - kind: string; - flags: string[]; - } - - export interface TypeField { - slot: number; - label: string; - type: string; - } - - export interface MethodField { - ptr: number | bigint; - code: number | bigint; - } - - export interface Class { - name: string, - fields?: TypeField[] | null, - methods?: MethodField[] | null - } - - export interface State { - mode: string; - fields: TypeField[]; - } - - export interface Constant { - type: string; - value: string; - } - - export interface Instructions { - bin?: number[] | null; - hex?: string; - asm?: string[] | null; - } - - export interface Routine { - name: string; - kind: string; - mode: string; - accepts?: TypeField[] | null; - returns?: TypeField[] | null; - executes: Instructions; - catches?: string[] | null; - } - - export interface Method { - name: string; - class: string; - mutable: boolean; - accepts?: TypeField[] | null; - returns?: TypeField[] | null; - executes: Instructions; - catches?: string[] | null; - } - - export interface Event { - name: string; - topics: number; - fields: TypeField[]; - } - - export type TypeDef = string; - - export type ElementKind = State | Constant | TypeDef | Routine | Class | Method | Event; - - export interface Element { - ptr: number; - kind: string; - deps?: number[] | null; - data: TElementKind; - } - - export interface Manifest { - syntax: number; - engine: EngineConfig; - elements: Element[]; - } + export interface EngineConfig { + kind: string; + flags: string[]; + } + + export interface TypeField { + slot: number; + label: string; + type: string; + } + + export interface MethodField { + ptr: number | bigint; + code: number | bigint; + } + + export interface Class { + name: string; + fields?: TypeField[] | null; + methods?: MethodField[] | null; + } + + export interface State { + mode: string; + fields: TypeField[]; + } + + export interface Constant { + type: string; + value: string; + } + + export interface Instructions { + bin?: number[] | null; + hex?: string; + asm?: string[] | null; + } + + export interface Routine { + name: string; + kind: string; + mode: string; + accepts?: TypeField[] | null; + returns?: TypeField[] | null; + executes: Instructions; + catches?: string[] | null; + } + + export interface Method { + name: string; + class: string; + mutable: boolean; + accepts?: TypeField[] | null; + returns?: TypeField[] | null; + executes: Instructions; + catches?: string[] | null; + } + + export interface Event { + name: string; + topics: number; + fields: TypeField[]; + } + + export type TypeDef = string; + + export type ElementKind = + | State + | Constant + | TypeDef + | Routine + | Class + | Method + | Event; + + export interface Element { + ptr: number; + kind: string; + deps?: number[] | null; + data: TElementKind; + } + + export interface Manifest { + syntax: number; + engine: EngineConfig; + elements: Element[]; + } + + export interface EventDef { + ptr: number; + topics: number; + } + + export interface MethodDef { + ptr: number; + class: string; + } + + export interface CallSite { + ptr: number; + kind: string; + } + + export interface EventDef { + ptr: number; + topics: number; + } + + export interface MethodDef { + ptr: number; + class: string; + } + + export interface CallSite { + ptr: number; + kind: string; + } } + diff --git a/packages/js-moi-providers/__tests__/jsonrpc-provider.test.ts b/packages/js-moi-providers/__tests__/jsonrpc-provider.test.ts index c78c2a4a..86571414 100644 --- a/packages/js-moi-providers/__tests__/jsonrpc-provider.test.ts +++ b/packages/js-moi-providers/__tests__/jsonrpc-provider.test.ts @@ -1,32 +1,25 @@ -import { Signer } from "js-moi-signer"; import { AssetCreationReceipt, AssetStandard, hexToBN, IxType, toQuantity } from "js-moi-utils"; import { VoyageProvider } from "../lib.cjs"; import { JsonRpcProvider } from "../src.ts/jsonrpc-provider"; import { Filter, InteractionReceipt } from "../types/jsonrpc"; import { getRandomSupply, getRandomSymbol, initializeWallet } from "./utils/utils"; -const HOST = ""; -const MNEMONIC = ""; -const ADDRESS = "0x55425876a7bdad21068d629e290b22b564c4f596fdf008db47c037da0cb146db"; - +const HOST = ""; +const MNEMONIC = ""; +const provider = new JsonRpcProvider(HOST); describe("Test JsonRpcProvider Query Calls", () => { - const address = ADDRESS; - const provider = new JsonRpcProvider(HOST); - let ixHash: string; - let signer: Signer; - let ixReceipt: InteractionReceipt; - let nextNonce = 0; + const signer = initializeWallet(provider, MNEMONIC); + const address = signer.getAddress(); + let ixHash: string; + let ixReceipt: InteractionReceipt; const supply = getRandomSupply(); MNEMONIC; beforeAll(async() => { - signer = await initializeWallet(provider, MNEMONIC); - const nonce = await signer.getNonce(); const ixResponse = await signer.sendInteraction({ type: IxType.ASSET_CREATE, - nonce: nonce, fuel_price: 1, fuel_limit: 200, payload: { @@ -38,7 +31,6 @@ describe("Test JsonRpcProvider Query Calls", () => { ixHash = ixResponse.hash; ixReceipt = await ixResponse.wait(); - nextNonce = Number(nonce) + 1 }); describe('getBalance', () => { @@ -47,9 +39,8 @@ describe("Test JsonRpcProvider Query Calls", () => { expect(ixReceipt.extra_data).toBeDefined(); return; } - - const balance = await provider.getBalance(address, (ixReceipt.extra_data).asset_id); - + + const balance = await provider.getBalance(signer.getAddress(), (ixReceipt.extra_data).asset_id); expect(balance).toBe(supply); }) }); @@ -135,7 +126,7 @@ describe("Test JsonRpcProvider Query Calls", () => { const interactions = await provider.getInteractionByTesseract(address, undefined, 0); expect(interactions).toBeDefined(); - expect(interactions.hash).toBe(ixReceipt.ix_hash); + expect(typeof interactions.hash).toBe("string"); }); it("should return the interaction by tesseract without address", async () => { @@ -242,7 +233,7 @@ describe("Test JsonRpcProvider Query Calls", () => { it('should return the receipt by executing the interaction', async () => { const receipt = await provider.call({ type: IxType.ASSET_CREATE, - nonce: nextNonce, + nonce: await signer.getNonce(), sender: address, fuel_price: 1, fuel_limit: 200, @@ -261,7 +252,7 @@ describe("Test JsonRpcProvider Query Calls", () => { it('should return the estimated fuel by executing the interaction', async () => { const fuelPrice = await provider.estimateFuel({ type: IxType.ASSET_CREATE, - nonce: nextNonce, + nonce: await signer.getNonce(), sender: address, fuel_price: 1, fuel_limit: 200, @@ -429,7 +420,6 @@ describe("Test JsonRpcProvider Query Calls", () => { address: address, height: [0, 10] }); - expect(logs).toBeDefined(); expect(Array.isArray(logs)).toBeTruthy(); }); diff --git a/packages/js-moi-providers/__tests__/utils/utils.ts b/packages/js-moi-providers/__tests__/utils/utils.ts index 84b01e83..baac7666 100644 --- a/packages/js-moi-providers/__tests__/utils/utils.ts +++ b/packages/js-moi-providers/__tests__/utils/utils.ts @@ -1,13 +1,10 @@ -import { Signer } from "js-moi-signer"; import { Wallet } from "js-moi-wallet"; -import { JsonRpcProvider } from "../../src.ts/jsonrpc-provider"; +import type { AbstractProvider } from "../../src.ts/abstract-provider"; -export const initializeWallet = async (provider: JsonRpcProvider, mnemonic: string): Promise => { - const derivationPath = "m/44'/6174'/0'/0/1"; - - const wallet = await Wallet.fromMnemonic(mnemonic, derivationPath); +export const initializeWallet = (provider: AbstractProvider, mnemonic: string): Wallet => { + const derivationPath = "m/44'/6174'/7020'/0/0"; + const wallet = Wallet.fromMnemonicSync(mnemonic, derivationPath); wallet.connect(provider); - return wallet; } diff --git a/packages/js-moi-providers/__tests__/ws-provider.test.ts b/packages/js-moi-providers/__tests__/ws-provider.test.ts index 7ff60664..05fe0efc 100644 --- a/packages/js-moi-providers/__tests__/ws-provider.test.ts +++ b/packages/js-moi-providers/__tests__/ws-provider.test.ts @@ -1,91 +1,147 @@ -import { Signer } from "js-moi-signer"; -import { AssetStandard, hexToBN, IxType } from "js-moi-utils"; -import { JsonRpcProvider } from "../src.ts/jsonrpc-provider"; -import { WebSocketEvents, WebSocketProvider } from "../src.ts/websocket-provider"; -import { initializeWallet } from "./utils/utils"; +import assert from "assert"; + +import { hexToBytes, IxType } from "js-moi-utils"; +import { Wallet } from "js-moi-wallet"; +import { WebSocketEvent } from "../src.ts/websocket-events"; +import { WebsocketProvider } from "../src.ts/websocket-provider"; +import { getRandomSupply, initializeWallet } from "./utils/utils"; + +const HOST = ""; +const MNEMONIC = ""; +const ASSET_ID = ""; describe("Test Websocket Provider", () => { - const address = "0x2c1fe83b9d6a5c81c5e6d4da20d2d0509ac3c1eb154e5f5b1fc7d5fd4a03b9cc"; - const mnemonic = "cushion tissue toss meadow glare math custom because inform describe vacant combine"; - let signer: Signer; - let nonce: number | bigint; - let wsProvider: WebSocketProvider; - - beforeAll(async () => { - const rpcProvider = new JsonRpcProvider("http://localhost:1600") - signer = await initializeWallet(rpcProvider, mnemonic); - nonce = await signer.getNonce(); - wsProvider = new WebSocketProvider("ws://localhost:1600/ws", { - reconnectOptions: { - auto: true, - delay: 5000 - } - }) - }) + const isValidMnemonic = MNEMONIC.split(" ").length === 12; + const isValidHost = HOST.startsWith("ws://") || HOST.startsWith("wss://"); - it('should receive new tesseracts', (done) => { - // subscribe to new tesseracts - wsProvider.on(WebSocketEvents.ALL_TESSERACTS, (tesseract) => { - // check if the tesseract height has increased - expect(hexToBN(tesseract.header.height)).toBeGreaterThan(0); - done(); + assert(isValidMnemonic, "Mnemonic is not valid"); + assert(isValidHost, "Host is not valid"); + assert(ASSET_ID.startsWith("0x"), "Asset ID is not valid"); + + const provider = new WebsocketProvider(HOST); + const wallet = initializeWallet(provider, MNEMONIC); + + describe("It should be able to perform rpc calls", () => { + it("should be able to get TDUs", async () => { + const tdu = await provider.getTDU(wallet.getAddress()); + + expect(tdu).toBeDefined(); + expect(Array.isArray(tdu)).toBeTruthy(); }); - // create a new tesseract - signer.sendInteraction({ - type: IxType.ASSET_CREATE, - nonce: nonce, - fuel_price: 1, - fuel_limit: 200, - payload: { - standard: AssetStandard.MAS0, - symbol: "FOO", - supply: 1248577 - } + it("should be able to get account info", async () => { + const account = await provider.getAccountMetaInfo( + wallet.getAddress() + ); + + expect(account).toBeDefined(); + expect(account.address).toBe(wallet.getAddress()); }); }); + describe("It should be able to listen to events", () => { + const receiver = Wallet.createRandomSync().address; - it('should receive new tesseracts based on address', (done) => { - // subscribe to new tesseracts - wsProvider.on(address, (tesseract) => { - // check if the tesseract height has increased - expect(hexToBN(tesseract.header.height)).toBeGreaterThan(1); - done(); + beforeAll(async () => { + await wallet.sendInteraction({ + type: IxType.VALUE_TRANSFER, + receiver: receiver, + fuel_price: 1, + fuel_limit: 100, + transfer_values: new Map([[ASSET_ID, getRandomSupply()]]), + }); }); - // create a new tesseract - signer.sendInteraction({ - type: IxType.ASSET_CREATE, - nonce: Number(nonce) + 1, - fuel_price: 1, - fuel_limit: 200, - payload: { - standard: AssetStandard.MAS0, - symbol: "BOO", - supply: 1248577 - } + test("should emit a event when connection is established", async () => { + provider.on(WebSocketEvent.Connect, () => { + // @ts-ignore + expect(provider.ws).toBeDefined(); + // @ts-ignore + expect(provider.ws.readyState).toBe(provider.ws.OPEN); + }); }); - }); - test("should receive a new pending interaction hash", (done) => { - wsProvider.on(WebSocketEvents.PENDING_INTERACTIONS, (hash) => { - expect(hash).toBeTruthy(); - expect(typeof hash).toBe("string"); - done(); - }) - - // will create a new interaction - signer.sendInteraction({ - type: IxType.ASSET_CREATE, - nonce: Number(nonce) + 1, - fuel_price: 1, - fuel_limit: 200, - payload: { - standard: AssetStandard.MAS0, - symbol: "BAZ", - supply: 1248577 - } + test("should be able to listen to new pending interactions events", async () => { + provider.on(WebSocketEvent.NewPendingInteractions, (ixHash) => { + expect(ixHash).toBeDefined(); + expect(typeof ixHash).toBe("string"); + expect(ixHash.startsWith("0x")).toBeTruthy(); + }); + }, 10000); + + test("should be able to listen to new tesseract", async () => { + provider.on(WebSocketEvent.NewTesseracts, (tesseract) => { + expect(tesseract).toBeDefined(); + expect(tesseract.hash).toBeDefined(); + expect(tesseract.hash.startsWith("0x")).toBeTruthy(); + expect(Array.isArray(tesseract.ixns)).toBeTruthy(); + }); + }); + + test("should be able to listen to tesseract of specific address", async () => { + provider.on( + { + event: WebSocketEvent.NewTesseractsByAccount, + params: { address: receiver }, + }, + (tesseract) => { + const isReceiverParticipating = tesseract.participants.some( + (p) => p.address === receiver + ); + expect(isReceiverParticipating).toBeTruthy(); + } + ); + }); + + describe("It should be able to listen to new logs", () => { + beforeAll(async () => { + const ix = await wallet.sendInteraction({ + type: IxType.LOGIC_DEPLOY, + fuel_price: 1, + fuel_limit: 10000, + payload: { + manifest: hexToBytes( + "0x0e4f031e9e01012f064e504953410fff040e9e059e0afe0dae118e1aae25ce31ce3fae4d8e51de5b9e67de7fee8a019e9d019ec101aed5015f0300068e01636f6e7374616e742f0666737472696e673078303637333635363536343635363432305f0310169e0101636f6e7374616e742f0666737472696e67307830363230373736393734363832305f0310169e0102636f6e7374616e742f0666737472696e673078303632305f0310169e0103636f6e7374616e742f06367536343078303331325f0310169e0104636f6e7374616e742f0666737472696e67307830363733363536653634363537323230363836313733323036653666323036323631366336313665363336355f0310169e0105636f6e7374616e742f0666737472696e673078303637333635366536343635373232303638363137333230363936653733373536363636363936333639363536653734323036323631366336313665363336355f0310169e0106636f6e7374616e742f0666737472696e6730783036363936653736363136633639363432303632373537323665323036313664366637353665373433613230363537383633363536353634373332303733373537303730366337395f0310169e0107636f6e7374616e742f0666737472696e67307830363639366537363631366336393634323036323735373236653230363136643666373536653734336132303733363536653634363537323230363836313733323036653666323036323631366336313665363336355f0310169e0108636f6e7374616e742f0666737472696e6730783036363936653736363136633639363432303632373537323665323036313664366637353665373433613230363936653733373536363636363936333639363536653734323036323631366336313665363336355f031016860109747970656465666d61705b616464726573735d753235364f0310166e0a6576656e745f0683019e015472616e73666572025f0e9e02ee043f03066673656e646572616464726573734f03169601017265636569766572616464726573733f03167602616d6f756e74753235364f0310166e0b73746174653f06ae0170657273697374656e745f0e8e02fe033f03066653796d626f6c737472696e673f03167601537570706c79753235364f031696010242616c616e6365736d61705b616464726573735d753235366f031e96018e020c4f0303132301020b726f7574696e65cf010646e601ce02fe068e07ee135365656470657273697374656e746465706c6f793f0e8e023f03066673796d626f6c737472696e673f03167601737570706c79753235360f5f06860c800c8000000401003600018100800001040201360002810080000273034903035700030281001100001000007303490303480303430000031103011003034300000348020243000002110202100202430000024300000142000072014901010600010f5f031e46be010d1f0303726f7574696e65df010686018602ee02fe029e058e07446563696d616c73726561646f6e6c79696e766f6b650f1f0e4f03068601646563696d616c737536345f06960190011100031000000500000f5f031e46be010e1f030b726f7574696e65df010696019602fe028e059e07ae0e42616c616e63654f66726561646f6e6c79696e766f6b651f0e3f03064661646472616464726573731f0e3f03067662616c616e6365753235365f06b606b0068000020401005402000162020211030903030262020211030b02030162020201620202110311030302560100010501000182000f6f031ea6019e020f4f0313233304050a0b726f7574696e65df01068601a6028e03fe078e088e1f5472616e7366657270657273697374656e74696e766f6b653f0eee013f030666616d6f756e74753235364f03169601017265636569766572616464726573730f5f06a616a01673004900008001025402010062020211030a03030262020211030c02030162020201110312030302110204100202070201560201000403004404020362040411051c030504110405100404070401040401540501046205051106250306056205051106270206016205050111062c0306052b05075701040501660202035701000256020104650202035701040281010a0153010000040001530101000400005301020011000a2e00000172014901010600010f5f031e46be01101f030b726f7574696e65cf010646e601ce02ce04de049e104d696e7470657273697374656e74696e766f6b651f0e3f030666616d6f756e74753235360f5f06e60ae00a800001370100040200650201022401023600018100800002730149010154020001620202110311030302620202110313020301620202011103180303022b0207570001020156020001040300650202035700010281000f6f031ea6019e02114f031323330607080b726f7574696e65cf010646e601ce02ce04de04ae164275726e70657273697374656e74696e766f6b651f0e3f030666616d6f756e74753235360f5f06f610f0108000013701000402004403010262030311040a03040311030610030307030166020102240102360001810080000273014901015402000162020211031903030262020211031b02030162020201110321030302110207100202070201560200010403004402020362020211042b03040211020810020207020156020001660202035700010281000f" + ), + callsite: "Seed", + calldata: hexToBytes( + "0x0d6f0665a6018502737570706c790398968073796d626f6c0644554d4d" + ), + }, + }); + + const result = await ix.result(); + + await wallet.sendInteraction({ + type: IxType.LOGIC_INVOKE, + fuel_price: 1, + fuel_limit: 10000, + payload: { + logic_id: result.logic_id, + callsite: "Transfer", + calldata: hexToBytes( + "0x0d6f066596019502616d6f756e74032710726563656976657206b90f39fcf346ba3260518669495f5d368a8d1bb8023584f67e8a5671cf3c56c1" + ), + }, + }); + }); + + test("should be able to listen to new logs", async () => { + provider.on( + { + event: WebSocketEvent.NewLog, + params: { + address: wallet.getAddress(), + height: [-1, -1], + topics: [], + }, + }, + (log) => { + expect(log).toBeDefined(); + expect(log.data).toBeDefined(); + } + ); + }); }); }); }); diff --git a/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts b/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts index 53907fcf..239b698e 100644 --- a/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts +++ b/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts @@ -1,12 +1,13 @@ +import { EventEmitter } from "events"; import { LogicManifest } from "js-moi-manifest"; import { Interaction, Tesseract } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; import { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, NodeInfo, Options, Registry, Status, SyncStatus, TDU, type Log, type LogFilter } from "../types/jsonrpc"; +import { type ProviderEvents } from "../types/websocket"; /** * Abstract class representing a provider for interacting with the MOI protocol. * Provides methods for account operations, execution, and querying. */ -export declare abstract class AbstractProvider { +export declare abstract class AbstractProvider extends EventEmitter { abstract getBalance(address: string, assetId: string, options?: Options): Promise; abstract getContextInfo(address: string, options?: Options): Promise; abstract getTesseract(address: string, with_interactions: boolean, options?: Options): Promise; @@ -45,27 +46,6 @@ export declare abstract class AbstractProvider { abstract removeFilter(filter: Filter): Promise; abstract getLogsFilter(filter: LogFilter): Promise; abstract getLogs(filter: LogFilter): Promise; - abstract on(eventName: EventType, listener: Listener): AbstractProvider; - abstract once(eventName: EventType, listener: Listener): AbstractProvider; - abstract listenerCount(eventName?: EventType): number; - abstract listeners(eventName?: EventType): Array; - abstract off(eventName: EventType, listener?: Listener): AbstractProvider; - abstract removeAllListeners(eventName?: EventType): AbstractProvider; - /** - * Alias for "on" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be called when the event is emitted. - * @returns The provider instance for chaining. - */ - addListener(eventName: EventType, listener: Listener): AbstractProvider; - /** - * Alias for "off" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be unregistered. - * @returns The provider instance for chaining. - */ - removeListener(eventName: EventType, listener: Listener): AbstractProvider; + abstract getSubscription(event: ProviderEvents): Promise; } //# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts.map b/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts.map index e7abea4c..cba70cf2 100644 --- a/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts.map +++ b/packages/js-moi-providers/lib.cjs/abstract-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACH,eAAe,EACf,YAAY,EACZ,SAAS,EACT,sBAAsB,EACtB,qBAAqB,EACrB,OAAO,EACP,WAAW,EACX,WAAW,EACX,QAAQ,EACR,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EACP,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAAE,mBAAmB,EACvC,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,GAAG,EACH,KAAK,GAAG,EACR,KAAK,SAAS,EACjB,MAAM,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,8BAAsB,gBAAgB;IAElC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAClG,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAGjF,QAAQ,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IACzG,QAAQ,CAAC,YAAY,CAAC,iBAAiB,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IAExF,QAAQ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EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC;IAC3H,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IACvC,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;IACrC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IACvC,QAAQ,CAAC,QAAQ,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IACzC,QAAQ,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IACjD,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1E,QAAQ,CAAC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC;IACvD,QAAQ,CAAC,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IACpE,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1D,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACnD,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,cAAc,GAAI,OAAO,CAAC,MAAM,CAAC;CACpE"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/abstract-provider.js b/packages/js-moi-providers/lib.cjs/abstract-provider.js index ea294948..da1bfb03 100644 --- a/packages/js-moi-providers/lib.cjs/abstract-provider.js +++ b/packages/js-moi-providers/lib.cjs/abstract-provider.js @@ -1,33 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AbstractProvider = void 0; +const events_1 = require("events"); /** * Abstract class representing a provider for interacting with the MOI protocol. * Provides methods for account operations, execution, and querying. */ -class AbstractProvider { - // Alias for "on" - /** - * Alias for "on" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be called when the event is emitted. - * @returns The provider instance for chaining. - */ - addListener(eventName, listener) { - return this.on(eventName, listener); - } - // Alias for "off" - /** - * Alias for "off" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be unregistered. - * @returns The provider instance for chaining. - */ - removeListener(eventName, listener) { - return this.off(eventName, listener); - } +class AbstractProvider extends events_1.EventEmitter { } exports.AbstractProvider = AbstractProvider; //# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/abstract-provider.js.map b/packages/js-moi-providers/lib.cjs/abstract-provider.js.map index 8443ad1e..34ade1f6 100644 --- a/packages/js-moi-providers/lib.cjs/abstract-provider.js.map +++ b/packages/js-moi-providers/lib.cjs/abstract-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":";;;AA4BA;;;GAGG;AACH,MAAsB,gBAAgB;IA0DlC,iBAAiB;IAEjB;;;;;;OAMG;IACH,WAAW,CAAC,SAAoB,EAAE,QAAkB;QAChD,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,kBAAkB;IAElB;;;;;;OAMG;IACH,cAAc,CAAC,SAAoB,EAAE,QAAkB;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACJ;AAnFD,4CAmFC"} \ No newline at end of file +{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AA+BtC;;;GAGG;AACH,MAAsB,gBAAiB,SAAQ,qBAAY;CAkD1D;AAlDD,4CAkDC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/base-provider.d.ts b/packages/js-moi-providers/lib.cjs/base-provider.d.ts index 85e2f021..158ccecf 100644 --- a/packages/js-moi-providers/lib.cjs/base-provider.d.ts +++ b/packages/js-moi-providers/lib.cjs/base-provider.d.ts @@ -1,16 +1,18 @@ import { LogicManifest } from "js-moi-manifest"; import { Interaction, Tesseract } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; -import { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, NodeInfo, Options, Registry, RpcResponse, Status, SyncStatus, TDU, type Log, type LogFilter } from "../types/jsonrpc"; +import type { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, Log, LogFilter, NodeInfo, Options, Registry, RpcResponse, Status, SyncStatus, TDU } from "../types/jsonrpc"; +import type { ProviderEvents } from "../types/websocket"; import { AbstractProvider } from "./abstract-provider"; -import Event from "./event"; +export interface EventTag { + event: string; + params?: unknown; +} /** * Class representing a base provider for interacting with the MOI protocol. * Extends the AbstractProvider class and provides implementations for * account operations, execution, and querying RPC methods. */ export declare class BaseProvider extends AbstractProvider { - protected _events: Event[]; constructor(); /** * Helper function to process the RPC response and extract the relevant data. @@ -404,6 +406,8 @@ export declare class BaseProvider extends AbstractProvider { * the response. */ getNodeInfo(): Promise; + getSubscription(event: ProviderEvents): Promise; + private validateAndFormatEvent; /** * Waits for the interaction with the specified hash to be included in a tesseract * and returns the interaction receipt. @@ -426,6 +430,7 @@ export declare class BaseProvider extends AbstractProvider { * data is missing. */ protected processReceipt(receipt: InteractionReceipt): any; + protected processWsResult(event: ProviderEvents, result: unknown): unknown; /** * Waits for the interaction with the specified hash to be included in a * tesseract and returns the result based on the interaction type. @@ -454,88 +459,5 @@ export declare class BaseProvider extends AbstractProvider { * @throws {Error} if the method is not implemented. */ protected execute(method: string, params: any): Promise>; - /** - * Starts the specified event by performing necessary actions. - * - * @param {Event} event - The event to start. - */ - protected _startEvent(event: Event): void; - /** - * Stops the specified event by performing necessary actions. - * - * @param {Event} event - The event to stop. - */ - protected _stopEvent(event: Event): void; - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @param {boolean} once - Indicates whether the listener should be called - * only once (true) or multiple times (false). - * @returns The instance of the class to allow method chaining. - */ - protected _addEventListener(eventName: EventType, listener: Listener, once: boolean): this; - /** - * Emits the specified event and calls all the associated listeners. - * - * @param {EventType} eventName - The name of the event to emit. - * @param {Array} args - The arguments to be passed to the event listeners. - * @returns {boolean} A boolean indicating whether any listeners were called - * for the event. - */ - protected emit(eventName: EventType, ...args: Array): boolean; - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the event is emitted. - * @returns The instance of the class to allow method chaining. - */ - on(eventName: EventType, listener: Listener): this; - /** - * Adds a one-time event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @returns The instance of the class to allow method chaining. - */ - once(eventName: EventType, listener: Listener): this; - /** - * Returns the number of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns {number} The number of listeners for the event. - */ - listenerCount(eventName?: EventType): number; - /** - * Returns an array of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns An array of listeners for the event. - */ - listeners(eventName?: EventType): Array; - /** - * Removes an event listener for the specified event. If no listener is - * specified, removes all listeners for the event. - * - * @param {EventType} eventName - The name of the event to remove the - * listener from. - * @param {Listener} listener - The listener function to remove. If not - * provided, removes all listeners for the event. - * @returns The instance of the class to allow method chaining. - */ - off(eventName: EventType, listener?: Listener): this; - /** - * Removes all listeners for the specified event. If no event is specified, - * removes all listeners for all events. - * - * @param {EventType} eventName - The name of the event to remove all - * listeners from. - * @returns The instance of the class to allow method chaining. - */ - removeAllListeners(eventName?: EventType): this; } //# sourceMappingURL=base-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/base-provider.d.ts.map b/packages/js-moi-providers/lib.cjs/base-provider.d.ts.map index d665939b..249af186 100644 --- a/packages/js-moi-providers/lib.cjs/base-provider.d.ts.map +++ b/packages/js-moi-providers/lib.cjs/base-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"base-provider.d.ts","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAC+E,WAAW,EAI7F,SAAS,EAGZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACH,eAAe,EAA4C,YAAY,EACvE,SAAS,EAAkC,sBAAsB,EAAE,qBAAqB,EACxF,OAAO,EAAE,WAAW,EAAwC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAExH,uBAAuB,EAAqB,kBAAkB,EAC9D,kBAAkB,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,OAAO,EAAE,QAAQ,EACzF,WAAW,EAAE,MAAM,EAAiC,UAAU,EAAoB,GAAG,EACrF,KAAK,GAAG,EACR,KAAK,SAAS,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,MAAM,SAAS,CAAC;AAU5B;;;;GAIG;AACH,qBAAa,YAAa,S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;cACa,aAAa,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAKtF;;;;;OAKG;IACH,SAAS,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAIpD;;;;;;;OAOG;IACH,SAAS,CAAC,OAAO,CAAC,CAAC,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAGnF"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/base-provider.js b/packages/js-moi-providers/lib.cjs/base-provider.js index 4e2d29c2..ee87dd20 100644 --- a/packages/js-moi-providers/lib.cjs/base-provider.js +++ b/packages/js-moi-providers/lib.cjs/base-provider.js @@ -1,30 +1,24 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseProvider = void 0; const js_moi_manifest_1 = require("js-moi-manifest"); const js_moi_utils_1 = require("js-moi-utils"); const abstract_provider_1 = require("./abstract-provider"); -const event_1 = __importDefault(require("./event")); const interaction_1 = require("./interaction"); // Default timeout value in seconds const defaultTimeout = 120; const defaultOptions = { tesseract_number: -1 }; +; /** * Class representing a base provider for interacting with the MOI protocol. * Extends the AbstractProvider class and provides implementations for * account operations, execution, and querying RPC methods. */ class BaseProvider extends abstract_provider_1.AbstractProvider { - _events; constructor() { super(); - // Events being listened to - this._events = []; } /** * Helper function to process the RPC response and extract the relevant data. @@ -779,7 +773,7 @@ class BaseProvider extends abstract_provider_1.AbstractProvider { const response = await this.execute("moi.GetLogs", payload); return this.processResponse(response).map((log) => ({ ...log, - data: "0x" + (0, js_moi_utils_1.bytesToHex)((0, js_moi_utils_1.decodeBase64)(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged + data: (0, js_moi_utils_1.encodeToString)((0, js_moi_utils_1.decodeBase64)(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged })); } /** @@ -924,6 +918,35 @@ class BaseProvider extends abstract_provider_1.AbstractProvider { throw error; } } + async getSubscription(event) { + let params = []; + if (typeof event === "string") { + params = event; + } + if (typeof event === "object") { + params = this.validateAndFormatEvent(event); + } + const response = await this.execute("moi.subscribe", params); + return this.processResponse(response); + } + validateAndFormatEvent(event) { + if (!(0, js_moi_utils_1.isValidAddress)(event.params.address)) { + js_moi_utils_1.ErrorUtils.throwArgumentError("Invalid address provided", "event.params.address", event.params); + } + if (event.event === 'newTesseractsByAccount') { + return [event.event, { address: event.params.address }]; + } + if (event.event === 'newLogs') { + if (event.params.topics == null) { + event.params.topics = []; + } + if (Array.isArray(event.params.topics) === false) { + js_moi_utils_1.ErrorUtils.throwArgumentError("Topics should be an array", "event.params.topics", event.params.topics); + } + return [event.event, { address: event.params.address, topics: this.hashTopics(event.params.topics), start_height: event.params.height[0], end_height: event.params.height[1] }]; + } + throw js_moi_utils_1.ErrorUtils.throwError("Invalid event type", js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); + } /** * Waits for the interaction with the specified hash to be included in a tesseract * and returns the interaction receipt. @@ -1019,6 +1042,25 @@ class BaseProvider extends abstract_provider_1.AbstractProvider { throw new Error("Unsupported interaction type encountered"); } } + processWsResult(event, result) { + if (event === 'newPendingInteractions') { + if (typeof result === "string") { + return result.startsWith("0x") ? result : `0x${result}`; + } + js_moi_utils_1.ErrorUtils.throwError("Invalid response received", js_moi_utils_1.ErrorCode.SERVER_ERROR); + } + if (typeof event === "string" && ["newTesseracts"].includes(event)) { + return result; + } + if (typeof event === "object" && event.event === "newTesseractsByAccount") { + return result; + } + if (typeof event === "object" && event.event === "newLogs") { + const log = result; + return { ...log, data: (0, js_moi_utils_1.encodeToString)((0, js_moi_utils_1.decodeBase64)(log.data)) }; + } + js_moi_utils_1.ErrorUtils.throwArgumentError("Invalid event type", "event", event); + } /** * Waits for the interaction with the specified hash to be included in a * tesseract and returns the result based on the interaction type. @@ -1054,194 +1096,6 @@ class BaseProvider extends abstract_provider_1.AbstractProvider { execute(method, params) { throw new Error(method + " not implemented"); } - /** - * Starts the specified event by performing necessary actions. - * - * @param {Event} event - The event to start. - */ - _startEvent(event) { - } - /** - * Stops the specified event by performing necessary actions. - * - * @param {Event} event - The event to stop. - */ - _stopEvent(event) { - } - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @param {boolean} once - Indicates whether the listener should be called - * only once (true) or multiple times (false). - * @returns The instance of the class to allow method chaining. - */ - _addEventListener(eventName, listener, once) { - const event = new event_1.default(getEventTag(eventName), listener, once); - this._events.push(event); - this._startEvent(event); - return this; - } - /** - * Emits the specified event and calls all the associated listeners. - * - * @param {EventType} eventName - The name of the event to emit. - * @param {Array} args - The arguments to be passed to the event listeners. - * @returns {boolean} A boolean indicating whether any listeners were called - * for the event. - */ - emit(eventName, ...args) { - let result = false; - let stopped = []; - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { - return true; - } - setTimeout(() => { - event.listener.apply(this, args); - }, 0); - result = true; - if (event.once) { - stopped.push(event); - return false; - } - return true; - }); - stopped.forEach((event) => { this._stopEvent(event); }); - return result; - } - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the event is emitted. - * @returns The instance of the class to allow method chaining. - */ - on(eventName, listener) { - return this._addEventListener(eventName, listener, false); - } - /** - * Adds a one-time event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @returns The instance of the class to allow method chaining. - */ - once(eventName, listener) { - return this._addEventListener(eventName, listener, true); - } - /** - * Returns the number of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns {number} The number of listeners for the event. - */ - listenerCount(eventName) { - if (!eventName) { - return this._events.length; - } - let eventTag = getEventTag(eventName); - return this._events.filter((event) => { - return (event.tag === eventTag); - }).length; - } - /** - * Returns an array of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns An array of listeners for the event. - */ - listeners(eventName) { - if (eventName == null) { - return this._events.map((event) => event.listener); - } - let eventTag = getEventTag(eventName); - return this._events - .filter((event) => (event.tag === eventTag)) - .map((event) => event.listener); - } - /** - * Removes an event listener for the specified event. If no listener is - * specified, removes all listeners for the event. - * - * @param {EventType} eventName - The name of the event to remove the - * listener from. - * @param {Listener} listener - The listener function to remove. If not - * provided, removes all listeners for the event. - * @returns The instance of the class to allow method chaining. - */ - off(eventName, listener) { - if (listener == null) { - return this.removeAllListeners(eventName); - } - const stopped = []; - let found = false; - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag || event.listener != listener) { - return true; - } - if (found) { - return true; - } - found = true; - stopped.push(event); - return false; - }); - stopped.forEach((event) => { this._stopEvent(event); }); - return this; - } - /** - * Removes all listeners for the specified event. If no event is specified, - * removes all listeners for all events. - * - * @param {EventType} eventName - The name of the event to remove all - * listeners from. - * @returns The instance of the class to allow method chaining. - */ - removeAllListeners(eventName) { - let stopped = []; - if (eventName == null) { - stopped = this._events; - this._events = []; - } - else { - const eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { - return true; - } - stopped.push(event); - return false; - }); - } - stopped.forEach((event) => { this._stopEvent(event); }); - return this; - } } exports.BaseProvider = BaseProvider; -// helper functions -/** - * Retrieves the event tag based on the event name. - * - * @param {EventType} eventName - The name of the event. - * @returns {string} The event tag. - * @throws {Error} if the event name is invalid. - */ -const getEventTag = (eventName) => { - if (typeof (eventName) === "string") { - eventName = eventName.toLowerCase(); - if ((0, js_moi_utils_1.hexDataLength)(eventName) === 32) { - return "tesseract:" + eventName; - } - if (eventName.indexOf(":") === -1) { - return eventName; - } - } - throw new Error("invalid event - " + eventName); -}; //# sourceMappingURL=base-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/base-provider.js.map b/packages/js-moi-providers/lib.cjs/base-provider.js.map index 0743b6ed..5982d8a3 100644 --- a/packages/js-moi-providers/lib.cjs/base-provider.js.map +++ b/packages/js-moi-providers/lib.cjs/base-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA+D;AAC/D,+CAQsB;AActB,2DAAuD;AACvD,oDAA4B;AAC5B,+CAAgD;AAEhD,mCAAmC;AACnC,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,cAAc,GAAY;IAC5B,gBAAgB,EAAE,CAAC,CAAC;CACvB,CAAA;AAED;;;;GAIG;AACH,MAAa,YAAa,SAAQ,oCAAgB;IACpC,OAAO,CAAU;IAE3B;QACI,KAAK,EAAE,CAAC;QACR,2BAA2B;QAC3B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;IAED;;;;;;;;;OASG;IACO,eAAe,CAAI,QAAwB;QACjD,IAAG,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC,MAAM,CAAA;QAC1B,CAAC;QAED,yBAAU,CAAC,UAAU,CACjB,QAAQ,CAAC,KAAK,CAAC,OAAO,EACtB,wBAAS,CAAC,YAAY,CACzB,CAAC;IACN,CAAC;IAED,kBAAkB;IAElB;;;;;;;;;OASG;IACI,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,OAAe,EAAE,OAAiB;QACvE,IAAI,CAAC;YACD,MAAM,MAAM,GAAkB;gBAC1B,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;aAC9C,CAAA;YAED,MAAM,QAAQ,GAAG,MAAM,I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C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAChC,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;AACpD,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":";;;AAAA,qDAA+D;AAC/D,+CASsB;AAetB,2DAAuD;AACvD,+CAAgD;AAEhD,mCAAmC;AACnC,MAAM,cAAc,GAAW,GAAG,CAAC;AAEnC,MAAM,cAAc,GAAY;IAC5B,gBAAgB,EAAE,CAAC,CAAC;CACvB,CAAA;AAKA,CAAC;AAEF;;;;GAIG;AACH,MAAa,YAAa,SAAQ,oCAAgB;IAC9C;QACI,KAAK,EAAE,CAAC;IACZ,CAAC;IAED;;;;;;;;;OASG;IACO,eAAe,CAAI,QAAwB;QACjD,IAAG,QAAQ,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC,MAAM,CAAA;QAC1B,CAAC;QAED,yBAAU,CAAC,UAAU,CACjB,QAAQ,CAAC,KAAK,CAAC,OAAO,EACtB,wBAAS,CAAC,YAAY,CACzB,CAAC;IACN,CAAC;IAED,kBAAkB;IAElB;;;;;;;;;OASG;IACI,KAAK,CAAC,UAAU,CAAC,OAAe,EAAE,OAAe,EAAE,OAAiB;QACvE,IAAI,CAAC;YACD,MAAM,MAAM,GAAkB;gBAC1B,OAAO,EAAE,OAAO;gBAChB,QAAQ,EAAE,OAAO;gBACjB,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;aAC9C,CAAA;YAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAE3D,MAAM,OAAO,GAAW,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CA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AAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;OAUG;IACO,KAAK,CAAC,aAAa,CAAC,eAAuB,EAAE,OAAgB;QACnE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QACxE,OAAO,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACO,aAAa,CAAC,QAAkB;QACtC,OAAO,QAAQ,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IACvE,CAAC;IAED;;;;;;;OAOG;IACO,OAAO,CAAU,MAAc,EAAE,MAAW;QAClD,MAAM,IAAI,KAAK,CAAC,MAAM,GAAG,kBAAkB,CAAC,CAAA;IAChD,CAAC;CACJ;AAvxCD,oCAuxCC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/event.d.ts b/packages/js-moi-providers/lib.cjs/event.d.ts deleted file mode 100644 index e95a83b8..00000000 --- a/packages/js-moi-providers/lib.cjs/event.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { EventType, Listener } from "../types/event"; -export default class Event { - readonly listener: Listener; - readonly once: boolean; - readonly tag: string; - constructor(tag: string, listener: Listener, once: boolean); - /** - * Returns the name of the event. - * @returns The event name. - */ - get event(): EventType; - /** - * Returns the type of the event. - * @returns The event type. - */ - get type(): string; - /** - * Returns the address from the tesseract event. - * @returns The address form tesseract. - */ - get address(): string; - /** - * Checks if the event is pollable. - * @returns True if the event is pollable, false otherwise. - */ - pollable(): boolean; -} -//# sourceMappingURL=event.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/event.d.ts.map b/packages/js-moi-providers/lib.cjs/event.d.ts.map deleted file mode 100644 index a7a65e14..00000000 --- a/packages/js-moi-providers/lib.cjs/event.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src.ts/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,CAAC,OAAO,OAAO,KAAK;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IAM1D;;;OAGG;IACH,IAAI,KAAK,IAAI,SAAS,CAOrB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED;;;OAGG;IACH,QAAQ,IAAI,OAAO;CAGtB"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/event.js b/packages/js-moi-providers/lib.cjs/event.js deleted file mode 100644 index dc8ece5f..00000000 --- a/packages/js-moi-providers/lib.cjs/event.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const js_moi_utils_1 = require("js-moi-utils"); -// List of events that can be polled -const PollableEvents = ["all_tesseracts", "tesseract"]; -class Event { - listener; - once; - tag; - constructor(tag, listener, once) { - (0, js_moi_utils_1.defineReadOnly)(this, "tag", tag); - (0, js_moi_utils_1.defineReadOnly)(this, "listener", listener); - (0, js_moi_utils_1.defineReadOnly)(this, "once", once); - } - /** - * Returns the name of the event. - * @returns The event name. - */ - get event() { - switch (this.type) { - case "tesseract": - return this.address; - } - return this.tag; - } - /** - * Returns the type of the event. - * @returns The event type. - */ - get type() { - return this.tag.split(":")[0]; - } - /** - * Returns the address from the tesseract event. - * @returns The address form tesseract. - */ - get address() { - const comps = this.tag.split(":"); - if (comps[0] !== "tesseract") { - return null; - } - return comps[1]; - } - /** - * Checks if the event is pollable. - * @returns True if the event is pollable, false otherwise. - */ - pollable() { - return (this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0); - } -} -exports.default = Event; -//# sourceMappingURL=event.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/event.js.map b/packages/js-moi-providers/lib.cjs/event.js.map deleted file mode 100644 index a2ddeb72..00000000 --- a/packages/js-moi-providers/lib.cjs/event.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event.js","sourceRoot":"","sources":["../src.ts/event.ts"],"names":[],"mappings":";;AACA,+CAA8C;AAE9C,oCAAoC;AACpC,MAAM,cAAc,GAAG,CAAE,gBAAgB,EAAE,WAAW,CAAE,CAAC;AAEzD,MAAqB,KAAK;IACb,QAAQ,CAAW;IACnB,IAAI,CAAU;IACd,GAAG,CAAS;IAErB,YAAY,GAAW,EAAE,QAAkB,EAAE,IAAa;QACtD,IAAA,6BAAc,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACjC,IAAA,6BAAc,EAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC3C,IAAA,6BAAc,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACL,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,WAAW;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC;QAC5B,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;YAAC,OAAO,IAAI,CAAC;QAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,QAAQ;QACJ,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ;AAjDD,wBAiDC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/index.d.ts b/packages/js-moi-providers/lib.cjs/index.d.ts index 2b038e14..1d7b2e82 100644 --- a/packages/js-moi-providers/lib.cjs/index.d.ts +++ b/packages/js-moi-providers/lib.cjs/index.d.ts @@ -1,9 +1,10 @@ +export type * from "../types/event"; +export type * from "../types/jsonrpc"; +export type * from "../types/provider"; export * from "./abstract-provider"; export * from "./base-provider"; export * from "./jsonrpc-provider"; export * from "./voyage-provider"; -export * from "./websocket-provider"; -export type * from "../types/jsonrpc"; -export type * from "../types/event"; -export type * from "../types/provider"; +export { WebSocketEvent } from "./websocket-events"; +export { WebsocketProvider } from "./websocket-provider"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/index.d.ts.map b/packages/js-moi-providers/lib.cjs/index.d.ts.map index 6b8a186c..2ff83f01 100644 --- a/packages/js-moi-providers/lib.cjs/index.d.ts.map +++ b/packages/js-moi-providers/lib.cjs/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,mBAAmB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/index.js b/packages/js-moi-providers/lib.cjs/index.js index 508a9bfb..8385dc1d 100644 --- a/packages/js-moi-providers/lib.cjs/index.js +++ b/packages/js-moi-providers/lib.cjs/index.js @@ -14,9 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebsocketProvider = exports.WebSocketEvent = void 0; __exportStar(require("./abstract-provider"), exports); __exportStar(require("./base-provider"), exports); __exportStar(require("./jsonrpc-provider"), exports); __exportStar(require("./voyage-provider"), exports); -__exportStar(require("./websocket-provider"), exports); +var websocket_events_1 = require("./websocket-events"); +Object.defineProperty(exports, "WebSocketEvent", { enumerable: true, get: function () { return websocket_events_1.WebSocketEvent; } }); +var websocket_provider_1 = require("./websocket-provider"); +Object.defineProperty(exports, "WebsocketProvider", { enumerable: true, get: function () { return websocket_provider_1.WebsocketProvider; } }); //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/index.js.map b/packages/js-moi-providers/lib.cjs/index.js.map index 16c321f2..fbc20d73 100644 --- a/packages/js-moi-providers/lib.cjs/index.js.map +++ b/packages/js-moi-providers/lib.cjs/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,oDAAkC;AAClC,uDAAqC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,sDAAoC;AACpC,kDAAgC;AAChC,qDAAmC;AACnC,oDAAkC;AAClC,uDAAoD;AAA3C,kHAAA,cAAc,OAAA;AACvB,2DAAyD;AAAhD,uHAAA,iBAAiB,OAAA"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts index 89a7155b..37b1ac74 100644 --- a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts +++ b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts @@ -1,6 +1,5 @@ -import { BaseProvider } from "./base-provider"; -import Event from "./event"; import { RpcResponse } from "../types/jsonrpc"; +import { BaseProvider } from "./base-provider"; /** * A class that represents a JSON-RPC provider for making RPC calls over HTTP. */ @@ -25,17 +24,5 @@ export declare class JsonRpcProvider extends BaseProvider { * @throws Error if there is an error sending the RPC request. */ protected send(method: string, params: any[]): Promise>; - /** - * Starts an event. - * - * @param event - The event to start. - */ - protected _startEvent(event: Event): void; - /** - * Stops an event. - * - * @param event - The event to stop. - */ - protected _stopEvent(event: Event): void; } //# sourceMappingURL=jsonrpc-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts.map b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts.map index b376ada3..59be25d1 100644 --- a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts.map +++ b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc-provider.d.ts","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAYxB;;;;;;;OAOG;cACa,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQhF;;;;;;;OAOG;cACa,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IA2C/E;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAIzC;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAG3C"} \ No newline at end of file +{"version":3,"file":"jsonrpc-provider.d.ts","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAYxB;;;;;;;OAOG;cACa,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQhF;;;;;;;OAOG;cACa,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CA0ClF"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js index a259df4f..3f39063d 100644 --- a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js +++ b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js @@ -75,22 +75,6 @@ class JsonRpcProvider extends base_provider_1.BaseProvider { js_moi_utils_1.ErrorUtils.throwError(`Error: ${error.message}`, js_moi_utils_1.ErrorCode.NETWORK_ERROR); } } - /** - * Starts an event. - * - * @param event - The event to start. - */ - _startEvent(event) { - super._startEvent(event); - } - /** - * Stops an event. - * - * @param event - The event to stop. - */ - _stopEvent(event) { - super._stopEvent(event); - } } exports.JsonRpcProvider = JsonRpcProvider; //# sourceMappingURL=jsonrpc-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js.map b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js.map index dd1e0bb0..6fac1ff2 100644 --- a/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js.map +++ b/packages/js-moi-providers/lib.cjs/jsonrpc-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc-provider.js","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,+CAAkE;AAClE,mDAA+C;AAI/C;;GAEG;AACH,MAAa,eAAgB,SAAQ,4BAAY;IACnC,IAAI,CAAS;IAEvB,YAAY,IAAY;QACpB,KAAK,EAAE,CAAC;QAER,IAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,IA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C,OAAM,KAAK,EAAE,CAAC;YACZ,IAAG,KAAK,YAAY,0BAAW,EAAE,CAAC;gBAC9B,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,yBAAU,CAAC,UAAU,CACjB,UAAU,KAAK,CAAC,OAAO,EAAE,EACzB,wBAAS,CAAC,aAAa,CAC1B,CAAA;QACL,CAAC;IACL,CAAC;IAED;;;;OAIG;IACO,WAAW,CAAC,KAAY;QAC9B,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED;;;;OAIG;IACO,UAAU,CAAC,KAAY;QAC7B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACJ;AAnGD,0CAmGC"} \ No newline at end of file +{"version":3,"file":"jsonrpc-provider.js","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAgC;AAChC,+CAAkE;AAElE,mDAA+C;AAE/C;;GAEG;AACH,MAAa,eAAgB,SAAQ,4BAAY;IACnC,IAAI,CAAS;IAEvB,YAAY,IAAY;QACpB,KAAK,EAAE,CAAC;QAER,IAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAEhB,OAAM;QACV,CAAC;QAED,yBAAU,CAAC,UAAU,CAAC,sBAAsB,EAAE,wBAAS,CAAC,gBAAgB,CAAC,CAAA;IAC7E,CAAC;IAED;;;;;;;OAOG;IACO,KAAK,CAAC,OAAO,CAAI,MAAc,EAAE,MAAW;QAClD,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;QAC5C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,KAAK,CAAA;QACf,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACO,KAAK,CAAC,IAAI,CAAI,MAAc,EAAE,MAAa;QACjD,IAAI,CAAC;YACD,MAAM,OAAO,GAAG;gBACZ,MAAM,EAAE,MAAM;gBACd,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,KAAK;gBACd,EAAE,EAAE,CAAC;aACR,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAK,EAAC,IAAI,CAAC,IAAI,EAAE;gBACpC,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;gBAC7B,OAAO,EAAE;oBACL,cAAc,EAAE,kBAAkB;iBACrC;aACJ,CAAC,CAAC;YAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACf,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;gBAEzC,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;oBAC/B,yBAAU,CAAC,UAAU,CACjB,UAAU,UAAU,EAAE,EACtB,wBAAS,CAAC,YAAY,CACzB,CAAA;gBACL,CAAC;gBAED,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;YAC/B,CAAC;YAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QAChC,CAAC;QAAC,OAAM,KAAK,EAAE,CAAC;YACZ,IAAG,KAAK,YAAY,0BAAW,EAAE,CAAC;gBAC9B,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,yBAAU,CAAC,UAAU,CACjB,UAAU,KAAK,CAAC,OAAO,EAAE,EACzB,wBAAS,CAAC,aAAa,CAC1B,CAAA;QACL,CAAC;IACL,CAAC;CACJ;AAjFD,0CAiFC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-events.d.ts b/packages/js-moi-providers/lib.cjs/websocket-events.d.ts new file mode 100644 index 00000000..48e235d5 --- /dev/null +++ b/packages/js-moi-providers/lib.cjs/websocket-events.d.ts @@ -0,0 +1,11 @@ +export declare enum WebSocketEvent { + Close = "close", + Connect = "connect", + Error = "error", + Reconnect = "reconnect", + NewTesseracts = "newTesseracts", + NewPendingInteractions = "newPendingInteractions", + NewLog = "newLog", + NewTesseractsByAccount = "newTesseractsByAccount" +} +//# sourceMappingURL=websocket-events.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-events.d.ts.map b/packages/js-moi-providers/lib.cjs/websocket-events.d.ts.map new file mode 100644 index 00000000..5f89d29a --- /dev/null +++ b/packages/js-moi-providers/lib.cjs/websocket-events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"websocket-events.d.ts","sourceRoot":"","sources":["../src.ts/websocket-events.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,KAAK,UAAU;IAEf,OAAO,YAAY;IAEnB,KAAK,UAAU;IAEf,SAAS,cAAc;IAEvB,aAAa,kBAAkB;IAE/B,sBAAsB,2BAA2B;IAEjD,MAAM,WAAW;IAEjB,sBAAsB,2BAA2B;CACpD"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-events.js b/packages/js-moi-providers/lib.cjs/websocket-events.js new file mode 100644 index 00000000..b4b5def5 --- /dev/null +++ b/packages/js-moi-providers/lib.cjs/websocket-events.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocketEvent = void 0; +var WebSocketEvent; +(function (WebSocketEvent) { + WebSocketEvent["Close"] = "close"; + WebSocketEvent["Connect"] = "connect"; + WebSocketEvent["Error"] = "error"; + WebSocketEvent["Reconnect"] = "reconnect"; + WebSocketEvent["NewTesseracts"] = "newTesseracts"; + WebSocketEvent["NewPendingInteractions"] = "newPendingInteractions"; + WebSocketEvent["NewLog"] = "newLog"; + WebSocketEvent["NewTesseractsByAccount"] = "newTesseractsByAccount"; +})(WebSocketEvent || (exports.WebSocketEvent = WebSocketEvent = {})); +//# sourceMappingURL=websocket-events.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-events.js.map b/packages/js-moi-providers/lib.cjs/websocket-events.js.map new file mode 100644 index 00000000..671aee26 --- /dev/null +++ b/packages/js-moi-providers/lib.cjs/websocket-events.js.map @@ -0,0 +1 @@ +{"version":3,"file":"websocket-events.js","sourceRoot":"","sources":["../src.ts/websocket-events.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACtB,iCAAe,CAAA;IAEf,qCAAmB,CAAA;IAEnB,iCAAe,CAAA;IAEf,yCAAuB,CAAA;IAEvB,iDAA+B,CAAA;IAE/B,mEAAiD,CAAA;IAEjD,mCAAiB,CAAA;IAEjB,mEAAiD,CAAA;AACrD,CAAC,EAhBW,cAAc,8BAAd,cAAc,QAgBzB"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts b/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts index d8baed47..b51dd020 100644 --- a/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts +++ b/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts @@ -1,128 +1,77 @@ -import { JsonRpcProvider } from "./jsonrpc-provider"; -import Event from "./event"; -import { WebsocketProviderOptions } from "../types/provider"; -/** - * Enum defining the WebSocket events. - */ -export declare enum WebSocketEvents { - TESSERACT = "tesseract", - ALL_TESSERACTS = "all_tesseracts", - PENDING_INTERACTIONS = "pending_interactions", - CONNECT = "connect", - RECONNECT = "reconnect", - CLOSE = "close", - DEBUG = "debug", - ERROR = "error" +import { type Tesseract } from "js-moi-utils"; +import { w3cwebsocket as Websocket } from "websocket"; +import type { Log, RpcResponse } from "../types/jsonrpc"; +import type { NewLogs, NewTesseractsByAccount, ProviderEvents, WebsocketEventMap } from "../types/websocket"; +import { BaseProvider } from "./base-provider"; +type TypeOfWebsocketConst = ConstructorParameters; +interface WebsocketConnection { + protocols?: TypeOfWebsocketConst[1]; + headers?: TypeOfWebsocketConst[3]; + requestOptions?: TypeOfWebsocketConst[4]; + clientConfig?: TypeOfWebsocketConst[5]; + reconnect?: { + delay: number; + maxAttempts: number; + }; + timeout?: number; } -/** - * WebSocketProvider class extends the JsonRpcProvider class and provides WebSocket-based - * communication with the JSON-RPC endpoint. - */ -export declare class WebSocketProvider extends JsonRpcProvider { - private requestQueue; - private responseQueue; - private connection; - private wsConnOptions; - private reconnecting; - private reconnAttempts; - private subscriptions; - private subsIds; - constructor(host: string, options?: WebsocketProviderOptions); - /** - * Establishes a WebSocket connection with the provided host. - * Creates a new WebSocket connection instance and sets up event handlers. - */ - private connect; - /** - * Sets up event listeners for the WebSocket connection. - */ - private addEventListener; - /** - * Removes event listeners from the WebSocket connection. - */ - private removeEventListener; - /** - * Initiates a reconnection to the WebSocket server. - * If there are pending requests in the response queue, their callbacks are - * invoked with a reconnection error. - * If the maximum reconnection attempts have not been reached, it schedules - * another reconnection attempt. - * If the maximum reconnection attempts have been reached, it invokes the - * error event and clears the request queue. - */ +export declare class WebsocketProvider extends BaseProvider { + private ws; + private reconnects; + private reconnectInterval?; + private readonly host; + private readonly options?; + private readonly subscriptions; + constructor(host: string, options?: WebsocketConnection); + private createNewWebsocket; private reconnect; + disconnect(): Promise; + private handleOnConnect; + private handleOnError; + private handleOnClose; + protected execute(method: string, params: any): Promise>; + private handleRpcRequest; + private isSubscriptionEvent; + getSubscription(eventName: ProviderEvents): Promise; + on(eventName: NewLogs, listener: (log: Log) => void): this; + on(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + on(eventName: K, listener: (...args: WebsocketEventMap[K]) => void): this; + once(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + once(eventName: NewLogs, listener: (logs: Log) => void): this; + once(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; + removeListener(eventName: NewLogs, listener: (logs: Log) => void): this; + removeListener(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + removeListener(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; /** - * Event handler triggered when the WebSocket connection is successfully established. - * Invokes pending requests in the request queue if any. - */ - private onConnect; - /** - * Checks if the WebSocket connection has failed based on the close event. - * - * @param event The close event object. - * @returns A boolean indicating whether the connection has failed. - */ - private isConnectionFailed; - /** - * Method called when the WebSocket connection is closed. - * - * @param event - The close event. - */ - private onClose; - /** - * Method called when a message is received through the WebSocket connection. - * - * @param event - The message event. - */ - private onMessage; - /** - * Method called when the WebSocket connection fails to connect. - * - * @param event - The connect failed event. - */ - private onConnectFailed; - /** - * Sends a request over the WebSocket connection. - * - * @param requestId - The ID of the request. - * @param request - The request object. - */ - private sendRequest; - /** - * Sends a request over the WebSocket connection and returns a Promise that - * resolves with the response. - * - * @param method - The method of the request. - * @param params - The parameters of the request. - * @returns A Promise that resolves with the response or rejects with an error. - */ - protected send(method: string, params: any[]): Promise; - /** - * Subscribes to an event. + * This method removes a listener from the provider * - * @param tag - The tag associated with the subscription. - * @param param - The parameters of the subscription. - * @param processFunc - The function to process the subscription result. - * @returns A Promise that resolves when the subscription is complete. + * @param eventName - The event to remove the listener from + * @param listener - The listener to remove + * @returns - The provider instance */ - protected _subscribe(tag: string, param: Array, processFunc: (result: any) => void): Promise; + off(eventName: string | symbol, listener: (...args: any[]) => void): this; /** - * Starts listening to an event. + * This methods returns all the listeners for a given event * - * @param event - The event to start listening to. + * @param eventName - The event to get the listeners for + * @returns - An array of listeners */ - protected _startEvent(event: Event): void; + listeners(eventName: string | symbol): Function[]; /** - * Stops listening to an event. + * Returns the number of listeners for the specified event name. * - * @param event - The event to stop listening to. + * @param eventName - The name of the event. + * @param listener - (Optional) The listener function. + * @returns The number of listeners for the specified event name. */ - protected _stopEvent(event: Event): void; + listenerCount(eventName: string | symbol, listener?: Function): number; /** - * Disconnects the WebSocket connection. + * Removes all event listeners for the specified event or all events. * - * @returns A Promise that resolves when the disconnect operation is complete. + * @param event - The event to remove listeners for. If not specified, all listeners for all events will be removed. + * @returns The instance of the class with all listeners removed. */ - disconnect(): Promise; + removeAllListeners(event?: string | symbol): this; } +export {}; //# sourceMappingURL=websocket-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts.map b/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts.map index 88841c0a..46e25d6f 100644 --- a/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts.map +++ b/packages/js-moi-providers/lib.cjs/websocket-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"websocket-provider.d.ts","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAK7D;;GAEG;AACH,oBAAY,eAAe;IACvB,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAClB;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;IAClD,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,CAAC,aAAa,CAA+B;IACpD,OAAO,CAAC,UAAU,CAAM;IACxB,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,OAAO,CAAuC;gBAE1C,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAsC5D;;;OAGG;IACH,OAAO,CAAC,OAAO,CAWd;IAED;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAUvB;IAED;;OAEG;IACH,OAAO,CAAC,mBAAmB,CAI1B;IAED;;;;;;;;OAQG;IACH,OAAO,CAAC,SAAS;IAuCjB;;;OAGG;IACH,OAAO,CAAC,SAAS,CAehB;IAED;;;;;OAKG;IACH,OAAO,CAAC,kBAAkB,CAEzB;IAED;;;;OAIG;IACH,OAAO,CAAC,OAAO,CA8Bd;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS,CA4ChB;IAGD;;;;OAIG;IACH,OAAO,CAAC,eAAe,CAsCtB;IAED;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAoBnB;;;;;;;OAOG;IACH,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IA+B3D;;;;;;;OAOG;cACa,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAc7G;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAwCzC;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAmBxC;;;;OAIG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;CAkB3C"} \ No newline at end of file +{"version":3,"file":"websocket-provider.d.ts","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,YAAY,IAAI,SAAS,EAAoB,MAAM,WAAW,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,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G,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI;IA0B/M;;;;;;OAMG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAIzE;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,EAAE;IAIpD;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAIzE;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAGpD"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-provider.js b/packages/js-moi-providers/lib.cjs/websocket-provider.js index 9496d652..c55329a2 100644 --- a/packages/js-moi-providers/lib.cjs/websocket-provider.js +++ b/packages/js-moi-providers/lib.cjs/websocket-provider.js @@ -1,462 +1,319 @@ "use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { - Object.defineProperty(o, "default", { enumerable: true, value: v }); -}) : function(o, v) { - o["default"] = v; -}); -var __importStar = (this && this.__importStar) || function (mod) { - if (mod && mod.__esModule) return mod; - var result = {}; - if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); - __setModuleDefault(result, mod); - return result; -}; Object.defineProperty(exports, "__esModule", { value: true }); -exports.WebSocketProvider = exports.WebSocketEvents = void 0; +exports.WebsocketProvider = void 0; +const crypto_1 = require("crypto"); const js_moi_utils_1 = require("js-moi-utils"); const websocket_1 = require("websocket"); -const jsonrpc_provider_1 = require("./jsonrpc-provider"); -const errors = __importStar(require("./errors")); -let nextReqId = 1; -/** - * Enum defining the WebSocket events. - */ -var WebSocketEvents; -(function (WebSocketEvents) { - WebSocketEvents["TESSERACT"] = "tesseract"; - WebSocketEvents["ALL_TESSERACTS"] = "all_tesseracts"; - WebSocketEvents["PENDING_INTERACTIONS"] = "pending_interactions"; - WebSocketEvents["CONNECT"] = "connect"; - WebSocketEvents["RECONNECT"] = "reconnect"; - WebSocketEvents["CLOSE"] = "close"; - WebSocketEvents["DEBUG"] = "debug"; - WebSocketEvents["ERROR"] = "error"; -})(WebSocketEvents || (exports.WebSocketEvents = WebSocketEvents = {})); -/** - * WebSocketProvider class extends the JsonRpcProvider class and provides WebSocket-based - * communication with the JSON-RPC endpoint. - */ -class WebSocketProvider extends jsonrpc_provider_1.JsonRpcProvider { - requestQueue; - responseQueue; - connection; - wsConnOptions; - reconnecting; - reconnAttempts; - subscriptions; - subsIds; +const base_provider_1 = require("./base-provider"); +const websocket_events_1 = require("./websocket-events"); +const WEBSOCKET_HOST_REGEX = /^wss?:\/\/([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(:[0-9]+)?(\/.*)?$/; +class WebsocketProvider extends base_provider_1.BaseProvider { + ws; + reconnects = 0; + reconnectInterval; + host; + options; + subscriptions = new Map(); constructor(host, options) { - if (/^ws(s)?:\/\//i.test(host)) { - super(host); - this.subsIds = {}; - this.wsConnOptions = {}; - this.wsConnOptions.host = host; - this.wsConnOptions.timeout = options?.timeout || 1000 * 5; - this.wsConnOptions.reconnectDelay = options?.reconnectDelay || undefined; - this.wsConnOptions.reconnectOptions = Object.assign({ - auto: false, - delay: 5000, - maxAttempts: 5, - onTimeout: false - }, options?.reconnectOptions); - this.wsConnOptions.headers = options?.headers || {}; - this.wsConnOptions.protocol = options?.protocol || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - this.wsConnOptions.requestOptions = options?.requestOptions || undefined; - this.wsConnOptions.origin = options?.origin || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - this.connection = null; - this.reconnAttempts = 0; - this.requestQueue = new Map(); - this.responseQueue = new Map(); - this.subscriptions = new Map(); - this.connect(); - return; + if (!WEBSOCKET_HOST_REGEX.test(host)) { + js_moi_utils_1.ErrorUtils.throwArgumentError("Invalid host", "host", host); } - js_moi_utils_1.ErrorUtils.throwError("Invalid websocket request url!", js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); + super(); + this.host = host; + this.options = options; + this.ws = this.createNewWebsocket(host, options); } - /** - * Establishes a WebSocket connection with the provided host. - * Creates a new WebSocket connection instance and sets up event handlers. - */ - connect = () => { - this.connection = new websocket_1.w3cwebsocket(this.host, this.wsConnOptions.protocol, undefined, this.wsConnOptions.headers, this.wsConnOptions.requestOptions, this.wsConnOptions.clientConfig); - this.addEventListener(); - }; - /** - * Sets up event listeners for the WebSocket connection. - */ - addEventListener = () => { - this.connection.onopen = this.onConnect.bind(this); - this.connection.onclose = this.onClose.bind(this); - this.connection.onmessage = this.onMessage.bind(this); - if (this.connection._client) { - this.connection._client.removeAllListeners("connectFailed"); - this.connection._client.on("connectFailed", this.onConnectFailed.bind(this)); + createNewWebsocket(host, options) { + const ws = new websocket_1.w3cwebsocket(host, options?.protocols, undefined, options?.headers ?? {}, options?.requestOptions, options?.clientConfig); + ws.onopen = () => this.handleOnConnect(); + ws.onerror = (error) => this.handleOnError(error); + ws.onclose = (event) => this.handleOnClose(event); + ws.onmessage = (message) => this.emit('message', message); + if (options?.timeout) { + setTimeout(() => { + if (ws.readyState === ws.OPEN) { + return; + } + ; + ws.close(3008, "Connection timeout"); + }, options.timeout); } - }; - /** - * Removes event listeners from the WebSocket connection. - */ - removeEventListener = () => { - this.connection.onopen = null; - this.connection.onclose = null; - this.connection.onmessage = null; - }; - /** - * Initiates a reconnection to the WebSocket server. - * If there are pending requests in the response queue, their callbacks are - * invoked with a reconnection error. - * If the maximum reconnection attempts have not been reached, it schedules - * another reconnection attempt. - * If the maximum reconnection attempts have been reached, it invokes the - * error event and clears the request queue. - */ + return ws; + } reconnect() { - this.reconnecting = true; - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - try { - this.responseQueue.delete(key); - request.callback(errors.PendingRequestsOnReconnectingError(), null); + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + if (this.options.reconnect) { + const interval = setInterval(() => { + if (this.ws.readyState === this.ws.OPEN) { + clearInterval(interval); + return; } - catch (e) { - console.error("Error encountered in reconnect: ", e); + if (this.reconnects >= this.options.reconnect.maxAttempts) { + this.emit('error', new Error('Max reconnect attempts reached')); + clearInterval(interval); + return; } - }); + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + }, this.options.reconnect.delay); } - if (!this.wsConnOptions.reconnectOptions.maxAttempts || - this.reconnAttempts < this.wsConnOptions.reconnectOptions.maxAttempts) { - setTimeout(() => { - this.reconnAttempts++; - this.removeEventListener(); - this.emit(WebSocketEvents.RECONNECT, this.reconnAttempts); - this.connect(); - }, this.wsConnOptions.reconnectOptions.delay); - return; + } + async disconnect() { + if (this.ws.readyState === this.ws.OPEN) { + this.ws.close(); + } + if (this.ws.readyState === this.ws.CLOSED) { + js_moi_utils_1.ErrorUtils.throwError("Closing on a closed connection", js_moi_utils_1.ErrorCode.ACTION_REJECTED); } - this.emit(WebSocketEvents.ERROR, errors.MaxAttemptsReachedOnReconnectingError()); - this.reconnecting = false; - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.MaxAttemptsReachedOnReconnectingError(), null); - this.requestQueue.delete(key); + if (this.ws.readyState === this.ws.CLOSING) { + return new Promise((resolve) => { + this.once(websocket_events_1.WebSocketEvent.Close, () => { + resolve(); + }); }); } - } - /** - * Event handler triggered when the WebSocket connection is successfully established. - * Invokes pending requests in the request queue if any. - */ - onConnect = () => { - this.emit(WebSocketEvents.CONNECT, "Websocket connection established successfully!"); - this.reconnAttempts = 0; - this.reconnecting = false; - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - try { - this.sendRequest(key, request); - } - catch (error) { - request.callback(error, null); - this.requestQueue.delete(key); - } + if (this.ws.readyState === this.ws.CONNECTING) { + return new Promise((resolve) => { + this.once(websocket_events_1.WebSocketEvent.Connect, () => { + this.ws.close(1000); + resolve(); + }); }); } - }; - /** - * Checks if the WebSocket connection has failed based on the close event. - * - * @param event The close event object. - * @returns A boolean indicating whether the connection has failed. - */ - isConnectionFailed = (event) => { - return event.code === 1006 && event.reason === "connection failed"; - }; - /** - * Method called when the WebSocket connection is closed. - * - * @param event - The close event. - */ - onClose = (event) => { - if (!this.isConnectionFailed(event)) { - this.subsIds = {}; - this.subscriptions = new Map(); - this.emit(WebSocketEvents.CLOSE, event); - if (this.wsConnOptions.reconnectOptions.auto && - (![1000, 1001].includes(event.code) || event.wasClean === false)) { + } + handleOnConnect() { + this.reconnects = 0; + this.emit('connect'); + } + handleOnError(error) { + this.emit('error', error); + } + handleOnClose(event) { + const isError = event.code !== 1000; + if (isError) { + if (this.options?.reconnect && this.reconnects < this.options.reconnect.maxAttempts) { + if (this.reconnectInterval) { + clearInterval(this.reconnectInterval); + } this.reconnect(); return; } - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); - } - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); - }); - } - this.removeEventListener(); - this.removeAllListeners(); } - }; - /** - * Method called when a message is received through the WebSocket connection. - * - * @param event - The message event. - */ - onMessage = (event) => { - const data = event.data; - const response = JSON.parse(data); - if (response.id != null) { - const id = response.id; - const request = this.responseQueue.get(id); - this.responseQueue.delete(id); - if (response.result != undefined) { - request.callback(null, response); - this.emit(WebSocketEvents.DEBUG, { - action: "response", - request: JSON.parse(request.payload), - response: response.result, - provider: this + this.emit('close'); + } + execute(method, params) { + if (this.ws.readyState !== this.ws.OPEN) { + return new Promise((resolve) => { + this.once(websocket_events_1.WebSocketEvent.Connect, async () => { + resolve(await this.handleRpcRequest(method, params)); }); - } - else { - // TODO: handle error - let error = null; - if (response.error) { - error = new Error(response.error.message || "unknown error"); - (0, js_moi_utils_1.defineReadOnly)(error, "code", response.error.code || null); - (0, js_moi_utils_1.defineReadOnly)(error, "response", data); - } - else { - error = new Error("unknown error"); + }); + } + return this.handleRpcRequest(method, params); + } + handleRpcRequest(method, params) { + const inputParams = Array.isArray(params) ? params : [params]; + const payload = { + method: method, + params: inputParams, + jsonrpc: "2.0", + id: (0, crypto_1.randomUUID)(), + }; + return new Promise((resolve) => { + const handler = (message) => { + const response = JSON.parse(message.data); + if (response.id !== payload.id) { + return; } - request.callback(error, null); - this.emit(WebSocketEvents.ERROR, { - action: "response", - error: error, - request: JSON.parse(request.payload), - provider: this - }); - } + // @ts-ignore - don't want to expose the message event + this.removeListener('message', handler); + resolve({ ...response, id: 1 }); + }; + // @ts-ignore - don't want to expose the message event + this.on('message', handler); + this.ws.send(JSON.stringify(payload)); + }); + } + isSubscriptionEvent(eventName) { + const events = ['newTesseracts', 'newTesseractsByAccount', 'newLogs', 'newPendingInteractions']; + const name = typeof eventName === "string" ? eventName : eventName.event; + return events.includes(name); + } + async getSubscription(eventName) { + const sub = this.subscriptions.get(eventName); + if (sub?.subID != null) { + return await this.subscriptions.get(eventName).subID; } - else if (response.method === "moi.subscription") { - const sub = this.subscriptions[response.params.subscription]; - if (sub) { - sub.processFunc(response.params.result); - } + if (sub == null) { + const promise = super.getSubscription(eventName); + this.subscriptions.set(eventName, { subID: promise }); + return await promise; } - }; + sub.subID = super.getSubscription(eventName); + return await sub.subID; + } /** - * Method called when the WebSocket connection fails to connect. + * This method listens to events emitted by the provider for the given event * - * @param event - The connect failed event. + * @param eventName - The event to listen to this can be a string or an object + * @param listener - The callback function to be called when the event is emitted + * @returns - The provider instance */ - onConnectFailed = (event) => { - let connectFailedDescription = event.toString().split('\n')[0]; - if (connectFailedDescription) { - event.description = connectFailedDescription; + on(eventName, listener) { + if (typeof eventName === "string") { + super.on(eventName, listener); } - event.code = 1006; - event.reason = 'connection failed'; - if (this.wsConnOptions.reconnectOptions.auto && (![1000, 1001].includes(event.code) || event.wasClean === false)) { - this.reconnect(); - return; - } - this.emit(WebSocketEvents.ERROR, event); - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${(0, crypto_1.randomUUID)()}`; + } + super.on(_sub.uuid, listener); + } + else { + const uuid = `${eventName.event}:${(0, crypto_1.randomUUID)()}`; + this.subscriptions.set(eventName, { uuid }); + super.on(uuid, listener); + } } - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.subID != null) { + return this; + } + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message) => { + const data = JSON.parse(message.data); + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return; + } + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName, data.params.result)); + return; + } + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } + }); }); } - //clean connection on our own - if (this.connection._connection) { - this.connection._connection.removeAllListeners(); - } - this.connection._client.removeAllListeners(); - this.connection._readyState = 3; // set readyState to CLOSED - this.emit(WebSocketEvents.CLOSE, event); - }; + return this; + } /** - * Sends a request over the WebSocket connection. + * Adds a one-time listener function for the specified event. * - * @param requestId - The ID of the request. - * @param request - The request object. + * @param eventName - The name of the event to listen for. + * @param listener - A function to be called when the event is triggered. + * @returns The WebSocketProvider instance. */ - sendRequest(requestId, request) { - if (this.connection.readyState !== this.connection.OPEN) { - this.requestQueue.delete(requestId); - request.callback(errors.ConnectionNotOpenError(), null); - return; + once(eventName, listener) { + if (typeof eventName === "string") { + super.once(eventName, listener); } - this.responseQueue.set(requestId, request); - this.requestQueue.delete(requestId); - try { - this.connection.send(request.payload); + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${(0, crypto_1.randomUUID)()}`; + } + super.once(_sub.uuid, listener); + } + else { + const uuid = `${eventName.event}:${(0, crypto_1.randomUUID)()}`; + this.subscriptions.set(eventName, { uuid }); + super.once(uuid, listener); + } } - catch (error) { - request.callback(error, null); - this.responseQueue.delete(requestId); + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.subID != null) { + return this; + } + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message) => { + const data = JSON.parse(message.data); + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return; + } + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName, data.params.result)); + return; + } + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } + }); + }); } + return this; } /** - * Sends a request over the WebSocket connection and returns a Promise that - * resolves with the response. + * Removes a listener from the WebSocket provider. * - * @param method - The method of the request. - * @param params - The parameters of the request. - * @returns A Promise that resolves with the response or rejects with an error. + * @param eventName - The name of the event or an object representing a subscription. + * @param listener - The listener function to be removed. + * @returns The WebSocket provider instance. */ - send(method, params) { - return new Promise((resolve, reject) => { - const callback = (error, result) => { - if (error) { - return reject(error); - } - return resolve(result); - }; - const requestId = nextReqId++; - const payload = { - method: method, - params: params, - id: requestId, - jsonrpc: "2.0" - }; - const request = { - payload: JSON.stringify(payload), - callback: callback - }; - if (this.connection.readyState === this.connection.CONNECTING || this.reconnecting) { - this.requestQueue.set(requestId, request); - return; + removeListener(eventName, listener) { + if (typeof eventName === "string") { + super.removeListener(eventName, listener); + } + if (typeof eventName === "object") { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + return this; } - this.sendRequest(requestId, request); - }); + super.removeListener(_sub.uuid, listener); + this.subscriptions.delete(eventName); + } + return this; } /** - * Subscribes to an event. + * This method removes a listener from the provider * - * @param tag - The tag associated with the subscription. - * @param param - The parameters of the subscription. - * @param processFunc - The function to process the subscription result. - * @returns A Promise that resolves when the subscription is complete. + * @param eventName - The event to remove the listener from + * @param listener - The listener to remove + * @returns - The provider instance */ - async _subscribe(tag, param, processFunc) { - let subIdPromise = this.subsIds[tag]; - if (subIdPromise == null) { - subIdPromise = Promise.all(param).then(async (param) => { - const response = await this.send("moi.subscribe", param); - return response.result; - }); - this.subsIds[tag] = subIdPromise; - } - const subId = await subIdPromise; - this.subscriptions[subId] = { tag, processFunc }; + off(eventName, listener) { + return super.off(eventName, listener); } /** - * Starts listening to an event. + * This methods returns all the listeners for a given event * - * @param event - The event to start listening to. + * @param eventName - The event to get the listeners for + * @returns - An array of listeners */ - _startEvent(event) { - switch (event.type) { - case WebSocketEvents.TESSERACT: - const params = { - address: event.address - }; - this._subscribe(event.tag, ["newAccountTesseracts", params], (result) => { - this.emit(event.address, result); - }); - break; - case WebSocketEvents.ALL_TESSERACTS: - this._subscribe("all_tesseracts", ["newTesseracts"], (result) => { - this.emit(WebSocketEvents.ALL_TESSERACTS, result); - }); - break; - case WebSocketEvents.PENDING_INTERACTIONS: - this._subscribe("pending_interactions", ["newPendingInteractions"], (result) => { - this.emit(WebSocketEvents.PENDING_INTERACTIONS, result); - }); - break; - case WebSocketEvents.CONNECT: - case WebSocketEvents.RECONNECT: - case WebSocketEvents.CLOSE: - case WebSocketEvents.DEBUG: - case WebSocketEvents.ERROR: - break; - default: - console.log("unhandled:", event); - break; - } + listeners(eventName) { + return super.listeners(eventName); } /** - * Stops listening to an event. + * Returns the number of listeners for the specified event name. * - * @param event - The event to stop listening to. + * @param eventName - The name of the event. + * @param listener - (Optional) The listener function. + * @returns The number of listeners for the specified event name. */ - _stopEvent(event) { - let tag = event.tag; - if (this.listenerCount(event.event)) { - // There are remaining event listeners - return; - } - const subId = this.subsIds[tag]; - if (!subId) { - return; - } - delete this.subsIds[tag]; - subId.then((subId) => { - if (!this.subscriptions[subId]) { - return; - } - delete this.subscriptions[subId]; - this.send("moi.unsubscribe", [subId]); - }); + listenerCount(eventName, listener) { + return super.listenerCount(eventName, listener); } /** - * Disconnects the WebSocket connection. + * Removes all event listeners for the specified event or all events. * - * @returns A Promise that resolves when the disconnect operation is complete. + * @param event - The event to remove listeners for. If not specified, all listeners for all events will be removed. + * @returns The instance of the class with all listeners removed. */ - async disconnect() { - // Wait until we have connected before trying to disconnect - if (this.connection.readyState === this.connection.CONNECTING) { - await (new Promise((resolve) => { - this.connection.onopen = () => { - resolve(true); - }; - this.connection.onerror = () => { - resolve(false); - }; - })); - } - // Hangup - // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes - this.connection.close(1000); + removeAllListeners(event) { + return super.removeAllListeners(event); } } -exports.WebSocketProvider = WebSocketProvider; +exports.WebsocketProvider = WebsocketProvider; //# sourceMappingURL=websocket-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.cjs/websocket-provider.js.map b/packages/js-moi-providers/lib.cjs/websocket-provider.js.map index ed326f05..88794883 100644 --- a/packages/js-moi-providers/lib.cjs/websocket-provider.js.map +++ b/packages/js-moi-providers/lib.cjs/websocket-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"websocket-provider.js","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqE;AACrE,yCAAmD;AACnD,yDAAmD;AAEnD,iDAAmC;AAInC,IAAI,SAAS,GAAG,CAAC,CAAC;AAElB;;GAEG;AACH,IAAY,eASX;AATD,WAAY,eAAe;IACvB,0CAAuB,CAAA;IACvB,oDAAiC,CAAA;IACjC,gEAA6C,CAAA;IAC7C,sCAAmB,CAAA;IACnB,0CAAuB,CAAA;IACvB,kCAAe,CAAA;IACf,kCAAe,CAAA;IACf,kCAAe,CAAA;AACnB,CAAC,EATW,eAAe,+BAAf,eAAe,QAS1B;AAED;;;GAGG;AACH,MAAa,iBAAkB,SAAQ,kCAAe;IAC1C,YAAY,CAA+B;IAC3C,aAAa,CAA+B;IAC5C,UAAU,CAAM;IAChB,aAAa,CAA2B;IACxC,YAAY,CAAU;IACtB,cAAc,CAAS;IACvB,aAAa,CAA4B;IACzC,OAAO,CAAuC;IAEtD,YAAY,IAAY,EAAE,OAAkC;QACxD,IAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,CAAA;YACX,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;YACjB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;YACvB,IAAI,CAAC,aAAa,CAAC,IAAI,GAAG,IAAI,CAAA;YAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,GAAG,CAAC,CA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AC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBAAC,OAAO;YAAC,CAAC;YAC3C,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAE,KAAK,CAAE,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,UAAU;QACnB,2DAA2D;QAC3D,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;YAC5D,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,EAAE;oBAC1B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC;gBAEF,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE;oBAC3B,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC,CAAC;YACN,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;QAED,SAAS;QACT,gFAAgF;QAChF,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACJ;AAjeD,8CAieC"} \ No newline at end of file +{"version":3,"file":"websocket-provider.js","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":";;;AAAA,mCAAoC;AACpC,+CAAqE;AACrE,yCAAwE;AAGxE,mDAA+C;AAC/C,yDAAoD;AAgBpD,MAAM,oBAAoB,GAAG,6DAA6D,CAAC;AAE3F,MAAa,iBAAkB,SAAQ,4BAAY;IACvC,EAAE,CAAY;IACd,UAAU,GAAG,CAAC,CAAC;IACf,iBAAiB,CAAkB;IAC1B,IAAI,CAAS;IACb,OAAO,CAAuB;IAC9B,aAAa,GAAoE,IAAI,GAAG,EAAE,CAAC;IAE5G,YA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AAC;YAChB,CAAC;YAED,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC1C,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACH,GAAG,CAAC,SAA0B,EAAE,QAAkC;QAC9D,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAI,SAA0B;QACnC,OAAO,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAI,SAA0B,EAAE,QAAmB;QAC5D,OAAO,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,KAAuB;QACtC,OAAO,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ;AA1XD,8CA0XC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/abstract-provider.d.ts b/packages/js-moi-providers/lib.esm/abstract-provider.d.ts index 53907fcf..239b698e 100644 --- a/packages/js-moi-providers/lib.esm/abstract-provider.d.ts +++ b/packages/js-moi-providers/lib.esm/abstract-provider.d.ts @@ -1,12 +1,13 @@ +import { EventEmitter } from "events"; import { LogicManifest } from "js-moi-manifest"; import { Interaction, Tesseract } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; import { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, NodeInfo, Options, Registry, Status, SyncStatus, TDU, type Log, type LogFilter } from "../types/jsonrpc"; +import { type ProviderEvents } from "../types/websocket"; /** * Abstract class representing a provider for interacting with the MOI protocol. * Provides methods for account operations, execution, and querying. */ -export declare abstract class AbstractProvider { +export declare abstract class AbstractProvider extends EventEmitter { abstract getBalance(address: string, assetId: string, options?: Options): Promise; abstract getContextInfo(address: string, options?: Options): Promise; abstract getTesseract(address: string, with_interactions: boolean, options?: Options): Promise; @@ -45,27 +46,6 @@ export declare abstract class AbstractProvider { abstract removeFilter(filter: Filter): Promise; abstract getLogsFilter(filter: LogFilter): Promise; abstract getLogs(filter: LogFilter): Promise; - abstract on(eventName: EventType, listener: Listener): AbstractProvider; - abstract once(eventName: EventType, listener: Listener): AbstractProvider; - abstract listenerCount(eventName?: EventType): number; - abstract listeners(eventName?: EventType): Array; - abstract off(eventName: EventType, listener?: Listener): AbstractProvider; - abstract removeAllListeners(eventName?: EventType): AbstractProvider; - /** - * Alias for "on" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be called when the event is emitted. - * @returns The provider instance for chaining. - */ - addListener(eventName: EventType, listener: Listener): AbstractProvider; - /** - * Alias for "off" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be unregistered. - * @returns The provider instance for chaining. - */ - removeListener(eventName: EventType, listener: Listener): AbstractProvider; + abstract getSubscription(event: ProviderEvents): Promise; } //# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/abstract-provider.d.ts.map b/packages/js-moi-providers/lib.esm/abstract-provider.d.ts.map index e7abea4c..cba70cf2 100644 --- a/packages/js-moi-providers/lib.esm/abstract-provider.d.ts.map +++ b/packages/js-moi-providers/lib.esm/abstract-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE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O,CAAC,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IACzC,QAAQ,CAAC,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IACjD,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1E,QAAQ,CAAC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC;IACvD,QAAQ,CAAC,gBAAgB,CAAC,CAAC,SAAS,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IACpE,QAAQ,CAAC,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAC1D,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACnD,QAAQ,CAAC,eAAe,CAAC,KAAK,EAAE,cAAc,GAAI,OAAO,CAAC,MAAM,CAAC;CACpE"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/abstract-provider.js b/packages/js-moi-providers/lib.esm/abstract-provider.js index d91dcaf6..6d542d32 100644 --- a/packages/js-moi-providers/lib.esm/abstract-provider.js +++ b/packages/js-moi-providers/lib.esm/abstract-provider.js @@ -1,29 +1,8 @@ +import { EventEmitter } from "events"; /** * Abstract class representing a provider for interacting with the MOI protocol. * Provides methods for account operations, execution, and querying. */ -export class AbstractProvider { - // Alias for "on" - /** - * Alias for "on" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be called when the event is emitted. - * @returns The provider instance for chaining. - */ - addListener(eventName, listener) { - return this.on(eventName, listener); - } - // Alias for "off" - /** - * Alias for "off" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be unregistered. - * @returns The provider instance for chaining. - */ - removeListener(eventName, listener) { - return this.off(eventName, listener); - } +export class AbstractProvider extends EventEmitter { } //# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/abstract-provider.js.map b/packages/js-moi-providers/lib.esm/abstract-provider.js.map index add966a6..3ffe312d 100644 --- a/packages/js-moi-providers/lib.esm/abstract-provider.js.map +++ b/packages/js-moi-providers/lib.esm/abstract-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":"AA4BA;;;GAGG;AACH,MAAM,OAAgB,gBAAgB;IA0DlC,iBAAiB;IAEjB;;;;;;OAMG;IACH,WAAW,CAAC,SAAoB,EAAE,QAAkB;QAChD,OAAO,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACxC,CAAC;IAED,kBAAkB;IAElB;;;;;;OAMG;IACH,cAAc,CAAC,SAAoB,EAAE,QAAkB;QACnD,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACzC,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../src.ts/abstract-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AA+BtC;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,YAAY;CAkD1D"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/base-provider.d.ts b/packages/js-moi-providers/lib.esm/base-provider.d.ts index 85e2f021..158ccecf 100644 --- a/packages/js-moi-providers/lib.esm/base-provider.d.ts +++ b/packages/js-moi-providers/lib.esm/base-provider.d.ts @@ -1,16 +1,18 @@ import { LogicManifest } from "js-moi-manifest"; import { Interaction, Tesseract } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; -import { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, NodeInfo, Options, Registry, RpcResponse, Status, SyncStatus, TDU, type Log, type LogFilter } from "../types/jsonrpc"; +import type { AccountMetaInfo, AccountState, AssetInfo, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InteractionCallResponse, InteractionReceipt, InteractionRequest, InteractionResponse, Log, LogFilter, NodeInfo, Options, Registry, RpcResponse, Status, SyncStatus, TDU } from "../types/jsonrpc"; +import type { ProviderEvents } from "../types/websocket"; import { AbstractProvider } from "./abstract-provider"; -import Event from "./event"; +export interface EventTag { + event: string; + params?: unknown; +} /** * Class representing a base provider for interacting with the MOI protocol. * Extends the AbstractProvider class and provides implementations for * account operations, execution, and querying RPC methods. */ export declare class BaseProvider extends AbstractProvider { - protected _events: Event[]; constructor(); /** * Helper function to process the RPC response and extract the relevant data. @@ -404,6 +406,8 @@ export declare class BaseProvider extends AbstractProvider { * the response. */ getNodeInfo(): Promise; + getSubscription(event: ProviderEvents): Promise; + private validateAndFormatEvent; /** * Waits for the interaction with the specified hash to be included in a tesseract * and returns the interaction receipt. @@ -426,6 +430,7 @@ export declare class BaseProvider extends AbstractProvider { * data is missing. */ protected processReceipt(receipt: InteractionReceipt): any; + protected processWsResult(event: ProviderEvents, result: unknown): unknown; /** * Waits for the interaction with the specified hash to be included in a * tesseract and returns the result based on the interaction type. @@ -454,88 +459,5 @@ export declare class BaseProvider extends AbstractProvider { * @throws {Error} if the method is not implemented. */ protected execute(method: string, params: any): Promise>; - /** - * Starts the specified event by performing necessary actions. - * - * @param {Event} event - The event to start. - */ - protected _startEvent(event: Event): void; - /** - * Stops the specified event by performing necessary actions. - * - * @param {Event} event - The event to stop. - */ - protected _stopEvent(event: Event): void; - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @param {boolean} once - Indicates whether the listener should be called - * only once (true) or multiple times (false). - * @returns The instance of the class to allow method chaining. - */ - protected _addEventListener(eventName: EventType, listener: Listener, once: boolean): this; - /** - * Emits the specified event and calls all the associated listeners. - * - * @param {EventType} eventName - The name of the event to emit. - * @param {Array} args - The arguments to be passed to the event listeners. - * @returns {boolean} A boolean indicating whether any listeners were called - * for the event. - */ - protected emit(eventName: EventType, ...args: Array): boolean; - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the event is emitted. - * @returns The instance of the class to allow method chaining. - */ - on(eventName: EventType, listener: Listener): this; - /** - * Adds a one-time event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @returns The instance of the class to allow method chaining. - */ - once(eventName: EventType, listener: Listener): this; - /** - * Returns the number of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns {number} The number of listeners for the event. - */ - listenerCount(eventName?: EventType): number; - /** - * Returns an array of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns An array of listeners for the event. - */ - listeners(eventName?: EventType): Array; - /** - * Removes an event listener for the specified event. If no listener is - * specified, removes all listeners for the event. - * - * @param {EventType} eventName - The name of the event to remove the - * listener from. - * @param {Listener} listener - The listener function to remove. If not - * provided, removes all listeners for the event. - * @returns The instance of the class to allow method chaining. - */ - off(eventName: EventType, listener?: Listener): this; - /** - * Removes all listeners for the specified event. If no event is specified, - * removes all listeners for all events. - * - * @param {EventType} eventName - The name of the event to remove all - * listeners from. - * @returns The instance of the class to allow method chaining. - */ - removeAllListeners(eventName?: EventType): this; } //# sourceMappingURL=base-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/base-provider.d.ts.map b/packages/js-moi-providers/lib.esm/base-provider.d.ts.map index d665939b..249af186 100644 --- a/packages/js-moi-providers/lib.esm/base-provider.d.ts.map +++ b/packages/js-moi-providers/lib.esm/base-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"base-provider.d.ts","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAC+E,WAAW,EAI7F,SAAS,EAGZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EACH,eAAe,EAA4C,YAAY,EACvE,SAAS,EAAkC,sBAAsB,EAAE,qBAAqB,EACxF,OAAO,EAAE,WAAW,EAAwC,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAExH,uBAAuB,EAAqB,kBAAkB,EAC9D,kBAAkB,EAAE,mBAAmB,EAAuB,QAAQ,EAAE,OAAO,EAAE,QAAQ,EACzF,WAAW,EAAE,MAAM,EAAiC,UAAU,EAAoB,GAAG,EACrF,KAAK,GAAG,EACR,KAAK,SAAS,EACjB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,MAAM,SAAS,CAAC;AAU5B;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAC9C,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;;IAQ3B;;;;;;;;;OASG;IACH,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAazD;;;;;;;;;OASG;IACU,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAkBtG;;;;;;;;;OASG;IACU,cAAc,CAAC,OAAO,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providers/lib.esm/base-provider.js b/packages/js-moi-providers/lib.esm/base-provider.js index 683c3599..7018c61c 100644 --- a/packages/js-moi-providers/lib.esm/base-provider.js +++ b/packages/js-moi-providers/lib.esm/base-provider.js @@ -1,24 +1,21 @@ import { ManifestCoder } from "js-moi-manifest"; -import { CustomError, ErrorCode, ErrorUtils, IxType, bytesToHex, decodeBase64, hexDataLength, hexToBN, hexToBytes, isValidAddress, toQuantity, topicHash, unmarshal } from "js-moi-utils"; +import { CustomError, ErrorCode, ErrorUtils, IxType, bytesToHex, decodeBase64, encodeToString, hexToBN, hexToBytes, isValidAddress, toQuantity, topicHash, unmarshal } from "js-moi-utils"; import { AbstractProvider } from "./abstract-provider"; -import Event from "./event"; import { processIxObject } from "./interaction"; // Default timeout value in seconds const defaultTimeout = 120; const defaultOptions = { tesseract_number: -1 }; +; /** * Class representing a base provider for interacting with the MOI protocol. * Extends the AbstractProvider class and provides implementations for * account operations, execution, and querying RPC methods. */ export class BaseProvider extends AbstractProvider { - _events; constructor() { super(); - // Events being listened to - this._events = []; } /** * Helper function to process the RPC response and extract the relevant data. @@ -773,7 +770,7 @@ export class BaseProvider extends AbstractProvider { const response = await this.execute("moi.GetLogs", payload); return this.processResponse(response).map((log) => ({ ...log, - data: "0x" + bytesToHex(decodeBase64(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged + data: encodeToString(decodeBase64(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged })); } /** @@ -918,6 +915,35 @@ export class BaseProvider extends AbstractProvider { throw error; } } + async getSubscription(event) { + let params = []; + if (typeof event === "string") { + params = event; + } + if (typeof event === "object") { + params = this.validateAndFormatEvent(event); + } + const response = await this.execute("moi.subscribe", params); + return this.processResponse(response); + } + validateAndFormatEvent(event) { + if (!isValidAddress(event.params.address)) { + ErrorUtils.throwArgumentError("Invalid address provided", "event.params.address", event.params); + } + if (event.event === 'newTesseractsByAccount') { + return [event.event, { address: event.params.address }]; + } + if (event.event === 'newLogs') { + if (event.params.topics == null) { + event.params.topics = []; + } + if (Array.isArray(event.params.topics) === false) { + ErrorUtils.throwArgumentError("Topics should be an array", "event.params.topics", event.params.topics); + } + return [event.event, { address: event.params.address, topics: this.hashTopics(event.params.topics), start_height: event.params.height[0], end_height: event.params.height[1] }]; + } + throw ErrorUtils.throwError("Invalid event type", ErrorCode.INVALID_ARGUMENT); + } /** * Waits for the interaction with the specified hash to be included in a tesseract * and returns the interaction receipt. @@ -1013,6 +1039,25 @@ export class BaseProvider extends AbstractProvider { throw new Error("Unsupported interaction type encountered"); } } + processWsResult(event, result) { + if (event === 'newPendingInteractions') { + if (typeof result === "string") { + return result.startsWith("0x") ? result : `0x${result}`; + } + ErrorUtils.throwError("Invalid response received", ErrorCode.SERVER_ERROR); + } + if (typeof event === "string" && ["newTesseracts"].includes(event)) { + return result; + } + if (typeof event === "object" && event.event === "newTesseractsByAccount") { + return result; + } + if (typeof event === "object" && event.event === "newLogs") { + const log = result; + return { ...log, data: encodeToString(decodeBase64(log.data)) }; + } + ErrorUtils.throwArgumentError("Invalid event type", "event", event); + } /** * Waits for the interaction with the specified hash to be included in a * tesseract and returns the result based on the interaction type. @@ -1048,193 +1093,5 @@ export class BaseProvider extends AbstractProvider { execute(method, params) { throw new Error(method + " not implemented"); } - /** - * Starts the specified event by performing necessary actions. - * - * @param {Event} event - The event to start. - */ - _startEvent(event) { - } - /** - * Stops the specified event by performing necessary actions. - * - * @param {Event} event - The event to stop. - */ - _stopEvent(event) { - } - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @param {boolean} once - Indicates whether the listener should be called - * only once (true) or multiple times (false). - * @returns The instance of the class to allow method chaining. - */ - _addEventListener(eventName, listener, once) { - const event = new Event(getEventTag(eventName), listener, once); - this._events.push(event); - this._startEvent(event); - return this; - } - /** - * Emits the specified event and calls all the associated listeners. - * - * @param {EventType} eventName - The name of the event to emit. - * @param {Array} args - The arguments to be passed to the event listeners. - * @returns {boolean} A boolean indicating whether any listeners were called - * for the event. - */ - emit(eventName, ...args) { - let result = false; - let stopped = []; - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { - return true; - } - setTimeout(() => { - event.listener.apply(this, args); - }, 0); - result = true; - if (event.once) { - stopped.push(event); - return false; - } - return true; - }); - stopped.forEach((event) => { this._stopEvent(event); }); - return result; - } - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the event is emitted. - * @returns The instance of the class to allow method chaining. - */ - on(eventName, listener) { - return this._addEventListener(eventName, listener, false); - } - /** - * Adds a one-time event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @returns The instance of the class to allow method chaining. - */ - once(eventName, listener) { - return this._addEventListener(eventName, listener, true); - } - /** - * Returns the number of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns {number} The number of listeners for the event. - */ - listenerCount(eventName) { - if (!eventName) { - return this._events.length; - } - let eventTag = getEventTag(eventName); - return this._events.filter((event) => { - return (event.tag === eventTag); - }).length; - } - /** - * Returns an array of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns An array of listeners for the event. - */ - listeners(eventName) { - if (eventName == null) { - return this._events.map((event) => event.listener); - } - let eventTag = getEventTag(eventName); - return this._events - .filter((event) => (event.tag === eventTag)) - .map((event) => event.listener); - } - /** - * Removes an event listener for the specified event. If no listener is - * specified, removes all listeners for the event. - * - * @param {EventType} eventName - The name of the event to remove the - * listener from. - * @param {Listener} listener - The listener function to remove. If not - * provided, removes all listeners for the event. - * @returns The instance of the class to allow method chaining. - */ - off(eventName, listener) { - if (listener == null) { - return this.removeAllListeners(eventName); - } - const stopped = []; - let found = false; - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag || event.listener != listener) { - return true; - } - if (found) { - return true; - } - found = true; - stopped.push(event); - return false; - }); - stopped.forEach((event) => { this._stopEvent(event); }); - return this; - } - /** - * Removes all listeners for the specified event. If no event is specified, - * removes all listeners for all events. - * - * @param {EventType} eventName - The name of the event to remove all - * listeners from. - * @returns The instance of the class to allow method chaining. - */ - removeAllListeners(eventName) { - let stopped = []; - if (eventName == null) { - stopped = this._events; - this._events = []; - } - else { - const eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { - return true; - } - stopped.push(event); - return false; - }); - } - stopped.forEach((event) => { this._stopEvent(event); }); - return this; - } } -// helper functions -/** - * Retrieves the event tag based on the event name. - * - * @param {EventType} eventName - The name of the event. - * @returns {string} The event tag. - * @throws {Error} if the event name is invalid. - */ -const getEventTag = (eventName) => { - if (typeof (eventName) === "string") { - eventName = eventName.toLowerCase(); - if (hexDataLength(eventName) === 32) { - return "tesseract:" + eventName; - } - if (eventName.indexOf(":") === -1) { - return eventName; - } - } - throw new Error("invalid event - " + eventName); -}; //# sourceMappingURL=base-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/base-provider.js.map b/packages/js-moi-providers/lib.esm/base-provider.js.map index 733db72d..1833da5e 100644 --- a/packages/js-moi-providers/lib.esm/base-provider.js.map +++ b/packages/js-moi-providers/lib.esm/base-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAC2C,WAAW,EAAE,SAAS,EAAE,UAAU,EAChF,MAAM,EAGK,UAAU,EACrB,YAAY,EACZ,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EACvF,MAAM,cAAc,CAAC;AActB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAA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KAAK,CAAC,GAAG,KAAK,QAAQ,EAAE,CAAC;oBAAC,OAAO,IAAI,CAAC;gBAAC,CAAC;gBAC5C,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACpB,OAAO,KAAK,CAAC;YACjB,CAAC,CAAC,CAAC;QACP,CAAC;QAED,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAExD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,mBAAmB;AACnB;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,CAAC,SAAoB,EAAU,EAAE;IACjD,IAAI,OAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,EAAE,CAAC;QACjC,SAAS,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;QAEpC,IAAI,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;YAClC,OAAO,YAAY,GAAG,SAAS,CAAC;QACpC,CAAC;QAED,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YAChC,OAAO,SAAS,CAAC;QACrB,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;AACpD,CAAC,CAAA"} \ No newline at end of file +{"version":3,"file":"base-provider.js","sourceRoot":"","sources":["../src.ts/base-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAC2C,WAAW,EAAE,SAAS,EAAE,UAAU,EAChF,MAAM,EAGK,UAAU,EACrB,YAAY,EACZ,cAAc,EACd,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EACxE,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAq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AAkB,CAAC,CAAA;IAChD,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/event.d.ts b/packages/js-moi-providers/lib.esm/event.d.ts deleted file mode 100644 index e95a83b8..00000000 --- a/packages/js-moi-providers/lib.esm/event.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { EventType, Listener } from "../types/event"; -export default class Event { - readonly listener: Listener; - readonly once: boolean; - readonly tag: string; - constructor(tag: string, listener: Listener, once: boolean); - /** - * Returns the name of the event. - * @returns The event name. - */ - get event(): EventType; - /** - * Returns the type of the event. - * @returns The event type. - */ - get type(): string; - /** - * Returns the address from the tesseract event. - * @returns The address form tesseract. - */ - get address(): string; - /** - * Checks if the event is pollable. - * @returns True if the event is pollable, false otherwise. - */ - pollable(): boolean; -} -//# sourceMappingURL=event.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/event.d.ts.map b/packages/js-moi-providers/lib.esm/event.d.ts.map deleted file mode 100644 index a7a65e14..00000000 --- a/packages/js-moi-providers/lib.esm/event.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src.ts/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAMrD,MAAM,CAAC,OAAO,OAAO,KAAK;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;IAM1D;;;OAGG;IACH,IAAI,KAAK,IAAI,SAAS,CAOrB;IAED;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;OAGG;IACH,IAAI,OAAO,IAAI,MAAM,CAIpB;IAED;;;OAGG;IACH,QAAQ,IAAI,OAAO;CAGtB"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/event.js b/packages/js-moi-providers/lib.esm/event.js deleted file mode 100644 index cedf4ced..00000000 --- a/packages/js-moi-providers/lib.esm/event.js +++ /dev/null @@ -1,50 +0,0 @@ -import { defineReadOnly } from "js-moi-utils"; -// List of events that can be polled -const PollableEvents = ["all_tesseracts", "tesseract"]; -export default class Event { - listener; - once; - tag; - constructor(tag, listener, once) { - defineReadOnly(this, "tag", tag); - defineReadOnly(this, "listener", listener); - defineReadOnly(this, "once", once); - } - /** - * Returns the name of the event. - * @returns The event name. - */ - get event() { - switch (this.type) { - case "tesseract": - return this.address; - } - return this.tag; - } - /** - * Returns the type of the event. - * @returns The event type. - */ - get type() { - return this.tag.split(":")[0]; - } - /** - * Returns the address from the tesseract event. - * @returns The address form tesseract. - */ - get address() { - const comps = this.tag.split(":"); - if (comps[0] !== "tesseract") { - return null; - } - return comps[1]; - } - /** - * Checks if the event is pollable. - * @returns True if the event is pollable, false otherwise. - */ - pollable() { - return (this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0); - } -} -//# sourceMappingURL=event.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/event.js.map b/packages/js-moi-providers/lib.esm/event.js.map deleted file mode 100644 index 39371da2..00000000 --- a/packages/js-moi-providers/lib.esm/event.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"event.js","sourceRoot":"","sources":["../src.ts/event.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,oCAAoC;AACpC,MAAM,cAAc,GAAG,CAAE,gBAAgB,EAAE,WAAW,CAAE,CAAC;AAEzD,MAAM,CAAC,OAAO,OAAO,KAAK;IACb,QAAQ,CAAW;IACnB,IAAI,CAAU;IACd,GAAG,CAAS;IAErB,YAAY,GAAW,EAAE,QAAkB,EAAE,IAAa;QACtD,cAAc,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;QACjC,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC3C,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACL,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;YAChB,KAAK,WAAW;gBACZ,OAAO,IAAI,CAAC,OAAO,CAAC;QAC5B,CAAC;QAED,OAAO,IAAI,CAAC,GAAG,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;IACH,IAAI,OAAO;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE,CAAC;YAAC,OAAO,IAAI,CAAC;QAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,QAAQ;QACJ,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/index.d.ts b/packages/js-moi-providers/lib.esm/index.d.ts index 2b038e14..1d7b2e82 100644 --- a/packages/js-moi-providers/lib.esm/index.d.ts +++ b/packages/js-moi-providers/lib.esm/index.d.ts @@ -1,9 +1,10 @@ +export type * from "../types/event"; +export type * from "../types/jsonrpc"; +export type * from "../types/provider"; export * from "./abstract-provider"; export * from "./base-provider"; export * from "./jsonrpc-provider"; export * from "./voyage-provider"; -export * from "./websocket-provider"; -export type * from "../types/jsonrpc"; -export type * from "../types/event"; -export type * from "../types/provider"; +export { WebSocketEvent } from "./websocket-events"; +export { WebsocketProvider } from "./websocket-provider"; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/index.d.ts.map b/packages/js-moi-providers/lib.esm/index.d.ts.map index 6b8a186c..2ff83f01 100644 --- a/packages/js-moi-providers/lib.esm/index.d.ts.map +++ b/packages/js-moi-providers/lib.esm/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC;AACrC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,mBAAmB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,kBAAkB,CAAC;AACtC,mBAAmB,mBAAmB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/index.js b/packages/js-moi-providers/lib.esm/index.js index dc1b6997..86741bde 100644 --- a/packages/js-moi-providers/lib.esm/index.js +++ b/packages/js-moi-providers/lib.esm/index.js @@ -2,5 +2,6 @@ export * from "./abstract-provider"; export * from "./base-provider"; export * from "./jsonrpc-provider"; export * from "./voyage-provider"; -export * from "./websocket-provider"; +export { WebSocketEvent } from "./websocket-events"; +export { WebsocketProvider } from "./websocket-provider"; //# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/index.js.map b/packages/js-moi-providers/lib.esm/index.js.map index d6b734e3..1af2f0d4 100644 --- a/packages/js-moi-providers/lib.esm/index.js.map +++ b/packages/js-moi-providers/lib.esm/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,sBAAsB,CAAC"} \ No newline at end of file +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAGA,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts b/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts index 89a7155b..37b1ac74 100644 --- a/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts +++ b/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts @@ -1,6 +1,5 @@ -import { BaseProvider } from "./base-provider"; -import Event from "./event"; import { RpcResponse } from "../types/jsonrpc"; +import { BaseProvider } from "./base-provider"; /** * A class that represents a JSON-RPC provider for making RPC calls over HTTP. */ @@ -25,17 +24,5 @@ export declare class JsonRpcProvider extends BaseProvider { * @throws Error if there is an error sending the RPC request. */ protected send(method: string, params: any[]): Promise>; - /** - * Starts an event. - * - * @param event - The event to start. - */ - protected _startEvent(event: Event): void; - /** - * Stops an event. - * - * @param event - The event to stop. - */ - protected _stopEvent(event: Event): void; } //# sourceMappingURL=jsonrpc-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts.map b/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts.map index b376ada3..59be25d1 100644 --- a/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts.map +++ b/packages/js-moi-providers/lib.esm/jsonrpc-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc-provider.d.ts","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAYxB;;;;;;;OAOG;cACa,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQhF;;;;;;;OAOG;cACa,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IA2C/E;;;;OAIG;IACH,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAIzC;;;;OAIG;IACH,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;CAG3C"} \ No newline at end of file +{"version":3,"file":"jsonrpc-provider.d.ts","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC7C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM;IAYxB;;;;;;;OAOG;cACa,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAQhF;;;;;;;OAOG;cACa,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CA0ClF"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/jsonrpc-provider.js b/packages/js-moi-providers/lib.esm/jsonrpc-provider.js index e4ea79c7..595a59b0 100644 --- a/packages/js-moi-providers/lib.esm/jsonrpc-provider.js +++ b/packages/js-moi-providers/lib.esm/jsonrpc-provider.js @@ -69,21 +69,5 @@ export class JsonRpcProvider extends BaseProvider { ErrorUtils.throwError(`Error: ${error.message}`, ErrorCode.NETWORK_ERROR); } } - /** - * Starts an event. - * - * @param event - The event to start. - */ - _startEvent(event) { - super._startEvent(event); - } - /** - * Stops an event. - * - * @param event - The event to stop. - */ - _stopEvent(event) { - super._stopEvent(event); - } } //# sourceMappingURL=jsonrpc-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/jsonrpc-provider.js.map b/packages/js-moi-providers/lib.esm/jsonrpc-provider.js.map index c25e2f7c..ddc402dd 100644 --- a/packages/js-moi-providers/lib.esm/jsonrpc-provider.js.map +++ b/packages/js-moi-providers/lib.esm/jsonrpc-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"jsonrpc-provider.js","sourceRoot":"","sources":["../src.ts/jsonrpc-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,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AA;QAChC,CAAC;QAAC,OAAM,KAAK,EAAE,CAAC;YACZ,IAAG,KAAK,YAAY,WAAW,EAAE,CAAC;gBAC9B,MAAM,KAAK,CAAC;YAChB,CAAC;YAED,UAAU,CAAC,UAAU,CACjB,UAAU,KAAK,CAAC,OAAO,EAAE,EACzB,SAAS,CAAC,aAAa,CAC1B,CAAA;QACL,CAAC;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-events.d.ts b/packages/js-moi-providers/lib.esm/websocket-events.d.ts new file mode 100644 index 00000000..48e235d5 --- /dev/null +++ b/packages/js-moi-providers/lib.esm/websocket-events.d.ts @@ -0,0 +1,11 @@ +export declare enum WebSocketEvent { + Close = "close", + Connect = "connect", + Error = "error", + Reconnect = "reconnect", + NewTesseracts = "newTesseracts", + NewPendingInteractions = "newPendingInteractions", + NewLog = "newLog", + NewTesseractsByAccount = "newTesseractsByAccount" +} +//# sourceMappingURL=websocket-events.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-events.d.ts.map b/packages/js-moi-providers/lib.esm/websocket-events.d.ts.map new file mode 100644 index 00000000..5f89d29a --- /dev/null +++ b/packages/js-moi-providers/lib.esm/websocket-events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"websocket-events.d.ts","sourceRoot":"","sources":["../src.ts/websocket-events.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACtB,KAAK,UAAU;IAEf,OAAO,YAAY;IAEnB,KAAK,UAAU;IAEf,SAAS,cAAc;IAEvB,aAAa,kBAAkB;IAE/B,sBAAsB,2BAA2B;IAEjD,MAAM,WAAW;IAEjB,sBAAsB,2BAA2B;CACpD"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-events.js b/packages/js-moi-providers/lib.esm/websocket-events.js new file mode 100644 index 00000000..df5e9d72 --- /dev/null +++ b/packages/js-moi-providers/lib.esm/websocket-events.js @@ -0,0 +1,12 @@ +export var WebSocketEvent; +(function (WebSocketEvent) { + WebSocketEvent["Close"] = "close"; + WebSocketEvent["Connect"] = "connect"; + WebSocketEvent["Error"] = "error"; + WebSocketEvent["Reconnect"] = "reconnect"; + WebSocketEvent["NewTesseracts"] = "newTesseracts"; + WebSocketEvent["NewPendingInteractions"] = "newPendingInteractions"; + WebSocketEvent["NewLog"] = "newLog"; + WebSocketEvent["NewTesseractsByAccount"] = "newTesseractsByAccount"; +})(WebSocketEvent || (WebSocketEvent = {})); +//# sourceMappingURL=websocket-events.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-events.js.map b/packages/js-moi-providers/lib.esm/websocket-events.js.map new file mode 100644 index 00000000..1c13d47f --- /dev/null +++ b/packages/js-moi-providers/lib.esm/websocket-events.js.map @@ -0,0 +1 @@ +{"version":3,"file":"websocket-events.js","sourceRoot":"","sources":["../src.ts/websocket-events.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,cAgBX;AAhBD,WAAY,cAAc;IACtB,iCAAe,CAAA;IAEf,qCAAmB,CAAA;IAEnB,iCAAe,CAAA;IAEf,yCAAuB,CAAA;IAEvB,iDAA+B,CAAA;IAE/B,mEAAiD,CAAA;IAEjD,mCAAiB,CAAA;IAEjB,mEAAiD,CAAA;AACrD,CAAC,EAhBW,cAAc,KAAd,cAAc,QAgBzB"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-provider.d.ts b/packages/js-moi-providers/lib.esm/websocket-provider.d.ts index d8baed47..b51dd020 100644 --- a/packages/js-moi-providers/lib.esm/websocket-provider.d.ts +++ b/packages/js-moi-providers/lib.esm/websocket-provider.d.ts @@ -1,128 +1,77 @@ -import { JsonRpcProvider } from "./jsonrpc-provider"; -import Event from "./event"; -import { WebsocketProviderOptions } from "../types/provider"; -/** - * Enum defining the WebSocket events. - */ -export declare enum WebSocketEvents { - TESSERACT = "tesseract", - ALL_TESSERACTS = "all_tesseracts", - PENDING_INTERACTIONS = "pending_interactions", - CONNECT = "connect", - RECONNECT = "reconnect", - CLOSE = "close", - DEBUG = "debug", - ERROR = "error" +import { type Tesseract } from "js-moi-utils"; +import { w3cwebsocket as Websocket } from "websocket"; +import type { Log, RpcResponse } from "../types/jsonrpc"; +import type { NewLogs, NewTesseractsByAccount, ProviderEvents, WebsocketEventMap } from "../types/websocket"; +import { BaseProvider } from "./base-provider"; +type TypeOfWebsocketConst = ConstructorParameters; +interface WebsocketConnection { + protocols?: TypeOfWebsocketConst[1]; + headers?: TypeOfWebsocketConst[3]; + requestOptions?: TypeOfWebsocketConst[4]; + clientConfig?: TypeOfWebsocketConst[5]; + reconnect?: { + delay: number; + maxAttempts: number; + }; + timeout?: number; } -/** - * WebSocketProvider class extends the JsonRpcProvider class and provides WebSocket-based - * communication with the JSON-RPC endpoint. - */ -export declare class WebSocketProvider extends JsonRpcProvider { - private requestQueue; - private responseQueue; - private connection; - private wsConnOptions; - private reconnecting; - private reconnAttempts; - private subscriptions; - private subsIds; - constructor(host: string, options?: WebsocketProviderOptions); - /** - * Establishes a WebSocket connection with the provided host. - * Creates a new WebSocket connection instance and sets up event handlers. - */ - private connect; - /** - * Sets up event listeners for the WebSocket connection. - */ - private addEventListener; - /** - * Removes event listeners from the WebSocket connection. - */ - private removeEventListener; - /** - * Initiates a reconnection to the WebSocket server. - * If there are pending requests in the response queue, their callbacks are - * invoked with a reconnection error. - * If the maximum reconnection attempts have not been reached, it schedules - * another reconnection attempt. - * If the maximum reconnection attempts have been reached, it invokes the - * error event and clears the request queue. - */ +export declare class WebsocketProvider extends BaseProvider { + private ws; + private reconnects; + private reconnectInterval?; + private readonly host; + private readonly options?; + private readonly subscriptions; + constructor(host: string, options?: WebsocketConnection); + private createNewWebsocket; private reconnect; + disconnect(): Promise; + private handleOnConnect; + private handleOnError; + private handleOnClose; + protected execute(method: string, params: any): Promise>; + private handleRpcRequest; + private isSubscriptionEvent; + getSubscription(eventName: ProviderEvents): Promise; + on(eventName: NewLogs, listener: (log: Log) => void): this; + on(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + on(eventName: K, listener: (...args: WebsocketEventMap[K]) => void): this; + once(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + once(eventName: NewLogs, listener: (logs: Log) => void): this; + once(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; + removeListener(eventName: NewLogs, listener: (logs: Log) => void): this; + removeListener(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + removeListener(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; /** - * Event handler triggered when the WebSocket connection is successfully established. - * Invokes pending requests in the request queue if any. - */ - private onConnect; - /** - * Checks if the WebSocket connection has failed based on the close event. - * - * @param event The close event object. - * @returns A boolean indicating whether the connection has failed. - */ - private isConnectionFailed; - /** - * Method called when the WebSocket connection is closed. - * - * @param event - The close event. - */ - private onClose; - /** - * Method called when a message is received through the WebSocket connection. - * - * @param event - The message event. - */ - private onMessage; - /** - * Method called when the WebSocket connection fails to connect. - * - * @param event - The connect failed event. - */ - private onConnectFailed; - /** - * Sends a request over the WebSocket connection. - * - * @param requestId - The ID of the request. - * @param request - The request object. - */ - private sendRequest; - /** - * Sends a request over the WebSocket connection and returns a Promise that - * resolves with the response. - * - * @param method - The method of the request. - * @param params - The parameters of the request. - * @returns A Promise that resolves with the response or rejects with an error. - */ - protected send(method: string, params: any[]): Promise; - /** - * Subscribes to an event. + * This method removes a listener from the provider * - * @param tag - The tag associated with the subscription. - * @param param - The parameters of the subscription. - * @param processFunc - The function to process the subscription result. - * @returns A Promise that resolves when the subscription is complete. + * @param eventName - The event to remove the listener from + * @param listener - The listener to remove + * @returns - The provider instance */ - protected _subscribe(tag: string, param: Array, processFunc: (result: any) => void): Promise; + off(eventName: string | symbol, listener: (...args: any[]) => void): this; /** - * Starts listening to an event. + * This methods returns all the listeners for a given event * - * @param event - The event to start listening to. + * @param eventName - The event to get the listeners for + * @returns - An array of listeners */ - protected _startEvent(event: Event): void; + listeners(eventName: string | symbol): Function[]; /** - * Stops listening to an event. + * Returns the number of listeners for the specified event name. * - * @param event - The event to stop listening to. + * @param eventName - The name of the event. + * @param listener - (Optional) The listener function. + * @returns The number of listeners for the specified event name. */ - protected _stopEvent(event: Event): void; + listenerCount(eventName: string | symbol, listener?: Function): number; /** - * Disconnects the WebSocket connection. + * Removes all event listeners for the specified event or all events. * - * @returns A Promise that resolves when the disconnect operation is complete. + * @param event - The event to remove listeners for. If not specified, all listeners for all events will be removed. + * @returns The instance of the class with all listeners removed. */ - disconnect(): Promise; + removeAllListeners(event?: string | symbol): this; } +export {}; //# sourceMappingURL=websocket-provider.d.ts.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-provider.d.ts.map b/packages/js-moi-providers/lib.esm/websocket-provider.d.ts.map index 88841c0a..46e25d6f 100644 --- a/packages/js-moi-providers/lib.esm/websocket-provider.d.ts.map +++ b/packages/js-moi-providers/lib.esm/websocket-provider.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"websocket-provider.d.ts","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,MAAM,SAAS,CAAC;AAE5B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAK7D;;GAEG;AACH,oBAAY,eAAe;IACvB,SAAS,cAAc;IACvB,cAAc,mBAAmB;IACjC,oBAAoB,yBAAyB;IAC7C,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,UAAU;CAClB;AAED;;;GAGG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;IAClD,OAAO,CAAC,YAAY,CAA+B;IACnD,OAAO,C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AAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI;IA8DrM,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,IAAI;IAC1E,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI;IACpG,cAAc,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,iBAAiB,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,SAAS,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,CAAC,SAAS,OAAO,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,KAAK,GAAG,KAAK,GAAG,IAAI;IA0B/M;;;;;;OAMG;IACH,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAIzE;;;;;OAKG;IACH,SAAS,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,EAAE;IAIpD;;;;;;OAMG;IACH,aAAa,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM;IAIzE;;;;;OAKG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAGpD"} \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-provider.js b/packages/js-moi-providers/lib.esm/websocket-provider.js index 07b0d8f7..e70810f8 100644 --- a/packages/js-moi-providers/lib.esm/websocket-provider.js +++ b/packages/js-moi-providers/lib.esm/websocket-provider.js @@ -1,435 +1,315 @@ -import { ErrorCode, ErrorUtils, defineReadOnly } from "js-moi-utils"; -import { w3cwebsocket as WsConn } from "websocket"; -import { JsonRpcProvider } from "./jsonrpc-provider"; -import * as errors from "./errors"; -let nextReqId = 1; -/** - * Enum defining the WebSocket events. - */ -export var WebSocketEvents; -(function (WebSocketEvents) { - WebSocketEvents["TESSERACT"] = "tesseract"; - WebSocketEvents["ALL_TESSERACTS"] = "all_tesseracts"; - WebSocketEvents["PENDING_INTERACTIONS"] = "pending_interactions"; - WebSocketEvents["CONNECT"] = "connect"; - WebSocketEvents["RECONNECT"] = "reconnect"; - WebSocketEvents["CLOSE"] = "close"; - WebSocketEvents["DEBUG"] = "debug"; - WebSocketEvents["ERROR"] = "error"; -})(WebSocketEvents || (WebSocketEvents = {})); -/** - * WebSocketProvider class extends the JsonRpcProvider class and provides WebSocket-based - * communication with the JSON-RPC endpoint. - */ -export class WebSocketProvider extends JsonRpcProvider { - requestQueue; - responseQueue; - connection; - wsConnOptions; - reconnecting; - reconnAttempts; - subscriptions; - subsIds; +import { randomUUID } from "crypto"; +import { ErrorCode, ErrorUtils } from "js-moi-utils"; +import { w3cwebsocket as Websocket } from "websocket"; +import { BaseProvider } from "./base-provider"; +import { WebSocketEvent } from "./websocket-events"; +const WEBSOCKET_HOST_REGEX = /^wss?:\/\/([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(:[0-9]+)?(\/.*)?$/; +export class WebsocketProvider extends BaseProvider { + ws; + reconnects = 0; + reconnectInterval; + host; + options; + subscriptions = new Map(); constructor(host, options) { - if (/^ws(s)?:\/\//i.test(host)) { - super(host); - this.subsIds = {}; - this.wsConnOptions = {}; - this.wsConnOptions.host = host; - this.wsConnOptions.timeout = options?.timeout || 1000 * 5; - this.wsConnOptions.reconnectDelay = options?.reconnectDelay || undefined; - this.wsConnOptions.reconnectOptions = Object.assign({ - auto: false, - delay: 5000, - maxAttempts: 5, - onTimeout: false - }, options?.reconnectOptions); - this.wsConnOptions.headers = options?.headers || {}; - this.wsConnOptions.protocol = options?.protocol || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - this.wsConnOptions.requestOptions = options?.requestOptions || undefined; - this.wsConnOptions.origin = options?.origin || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - this.connection = null; - this.reconnAttempts = 0; - this.requestQueue = new Map(); - this.responseQueue = new Map(); - this.subscriptions = new Map(); - this.connect(); - return; + if (!WEBSOCKET_HOST_REGEX.test(host)) { + ErrorUtils.throwArgumentError("Invalid host", "host", host); } - ErrorUtils.throwError("Invalid websocket request url!", ErrorCode.INVALID_ARGUMENT); + super(); + this.host = host; + this.options = options; + this.ws = this.createNewWebsocket(host, options); } - /** - * Establishes a WebSocket connection with the provided host. - * Creates a new WebSocket connection instance and sets up event handlers. - */ - connect = () => { - this.connection = new WsConn(this.host, this.wsConnOptions.protocol, undefined, this.wsConnOptions.headers, this.wsConnOptions.requestOptions, this.wsConnOptions.clientConfig); - this.addEventListener(); - }; - /** - * Sets up event listeners for the WebSocket connection. - */ - addEventListener = () => { - this.connection.onopen = this.onConnect.bind(this); - this.connection.onclose = this.onClose.bind(this); - this.connection.onmessage = this.onMessage.bind(this); - if (this.connection._client) { - this.connection._client.removeAllListeners("connectFailed"); - this.connection._client.on("connectFailed", this.onConnectFailed.bind(this)); + createNewWebsocket(host, options) { + const ws = new Websocket(host, options?.protocols, undefined, options?.headers ?? {}, options?.requestOptions, options?.clientConfig); + ws.onopen = () => this.handleOnConnect(); + ws.onerror = (error) => this.handleOnError(error); + ws.onclose = (event) => this.handleOnClose(event); + ws.onmessage = (message) => this.emit('message', message); + if (options?.timeout) { + setTimeout(() => { + if (ws.readyState === ws.OPEN) { + return; + } + ; + ws.close(3008, "Connection timeout"); + }, options.timeout); } - }; - /** - * Removes event listeners from the WebSocket connection. - */ - removeEventListener = () => { - this.connection.onopen = null; - this.connection.onclose = null; - this.connection.onmessage = null; - }; - /** - * Initiates a reconnection to the WebSocket server. - * If there are pending requests in the response queue, their callbacks are - * invoked with a reconnection error. - * If the maximum reconnection attempts have not been reached, it schedules - * another reconnection attempt. - * If the maximum reconnection attempts have been reached, it invokes the - * error event and clears the request queue. - */ + return ws; + } reconnect() { - this.reconnecting = true; - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - try { - this.responseQueue.delete(key); - request.callback(errors.PendingRequestsOnReconnectingError(), null); + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + if (this.options.reconnect) { + const interval = setInterval(() => { + if (this.ws.readyState === this.ws.OPEN) { + clearInterval(interval); + return; } - catch (e) { - console.error("Error encountered in reconnect: ", e); + if (this.reconnects >= this.options.reconnect.maxAttempts) { + this.emit('error', new Error('Max reconnect attempts reached')); + clearInterval(interval); + return; } - }); + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + }, this.options.reconnect.delay); } - if (!this.wsConnOptions.reconnectOptions.maxAttempts || - this.reconnAttempts < this.wsConnOptions.reconnectOptions.maxAttempts) { - setTimeout(() => { - this.reconnAttempts++; - this.removeEventListener(); - this.emit(WebSocketEvents.RECONNECT, this.reconnAttempts); - this.connect(); - }, this.wsConnOptions.reconnectOptions.delay); - return; + } + async disconnect() { + if (this.ws.readyState === this.ws.OPEN) { + this.ws.close(); } - this.emit(WebSocketEvents.ERROR, errors.MaxAttemptsReachedOnReconnectingError()); - this.reconnecting = false; - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.MaxAttemptsReachedOnReconnectingError(), null); - this.requestQueue.delete(key); + if (this.ws.readyState === this.ws.CLOSED) { + ErrorUtils.throwError("Closing on a closed connection", ErrorCode.ACTION_REJECTED); + } + if (this.ws.readyState === this.ws.CLOSING) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Close, () => { + resolve(); + }); }); } - } - /** - * Event handler triggered when the WebSocket connection is successfully established. - * Invokes pending requests in the request queue if any. - */ - onConnect = () => { - this.emit(WebSocketEvents.CONNECT, "Websocket connection established successfully!"); - this.reconnAttempts = 0; - this.reconnecting = false; - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - try { - this.sendRequest(key, request); - } - catch (error) { - request.callback(error, null); - this.requestQueue.delete(key); - } + if (this.ws.readyState === this.ws.CONNECTING) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Connect, () => { + this.ws.close(1000); + resolve(); + }); }); } - }; - /** - * Checks if the WebSocket connection has failed based on the close event. - * - * @param event The close event object. - * @returns A boolean indicating whether the connection has failed. - */ - isConnectionFailed = (event) => { - return event.code === 1006 && event.reason === "connection failed"; - }; - /** - * Method called when the WebSocket connection is closed. - * - * @param event - The close event. - */ - onClose = (event) => { - if (!this.isConnectionFailed(event)) { - this.subsIds = {}; - this.subscriptions = new Map(); - this.emit(WebSocketEvents.CLOSE, event); - if (this.wsConnOptions.reconnectOptions.auto && - (![1000, 1001].includes(event.code) || event.wasClean === false)) { + } + handleOnConnect() { + this.reconnects = 0; + this.emit('connect'); + } + handleOnError(error) { + this.emit('error', error); + } + handleOnClose(event) { + const isError = event.code !== 1000; + if (isError) { + if (this.options?.reconnect && this.reconnects < this.options.reconnect.maxAttempts) { + if (this.reconnectInterval) { + clearInterval(this.reconnectInterval); + } this.reconnect(); return; } - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); - } - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); - }); - } - this.removeEventListener(); - this.removeAllListeners(); } - }; - /** - * Method called when a message is received through the WebSocket connection. - * - * @param event - The message event. - */ - onMessage = (event) => { - const data = event.data; - const response = JSON.parse(data); - if (response.id != null) { - const id = response.id; - const request = this.responseQueue.get(id); - this.responseQueue.delete(id); - if (response.result != undefined) { - request.callback(null, response); - this.emit(WebSocketEvents.DEBUG, { - action: "response", - request: JSON.parse(request.payload), - response: response.result, - provider: this + this.emit('close'); + } + execute(method, params) { + if (this.ws.readyState !== this.ws.OPEN) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Connect, async () => { + resolve(await this.handleRpcRequest(method, params)); }); - } - else { - // TODO: handle error - let error = null; - if (response.error) { - error = new Error(response.error.message || "unknown error"); - defineReadOnly(error, "code", response.error.code || null); - defineReadOnly(error, "response", data); - } - else { - error = new Error("unknown error"); + }); + } + return this.handleRpcRequest(method, params); + } + handleRpcRequest(method, params) { + const inputParams = Array.isArray(params) ? params : [params]; + const payload = { + method: method, + params: inputParams, + jsonrpc: "2.0", + id: randomUUID(), + }; + return new Promise((resolve) => { + const handler = (message) => { + const response = JSON.parse(message.data); + if (response.id !== payload.id) { + return; } - request.callback(error, null); - this.emit(WebSocketEvents.ERROR, { - action: "response", - error: error, - request: JSON.parse(request.payload), - provider: this - }); - } + // @ts-ignore - don't want to expose the message event + this.removeListener('message', handler); + resolve({ ...response, id: 1 }); + }; + // @ts-ignore - don't want to expose the message event + this.on('message', handler); + this.ws.send(JSON.stringify(payload)); + }); + } + isSubscriptionEvent(eventName) { + const events = ['newTesseracts', 'newTesseractsByAccount', 'newLogs', 'newPendingInteractions']; + const name = typeof eventName === "string" ? eventName : eventName.event; + return events.includes(name); + } + async getSubscription(eventName) { + const sub = this.subscriptions.get(eventName); + if (sub?.subID != null) { + return await this.subscriptions.get(eventName).subID; } - else if (response.method === "moi.subscription") { - const sub = this.subscriptions[response.params.subscription]; - if (sub) { - sub.processFunc(response.params.result); - } + if (sub == null) { + const promise = super.getSubscription(eventName); + this.subscriptions.set(eventName, { subID: promise }); + return await promise; } - }; + sub.subID = super.getSubscription(eventName); + return await sub.subID; + } /** - * Method called when the WebSocket connection fails to connect. + * This method listens to events emitted by the provider for the given event * - * @param event - The connect failed event. + * @param eventName - The event to listen to this can be a string or an object + * @param listener - The callback function to be called when the event is emitted + * @returns - The provider instance */ - onConnectFailed = (event) => { - let connectFailedDescription = event.toString().split('\n')[0]; - if (connectFailedDescription) { - event.description = connectFailedDescription; - } - event.code = 1006; - event.reason = 'connection failed'; - if (this.wsConnOptions.reconnectOptions.auto && (![1000, 1001].includes(event.code) || event.wasClean === false)) { - this.reconnect(); - return; + on(eventName, listener) { + if (typeof eventName === "string") { + super.on(eventName, listener); } - this.emit(WebSocketEvents.ERROR, event); - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${randomUUID()}`; + } + super.on(_sub.uuid, listener); + } + else { + const uuid = `${eventName.event}:${randomUUID()}`; + this.subscriptions.set(eventName, { uuid }); + super.on(uuid, listener); + } } - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.subID != null) { + return this; + } + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message) => { + const data = JSON.parse(message.data); + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return; + } + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName, data.params.result)); + return; + } + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } + }); }); } - //clean connection on our own - if (this.connection._connection) { - this.connection._connection.removeAllListeners(); - } - this.connection._client.removeAllListeners(); - this.connection._readyState = 3; // set readyState to CLOSED - this.emit(WebSocketEvents.CLOSE, event); - }; + return this; + } /** - * Sends a request over the WebSocket connection. + * Adds a one-time listener function for the specified event. * - * @param requestId - The ID of the request. - * @param request - The request object. + * @param eventName - The name of the event to listen for. + * @param listener - A function to be called when the event is triggered. + * @returns The WebSocketProvider instance. */ - sendRequest(requestId, request) { - if (this.connection.readyState !== this.connection.OPEN) { - this.requestQueue.delete(requestId); - request.callback(errors.ConnectionNotOpenError(), null); - return; + once(eventName, listener) { + if (typeof eventName === "string") { + super.once(eventName, listener); } - this.responseQueue.set(requestId, request); - this.requestQueue.delete(requestId); - try { - this.connection.send(request.payload); + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${randomUUID()}`; + } + super.once(_sub.uuid, listener); + } + else { + const uuid = `${eventName.event}:${randomUUID()}`; + this.subscriptions.set(eventName, { uuid }); + super.once(uuid, listener); + } } - catch (error) { - request.callback(error, null); - this.responseQueue.delete(requestId); + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); + if (_sub?.subID != null) { + return this; + } + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message) => { + const data = JSON.parse(message.data); + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return; + } + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName, data.params.result)); + return; + } + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } + }); + }); } + return this; } /** - * Sends a request over the WebSocket connection and returns a Promise that - * resolves with the response. + * Removes a listener from the WebSocket provider. * - * @param method - The method of the request. - * @param params - The parameters of the request. - * @returns A Promise that resolves with the response or rejects with an error. + * @param eventName - The name of the event or an object representing a subscription. + * @param listener - The listener function to be removed. + * @returns The WebSocket provider instance. */ - send(method, params) { - return new Promise((resolve, reject) => { - const callback = (error, result) => { - if (error) { - return reject(error); - } - return resolve(result); - }; - const requestId = nextReqId++; - const payload = { - method: method, - params: params, - id: requestId, - jsonrpc: "2.0" - }; - const request = { - payload: JSON.stringify(payload), - callback: callback - }; - if (this.connection.readyState === this.connection.CONNECTING || this.reconnecting) { - this.requestQueue.set(requestId, request); - return; + removeListener(eventName, listener) { + if (typeof eventName === "string") { + super.removeListener(eventName, listener); + } + if (typeof eventName === "object") { + const _sub = this.subscriptions.get(eventName); + if (_sub?.uuid == null) { + return this; } - this.sendRequest(requestId, request); - }); + super.removeListener(_sub.uuid, listener); + this.subscriptions.delete(eventName); + } + return this; } /** - * Subscribes to an event. + * This method removes a listener from the provider * - * @param tag - The tag associated with the subscription. - * @param param - The parameters of the subscription. - * @param processFunc - The function to process the subscription result. - * @returns A Promise that resolves when the subscription is complete. + * @param eventName - The event to remove the listener from + * @param listener - The listener to remove + * @returns - The provider instance */ - async _subscribe(tag, param, processFunc) { - let subIdPromise = this.subsIds[tag]; - if (subIdPromise == null) { - subIdPromise = Promise.all(param).then(async (param) => { - const response = await this.send("moi.subscribe", param); - return response.result; - }); - this.subsIds[tag] = subIdPromise; - } - const subId = await subIdPromise; - this.subscriptions[subId] = { tag, processFunc }; + off(eventName, listener) { + return super.off(eventName, listener); } /** - * Starts listening to an event. + * This methods returns all the listeners for a given event * - * @param event - The event to start listening to. + * @param eventName - The event to get the listeners for + * @returns - An array of listeners */ - _startEvent(event) { - switch (event.type) { - case WebSocketEvents.TESSERACT: - const params = { - address: event.address - }; - this._subscribe(event.tag, ["newAccountTesseracts", params], (result) => { - this.emit(event.address, result); - }); - break; - case WebSocketEvents.ALL_TESSERACTS: - this._subscribe("all_tesseracts", ["newTesseracts"], (result) => { - this.emit(WebSocketEvents.ALL_TESSERACTS, result); - }); - break; - case WebSocketEvents.PENDING_INTERACTIONS: - this._subscribe("pending_interactions", ["newPendingInteractions"], (result) => { - this.emit(WebSocketEvents.PENDING_INTERACTIONS, result); - }); - break; - case WebSocketEvents.CONNECT: - case WebSocketEvents.RECONNECT: - case WebSocketEvents.CLOSE: - case WebSocketEvents.DEBUG: - case WebSocketEvents.ERROR: - break; - default: - console.log("unhandled:", event); - break; - } + listeners(eventName) { + return super.listeners(eventName); } /** - * Stops listening to an event. + * Returns the number of listeners for the specified event name. * - * @param event - The event to stop listening to. + * @param eventName - The name of the event. + * @param listener - (Optional) The listener function. + * @returns The number of listeners for the specified event name. */ - _stopEvent(event) { - let tag = event.tag; - if (this.listenerCount(event.event)) { - // There are remaining event listeners - return; - } - const subId = this.subsIds[tag]; - if (!subId) { - return; - } - delete this.subsIds[tag]; - subId.then((subId) => { - if (!this.subscriptions[subId]) { - return; - } - delete this.subscriptions[subId]; - this.send("moi.unsubscribe", [subId]); - }); + listenerCount(eventName, listener) { + return super.listenerCount(eventName, listener); } /** - * Disconnects the WebSocket connection. + * Removes all event listeners for the specified event or all events. * - * @returns A Promise that resolves when the disconnect operation is complete. + * @param event - The event to remove listeners for. If not specified, all listeners for all events will be removed. + * @returns The instance of the class with all listeners removed. */ - async disconnect() { - // Wait until we have connected before trying to disconnect - if (this.connection.readyState === this.connection.CONNECTING) { - await (new Promise((resolve) => { - this.connection.onopen = () => { - resolve(true); - }; - this.connection.onerror = () => { - resolve(false); - }; - })); - } - // Hangup - // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes - this.connection.close(1000); + removeAllListeners(event) { + return super.removeAllListeners(event); } } //# sourceMappingURL=websocket-provider.js.map \ No newline at end of file diff --git a/packages/js-moi-providers/lib.esm/websocket-provider.js.map b/packages/js-moi-providers/lib.esm/websocket-provider.js.map index e6b2bcd0..1d208ad6 100644 --- a/packages/js-moi-providers/lib.esm/websocket-provider.js.map +++ b/packages/js-moi-providers/lib.esm/websocket-provider.js.map @@ -1 +1 @@ -{"version":3,"file":"websocket-provider.js","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,YAAY,IAAI,MAAM,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAEnD,OAAO,KAAK,MAAM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AAE,CAAC;YAC5D,MAAM,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;gBAC3B,IAAI,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,EAAE;oBAC1B,OAAO,CAAC,IAAI,CAAC,CAAC;gBAClB,CAAC,CAAC;gBAEF,IAAI,CAAC,UAAU,CAAC,OAAO,GAAG,GAAG,EAAE;oBAC3B,OAAO,CAAC,KAAK,CAAC,CAAC;gBACnB,CAAC,CAAC;YACN,CAAC,CAAC,CAAC,CAAC;QACR,CAAC;QAED,SAAS;QACT,gFAAgF;QAChF,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;CACJ"} \ No newline at end of file +{"version":3,"file":"websocket-provider.js","sourceRoot":"","sources":["../src.ts/websocket-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,YAAY,IAAI,SAAS,EAAoB,MAAM,WAAW,CAAC;AAGxE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAgBpD,MAAM,oBAAoB,GAAG,6DAA6D,CAAC;AAE3F,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IACvC,EAAE,CAAY;IACd,UAAU,GAAG,CAAC,CAAC;IACf,iBAAiB,CAAkB;IAC1B,IAAI,CAAS;IACb,OAAO,CAAuB;IAC9B,aAAa,GAAoE,IAAI,GAAG,EAAE,CAAC;IAE5G,YAAY,IAAY,EAAE,OAA6B;QACnD,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,UAAU,CAAC,kBAAkB,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QAChE,CAAC;QAED,KAA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SAA0B,EAAE,QAAkC;QAC9D,OAAO,KAAK,CAAC,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;OAKG;IACH,SAAS,CAAI,SAA0B;QACnC,OAAO,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAI,SAA0B,EAAE,QAAmB;QAC5D,OAAO,KAAK,CAAC,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACpD,CAAC;IAED;;;;;OAKG;IACH,kBAAkB,CAAC,KAAuB;QACtC,OAAO,KAAK,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-providers/package.json b/packages/js-moi-providers/package.json index 4b63d661..d218c696 100644 --- a/packages/js-moi-providers/package.json +++ b/packages/js-moi-providers/package.json @@ -23,9 +23,14 @@ "author": "Sarva Labs Inc. & MOI Protocol Developers", "license": "Apache-2.0 OR MIT", "dependencies": { - "js-moi-utils": "^0.4.1", - "js-moi-manifest": "^0.4.1", "cross-fetch": "^4.0.0", - "websocket": "^1.0.34" + "events": "npm:events@^3.3.0", + "js-moi-manifest": "^0.4.1", + "crypto": "npm:crypto-browserify", + "js-moi-utils": "^0.4.1", + "websocket": "^1.0.35" + }, + "devDependencies": { + "@types/websocket": "^1.0.10" } -} \ No newline at end of file +} diff --git a/packages/js-moi-providers/src.ts/abstract-provider.ts b/packages/js-moi-providers/src.ts/abstract-provider.ts index 20002f25..23cc2ab9 100644 --- a/packages/js-moi-providers/src.ts/abstract-provider.ts +++ b/packages/js-moi-providers/src.ts/abstract-provider.ts @@ -1,6 +1,6 @@ +import { EventEmitter } from "events"; import { LogicManifest } from "js-moi-manifest"; import { Interaction, Tesseract } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; import { AccountMetaInfo, AccountState, @@ -25,12 +25,15 @@ import { type Log, type LogFilter } from "../types/jsonrpc"; +import { type ProviderEvents } from "../types/websocket"; + + /** * Abstract class representing a provider for interacting with the MOI protocol. * Provides methods for account operations, execution, and querying. */ -export abstract class AbstractProvider { +export abstract class AbstractProvider extends EventEmitter { // Account Methods abstract getBalance(address: string, assetId: string, options?: Options): Promise abstract getContextInfo(address: string, options?: Options): Promise @@ -78,39 +81,6 @@ export abstract class AbstractProvider { abstract getFilterChanges(filter: Filter): Promise abstract removeFilter(filter: Filter): Promise abstract getLogsFilter(filter: LogFilter): Promise - abstract getLogs(filter: LogFilter): Promise - - // Event Emitter (ish) - abstract on(eventName: EventType, listener: Listener): AbstractProvider; - abstract once(eventName: EventType, listener: Listener): AbstractProvider; - abstract listenerCount(eventName?: EventType): number; - abstract listeners(eventName?: EventType): Array; - abstract off(eventName: EventType, listener?: Listener): AbstractProvider; - abstract removeAllListeners(eventName?: EventType): AbstractProvider; - - // Alias for "on" - - /** - * Alias for "on" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be called when the event is emitted. - * @returns The provider instance for chaining. - */ - addListener(eventName: EventType, listener: Listener): AbstractProvider { - return this.on(eventName, listener); - } - - // Alias for "off" - - /** - * Alias for "off" method. - * - * @param eventName - The name of the event. - * @param listener - The listener function to be unregistered. - * @returns The provider instance for chaining. - */ - removeListener(eventName: EventType, listener: Listener): AbstractProvider { - return this.off(eventName, listener); - } -} + abstract getLogs(filter: LogFilter): Promise; + abstract getSubscription(event: ProviderEvents) : Promise; +} \ No newline at end of file diff --git a/packages/js-moi-providers/src.ts/base-provider.ts b/packages/js-moi-providers/src.ts/base-provider.ts index 6e49d7b8..904d7033 100644 --- a/packages/js-moi-providers/src.ts/base-provider.ts +++ b/packages/js-moi-providers/src.ts/base-provider.ts @@ -6,23 +6,24 @@ import { LogicInvokeReceipt, Tesseract, bytesToHex, decodeBase64, - hexDataLength, hexToBN, hexToBytes, isValidAddress, toQuantity, topicHash, unmarshal, type NumberLike + encodeToString, + hexToBN, hexToBytes, isValidAddress, toQuantity, topicHash, unmarshal, type NumberLike } from "js-moi-utils"; -import { EventType, Listener } from "../types/event"; -import { +import type { AccountMetaInfo, AccountMetaInfoParams, AccountParamsBase, AccountState, AccountStateParams, AssetInfo, AssetInfoParams, BalanceParams, CallorEstimateIxObject, CallorEstimateOptions, Content, ContentFrom, ContentFromResponse, ContentResponse, ContextInfo, Encoding, Filter, FilterDeletionResult, Inspect, InspectResponse, InteractionCallResponse, InteractionParams, InteractionReceipt, - InteractionRequest, InteractionResponse, LogicManifestParams, NodeInfo, Options, Registry, - RpcResponse, Status, StatusResponse, StorageParams, SyncStatus, SyncStatusParams, TDU, TDUResponse, - type Log, - type LogFilter + InteractionRequest, InteractionResponse, + Log, LogFilter, + LogicManifestParams, NodeInfo, Options, + Registry, + RpcResponse, Status, StatusResponse, StorageParams, SyncStatus, SyncStatusParams, TDU, TDUResponse } from "../types/jsonrpc"; import { type NestedArray } from "../types/util"; +import type { ProviderEvents } from "../types/websocket"; import { AbstractProvider } from "./abstract-provider"; -import Event from "./event"; import { processIxObject } from "./interaction"; // Default timeout value in seconds @@ -32,18 +33,19 @@ const defaultOptions: Options = { tesseract_number: -1 } +export interface EventTag { + event: string; + params?: unknown; +}; + /** * Class representing a base provider for interacting with the MOI protocol. * Extends the AbstractProvider class and provides implementations for * account operations, execution, and querying RPC methods. */ export class BaseProvider extends AbstractProvider { - protected _events: Event[]; - constructor() { super(); - // Events being listened to - this._events = []; } /** @@ -967,7 +969,7 @@ export class BaseProvider extends AbstractProvider { const response = await this.execute("moi.GetLogs", payload); return this.processResponse(response).map((log) => ({ ...log, - data: "0x" + bytesToHex(decodeBase64(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged + data: encodeToString(decodeBase64(log.data)), // FIXME: remove this once PR (https://github.com/sarvalabs/go-moi/pull/1023) is merged })); } @@ -1131,6 +1133,46 @@ export class BaseProvider extends AbstractProvider { } } + public async getSubscription(event: ProviderEvents): Promise { + let params: unknown = []; + + if (typeof event === "string") { + params = event; + } + + if (typeof event === "object") { + params = this.validateAndFormatEvent(event); + + } + + const response = await this.execute("moi.subscribe", params); + return this.processResponse(response); + } + + private validateAndFormatEvent(event: { event: string; params: any; }) { + if (!isValidAddress(event.params.address)) { + ErrorUtils.throwArgumentError("Invalid address provided", "event.params.address", event.params); + } + + if (event.event === 'newTesseractsByAccount') { + return [event.event, { address: event.params.address }]; + } + + if (event.event === 'newLogs') { + if (event.params.topics == null) { + event.params.topics = []; + } + + if (Array.isArray(event.params.topics) === false) { + ErrorUtils.throwArgumentError("Topics should be an array", "event.params.topics", event.params.topics); + } + + return [event.event, { address: event.params.address, topics: this.hashTopics(event.params.topics), start_height: event.params.height[0], end_height: event.params.height[1] }]; + } + + throw ErrorUtils.throwError("Invalid event type", ErrorCode.INVALID_ARGUMENT); + } + /** * Waits for the interaction with the specified hash to be included in a tesseract * and returns the interaction receipt. @@ -1242,6 +1284,31 @@ export class BaseProvider extends AbstractProvider { } } + protected processWsResult(event: ProviderEvents, result: unknown): unknown { + if (event === 'newPendingInteractions') { + if (typeof result === "string") { + return result.startsWith("0x") ? result : `0x${result}`; + } + + ErrorUtils.throwError("Invalid response received", ErrorCode.SERVER_ERROR); + } + + if (typeof event === "string" && ["newTesseracts"].includes(event)) { + return result; + } + + if (typeof event === "object" && event.event === "newTesseractsByAccount") { + return result; + } + + if (typeof event === "object" && event.event === "newLogs") { + const log = result as Log; + return { ...log, data: encodeToString(decodeBase64(log.data)) }; + } + + ErrorUtils.throwArgumentError("Invalid event type", "event", event); + } + /** * Waits for the interaction with the specified hash to be included in a * tesseract and returns the result based on the interaction type. @@ -1278,214 +1345,5 @@ export class BaseProvider extends AbstractProvider { */ protected execute(method: string, params: any): Promise> { throw new Error(method + " not implemented") - } - - /** - * Starts the specified event by performing necessary actions. - * - * @param {Event} event - The event to start. - */ - protected _startEvent(event: Event): void { - } - - /** - * Stops the specified event by performing necessary actions. - * - * @param {Event} event - The event to stop. - */ - protected _stopEvent(event: Event): void { - } - - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @param {boolean} once - Indicates whether the listener should be called - * only once (true) or multiple times (false). - * @returns The instance of the class to allow method chaining. - */ - protected _addEventListener(eventName: EventType, listener: Listener, once: boolean): this { - const event = new Event(getEventTag(eventName), listener, once) - this._events.push(event); - this._startEvent(event); - - return this; - } - - /** - * Emits the specified event and calls all the associated listeners. - * - * @param {EventType} eventName - The name of the event to emit. - * @param {Array} args - The arguments to be passed to the event listeners. - * @returns {boolean} A boolean indicating whether any listeners were called - * for the event. - */ - protected emit(eventName: EventType, ...args: Array): boolean { - let result = false; - - let stopped: Array = [ ]; - - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { return true; } - - setTimeout(() => { - event.listener.apply(this, args); - }, 0); - - result = true; - - if (event.once) { - stopped.push(event); - return false; - } - - return true; - }); - - stopped.forEach((event) => { this._stopEvent(event); }); - - return result; - } - - /** - * Adds an event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the event is emitted. - * @returns The instance of the class to allow method chaining. - */ - public on(eventName: EventType, listener: Listener): this { - return this._addEventListener(eventName, listener, false); - } - - /** - * Adds a one-time event listener for the specified event. - * - * @param {EventType} eventName - The name of the event to listen to. - * @param {Listener} listener - The listener function to be called when the - * event is emitted. - * @returns The instance of the class to allow method chaining. - */ - public once(eventName: EventType, listener: Listener): this { - return this._addEventListener(eventName, listener, true); - } - - /** - * Returns the number of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns {number} The number of listeners for the event. - */ - public listenerCount(eventName?: EventType): number { - if (!eventName) { return this._events.length; } - - let eventTag = getEventTag(eventName); - return this._events.filter((event) => { - return (event.tag === eventTag); - }).length; - } - - /** - * Returns an array of listeners for the specified event. - * - * @param {EventType} eventName - The name of the event. - * @returns An array of listeners for the event. - */ - public listeners(eventName?: EventType): Array { - if (eventName == null) { - return this._events.map((event) => event.listener); - } - - let eventTag = getEventTag(eventName); - return this._events - .filter((event) => (event.tag === eventTag)) - .map((event) => event.listener); - } - - /** - * Removes an event listener for the specified event. If no listener is - * specified, removes all listeners for the event. - * - * @param {EventType} eventName - The name of the event to remove the - * listener from. - * @param {Listener} listener - The listener function to remove. If not - * provided, removes all listeners for the event. - * @returns The instance of the class to allow method chaining. - */ - public off(eventName: EventType, listener?: Listener): this { - if (listener == null) { - return this.removeAllListeners(eventName); - } - - const stopped: Array = [ ]; - - let found = false; - let eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag || event.listener != listener) { return true; } - if (found) { return true; } - found = true; - stopped.push(event); - return false; - }); - - stopped.forEach((event) => { this._stopEvent(event); }); - - return this; - } - - /** - * Removes all listeners for the specified event. If no event is specified, - * removes all listeners for all events. - * - * @param {EventType} eventName - The name of the event to remove all - * listeners from. - * @returns The instance of the class to allow method chaining. - */ - public removeAllListeners(eventName?: EventType): this { - let stopped: Array = [ ]; - if (eventName == null) { - stopped = this._events; - - this._events = [ ]; - } else { - const eventTag = getEventTag(eventName); - this._events = this._events.filter((event) => { - if (event.tag !== eventTag) { return true; } - stopped.push(event); - return false; - }); - } - - stopped.forEach((event) => { this._stopEvent(event); }); - - return this; - } -} - -// helper functions -/** - * Retrieves the event tag based on the event name. - * - * @param {EventType} eventName - The name of the event. - * @returns {string} The event tag. - * @throws {Error} if the event name is invalid. - */ -const getEventTag = (eventName: EventType): string => { - if (typeof(eventName) === "string") { - eventName = eventName.toLowerCase(); - - if (hexDataLength(eventName) === 32) { - return "tesseract:" + eventName; - } - - if (eventName.indexOf(":") === -1) { - return eventName; - } - } - - throw new Error("invalid event - " + eventName); + } } diff --git a/packages/js-moi-providers/src.ts/event.ts b/packages/js-moi-providers/src.ts/event.ts deleted file mode 100644 index 2ba684d0..00000000 --- a/packages/js-moi-providers/src.ts/event.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { EventType, Listener } from "../types/event"; -import { defineReadOnly } from "js-moi-utils"; - -// List of events that can be polled -const PollableEvents = [ "all_tesseracts", "tesseract" ]; - -export default class Event { - readonly listener: Listener; - readonly once: boolean; - readonly tag: string; - - constructor(tag: string, listener: Listener, once: boolean) { - defineReadOnly(this, "tag", tag); - defineReadOnly(this, "listener", listener); - defineReadOnly(this, "once", once); - } - - /** - * Returns the name of the event. - * @returns The event name. - */ - get event(): EventType { - switch (this.type) { - case "tesseract": - return this.address; - } - - return this.tag; - } - - /** - * Returns the type of the event. - * @returns The event type. - */ - get type(): string { - return this.tag.split(":")[0] - } - - /** - * Returns the address from the tesseract event. - * @returns The address form tesseract. - */ - get address(): string { - const comps = this.tag.split(":"); - if (comps[0] !== "tesseract") { return null; } - return comps[1]; - } - - /** - * Checks if the event is pollable. - * @returns True if the event is pollable, false otherwise. - */ - pollable(): boolean { - return (this.tag.indexOf(":") >= 0 || PollableEvents.indexOf(this.tag) >= 0); - } -} diff --git a/packages/js-moi-providers/src.ts/index.ts b/packages/js-moi-providers/src.ts/index.ts index cd104ef1..1ee010bb 100644 --- a/packages/js-moi-providers/src.ts/index.ts +++ b/packages/js-moi-providers/src.ts/index.ts @@ -1,8 +1,10 @@ +export type * from "../types/event"; +export type * from "../types/jsonrpc"; +export type * from "../types/provider"; export * from "./abstract-provider"; export * from "./base-provider"; export * from "./jsonrpc-provider"; export * from "./voyage-provider"; -export * from "./websocket-provider"; -export type * from "../types/jsonrpc"; -export type * from "../types/event"; -export type * from "../types/provider"; +export { WebSocketEvent } from "./websocket-events"; +export { WebsocketProvider } from "./websocket-provider"; + diff --git a/packages/js-moi-providers/src.ts/jsonrpc-provider.ts b/packages/js-moi-providers/src.ts/jsonrpc-provider.ts index 26b83a65..d18ec9d1 100644 --- a/packages/js-moi-providers/src.ts/jsonrpc-provider.ts +++ b/packages/js-moi-providers/src.ts/jsonrpc-provider.ts @@ -1,8 +1,7 @@ import fetch from "cross-fetch"; import { CustomError, ErrorCode, ErrorUtils } from "js-moi-utils"; -import { BaseProvider } from "./base-provider"; -import Event from "./event"; import { RpcResponse } from "../types/jsonrpc"; +import { BaseProvider } from "./base-provider"; /** * A class that represents a JSON-RPC provider for making RPC calls over HTTP. @@ -88,22 +87,4 @@ export class JsonRpcProvider extends BaseProvider { ) } } - - /** - * Starts an event. - * - * @param event - The event to start. - */ - protected _startEvent(event: Event): void { - super._startEvent(event); - } - - /** - * Stops an event. - * - * @param event - The event to stop. - */ - protected _stopEvent(event: Event): void { - super._stopEvent(event); - } } diff --git a/packages/js-moi-providers/src.ts/websocket-events.ts b/packages/js-moi-providers/src.ts/websocket-events.ts new file mode 100644 index 00000000..303fa1c3 --- /dev/null +++ b/packages/js-moi-providers/src.ts/websocket-events.ts @@ -0,0 +1,17 @@ +export enum WebSocketEvent { + Close = "close", + + Connect = "connect", + + Error = "error", + + Reconnect = "reconnect", + + NewTesseracts = "newTesseracts", + + NewPendingInteractions = "newPendingInteractions", + + NewLog = "newLog", + + NewTesseractsByAccount = "newTesseractsByAccount", +} \ No newline at end of file diff --git a/packages/js-moi-providers/src.ts/websocket-provider.ts b/packages/js-moi-providers/src.ts/websocket-provider.ts index 431c8df5..36c56d04 100644 --- a/packages/js-moi-providers/src.ts/websocket-provider.ts +++ b/packages/js-moi-providers/src.ts/websocket-provider.ts @@ -1,510 +1,403 @@ -import { ErrorCode, ErrorUtils, defineReadOnly } from "js-moi-utils"; -import { w3cwebsocket as WsConn } from "websocket"; -import {JsonRpcProvider} from "./jsonrpc-provider"; -import Event from "./event"; -import * as errors from "./errors"; -import { WebsocketProviderOptions } from "../types/provider"; -import { InflightRequest, TesseractParams, Subscription } from "../types/websocket"; - -let nextReqId = 1; - -/** - * Enum defining the WebSocket events. - */ -export enum WebSocketEvents { - TESSERACT = 'tesseract', - ALL_TESSERACTS = 'all_tesseracts', - PENDING_INTERACTIONS = 'pending_interactions', - CONNECT = "connect", - RECONNECT = 'reconnect', - CLOSE = 'close', - DEBUG = 'debug', - ERROR = 'error', +import { randomUUID } from "crypto"; +import { ErrorCode, ErrorUtils, type Tesseract } from "js-moi-utils"; +import { w3cwebsocket as Websocket, type ICloseEvent } from "websocket"; +import type { Log, RpcResponse } from "../types/jsonrpc"; +import type { NewLogs, NewTesseractsByAccount, ProviderEvents, WebsocketEventMap } from "../types/websocket"; +import { BaseProvider } from "./base-provider"; +import { WebSocketEvent } from "./websocket-events"; + +type TypeOfWebsocketConst = ConstructorParameters; + +interface WebsocketConnection { + protocols?: TypeOfWebsocketConst[1]; + headers?: TypeOfWebsocketConst[3]; + requestOptions?: TypeOfWebsocketConst[4]; + clientConfig?: TypeOfWebsocketConst[5]; + reconnect?: { + delay: number; + maxAttempts: number; + } + timeout?: number; } -/** - * WebSocketProvider class extends the JsonRpcProvider class and provides WebSocket-based - * communication with the JSON-RPC endpoint. - */ -export class WebSocketProvider extends JsonRpcProvider { - private requestQueue: Map; - private responseQueue: Map; - private connection: any; - private wsConnOptions: WebsocketProviderOptions; - private reconnecting: boolean; - private reconnAttempts: number; - private subscriptions: Map; - private subsIds: { [ tag: string ]: Promise }; - - constructor(host: string, options?: WebsocketProviderOptions) { - if(/^ws(s)?:\/\//i.test(host)) { - super(host) - this.subsIds = {} - this.wsConnOptions = {} - this.wsConnOptions.host = host - this.wsConnOptions.timeout = options?.timeout || 1000 * 5; - this.wsConnOptions.reconnectDelay = options?.reconnectDelay || undefined; - this.wsConnOptions.reconnectOptions = Object.assign({ - auto: false, - delay: 5000, - maxAttempts: 5, - onTimeout: false - }, options?.reconnectOptions); - this.wsConnOptions.headers = options?.headers || {}; - this.wsConnOptions.protocol = options?.protocol || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - this.wsConnOptions.requestOptions = options?.requestOptions || undefined; - this.wsConnOptions.origin = options?.origin || undefined; - this.wsConnOptions.clientConfig = options?.clientConfig || undefined; - - this.connection = null; - this.reconnAttempts = 0; - this.requestQueue = new Map() - this.responseQueue = new Map() - this.subscriptions = new Map() - - this.connect() - - return; +const WEBSOCKET_HOST_REGEX = /^wss?:\/\/([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+(:[0-9]+)?(\/.*)?$/; + +export class WebsocketProvider extends BaseProvider { + private ws: Websocket; + private reconnects = 0; + private reconnectInterval?: NodeJS.Timeout; + private readonly host: string; + private readonly options?: WebsocketConnection; + private readonly subscriptions: Map, uuid?: string }> = new Map(); + + constructor(host: string, options?: WebsocketConnection) { + if (!WEBSOCKET_HOST_REGEX.test(host)) { + ErrorUtils.throwArgumentError("Invalid host", "host", host); } - ErrorUtils.throwError( - "Invalid websocket request url!", - ErrorCode.INVALID_ARGUMENT - ); + super(); + this.host = host; + this.options = options; + this.ws = this.createNewWebsocket(host, options); } - /** - * Establishes a WebSocket connection with the provided host. - * Creates a new WebSocket connection instance and sets up event handlers. - */ - private connect = () => { - this.connection = new WsConn( - this.host, - this.wsConnOptions.protocol, - undefined, - this.wsConnOptions.headers, - this.wsConnOptions.requestOptions, - this.wsConnOptions.clientConfig - ); - - this.addEventListener(); - } + private createNewWebsocket(host: string, options?: WebsocketConnection): Websocket { + const ws = new Websocket(host, options?.protocols, undefined, options?.headers ?? {}, options?.requestOptions, options?.clientConfig); - /** - * Sets up event listeners for the WebSocket connection. - */ - private addEventListener = () => { - this.connection.onopen = this.onConnect.bind(this) - this.connection.onclose = this.onClose.bind(this) - this.connection.onmessage = this.onMessage.bind(this) + ws.onopen = () => this.handleOnConnect(); + ws.onerror = (error) => this.handleOnError(error); + ws.onclose = (event) => this.handleOnClose(event); + ws.onmessage = (message) => this.emit('message', message); - if(this.connection._client) { - this.connection._client.removeAllListeners("connectFailed") + if (options?.timeout) { + setTimeout(() => { + if (ws.readyState === ws.OPEN) { + return; + }; - this.connection._client.on("connectFailed", this.onConnectFailed.bind(this)) + ws.close(3008, "Connection timeout"); + }, options.timeout); } - } - /** - * Removes event listeners from the WebSocket connection. - */ - private removeEventListener = () => { - this.connection.onopen = null; - this.connection.onclose = null; - this.connection.onmessage = null; + return ws; } - /** - * Initiates a reconnection to the WebSocket server. - * If there are pending requests in the response queue, their callbacks are - * invoked with a reconnection error. - * If the maximum reconnection attempts have not been reached, it schedules - * another reconnection attempt. - * If the maximum reconnection attempts have been reached, it invokes the - * error event and clears the request queue. - */ private reconnect(): void { - this.reconnecting = true; - - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - try{ - this.responseQueue.delete(key); - request.callback(errors.PendingRequestsOnReconnectingError(), null) - } catch (e) { - console.error("Error encountered in reconnect: ", e) + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + + if (this.options.reconnect) { + const interval = setInterval(() => { + if (this.ws.readyState === this.ws.OPEN) { + clearInterval(interval); + return; } - }); + + if (this.reconnects >= this.options.reconnect.maxAttempts) { + this.emit('error', new Error('Max reconnect attempts reached')); + clearInterval(interval); + return; + } + + this.reconnects++; + this.ws = this.createNewWebsocket(this.host, this.options); + this.emit('reconnect', this.reconnects); + }, this.options.reconnect.delay); } - - if ( - !this.wsConnOptions.reconnectOptions.maxAttempts || - this.reconnAttempts < this.wsConnOptions.reconnectOptions.maxAttempts - ) { - setTimeout(() => { - this.reconnAttempts++; - this.removeEventListener(); - this.emit(WebSocketEvents.RECONNECT, this.reconnAttempts); - this.connect(); - }, this.wsConnOptions.reconnectOptions.delay); - - return; + } + + public async disconnect(): Promise { + if (this.ws.readyState === this.ws.OPEN) { + this.ws.close(); + } + + if (this.ws.readyState === this.ws.CLOSED) { + ErrorUtils.throwError("Closing on a closed connection", ErrorCode.ACTION_REJECTED); } - - this.emit(WebSocketEvents.ERROR, errors.MaxAttemptsReachedOnReconnectingError()); - this.reconnecting = false; - - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.MaxAttemptsReachedOnReconnectingError(), null); - this.requestQueue.delete(key); + + if (this.ws.readyState === this.ws.CLOSING) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Close, () => { + resolve(); + }); }); } - } - /** - * Event handler triggered when the WebSocket connection is successfully established. - * Invokes pending requests in the request queue if any. - */ - private onConnect = () => { - this.emit(WebSocketEvents.CONNECT, "Websocket connection established successfully!"); - this.reconnAttempts = 0; - this.reconnecting = false; - - if(this.requestQueue.size > 0) { - this.requestQueue.forEach((request: any, key) => { - try { - this.sendRequest(key, request); - } catch (error) { - request.callback(error, null); - this.requestQueue.delete(key); - } - }) + if (this.ws.readyState === this.ws.CONNECTING) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Connect, () => { + this.ws.close(1000); + resolve(); + }); + }); } } - /** - * Checks if the WebSocket connection has failed based on the close event. - * - * @param event The close event object. - * @returns A boolean indicating whether the connection has failed. - */ - private isConnectionFailed = (event) => { - return event.code === 1006 && event.reason === "connection failed"; + private handleOnConnect(): void { + this.reconnects = 0; + this.emit('connect'); } - /** - * Method called when the WebSocket connection is closed. - * - * @param event - The close event. - */ - private onClose = (event) => { - if(!this.isConnectionFailed(event)) { - this.subsIds = {}; - this.subscriptions = new Map(); - this.emit(WebSocketEvents.CLOSE, event); - - if(this.wsConnOptions.reconnectOptions.auto && - (![1000, 1001].includes(event.code) || event.wasClean === false)) { + private handleOnError(error: Error): void { + this.emit('error', error); + } + + private handleOnClose(event: ICloseEvent): void { + const isError = event.code !== 1000; + + if (isError) { + if (this.options?.reconnect && this.reconnects < this.options.reconnect.maxAttempts) { + if (this.reconnectInterval) { + clearInterval(this.reconnectInterval); + } + this.reconnect(); - return; } - - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); - } - - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); - }); - } - - this.removeEventListener(); - this.removeAllListeners(); } + + this.emit('close'); } - /** - * Method called when a message is received through the WebSocket connection. - * - * @param event - The message event. - */ - private onMessage = (event: { data: string }) => { - const data:any = event.data; - const response = JSON.parse(data); - - if(response.id != null) { - const id = response.id - const request = this.responseQueue.get(id) - this.responseQueue.delete(id); - - if(response.result != undefined) { - request.callback(null, response); - - this.emit(WebSocketEvents.DEBUG, { - action: "response", - request: JSON.parse(request.payload), - response: response.result, - provider: this + protected execute(method: string, params: any): Promise> { + if (this.ws.readyState !== this.ws.OPEN) { + return new Promise((resolve) => { + this.once(WebSocketEvent.Connect, async () => { + resolve(await this.handleRpcRequest(method, params)); }); - } else { - // TODO: handle error - let error: Error = null; - if (response.error) { - error = new Error(response.error.message || "unknown error"); - defineReadOnly(error, "code", response.error.code || null); - defineReadOnly(error, "response", data); - } else { - error = new Error("unknown error"); + }); + } + + return this.handleRpcRequest(method, params); + } + + private handleRpcRequest(method: string, params: any) { + const inputParams = Array.isArray(params) ? params : [params]; + const payload = { + method: method, + params: inputParams, + jsonrpc: "2.0", + id: randomUUID(), + }; + + return new Promise>((resolve) => { + const handler = (message: MessageEvent) => { + const response: Omit, "id"> & { id: string; } = JSON.parse(message.data); + + if (response.id !== payload.id as unknown) { + return; } - request.callback(error, null); + // @ts-ignore - don't want to expose the message event + this.removeListener('message', handler); + resolve({ ...response, id: 1 }); + }; - this.emit(WebSocketEvents.ERROR, { - action: "response", - error: error, - request: JSON.parse(request.payload), - provider: this - }); - } - } else if(response.method === "moi.subscription") { - const sub = this.subscriptions[response.params.subscription]; - if (sub) { - sub.processFunc(response.params.result) - } - } + // @ts-ignore - don't want to expose the message event + this.on('message', handler); + this.ws.send(JSON.stringify(payload)); + }); } + private isSubscriptionEvent(eventName: ProviderEvents): boolean { + const events = ['newTesseracts', 'newTesseractsByAccount', 'newLogs', 'newPendingInteractions']; + const name = typeof eventName === "string" ? eventName : eventName.event; + return events.includes(name); + } - /** - * Method called when the WebSocket connection fails to connect. - * - * @param event - The connect failed event. - */ - private onConnectFailed = (event): void => { - let connectFailedDescription = event.toString().split('\n')[0]; - if (connectFailedDescription) { - event.description = connectFailedDescription; - } - - event.code = 1006; - event.reason = 'connection failed'; - - if (this.wsConnOptions.reconnectOptions.auto && (![1000, 1001].includes(event.code) || event.wasClean === false)) { - this.reconnect(); - - return; - } - - this.emit(WebSocketEvents.ERROR, event); - if (this.requestQueue.size > 0) { - this.requestQueue.forEach((request, key) => { - request.callback(errors.ConnectionNotOpenError(event), null); - this.requestQueue.delete(key); - }); - } - - if (this.responseQueue.size > 0) { - this.responseQueue.forEach((request, key) => { - request.callback(errors.InvalidConnection('on WS', event), null); - this.responseQueue.delete(key); - }); + public override async getSubscription(eventName: ProviderEvents): Promise { + const sub = this.subscriptions.get(eventName); + + if (sub?.subID != null) { + return await this.subscriptions.get(eventName).subID; } - - //clean connection on our own - if(this.connection._connection){ - this.connection._connection.removeAllListeners(); + + if (sub == null) { + const promise = super.getSubscription(eventName); + this.subscriptions.set(eventName, { subID: promise }); + return await promise; } - this.connection._client.removeAllListeners(); - this.connection._readyState = 3; // set readyState to CLOSED - - this.emit(WebSocketEvents.CLOSE, event); + + sub.subID = super.getSubscription(eventName); + return await sub.subID; } + on(eventName: NewLogs, listener: (log: Log) => void): this; + on(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + on(eventName: K, listener: (...args: WebsocketEventMap[K]) => void): this; /** - * Sends a request over the WebSocket connection. + * This method listens to events emitted by the provider for the given event * - * @param requestId - The ID of the request. - * @param request - The request object. + * @param eventName - The event to listen to this can be a string or an object + * @param listener - The callback function to be called when the event is emitted + * @returns - The provider instance */ - private sendRequest(requestId: number, request: InflightRequest): void { - if (this.connection.readyState !== this.connection.OPEN) { - this.requestQueue.delete(requestId); - - request.callback(errors.ConnectionNotOpenError(), null); - - return; + on(eventName: ProviderEvents, listener: (...args: any[]) => void): this { + if (typeof eventName === "string") { + super.on(eventName, listener); } - this.responseQueue.set(requestId, request); - this.requestQueue.delete(requestId); + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); - try { - this.connection.send(request.payload); - } catch (error) { - request.callback(error, null); - this.responseQueue.delete(requestId); + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${randomUUID()}`; + } + super.on(_sub.uuid, listener); + } else { + const uuid = `${eventName.event}:${randomUUID()}`; + this.subscriptions.set(eventName, { uuid }); + super.on(uuid, listener); + } } - } - /** - * Sends a request over the WebSocket connection and returns a Promise that - * resolves with the response. - * - * @param method - The method of the request. - * @param params - The parameters of the request. - * @returns A Promise that resolves with the response or rejects with an error. - */ - protected send(method: string, params: any[]): Promise { - return new Promise((resolve, reject) => { - const callback = (error: Error, result: any) => { - if (error) { return reject(error); } - return resolve(result); - } + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); - const requestId = nextReqId++ + if (_sub?.subID != null) { + return this; + } - const payload = { - method: method, - params: params, - id: requestId, - jsonrpc: "2.0" - }; - const request: InflightRequest = { - payload: JSON.stringify(payload), - callback: callback - }; + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message: MessageEvent) => { + const data = JSON.parse(message.data); - if (this.connection.readyState === this.connection.CONNECTING || this.reconnecting) { - this.requestQueue.set(requestId, request); - - return; - } + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return + } - this.sendRequest(requestId, request) - }) - } + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName as ProviderEvents, data.params.result)); + return; + } - /** - * Subscribes to an event. - * - * @param tag - The tag associated with the subscription. - * @param param - The parameters of the subscription. - * @param processFunc - The function to process the subscription result. - * @returns A Promise that resolves when the subscription is complete. - */ - protected async _subscribe(tag: string, param: Array, processFunc: (result: any) => void): Promise { - let subIdPromise = this.subsIds[tag]; - if (subIdPromise == null) { - subIdPromise = Promise.all(param).then(async (param) => { - const response = await this.send("moi.subscribe", param); + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } - return response.result + }); }); - this.subsIds[tag] = subIdPromise; } - const subId = await subIdPromise; - this.subscriptions[subId] = { tag, processFunc }; + + return this; } + once(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + once(eventName: NewLogs, listener: (logs: Log) => void): this; + once(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; /** - * Starts listening to an event. + * Adds a one-time listener function for the specified event. * - * @param event - The event to start listening to. + * @param eventName - The name of the event to listen for. + * @param listener - A function to be called when the event is triggered. + * @returns The WebSocketProvider instance. */ - protected _startEvent(event: Event): void { - switch (event.type) { - case WebSocketEvents.TESSERACT: - const params: TesseractParams = { - address: event.address + once(eventName: ProviderEvents, listener: (...args: any[]) => void): this { + if (typeof eventName === "string") { + super.once(eventName, listener); + } + + if (typeof eventName === "object") { + if (this.subscriptions.has(eventName)) { + const _sub = this.subscriptions.get(eventName); + + if (_sub?.uuid == null) { + _sub.uuid = `${eventName.event}:${randomUUID()}`; } - this._subscribe(event.tag, [ "newAccountTesseracts", params ], (result: any) => { - this.emit(event.address, result); - }); - break; + super.once(_sub.uuid, listener); + } else { + const uuid = `${eventName.event}:${randomUUID()}`; + this.subscriptions.set(eventName, { uuid }); + super.once(uuid, listener); + } + } - case WebSocketEvents.ALL_TESSERACTS: - this._subscribe("all_tesseracts", [ "newTesseracts" ], (result: any) => { - this.emit(WebSocketEvents.ALL_TESSERACTS, result); - }); - break; - - case WebSocketEvents.PENDING_INTERACTIONS: - this._subscribe("pending_interactions", ["newPendingInteractions"], (result: any) => { - this.emit(WebSocketEvents.PENDING_INTERACTIONS, result); - }); - break; - - case WebSocketEvents.CONNECT: + if (this.isSubscriptionEvent(eventName)) { + const _sub = this.subscriptions.get(eventName); + + if (_sub?.subID != null) { + return this; + } - case WebSocketEvents.RECONNECT: - - case WebSocketEvents.CLOSE: - case WebSocketEvents.DEBUG: + this.getSubscription(eventName).then((subscription) => { + // @ts-ignore - don't want to expose the message event + this.on("message", (message: MessageEvent) => { + const data = JSON.parse(message.data); - case WebSocketEvents.ERROR: - break; + if (!("method" in data) || data.method !== "moi.subscription" || data.params.subscription !== subscription) { + return + } - default: - console.log("unhandled:", event); - break; + if (typeof eventName === "string") { + this.emit(eventName, this.processWsResult(eventName, data.params.result)); + return; + } + + if (typeof eventName === "object" && _sub.uuid != null) { + this.emit(_sub.uuid, this.processWsResult(eventName, data.params.result)); + return; + } + + }); + }); } + + return this; } + removeListener(eventName: NewLogs, listener: (logs: Log) => void): this; + removeListener(eventName: NewTesseractsByAccount, listener: (tesseract: Tesseract) => void): this; + removeListener(eventName: keyof WebsocketEventMap | K, listener: K extends keyof WebsocketEventMap ? WebsocketEventMap[K] extends unknown[] ? (...args: WebsocketEventMap[K]) => void : never : never): this; /** - * Stops listening to an event. + * Removes a listener from the WebSocket provider. * - * @param event - The event to stop listening to. + * @param eventName - The name of the event or an object representing a subscription. + * @param listener - The listener function to be removed. + * @returns The WebSocket provider instance. */ - protected _stopEvent(event: Event): void { - let tag = event.tag; - - if (this.listenerCount(event.event)) { - // There are remaining event listeners - return; + removeListener(eventName: ProviderEvents, listener: (...args: any[]) => void): this { + if (typeof eventName === "string") { + super.removeListener(eventName, listener); } - const subId = this.subsIds[tag]; - if (!subId) { return; } + if (typeof eventName === "object") { + const _sub = this.subscriptions.get(eventName); - delete this.subsIds[tag]; - subId.then((subId) => { - if (!this.subscriptions[subId]) { return; } - delete this.subscriptions[subId]; - this.send("moi.unsubscribe", [ subId ]); - }); + if (_sub?.uuid == null) { + return this; + } + + super.removeListener(_sub.uuid, listener); + this.subscriptions.delete(eventName); + } + return this; } /** - * Disconnects the WebSocket connection. + * This method removes a listener from the provider * - * @returns A Promise that resolves when the disconnect operation is complete. + * @param eventName - The event to remove the listener from + * @param listener - The listener to remove + * @returns - The provider instance */ - public async disconnect(): Promise { - // Wait until we have connected before trying to disconnect - if (this.connection.readyState === this.connection.CONNECTING) { - await (new Promise((resolve) => { - this.connection.onopen = () => { - resolve(true); - }; + off(eventName: string | symbol, listener: (...args: any[]) => void): this { + return super.off(eventName, listener); + } - this.connection.onerror = () => { - resolve(false); - }; - })); - } + /** + * This methods returns all the listeners for a given event + * + * @param eventName - The event to get the listeners for + * @returns - An array of listeners + */ + listeners(eventName: string | symbol): Function[] { + return super.listeners(eventName); + } + + /** + * Returns the number of listeners for the specified event name. + * + * @param eventName - The name of the event. + * @param listener - (Optional) The listener function. + * @returns The number of listeners for the specified event name. + */ + listenerCount(eventName: string | symbol, listener?: Function): number { + return super.listenerCount(eventName, listener); + } - // Hangup - // See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes - this.connection.close(1000); + /** + * Removes all event listeners for the specified event or all events. + * + * @param event - The event to remove listeners for. If not specified, all listeners for all events will be removed. + * @returns The instance of the class with all listeners removed. + */ + removeAllListeners(event?: string | symbol): this { + return super.removeAllListeners(event); } -} +} \ No newline at end of file diff --git a/packages/js-moi-providers/types/event.d.ts b/packages/js-moi-providers/types/event.d.ts index 043cc91f..d11ba3c5 100644 --- a/packages/js-moi-providers/types/event.d.ts +++ b/packages/js-moi-providers/types/event.d.ts @@ -1,3 +1,5 @@ -export type EventType = string; +import type { LogFilter } from "./jsonrpc"; + +export type EventType = string | LogFilter; export type Listener = (...args: Array) => void; diff --git a/packages/js-moi-providers/types/jsonrpc.d.ts b/packages/js-moi-providers/types/jsonrpc.d.ts index 9a0ac65c..ac07469c 100644 --- a/packages/js-moi-providers/types/jsonrpc.d.ts +++ b/packages/js-moi-providers/types/jsonrpc.d.ts @@ -337,4 +337,21 @@ export interface LogFilter { address: string; height: [start: number, end: number]; topics?: NestedArray; -} \ No newline at end of file +} + + +export interface Log { + address: string; + topics: string[]; + data: string; + ix_hash: string; + ts_hash: string; + participants: Participants; +} + +export interface LogFilter { + address: string; + height: [start: number, end: number]; + topics?: NestedArray; +} + diff --git a/packages/js-moi-providers/types/websocket.d.ts b/packages/js-moi-providers/types/websocket.d.ts index 19bd0d1d..f7039218 100644 --- a/packages/js-moi-providers/types/websocket.d.ts +++ b/packages/js-moi-providers/types/websocket.d.ts @@ -1,13 +1,22 @@ -export type InflightRequest = { - callback: (error: Error, result: any) => void; - payload: string; -}; +import type { Tesseract } from "js-moi-utils"; +import type { WebSocketEvent } from "../src.ts/websocket-events"; +import type { LogFilter } from "./jsonrpc"; -export type Subscription = { - tag: string; - processFunc: (payload: any) => void; +export type NewTesseractsByAccount = { + event: WebSocketEvent.NewTesseractsByAccount; + params: { address: string; }; }; -export type TesseractParams = { - address: string +export type NewLogs = { event: WebSocketEvent.NewLog; params: LogFilter; }; + +export type ProviderEvents = keyof WebsocketEventMap | +{ event: string; params: any; }; + +export interface WebsocketEventMap { + [WebSocketEvent.NewTesseracts]: [tesseract: Tesseract]; + [WebSocketEvent.NewPendingInteractions]: [interactionHash: string]; + [WebSocketEvent.Connect]: []; + [WebSocketEvent.Error]: [error: unknown]; + [WebSocketEvent.Close]: []; + [WebSocketEvent.Reconnect]: [attempt: number]; } diff --git a/packages/js-moi-signer/lib.cjs/signer.d.ts.map b/packages/js-moi-signer/lib.cjs/signer.d.ts.map index e0209837..2255a538 100644 --- a/packages/js-moi-signer/lib.cjs/signer.d.ts.map +++ b/packages/js-moi-signer/lib.cjs/signer.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src.ts/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,uBAAuB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE1K,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAMtD;;;GAGG;AACH,8BAAsB,MAAM;IACjB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,iBAAiB,EAAE,iBAAiB,CAAC;gBAEhC,QAAQ,CAAC,EAAE,gBAAgB;IAOvC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAC7B,QAAQ,CAAC,OAAO,CAAC,QAAQ,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5B,iBAAiB,EAAE,iBAAiB,CAAC;gBAEhC,QAAQ,CAAC,EAAE,gBAAgB;IAOvC,QAAQ,CAAC,UAAU,IAAI,MAAM;IAC7B,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAClD,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM;IAC5D,QAAQ,CAAC,aAAa,IAAI,OAAO;IACjC,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAO,EAAE,OAAO,GAAG,kBAAkB;IAG3F;;;;;OAKG;IACI,WAAW;IAWlB;;;;;;;;;OASG;IACU,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAelE;;;;;;OAMG;YACW,gBAAgB;IA6D9B;;;;;;;;;OASG;YACW,kBAAkB;IAYhC;;;;;;;;;OASG;IACU,IAAI,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAShF;;;;;;;;;;;OAWG;IACU,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAShF;;;;;;;;;OASG;IACU,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoBvF;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAC,UAAU,EAAE,SAAS,EAAE,MAAM,GAAC,UAAU,GAAG,OAAO;CA+B1G"} \ No newline at end of file diff --git a/packages/js-moi-signer/lib.cjs/signer.js b/packages/js-moi-signer/lib.cjs/signer.js index 4ae3d691..f9db42b9 100644 --- a/packages/js-moi-signer/lib.cjs/signer.js +++ b/packages/js-moi-signer/lib.cjs/signer.js @@ -90,10 +90,10 @@ class Signer { if (ixObject.fuel_limit == null) { js_moi_utils_1.ErrorUtils.throwError("Fuel limit is missing", js_moi_utils_1.ErrorCode.MISSING_ARGUMENT); } - if (typeof ixObject.fuel_price !== "number" || typeof ixObject.fuel_price !== "bigint") { + if (typeof ixObject.fuel_price !== "number" && typeof ixObject.fuel_price !== "bigint") { js_moi_utils_1.ErrorUtils.throwError(`Invalid fuel price. Expected number or bigint, got ${typeof ixObject.fuel_price}`, js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.fuel_limit !== "number" || typeof ixObject.fuel_limit !== "bigint") { + if (typeof ixObject.fuel_limit !== "number" && typeof ixObject.fuel_limit !== "bigint") { js_moi_utils_1.ErrorUtils.throwError(`Invalid fuel limit. Expected number or bigint, got ${typeof ixObject.fuel_limit}`, js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); } if (ixObject.fuel_price < 0) { @@ -102,9 +102,6 @@ class Signer { if (ixObject.fuel_limit <= 0) { js_moi_utils_1.ErrorUtils.throwError("Fuel limit must be greater than 0", js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.nonce !== "number") { - js_moi_utils_1.ErrorUtils.throwError(`Invalid nonce. Expected number, got ${typeof ixObject.nonce}`, js_moi_utils_1.ErrorCode.INVALID_ARGUMENT); - } if (ixObject.nonce != null) { const nonce = await this.getNonce({ tesseract_number: -1 }); if (ixObject.nonce < nonce) { diff --git a/packages/js-moi-signer/lib.cjs/signer.js.map b/packages/js-moi-signer/lib.cjs/signer.js.map index 0dc13693..f5fc6cdd 100644 --- a/packages/js-moi-signer/lib.cjs/signer.js.map +++ b/packages/js-moi-signer/lib.cjs/signer.js.map @@ -1 +1 @@ -{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src.ts/signer.ts"],"names":[],"mappings":";;;;;;AACA,+CAAyF;AAEzF,oDAAiC;AACjC,4DAAoC;AAIpC;;;GAGG;AACH,MAAsB,MAAM;IACjB,QAAQ,CAAoB;IAC5B,iBAAiB,CAAoB;IAE5C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M,GAAG,CAAC;QACd,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,OAAmB,EAAE,SAA4B,EAAE,SAA4B;QACzF,IAAI,eAA2B,CAAC;QAEhC,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE,CAAC;YAChC,eAAe,GAAG,IAAA,yBAAU,EAAC,SAAmB,CAAC,CAAA;QACrD,CAAC;aAAM,CAAC;YACJ,eAAe,GAAG,SAAuB,CAAA;QAC7C,CAAC;QAED,IAAI,eAAe,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YAChC,eAAe,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QAED,MAAM,GAAG,GAAG,IAAI,mBAAS,EAAE,CAAC;QAC5B,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;QAE1B,QAAO,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC;YACtB,KAAK,CAAC,CAAC,CAAC,CAAC;gBACL,MAAM,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;gBAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC;YACtD,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACN,yBAAU,CAAC,UAAU,CACjB,6DAA6D,EAC7D,wBAAS,CAAC,iBAAiB,CAC9B,CAAA;YACL,CAAC;QACL,CAAC;IAEL,CAAC;CACJ;AAvQD,wBAuQC"} \ No newline at end of file diff --git a/packages/js-moi-signer/lib.esm/signer.d.ts.map b/packages/js-moi-signer/lib.esm/signer.d.ts.map index e0209837..2255a538 100644 --- a/packages/js-moi-signer/lib.esm/signer.d.ts.map +++ b/packages/js-moi-signer/lib.esm/signer.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src.ts/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,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,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAoBvF;;;;;;;;;;;OAWG;IACI,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAC,UAAU,EAAE,SAAS,EAAE,MAAM,GAAC,UAAU,GAAG,OAAO;CA+B1G"} \ No newline at end of file diff --git a/packages/js-moi-signer/lib.esm/signer.js b/packages/js-moi-signer/lib.esm/signer.js index 0a8f5f0e..cf0caf0a 100644 --- a/packages/js-moi-signer/lib.esm/signer.js +++ b/packages/js-moi-signer/lib.esm/signer.js @@ -84,10 +84,10 @@ export class Signer { if (ixObject.fuel_limit == null) { ErrorUtils.throwError("Fuel limit is missing", ErrorCode.MISSING_ARGUMENT); } - if (typeof ixObject.fuel_price !== "number" || typeof ixObject.fuel_price !== "bigint") { + if (typeof ixObject.fuel_price !== "number" && typeof ixObject.fuel_price !== "bigint") { ErrorUtils.throwError(`Invalid fuel price. Expected number or bigint, got ${typeof ixObject.fuel_price}`, ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.fuel_limit !== "number" || typeof ixObject.fuel_limit !== "bigint") { + if (typeof ixObject.fuel_limit !== "number" && typeof ixObject.fuel_limit !== "bigint") { ErrorUtils.throwError(`Invalid fuel limit. Expected number or bigint, got ${typeof ixObject.fuel_limit}`, ErrorCode.INVALID_ARGUMENT); } if (ixObject.fuel_price < 0) { @@ -96,9 +96,6 @@ export class Signer { if (ixObject.fuel_limit <= 0) { ErrorUtils.throwError("Fuel limit must be greater than 0", ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.nonce !== "number") { - ErrorUtils.throwError(`Invalid nonce. Expected number, got ${typeof ixObject.nonce}`, ErrorCode.INVALID_ARGUMENT); - } if (ixObject.nonce != null) { const nonce = await this.getNonce({ tesseract_number: -1 }); if (ixObject.nonce < nonce) { diff --git a/packages/js-moi-signer/lib.esm/signer.js.map b/packages/js-moi-signer/lib.esm/signer.js.map index d137aae8..03b2710e 100644 --- a/packages/js-moi-signer/lib.esm/signer.js.map +++ b/packages/js-moi-signer/lib.esm/signer.js.map @@ -1 +1 @@ -{"version":3,"file":"signer.js","sourceRoot":"","sources":["../src.ts/signer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEzF,OAAO,UAAU,MAAM,SAAS,CAAC;AACjC,OAAO,SAAS,MAAM,aAAa,CAAC;AAIpC;;;GAGG;AACH,MAAM,OAAgB,MAAM;IACjB,QAAQ,CAAoB;IAC5B,iBAAiB,CAAoB;IAE5C,YAAY,QAA2B;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG;YACrB,eAAe,EAAE,IAAI,UAAU,EAAE;SACpC,CAAC;IACN,CAAC;IASD;;;;;OAKG;IACI,WAAW;QACd,IAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,QAAQ,CAAC;QACzB,CAAC;QAED,UAAU,CAAC,UAAU,CACjB,8BAA8B,EAC9B,SAAS,CAAC,eAAe,CAC5B,CAAC;IACN,CAAC;IAED;;;;;;;;;OASG;IACI,KAAK,CAAC,QAAQ,CAAC,OAAiB;QACnC,IAAI,CAAC;YACD,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACpC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAElC,IAAG,CAAC,OAAO,EAAE,CAAC;gBACV,OAAO,MAAM,QAAQ,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAA;YAC7D,CAAC;YAED,OAAO,MAAM,QAAQ,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC/D,CAAC;QAAC,OAAM,GAAG,EAAE,CAAC;YACV,MAAM,GAAG,CAAC;QACd,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACK,KAAK,CAAC,gBA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AS,CAAC,iBAAiB,CAC9B,CAAA;YACL,CAAC;QACL,CAAC;IAEL,CAAC;CACJ"} \ No newline at end of file diff --git a/packages/js-moi-signer/src.ts/signer.ts b/packages/js-moi-signer/src.ts/signer.ts index 19878e9e..1c7daa60 100644 --- a/packages/js-moi-signer/src.ts/signer.ts +++ b/packages/js-moi-signer/src.ts/signer.ts @@ -113,11 +113,11 @@ export abstract class Signer { ErrorUtils.throwError("Fuel limit is missing", ErrorCode.MISSING_ARGUMENT); } - if (typeof ixObject.fuel_price !== "number" || typeof ixObject.fuel_price !== "bigint") { + if (typeof ixObject.fuel_price !== "number" && typeof ixObject.fuel_price !== "bigint") { ErrorUtils.throwError(`Invalid fuel price. Expected number or bigint, got ${typeof ixObject.fuel_price}`, ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.fuel_limit !== "number" || typeof ixObject.fuel_limit !== "bigint") { + if (typeof ixObject.fuel_limit !== "number" && typeof ixObject.fuel_limit !== "bigint") { ErrorUtils.throwError(`Invalid fuel limit. Expected number or bigint, got ${typeof ixObject.fuel_limit}`, ErrorCode.INVALID_ARGUMENT); } @@ -129,10 +129,6 @@ export abstract class Signer { ErrorUtils.throwError("Fuel limit must be greater than 0", ErrorCode.INVALID_ARGUMENT); } - if (typeof ixObject.nonce !== "number") { - ErrorUtils.throwError(`Invalid nonce. Expected number, got ${typeof ixObject.nonce}`, ErrorCode.INVALID_ARGUMENT); - } - if(ixObject.nonce != null) { const nonce = await this.getNonce({ tesseract_number: -1 }); if(ixObject.nonce < nonce) { diff --git a/packages/js-moi-utils/lib.cjs/schema.d.ts b/packages/js-moi-utils/lib.cjs/schema.d.ts index f9f3d0d3..bc4cf27b 100644 --- a/packages/js-moi-utils/lib.cjs/schema.d.ts +++ b/packages/js-moi-utils/lib.cjs/schema.d.ts @@ -55,7 +55,7 @@ export declare const assetCreateSchema: { }; }; }; -export declare const DEFAULT_EVENT_SCHEMA: { +export declare const builtInLogEventSchema: { kind: string; fields: { value: { diff --git a/packages/js-moi-utils/lib.cjs/schema.d.ts.map b/packages/js-moi-utils/lib.cjs/schema.d.ts.map index cbb78286..4f729294 100644 --- a/packages/js-moi-utils/lib.cjs/schema.d.ts.map +++ b/packages/js-moi-utils/lib.cjs/schema.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB7B,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD1B,CAAA"} \ No newline at end of file +{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB7B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;CAOjC,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD1B,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-utils/lib.cjs/schema.js b/packages/js-moi-utils/lib.cjs/schema.js index 56af7077..85ba1d03 100644 --- a/packages/js-moi-utils/lib.cjs/schema.js +++ b/packages/js-moi-utils/lib.cjs/schema.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.ixObjectSchema = exports.assetMintOrBurnSchema = exports.DEFAULT_EVENT_SCHEMA = exports.assetCreateSchema = exports.logicSchema = void 0; +exports.ixObjectSchema = exports.assetMintOrBurnSchema = exports.builtInLogEventSchema = exports.assetCreateSchema = exports.logicSchema = void 0; exports.logicSchema = { kind: "struct", fields: { @@ -42,7 +42,7 @@ exports.assetCreateSchema = { logic_payload: exports.logicSchema } }; -exports.DEFAULT_EVENT_SCHEMA = { +exports.builtInLogEventSchema = { kind: "struct", fields: { value: { diff --git a/packages/js-moi-utils/lib.cjs/schema.js.map b/packages/js-moi-utils/lib.cjs/schema.js.map index e67068c6..9cc2a9b4 100644 --- a/packages/js-moi-utils/lib.cjs/schema.js.map +++ b/packages/js-moi-utils/lib.cjs/schema.js.map @@ -1 +1 @@ -{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA;AAEY,QAAA,iBAAiB,GAAG;IAC7B,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;SAClB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,SAAS;SAClB;QACD,SAAS,EAAE;YACP,IAAI,EAAE,SAAS;SAClB;QACD,WAAW,EAAE;YACT,IAAI,EAAE,MAAM;SACf;QACD,UAAU,EAAE;YACR,IAAI,EAAE,MAAM;SACf;QACD,aAAa,EAAE,mBAAW;KAC7B;CACJ,CAAA;AAEY,QAAA,oBAAoB,GAAG;IAChC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;SACjB;KACJ;CACJ,CAAA;AAEY,QAAA,qBAAqB,GAAG;IACjC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;SAClB;KACJ;CACJ,CAAA;AAEY,QAAA,cAAc,GAAI;IAC3B,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,IAAI,EAAE;YACF,IAAI,EAAE,SAAS;SAClB;QACD,KAAK,EAAE;YACH,IAAI,EAAE,SAAS;SAClB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,OAAO;SAChB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;QACD,KAAK,EAAE;YACH,IAAI,EAAE,OAAO;SAChB;QACD,eAAe,EAAE;YACb,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,gBAAgB,EAAE;YACd,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,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,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,gBAAgB,EAAE;YACd,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-utils/lib.esm/schema.d.ts b/packages/js-moi-utils/lib.esm/schema.d.ts index f9f3d0d3..bc4cf27b 100644 --- a/packages/js-moi-utils/lib.esm/schema.d.ts +++ b/packages/js-moi-utils/lib.esm/schema.d.ts @@ -55,7 +55,7 @@ export declare const assetCreateSchema: { }; }; }; -export declare const DEFAULT_EVENT_SCHEMA: { +export declare const builtInLogEventSchema: { kind: string; fields: { value: { diff --git a/packages/js-moi-utils/lib.esm/schema.d.ts.map b/packages/js-moi-utils/lib.esm/schema.d.ts.map index cbb78286..4f729294 100644 --- a/packages/js-moi-utils/lib.esm/schema.d.ts.map +++ b/packages/js-moi-utils/lib.esm/schema.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB7B,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;;;CAOhC,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD1B,CAAA"} \ No newline at end of file +{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;CAgBvB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB7B,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;CAOjC,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;CAUjC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkD1B,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-utils/lib.esm/schema.js b/packages/js-moi-utils/lib.esm/schema.js index b0e913e7..1a65d3ab 100644 --- a/packages/js-moi-utils/lib.esm/schema.js +++ b/packages/js-moi-utils/lib.esm/schema.js @@ -39,7 +39,7 @@ export const assetCreateSchema = { logic_payload: logicSchema } }; -export const DEFAULT_EVENT_SCHEMA = { +export const builtInLogEventSchema = { kind: "struct", fields: { value: { diff --git a/packages/js-moi-utils/lib.esm/schema.js.map b/packages/js-moi-utils/lib.esm/schema.js.map index 7af0d2b6..e5294c1c 100644 --- a/packages/js-moi-utils/lib.esm/schema.js.map +++ b/packages/js-moi-utils/lib.esm/schema.js.map @@ -1 +1 @@ -{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE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ACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,gBAAgB,EAAE;YACd,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src.ts/schema.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,MAAM,EAAE;YACJ,IAAI,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;SAClB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,SAAS;SAClB;QACD,SAAS,EAAE;YACP,IAAI,EAAE,SAAS;SAClB;QACD,WAAW,EAAE;YACT,IAAI,EAAE,MAAM;SACf;QACD,UAAU,EAAE;YACR,IAAI,EAAE,MAAM;SACf;QACD,aAAa,EAAE,WAAW;KAC7B;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,KAAK,EAAE;YACH,IAAI,EAAE,QAAQ;SACjB;KACJ;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,QAAQ,EAAE;YACN,IAAI,EAAE,QAAQ;SACjB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,SAAS;SAClB;KACJ;CACJ,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAI;IAC3B,IAAI,EAAE,QAAQ;IACd,MAAM,EAAE;QACJ,IAAI,EAAE;YACF,IAAI,EAAE,SAAS;SAClB;QACD,KAAK,EAAE;YACH,IAAI,EAAE,SAAS;SAClB;QACD,MAAM,EAAE;YACJ,IAAI,EAAE,OAAO;SAChB;QACD,QAAQ,EAAE;YACN,IAAI,EAAE,OAAO;SAChB;QACD,KAAK,EAAE;YACH,IAAI,EAAE,OAAO;SAChB;QACD,eAAe,EAAE;YACb,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,gBAAgB,EAAE;YACd,IAAI,EAAE,KAAK;YACX,MAAM,EAAE;gBACJ,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;iBACjB;gBACD,MAAM,EAAE;oBACJ,IAAI,EAAE,SAAS;iBAClB;aACJ;SACJ;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,UAAU,EAAE;YACR,IAAI,EAAE,SAAS;SAClB;QACD,OAAO,EAAE;YACL,IAAI,EAAE,OAAO;SAChB;KACJ;CACJ,CAAA"} \ No newline at end of file diff --git a/packages/js-moi-utils/src.ts/schema.ts b/packages/js-moi-utils/src.ts/schema.ts index 67c01fbe..cdb0b2f7 100644 --- a/packages/js-moi-utils/src.ts/schema.ts +++ b/packages/js-moi-utils/src.ts/schema.ts @@ -41,7 +41,7 @@ export const assetCreateSchema = { } } -export const DEFAULT_EVENT_SCHEMA = { +export const builtInLogEventSchema = { kind: "struct", fields: { value: { diff --git a/packages/js-moi-wallet/package.json b/packages/js-moi-wallet/package.json index 7efed2e1..8a435677 100644 --- a/packages/js-moi-wallet/package.json +++ b/packages/js-moi-wallet/package.json @@ -33,6 +33,6 @@ "buffer": "^6.0.3", "aes-js": "4.0.0-beta.5", "elliptic": "^6.5.4", - "js-polo": "^0.1.3" + "js-polo": "0.1.4" } } \ No newline at end of file