-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (24 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const { Wallets } = require('fabric-network');
const fs = require('fs');
const path = require('path');
const { createLeo } = require('./functions/create.leo');
const { getLeo } = require('./functions/get.leo');
const { getAllLeo } = require('./functions/getAll.leo');
const { sleep } = require('./utils/sleep');
const {enroll, register} = require('./utils/wallet');
(async () => {
const appConfig = path.resolve("./application.json");
const CONFIG = JSON.parse(fs.readFileSync(appConfig, 'utf8'));
const ccp = JSON.parse(fs.readFileSync(CONFIG.ccpPath, 'utf8'));
const walletPath = path.join(process.cwd(), CONFIG.walletPath);
const wallet = await Wallets.newFileSystemWallet(walletPath);
await enroll(CONFIG, ccp, wallet);
await register(CONFIG, ccp, wallet);
// 키와 값을 변경하여 테스트
const key = "키";
const value = "값";
await createLeo(CONFIG, ccp, wallet)(key, value);
await sleep(3);
await getLeo(CONFIG, ccp, wallet)(key);
await getAllLeo(CONFIG, ccp, wallet)();
})()