Skip to content

Commit a06946f

Browse files
committed
1 parent 4dc7c9a commit a06946f

File tree

3 files changed

+12
-17
lines changed

3 files changed

+12
-17
lines changed

.eslintrc.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
},
1313
"rules": {
1414
"semi": "error",
15+
"no-async-promise-executor": 0,
16+
"no-undef": 0,
1517
"new-cap": [
1618
2,
1719
{

api/index.js

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
/*
2-
* SPDX-License-Identifier: Apache-2.0
3-
*/
4-
5-
'use strict';
6-
7-
const { Gateway, Wallets } = require('fabric-network');
8-
const fs = require('fs');
9-
const path = require('path');
1+
import { Gateway, Wallets } from 'fabric-network';
2+
import fs from 'fs';
3+
import path, { dirname } from 'path';
4+
import { fileURLToPath } from 'url';
105

6+
const __filename = fileURLToPath(import.meta.url);
7+
const __dirname = dirname(__filename);
118
const WALLET_PATH = path.join(__dirname, '..', '..', '..', 'wallet');
129
const CCP_PATH = path.resolve(__dirname, '..', '..', '..', 'network', 'organizations', 'peerOrganizations', 'org1.example.com', 'connection-org1.json');
1310

14-
async function getContractAndGateway({username, chaincode, contract}) {
11+
export const getContractAndGateway = async ({username, chaincode, contract}) => {
1512
// load the network configuration
1613
const ccp = JSON.parse(fs.readFileSync(CCP_PATH, 'utf8'));
1714

@@ -32,9 +29,4 @@ async function getContractAndGateway({username, chaincode, contract}) {
3229

3330
// Get the contract from the network.
3431
return {contract: network.getContract(chaincode, contract), gateway};
35-
}
36-
37-
38-
module.exports = {
39-
getContractAndGateway,
40-
};
32+
};

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blockotus-organ-helper",
3-
"version": "0.2.0-alpha",
3+
"version": "0.2.3-alpha",
44
"description": "",
55
"main": "index.js",
66
"scripts": {
@@ -13,6 +13,7 @@
1313
},
1414
"author": "Daniel Febrero",
1515
"license": "AGPL-3.0",
16+
"type": "module",
1617
"bugs": {
1718
"url": "https://github.com/BLOCKOTUS/helper/issues"
1819
},

0 commit comments

Comments
 (0)