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
14 changes: 13 additions & 1 deletion apis/fabric-shim-api/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,21 @@ declare module 'fabric-shim-api' {

interface ChaincodeResponse {
status: number;
message: string;
message?: string;
payload?: Uint8Array;
}

interface SuccessResponse {
status: RESPONSE_CODE.OK;
message?: string;
payload: Uint8Array;
}

interface ErrorResponse {
status: RESPONSE_CODE.ERROR;
message: string;
payload?: Uint8Array;
}

interface ClientIdentity {
assertAttributeValue(attrName: string, attrValue: string): boolean;
Expand Down
12 changes: 8 additions & 4 deletions libraries/fabric-shim/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ declare module 'fabric-shim' {
import {
ChaincodeInterface,
ChaincodeProposal,
ErrorResponse,
SuccessResponse,
ChaincodeResponse,
ChaincodeStub as IChaincodeStub,
ClientIdentity as IClientIdentity,
Expand All @@ -26,6 +28,8 @@ declare module 'fabric-shim' {
export {
ChaincodeInterface,
ChaincodeProposal,
ErrorResponse,
SuccessResponse,
ChaincodeResponse,
Iterators,
QueryResponseMetadata,
Expand All @@ -35,16 +39,16 @@ declare module 'fabric-shim' {
Timestamp
}

export function error(msg: Uint8Array): ChaincodeResponse;
export function error(msg: string): ErrorResponse;
export function newLogger(name: string): Logger;
export function start(chaincode: ChaincodeInterface): any;
export function success(payload?: Uint8Array): ChaincodeResponse;
export function success(payload?: Uint8Array): SuccessResponse;

export class Shim {
static error(msg: Uint8Array): ChaincodeResponse;
static error(msg: string): ErrorResponse;
static newLogger(name: string): Logger;
static start(chaincode: ChaincodeInterface): any;
static success(payload?: Uint8Array): ChaincodeResponse;
static success(payload?: Uint8Array): SuccessResponse;
static server(chaincode: ChaincodeInterface, serverOpts: ChaincodeServerOpts): ChaincodeServer;
}

Expand Down