@@ -43,10 +43,32 @@ func (s *ConstructionAPIService) ConstructionMetadata(
4343
4444// ConstructionCombine implements the /construction/combine endpoint.
4545func (s * ConstructionAPIService ) ConstructionCombine (
46- context.Context ,
47- * types.ConstructionCombineRequest ,
46+ ctx context.Context ,
47+ request * types.ConstructionCombineRequest ,
4848) (* types.ConstructionCombineResponse , * types.Error ) {
49- panic ("implement me" )
49+ tx , err := ckbRpc .TransactionFromString (request .UnsignedTransaction )
50+ if err != nil {
51+ return nil , & types.Error {
52+ Code : 11 ,
53+ Message : fmt .Sprintf ("can not decode transaction string: %s" , request .UnsignedTransaction ),
54+ Retriable : false ,
55+ }
56+ }
57+ index := 0
58+ for i , witness := range tx .Witnesses {
59+ if len (witness ) != 0 {
60+ tx .Witnesses [i ] = request .Signatures [index ].Bytes
61+ index ++
62+ }
63+ }
64+
65+ txString , err := ckbRpc .TransactionString (tx )
66+ if err != nil {
67+ return nil , ServerError
68+ }
69+ return & types.ConstructionCombineResponse {
70+ SignedTransaction : txString ,
71+ }, nil
5072}
5173
5274// ConstructionDerive implements the /construction/derive endpoint.
@@ -274,11 +296,12 @@ func (s *ConstructionAPIService) ConstructionPayloads(
274296 if err != nil {
275297 return nil , ServerError
276298 }
299+
300+ // TODO remove to transaction generated
277301 payload , err := ckbTransaction .SingleSegmentSignMessage (tx , group [0 ], group [0 ]+ len (group ), witnessArgs )
278302 if err != nil {
279303 return nil , ServerError
280304 }
281-
282305 payloads = append (payloads , & types.SigningPayload {
283306 Address : operation .Account .Address ,
284307 Bytes : payload ,
0 commit comments