@decaf-ts/for-fabric 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/for-fabric.cjs +1 -1
- package/dist/for-fabric.cjs.map +1 -1
- package/dist/for-fabric.js +1 -1
- package/dist/for-fabric.js.map +1 -1
- package/lib/client/FabricClientAdapter.cjs +94 -81
- package/lib/client/FabricClientAdapter.d.ts +24 -33
- package/lib/client/FabricClientAdapter.js.map +1 -1
- package/lib/client/FabricClientDispatch.cjs +14 -5
- package/lib/client/FabricClientDispatch.d.ts +7 -5
- package/lib/client/FabricClientDispatch.js.map +1 -1
- package/lib/client/FabricClientRepository.cjs +4 -137
- package/lib/client/FabricClientRepository.d.ts +6 -78
- package/lib/client/FabricClientRepository.js.map +1 -1
- package/lib/client/erc20/FabricERC20ClientRepository.cjs +17 -17
- package/lib/client/erc20/FabricERC20ClientRepository.d.ts +5 -5
- package/lib/client/erc20/FabricERC20ClientRepository.js.map +1 -1
- package/lib/client/logging.cjs +1 -3
- package/lib/client/logging.js.map +1 -1
- package/lib/client/services/FabricEnrollmentService.cjs +3 -3
- package/lib/client/services/FabricEnrollmentService.d.ts +2 -2
- package/lib/client/services/FabricEnrollmentService.js.map +1 -1
- package/lib/contracts/ContractAdapter.cjs +204 -115
- package/lib/contracts/ContractAdapter.d.ts +26 -34
- package/lib/contracts/ContractAdapter.js.map +1 -1
- package/lib/contracts/ContractContext.cjs +1 -9
- package/lib/contracts/ContractContext.d.ts +0 -6
- package/lib/contracts/ContractContext.js.map +1 -1
- package/lib/contracts/ContractPrivateDataAdapter.cjs +429 -288
- package/lib/contracts/ContractPrivateDataAdapter.d.ts +0 -76
- package/lib/contracts/ContractPrivateDataAdapter.js.map +1 -1
- package/lib/contracts/FabricConstruction.cjs +3 -3
- package/lib/contracts/FabricConstruction.d.ts +9 -8
- package/lib/contracts/FabricConstruction.js.map +1 -1
- package/lib/contracts/FabricContractRepository.cjs +7 -202
- package/lib/contracts/FabricContractRepository.d.ts +5 -68
- package/lib/contracts/FabricContractRepository.js.map +1 -1
- package/lib/contracts/FabricContractRepositoryObservableHandler.cjs +4 -1
- package/lib/contracts/FabricContractRepositoryObservableHandler.d.ts +4 -4
- package/lib/contracts/FabricContractRepositoryObservableHandler.js.map +1 -1
- package/lib/contracts/FabricContractSequence.cjs +39 -60
- package/lib/contracts/FabricContractSequence.d.ts +29 -41
- package/lib/contracts/FabricContractSequence.js.map +1 -1
- package/lib/contracts/FabricContractStatement.cjs +6 -6
- package/lib/contracts/FabricContractStatement.d.ts +4 -6
- package/lib/contracts/FabricContractStatement.js.map +1 -1
- package/lib/contracts/crud/crud-contract.cjs +74 -44
- package/lib/contracts/crud/crud-contract.d.ts +7 -11
- package/lib/contracts/crud/crud-contract.js.map +1 -1
- package/lib/contracts/crud/serialized-crud-contract.cjs +12 -21
- package/lib/contracts/crud/serialized-crud-contract.d.ts +3 -11
- package/lib/contracts/crud/serialized-crud-contract.js.map +1 -1
- package/lib/contracts/erc20/erc20contract.cjs +73 -67
- package/lib/contracts/erc20/erc20contract.d.ts +13 -12
- package/lib/contracts/erc20/erc20contract.js.map +1 -1
- package/lib/contracts/logging.cjs +3 -9
- package/lib/contracts/logging.d.ts +1 -2
- package/lib/contracts/logging.js.map +1 -1
- package/lib/contracts/private-data.cjs +202 -118
- package/lib/contracts/private-data.d.ts +0 -16
- package/lib/contracts/private-data.js.map +1 -1
- package/lib/contracts/types.d.ts +1 -1
- package/lib/esm/client/FabricClientAdapter.d.ts +24 -33
- package/lib/esm/client/FabricClientAdapter.js +90 -78
- package/lib/esm/client/FabricClientAdapter.js.map +1 -1
- package/lib/esm/client/FabricClientDispatch.d.ts +7 -5
- package/lib/esm/client/FabricClientDispatch.js +17 -8
- package/lib/esm/client/FabricClientDispatch.js.map +1 -1
- package/lib/esm/client/FabricClientRepository.d.ts +6 -78
- package/lib/esm/client/FabricClientRepository.js +4 -137
- package/lib/esm/client/FabricClientRepository.js.map +1 -1
- package/lib/esm/client/erc20/FabricERC20ClientRepository.d.ts +5 -5
- package/lib/esm/client/erc20/FabricERC20ClientRepository.js +17 -17
- package/lib/esm/client/erc20/FabricERC20ClientRepository.js.map +1 -1
- package/lib/esm/client/logging.js +1 -3
- package/lib/esm/client/logging.js.map +1 -1
- package/lib/esm/client/services/FabricEnrollmentService.d.ts +2 -2
- package/lib/esm/client/services/FabricEnrollmentService.js +3 -3
- package/lib/esm/client/services/FabricEnrollmentService.js.map +1 -1
- package/lib/esm/contracts/ContractAdapter.d.ts +26 -34
- package/lib/esm/contracts/ContractAdapter.js +205 -116
- package/lib/esm/contracts/ContractAdapter.js.map +1 -1
- package/lib/esm/contracts/ContractContext.d.ts +0 -6
- package/lib/esm/contracts/ContractContext.js +1 -9
- package/lib/esm/contracts/ContractContext.js.map +1 -1
- package/lib/esm/contracts/ContractPrivateDataAdapter.d.ts +0 -76
- package/lib/esm/contracts/ContractPrivateDataAdapter.js +430 -285
- package/lib/esm/contracts/ContractPrivateDataAdapter.js.map +1 -1
- package/lib/esm/contracts/FabricConstruction.d.ts +9 -8
- package/lib/esm/contracts/FabricConstruction.js +3 -3
- package/lib/esm/contracts/FabricConstruction.js.map +1 -1
- package/lib/esm/contracts/FabricContractRepository.d.ts +5 -68
- package/lib/esm/contracts/FabricContractRepository.js +7 -202
- package/lib/esm/contracts/FabricContractRepository.js.map +1 -1
- package/lib/esm/contracts/FabricContractRepositoryObservableHandler.d.ts +4 -4
- package/lib/esm/contracts/FabricContractRepositoryObservableHandler.js +5 -2
- package/lib/esm/contracts/FabricContractRepositoryObservableHandler.js.map +1 -1
- package/lib/esm/contracts/FabricContractSequence.d.ts +29 -41
- package/lib/esm/contracts/FabricContractSequence.js +40 -61
- package/lib/esm/contracts/FabricContractSequence.js.map +1 -1
- package/lib/esm/contracts/FabricContractStatement.d.ts +4 -6
- package/lib/esm/contracts/FabricContractStatement.js +7 -7
- package/lib/esm/contracts/FabricContractStatement.js.map +1 -1
- package/lib/esm/contracts/crud/crud-contract.d.ts +7 -11
- package/lib/esm/contracts/crud/crud-contract.js +75 -45
- package/lib/esm/contracts/crud/crud-contract.js.map +1 -1
- package/lib/esm/contracts/crud/serialized-crud-contract.d.ts +3 -11
- package/lib/esm/contracts/crud/serialized-crud-contract.js +12 -21
- package/lib/esm/contracts/crud/serialized-crud-contract.js.map +1 -1
- package/lib/esm/contracts/erc20/erc20contract.d.ts +13 -12
- package/lib/esm/contracts/erc20/erc20contract.js +73 -67
- package/lib/esm/contracts/erc20/erc20contract.js.map +1 -1
- package/lib/esm/contracts/logging.d.ts +1 -2
- package/lib/esm/contracts/logging.js +3 -9
- package/lib/esm/contracts/logging.js.map +1 -1
- package/lib/esm/contracts/private-data.d.ts +0 -16
- package/lib/esm/contracts/private-data.js +203 -111
- package/lib/esm/contracts/private-data.js.map +1 -1
- package/lib/esm/contracts/types.d.ts +1 -1
- package/lib/esm/shared/decorators.d.ts +14 -4
- package/lib/esm/shared/decorators.js +142 -42
- package/lib/esm/shared/decorators.js.map +1 -1
- package/lib/esm/shared/errors.js +2 -2
- package/lib/esm/shared/errors.js.map +1 -1
- package/lib/esm/shared/events.d.ts +1 -5
- package/lib/esm/shared/events.js.map +1 -1
- package/lib/esm/shared/model/Sequence.d.ts +14 -0
- package/lib/esm/shared/model/Sequence.js +33 -0
- package/lib/esm/shared/model/Sequence.js.map +1 -0
- package/lib/esm/shared/model/index.d.ts +2 -0
- package/lib/esm/shared/model/index.js +2 -0
- package/lib/esm/shared/model/index.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/shared/decorators.cjs +148 -41
- package/lib/shared/decorators.d.ts +14 -4
- package/lib/shared/decorators.js.map +1 -1
- package/lib/shared/errors.cjs +2 -2
- package/lib/shared/errors.js.map +1 -1
- package/lib/shared/events.d.ts +1 -5
- package/lib/shared/events.js.map +1 -1
- package/lib/shared/model/Sequence.cjs +36 -0
- package/lib/shared/model/Sequence.d.ts +14 -0
- package/lib/shared/model/Sequence.js.map +1 -0
- package/lib/shared/model/index.cjs +2 -0
- package/lib/shared/model/index.d.ts +2 -0
- package/lib/shared/model/index.js.map +1 -1
- package/lib/version.cjs +1 -1
- package/lib/version.d.ts +1 -1
- package/package.json +2 -3
- package/lib/client/services/LoggedService.cjs +0 -47
- package/lib/client/services/LoggedService.d.ts +0 -42
- package/lib/client/services/LoggedService.js.map +0 -1
- package/lib/esm/client/services/LoggedService.d.ts +0 -42
- package/lib/esm/client/services/LoggedService.js +0 -43
- package/lib/esm/client/services/LoggedService.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud-contract.js","sourceRoot":"","sources":["../../../../src/contracts/crud/crud-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gCAA2B;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"crud-contract.js","sourceRoot":"","sources":["../../../../src/contracts/crud/crud-contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,gCAA2B;AAC3D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,EAAc,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAgC,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,uBAAuB,EAAE,kDAA6C;AAI/E,OAAO,EAAE,qBAAqB,EAAE,gCAA2B;AAC3D,OAAO,EACL,qBAAqB,EACrB,aAAa,EACb,aAAa,GACd,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,MAAM,OAAgB,kBACpB,SAAQ,QAAQ;IAGhB;;OAEG;aACc,YAAO,GAA0B,IAAI,qBAAqB,EAAE,AAArD,CAAsD;aAIpD,eAAU,GAAG,IAAI,uBAAuB,EAAE,AAAhC,CAAiC;IAIrE;;;;;OAKG;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MAAM,CAAC;gBAC1B,KAAK,qBAAqB,CAAC,UAAU,CAAC;gBACtC,KAAK,qBAAqB,CAAC,QAAQ,CAAC;gBACpC,KAAK,qBAAqB,CAAC,UAAU,CAAC;gBACtC,KAAK,qBAAqB,CAAC,UAAU;oBACnC,OAAO,MAAM,CAAC,IAAI,CAAC;gBACrB;oBACE,OAAO,MAAM,CAAC,IAAI,CAAC;YACvB,CAAC;QACH,CAAC;QAED,MAAM,SAAS,GAAG;YAChB,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE;SAClC,CAAC;QAEF,MAAM,OAAO,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,OAAO,CACtD,KAAK,EAAE,EACP,SAAgB,EAChB,IAAI,CAAC,KAAK,EACV,GAAG,CACJ,CAAC;QACF,MAAM,GAAG,GAAG,CACV,IAAI;YACF,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;YACtC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CACd,CAAC;QACrC,OAAO;YACL,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,GAAG;YACR,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC;SAC5B,CAAC;IACJ,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FabricCrudContract } from "./crud-contract";
|
|
2
2
|
import { Model } from "@decaf-ts/decorator-validation";
|
|
3
|
-
import { Context
|
|
4
|
-
import { ContractLogger } from "../logging";
|
|
3
|
+
import { Context as Ctx } from "fabric-contract-api";
|
|
5
4
|
import { Constructor } from "@decaf-ts/decoration";
|
|
6
5
|
/**
|
|
7
6
|
* @description CRUD contract variant that serializes/deserializes payloads
|
|
@@ -17,13 +16,6 @@ import { Constructor } from "@decaf-ts/decoration";
|
|
|
17
16
|
*/
|
|
18
17
|
export declare class SerializedCrudContract<M extends Model> extends FabricCrudContract<M> {
|
|
19
18
|
constructor(name: string, clazz: Constructor<M>);
|
|
20
|
-
/**
|
|
21
|
-
* @description Creates a logger for a specific chaincode context
|
|
22
|
-
* @summary Returns a ContractLogger instance configured for the current context
|
|
23
|
-
* @param {Ctx} ctx - The Fabric chaincode context
|
|
24
|
-
* @return {ContractLogger} The logger instance
|
|
25
|
-
*/
|
|
26
|
-
logFor(ctx: Context): ContractLogger;
|
|
27
19
|
create(ctx: Ctx, model: string): Promise<string>;
|
|
28
20
|
read(ctx: Ctx, key: string): Promise<string>;
|
|
29
21
|
update(ctx: Ctx, model: string): Promise<string>;
|
|
@@ -31,8 +23,8 @@ export declare class SerializedCrudContract<M extends Model> extends FabricCrudC
|
|
|
31
23
|
deleteAll(ctx: Ctx, keys: string): Promise<string>;
|
|
32
24
|
readAll(ctx: Ctx, keys: string): Promise<string>;
|
|
33
25
|
updateAll(ctx: Ctx, models: string): Promise<string>;
|
|
34
|
-
raw(
|
|
26
|
+
raw(context: Ctx, rawInput: string, docsOnly: boolean): Promise<any>;
|
|
35
27
|
init(ctx: Ctx): Promise<void>;
|
|
36
28
|
healthcheck(ctx: Ctx): Promise<string>;
|
|
37
|
-
createAll(
|
|
29
|
+
createAll(context: Ctx, models: string): Promise<string>;
|
|
38
30
|
}
|
|
@@ -9,7 +9,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
import { FabricCrudContract } from "./crud-contract.js";
|
|
11
11
|
import { Context as Ctx, Transaction } from "fabric-contract-api";
|
|
12
|
-
import { Logging } from "@decaf-ts/logging";
|
|
13
12
|
/**
|
|
14
13
|
* @description CRUD contract variant that serializes/deserializes payloads
|
|
15
14
|
* @summary Exposes the same CRUD operations as FabricCrudContract but takes and returns JSON strings to facilitate simple client interactions.
|
|
@@ -26,51 +25,42 @@ export class SerializedCrudContract extends FabricCrudContract {
|
|
|
26
25
|
constructor(name, clazz) {
|
|
27
26
|
super(name, clazz);
|
|
28
27
|
}
|
|
29
|
-
/**
|
|
30
|
-
* @description Creates a logger for a specific chaincode context
|
|
31
|
-
* @summary Returns a ContractLogger instance configured for the current context
|
|
32
|
-
* @param {Ctx} ctx - The Fabric chaincode context
|
|
33
|
-
* @return {ContractLogger} The logger instance
|
|
34
|
-
*/
|
|
35
|
-
logFor(ctx) {
|
|
36
|
-
return Logging.for(SerializedCrudContract, {}, ctx);
|
|
37
|
-
}
|
|
38
28
|
async create(ctx, model) {
|
|
39
|
-
const log = this.
|
|
29
|
+
const { log } = await this.logCtx([ctx], this.create);
|
|
40
30
|
log.info(`Creating model: ${model}`);
|
|
41
31
|
const m = this.deserialize(model);
|
|
42
32
|
log.info(`Model deserialized: ${JSON.stringify(m)}`);
|
|
43
33
|
return this.serialize((await super.create(ctx, m)));
|
|
44
34
|
}
|
|
45
35
|
async read(ctx, key) {
|
|
46
|
-
const log = this.
|
|
36
|
+
const { log } = await this.logCtx([ctx], this.read);
|
|
47
37
|
log.info(`Reading id: ${key}`);
|
|
48
38
|
return this.serialize((await super.read(ctx, key)));
|
|
49
39
|
}
|
|
50
40
|
async update(ctx, model) {
|
|
51
|
-
const log = this.
|
|
41
|
+
const { log } = await this.logCtx([ctx], this.update);
|
|
52
42
|
log.info(`Updating model: ${model}`);
|
|
53
43
|
return this.serialize((await super.update(ctx, model)));
|
|
54
44
|
}
|
|
55
45
|
async delete(ctx, key) {
|
|
56
|
-
const log = this.
|
|
46
|
+
const { log } = await this.logCtx([ctx], this.delete);
|
|
57
47
|
log.info(`Deleting id: ${key}`);
|
|
58
48
|
return this.serialize((await super.delete(ctx, key)));
|
|
59
49
|
}
|
|
60
50
|
async deleteAll(ctx, keys) {
|
|
61
51
|
const parsedKeys = JSON.parse(keys);
|
|
62
|
-
const log = this.
|
|
52
|
+
const { log } = await this.logCtx([ctx], this.deleteAll);
|
|
63
53
|
log.info(`deleting ${parsedKeys.length} entries from the table`);
|
|
64
54
|
return JSON.stringify((await super.deleteAll(ctx, parsedKeys)).map((m) => this.serialize(m)));
|
|
65
55
|
}
|
|
66
56
|
async readAll(ctx, keys) {
|
|
67
57
|
const parsedKeys = JSON.parse(keys);
|
|
68
|
-
const log = this.
|
|
58
|
+
const { log } = await this.logCtx([ctx], this.readAll);
|
|
69
59
|
log.info(`reading ${parsedKeys.length} entries from the table`);
|
|
70
60
|
return JSON.stringify((await super.readAll(ctx, parsedKeys)).map((m) => this.serialize(m)));
|
|
71
61
|
}
|
|
72
62
|
async updateAll(ctx, models) {
|
|
73
|
-
const log = this.
|
|
63
|
+
const { log } = await this.logCtx([ctx], this.updateAll);
|
|
74
64
|
const list = JSON.parse(models);
|
|
75
65
|
const modelList = list
|
|
76
66
|
.map((m) => this.deserialize(m))
|
|
@@ -78,7 +68,8 @@ export class SerializedCrudContract extends FabricCrudContract {
|
|
|
78
68
|
log.info(`Updating ${modelList.length} entries to the table`);
|
|
79
69
|
return JSON.stringify((await super.updateAll(ctx, modelList)).map((m) => this.serialize(m)));
|
|
80
70
|
}
|
|
81
|
-
async raw(
|
|
71
|
+
async raw(context, rawInput, docsOnly) {
|
|
72
|
+
const { ctx } = await this.logCtx([context], this.raw);
|
|
82
73
|
const parsedInput = JSON.parse(rawInput);
|
|
83
74
|
return super.raw(ctx, parsedInput, docsOnly);
|
|
84
75
|
}
|
|
@@ -89,14 +80,14 @@ export class SerializedCrudContract extends FabricCrudContract {
|
|
|
89
80
|
//TODO: TRIM NOT WORKING CHECK LATER
|
|
90
81
|
return JSON.stringify(await super.healthcheck(ctx));
|
|
91
82
|
}
|
|
92
|
-
async createAll(
|
|
93
|
-
const log = this.
|
|
83
|
+
async createAll(context, models) {
|
|
84
|
+
const { log } = await this.logCtx([context], this.createAll);
|
|
94
85
|
const list = JSON.parse(models);
|
|
95
86
|
const modelList = list
|
|
96
87
|
.map((m) => this.deserialize(m))
|
|
97
88
|
.map((m) => new this.clazz(m));
|
|
98
89
|
log.info(`Adding ${modelList.length} entries to the table`);
|
|
99
|
-
return JSON.stringify((await super.createAll(
|
|
90
|
+
return JSON.stringify((await super.createAll(context, modelList)).map((m) => this.serialize(m)));
|
|
100
91
|
}
|
|
101
92
|
}
|
|
102
93
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialized-crud-contract.js","sourceRoot":"","sources":["../../../../src/contracts/crud/serialized-crud-contract.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,2BAAwB;AAGrD,OAAO,
|
|
1
|
+
{"version":3,"file":"serialized-crud-contract.js","sourceRoot":"","sources":["../../../../src/contracts/crud/serialized-crud-contract.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,kBAAkB,EAAE,2BAAwB;AAGrD,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlE;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,sBAEX,SAAQ,kBAAqB;IAC7B,YAAY,IAAY,EAAE,KAAqB;QAC7C,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrB,CAAC;IAGc,AAAN,KAAK,CAAC,MAAM,CAAC,GAAQ,EAAE,KAAa;QAC3C,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACtD,GAAG,CAAC,IAAI,CAAC,mBAAmB,KAAK,EAAE,CAAC,CAAC;QAErC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,CAAI,KAAK,CAAC,CAAC;QAErC,GAAG,CAAC,IAAI,CAAC,uBAAuB,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAM,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|
1
1
|
import { Context } from "fabric-contract-api";
|
|
2
2
|
import { Allowance, ERC20Token, ERC20Wallet } from "./models";
|
|
3
|
+
import type { FabricContractContext } from "../ContractContext";
|
|
3
4
|
import { FabricCrudContract } from "../crud/crud-contract";
|
|
4
5
|
/**
|
|
5
6
|
* @description ERC20 token contract base for Hyperledger Fabric
|
|
@@ -72,7 +73,7 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
72
73
|
*
|
|
73
74
|
* @returns {Boolean} Return whether the transfer was successful or not
|
|
74
75
|
*/
|
|
75
|
-
Transfer(
|
|
76
|
+
Transfer(context: Context, to: string, value: number): Promise<boolean>;
|
|
76
77
|
/**
|
|
77
78
|
* Transfer `value` amount of tokens from `from` to `to`.
|
|
78
79
|
*
|
|
@@ -82,8 +83,8 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
82
83
|
* @param {number} value The amount of token to be transferred
|
|
83
84
|
* @returns {Boolean} Return whether the transfer was successful or not
|
|
84
85
|
*/
|
|
85
|
-
TransferFrom(
|
|
86
|
-
_transfer(
|
|
86
|
+
TransferFrom(context: Context, from: string, to: string, value: number): Promise<boolean>;
|
|
87
|
+
_transfer(from: string, to: string, value: number, ctx: FabricContractContext): Promise<boolean>;
|
|
87
88
|
/**
|
|
88
89
|
* Allows `spender` to spend `value` amount of tokens from the owner. New Approve calls override the previous allowance.
|
|
89
90
|
* @note https://eips.ethereum.org/EIPS/eip-20
|
|
@@ -93,7 +94,7 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
93
94
|
* @param {number} value The amount of tokens to be approved for transfer
|
|
94
95
|
* @returns {Boolean} Return whether the approval was successful or not
|
|
95
96
|
*/
|
|
96
|
-
Approve(
|
|
97
|
+
Approve(context: Context, spender: string, value: number): Promise<boolean>;
|
|
97
98
|
/**
|
|
98
99
|
* Returns the amount of tokens which ` ` is allowed to withdraw from `owner`.
|
|
99
100
|
*
|
|
@@ -102,8 +103,8 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
102
103
|
* @param {String} spender The spender who are able to transfer the tokens
|
|
103
104
|
* @returns {number} Return the amount of remaining tokens allowed to spent
|
|
104
105
|
*/
|
|
105
|
-
Allowance(
|
|
106
|
-
_getAllowance(
|
|
106
|
+
Allowance(context: Context, owner: string, spender: string): Promise<number>;
|
|
107
|
+
_getAllowance(owner: string, spender: string, ctx: FabricContractContext): Promise<Allowance>;
|
|
107
108
|
/**
|
|
108
109
|
* Set optional infomation for a token.
|
|
109
110
|
*
|
|
@@ -113,8 +114,8 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
113
114
|
* @param {String} decimals The decimals of the token
|
|
114
115
|
* @param {String} totalSupply The totalSupply of the token
|
|
115
116
|
*/
|
|
116
|
-
Initialize(
|
|
117
|
-
CheckInitialized(
|
|
117
|
+
Initialize(context: Context, token: ERC20Token): Promise<boolean>;
|
|
118
|
+
CheckInitialized(context: Context): Promise<void>;
|
|
118
119
|
/**
|
|
119
120
|
* Mint creates new tokens and adds them to minter's account balance
|
|
120
121
|
*
|
|
@@ -122,7 +123,7 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
122
123
|
* @param {number} amount amount of tokens to be minted
|
|
123
124
|
* @returns {Object} The balance
|
|
124
125
|
*/
|
|
125
|
-
Mint(
|
|
126
|
+
Mint(context: Context, amount: number): Promise<void>;
|
|
126
127
|
/**
|
|
127
128
|
* Burn redeem tokens from minter's account balance
|
|
128
129
|
*
|
|
@@ -130,7 +131,7 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
130
131
|
* @param {number} amount amount of tokens to be burned
|
|
131
132
|
* @returns {Object} The balance
|
|
132
133
|
*/
|
|
133
|
-
Burn(
|
|
134
|
+
Burn(context: Context, amount: number): Promise<void>;
|
|
134
135
|
/**
|
|
135
136
|
* BurnFrom redeem tokens from account allowence and balance
|
|
136
137
|
*
|
|
@@ -139,7 +140,7 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
139
140
|
* @param {number} amount amount of tokens to be burned
|
|
140
141
|
* @returns {Object} The balance
|
|
141
142
|
*/
|
|
142
|
-
BurnFrom(
|
|
143
|
+
BurnFrom(context: Context, account: string, amount: number): Promise<void>;
|
|
143
144
|
/**
|
|
144
145
|
* ClientAccountBalance returns the balance of the requesting client's account.
|
|
145
146
|
*
|
|
@@ -147,5 +148,5 @@ export declare abstract class FabricERC20Contract extends FabricCrudContract<ERC
|
|
|
147
148
|
* @returns {Number} Returns the account balance
|
|
148
149
|
*/
|
|
149
150
|
ClientAccountBalance(ctx: Context): Promise<number>;
|
|
150
|
-
ClientAccountID(
|
|
151
|
+
ClientAccountID(context: Context): Promise<string>;
|
|
151
152
|
}
|
|
@@ -55,8 +55,8 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
55
55
|
async TokenName(ctx) {
|
|
56
56
|
// Check contract options are already set first to execute the function
|
|
57
57
|
await this.CheckInitialized(ctx);
|
|
58
|
-
const select = await this.tokenRepository.
|
|
59
|
-
const token = (await select.execute())[0];
|
|
58
|
+
const select = await this.tokenRepository.select();
|
|
59
|
+
const token = (await select.execute(ctx))[0];
|
|
60
60
|
return token.name;
|
|
61
61
|
}
|
|
62
62
|
/**
|
|
@@ -68,8 +68,8 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
68
68
|
async Symbol(ctx) {
|
|
69
69
|
// Check contract options are already set first to execute the function
|
|
70
70
|
await this.CheckInitialized(ctx);
|
|
71
|
-
const select = await this.tokenRepository.
|
|
72
|
-
const token = (await select.execute())[0];
|
|
71
|
+
const select = await this.tokenRepository.select();
|
|
72
|
+
const token = (await select.execute(ctx))[0];
|
|
73
73
|
return token.symbol;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -82,8 +82,8 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
82
82
|
async Decimals(ctx) {
|
|
83
83
|
// Check contract options are already set first to execute the function
|
|
84
84
|
await this.CheckInitialized(ctx);
|
|
85
|
-
const select = await this.tokenRepository.
|
|
86
|
-
const token = (await select.execute())[0];
|
|
85
|
+
const select = await this.tokenRepository.select();
|
|
86
|
+
const token = (await select.execute(ctx))[0];
|
|
87
87
|
return token.decimals;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
@@ -95,8 +95,8 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
95
95
|
async TotalSupply(ctx) {
|
|
96
96
|
// Check contract options are already set first to execute the function
|
|
97
97
|
await this.CheckInitialized(ctx);
|
|
98
|
-
const select = await this.walletRepository.
|
|
99
|
-
const wallets = await select.execute();
|
|
98
|
+
const select = await this.walletRepository.select();
|
|
99
|
+
const wallets = await select.execute(ctx);
|
|
100
100
|
if (wallets.length == 0) {
|
|
101
101
|
throw new NotFoundError(`The token ${this.getName()} does not exist`);
|
|
102
102
|
}
|
|
@@ -129,11 +129,12 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
129
129
|
*
|
|
130
130
|
* @returns {Boolean} Return whether the transfer was successful or not
|
|
131
131
|
*/
|
|
132
|
-
async Transfer(
|
|
132
|
+
async Transfer(context, to, value) {
|
|
133
133
|
// Check contract options are already set first to execute the function
|
|
134
|
-
await this.CheckInitialized(
|
|
135
|
-
const
|
|
136
|
-
const
|
|
134
|
+
await this.CheckInitialized(context);
|
|
135
|
+
const { ctx } = await this.logCtx([context], this.Transfer);
|
|
136
|
+
const from = ctx.identity.getID();
|
|
137
|
+
const transferResp = await this._transfer(from, to, value, ctx);
|
|
137
138
|
if (!transferResp) {
|
|
138
139
|
throw new InternalError("Failed to transfer");
|
|
139
140
|
}
|
|
@@ -148,12 +149,13 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
148
149
|
* @param {number} value The amount of token to be transferred
|
|
149
150
|
* @returns {Boolean} Return whether the transfer was successful or not
|
|
150
151
|
*/
|
|
151
|
-
async TransferFrom(
|
|
152
|
+
async TransferFrom(context, from, to, value) {
|
|
152
153
|
// Check contract options are already set first to execute the function
|
|
153
|
-
await this.CheckInitialized(
|
|
154
|
+
await this.CheckInitialized(context);
|
|
155
|
+
const { ctx } = await this.logCtx([context], this.BurnFrom);
|
|
154
156
|
// Retrieve the allowance of the spender
|
|
155
|
-
const spender = ctx.
|
|
156
|
-
const allowance = await this._getAllowance(
|
|
157
|
+
const spender = ctx.identity.getID();
|
|
158
|
+
const allowance = await this._getAllowance(from, spender, ctx);
|
|
157
159
|
if (!allowance || allowance.value < 0) {
|
|
158
160
|
throw new AllowanceError(`spender ${spender} has no allowance from ${from}`);
|
|
159
161
|
}
|
|
@@ -169,14 +171,14 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
169
171
|
});
|
|
170
172
|
await this.allowanceRepository.update(newAllowance, ctx);
|
|
171
173
|
//Realize the transfer
|
|
172
|
-
const transferResp = await this._transfer(
|
|
174
|
+
const transferResp = await this._transfer(from, to, value, ctx);
|
|
173
175
|
if (!transferResp) {
|
|
174
176
|
throw new InternalError("Failed to transfer");
|
|
175
177
|
}
|
|
176
178
|
return true;
|
|
177
179
|
}
|
|
178
|
-
async _transfer(
|
|
179
|
-
const
|
|
180
|
+
async _transfer(from, to, value, ctx) {
|
|
181
|
+
const log = ctx.logger;
|
|
180
182
|
if (from === to) {
|
|
181
183
|
throw new AuthorizationError("cannot transfer to and from same client account");
|
|
182
184
|
}
|
|
@@ -235,8 +237,9 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
235
237
|
}
|
|
236
238
|
// Emit the Transfer event
|
|
237
239
|
const transferEvent = { from, to, value: value };
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
this.repo
|
|
241
|
+
.refresh(ERC20Token, ERC20Events.TRANSFER, "", transferEvent, ctx)
|
|
242
|
+
.catch((e) => log.error(`Failed to notify transfer: ${e}`));
|
|
240
243
|
return true;
|
|
241
244
|
}
|
|
242
245
|
/**
|
|
@@ -248,20 +251,20 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
248
251
|
* @param {number} value The amount of tokens to be approved for transfer
|
|
249
252
|
* @returns {Boolean} Return whether the approval was successful or not
|
|
250
253
|
*/
|
|
251
|
-
async Approve(
|
|
254
|
+
async Approve(context, spender, value) {
|
|
252
255
|
// Check contract options are already set first to execute the function
|
|
253
|
-
await this.CheckInitialized(
|
|
254
|
-
const
|
|
255
|
-
const owner = ctx.
|
|
256
|
-
let allowance = await this._getAllowance(
|
|
257
|
-
const ownerWallet = await this.walletRepository.read(owner,
|
|
256
|
+
await this.CheckInitialized(context);
|
|
257
|
+
const { ctx, ctxArgs } = await this.logCtx([context], this.Approve);
|
|
258
|
+
const owner = ctx.identity.getID();
|
|
259
|
+
let allowance = await this._getAllowance(owner, spender, ctx);
|
|
260
|
+
const ownerWallet = await this.walletRepository.read(owner, ...ctxArgs);
|
|
258
261
|
if (ownerWallet.balance < value) {
|
|
259
262
|
throw new BalanceError(`client account ${owner} has insufficient funds.`);
|
|
260
263
|
}
|
|
261
264
|
if (allowance) {
|
|
262
265
|
// Overwrite the allowance
|
|
263
266
|
allowance.value = value;
|
|
264
|
-
await this.allowanceRepository.update(allowance,
|
|
267
|
+
await this.allowanceRepository.update(allowance, ...ctxArgs);
|
|
265
268
|
}
|
|
266
269
|
else {
|
|
267
270
|
allowance = new Allowance({
|
|
@@ -269,12 +272,11 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
269
272
|
spender: spender,
|
|
270
273
|
value: value,
|
|
271
274
|
});
|
|
272
|
-
await this.allowanceRepository.create(allowance,
|
|
275
|
+
await this.allowanceRepository.create(allowance, ...ctxArgs);
|
|
273
276
|
}
|
|
274
277
|
// Emit the Approval event
|
|
275
278
|
const approvalEvent = { owner, spender, value: value };
|
|
276
|
-
|
|
277
|
-
eventHandler.updateObservers(logger, "", ERC20Events.APPROVAL, "", ctx, "", approvalEvent);
|
|
279
|
+
this.repo.refresh(ERC20Token, ERC20Events.APPROVAL, "", approvalEvent, ctx);
|
|
278
280
|
return true;
|
|
279
281
|
}
|
|
280
282
|
/**
|
|
@@ -285,19 +287,22 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
285
287
|
* @param {String} spender The spender who are able to transfer the tokens
|
|
286
288
|
* @returns {number} Return the amount of remaining tokens allowed to spent
|
|
287
289
|
*/
|
|
288
|
-
async Allowance(
|
|
290
|
+
async Allowance(context, owner, spender) {
|
|
289
291
|
// Check contract options are already set first to execute the function
|
|
290
|
-
await this.CheckInitialized(
|
|
291
|
-
const
|
|
292
|
+
await this.CheckInitialized(context);
|
|
293
|
+
const { ctx } = await this.logCtx([context], this.Allowance);
|
|
294
|
+
const allowance = await this._getAllowance(owner, spender, ctx);
|
|
292
295
|
if (!allowance) {
|
|
293
296
|
throw new AllowanceError(`spender ${spender} has no allowance from ${owner}`);
|
|
294
297
|
}
|
|
295
298
|
return allowance.value;
|
|
296
299
|
}
|
|
297
|
-
async _getAllowance(
|
|
300
|
+
async _getAllowance(owner, spender, ctx) {
|
|
298
301
|
const allowanceCondition = Condition.and(Condition.attribute("owner").eq(owner), Condition.attribute("spender").eq(spender));
|
|
299
|
-
const
|
|
300
|
-
|
|
302
|
+
const allowance = await this.allowanceRepository
|
|
303
|
+
.select()
|
|
304
|
+
.where(allowanceCondition)
|
|
305
|
+
.execute(ctx);
|
|
301
306
|
return allowance?.[0];
|
|
302
307
|
}
|
|
303
308
|
// ================== Extended Functions ==========================
|
|
@@ -310,21 +315,21 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
310
315
|
* @param {String} decimals The decimals of the token
|
|
311
316
|
* @param {String} totalSupply The totalSupply of the token
|
|
312
317
|
*/
|
|
313
|
-
async Initialize(
|
|
318
|
+
async Initialize(context, token) {
|
|
319
|
+
const { ctx } = await this.logCtx([context], this.Initialize);
|
|
314
320
|
// Check contract options are not already set, client is not authorized to change them once intitialized
|
|
315
|
-
const
|
|
316
|
-
const tokens = await select.execute();
|
|
321
|
+
const tokens = await this.tokenRepository.select().execute(ctx);
|
|
317
322
|
if (tokens.length > 0) {
|
|
318
323
|
throw new AuthorizationError("contract options are already set, client is not authorized to change them");
|
|
319
324
|
}
|
|
320
|
-
token.owner = ctx.
|
|
325
|
+
token.owner = ctx.identity.getID();
|
|
321
326
|
await this.tokenRepository.create(token, ctx);
|
|
322
327
|
return true;
|
|
323
328
|
}
|
|
324
329
|
// Checks that contract options have been already initialized
|
|
325
|
-
async CheckInitialized(
|
|
326
|
-
const
|
|
327
|
-
const tokens = await select.execute();
|
|
330
|
+
async CheckInitialized(context) {
|
|
331
|
+
const { ctx } = await this.logCtx([context], this.CheckInitialized);
|
|
332
|
+
const tokens = await this.tokenRepository.select().execute(ctx);
|
|
328
333
|
if (tokens.length == 0) {
|
|
329
334
|
throw new NotInitializedError("contract options need to be set before calling any function, call Initialize() to initialize contract");
|
|
330
335
|
}
|
|
@@ -336,12 +341,12 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
336
341
|
* @param {number} amount amount of tokens to be minted
|
|
337
342
|
* @returns {Object} The balance
|
|
338
343
|
*/
|
|
339
|
-
async Mint(
|
|
344
|
+
async Mint(context, amount) {
|
|
340
345
|
// Check contract options are already set first to execute the function
|
|
341
|
-
await this.CheckInitialized(
|
|
342
|
-
const
|
|
346
|
+
await this.CheckInitialized(context);
|
|
347
|
+
const { ctx } = await this.logCtx([context], this.Mint);
|
|
343
348
|
// Get ID of submitting client identity
|
|
344
|
-
const minter = ctx.
|
|
349
|
+
const minter = ctx.identity.getID();
|
|
345
350
|
if (amount <= 0) {
|
|
346
351
|
throw new ValidationError("mint amount must be a positive integer");
|
|
347
352
|
}
|
|
@@ -362,7 +367,7 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
362
367
|
const newWallet = new ERC20Wallet({
|
|
363
368
|
id: minter,
|
|
364
369
|
balance: amount,
|
|
365
|
-
token: await this.TokenName(
|
|
370
|
+
token: await this.TokenName(context),
|
|
366
371
|
});
|
|
367
372
|
await this.walletRepository.create(newWallet, ctx);
|
|
368
373
|
}
|
|
@@ -377,7 +382,7 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
377
382
|
// Emit the Transfer event
|
|
378
383
|
const transferEvent = { from: "0x0", to: minter, value: amount };
|
|
379
384
|
const eventHandler = this.repo.ObserverHandler();
|
|
380
|
-
eventHandler.updateObservers(
|
|
385
|
+
eventHandler.updateObservers(ERC20Token, ERC20Events.TRANSFER, "", transferEvent, ctx);
|
|
381
386
|
}
|
|
382
387
|
/**
|
|
383
388
|
* Burn redeem tokens from minter's account balance
|
|
@@ -386,11 +391,11 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
386
391
|
* @param {number} amount amount of tokens to be burned
|
|
387
392
|
* @returns {Object} The balance
|
|
388
393
|
*/
|
|
389
|
-
async Burn(
|
|
394
|
+
async Burn(context, amount) {
|
|
390
395
|
// Check contract options are already set first to execute the function
|
|
391
|
-
await this.CheckInitialized(
|
|
392
|
-
const
|
|
393
|
-
const minter = ctx.
|
|
396
|
+
await this.CheckInitialized(context);
|
|
397
|
+
const { log, ctx } = await this.logCtx([context], this.Burn);
|
|
398
|
+
const minter = ctx.identity.getID();
|
|
394
399
|
const minterWallet = await this.walletRepository.read(minter, ctx);
|
|
395
400
|
const currentBalance = minterWallet.balance;
|
|
396
401
|
if (currentBalance < amount) {
|
|
@@ -401,11 +406,11 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
401
406
|
balance: updatedBalance,
|
|
402
407
|
});
|
|
403
408
|
await this.walletRepository.update(updatedminter, ctx);
|
|
404
|
-
|
|
409
|
+
log.info(`${amount} tokens were burned`);
|
|
405
410
|
// Emit the Transfer event
|
|
406
411
|
const transferEvent = { from: minter, to: "0x0", value: amount };
|
|
407
412
|
const eventHandler = this.repo.ObserverHandler();
|
|
408
|
-
eventHandler.updateObservers(
|
|
413
|
+
eventHandler.updateObservers(ERC20Token, ERC20Events.TRANSFER, "", transferEvent, ctx);
|
|
409
414
|
}
|
|
410
415
|
/**
|
|
411
416
|
* BurnFrom redeem tokens from account allowence and balance
|
|
@@ -415,10 +420,10 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
415
420
|
* @param {number} amount amount of tokens to be burned
|
|
416
421
|
* @returns {Object} The balance
|
|
417
422
|
*/
|
|
418
|
-
async BurnFrom(
|
|
423
|
+
async BurnFrom(context, account, amount) {
|
|
419
424
|
// Check contract options are already set first to execute the function
|
|
420
|
-
await this.CheckInitialized(
|
|
421
|
-
const
|
|
425
|
+
await this.CheckInitialized(context);
|
|
426
|
+
const { log, ctx } = await this.logCtx([context], this.BurnFrom);
|
|
422
427
|
const accountWallet = await this.walletRepository.read(account, ctx);
|
|
423
428
|
const currentBalance = accountWallet.balance;
|
|
424
429
|
if (currentBalance < amount) {
|
|
@@ -429,11 +434,11 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
429
434
|
balance: updatedBalance,
|
|
430
435
|
});
|
|
431
436
|
await this.walletRepository.update(updatedaccount, ctx);
|
|
432
|
-
|
|
437
|
+
log.info(`${amount} tokens were burned from ${account}`);
|
|
433
438
|
// Emit the Transfer event
|
|
434
439
|
const transferEvent = { from: account, to: "0x0", value: amount };
|
|
435
440
|
const eventHandler = this.repo.ObserverHandler();
|
|
436
|
-
eventHandler.updateObservers(
|
|
441
|
+
eventHandler.updateObservers(ERC20Token, ERC20Events.TRANSFER, "", transferEvent, ctx);
|
|
437
442
|
}
|
|
438
443
|
/**
|
|
439
444
|
* ClientAccountBalance returns the balance of the requesting client's account.
|
|
@@ -455,11 +460,12 @@ export class FabricERC20Contract extends FabricCrudContract {
|
|
|
455
460
|
// ClientAccountID returns the id of the requesting client's account.
|
|
456
461
|
// In this implementation, the client account ID is the clientId itself.
|
|
457
462
|
// Users can use this function to get their own account id, which they can then give to others as the payment address
|
|
458
|
-
async ClientAccountID(
|
|
463
|
+
async ClientAccountID(context) {
|
|
459
464
|
// Check contract options are already set first to execute the function
|
|
460
|
-
await this.CheckInitialized(
|
|
465
|
+
await this.CheckInitialized(context);
|
|
466
|
+
const { ctx } = await this.logCtx([context], this.ClientAccountID);
|
|
461
467
|
// Get ID of submitting client identity
|
|
462
|
-
const clientAccountID = ctx.
|
|
468
|
+
const clientAccountID = ctx.identity.getID();
|
|
463
469
|
return clientAccountID;
|
|
464
470
|
}
|
|
465
471
|
}
|
|
@@ -512,7 +518,7 @@ __decorate([
|
|
|
512
518
|
__metadata("design:returntype", Promise)
|
|
513
519
|
], FabricERC20Contract.prototype, "Approve", null);
|
|
514
520
|
__decorate([
|
|
515
|
-
Transaction(),
|
|
521
|
+
Transaction(false),
|
|
516
522
|
__metadata("design:type", Function),
|
|
517
523
|
__metadata("design:paramtypes", [Context, String, String]),
|
|
518
524
|
__metadata("design:returntype", Promise)
|
|
@@ -551,13 +557,13 @@ __decorate([
|
|
|
551
557
|
__metadata("design:returntype", Promise)
|
|
552
558
|
], FabricERC20Contract.prototype, "BurnFrom", null);
|
|
553
559
|
__decorate([
|
|
554
|
-
Transaction(),
|
|
560
|
+
Transaction(false),
|
|
555
561
|
__metadata("design:type", Function),
|
|
556
562
|
__metadata("design:paramtypes", [Context]),
|
|
557
563
|
__metadata("design:returntype", Promise)
|
|
558
564
|
], FabricERC20Contract.prototype, "ClientAccountBalance", null);
|
|
559
565
|
__decorate([
|
|
560
|
-
Transaction(),
|
|
566
|
+
Transaction(false),
|
|
561
567
|
__metadata("design:type", Function),
|
|
562
568
|
__metadata("design:paramtypes", [Context]),
|
|
563
569
|
__metadata("design:returntype", Promise)
|