@@ -16,6 +16,7 @@ import { decodeGetTransactionReceiptProofResponse, encodeGetTransactionReceiptPr
1616import { decodeGetBlockResponse , encodeGetBlockRequest , GetBlockResponse } from "../codec/OpGetBlock" ;
1717import axios , { AxiosResponse } from "axios" ;
1818import { getTextDecoder } from "../membuffers/text" ;
19+ import { Signer } from "../crypto/Signature" ;
1920
2021const PROTOCOL_VERSION = 1 ;
2122const CONTENT_TYPE_MEMBUFFERS = "application/membuffers" ;
@@ -29,46 +30,44 @@ export const PROCESSOR_TYPE_NATIVE = 1;
2930export const PROCESSOR_TYPE_JAVASCRIPT = 2 ;
3031
3132export class Client {
32- constructor ( private endpoint : string , private virtualChainId : number , private networkType : NetworkType ) { }
33+ constructor ( private endpoint : string , private virtualChainId : number , private networkType : NetworkType , private signer : Signer ) { }
3334
34- createTransaction ( publicKey : Uint8Array , privateKey : Uint8Array , contractName : string , methodName : string , inputArguments : Argument [ ] ) : [ Uint8Array , string ] {
35+ createTransaction ( contractName : string , methodName : string , inputArguments : Argument [ ] ) : [ Uint8Array , string ] {
3536 const [ req , rawTxId ] = encodeSendTransactionRequest (
3637 {
3738 protocolVersion : PROTOCOL_VERSION ,
3839 virtualChainId : this . virtualChainId ,
3940 timestamp : new Date ( ) ,
4041 networkType : this . networkType ,
41- publicKey : publicKey ,
4242 contractName : contractName ,
4343 methodName : methodName ,
4444 inputArguments : inputArguments ,
4545 } ,
46- privateKey ,
46+ this . signer ,
4747 ) ;
4848 return [ req , Encoding . encodeHex ( rawTxId ) ] ;
4949 }
5050
51- createDeployTransaction ( publicKey : Uint8Array , privateKey : Uint8Array , contractName : string , processorType : number , ...sources : Uint8Array [ ] ) : [ Uint8Array , string ] {
51+ createDeployTransaction ( contractName : string , processorType : number , ...sources : Uint8Array [ ] ) : [ Uint8Array , string ] {
5252 const inputArguments : Argument [ ] = [
5353 argString ( contractName ) ,
5454 argUint32 ( processorType ) ,
5555 ...sources . map ( argBytes )
5656 ] ;
5757
58- return this . createTransaction ( publicKey , privateKey , "_Deployments" , "deployService" , inputArguments ) ;
58+ return this . createTransaction ( "_Deployments" , "deployService" , inputArguments ) ;
5959 }
6060
61- createQuery ( publicKey : Uint8Array , contractName : string , methodName : string , inputArguments : Argument [ ] ) : Uint8Array {
61+ createQuery ( contractName : string , methodName : string , inputArguments : Argument [ ] ) : Uint8Array {
6262 return encodeRunQueryRequest ( {
6363 protocolVersion : PROTOCOL_VERSION ,
6464 virtualChainId : this . virtualChainId ,
6565 timestamp : new Date ( ) ,
6666 networkType : this . networkType ,
67- publicKey : publicKey ,
6867 contractName : contractName ,
6968 methodName : methodName ,
7069 inputArguments : inputArguments ,
71- } ) ;
70+ } , this . signer ) ;
7271 }
7372
7473 protected createGetTransactionStatusPayload ( txId : string ) : Uint8Array {
0 commit comments