Comparing version 0.3.1 to 0.3.2
@@ -55,2 +55,38 @@ exports['DumbContract should snapshot generated code 1'] = ` | ||
constant: true, | ||
inputs: [{ name: "offset", type: "int256" }], | ||
name: "returnSigned", | ||
outputs: [{ name: "", type: "int256" }], | ||
payable: false, | ||
stateMutability: "pure", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [{ name: "boolParam", type: "bool" }], | ||
name: "callWithBoolean", | ||
outputs: [{ name: "", type: "bool" }], | ||
payable: false, | ||
stateMutability: "pure", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [{ name: "arrayParam", type: "uint256[]" }], | ||
name: "callWithArray2", | ||
outputs: [{ name: "", type: "uint256[]" }], | ||
payable: false, | ||
stateMutability: "pure", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [{ name: "a", type: "address" }], | ||
name: "testAddress", | ||
outputs: [{ name: "", type: "address" }], | ||
payable: false, | ||
stateMutability: "pure", | ||
type: "function", | ||
}, | ||
{ | ||
constant: true, | ||
inputs: [], | ||
@@ -64,6 +100,15 @@ name: "counter", | ||
{ | ||
constant: true, | ||
inputs: [{ name: "a", type: "string" }], | ||
name: "testString", | ||
outputs: [{ name: "", type: "string" }], | ||
payable: false, | ||
stateMutability: "pure", | ||
type: "function", | ||
}, | ||
{ | ||
constant: false, | ||
inputs: [{ name: "byteParam", type: "bytes32" }], | ||
name: "callWithBytes", | ||
outputs: [{ name: "", type: "bool" }], | ||
outputs: [{ name: "", type: "bytes32" }], | ||
payable: false, | ||
@@ -182,2 +227,24 @@ stateMutability: "nonpayable", | ||
public returnSigned(offset: BigNumber | number): Promise<BigNumber> { | ||
return TC.promisify(this.rawWeb3Contract.returnSigned, [offset.toString()]); | ||
} | ||
public callWithBoolean(boolParam: boolean): Promise<boolean> { | ||
return TC.promisify(this.rawWeb3Contract.callWithBoolean, [boolParam.toString()]); | ||
} | ||
public callWithArray2(arrayParam: BigNumber[]): Promise<BigNumber[]> { | ||
return TC.promisify(this.rawWeb3Contract.callWithArray2, [ | ||
arrayParam.map(val => val.toString()), | ||
]); | ||
} | ||
public testAddress(a: BigNumber | string): Promise<string> { | ||
return TC.promisify(this.rawWeb3Contract.testAddress, [a.toString()]); | ||
} | ||
public testString(a: string): Promise<string> { | ||
return TC.promisify(this.rawWeb3Contract.testString, [a.toString()]); | ||
} | ||
public counterArray(arg0: BigNumber | number): Promise<BigNumber> { | ||
@@ -184,0 +251,0 @@ return TC.promisify(this.rawWeb3Contract.counterArray, [arg0.toString()]); |
import { TsGeneratorPlugin, TFileDesc, TContext, TOutput } from "ts-generator"; | ||
export declare type TTypechainTarget = "truffle" | "legacy"; | ||
export declare type TTypechainTarget = "truffle" | "web3-1.0.0" | "legacy"; | ||
export interface ITypechainCfg { | ||
@@ -4,0 +4,0 @@ target: TTypechainTarget; |
@@ -6,2 +6,3 @@ "use strict"; | ||
const truffle_1 = require("./targets/truffle"); | ||
const web3_1 = require("./targets/web3"); | ||
/** | ||
@@ -17,3 +18,3 @@ * Proxies calls to real implementation that is selected based on target parameter. | ||
findRealImpl(ctx) { | ||
switch (this.ctx.rawConfig.target) { | ||
switch (ctx.rawConfig.target) { | ||
case "legacy": | ||
@@ -23,2 +24,4 @@ return new legacy_1.TypechainLegacy(ctx); | ||
return new truffle_1.Truffle(ctx); | ||
case "web3-1.0.0": | ||
return new web3_1.Web3(ctx); | ||
default: | ||
@@ -25,0 +28,0 @@ throw new Error(`Unsupported target ${this.ctx.rawConfig.target}!`); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"license": "MIT", | ||
@@ -49,3 +49,3 @@ "repository": "https://github.com/Neufund/Typechain", | ||
"typestrict": "^0.0.6", | ||
"web3": "0.20.2", | ||
"web3": "0.20.x", | ||
"web3-typescript-typings": "^0.7.2" | ||
@@ -59,6 +59,2 @@ }, | ||
}, | ||
"peerDependencies": { | ||
"bignumber.js": "^5.0.0", | ||
"web3": "0.20.x" | ||
}, | ||
"scripts": { | ||
@@ -79,3 +75,3 @@ "prepare": "patch-package && yarn build", | ||
"test:fix": "yarn lint:fix && ./scripts/test.sh", | ||
"test:mocha": "NODE_ENV=test mocha --require ts-node/register.js --require test/setup-chai.ts --require 'test/integration/before.ts' 'test/integration/web3.ts' './**/*.spec.ts'", | ||
"test:mocha": "TS_NODE_IGNORE=\"/test/integration/targets/web3-1.0.0/\" mocha --require ts-node/register.js --require test/setup-chai.ts --require 'test/integration/before.ts' 'test/integration/web3.ts' './**/*.spec.ts'", | ||
"test:mocha:coverage": "NODE_ENV=test nyc mocha --require ts-node/register.js --require source-map-support/register --require test/setup-chai.ts --require 'test/integration/before.ts' 'test/integration/web3.ts' './**/*.spec.ts'", | ||
@@ -82,0 +78,0 @@ "coveralls": "nyc report --reporter=text-lcov | coveralls" |
@@ -27,3 +27,3 @@ <p align="center"> | ||
* IDE support - works with any IDE supporting Typescript | ||
* works with multiple libraries - use `truffle` or `Web3.js 0.20.x`, `Web3.js 1.0` support coming soon | ||
* works with multiple libraries - use `truffle`,`Web3.js 1.0`, `Web3.js 0.20.x` | ||
* frictionless - works with simple, JSON ABI files as well as with Truffle style ABIs | ||
@@ -46,3 +46,3 @@ | ||
``` | ||
typechain --target=(truffle|legacy) [glob] | ||
typechain --target=(truffle|web3-1.0.0|legacy) [glob] | ||
``` | ||
@@ -52,3 +52,3 @@ | ||
"**/*.json"` | ||
* `--target` - `truffle` or `legacy` | ||
* `--target` - `truffle`, `web3-1.0.0` or `legacy` | ||
* `--outDir` - put all generated files to a specific dir | ||
@@ -103,3 +103,3 @@ | ||
interface for interacting with blockchain. Depending on the target parameter it can generate typings for | ||
truffle or web3.js 0.20.x. | ||
truffle, web3 1.0.0 or web3 0.20.x (legacy target). | ||
@@ -127,4 +127,8 @@ ### Step by step guide | ||
### Legacy | ||
### Web3-1.0.0 | ||
Generates typings for contracts compatible with latest Web3.js version. It requires official typings from `@types/web3` installed. For now it needs explicit cast as shown [here](https://github.com/krzkaczor/TypeChain/pull/88/files#diff-540a9b8840419be93ddb8d4b53325637R8), this will be fixed after improving official typings. | ||
### Legacy (Web3 0.2.x) | ||
This was default and only target for typechain 0.2.x. It requires `Web3.js 0.20.x` to be installed in your project and it generates promise based wrappers. It's nice upgrade comparing to raw callbacks but in the near future Typechain will support `Web3js 1.0` target. | ||
@@ -131,0 +135,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
419189
4
61
2230
193
0