-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from CityOfZion/CU-86a0uktwy
CU-86a0uktwy - Move typeChecker to neon-dappkit-types
- Loading branch information
Showing
82 changed files
with
708 additions
and
327 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@cityofzion/neon-dappkit-types/CU-86a0uktwy_2023-09-26-18-42.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
10 changes: 10 additions & 0 deletions
10
common/changes/@cityofzion/neon-dappkit/CU-86a0uktwy_2023-09-26-18-42.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.