Skip to content
Open
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
2 changes: 1 addition & 1 deletion library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion library/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@augurproject/solidity-typescript-generator",
"version": "1.1.6",
"version": "1.1.8",
"description": "Takes in a solidity file and generates a set of TypeScript classes for interacting with the contract.",
"main": "output/index.js",
"scripts": {
Expand Down
8 changes: 6 additions & 2 deletions library/source/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keccak256 } from 'js-sha3'

type Primitive = 'uint8' | 'uint64' | 'uint256' | 'bool' | 'string' | 'address' | 'bytes4' | 'bytes20' | 'bytes32' | 'bytes' | 'bytes[]' | 'int256' | 'tuple' | 'address[]' | 'uint8[]' | 'uint256[]' | 'int256[]' | 'bytes32[]' | 'tuple[]'
type Primitive = 'uint8' | 'uint64' | 'uint128' | 'uint256' | 'bool' | 'string' | 'address' | 'bytes4' | 'bytes20' | 'bytes32' | 'bytes' | 'bytes[]' | 'int256' | 'tuple' | 'address[]' | 'uint8[]' | 'uint256[]' | 'int256[]' | 'bytes32[]' | 'tuple[]' | 'bool[]'

interface AbiParameter {
name: string,
Expand Down Expand Up @@ -70,7 +70,7 @@ export function generateContractInterfaces(contractsOutput: CompilerOutput): str

return `// THIS FILE IS AUTOMATICALLY GENERATED BY \`generateContractInterfaces.ts\`. DO NOT EDIT BY HAND'

export type Primitive = 'uint8' | 'uint64' | 'uint256' | 'bool' | 'string' | 'address' | 'bytes4' | 'bytes20' | 'bytes32' | 'bytes' | 'bytes[]' | 'int256' | 'tuple' | 'address[]' | 'uint8[]' | 'uint256[]' | 'int256[]' | 'bytes32[]' | 'tuple[]'
export type Primitive = 'uint8' | 'uint64' | 'uint128' | 'uint256' | 'bool' | 'string' | 'address' | 'bytes4' | 'bytes20' | 'bytes32' | 'bytes' | 'bytes[]' | 'int256' | 'tuple' | 'address[]' | 'uint8[]' | 'uint256[]' | 'int256[]' | 'bytes32[]' | 'tuple[]' | 'bool[]'

export interface AbiParameter {
name: string
Expand Down Expand Up @@ -356,6 +356,7 @@ function toTsTypeString(abiParameter: AbiParameter, errorContext: { contractName
switch(abiParameter.type) {
case 'uint8':
case 'uint64':
case 'uint128':
case 'uint256':
case 'int256': {
return 'TBigNumber'
Expand All @@ -371,6 +372,9 @@ function toTsTypeString(abiParameter: AbiParameter, errorContext: { contractName
case 'bool': {
return 'boolean'
}
case 'bool[]': {
return 'Array<boolean>'
}
case 'tuple': {
return `{ ${abiParameter.components!.map(component => `${component.name}: ${toTsTypeString(component, errorContext)}`).join(', ')} }`
}
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1