Skip to content
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
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

93 changes: 0 additions & 93 deletions .eslintrc

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ jobs:
PIPELINE_WORKSPACE: workspace
run: |
set -xev
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:2.5
docker images
Expand Down
8 changes: 6 additions & 2 deletions apis/fabric-contract-api/.npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
test
fabric-contract-api*.tgz
# Exclude everything except specific inclusions below
**/*

!lib/**/*
!schema/**/*
!types/**/*
11 changes: 7 additions & 4 deletions apis/fabric-contract-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"buildt": "tsc --project test/typescript",
"test": "nyc mocha --recursive 'test/unit/**/*.js'",
"build": "npm run lint && npm run test:unit && npm run test:schema",
"lint": "eslint ./lib ./types ./test/typescript/*.ts --ext .js --ext .ts",
"lint": "eslint ./lib ./types ./test/typescript/*.ts",
"test:unit": "npm run test",
"test:schema": "ajv compile -s ./schema/contract-schema.json && ajv validate -s ./schema/contract-schema.json -d ./schema/example-full.json"
},
Expand Down Expand Up @@ -46,7 +46,7 @@
},
"dependencies": {
"fabric-shim-api": "2.5.9",
"class-transformer": "^0.4.0",
"class-transformer": "^0.5.1",
"fast-safe-stringify": "^2.1.1",
"get-params": "^0.1.2",
"reflect-metadata": "^0.1.13",
Expand All @@ -59,14 +59,17 @@
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-things": "^0.2.0",
"eslint": "^6.6.0",
"eslint": "^9.37.0",
"gulp": "^4.0.2",
"gulp-debug": "~4.0.0",
"gulp-eslint": "~6.0.0",
"mocha": "9.1.3",
"nyc": "15.1.0",
"rewire": "6.0.0",
"sinon": "13.0.1",
"typescript": "4.4.4"
"typescript": "~5.8.3",
"typescript-eslint": "^8.46.0",
"@eslint/js": "^9.37.0",
"@tsconfig/node18": "~18.2.4"
}
}
26 changes: 14 additions & 12 deletions apis/fabric-contract-api/test/typescript/smartcontract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@

*/

import {Contract, Context} from 'fabric-contract-api';
import {ChaincodeStub, ClientIdentity} from 'fabric-shim-api';
import { Contract, Context } from 'fabric-contract-api';
import { ChaincodeStub, ClientIdentity } from 'fabric-shim-api';

export class ScenarioContext extends Context {
customFunction(): void {

}
customFunction(): void {}
}

export default class TestContractOne extends Contract {
constructor() {
super('org.papernet.commercialpaper');
}

beforeTransaction(ctx: ScenarioContext) {
beforeTransaction(ctx: ScenarioContext): Promise<void> {
// test that the context super class properties are available
const stubApi: ChaincodeStub = ctx.stub;
const clientIdentity: ClientIdentity = ctx.clientIdentity;
Expand All @@ -32,29 +30,33 @@ export default class TestContractOne extends Contract {
return Promise.resolve();
}

afterTransaction(ctx: ScenarioContext, result: any) {
afterTransaction(ctx: ScenarioContext, result: any): Promise<void> {
// This proves that typescript is enforcing the
// return type of Promise<void>
return Promise.resolve();
}

aroundTransaction(ctx: ScenarioContext, fn: Function, parameters: any) {
aroundTransaction(
ctx: ScenarioContext,
fn: Function,
parameters: any
): Promise<void> {
// This proves that typescript is enforcing the
// return type of Promise<void>
return super.aroundTransaction(ctx, fn, parameters);
}

unknownTransaction(ctx: ScenarioContext) {
unknownTransaction(ctx: ScenarioContext): Promise<void> {
// This proves that typescript is enforcing the
// return type of Promise<void>
return Promise.resolve();
}

createContext() {
createContext(): ScenarioContext {
return new ScenarioContext();
}

async Transaction(ctx: ScenarioContext) {
async Transaction(ctx: ScenarioContext): Promise<void> {
// test that the context super class properties are available
const stubApi: ChaincodeStub = ctx.stub;
const clientIdentity: ClientIdentity = ctx.clientIdentity;
Expand All @@ -69,7 +71,7 @@ export class TestContractTwo extends Contract {
super();
}

async Transaction(ctx: Context) {
async Transaction(ctx: Context): Promise<void> {
const stubApi: ChaincodeStub = ctx.stub;
const clientIdentity: ClientIdentity = ctx.clientIdentity;
}
Expand Down
32 changes: 13 additions & 19 deletions apis/fabric-contract-api/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@
* SPDX-License-Identifier: Apache-2.0
*/
{
"compilerOptions": {
"types": ["./types/"],
"alwaysStrict": true,
"module": "commonjs",
"declaration": true,
"sourceMap": true,
"strict": true,
"target": "es2017",
"lib": [
"esnext",
]
},
"include": [
"lib/**/*",
"test/**/*"
],
"exclude": [
"node_modules/**/*"
]
"$schema": "https://json.schemastore.org/tsconfig",
"extends": "@tsconfig/node18/tsconfig.json",
"compilerOptions": {
"types": ["./types/"],
"declaration": true,
"declarationMap": true,
"erasableSyntaxOnly": true,
"isolatedModules": true,
"sourceMap": true,
"strict": true
},
"include": ["lib/**/*", "test/**/*"],
"exclude": ["node_modules/**/*"]
}
5 changes: 5 additions & 0 deletions apis/fabric-shim-api/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Exclude everything except specific inclusions below
**/*

!lib/**/*
!types/**/*
8 changes: 4 additions & 4 deletions apis/fabric-shim-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"url": "https://github.com/hyperledger/fabric-chaincode-node"
},
"scripts": {
"lint": "eslint ./types/ --ext .ts",
"lint": "eslint ./types/",
"build": "echo No Build needed"
},
"keywords": [
Expand All @@ -18,13 +18,13 @@
"Fabric Shim"
],
"engines": {
"node": ">=18",
"eslint": "^6.6.0"
"node": ">=18"
},
"types": "./types/index.d.ts",
"license": "Apache-2.0",
"devDependencies": {
"@types/long": "^4.0.1",
"eslint": "^6.6.0"
"eslint": "^9.37.0",
"@eslint/js": "^9.37.0"
}
}
9 changes: 1 addition & 8 deletions common/config/rush/command-line.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"description": "Runs the Scenario e2e tests.",
"enableParallelism": true,
"ignoreMissingScript": true
},
},
{
"commandKind": "global",
"name": "update-protos",
Expand Down Expand Up @@ -75,13 +75,6 @@
"summary": "Lists build log files created",
"description": "Run this command to list the build logs created after rush rebuild",
"shellCommand": "./tools/logfiles.sh"
},
{
"commandKind": "global",
"name": "edge-docker",
"summary": "Gets the latest main docker images for Fabric ",
"description": "Run this command before doing anything to get the main branch Fabric docker images",
"shellCommand": "./tools/getEdgeDocker.sh"
}
]
}
Loading
Loading