From cf55b3cdac94c419a3d45aa8730397ee99bea91a Mon Sep 17 00:00:00 2001 From: luc10921 Date: Tue, 14 Mar 2023 11:58:21 -0300 Subject: [PATCH 1/2] CU-864dtwgww - Add a way to give hints when parsing --- common/config/rush/pnpm-lock.yaml | 283 ++++++++++- packages/neo3-parser/README.MD | 101 ++++ packages/neo3-parser/dist/index.d.ts | 138 ++++- packages/neo3-parser/dist/index.js | 38 ++ packages/neo3-parser/docs/assets/search.js | 2 +- packages/neo3-parser/docs/index.html | 6 +- .../docs/interfaces/Neo3Parser.html | 46 +- .../docs/interfaces/ParseConfig.html | 56 +- .../docs/interfaces/RpcResponse.html | 80 +++ packages/neo3-parser/docs/modules.html | 13 +- .../neo3-parser/docs/variables/ABI_TYPES.html | 142 ++++++ .../docs/variables/EXTENDED_ABI_TYPES.html | 149 ++++++ .../docs/variables/INTERNAL_TYPES.html | 73 +++ packages/neo3-parser/src/index.ts | 58 ++- packages/neon-parser/dist/index.js | 54 +- packages/neon-parser/dist/index.js.map | 1 + packages/neon-parser/dist/index.spec.d.ts | 1 + packages/neon-parser/dist/index.spec.js | 306 +++++++++++ packages/neon-parser/dist/index.spec.js.map | 1 + packages/neon-parser/package.json | 17 +- packages/neon-parser/src/index.spec.js | 17 - packages/neon-parser/src/index.spec.ts | 478 ++++++++++++++++++ packages/neon-parser/src/index.ts | 114 ++++- packages/neon-parser/tsconfig.json | 3 +- 24 files changed, 2072 insertions(+), 105 deletions(-) create mode 100644 packages/neo3-parser/docs/interfaces/RpcResponse.html create mode 100644 packages/neo3-parser/docs/variables/ABI_TYPES.html create mode 100644 packages/neo3-parser/docs/variables/EXTENDED_ABI_TYPES.html create mode 100644 packages/neo3-parser/docs/variables/INTERNAL_TYPES.html create mode 100644 packages/neon-parser/dist/index.js.map create mode 100644 packages/neon-parser/dist/index.spec.d.ts create mode 100644 packages/neon-parser/dist/index.spec.js create mode 100644 packages/neon-parser/dist/index.spec.js.map delete mode 100644 packages/neon-parser/src/index.spec.js create mode 100644 packages/neon-parser/src/index.spec.ts diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 74ddd59..c05af00 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -15,23 +15,27 @@ importers: ../../packages/neon-parser: specifiers: - '@cityofzion/neo3-parser': 1.5.2 + '@cityofzion/neo3-parser': workspace:* '@cityofzion/neon-js': ^5.3.0 + '@types/mocha': ^10.0.1 + '@types/node': ^18.14.6 + assert: ^2.0.0 mocha: ^10.0.0 + ts-mocha: ^10.0.0 typescript: ^4.3.2 dependencies: - '@cityofzion/neo3-parser': 1.5.2 + '@cityofzion/neo3-parser': link:../neo3-parser '@cityofzion/neon-js': 5.3.0 devDependencies: + '@types/mocha': 10.0.1 + '@types/node': 18.15.3 + assert: 2.0.0 mocha: 10.1.0 + ts-mocha: 10.0.0_mocha@10.1.0 typescript: 4.8.3 packages: - /@cityofzion/neo3-parser/1.5.2: - resolution: {integrity: sha512-VVWBNeJIXFVdFEgzchZmX09UGJazNUM/caq+mwyzEy2vsZ60JKjWiCzNo9yjViSe4YaWoE8RwUEcuZkMw8Ku0A==} - dev: false - /@cityofzion/neon-api/5.2.2_@cityofzion+neon-core@5.3.0: resolution: {integrity: sha512-zNaGI+0C3r/w0olV6cpbdl1OarvX/Qen8bnEO3Xlqybc8uswu0AoL/mhfjXPFd75UkWmQTC7JCziKQULTfLblg==} peerDependencies: @@ -68,6 +72,19 @@ packages: - encoding dev: false + /@types/json5/0.0.29: + resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} + dev: true + optional: true + + /@types/mocha/10.0.1: + resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==} + dev: true + + /@types/node/18.15.3: + resolution: {integrity: sha512-p6ua9zBxz5otCmbpb5D3U4B5Nanw6Pk3PPyX05xnxbB/fRv71N7CPmORg7uAD5P70T0xmx1pzAx/FUfa5X+3cw==} + dev: true + /abort-controller/3.0.0: resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==} engines: {node: '>=6.5'} @@ -104,6 +121,25 @@ packages: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} dev: true + /arrify/1.0.1: + resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} + engines: {node: '>=0.10.0'} + dev: true + + /assert/2.0.0: + resolution: {integrity: sha512-se5Cd+js9dXJnu6Ag2JFc00t+HmHOen+8Q+L7O9zI0PqQXr20uk2J0XQqMxZEeo5U50o8Nvmmx7dZrl+Ufr35A==} + dependencies: + es6-object-assign: 1.1.0 + is-nan: 1.3.2 + object-is: 1.1.5 + util: 0.12.5 + dev: true + + /available-typed-arrays/1.0.5: + resolution: {integrity: sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==} + engines: {node: '>= 0.4'} + dev: true + /balanced-match/1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true @@ -163,6 +199,10 @@ packages: base-x: 4.0.0 dev: false + /buffer-from/1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + dev: true + /buffer/6.0.3: resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} dependencies: @@ -170,6 +210,13 @@ packages: ieee754: 1.2.1 dev: false + /call-bind/1.0.2: + resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} + dependencies: + function-bind: 1.1.1 + get-intrinsic: 1.2.0 + dev: true + /camelcase/6.3.0: resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} engines: {node: '>=10'} @@ -251,6 +298,19 @@ packages: engines: {node: '>=10'} dev: true + /define-properties/1.2.0: + resolution: {integrity: sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==} + engines: {node: '>= 0.4'} + dependencies: + has-property-descriptors: 1.0.0 + object-keys: 1.1.1 + dev: true + + /diff/3.5.0: + resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} + engines: {node: '>=0.3.1'} + dev: true + /diff/5.0.0: resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} engines: {node: '>=0.3.1'} @@ -272,6 +332,10 @@ packages: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} dev: true + /es6-object-assign/1.1.0: + resolution: {integrity: sha512-MEl9uirslVwqQU369iHNWZXsI8yaZYGg/D65aOgZkeyFJwHYSxilf7rQzXKI7DdDuBPrBXbfk3sl9hJhmd5AUw==} + dev: true + /escalade/3.1.1: resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==} engines: {node: '>=6'} @@ -307,6 +371,12 @@ packages: hasBin: true dev: true + /for-each/0.3.3: + resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} + dependencies: + is-callable: 1.2.7 + dev: true + /fs.realpath/1.0.0: resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} dev: true @@ -318,11 +388,23 @@ packages: dev: true optional: true + /function-bind/1.1.1: + resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==} + dev: true + /get-caller-file/2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} dev: true + /get-intrinsic/1.2.0: + resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==} + dependencies: + function-bind: 1.1.1 + has: 1.0.3 + has-symbols: 1.0.3 + dev: true + /glob-parent/5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -341,11 +423,42 @@ packages: path-is-absolute: 1.0.1 dev: true + /gopd/1.0.1: + resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} + dependencies: + get-intrinsic: 1.2.0 + dev: true + /has-flag/4.0.0: resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} engines: {node: '>=8'} dev: true + /has-property-descriptors/1.0.0: + resolution: {integrity: sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==} + dependencies: + get-intrinsic: 1.2.0 + dev: true + + /has-symbols/1.0.3: + resolution: {integrity: sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==} + engines: {node: '>= 0.4'} + dev: true + + /has-tostringtag/1.0.0: + resolution: {integrity: sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==} + engines: {node: '>= 0.4'} + dependencies: + has-symbols: 1.0.3 + dev: true + + /has/1.0.3: + resolution: {integrity: sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==} + engines: {node: '>= 0.4.0'} + dependencies: + function-bind: 1.1.1 + dev: true + /hash.js/1.1.7: resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} dependencies: @@ -380,6 +493,14 @@ packages: /inherits/2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + /is-arguments/1.1.1: + resolution: {integrity: sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + has-tostringtag: 1.0.0 + dev: true + /is-binary-path/2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -387,6 +508,11 @@ packages: binary-extensions: 2.2.0 dev: true + /is-callable/1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + dev: true + /is-extglob/2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -397,6 +523,13 @@ packages: engines: {node: '>=8'} dev: true + /is-generator-function/1.0.10: + resolution: {integrity: sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==} + engines: {node: '>= 0.4'} + dependencies: + has-tostringtag: 1.0.0 + dev: true + /is-glob/4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -404,6 +537,14 @@ packages: is-extglob: 2.1.1 dev: true + /is-nan/1.3.2: + resolution: {integrity: sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.2.0 + dev: true + /is-number/7.0.0: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} @@ -414,6 +555,17 @@ packages: engines: {node: '>=8'} dev: true + /is-typed-array/1.1.10: + resolution: {integrity: sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.2 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + /is-unicode-supported/0.1.0: resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} engines: {node: '>=10'} @@ -426,6 +578,14 @@ packages: argparse: 2.0.1 dev: true + /json5/1.0.2: + resolution: {integrity: sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: true + optional: true + /jsonc-parser/3.2.0: resolution: {integrity: sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==} dev: true @@ -462,6 +622,10 @@ packages: resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} dev: true + /make-error/1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true + /marked/4.1.0: resolution: {integrity: sha512-+Z6KDjSPa6/723PQYyc1axYZpYYpDnECDaU6hkaf5gqBieBkMKYReL5hteF2QizhlMbgbo8umXl/clZ67+GlsA==} engines: {node: '>= 12'} @@ -496,6 +660,17 @@ packages: brace-expansion: 2.0.1 dev: true + /minimist/1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true + + /mkdirp/0.5.6: + resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} + hasBin: true + dependencies: + minimist: 1.2.8 + dev: true + /mocha/10.1.0: resolution: {integrity: sha512-vUF7IYxEoN7XhQpFLxQAEMtE4W91acW4B6En9l97MwE9stL1A9gusXfoHZCLVHDUJ/7V5+lbCM6yMqzo5vNymg==} engines: {node: '>= 14.0.0'} @@ -555,6 +730,19 @@ packages: engines: {node: '>=0.10.0'} dev: true + /object-is/1.1.5: + resolution: {integrity: sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.2 + define-properties: 1.2.0 + dev: true + + /object-keys/1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + dev: true + /once/1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: @@ -630,6 +818,18 @@ packages: vscode-textmate: 6.0.0 dev: true + /source-map-support/0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + dev: true + + /source-map/0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + /string-width/4.2.3: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} @@ -646,6 +846,12 @@ packages: ansi-regex: 5.0.1 dev: true + /strip-bom/3.0.0: + resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} + engines: {node: '>=4'} + dev: true + optional: true + /strip-json-comments/3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -676,6 +882,44 @@ packages: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} dev: false + /ts-mocha/10.0.0_mocha@10.1.0: + resolution: {integrity: sha512-VRfgDO+iiuJFlNB18tzOfypJ21xn2xbuZyDvJvqpTbWgkAgD17ONGr8t+Tl8rcBtOBdjXp5e/Rk+d39f7XBHRw==} + engines: {node: '>= 6.X.X'} + hasBin: true + peerDependencies: + mocha: ^3.X.X || ^4.X.X || ^5.X.X || ^6.X.X || ^7.X.X || ^8.X.X || ^9.X.X || ^10.X.X + dependencies: + mocha: 10.1.0 + ts-node: 7.0.1 + optionalDependencies: + tsconfig-paths: 3.14.2 + dev: true + + /ts-node/7.0.1: + resolution: {integrity: sha512-BVwVbPJRspzNh2yfslyT1PSbl5uIk03EZlb493RKHN4qej/D06n1cEhjlOJG69oFsE7OT8XjpTUcYf6pKTLMhw==} + engines: {node: '>=4.2.0'} + hasBin: true + dependencies: + arrify: 1.0.1 + buffer-from: 1.1.2 + diff: 3.5.0 + make-error: 1.3.6 + minimist: 1.2.8 + mkdirp: 0.5.6 + source-map-support: 0.5.21 + yn: 2.0.0 + dev: true + + /tsconfig-paths/3.14.2: + resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} + dependencies: + '@types/json5': 0.0.29 + json5: 1.0.2 + minimist: 1.2.8 + strip-bom: 3.0.0 + dev: true + optional: true + /typedoc/0.23.14_typescript@4.8.3: resolution: {integrity: sha512-s2I+ZKBET38EctZvbXp2GooHrNaKjWZkrwGEK/sttnOGiKJqU0vHrsdcwLgKZGuo2aedNL3RRPj1LnAAeYscig==} engines: {node: '>= 14.14'} @@ -696,6 +940,16 @@ packages: hasBin: true dev: true + /util/0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + dependencies: + inherits: 2.0.4 + is-arguments: 1.1.1 + is-generator-function: 1.0.10 + is-typed-array: 1.1.10 + which-typed-array: 1.1.9 + dev: true + /vscode-oniguruma/1.6.2: resolution: {integrity: sha512-KH8+KKov5eS/9WhofZR8M8dMHWN2gTxjMsG4jd04YhpbPR91fUj7rYQ2/XjeHCJWbg7X++ApRIU9NUwM2vTvLA==} dev: true @@ -715,6 +969,18 @@ packages: webidl-conversions: 3.0.1 dev: false + /which-typed-array/1.1.9: + resolution: {integrity: sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.2 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + is-typed-array: 1.1.10 + dev: true + /workerpool/6.2.1: resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} dev: true @@ -765,6 +1031,11 @@ packages: yargs-parser: 20.2.4 dev: true + /yn/2.0.0: + resolution: {integrity: sha512-uTv8J/wiWTgUTg+9vLTi//leUl5vDQS6uii/emeTb2ssY7vl6QWf2fFbIIGjnhjvbdKlU0ed7QPgY1htTC86jQ==} + engines: {node: '>=4'} + dev: true + /yocto-queue/0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} diff --git a/packages/neo3-parser/README.MD b/packages/neo3-parser/README.MD index b2992f8..32d5342 100644 --- a/packages/neo3-parser/README.MD +++ b/packages/neo3-parser/README.MD @@ -10,6 +10,107 @@

# Neo3-parser + Neo3-parser is a specification of how SmartContract client SDKs can interact with different parsing libraries such as Neon-JS. Visit the [main page](../../README.md) of the project. + +## How to parse responses + +After invoking a contract you'll get the results on a stack. Use the `parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig)` function on each item to get the results parsed. + +### How to use parseConfig + +The `parseConfig` object has the following properties: + +| Property | Description | +|---------------------------|-------------------------------------------------------------------------------------------| +| type: string | a [valid ABI Type](https://github.com/neo-project/proposals/blob/master/nep-14.mediawiki#method)| +| hint?: string | a type that extends from the ABI type | +| generic?: ParseConfig | you only need to pass this prop if `type` is `"Array"` | +| genericKey?: ParseConfig | you only need to pass this prop if `type` is `"Map"` | +| genericItem?: ParseConfig | you only need to pass this prop if `type` is `"Map"` | +| union?: ParseConfig[] | you only need to pass this prop if `type` is `"Any"` and you expect to get multiple types | + +> Note: check [HINT_TYPES](./src/index.ts) to see what types are available to use on `hint`. + +### Example + +```ts +// Simulating a result stack after invoking a contract +const stackResult = [ + { + type: "ByteString", + value: "AAECAwQFBgcICQoLDA0ODxAREhM=" // This value is a Hash160 + } +] + +// Call parseRpcResponse on an item of the stack +const response = Neo3Parser.parseRpcResponde(stackResult[0]) + +console.log(response) +// Expected output: "☺☻♥♦♣♠\n♫☼►◄↕‼" + +// You can use the `parseConfig` parameter to change how to parse the response +const responseHash160 = Neo3Parser.parseRpcResponde(stackResult[0], { type: "Hash160"}) + +console.log(responseHash160) +// Expected output: "0x131211100f0e0d0c0b0a09080706050403020100" + +// Adding a hint might also change how it is parsed +const responseHash160LE = Neo3Parser.parseRpcResponde(stackResult[0], { type: "Hash160", hint: "ScriptHashLittleEndian"}) + +console.log(responseHash160LE) +// Expected output: "000102030405060708090a0b0c0d0e0f10111213" +``` + +#### Using neo3-boa to get the parseConfig + +If you compiled your smart contract with Neo3-boa you can use the ABI inside the `.manifest.json` file as the `parseConfig`. + +For example, compiling [this smart contract](https://github.com/CityOfZion/neo3-boa/blob/d43c0a3cdb1db11e80093d8da8b30441384ba213/boa3_test/test_sc/generation_test/ManifestTypeHintFromUInt160ToScriptHashLittleEndian.py) will generate the following file: + +```json +{ + "name": "ManifestTypeHintFromUInt160ToScriptHashLittleEndian", + "groups": [], + "abi": { + "methods": [ + { + "name": "Main", + "offset": 0, + "parameters": [], + "safe": false, + "returntype": "Hash160", + "returnhint": "ScriptHashLittleEndian" + } + ], + "events": [] + }, + "permissions": [ + { + "contract": "*", + "methods": "*" + } + ], + "trusts": [], + "features": {}, + "supportedstandards": [], + "extra": null +} +``` + +Then, you can copy the properties of the method you want to parse that have the `return` prefix, in this example it should be `returntype` and `returnhint`. +Remove the `return` prefix and attribute it to a `ParseConfig` variable in your TypeScript file. + +```ts +const parseConfigFromNeo3boa = { + "type": "Hash160", + "hint": "ScriptHashLittleEndian" +} + +const responseHash160LE = Neo3Parser.parseRpcResponde(stackResult[0], parseConfigFromNeo3boa) + +console.log(responseHash160LE) +// Expected output: "000102030405060708090a0b0c0d0e0f10111213" +``` diff --git a/packages/neo3-parser/dist/index.d.ts b/packages/neo3-parser/dist/index.d.ts index f74ef92..1b014f9 100644 --- a/packages/neo3-parser/dist/index.d.ts +++ b/packages/neo3-parser/dist/index.d.ts @@ -95,8 +95,142 @@ export interface Neo3Parser { * Formats the response from the RPC server to an easier to use format for dapp developers * @param input The response from the RPC server */ - parseRpcResponse: (field: any, parseConfig?: ParseConfig) => any; + parseRpcResponse: (field: RpcResponse, parseConfig?: ParseConfig) => any; } export interface ParseConfig { - ByteStringToScriptHash: boolean; + type: string; + hint?: string; + generic?: ParseConfig; + genericKey?: ParseConfig; + genericItem?: ParseConfig; + union?: ParseConfig[]; + sessionId?: string; } +export interface RpcResponse { + type?: string; + value: string | RpcResponse[] | RpcResponse | boolean; + key?: RpcResponse; +} +export declare const INTERNAL_TYPES: { + ARRAY: string; + BYTESTRING: string; + BUFFER: string; + INTEGER: string; + INTEROPINTERFACE: string; + BOOLEAN: string; + MAP: string; + NULL: string; + POINTER: string; + STRUCT: string; +}; +export declare const ABI_TYPES: { + ANY: { + name: string; + }; + SIGNATURE: { + name: string; + internal: string; + }; + BOOLEAN: { + name: string; + internal: string; + }; + INTEGER: { + name: string; + internal: string; + }; + HASH160: { + name: string; + internal: string; + }; + HASH256: { + name: string; + internal: string; + }; + BYTEARRAY: { + name: string; + internal: string; + }; + PUBLICKEY: { + name: string; + internal: string; + }; + STRING: { + name: string; + internal: string; + }; + ARRAY: { + name: string; + internal: string; + }; + MAP: { + name: string; + internal: string; + }; + INTEROPINTERFACE: { + name: string; + internal: string; + }; + VOID: { + name: string; + internal: string; + }; +}; +export declare const EXTENDED_ABI_TYPES: { + ADDRESS: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + PUBLICKEY: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + SCRIPTHASH: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + SCRIPTHASHLITTLEENDING: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + BLOCKHASH: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + TRANSACTIONID: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + STORAGECONTEXT: { + name: string; + abi: { + name: string; + internal: string; + }; + }; + ITERATOR: { + name: string; + abi: { + name: string; + internal: string; + }; + }; +}; diff --git a/packages/neo3-parser/dist/index.js b/packages/neo3-parser/dist/index.js index c8ad2e5..584266d 100644 --- a/packages/neo3-parser/dist/index.js +++ b/packages/neo3-parser/dist/index.js @@ -1,2 +1,40 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +exports.EXTENDED_ABI_TYPES = exports.ABI_TYPES = exports.INTERNAL_TYPES = void 0; +exports.INTERNAL_TYPES = { + ARRAY: "Array", + BYTESTRING: "ByteString", + BUFFER: "Buffer", + INTEGER: "Integer", + INTEROPINTERFACE: "InteropInterface", + BOOLEAN: "Boolean", + MAP: "Map", + NULL: "Null", + POINTER: "Pointer", + STRUCT: "Struct", +}; +exports.ABI_TYPES = { + ANY: { name: "Any" }, + SIGNATURE: { name: "Signature", internal: exports.INTERNAL_TYPES.BYTESTRING }, + BOOLEAN: { name: "Boolean", internal: exports.INTERNAL_TYPES.BOOLEAN }, + INTEGER: { name: "Integer", internal: exports.INTERNAL_TYPES.INTEGER }, + HASH160: { name: "Hash160", internal: exports.INTERNAL_TYPES.BYTESTRING }, + HASH256: { name: "Hash256", internal: exports.INTERNAL_TYPES.BYTESTRING }, + BYTEARRAY: { name: "ByteArray", internal: exports.INTERNAL_TYPES.BYTESTRING }, + PUBLICKEY: { name: "PublicKey", internal: exports.INTERNAL_TYPES.BYTESTRING }, + STRING: { name: "String", internal: exports.INTERNAL_TYPES.BYTESTRING }, + ARRAY: { name: "Array", internal: exports.INTERNAL_TYPES.ARRAY }, + MAP: { name: "Map", internal: exports.INTERNAL_TYPES.MAP }, + INTEROPINTERFACE: { name: "InteropInterface", internal: exports.INTERNAL_TYPES.INTEROPINTERFACE }, + VOID: { name: "Void", internal: exports.INTERNAL_TYPES.NULL }, +}; +exports.EXTENDED_ABI_TYPES = { + ADDRESS: { name: "Address", abi: exports.ABI_TYPES.STRING }, + PUBLICKEY: { name: "PublicKey", abi: exports.ABI_TYPES.PUBLICKEY }, + SCRIPTHASH: { name: "ScriptHash", abi: exports.ABI_TYPES.HASH160 }, + SCRIPTHASHLITTLEENDING: { name: "ScriptHashLittleEndian", abi: exports.ABI_TYPES.HASH160 }, + BLOCKHASH: { name: "BlockHash", abi: exports.ABI_TYPES.HASH256 }, + TRANSACTIONID: { name: "TransactionId", abi: exports.ABI_TYPES.HASH256 }, + STORAGECONTEXT: { name: "StorageContext", abi: exports.ABI_TYPES.INTEROPINTERFACE }, + ITERATOR: { name: "Iterator", abi: exports.ABI_TYPES.INTEROPINTERFACE }, +}; diff --git a/packages/neo3-parser/docs/assets/search.js b/packages/neo3-parser/docs/assets/search.js index 07707bf..9d9f3c4 100644 --- a/packages/neo3-parser/docs/assets/search.js +++ b/packages/neo3-parser/docs/assets/search.js @@ -1 +1 @@ -window.searchData = JSON.parse("{\"kinds\":{\"256\":\"Interface\",\"1024\":\"Property\",\"65536\":\"Type literal\"},\"rows\":[{\"kind\":256,\"name\":\"Neo3Parser\",\"url\":\"interfaces/Neo3Parser.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"abToStr\",\"url\":\"interfaces/Neo3Parser.html#abToStr\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToAb\",\"url\":\"interfaces/Neo3Parser.html#strToAb\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-30\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexstringToAb\",\"url\":\"interfaces/Neo3Parser.html#hexstringToAb\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-16\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"abToHexstring\",\"url\":\"interfaces/Neo3Parser.html#abToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToHexstring\",\"url\":\"interfaces/Neo3Parser.html#strToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-34\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexstringToStr\",\"url\":\"interfaces/Neo3Parser.html#hexstringToStr\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-18\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"intToHex\",\"url\":\"interfaces/Neo3Parser.html#intToHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-20\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"numToHexstring\",\"url\":\"interfaces/Neo3Parser.html#numToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-22\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"numToVarInt\",\"url\":\"interfaces/Neo3Parser.html#numToVarInt\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-24\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexToBase64\",\"url\":\"interfaces/Neo3Parser.html#hexToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-14\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"base64ToHex\",\"url\":\"interfaces/Neo3Parser.html#base64ToHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"utf8ToBase64\",\"url\":\"interfaces/Neo3Parser.html#utf8ToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-36\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"asciiToBase64\",\"url\":\"interfaces/Neo3Parser.html#asciiToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"base64ToUtf8\",\"url\":\"interfaces/Neo3Parser.html#base64ToUtf8\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"accountInputToScripthash\",\"url\":\"interfaces/Neo3Parser.html#accountInputToScripthash\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToBase64\",\"url\":\"interfaces/Neo3Parser.html#strToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-32\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"accountInputToAddress\",\"url\":\"interfaces/Neo3Parser.html#accountInputToAddress\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"reverseHex\",\"url\":\"interfaces/Neo3Parser.html#reverseHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-28\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"parseRpcResponse\",\"url\":\"interfaces/Neo3Parser.html#parseRpcResponse\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-26\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":256,\"name\":\"ParseConfig\",\"url\":\"interfaces/ParseConfig.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"ByteStringToScriptHash\",\"url\":\"interfaces/ParseConfig.html#ByteStringToScriptHash\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,33.322]],[\"comment/0\",[]],[\"name/1\",[1,33.322]],[\"comment/1\",[]],[\"name/2\",[2,7.673]],[\"comment/2\",[]],[\"name/3\",[3,33.322]],[\"comment/3\",[]],[\"name/4\",[2,7.673]],[\"comment/4\",[]],[\"name/5\",[4,33.322]],[\"comment/5\",[]],[\"name/6\",[2,7.673]],[\"comment/6\",[]],[\"name/7\",[5,33.322]],[\"comment/7\",[]],[\"name/8\",[2,7.673]],[\"comment/8\",[]],[\"name/9\",[6,33.322]],[\"comment/9\",[]],[\"name/10\",[2,7.673]],[\"comment/10\",[]],[\"name/11\",[7,33.322]],[\"comment/11\",[]],[\"name/12\",[2,7.673]],[\"comment/12\",[]],[\"name/13\",[8,33.322]],[\"comment/13\",[]],[\"name/14\",[2,7.673]],[\"comment/14\",[]],[\"name/15\",[9,33.322]],[\"comment/15\",[]],[\"name/16\",[2,7.673]],[\"comment/16\",[]],[\"name/17\",[10,33.322]],[\"comment/17\",[]],[\"name/18\",[2,7.673]],[\"comment/18\",[]],[\"name/19\",[11,33.322]],[\"comment/19\",[]],[\"name/20\",[2,7.673]],[\"comment/20\",[]],[\"name/21\",[12,33.322]],[\"comment/21\",[]],[\"name/22\",[2,7.673]],[\"comment/22\",[]],[\"name/23\",[13,33.322]],[\"comment/23\",[]],[\"name/24\",[2,7.673]],[\"comment/24\",[]],[\"name/25\",[14,33.322]],[\"comment/25\",[]],[\"name/26\",[2,7.673]],[\"comment/26\",[]],[\"name/27\",[15,33.322]],[\"comment/27\",[]],[\"name/28\",[2,7.673]],[\"comment/28\",[]],[\"name/29\",[16,33.322]],[\"comment/29\",[]],[\"name/30\",[2,7.673]],[\"comment/30\",[]],[\"name/31\",[17,33.322]],[\"comment/31\",[]],[\"name/32\",[2,7.673]],[\"comment/32\",[]],[\"name/33\",[18,33.322]],[\"comment/33\",[]],[\"name/34\",[2,7.673]],[\"comment/34\",[]],[\"name/35\",[19,33.322]],[\"comment/35\",[]],[\"name/36\",[2,7.673]],[\"comment/36\",[]],[\"name/37\",[20,33.322]],[\"comment/37\",[]],[\"name/38\",[2,7.673]],[\"comment/38\",[]],[\"name/39\",[21,33.322]],[\"comment/39\",[]],[\"name/40\",[22,33.322]],[\"comment/40\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":2,\"name\":{\"2\":{},\"4\":{},\"6\":{},\"8\":{},\"10\":{},\"12\":{},\"14\":{},\"16\":{},\"18\":{},\"20\":{},\"22\":{},\"24\":{},\"26\":{},\"28\":{},\"30\":{},\"32\":{},\"34\":{},\"36\":{},\"38\":{}},\"comment\":{}}],[\"abtohexstring\",{\"_index\":5,\"name\":{\"7\":{}},\"comment\":{}}],[\"abtostr\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"accountinputtoaddress\",{\"_index\":18,\"name\":{\"33\":{}},\"comment\":{}}],[\"accountinputtoscripthash\",{\"_index\":16,\"name\":{\"29\":{}},\"comment\":{}}],[\"asciitobase64\",{\"_index\":14,\"name\":{\"25\":{}},\"comment\":{}}],[\"base64tohex\",{\"_index\":12,\"name\":{\"21\":{}},\"comment\":{}}],[\"base64toutf8\",{\"_index\":15,\"name\":{\"27\":{}},\"comment\":{}}],[\"bytestringtoscripthash\",{\"_index\":22,\"name\":{\"40\":{}},\"comment\":{}}],[\"hexstringtoab\",{\"_index\":4,\"name\":{\"5\":{}},\"comment\":{}}],[\"hexstringtostr\",{\"_index\":7,\"name\":{\"11\":{}},\"comment\":{}}],[\"hextobase64\",{\"_index\":11,\"name\":{\"19\":{}},\"comment\":{}}],[\"inttohex\",{\"_index\":8,\"name\":{\"13\":{}},\"comment\":{}}],[\"neo3parser\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"numtohexstring\",{\"_index\":9,\"name\":{\"15\":{}},\"comment\":{}}],[\"numtovarint\",{\"_index\":10,\"name\":{\"17\":{}},\"comment\":{}}],[\"parseconfig\",{\"_index\":21,\"name\":{\"39\":{}},\"comment\":{}}],[\"parserpcresponse\",{\"_index\":20,\"name\":{\"37\":{}},\"comment\":{}}],[\"reversehex\",{\"_index\":19,\"name\":{\"35\":{}},\"comment\":{}}],[\"strtoab\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"strtobase64\",{\"_index\":17,\"name\":{\"31\":{}},\"comment\":{}}],[\"strtohexstring\",{\"_index\":6,\"name\":{\"9\":{}},\"comment\":{}}],[\"utf8tobase64\",{\"_index\":13,\"name\":{\"23\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file +window.searchData = JSON.parse("{\"kinds\":{\"32\":\"Variable\",\"256\":\"Interface\",\"1024\":\"Property\",\"65536\":\"Type literal\"},\"rows\":[{\"kind\":256,\"name\":\"Neo3Parser\",\"url\":\"interfaces/Neo3Parser.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"abToStr\",\"url\":\"interfaces/Neo3Parser.html#abToStr\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToAb\",\"url\":\"interfaces/Neo3Parser.html#strToAb\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-30\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexstringToAb\",\"url\":\"interfaces/Neo3Parser.html#hexstringToAb\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-16\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"abToHexstring\",\"url\":\"interfaces/Neo3Parser.html#abToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToHexstring\",\"url\":\"interfaces/Neo3Parser.html#strToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-34\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexstringToStr\",\"url\":\"interfaces/Neo3Parser.html#hexstringToStr\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-18\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"intToHex\",\"url\":\"interfaces/Neo3Parser.html#intToHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-20\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"numToHexstring\",\"url\":\"interfaces/Neo3Parser.html#numToHexstring\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-22\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"numToVarInt\",\"url\":\"interfaces/Neo3Parser.html#numToVarInt\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-24\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"hexToBase64\",\"url\":\"interfaces/Neo3Parser.html#hexToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-14\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"base64ToHex\",\"url\":\"interfaces/Neo3Parser.html#base64ToHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"utf8ToBase64\",\"url\":\"interfaces/Neo3Parser.html#utf8ToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-36\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"asciiToBase64\",\"url\":\"interfaces/Neo3Parser.html#asciiToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"base64ToUtf8\",\"url\":\"interfaces/Neo3Parser.html#base64ToUtf8\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"accountInputToScripthash\",\"url\":\"interfaces/Neo3Parser.html#accountInputToScripthash\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"strToBase64\",\"url\":\"interfaces/Neo3Parser.html#strToBase64\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-32\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"accountInputToAddress\",\"url\":\"interfaces/Neo3Parser.html#accountInputToAddress\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"reverseHex\",\"url\":\"interfaces/Neo3Parser.html#reverseHex\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-28\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":1024,\"name\":\"parseRpcResponse\",\"url\":\"interfaces/Neo3Parser.html#parseRpcResponse\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"interfaces/Neo3Parser.html#__type-26\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-interface\",\"parent\":\"Neo3Parser\"},{\"kind\":256,\"name\":\"ParseConfig\",\"url\":\"interfaces/ParseConfig.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/ParseConfig.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"hint\",\"url\":\"interfaces/ParseConfig.html#hint\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"generic\",\"url\":\"interfaces/ParseConfig.html#generic\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"genericKey\",\"url\":\"interfaces/ParseConfig.html#genericKey\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"genericItem\",\"url\":\"interfaces/ParseConfig.html#genericItem\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"union\",\"url\":\"interfaces/ParseConfig.html#union\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":1024,\"name\":\"sessionId\",\"url\":\"interfaces/ParseConfig.html#sessionId\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"ParseConfig\"},{\"kind\":256,\"name\":\"RpcResponse\",\"url\":\"interfaces/RpcResponse.html\",\"classes\":\"tsd-kind-interface\"},{\"kind\":1024,\"name\":\"type\",\"url\":\"interfaces/RpcResponse.html#type\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RpcResponse\"},{\"kind\":1024,\"name\":\"value\",\"url\":\"interfaces/RpcResponse.html#value\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RpcResponse\"},{\"kind\":1024,\"name\":\"key\",\"url\":\"interfaces/RpcResponse.html#key\",\"classes\":\"tsd-kind-property tsd-parent-kind-interface\",\"parent\":\"RpcResponse\"},{\"kind\":32,\"name\":\"INTERNAL_TYPES\",\"url\":\"variables/INTERNAL_TYPES.html\",\"classes\":\"tsd-kind-variable\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/INTERNAL_TYPES.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"INTERNAL_TYPES\"},{\"kind\":1024,\"name\":\"ARRAY\",\"url\":\"variables/INTERNAL_TYPES.html#__type.ARRAY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"BYTESTRING\",\"url\":\"variables/INTERNAL_TYPES.html#__type.BYTESTRING\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"BUFFER\",\"url\":\"variables/INTERNAL_TYPES.html#__type.BUFFER\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"INTEGER\",\"url\":\"variables/INTERNAL_TYPES.html#__type.INTEGER\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"INTEROPINTERFACE\",\"url\":\"variables/INTERNAL_TYPES.html#__type.INTEROPINTERFACE\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"BOOLEAN\",\"url\":\"variables/INTERNAL_TYPES.html#__type.BOOLEAN\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"MAP\",\"url\":\"variables/INTERNAL_TYPES.html#__type.MAP\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"NULL\",\"url\":\"variables/INTERNAL_TYPES.html#__type.NULL\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"POINTER\",\"url\":\"variables/INTERNAL_TYPES.html#__type.POINTER\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":1024,\"name\":\"STRUCT\",\"url\":\"variables/INTERNAL_TYPES.html#__type.STRUCT\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"INTERNAL_TYPES.__type\"},{\"kind\":32,\"name\":\"ABI_TYPES\",\"url\":\"variables/ABI_TYPES.html\",\"classes\":\"tsd-kind-variable\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"ABI_TYPES\"},{\"kind\":1024,\"name\":\"ANY\",\"url\":\"variables/ABI_TYPES.html#__type.ANY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-1.name\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"SIGNATURE\",\"url\":\"variables/ABI_TYPES.html#__type.SIGNATURE\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-11\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-11.name-10\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-11.internal-9\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"BOOLEAN\",\"url\":\"variables/ABI_TYPES.html#__type.BOOLEAN\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-3.name-2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-3.internal-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"INTEGER\",\"url\":\"variables/ABI_TYPES.html#__type.INTEGER\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-7.name-6\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-7.internal-5\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"HASH160\",\"url\":\"variables/ABI_TYPES.html#__type.HASH160\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-5.name-4\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-5.internal-3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"HASH256\",\"url\":\"variables/ABI_TYPES.html#__type.HASH256\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-6.name-5\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-6.internal-4\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"BYTEARRAY\",\"url\":\"variables/ABI_TYPES.html#__type.BYTEARRAY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-4.name-3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-4.internal-2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"PUBLICKEY\",\"url\":\"variables/ABI_TYPES.html#__type.PUBLICKEY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-10.name-9\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-10.internal-8\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"STRING\",\"url\":\"variables/ABI_TYPES.html#__type.STRING\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-12.name-11\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-12.internal-10\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"ARRAY\",\"url\":\"variables/ABI_TYPES.html#__type.ARRAY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-2.name-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-2.internal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"MAP\",\"url\":\"variables/ABI_TYPES.html#__type.MAP\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-9.name-8\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-9.internal-7\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"INTEROPINTERFACE\",\"url\":\"variables/ABI_TYPES.html#__type.INTEROPINTERFACE\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-8.name-7\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-8.internal-6\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"VOID\",\"url\":\"variables/ABI_TYPES.html#__type.VOID\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/ABI_TYPES.html#__type.__type-13\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/ABI_TYPES.html#__type.__type-13.name-12\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/ABI_TYPES.html#__type.__type-13.internal-11\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"ABI_TYPES.__type.__type\"},{\"kind\":32,\"name\":\"EXTENDED_ABI_TYPES\",\"url\":\"variables/EXTENDED_ABI_TYPES.html\",\"classes\":\"tsd-kind-variable\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-variable\",\"parent\":\"EXTENDED_ABI_TYPES\"},{\"kind\":1024,\"name\":\"ADDRESS\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.ADDRESS\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1.name-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1.abi\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1.__type-2\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1.__type-2.name\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-1.__type-2.internal\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"PUBLICKEY\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.PUBLICKEY\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7.name-7\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7.abi-3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7.__type-8\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7.__type-8.name-6\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-7.__type-8.internal-3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"SCRIPTHASH\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.SCRIPTHASH\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9.name-9\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9.abi-4\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9.__type-10\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9.__type-10.name-8\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-9.__type-10.internal-4\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"SCRIPTHASHLITTLEENDING\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.SCRIPTHASHLITTLEENDING\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11.name-11\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11.abi-5\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11.__type-12\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11.__type-12.name-10\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-11.__type-12.internal-5\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"BLOCKHASH\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.BLOCKHASH\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3.name-3\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3.abi-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3.__type-4\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3.__type-4.name-2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-3.__type-4.internal-1\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"TRANSACTIONID\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.TRANSACTIONID\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15.name-15\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15.abi-7\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15.__type-16\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15.__type-16.name-14\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-15.__type-16.internal-7\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"STORAGECONTEXT\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.STORAGECONTEXT\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13.name-13\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13.abi-6\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13.__type-14\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13.__type-14.name-12\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-13.__type-14.internal-6\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"ITERATOR\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.ITERATOR\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5.name-5\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"abi\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5.abi-2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":65536,\"name\":\"__type\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5.__type-6\",\"classes\":\"tsd-kind-type-literal tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type\"},{\"kind\":1024,\"name\":\"name\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5.__type-6.name-4\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"},{\"kind\":1024,\"name\":\"internal\",\"url\":\"variables/EXTENDED_ABI_TYPES.html#__type.__type-5.__type-6.internal-2\",\"classes\":\"tsd-kind-property tsd-parent-kind-type-literal\",\"parent\":\"EXTENDED_ABI_TYPES.__type.__type.__type\"}],\"index\":{\"version\":\"2.3.9\",\"fields\":[\"name\",\"comment\"],\"fieldVectors\":[[\"name/0\",[0,47.593]],[\"comment/0\",[]],[\"name/1\",[1,47.593]],[\"comment/1\",[]],[\"name/2\",[2,12.232]],[\"comment/2\",[]],[\"name/3\",[3,47.593]],[\"comment/3\",[]],[\"name/4\",[2,12.232]],[\"comment/4\",[]],[\"name/5\",[4,47.593]],[\"comment/5\",[]],[\"name/6\",[2,12.232]],[\"comment/6\",[]],[\"name/7\",[5,47.593]],[\"comment/7\",[]],[\"name/8\",[2,12.232]],[\"comment/8\",[]],[\"name/9\",[6,47.593]],[\"comment/9\",[]],[\"name/10\",[2,12.232]],[\"comment/10\",[]],[\"name/11\",[7,47.593]],[\"comment/11\",[]],[\"name/12\",[2,12.232]],[\"comment/12\",[]],[\"name/13\",[8,47.593]],[\"comment/13\",[]],[\"name/14\",[2,12.232]],[\"comment/14\",[]],[\"name/15\",[9,47.593]],[\"comment/15\",[]],[\"name/16\",[2,12.232]],[\"comment/16\",[]],[\"name/17\",[10,47.593]],[\"comment/17\",[]],[\"name/18\",[2,12.232]],[\"comment/18\",[]],[\"name/19\",[11,47.593]],[\"comment/19\",[]],[\"name/20\",[2,12.232]],[\"comment/20\",[]],[\"name/21\",[12,47.593]],[\"comment/21\",[]],[\"name/22\",[2,12.232]],[\"comment/22\",[]],[\"name/23\",[13,47.593]],[\"comment/23\",[]],[\"name/24\",[2,12.232]],[\"comment/24\",[]],[\"name/25\",[14,47.593]],[\"comment/25\",[]],[\"name/26\",[2,12.232]],[\"comment/26\",[]],[\"name/27\",[15,47.593]],[\"comment/27\",[]],[\"name/28\",[2,12.232]],[\"comment/28\",[]],[\"name/29\",[16,47.593]],[\"comment/29\",[]],[\"name/30\",[2,12.232]],[\"comment/30\",[]],[\"name/31\",[17,47.593]],[\"comment/31\",[]],[\"name/32\",[2,12.232]],[\"comment/32\",[]],[\"name/33\",[18,47.593]],[\"comment/33\",[]],[\"name/34\",[2,12.232]],[\"comment/34\",[]],[\"name/35\",[19,47.593]],[\"comment/35\",[]],[\"name/36\",[2,12.232]],[\"comment/36\",[]],[\"name/37\",[20,47.593]],[\"comment/37\",[]],[\"name/38\",[2,12.232]],[\"comment/38\",[]],[\"name/39\",[21,47.593]],[\"comment/39\",[]],[\"name/40\",[22,42.485]],[\"comment/40\",[]],[\"name/41\",[23,47.593]],[\"comment/41\",[]],[\"name/42\",[24,47.593]],[\"comment/42\",[]],[\"name/43\",[25,47.593]],[\"comment/43\",[]],[\"name/44\",[26,47.593]],[\"comment/44\",[]],[\"name/45\",[27,47.593]],[\"comment/45\",[]],[\"name/46\",[28,47.593]],[\"comment/46\",[]],[\"name/47\",[29,47.593]],[\"comment/47\",[]],[\"name/48\",[22,42.485]],[\"comment/48\",[]],[\"name/49\",[30,47.593]],[\"comment/49\",[]],[\"name/50\",[31,47.593]],[\"comment/50\",[]],[\"name/51\",[32,47.593]],[\"comment/51\",[]],[\"name/52\",[2,12.232]],[\"comment/52\",[]],[\"name/53\",[33,42.485]],[\"comment/53\",[]],[\"name/54\",[34,47.593]],[\"comment/54\",[]],[\"name/55\",[35,47.593]],[\"comment/55\",[]],[\"name/56\",[36,42.485]],[\"comment/56\",[]],[\"name/57\",[37,42.485]],[\"comment/57\",[]],[\"name/58\",[38,42.485]],[\"comment/58\",[]],[\"name/59\",[39,42.485]],[\"comment/59\",[]],[\"name/60\",[40,47.593]],[\"comment/60\",[]],[\"name/61\",[41,47.593]],[\"comment/61\",[]],[\"name/62\",[42,47.593]],[\"comment/62\",[]],[\"name/63\",[43,47.593]],[\"comment/63\",[]],[\"name/64\",[2,12.232]],[\"comment/64\",[]],[\"name/65\",[44,47.593]],[\"comment/65\",[]],[\"name/66\",[2,12.232]],[\"comment/66\",[]],[\"name/67\",[45,17.804]],[\"comment/67\",[]],[\"name/68\",[46,47.593]],[\"comment/68\",[]],[\"name/69\",[2,12.232]],[\"comment/69\",[]],[\"name/70\",[45,17.804]],[\"comment/70\",[]],[\"name/71\",[47,21.444]],[\"comment/71\",[]],[\"name/72\",[38,42.485]],[\"comment/72\",[]],[\"name/73\",[2,12.232]],[\"comment/73\",[]],[\"name/74\",[45,17.804]],[\"comment/74\",[]],[\"name/75\",[47,21.444]],[\"comment/75\",[]],[\"name/76\",[36,42.485]],[\"comment/76\",[]],[\"name/77\",[2,12.232]],[\"comment/77\",[]],[\"name/78\",[45,17.804]],[\"comment/78\",[]],[\"name/79\",[47,21.444]],[\"comment/79\",[]],[\"name/80\",[48,47.593]],[\"comment/80\",[]],[\"name/81\",[2,12.232]],[\"comment/81\",[]],[\"name/82\",[45,17.804]],[\"comment/82\",[]],[\"name/83\",[47,21.444]],[\"comment/83\",[]],[\"name/84\",[49,47.593]],[\"comment/84\",[]],[\"name/85\",[2,12.232]],[\"comment/85\",[]],[\"name/86\",[45,17.804]],[\"comment/86\",[]],[\"name/87\",[47,21.444]],[\"comment/87\",[]],[\"name/88\",[50,47.593]],[\"comment/88\",[]],[\"name/89\",[2,12.232]],[\"comment/89\",[]],[\"name/90\",[45,17.804]],[\"comment/90\",[]],[\"name/91\",[47,21.444]],[\"comment/91\",[]],[\"name/92\",[51,42.485]],[\"comment/92\",[]],[\"name/93\",[2,12.232]],[\"comment/93\",[]],[\"name/94\",[45,17.804]],[\"comment/94\",[]],[\"name/95\",[47,21.444]],[\"comment/95\",[]],[\"name/96\",[52,47.593]],[\"comment/96\",[]],[\"name/97\",[2,12.232]],[\"comment/97\",[]],[\"name/98\",[45,17.804]],[\"comment/98\",[]],[\"name/99\",[47,21.444]],[\"comment/99\",[]],[\"name/100\",[33,42.485]],[\"comment/100\",[]],[\"name/101\",[2,12.232]],[\"comment/101\",[]],[\"name/102\",[45,17.804]],[\"comment/102\",[]],[\"name/103\",[47,21.444]],[\"comment/103\",[]],[\"name/104\",[39,42.485]],[\"comment/104\",[]],[\"name/105\",[2,12.232]],[\"comment/105\",[]],[\"name/106\",[45,17.804]],[\"comment/106\",[]],[\"name/107\",[47,21.444]],[\"comment/107\",[]],[\"name/108\",[37,42.485]],[\"comment/108\",[]],[\"name/109\",[2,12.232]],[\"comment/109\",[]],[\"name/110\",[45,17.804]],[\"comment/110\",[]],[\"name/111\",[47,21.444]],[\"comment/111\",[]],[\"name/112\",[53,47.593]],[\"comment/112\",[]],[\"name/113\",[2,12.232]],[\"comment/113\",[]],[\"name/114\",[45,17.804]],[\"comment/114\",[]],[\"name/115\",[47,21.444]],[\"comment/115\",[]],[\"name/116\",[54,47.593]],[\"comment/116\",[]],[\"name/117\",[2,12.232]],[\"comment/117\",[]],[\"name/118\",[55,47.593]],[\"comment/118\",[]],[\"name/119\",[2,12.232]],[\"comment/119\",[]],[\"name/120\",[45,17.804]],[\"comment/120\",[]],[\"name/121\",[56,30.247]],[\"comment/121\",[]],[\"name/122\",[2,12.232]],[\"comment/122\",[]],[\"name/123\",[45,17.804]],[\"comment/123\",[]],[\"name/124\",[47,21.444]],[\"comment/124\",[]],[\"name/125\",[51,42.485]],[\"comment/125\",[]],[\"name/126\",[2,12.232]],[\"comment/126\",[]],[\"name/127\",[45,17.804]],[\"comment/127\",[]],[\"name/128\",[56,30.247]],[\"comment/128\",[]],[\"name/129\",[2,12.232]],[\"comment/129\",[]],[\"name/130\",[45,17.804]],[\"comment/130\",[]],[\"name/131\",[47,21.444]],[\"comment/131\",[]],[\"name/132\",[57,47.593]],[\"comment/132\",[]],[\"name/133\",[2,12.232]],[\"comment/133\",[]],[\"name/134\",[45,17.804]],[\"comment/134\",[]],[\"name/135\",[56,30.247]],[\"comment/135\",[]],[\"name/136\",[2,12.232]],[\"comment/136\",[]],[\"name/137\",[45,17.804]],[\"comment/137\",[]],[\"name/138\",[47,21.444]],[\"comment/138\",[]],[\"name/139\",[58,47.593]],[\"comment/139\",[]],[\"name/140\",[2,12.232]],[\"comment/140\",[]],[\"name/141\",[45,17.804]],[\"comment/141\",[]],[\"name/142\",[56,30.247]],[\"comment/142\",[]],[\"name/143\",[2,12.232]],[\"comment/143\",[]],[\"name/144\",[45,17.804]],[\"comment/144\",[]],[\"name/145\",[47,21.444]],[\"comment/145\",[]],[\"name/146\",[59,47.593]],[\"comment/146\",[]],[\"name/147\",[2,12.232]],[\"comment/147\",[]],[\"name/148\",[45,17.804]],[\"comment/148\",[]],[\"name/149\",[56,30.247]],[\"comment/149\",[]],[\"name/150\",[2,12.232]],[\"comment/150\",[]],[\"name/151\",[45,17.804]],[\"comment/151\",[]],[\"name/152\",[47,21.444]],[\"comment/152\",[]],[\"name/153\",[60,47.593]],[\"comment/153\",[]],[\"name/154\",[2,12.232]],[\"comment/154\",[]],[\"name/155\",[45,17.804]],[\"comment/155\",[]],[\"name/156\",[56,30.247]],[\"comment/156\",[]],[\"name/157\",[2,12.232]],[\"comment/157\",[]],[\"name/158\",[45,17.804]],[\"comment/158\",[]],[\"name/159\",[47,21.444]],[\"comment/159\",[]],[\"name/160\",[61,47.593]],[\"comment/160\",[]],[\"name/161\",[2,12.232]],[\"comment/161\",[]],[\"name/162\",[45,17.804]],[\"comment/162\",[]],[\"name/163\",[56,30.247]],[\"comment/163\",[]],[\"name/164\",[2,12.232]],[\"comment/164\",[]],[\"name/165\",[45,17.804]],[\"comment/165\",[]],[\"name/166\",[47,21.444]],[\"comment/166\",[]],[\"name/167\",[62,47.593]],[\"comment/167\",[]],[\"name/168\",[2,12.232]],[\"comment/168\",[]],[\"name/169\",[45,17.804]],[\"comment/169\",[]],[\"name/170\",[56,30.247]],[\"comment/170\",[]],[\"name/171\",[2,12.232]],[\"comment/171\",[]],[\"name/172\",[45,17.804]],[\"comment/172\",[]],[\"name/173\",[47,21.444]],[\"comment/173\",[]]],\"invertedIndex\":[[\"__type\",{\"_index\":2,\"name\":{\"2\":{},\"4\":{},\"6\":{},\"8\":{},\"10\":{},\"12\":{},\"14\":{},\"16\":{},\"18\":{},\"20\":{},\"22\":{},\"24\":{},\"26\":{},\"28\":{},\"30\":{},\"32\":{},\"34\":{},\"36\":{},\"38\":{},\"52\":{},\"64\":{},\"66\":{},\"69\":{},\"73\":{},\"77\":{},\"81\":{},\"85\":{},\"89\":{},\"93\":{},\"97\":{},\"101\":{},\"105\":{},\"109\":{},\"113\":{},\"117\":{},\"119\":{},\"122\":{},\"126\":{},\"129\":{},\"133\":{},\"136\":{},\"140\":{},\"143\":{},\"147\":{},\"150\":{},\"154\":{},\"157\":{},\"161\":{},\"164\":{},\"168\":{},\"171\":{}},\"comment\":{}}],[\"abi\",{\"_index\":56,\"name\":{\"121\":{},\"128\":{},\"135\":{},\"142\":{},\"149\":{},\"156\":{},\"163\":{},\"170\":{}},\"comment\":{}}],[\"abi_types\",{\"_index\":43,\"name\":{\"63\":{}},\"comment\":{}}],[\"abtohexstring\",{\"_index\":5,\"name\":{\"7\":{}},\"comment\":{}}],[\"abtostr\",{\"_index\":1,\"name\":{\"1\":{}},\"comment\":{}}],[\"accountinputtoaddress\",{\"_index\":18,\"name\":{\"33\":{}},\"comment\":{}}],[\"accountinputtoscripthash\",{\"_index\":16,\"name\":{\"29\":{}},\"comment\":{}}],[\"address\",{\"_index\":55,\"name\":{\"118\":{}},\"comment\":{}}],[\"any\",{\"_index\":44,\"name\":{\"65\":{}},\"comment\":{}}],[\"array\",{\"_index\":33,\"name\":{\"53\":{},\"100\":{}},\"comment\":{}}],[\"asciitobase64\",{\"_index\":14,\"name\":{\"25\":{}},\"comment\":{}}],[\"base64tohex\",{\"_index\":12,\"name\":{\"21\":{}},\"comment\":{}}],[\"base64toutf8\",{\"_index\":15,\"name\":{\"27\":{}},\"comment\":{}}],[\"blockhash\",{\"_index\":59,\"name\":{\"146\":{}},\"comment\":{}}],[\"boolean\",{\"_index\":38,\"name\":{\"58\":{},\"72\":{}},\"comment\":{}}],[\"buffer\",{\"_index\":35,\"name\":{\"55\":{}},\"comment\":{}}],[\"bytearray\",{\"_index\":50,\"name\":{\"88\":{}},\"comment\":{}}],[\"bytestring\",{\"_index\":34,\"name\":{\"54\":{}},\"comment\":{}}],[\"extended_abi_types\",{\"_index\":54,\"name\":{\"116\":{}},\"comment\":{}}],[\"generic\",{\"_index\":24,\"name\":{\"42\":{}},\"comment\":{}}],[\"genericitem\",{\"_index\":26,\"name\":{\"44\":{}},\"comment\":{}}],[\"generickey\",{\"_index\":25,\"name\":{\"43\":{}},\"comment\":{}}],[\"hash160\",{\"_index\":48,\"name\":{\"80\":{}},\"comment\":{}}],[\"hash256\",{\"_index\":49,\"name\":{\"84\":{}},\"comment\":{}}],[\"hexstringtoab\",{\"_index\":4,\"name\":{\"5\":{}},\"comment\":{}}],[\"hexstringtostr\",{\"_index\":7,\"name\":{\"11\":{}},\"comment\":{}}],[\"hextobase64\",{\"_index\":11,\"name\":{\"19\":{}},\"comment\":{}}],[\"hint\",{\"_index\":23,\"name\":{\"41\":{}},\"comment\":{}}],[\"integer\",{\"_index\":36,\"name\":{\"56\":{},\"76\":{}},\"comment\":{}}],[\"internal\",{\"_index\":47,\"name\":{\"71\":{},\"75\":{},\"79\":{},\"83\":{},\"87\":{},\"91\":{},\"95\":{},\"99\":{},\"103\":{},\"107\":{},\"111\":{},\"115\":{},\"124\":{},\"131\":{},\"138\":{},\"145\":{},\"152\":{},\"159\":{},\"166\":{},\"173\":{}},\"comment\":{}}],[\"internal_types\",{\"_index\":32,\"name\":{\"51\":{}},\"comment\":{}}],[\"interopinterface\",{\"_index\":37,\"name\":{\"57\":{},\"108\":{}},\"comment\":{}}],[\"inttohex\",{\"_index\":8,\"name\":{\"13\":{}},\"comment\":{}}],[\"iterator\",{\"_index\":62,\"name\":{\"167\":{}},\"comment\":{}}],[\"key\",{\"_index\":31,\"name\":{\"50\":{}},\"comment\":{}}],[\"map\",{\"_index\":39,\"name\":{\"59\":{},\"104\":{}},\"comment\":{}}],[\"name\",{\"_index\":45,\"name\":{\"67\":{},\"70\":{},\"74\":{},\"78\":{},\"82\":{},\"86\":{},\"90\":{},\"94\":{},\"98\":{},\"102\":{},\"106\":{},\"110\":{},\"114\":{},\"120\":{},\"123\":{},\"127\":{},\"130\":{},\"134\":{},\"137\":{},\"141\":{},\"144\":{},\"148\":{},\"151\":{},\"155\":{},\"158\":{},\"162\":{},\"165\":{},\"169\":{},\"172\":{}},\"comment\":{}}],[\"neo3parser\",{\"_index\":0,\"name\":{\"0\":{}},\"comment\":{}}],[\"null\",{\"_index\":40,\"name\":{\"60\":{}},\"comment\":{}}],[\"numtohexstring\",{\"_index\":9,\"name\":{\"15\":{}},\"comment\":{}}],[\"numtovarint\",{\"_index\":10,\"name\":{\"17\":{}},\"comment\":{}}],[\"parseconfig\",{\"_index\":21,\"name\":{\"39\":{}},\"comment\":{}}],[\"parserpcresponse\",{\"_index\":20,\"name\":{\"37\":{}},\"comment\":{}}],[\"pointer\",{\"_index\":41,\"name\":{\"61\":{}},\"comment\":{}}],[\"publickey\",{\"_index\":51,\"name\":{\"92\":{},\"125\":{}},\"comment\":{}}],[\"reversehex\",{\"_index\":19,\"name\":{\"35\":{}},\"comment\":{}}],[\"rpcresponse\",{\"_index\":29,\"name\":{\"47\":{}},\"comment\":{}}],[\"scripthash\",{\"_index\":57,\"name\":{\"132\":{}},\"comment\":{}}],[\"scripthashlittleending\",{\"_index\":58,\"name\":{\"139\":{}},\"comment\":{}}],[\"sessionid\",{\"_index\":28,\"name\":{\"46\":{}},\"comment\":{}}],[\"signature\",{\"_index\":46,\"name\":{\"68\":{}},\"comment\":{}}],[\"storagecontext\",{\"_index\":61,\"name\":{\"160\":{}},\"comment\":{}}],[\"string\",{\"_index\":52,\"name\":{\"96\":{}},\"comment\":{}}],[\"strtoab\",{\"_index\":3,\"name\":{\"3\":{}},\"comment\":{}}],[\"strtobase64\",{\"_index\":17,\"name\":{\"31\":{}},\"comment\":{}}],[\"strtohexstring\",{\"_index\":6,\"name\":{\"9\":{}},\"comment\":{}}],[\"struct\",{\"_index\":42,\"name\":{\"62\":{}},\"comment\":{}}],[\"transactionid\",{\"_index\":60,\"name\":{\"153\":{}},\"comment\":{}}],[\"type\",{\"_index\":22,\"name\":{\"40\":{},\"48\":{}},\"comment\":{}}],[\"union\",{\"_index\":27,\"name\":{\"45\":{}},\"comment\":{}}],[\"utf8tobase64\",{\"_index\":13,\"name\":{\"23\":{}},\"comment\":{}}],[\"value\",{\"_index\":30,\"name\":{\"49\":{}},\"comment\":{}}],[\"void\",{\"_index\":53,\"name\":{\"112\":{}},\"comment\":{}}]],\"pipeline\":[]}}"); \ No newline at end of file diff --git a/packages/neo3-parser/docs/index.html b/packages/neo3-parser/docs/index.html index 1a1686a..782c94d 100644 --- a/packages/neo3-parser/docs/index.html +++ b/packages/neo3-parser/docs/index.html @@ -52,7 +52,11 @@

+
  • ParseConfig
  • +
  • RpcResponse
  • +
  • ABI_TYPES
  • +
  • EXTENDED_ABI_TYPES
  • +
  • INTERNAL_TYPES
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/packages/neo3-parser/docs/interfaces/Neo3Parser.html b/packages/neo3-parser/docs/interfaces/Neo3Parser.html index 21d5c62..ab9bd51 100644 --- a/packages/neo3-parser/docs/interfaces/Neo3Parser.html +++ b/packages/neo3-parser/docs/interfaces/Neo3Parser.html @@ -18,7 +18,7 @@

    Hierarchy

    +
  • Defined in index.ts:1
  • @@ -67,7 +67,7 @@

    Parameters

    arr: ArrayBuffer | ArrayLike<number>

    Returns string

    +
  • Defined in index.ts:21
  • abToStr: ((buf: ArrayBuffer | ArrayLike<number>) => string)
    @@ -87,7 +87,7 @@

    Parameters

    buf: ArrayBuffer | ArrayLike<number>

    Returns string

    +
  • Defined in index.ts:6
  • accountInputToAddress: ((input: string) => string)
    @@ -107,7 +107,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:88
  • accountInputToScripthash: ((input: string) => string)
    @@ -127,7 +127,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:78
  • asciiToBase64: ((input: string) => string)
    @@ -147,7 +147,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:68
  • base64ToHex: ((input: string) => string)
    @@ -167,7 +167,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:58
  • base64ToUtf8: ((input: string) => string)
    @@ -187,7 +187,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:73
  • hexToBase64: ((input: string) => string)
    @@ -207,7 +207,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:53
  • hexstringToAb: ((str: string) => Uint8Array)
    @@ -227,7 +227,7 @@

    Parameters

    str: string

    Returns Uint8Array

    +
  • Defined in index.ts:16
  • hexstringToStr: ((hexstring: string) => string)
    @@ -247,7 +247,7 @@

    Parameters

    hexstring: string

    Returns string

    +
  • Defined in index.ts:31
  • intToHex: ((num: number) => string)
    @@ -267,7 +267,7 @@

    Parameters

    num: number

    Returns string

    +
  • Defined in index.ts:36
  • numToHexstring: ((num: number, size?: number, littleEndian?: boolean) => string)
    @@ -297,7 +297,7 @@
    Optional littleEndian:

    Returns string

    +
  • Defined in index.ts:43
  • numToVarInt: ((num: number) => string)
    @@ -317,16 +317,16 @@

    Parameters

    num: number

    Returns string

    +
  • Defined in index.ts:48
  • -
    parseRpcResponse: ((field: any, parseConfig?: ParseConfig) => any)
    +
    parseRpcResponse: ((field: RpcResponse, parseConfig?: ParseConfig) => any)

    Type declaration

      • -
      • (field: any, parseConfig?: ParseConfig): any
      • +
      • (field: RpcResponse, parseConfig?: ParseConfig): any
      • Formats the response from the RPC server to an easier to use format for dapp developers

        @@ -334,12 +334,12 @@

        Type declaration

        Parameters

    Returns any

    +
  • Defined in index.ts:98
  • reverseHex: ((input: string) => string)
    @@ -359,7 +359,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:93
  • strToAb: ((str: string) => Uint8Array)
    @@ -379,7 +379,7 @@

    Parameters

    str: string

    Returns Uint8Array

    +
  • Defined in index.ts:11
  • strToBase64: ((input: string) => string)
    @@ -401,7 +401,7 @@
    input: string

    Returns string

    +
  • Defined in index.ts:83
  • strToHexstring: ((str: string) => string)
    @@ -421,7 +421,7 @@

    Parameters

    str: string

    Returns string

    +
  • Defined in index.ts:26
  • utf8ToBase64: ((input: string) => string)
    @@ -441,7 +441,7 @@

    Parameters

    input: string

    Returns string

    +
  • Defined in index.ts:63
  • +
  • Defined in index.ts:104
  • +
    + +
    genericItem?: ParseConfig
    +
    + +
    genericKey?: ParseConfig
    +
    + +
    hint?: string
    +
    + +
    sessionId?: string
    +
    + +
    type: string
    +
    + +
    union?: ParseConfig[]
    +
  • generic?
  • +
  • genericItem?
  • +
  • genericKey?
  • +
  • hint?
  • +
  • sessionId?
  • +
  • type
  • +
  • union?
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/packages/neo3-parser/docs/interfaces/RpcResponse.html b/packages/neo3-parser/docs/interfaces/RpcResponse.html new file mode 100644 index 0000000..042016c --- /dev/null +++ b/packages/neo3-parser/docs/interfaces/RpcResponse.html @@ -0,0 +1,80 @@ +RpcResponse | @cityofzion/neo3-parser
    +
    + +
    +
    +
    +
    + +

    Interface RpcResponse

    +
    +

    Hierarchy

    +
      +
    • RpcResponse
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    +
    + +
    type?: string
    +
    + +
    value: string | boolean | RpcResponse | RpcResponse[]
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/packages/neo3-parser/docs/modules.html b/packages/neo3-parser/docs/modules.html index 9d879ab..7f363ec 100644 --- a/packages/neo3-parser/docs/modules.html +++ b/packages/neo3-parser/docs/modules.html @@ -17,6 +17,13 @@

    Index

    Interfaces

    Neo3Parser ParseConfig +RpcResponse +
    +
    +

    Variables

    +
    +
  • ParseConfig
  • +
  • RpcResponse
  • +
  • ABI_TYPES
  • +
  • EXTENDED_ABI_TYPES
  • +
  • INTERNAL_TYPES
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/packages/neo3-parser/docs/variables/ABI_TYPES.html b/packages/neo3-parser/docs/variables/ABI_TYPES.html new file mode 100644 index 0000000..2df0367 --- /dev/null +++ b/packages/neo3-parser/docs/variables/ABI_TYPES.html @@ -0,0 +1,142 @@ +ABI_TYPES | @cityofzion/neo3-parser
    +
    + +
    +
    +
    +
    + +

    Variable ABI_TYPESConst

    +
    ABI_TYPES: { ANY: { name: string }; ARRAY: { internal: string; name: string }; BOOLEAN: { internal: string; name: string }; BYTEARRAY: { internal: string; name: string }; HASH160: { internal: string; name: string }; HASH256: { internal: string; name: string }; INTEGER: { internal: string; name: string }; INTEROPINTERFACE: { internal: string; name: string }; MAP: { internal: string; name: string }; PUBLICKEY: { internal: string; name: string }; SIGNATURE: { internal: string; name: string }; STRING: { internal: string; name: string }; VOID: { internal: string; name: string } } = ...
    +
    +

    Type declaration

    +
      +
    • +
      ANY: { name: string }
      +
        +
      • +
        name: string
    • +
    • +
      ARRAY: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      BOOLEAN: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      BYTEARRAY: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      HASH160: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      HASH256: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      INTEGER: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      INTEROPINTERFACE: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      MAP: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      PUBLICKEY: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      SIGNATURE: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      STRING: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    • +
    • +
      VOID: { internal: string; name: string }
      +
        +
      • +
        internal: string
      • +
      • +
        name: string
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/packages/neo3-parser/docs/variables/EXTENDED_ABI_TYPES.html b/packages/neo3-parser/docs/variables/EXTENDED_ABI_TYPES.html new file mode 100644 index 0000000..7186308 --- /dev/null +++ b/packages/neo3-parser/docs/variables/EXTENDED_ABI_TYPES.html @@ -0,0 +1,149 @@ +EXTENDED_ABI_TYPES | @cityofzion/neo3-parser
    +
    + +
    +
    +
    +
    + +

    Variable EXTENDED_ABI_TYPESConst

    +
    EXTENDED_ABI_TYPES: { ADDRESS: { abi: { internal: string; name: string }; name: string }; BLOCKHASH: { abi: { internal: string; name: string }; name: string }; ITERATOR: { abi: { internal: string; name: string }; name: string }; PUBLICKEY: { abi: { internal: string; name: string }; name: string }; SCRIPTHASH: { abi: { internal: string; name: string }; name: string }; SCRIPTHASHLITTLEENDING: { abi: { internal: string; name: string }; name: string }; STORAGECONTEXT: { abi: { internal: string; name: string }; name: string }; TRANSACTIONID: { abi: { internal: string; name: string }; name: string } } = ...
    +
    +

    Type declaration

    +
      +
    • +
      ADDRESS: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      BLOCKHASH: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      ITERATOR: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      PUBLICKEY: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      SCRIPTHASH: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      SCRIPTHASHLITTLEENDING: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      STORAGECONTEXT: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    • +
    • +
      TRANSACTIONID: { abi: { internal: string; name: string }; name: string }
      +
        +
      • +
        abi: { internal: string; name: string }
        +
          +
        • +
          internal: string
        • +
        • +
          name: string
      • +
      • +
        name: string
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/packages/neo3-parser/docs/variables/INTERNAL_TYPES.html b/packages/neo3-parser/docs/variables/INTERNAL_TYPES.html new file mode 100644 index 0000000..da069b9 --- /dev/null +++ b/packages/neo3-parser/docs/variables/INTERNAL_TYPES.html @@ -0,0 +1,73 @@ +INTERNAL_TYPES | @cityofzion/neo3-parser
    +
    + +
    +
    +
    +
    + +

    Variable INTERNAL_TYPESConst

    +
    INTERNAL_TYPES: { ARRAY: string; BOOLEAN: string; BUFFER: string; BYTESTRING: string; INTEGER: string; INTEROPINTERFACE: string; MAP: string; NULL: string; POINTER: string; STRUCT: string } = ...
    +
    +

    Type declaration

    +
      +
    • +
      ARRAY: string
    • +
    • +
      BOOLEAN: string
    • +
    • +
      BUFFER: string
    • +
    • +
      BYTESTRING: string
    • +
    • +
      INTEGER: string
    • +
    • +
      INTEROPINTERFACE: string
    • +
    • +
      MAP: string
    • +
    • +
      NULL: string
    • +
    • +
      POINTER: string
    • +
    • +
      STRUCT: string
    +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/packages/neo3-parser/src/index.ts b/packages/neo3-parser/src/index.ts index 856015d..48f5d93 100644 --- a/packages/neo3-parser/src/index.ts +++ b/packages/neo3-parser/src/index.ts @@ -95,9 +95,63 @@ export interface Neo3Parser { * Formats the response from the RPC server to an easier to use format for dapp developers * @param input The response from the RPC server */ - parseRpcResponse: (field: any, parseConfig?: ParseConfig) => any + parseRpcResponse: (field: RpcResponse, parseConfig?: ParseConfig) => any } export interface ParseConfig { - ByteStringToScriptHash: boolean + type: string, + hint?: string, + generic?: ParseConfig, + genericKey?: ParseConfig, + genericItem?: ParseConfig, + union?: ParseConfig[], +} + +export interface RpcResponse{ + type?: string, + value?: string | RpcResponse[] | RpcResponse | boolean, // Se o StorageCOntext contar entao é ? + key?: RpcResponse + sessionId?: string + id?: string + interface?: string +} + +export const INTERNAL_TYPES = { + ARRAY: "Array", + BYTESTRING: "ByteString", + BUFFER: "Buffer", + INTEGER: "Integer", + INTEROPINTERFACE: "InteropInterface", + BOOLEAN: "Boolean", + MAP: "Map", + NULL: "Null", + POINTER: "Pointer", + STRUCT: "Struct", +} + +export const ABI_TYPES = { + ANY: {name: "Any"}, + SIGNATURE: {name: "Signature", internal: INTERNAL_TYPES.BYTESTRING}, + BOOLEAN: {name: "Boolean", internal: INTERNAL_TYPES.BOOLEAN}, + INTEGER: {name: "Integer", internal: INTERNAL_TYPES.INTEGER}, + HASH160: {name: "Hash160", internal: INTERNAL_TYPES.BYTESTRING}, + HASH256: {name: "Hash256", internal: INTERNAL_TYPES.BYTESTRING}, + BYTEARRAY: {name: "ByteArray", internal: INTERNAL_TYPES.BYTESTRING}, + PUBLICKEY: {name: "PublicKey", internal: INTERNAL_TYPES.BYTESTRING}, + STRING: {name: "String", internal: INTERNAL_TYPES.BYTESTRING}, + ARRAY: {name: "Array", internal: INTERNAL_TYPES.ARRAY}, + MAP: {name: "Map", internal: INTERNAL_TYPES.MAP}, + INTEROPINTERFACE: {name: "InteropInterface", internal: INTERNAL_TYPES.INTEROPINTERFACE}, + VOID: {name: "Void", internal: INTERNAL_TYPES.NULL}, +} + +export const HINT_TYPES = { + ADDRESS: { name: "Address", abi: ABI_TYPES.STRING }, + PUBLICKEY: { name: "PublicKey", abi: ABI_TYPES.PUBLICKEY }, + SCRIPTHASH: { name: "ScriptHash", abi: ABI_TYPES.HASH160 }, + SCRIPTHASHLITTLEENDING: { name: "ScriptHashLittleEndian", abi: ABI_TYPES.HASH160 }, + BLOCKHASH: { name: "BlockHash", abi: ABI_TYPES.HASH256 }, + TRANSACTIONID: { name: "TransactionId", abi: ABI_TYPES.HASH256 }, + STORAGECONTEXT: { name: "StorageContext", abi: ABI_TYPES.INTEROPINTERFACE }, + ITERATOR: { name: "Iterator", abi: ABI_TYPES.INTEROPINTERFACE }, } diff --git a/packages/neon-parser/dist/index.js b/packages/neon-parser/dist/index.js index e0de880..3c04eb6 100644 --- a/packages/neon-parser/dist/index.js +++ b/packages/neon-parser/dist/index.js @@ -1,6 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NeonParser = void 0; +const neo3_parser_1 = require("@cityofzion/neo3-parser"); const neon_js_1 = require("@cityofzion/neon-js"); exports.NeonParser = { abToHexstring(arr) { @@ -60,28 +61,18 @@ exports.NeonParser = { parseRpcResponse(field, parseConfig) { switch (field.type) { case "ByteString": - const rawValue = exports.NeonParser.base64ToHex(field.value); - if (rawValue.length === 40 && (parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.ByteStringToScriptHash)) { - return `0x${exports.NeonParser.reverseHex(rawValue)}`; - } - const asStr = exports.NeonParser.hexstringToStr(rawValue); - try { - return JSON.parse(asStr); - } - catch (e) { - return asStr; - } + return parseByteString(field, parseConfig); case "Integer": return parseInt(field.value); case "Array": return field.value.map((f) => { - return exports.NeonParser.parseRpcResponse(f, parseConfig); + return exports.NeonParser.parseRpcResponse(f, parseConfig.generic); }); case "Map": const object = {}; field.value.forEach((f) => { - let key = exports.NeonParser.parseRpcResponse(f.key, parseConfig); - object[key] = exports.NeonParser.parseRpcResponse(f.value, parseConfig); + let key = exports.NeonParser.parseRpcResponse(f.key, parseConfig.genericKey); + object[key] = exports.NeonParser.parseRpcResponse(f.value, parseConfig.genericItem); }); return object; default: @@ -94,3 +85,38 @@ exports.NeonParser = { } } }; +function parseByteString({ value }, parseConfig) { + const valueToParse = value; + if (parseConfig.union) { + for (const config of parseConfig.union) { + if (neo3_parser_1.ABI_TYPES[config.type.toUpperCase()].internal === neo3_parser_1.INTERNAL_TYPES.BYTESTRING) { + parseConfig = config; + break; + } + } + } + if ((parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.type) === neo3_parser_1.ABI_TYPES.STRING.name) { + const stringValue = exports.NeonParser.base64ToUtf8(valueToParse); + if ((parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.hint) === neo3_parser_1.EXTENDED_ABI_TYPES.ADDRESS.name && + (stringValue.length !== 34 || + (!stringValue.startsWith("N") && !stringValue.startsWith("A"))) + // veirfica se é base58 depois eua cho + ) { + throw new TypeError(`${valueToParse} is not an ${neo3_parser_1.EXTENDED_ABI_TYPES.ADDRESS.name}`); + } + return stringValue; + } + const rawValue = exports.NeonParser.base64ToHex(valueToParse); + if ((parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.type) === neo3_parser_1.ABI_TYPES.HASH160.name) { + if (rawValue.length !== 40) + throw new TypeError(`${rawValue} is not a ${neo3_parser_1.ABI_TYPES.HASH160}`); + return (parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.hint) === neo3_parser_1.EXTENDED_ABI_TYPES.SCRIPTHASHLITTLEENDING.name ? rawValue : `0x${exports.NeonParser.reverseHex(rawValue)}`; + } + if ((parseConfig === null || parseConfig === void 0 ? void 0 : parseConfig.type) === neo3_parser_1.ABI_TYPES.HASH256.name) { + if (rawValue.length !== 64) + throw new TypeError(`${rawValue} is not a ${neo3_parser_1.ABI_TYPES.HASH256}`); + return `0x${exports.NeonParser.reverseHex(rawValue)}`; + } + return rawValue; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/neon-parser/dist/index.js.map b/packages/neon-parser/dist/index.js.map new file mode 100644 index 0000000..68bf119 --- /dev/null +++ b/packages/neon-parser/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAGgC;AAChC,iDAA+C;AAGlC,QAAA,UAAU,GAAe;IACpC,aAAa,CAAC,GAAoC;QAChD,OAAO,WAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IACD,OAAO,CAAC,GAAoC;QAC1C,OAAO,WAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;IACD,qBAAqB,CAAC,KAAa;QACjC,OAAO,IAAI,gBAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAA;IAC1C,CAAC;IACD,wBAAwB,CAAC,KAAa;QACpC,OAAO,IAAI,gBAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAA;IAC7C,CAAC;IACD,WAAW,EAAE,CAAC,KAAa,EAAU,EAAE;QACrC,OAAO,WAAC,CAAC,UAAU,CAAC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AC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,kBAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAA;KAChI;IAED,IAAI,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,MAAK,uBAAS,CAAC,OAAO,CAAC,IAAI,EAAE;QAChD,IAAI,QAAQ,CAAC,MAAM,KAAK,EAAE;YAAE,MAAM,IAAI,SAAS,CAAC,GAAG,QAAQ,aAAa,uBAAS,CAAC,OAAO,EAAE,CAAC,CAAA;QAE5F,OAAO,KAAK,kBAAU,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAA;KAC9C;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC"} \ No newline at end of file diff --git a/packages/neon-parser/dist/index.spec.d.ts b/packages/neon-parser/dist/index.spec.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/packages/neon-parser/dist/index.spec.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/packages/neon-parser/dist/index.spec.js b/packages/neon-parser/dist/index.spec.js new file mode 100644 index 0000000..c37d55e --- /dev/null +++ b/packages/neon-parser/dist/index.spec.js @@ -0,0 +1,306 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _1 = require("."); +const mocha_1 = require("mocha"); +const assert = require("assert"); +// describe('Neon-Parser Tests', function () { +// this.timeout(60000) +// it("converts Base64 to Hex and revert it", async () => { +// assert.equal(NeonParser.reverseHex(NeonParser.base64ToHex('ateeXCdGd+AdYKWa5w8SikaAqlk=')), '59aa80468a120fe79aa5601de07746275c9ed76a') +// return true +// }) +// it("converts address to script hash", async () => { +// assert.equal(NeonParser.accountInputToScripthash('NhGomBpYnKXArr55nHRQ5rzy79TwKVXZbr'), '857a247939db5c7cd3a7bb14791280c09e824bea') +// return true +// }) +// }) +(0, mocha_1.describe)('RPC Parser Tests', function () { + (0, mocha_1.it)("Parse Address", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "ByteString", + value: "Tk5MaTQ0ZEpOWHRETlNCa29mQjQ4YVRWWXRiMXpack5Fcw==" + }; + const address = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "String", hint: "Address" }); + assert.deepEqual(address, "NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs"); + })); + (0, mocha_1.it)("Parse invalid Address", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "ByteString", + // Address will end up too short + value: _1.NeonParser.hexToBase64('Nnnnnnnnnnnnnnnn') + }; + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "String", hint: "Address" })); + // Address will be too big + rpcResponse.value = _1.NeonParser.strToBase64('NnnnnnnnnnnnnnnnNnnnnnnnnnnnnnnnNnnnnnnnnnnnnnnn'); + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "String", hint: "Address" })); + // Address shouldn't start with a letter that isn't 'A' or 'N' + rpcResponse.value = _1.NeonParser.strToBase64('BNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs'); + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "String", hint: "Address" })); + })); + (0, mocha_1.it)("Parse ScriptHash and ScriptHashLittleEndian", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "ByteString", + value: "YUeato/VwsBLJU84LYTd8vXGfO0=" + }; + const scriptHash = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHash" }); + assert.deepEqual(scriptHash, "0xed7cc6f5f2dd842d384f254bc0c2d58fb69a4761"); + const scriptHashLilEndian = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHashLittleEndian" }); + assert.deepEqual(scriptHashLilEndian, "61479ab68fd5c2c04b254f382d84ddf2f5c67ced"); + })); + (0, mocha_1.it)("Parse invalid ScriptHash and ScriptHashLittleEndian", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "ByteString", + // ScriptHash will end up too short + value: "YUeato/VwsBLJU84LvX=" + }; + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHash" })); + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHashLittleEndian" })); + // ScriptHash will be too big + rpcResponse.value = _1.NeonParser.strToBase64('YUeato/VwsBLJU84LYTd8vXGfO00000='); + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHash" })); + assert.throws(() => _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash160", hint: "ScriptHashLittleEndian" })); + })); + (0, mocha_1.it)("Parse BlockHash or TransactionId", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "ByteString", + value: "/BSStl9lDDKg1cEWHNeQyJoiAXOgBcLe2n2xkec9UWw=" + }; + const blockHash = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash256", hint: "BlockHash" }); + const transactionId = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash256", hint: "TransactionId" }); + assert.deepEqual(transactionId, "0x6c513de791b17ddadec205a07301229ac890d71c16c1d5a0320c655fb69214fc"); + assert.deepEqual(blockHash, transactionId); + // There isn't a different on how they are returned right now + const hash256 = _1.NeonParser.parseRpcResponse(rpcResponse, { type: "Hash256" }); + assert.deepEqual(hash256, blockHash); + })); + // it("Parse ByteString without parseConfig", async () => { + // const rpcResponse = { + // type: "ByteString", + // value: "aaaaaa" + // } + // const bytesValue = NeonParser.parseRpcResponse(rpcResponse) + // assert.deepEqual(bytesValue, "aaa") + // }) + (0, mocha_1.it)("Parse Integer", () => __awaiter(this, void 0, void 0, function* () { + const rpcResponse = { + type: "Integer", + value: "18" + }; + const integer = _1.NeonParser.parseRpcResponse(rpcResponse); + assert.deepEqual(integer, 18); + })); + (0, mocha_1.it)("Parse single type Array", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "Integer", + value: "20" + }, + { + type: "Integer", + value: "30" + }, + ] + }; + let array = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Array', generic: { type: "Integer" } }); + assert.deepEqual(array, [10, 20, 30]); + rpcResponse = { + type: "Array", + value: [ + { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + }, + { + type: "ByteString", + value: _1.NeonParser.strToBase64("array") + }, + { + type: "ByteString", + value: _1.NeonParser.strToBase64("return") + }, + ] + }; + array = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Array', generic: { type: "String" } }); + assert.deepEqual(array, ['test', 'array', 'return']); + })); + (0, mocha_1.it)("Parse Union", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + }; + let union = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Any', union: [{ type: "String" }, { type: "Integer" }] }); + assert.deepEqual(union, 'test'); + rpcResponse = { + type: "Integer", + value: "12" + }; + union = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Any', union: [{ type: "String" }, { type: "Integer" }] }); + assert.deepEqual(union, 12); + })); + (0, mocha_1.it)("Try parse same internal types with Union", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + }; + // It's not possible to definitly know the correct return of the same internal type, it will be the always try to get the first one + assert.throws(() => { _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Any', union: [{ type: "Hash160", hint: "ScriptHash" }, { type: "String" }, { type: "Integer" }] }); }); + })); + (0, mocha_1.it)("Parse multiple types Array", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + }, + { + type: "ByteString", + value: _1.NeonParser.strToBase64("parser") + }, + ] + }; + let array = _1.NeonParser.parseRpcResponse(rpcResponse, { + type: 'Array', + generic: { + type: "Any", + union: [ + { + type: 'Integer' + }, + { + type: 'String' + } + ] + } + }); + assert.deepEqual(array, [10, 'test', 'parser']); + rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "ByteString", + value: "Tk5MaTQ0ZEpOWHRETlNCa29mQjQ4YVRWWXRiMXpack5Fcw" + }, + { + type: "ByteString", + value: "TlozcHFuYzFoTU44RUhXNTVabkNudThCMndvb1hKSEN5cg==" + }, + ] + }; + array = _1.NeonParser.parseRpcResponse(rpcResponse, { + type: 'Array', + generic: { + type: "Any", + union: [ + { + type: 'Integer' + }, + { + type: 'String', + hint: "Address" + } + ] + } + }); + assert.deepEqual(array, [10, 'NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs', 'NZ3pqnc1hMN8EHW55ZnCnu8B2wooXJHCyr']); + })); + (0, mocha_1.it)("Parse single type Map", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "Map", + value: [ + { + key: { + type: "ByteString", + value: _1.NeonParser.strToBase64("unit") + }, + value: { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + } + }, + { + key: { + type: "ByteString", + value: _1.NeonParser.strToBase64("neo") + }, + value: { + type: "ByteString", + value: _1.NeonParser.strToBase64("parser") + } + }, + ] + }; + let map = _1.NeonParser.parseRpcResponse(rpcResponse, { + type: 'Array', + genericKey: { type: 'String' }, genericItem: { type: "String" } + }); + assert.deepEqual(map, { unit: 'test', neo: 'parser' }); + })); + (0, mocha_1.it)("Parse multiple types Map", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + type: "Map", + value: [ + { + key: { + type: "ByteString", + value: _1.NeonParser.strToBase64("unit") + }, + value: { + type: "ByteString", + value: _1.NeonParser.strToBase64("test") + } + }, + { + key: { + type: "ByteString", + value: _1.NeonParser.strToBase64("neo") + }, + value: { + type: "Integer", + value: "123" + } + }, + ] + }; + let map = _1.NeonParser.parseRpcResponse(rpcResponse, { + type: 'Array', + genericKey: { type: 'String' }, genericItem: { type: "Any", union: [{ type: 'HASH256' }, { type: 'SIGNATURE' }] } + }); + assert.deepEqual(map, { unit: 'test', neo: 123 }); + })); + (0, mocha_1.it)("Parse Boolean", () => __awaiter(this, void 0, void 0, function* () { + let rpcResponse = { + "type": "Boolean", + "value": true + }; + let bool = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Boolean' }); + assert.deepEqual(bool, true); + rpcResponse.value = false; + bool = _1.NeonParser.parseRpcResponse(rpcResponse, { type: 'Boolean' }); + assert.deepEqual(bool, false); + })); +}); +//# sourceMappingURL=index.spec.js.map \ No newline at end of file diff --git a/packages/neon-parser/dist/index.spec.js.map b/packages/neon-parser/dist/index.spec.js.map new file mode 100644 index 0000000..8b18c8e --- /dev/null +++ b/packages/neon-parser/dist/index.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.spec.js","sourceRoot":"","sources":["../src/index.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,wBAA8B;AAC9B,iCAAkC;AAClC,iCAAiC;AAGjC,8CAA8C;AAC9C,wBAAwB;AAExB,6DAA6D;AAC7D,8IAA8I;AAC9I,kBAAkB;AAClB,OAAO;AAEP,wDAAwD;AACxD,0IAA0I;AAC1I,kBAAkB;AAClB,OAAO;AAEP,KAAK;AAEL,IAAA,gBAAQ,EAAC,kBAAkB,EAAE;IAE3B,IAAA,UAAE,EAAC,eAAe,EAAE,GAAS,EAAE;QAC7B,MAAM,WAAW,GAAG;YAClB,IAAI,EAAE,YAAY;YAClB,KAAK,EAAE,kDAAkD;SAC1D,CAAA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B,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAC,CAAC,CAAA;QACnE,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAE/B,CAAC,CAAA,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/packages/neon-parser/package.json b/packages/neon-parser/package.json index a78153a..92dee0e 100644 --- a/packages/neon-parser/package.json +++ b/packages/neon-parser/package.json @@ -2,21 +2,28 @@ "name": "@cityofzion/neon-parser", "version": "1.5.3", "license": "MIT", + "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ "/dist" ], "scripts": { - "build": "tsc" + "build": "tsc", + "lint": "eslint --fix", + "test": "ts-mocha src/**/*.spec.ts" }, "dependencies": { - "@cityofzion/neon-js": "^5.3.0", - "@cityofzion/neo3-parser": "1.5.2" + "@cityofzion/neo3-parser": "workspace:*", + "@cityofzion/neon-js": "^5.3.0" }, "devDependencies": { - "typescript": "^4.3.2", - "mocha": "^10.0.0" + "@types/node": "^18.14.6", + "@types/mocha": "^10.0.1", + "assert": "^2.0.0", + "mocha": "^10.0.0", + "ts-mocha": "^10.0.0", + "typescript": "^4.3.2" }, "repository": { "type": "git", diff --git a/packages/neon-parser/src/index.spec.js b/packages/neon-parser/src/index.spec.js deleted file mode 100644 index edc8875..0000000 --- a/packages/neon-parser/src/index.spec.js +++ /dev/null @@ -1,17 +0,0 @@ -const { NeonParser } = require('../dist/index') -const assert = require('assert') - -describe('Neon-Parser Tests', function () { - this.timeout(60000) - - it("converts Base64 to Hex and revert it", async () => { - assert.equal(NeonParser.reverseHex(NeonParser.base64ToHex('ateeXCdGd+AdYKWa5w8SikaAqlk=')), '59aa80468a120fe79aa5601de07746275c9ed76a') - return true - }) - - it("converts address to script hash", async () => { - assert.equal(NeonParser.accountInputToScripthash('NhGomBpYnKXArr55nHRQ5rzy79TwKVXZbr'), '857a247939db5c7cd3a7bb14791280c09e824bea') - return true - }) - -}) diff --git a/packages/neon-parser/src/index.spec.ts b/packages/neon-parser/src/index.spec.ts new file mode 100644 index 0000000..5a20d5e --- /dev/null +++ b/packages/neon-parser/src/index.spec.ts @@ -0,0 +1,478 @@ +import { NeonParser } from "." +import {describe, it} from "mocha" +import * as assert from "assert"; + + +describe("Neon-Parser Tests", function () { + this.timeout(60000) + + it("converts Base64 to Hex and revert it", async () => { + assert.equal(NeonParser.reverseHex(NeonParser.base64ToHex("ateeXCdGd+AdYKWa5w8SikaAqlk=")), "59aa80468a120fe79aa5601de07746275c9ed76a") + }) + + it("converts address to script hash", async () => { + assert.equal(NeonParser.accountInputToScripthash("NhGomBpYnKXArr55nHRQ5rzy79TwKVXZbr"), "857a247939db5c7cd3a7bb14791280c09e824bea") + }) + +}) + +describe("RPC Parser Tests", function () { + + it("Parse Address", async () => { + const rpcResponse = { + type: "ByteString", + value: NeonParser.asciiToBase64("NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs") + } + + const address = NeonParser.parseRpcResponse(rpcResponse, {type: "String", hint: "Address"}) + assert.deepEqual(address, "NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs") + }) + + it("Parse invalid Address", async () => { + const rpcResponse = { + type: "ByteString", + // Address will end up too short + value: NeonParser.hexToBase64("Nnnnnnnnnnnnnnnn") + } + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "String", hint: "Address"})) + + // Address will be too big + rpcResponse.value = NeonParser.strToBase64("NnnnnnnnnnnnnnnnNnnnnnnnnnnnnnnnNnnnnnnnnnnnnnnn") + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "String", hint: "Address"})) + + // Address shouldn't start with a letter that isn't 'A' or 'N' + rpcResponse.value = NeonParser.strToBase64("BNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs") + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "String", hint: "Address"})) + + // Address shouldn't have invalid base58 characters + rpcResponse.value = NeonParser.strToBase64("NNLI44dJNXtDNSBkofB48aTVYtb1zZrNEL") + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "String", hint: "Address"})) + }) + + it("Parse ScriptHash and ScriptHashLittleEndian", async () => { + const rpcResponse = { + type: "ByteString", + value: NeonParser.hexToBase64("61479ab68fd5c2c04b254f382d84ddf2f5c67ced") + } + + const scriptHash = NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHash"}) + assert.deepEqual(scriptHash, "0xed7cc6f5f2dd842d384f254bc0c2d58fb69a4761") + + const scriptHashLilEndian = NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHashLittleEndian"}) + assert.deepEqual(scriptHashLilEndian, "61479ab68fd5c2c04b254f382d84ddf2f5c67ced") + }) + + it("Parse invalid ScriptHash and ScriptHashLittleEndian", async () => { + const rpcResponse = { + type: "ByteString", + // ScriptHash will end up too short + value: NeonParser.hexToBase64("61479ab68fd5c2c04b25") + } + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHash"})) + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHashLittleEndian"})) + + // ScriptHash will be too big + rpcResponse.value = NeonParser.hexToBase64("61479ab68fd5c2c04b254f382d84ddf2f5c67ced111111111111") + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHash"})) + assert.throws(() => NeonParser.parseRpcResponse(rpcResponse, {type: "Hash160", hint: "ScriptHashLittleEndian"})) + }) + + it("Parse BlockHash or TransactionId", async () => { + const rpcResponse = { + type: "ByteString", + value: NeonParser.hexToBase64( + NeonParser.reverseHex("0x6c513de791b17ddadec205a07301229ac890d71c16c1d5a0320c655fb69214fc".substring(2)) + ) + } + + const blockHash = NeonParser.parseRpcResponse(rpcResponse, {type: "Hash256", hint: "BlockHash"}) + const transactionId = NeonParser.parseRpcResponse(rpcResponse, {type: "Hash256", hint: "TransactionId"}) + assert.deepEqual(transactionId, "0x6c513de791b17ddadec205a07301229ac890d71c16c1d5a0320c655fb69214fc") + assert.deepEqual(blockHash, transactionId) + + // There isn't a different on how they are returned right now + const hash256 = NeonParser.parseRpcResponse(rpcResponse, {type: "Hash256"}) + assert.deepEqual(hash256, blockHash) + }) + + it("Parse ByteString without parseConfig", async () => { + const rpcResponse = { + type: "ByteString", + value: NeonParser.asciiToBase64("Testing") + } + + const stringValue = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(stringValue, "Testing") + + const bytesValue = NeonParser.parseRpcResponse(rpcResponse, {type: 'ByteArray'}) + assert.deepEqual(bytesValue, "54657374696e67") + }) + + + it("Parse Integer", async () => { + const rpcResponse = { + type: "Integer", + value: "18" + } + + const integer = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(integer, 18) + }) + + it("Parse single type Array", async () => { + let rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "Integer", + value: "20" + }, + { + type: "Integer", + value: "30" + }, + ] + } + let array = NeonParser.parseRpcResponse(rpcResponse, {type: "Array", generic: { type: "Integer"} }) + assert.deepEqual(array, [10, 20, 30]) + + rpcResponse = { + type: "Array", + value: [ + { + type: "ByteString", + value: NeonParser.strToBase64("test") + }, + { + type: "ByteString", + value: NeonParser.strToBase64("array") + }, + { + type: "ByteString", + value: NeonParser.strToBase64("return") + }, + ] + } + array = NeonParser.parseRpcResponse(rpcResponse, {type: "Array", generic: { type: "String"} }) + assert.deepEqual(array, ["test", "array", "return"]) + + // Will also work if you don't send a parseConfig and expects the ByteString results to be a String + assert.deepEqual(array, NeonParser.parseRpcResponse(rpcResponse)) + + rpcResponse = { + type: "Array", + value: [ + { + type: "ByteString", + value: NeonParser.strToBase64("test") + }, + { + type: "ByteString", + value: NeonParser.strToBase64("array") + }, + { + type: "ByteString", + value: NeonParser.strToBase64("return") + }, + ] + } + array = NeonParser.parseRpcResponse(rpcResponse, {type: "Array", generic: { type: "ByteArray"} }) + assert.deepEqual(array, ["74657374", "6172726179", "72657475726e"]) + }) + + it("Parse Union", async () => { + let rpcResponse = { + type: "ByteString", + value: NeonParser.strToBase64("test") + } + let union = NeonParser.parseRpcResponse(rpcResponse, {type: "Any", union: [{ type: "String"}, {type: "Integer"}]}) + assert.deepEqual(union, "test") + + rpcResponse = { + type: "Integer", + value: "12" + } + union = NeonParser.parseRpcResponse(rpcResponse, {type: "Any", union: [{ type: "String"}, {type: "Integer"}]}) + assert.deepEqual(union, 12) + + rpcResponse = { + type: "ByteString", + value: NeonParser.hexToBase64("61479ab68fd5c2c04b254f382d84ddf2f5c67ced") + } + union = NeonParser.parseRpcResponse(rpcResponse, {type: "Any", union: [{ type: "Hash160", hint: "ScriptHash"}, {type: "Integer"}]}) + assert.deepEqual(union, "0xed7cc6f5f2dd842d384f254bc0c2d58fb69a4761") + }) + + it("Try parse same internal types with Union", async () => { + let rpcResponse = { + type: "ByteString", + value: NeonParser.strToBase64("test") + } + + // It's not possible to definitly know the correct return of the same internal type, currently, it's only a ByteString problem, + // so whenever there are multiple ByteStrings on a union it will be considerer as a String + const str = NeonParser.parseRpcResponse(rpcResponse, {type: "Any", union: [{ type: "Hash160", hint: "ScriptHash" }, { type: "Hash256", hint: "BlockHash"}, {type: "Integer"}]}) + assert.deepEqual(str, "test") + }) + + it("Parse multiple types Array", async () => { + let rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "ByteString", + value: NeonParser.strToBase64("test") + }, + { + type: "ByteString", + value: NeonParser.strToBase64("parser") + }, + ] + } + let array = NeonParser.parseRpcResponse(rpcResponse, + { + type: "Array", + generic: { + type: "Any", + union: [ + { + type: "Integer" + }, + { + type: "String"} + ] + } + } + ) + assert.deepEqual(array, [10, "test", "parser"]) + + rpcResponse = { + type: "Array", + value: [ + { + type: "Integer", + value: "10" + }, + { + type: "ByteString", + value: "Tk5MaTQ0ZEpOWHRETlNCa29mQjQ4YVRWWXRiMXpack5Fcw" + }, + { + type: "ByteString", + value: "TlozcHFuYzFoTU44RUhXNTVabkNudThCMndvb1hKSEN5cg==" + }, + ] + } + array = NeonParser.parseRpcResponse(rpcResponse, + { + type: "Array", + generic: { + type: "Any", + union: [ + { + type: "Integer" + }, + { + type: "String", + hint: "Address" + } + ] + } + } + ) + assert.deepEqual(array, [10, "NNLi44dJNXtDNSBkofB48aTVYtb1zZrNEs", "NZ3pqnc1hMN8EHW55ZnCnu8B2wooXJHCyr"]) + }) + + it("Parse single type Map", async () => { + let rpcResponse = { + type: "Map", + value: [ + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("unit") + }, + value: { + type: "ByteString", + value: NeonParser.strToBase64("test") + } + }, + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("neo") + }, + value: { + type: "ByteString", + value: NeonParser.strToBase64("parser") + } + }, + ] + } + let map = NeonParser.parseRpcResponse(rpcResponse, + { + type: "Map", + genericKey: { type: "String" }, genericItem: { type: "String" } + } + ) + assert.deepEqual(map, { unit: "test", neo: "parser" }) + // Will also work if you don't send a parseConfig and expects the ByteString results to be a String + assert.deepEqual(map, NeonParser.parseRpcResponse(rpcResponse)) + }) + + it("Parse multiple types Map", async () => { + let rpcResponse = { + type: "Map", + value: [ + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("unit") + }, + value: { + type: "ByteString", + value: NeonParser.strToBase64("test") + } + }, + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("neo") + }, + value: { + type: "Integer", + value: "123" + } + }, + { + key: { + type: "Integer", + value: "789" + }, + value: { + type: "Integer", + value: "123" + } + }, + ] + } + let map = NeonParser.parseRpcResponse(rpcResponse, + { + type: "Map", + genericKey: { type: "Any", union:[ { type: "String" }, { type: "Integer" } ] }, + genericItem: { type: "Any", union:[ { type: "String" }, { type: "Integer" } ] } + } + ) + assert.deepEqual(map, { unit: "test", neo: 123 , 789: 123 }) + }) + + it("Parse Boolean", async () => { + let rpcResponse = { + "type": "Boolean", + "value": true + } + + let bool = NeonParser.parseRpcResponse(rpcResponse, { type: "Boolean"}) + assert.deepEqual(bool, true) + bool = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(bool, true) + + rpcResponse.value = false + bool = NeonParser.parseRpcResponse(rpcResponse, { type: "Boolean"}) + assert.deepEqual(bool, false) + bool = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(bool, false) + }) + + it("Parse Iterator", async () => { + let rpcResponse = { + "type": "InteropInterface", + "interface": "IIterator", + "id": "e93e82f7-629b-4b4b-9fae-054d18bd32e2" + } + + // currently can't parse an iterator + const iterator = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(iterator, undefined) + }) + + it("Parse Array inside Map", async () => { + const rpcResponse = { + type: "Map", + value: [ + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("test") + }, + value: { + type: "Array", + value: [ + { type: "ByteString", value: NeonParser.strToBase64("abc") }, + { type: "ByteString", value: NeonParser.strToBase64("def") }, + { type: "ByteString", value: NeonParser.strToBase64("ghi") }, + ] + } + }, + { + key: { + type: "ByteString", + value: NeonParser.strToBase64("neo") + }, + value: { + type: "Integer", + value: "123" + } + }, + ] + } + + const map = NeonParser.parseRpcResponse(rpcResponse) + assert.deepEqual(map, {test: ['abc', 'def', 'ghi'], neo: 123}) + + const mapWithConfig = NeonParser.parseRpcResponse(rpcResponse, + { + type: 'Map', + genericKey: { type: 'String' }, + genericItem: { type: 'Any', union: [ {type: 'Integer'}, { type: 'Array', generic: {type: 'ByteArray'} }]} + } + ) + assert.deepEqual(mapWithConfig, {test: ['616263', '646566', '676869'], neo: 123}) + }) + + it("Parse Map inside Array", async () => { + const rpcResponseArray = { + type: "Array", + value: [ + { type: "ByteString", value: NeonParser.strToBase64("abc") }, + { type: "Map", value: [ + { + key: { type: 'ByteString', value: NeonParser.strToBase64("neon") }, + value: { type: 'ByteString', value: NeonParser.strToBase64("parser") }, + }, + { + key: { type: 'ByteString', value: NeonParser.strToBase64("unit") }, + value: { type: 'ByteString', value: NeonParser.strToBase64("test") }, + }, + ] }, + { type: "ByteString", value: NeonParser.strToBase64("def") }, + ] + } + let array = NeonParser.parseRpcResponse(rpcResponseArray) + assert.deepEqual(array, ['abc', { neon: 'parser', unit: 'test' }, 'def']) + + array = NeonParser.parseRpcResponse(rpcResponseArray, { + type: 'Array', + generic: {type: 'Any', union: [ {type: 'String'}, {type: 'Map', genericKey: {type: 'String'}, genericItem: {type: 'ByteArray'}} ]} + }) + assert.deepEqual(array, ['abc', { neon: '706172736572', unit: '74657374' }, 'def']) + }) +}) diff --git a/packages/neon-parser/src/index.ts b/packages/neon-parser/src/index.ts index 72a12d1..880854e 100644 --- a/packages/neon-parser/src/index.ts +++ b/packages/neon-parser/src/index.ts @@ -1,6 +1,10 @@ -import { Neo3Parser, ParseConfig } from '@cityofzion/neo3-parser' +import { + Neo3Parser, ParseConfig, RpcResponse, + ABI_TYPES, HINT_TYPES +} from '@cityofzion/neo3-parser/src' import { u, wallet } from '@cityofzion/neon-js' + export const NeonParser: Neo3Parser = { abToHexstring(arr: ArrayBuffer | ArrayLike): string { return u.ab2hexstring(arr) @@ -56,40 +60,100 @@ export const NeonParser: Neo3Parser = { asciiToBase64(input: string): string { return u.HexString.fromAscii(input).toBase64() }, - parseRpcResponse(field: any, parseConfig?: ParseConfig): any { - switch (field.type) { - case "ByteString": - const rawValue = NeonParser.base64ToHex(field.value) - if (rawValue.length === 40 && parseConfig?.ByteStringToScriptHash) { - return `0x${NeonParser.reverseHex(rawValue)}` - } - const asStr = NeonParser.hexstringToStr(rawValue) - try { - return JSON.parse(asStr) - } catch (e) { - return asStr - } - case "Integer": - return parseInt(field.value) - case "Array": - return field.value.map( (f: any) => { - return NeonParser.parseRpcResponse(f, parseConfig) + parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig): any { + verifyParseConfigUnion(field, parseConfig) + + switch (field.type?.toUpperCase()) { + case "BYTESTRING": + return parseByteString(field, parseConfig) + case "INTEGER": + return parseInt(field.value as string) + case "ARRAY": + return (field.value as RpcResponse[]).map( (f: any) => { + return NeonParser.parseRpcResponse(f, parseConfig?.generic) }) - case "Map": + case "MAP": const object: { [key: string]: any - } = {} - field.value.forEach((f: any) => { - let key: string = NeonParser.parseRpcResponse(f.key, parseConfig) - object[key] = NeonParser.parseRpcResponse(f.value, parseConfig) + } = {}; + + (field.value as RpcResponse[]).forEach((f: any) => { + let key: string = NeonParser.parseRpcResponse(f.key, parseConfig?.genericKey) + object[key] = NeonParser.parseRpcResponse(f.value, parseConfig?.genericItem) }) return object + + // Another method should take care of this parse + case "INTEROPINTERFACE": + return default: try { - return JSON.parse(field.value) + return JSON.parse(field.value as string) } catch (e) { return field.value } } } } + +function verifyParseConfigUnion(field: RpcResponse, parseConfig?: ParseConfig) { + + if (parseConfig?.union){ + const configs = parseConfig?.union.filter( (config) => { + return ABI_TYPES[config.type.toUpperCase()].internal.toUpperCase() === field.type.toUpperCase() + }) + + if (configs.length > 0){ + if (field.type.toUpperCase() === "Array".toUpperCase()){ + parseConfig.generic = configs[0].generic + }else if (field.type.toUpperCase() === "Map".toUpperCase()) { + parseConfig.genericItem = configs[0].genericItem + parseConfig.genericKey = configs[0].genericKey + }else if (field.type.toUpperCase() === "ByteString".toUpperCase()) { + if (configs.length === 1){ + Object.assign(parseConfig, configs[0]) + } else{ + parseConfig.type = 'String' + } + }else{ + Object.assign(parseConfig, configs[0]) + } + } + } +} + +function parseByteString({value}: RpcResponse, parseConfig?: ParseConfig) { + const valueToParse = value as string + + const rawValue = NeonParser.base64ToHex(valueToParse) + + if (parseConfig?.type.toUpperCase() === ABI_TYPES.BYTEARRAY.name.toUpperCase()){ + return rawValue + } + + if (parseConfig?.type.toUpperCase() === ABI_TYPES.HASH160.name.toUpperCase()) { + if (rawValue.length !== 40) throw new TypeError(`${rawValue} is not a ${ABI_TYPES.HASH160.name}`) + + return parseConfig?.hint?.toUpperCase() === HINT_TYPES.SCRIPTHASHLITTLEENDING.name.toUpperCase() + ? rawValue : `0x${NeonParser.reverseHex(rawValue)}` + } + + if (parseConfig?.type.toUpperCase() === ABI_TYPES.HASH256.name.toUpperCase()) { + if (rawValue.length !== 64) throw new TypeError(`${rawValue} is not a ${ABI_TYPES.HASH256.name}`) + + return `0x${NeonParser.reverseHex(rawValue)}` + } + + const stringValue = NeonParser.base64ToUtf8(valueToParse) + + if (parseConfig?.hint?.toUpperCase() === HINT_TYPES.ADDRESS.name.toUpperCase() && + ( + stringValue.length !== 34 || + (!stringValue.startsWith("N") && !stringValue.startsWith("A") ) || + !stringValue.match(/^[A-HJ-NP-Za-km-z1-9]*$/) // check base58 chars + ) + ){ + throw new TypeError(`${valueToParse} is not an ${HINT_TYPES.ADDRESS.name}`) + } + return stringValue +} diff --git a/packages/neon-parser/tsconfig.json b/packages/neon-parser/tsconfig.json index a449398..a4c2b62 100644 --- a/packages/neon-parser/tsconfig.json +++ b/packages/neon-parser/tsconfig.json @@ -1,7 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "./dist" + "outDir": "./dist", + "sourceMap": true }, "include": [ "src" From e08732032a689ab8064a86675818734ba9547340 Mon Sep 17 00:00:00 2001 From: luc10921 Date: Thu, 16 Mar 2023 16:22:42 -0300 Subject: [PATCH 2/2] CR - changed grammar mistakes on README --- packages/neo3-parser/README.MD | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/neo3-parser/README.MD b/packages/neo3-parser/README.MD index 32d5342..4331713 100644 --- a/packages/neo3-parser/README.MD +++ b/packages/neo3-parser/README.MD @@ -17,7 +17,7 @@ Visit the [main page](../../README.md) of the project. ## How to parse responses -After invoking a contract you'll get the results on a stack. Use the `parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig)` function on each item to get the results parsed. +After invoking a contract you'll get the results on a stack. Use the `parseRpcResponse(field: RpcResponse, parseConfig?: ParseConfig)` function on each result of the stack to get the results parsed. ### How to use parseConfig @@ -46,19 +46,19 @@ const stackResult = [ ] // Call parseRpcResponse on an item of the stack -const response = Neo3Parser.parseRpcResponde(stackResult[0]) +const response = Neo3Parser.parseRpcResponse(stackResult[0]) console.log(response) // Expected output: "☺☻♥♦♣♠\n♫☼►◄↕‼" // You can use the `parseConfig` parameter to change how to parse the response -const responseHash160 = Neo3Parser.parseRpcResponde(stackResult[0], { type: "Hash160"}) +const responseHash160 = Neo3Parser.parseRpcResponse(stackResult[0], { type: "Hash160"}) console.log(responseHash160) // Expected output: "0x131211100f0e0d0c0b0a09080706050403020100" // Adding a hint might also change how it is parsed -const responseHash160LE = Neo3Parser.parseRpcResponde(stackResult[0], { type: "Hash160", hint: "ScriptHashLittleEndian"}) +const responseHash160LE = Neo3Parser.parseRpcResponse(stackResult[0], { type: "Hash160", hint: "ScriptHashLittleEndian"}) console.log(responseHash160LE) // Expected output: "000102030405060708090a0b0c0d0e0f10111213" @@ -109,7 +109,7 @@ const parseConfigFromNeo3boa = { "hint": "ScriptHashLittleEndian" } -const responseHash160LE = Neo3Parser.parseRpcResponde(stackResult[0], parseConfigFromNeo3boa) +const responseHash160LE = Neo3Parser.parseRpcResponse(stackResult[0], parseConfigFromNeo3boa) console.log(responseHash160LE) // Expected output: "000102030405060708090a0b0c0d0e0f10111213"