|
5 | 5 | */
|
6 | 6 |
|
7 | 7 | /* tslint:disable:max-classes-per-file */
|
| 8 | +/* tslint:disable:ordered-imports */ |
8 | 9 |
|
9 |
| -import FabricCAServices = require('fabric-ca-client'); |
10 | 10 | import { BaseClient } from './base';
|
| 11 | +import FabricCAServices = require('fabric-ca-client'); |
| 12 | +import { lstatSync } from 'fs'; |
11 | 13 |
|
12 | 14 | interface ProtoBufObject {
|
13 | 15 | toBuffer(): Buffer;
|
@@ -48,7 +50,7 @@ declare class Client extends BaseClient {
|
48 | 50 | public queryPeers(request: Client.PeerQueryRequest): Promise<Client.PeerQueryResponse>;
|
49 | 51 | public queryChannels(peer: Client.Peer | string, useAdmin?: boolean): Promise<Client.ChannelQueryResponse>;
|
50 | 52 | public queryInstalledChaincodes(peer: Client.Peer | string, useAdmin?: boolean): Promise<Client.ChaincodeQueryResponse>;
|
51 |
| - public installChaincode(request: Client.ChaincodeInstallRequest, timeout?: number): Promise<Client.ProposalResponseObject>; |
| 53 | + public installChaincode(request: Client.ChaincodeInstallRequestv1, timeout?: number): Promise<Client.ProposalResponseObject>; |
52 | 54 | public initCredentialStores(): Promise<boolean>;
|
53 | 55 | public setStateStore(store: Client.IKeyValueStore): void;
|
54 | 56 | public setAdminSigningIdentity(privateKey: string, certificate: string, mspid: string): void;
|
@@ -155,6 +157,44 @@ declare namespace Client { // tslint:disable-line:no-namespace
|
155 | 157 | configUpdate?: Buffer;
|
156 | 158 | }
|
157 | 159 |
|
| 160 | + export interface ChaincodeDefinitionQueryRequest { |
| 161 | + target: Peer; |
| 162 | + chaincodeId: string; |
| 163 | + request_timeout?: number; |
| 164 | + txId?: TransactionId; |
| 165 | + } |
| 166 | + |
| 167 | + export interface NamespaceDefinitionsRequest { |
| 168 | + target: Peer; |
| 169 | + request_timeout?: number; |
| 170 | + txId?: TransactionId; |
| 171 | + } |
| 172 | + |
| 173 | + export interface ApprovalStatusRequest { |
| 174 | + target: Peer; |
| 175 | + request_timeout?: number; |
| 176 | + txId?: TransactionId; |
| 177 | + chaincode: Chaincode; |
| 178 | + } |
| 179 | + |
| 180 | + export interface InstalledChaincodeRequest { |
| 181 | + target: Peer; |
| 182 | + request_timeout?: number; |
| 183 | + txId?: TransactionId; |
| 184 | + package_id: string; |
| 185 | + } |
| 186 | + |
| 187 | + export interface InstalledChaincodesRequest { |
| 188 | + target: Peer; |
| 189 | + request_timeout?: number; |
| 190 | + txId?: TransactionId; |
| 191 | + } |
| 192 | + |
| 193 | + export interface QueryInstalledChaincodeResult { |
| 194 | + package_id: string; |
| 195 | + label: string; |
| 196 | + } |
| 197 | + |
158 | 198 | export class Channel {
|
159 | 199 | public static sendSignedProposal(request: SignedProposal, timeout?: number): Promise<ProposalResponseObject>;
|
160 | 200 |
|
@@ -222,6 +262,14 @@ declare namespace Client { // tslint:disable-line:no-namespace
|
222 | 262 | public queryByChaincode(request: ChaincodeQueryRequest, useAdmin?: boolean): Promise<Buffer[]>;
|
223 | 263 | public verifyProposalResponse(proposalResponse: ProposalResponse): boolean;
|
224 | 264 | public compareProposalResponseResults(proposalResponses: ProposalResponse[]): boolean;
|
| 265 | + |
| 266 | + public approveChaincodeForOrg(request: ChaincodeRequest): Promise<object>; |
| 267 | + public commitChaincode(request: ChaincodeRequest): Promise<object>; |
| 268 | + public queryChaincodeDefinition(request: ChaincodeDefinitionQueryRequest): Promise<Chaincode>; |
| 269 | + public queryNamespaceDefinitions(request: NamespaceDefinitionsRequest): Promise<object>; |
| 270 | + public queryApprovalStatus(request: ApprovalStatusRequest): Promise<object>; |
| 271 | + public queryInstalledChaincode(request: InstalledChaincodeRequest): Promise<QueryInstalledChaincodeResult>; |
| 272 | + public queryInstalledChaincodes(request: InstalledChaincodesRequest): Promise<QueryInstalledChaincodeResult[]>; |
225 | 273 | }
|
226 | 274 |
|
227 | 275 | export interface ChannelPeerRoles {
|
@@ -456,7 +504,7 @@ declare namespace Client { // tslint:disable-line:no-namespace
|
456 | 504 | metadataPath?: string;
|
457 | 505 | }
|
458 | 506 |
|
459 |
| - export type ChaincodeInstallRequest = ChaincodePackageInstallRequest | ChaincodePathInstallRequest; |
| 507 | + export type ChaincodeInstallRequestv1 = ChaincodePackageInstallRequest | ChaincodePathInstallRequest; |
460 | 508 |
|
461 | 509 | export interface ChaincodeInstantiateUpgradeRequest {
|
462 | 510 | targets?: Peer[] | string[];
|
@@ -492,6 +540,12 @@ declare namespace Client { // tslint:disable-line:no-namespace
|
492 | 540 | txId?: TransactionId;
|
493 | 541 | }
|
494 | 542 |
|
| 543 | + export interface ChaincodeRequest { |
| 544 | + targets?: Peer[] | string[]; |
| 545 | + chaincode: Chaincode; |
| 546 | + txId?: TransactionId; |
| 547 | + } |
| 548 | + |
495 | 549 | export interface KeyOpts {
|
496 | 550 | ephemeral: boolean;
|
497 | 551 | }
|
@@ -727,4 +781,55 @@ declare namespace Client { // tslint:disable-line:no-namespace
|
727 | 781 | public getFileNames(): string[];
|
728 | 782 | public toBuffer(): Promise<Buffer>;
|
729 | 783 | }
|
| 784 | + |
| 785 | + export interface ChaincodePackageRequest { |
| 786 | + label?: string; |
| 787 | + chaincodeType: ChaincodeType; |
| 788 | + chaincodePath: string; |
| 789 | + metadataPath?: string; |
| 790 | + goPath?: string; |
| 791 | + } |
| 792 | + |
| 793 | + export interface ChaincodeInstallRequest { |
| 794 | + target: Peer; |
| 795 | + request_timeout?: number; |
| 796 | + txId: TransactionId; |
| 797 | + } |
| 798 | + |
| 799 | + export class Chaincode { |
| 800 | + public static fromQueryResult(name: string, payload: ByteBuffer, client: Client): Chaincode; |
| 801 | + constructor(name: string, version: string, client: Client); |
| 802 | + public getName(): string; |
| 803 | + public getVersion(): string; |
| 804 | + public setVersion(version: string): Chaincode; |
| 805 | + public getSequence(): Long; |
| 806 | + public setSequence(sequence: Long): Chaincode; |
| 807 | + public getPackage(): Buffer; |
| 808 | + public setPackage(packagedChaincode: Buffer): Chaincode; |
| 809 | + public getType(): ChaincodeType; |
| 810 | + public setType(type: ChaincodeType): Chaincode; |
| 811 | + public getInitRequired(): boolean; |
| 812 | + public setInitRequired(required: boolean): Chaincode; |
| 813 | + public getChaincodePath(): string; |
| 814 | + public setChaincodePath(path: string): Chaincode; |
| 815 | + public getMetadataPath(): string; |
| 816 | + public setMetadataPath(path: string): Chaincode; |
| 817 | + public getGoLangPath(): string; |
| 818 | + public setGoLangPath(path: string): Chaincode; |
| 819 | + public getLabel(): string; |
| 820 | + public setLabel(label: string): Chaincode; |
| 821 | + public getPackageId(): string; |
| 822 | + public setPackageId(packageId: string): Chaincode; |
| 823 | + public getEndorsementPolicyDefinition(): object; |
| 824 | + public setEndorsementPolicyDefinition(policy: object): Chaincode; |
| 825 | + public getEndorsementPolicy(): object; |
| 826 | + public setEndorsementPolicy(policy: object): Chaincode; |
| 827 | + public getCollectionConfigPackageDefinition(): object; |
| 828 | + public setCollectionConfigPackageDefinition(configPackage: object): Chaincode; |
| 829 | + public getCollectionConfigPackage(): object; |
| 830 | + public validate(): void; |
| 831 | + public package(request: ChaincodePackageRequest): Promise<Buffer>; |
| 832 | + public install(request: ChaincodeInstallRequest): Promise<string>; |
| 833 | + public toString(): string; |
| 834 | + } |
730 | 835 | }
|
0 commit comments