Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CU-86a0uktwy - Move typeChecker to neon-dappkit-types #16

Merged
merged 3 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/neon-dappkit-types",
"comment": "Add TypeChecker",
"type": "minor"
}
],
"packageName": "@cityofzion/neon-dappkit-types"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@cityofzion/neon-dappkit",
"comment": "Remove typeChecker.ts file; import new TypeChecker from neon-dappkit-types",
"type": "minor"
}
],
"packageName": "@cityofzion/neon-dappkit"
}
15 changes: 15 additions & 0 deletions packages/neon-dappkit-types/dist/TypeChecker.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { AnyArgType, BooleanArgType, IntegerArgType, ArrayResponseArgType, MapResponseArgType, ByteStringArgType, InteropInterfaceArgType, PointerArgType, BufferArgType, StructArgType, RpcResponseStackItem } from './Neo3Invoker';
declare const TypeChecker: {
isStackTypeAny(item: any): item is AnyArgType;
isStackTypeBoolean(item: any): item is BooleanArgType;
isStackTypeInteger(item: any): item is IntegerArgType;
isStackTypeArray(item: any): item is ArrayResponseArgType;
isStackTypeMap(item: any): item is MapResponseArgType;
isStackTypeByteString(item: any): item is ByteStringArgType;
isStackTypeInteropInterface(item: any): item is InteropInterfaceArgType;
isStackTypePointer(item: any): item is PointerArgType;
isStackTypeBuffer(item: any): item is BufferArgType;
isStackTypeStruct(item: any): item is StructArgType;
isRpcResponseStackItem(item: any): item is RpcResponseStackItem;
};
export { TypeChecker };
60 changes: 60 additions & 0 deletions packages/neon-dappkit-types/dist/TypeChecker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TypeChecker = void 0;
const TypeChecker = {
isStackTypeAny(item) {
return typeof item === 'object' && item.type === 'Any';
},
isStackTypeBoolean(item) {
return typeof item === 'object' && item.type === 'Boolean' && typeof item.value === 'boolean';
},
isStackTypeInteger(item) {
return typeof item === 'object' && item.type === 'Integer' && typeof item.value === 'string';
},
isStackTypeArray(item) {
return (typeof item === 'object' &&
item.type === 'Array' &&
Array.isArray(item.value) &&
item.value.every((i) => TypeChecker.isRpcResponseStackItem(i)));
},
isStackTypeMap(item) {
return (typeof item === 'object' &&
item.type === 'Map' &&
Array.isArray(item.value) &&
item.value.every((i) => TypeChecker.isRpcResponseStackItem(i.key) && TypeChecker.isRpcResponseStackItem(i.value)));
},
isStackTypeByteString(item) {
return typeof item === 'object' && item.type === 'ByteString' && typeof item.value === 'string';
},
isStackTypeInteropInterface(item) {
return (typeof item === 'object' &&
item.type === 'InteropInterface' &&
typeof item.interface === 'string' &&
typeof item.id === 'string');
},
isStackTypePointer(item) {
return typeof item === 'object' && item.type === 'Pointer' && typeof item.value === 'string';
},
isStackTypeBuffer(item) {
return typeof item === 'object' && item.type === 'Buffer' && typeof item.value === 'string';
},
isStackTypeStruct(item) {
return (typeof item === 'object' &&
item.type === 'Struct' &&
Array.isArray(item.value) &&
item.value.every((i) => TypeChecker.isRpcResponseStackItem(i)));
},
isRpcResponseStackItem(item) {
return (TypeChecker.isStackTypeAny(item) ||
TypeChecker.isStackTypeBoolean(item) ||
TypeChecker.isStackTypeInteger(item) ||
TypeChecker.isStackTypeArray(item) ||
TypeChecker.isStackTypeMap(item) ||
TypeChecker.isStackTypeByteString(item) ||
TypeChecker.isStackTypeInteropInterface(item) ||
TypeChecker.isStackTypePointer(item) ||
TypeChecker.isStackTypeBuffer(item) ||
TypeChecker.isStackTypeStruct(item));
},
};
exports.TypeChecker = TypeChecker;
1 change: 1 addition & 0 deletions packages/neon-dappkit-types/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './Neo3EventListener';
export * from './Neo3Invoker';
export * from './Neo3Parser';
export * from './Neo3Signer';
export * from './TypeChecker';
1 change: 1 addition & 0 deletions packages/neon-dappkit-types/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ __exportStar(require("./Neo3EventListener"), exports);
__exportStar(require("./Neo3Invoker"), exports);
__exportStar(require("./Neo3Parser"), exports);
__exportStar(require("./Neo3Signer"), exports);
__exportStar(require("./TypeChecker"), exports);
2 changes: 1 addition & 1 deletion packages/neon-dappkit-types/docs/assets/search.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ <h1>Enumeration SignMessageVersion</h1></div>
<div class="tsd-comment tsd-typography"><p>A version enum that indicates how a message should be signed</p>
</div></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Signer.ts#L4">Neo3Signer.ts:4</a></li></ul></aside>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Signer.ts#L4">Neo3Signer.ts:4</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand All @@ -37,17 +37,17 @@ <h2>Enumeration Members</h2>
<h3 class="tsd-anchor-link"><span>CLASSIC</span><a href="#CLASSIC" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
<div class="tsd-signature">CLASSIC<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">1</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Signer.ts#L5">Neo3Signer.ts:5</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Signer.ts#L5">Neo3Signer.ts:5</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="DEFAULT" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>DEFAULT</span><a href="#DEFAULT" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">DEFAULT<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">2</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Signer.ts#L6">Neo3Signer.ts:6</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Signer.ts#L6">Neo3Signer.ts:6</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-enum-member tsd-parent-kind-enum"><a id="WITHOUT_SALT" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>WITHOUT_<wbr/>SALT</span><a href="#WITHOUT_SALT" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">WITHOUT_<wbr/>SALT<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">3</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Signer.ts#L7">Neo3Signer.ts:7</a></li></ul></aside></section></section></div>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Signer.ts#L7">Neo3Signer.ts:7</a></li></ul></aside></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
3 changes: 2 additions & 1 deletion packages/neon-dappkit-types/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.9389
<li class="tsd-kind-type-alias"><a href="types/WitnessCondition.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Witness<wbr/>Condition</a></li>
<li class="tsd-kind-variable"><a href="variables/ABI_TYPES.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-32-path"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)" id="icon-32-text"></path></svg>ABI_<wbr/>TYPES</a></li>
<li class="tsd-kind-variable"><a href="variables/HINT_TYPES.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-32-path"></use><use href="#icon-32-text"></use></svg>HINT_<wbr/>TYPES</a></li>
<li class="tsd-kind-variable"><a href="variables/INTERNAL_TYPES.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-32-path"></use><use href="#icon-32-text"></use></svg>INTERNAL_<wbr/>TYPES</a></li></ul></nav></div></div>
<li class="tsd-kind-variable"><a href="variables/INTERNAL_TYPES.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-32-path"></use><use href="#icon-32-text"></use></svg>INTERNAL_<wbr/>TYPES</a></li>
<li class="tsd-kind-variable"><a href="variables/TypeChecker.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-32-path"></use><use href="#icon-32-text"></use></svg>Type<wbr/>Checker</a></li></ul></nav></div></div>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">AndWitnessCondition</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L11">Neo3Invoker.ts:11</a></li></ul></aside>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L11">Neo3Invoker.ts:11</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand All @@ -37,12 +37,12 @@ <h2>Properties</h2>
<h3 class="tsd-anchor-link"><span>expressions</span><a href="#expressions" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
<div class="tsd-signature">expressions<span class="tsd-signature-symbol">:</span> <a href="../types/WitnessCondition.html" class="tsd-signature-type" data-tsd-kind="Type alias">WitnessCondition</a><span class="tsd-signature-symbol">[]</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L13">Neo3Invoker.ts:13</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L13">Neo3Invoker.ts:13</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="type" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>type</span><a href="#type" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;And&quot;</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L12">Neo3Invoker.ts:12</a></li></ul></aside></section></section></div>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L12">Neo3Invoker.ts:12</a></li></ul></aside></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h4>Hierarchy</h4>
<ul class="tsd-hierarchy">
<li><span class="target">BooleanWitnessCondition</span></li></ul></section><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L1">Neo3Invoker.ts:1</a></li></ul></aside>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L1">Neo3Invoker.ts:1</a></li></ul></aside>
<section class="tsd-panel-group tsd-index-group">
<section class="tsd-panel tsd-index-panel">
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
Expand All @@ -37,12 +37,12 @@ <h2>Properties</h2>
<h3 class="tsd-anchor-link"><span>expression</span><a href="#expression" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none" id="icon-anchor-a"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5" id="icon-anchor-b"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5" id="icon-anchor-c"></path></svg></a></h3>
<div class="tsd-signature">expression<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L3">Neo3Invoker.ts:3</a></li></ul></aside></section>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L3">Neo3Invoker.ts:3</a></li></ul></aside></section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-interface"><a id="type" class="tsd-anchor"></a>
<h3 class="tsd-anchor-link"><span>type</span><a href="#type" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
<div class="tsd-signature">type<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">&quot;Boolean&quot;</span></div><aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82982a3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L2">Neo3Invoker.ts:2</a></li></ul></aside></section></section></div>
<li>Defined in <a href="https://github.com/CityOfZion/neon-dappkit/blob/82b93e3/packages/neon-dappkit-types/src/Neo3Invoker.ts#L2">Neo3Invoker.ts:2</a></li></ul></aside></section></section></div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<div class="tsd-navigation settings">
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
Expand Down
Loading