Skip to content

Commit

Permalink
add sign api for state channel
Browse files Browse the repository at this point in the history
  • Loading branch information
MickWang authored and xizho10 committed May 30, 2019
1 parent 36536fe commit bdeec87
Show file tree
Hide file tree
Showing 5 changed files with 5,334 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MessageApi } from './message';
import { NetworkApi } from './network';
import { ProviderApi } from './provider';
import { SmartContractApi } from './smartContract';
import { StateChannelApi } from './stateChannel';
import { UtilsApi } from './utils';

export * from './types';
Expand All @@ -22,4 +23,5 @@ export interface DApi {
provider: ProviderApi;
smartContract: SmartContractApi;
utils: UtilsApi;
stateChannel: StateChannelApi;
}
13 changes: 13 additions & 0 deletions src/api/stateChannel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Response } from './types';

export interface StateChannelApi {
sign({
channelId,
scriptHash,
message
}: {
channelId: string,
scriptHash: string,
message: string
}): Promise<Response>;
}
9 changes: 9 additions & 0 deletions src/client/stateChannel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { StateChannelApi } from '../api/stateChannel';
import { Response } from '../api/types';
import { call } from './proxy';

export const stateChannelApi: StateChannelApi = {
sign(args) {
return call<Response>('stateChannel.sign', args);
}
};
2 changes: 2 additions & 0 deletions src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,6 @@ export function registerProvider({ provider, logMessages }: { provider: DApi; lo
checkedRegister('smartContract.deploy', provider.smartContract.deploy);

checkedRegister('provider.getProvider', provider.provider.getProvider);

checkedRegister('stateChannel.sign', provider.stateChannel.sign);
}
Loading

0 comments on commit bdeec87

Please sign in to comment.