Skip to content

Commit d277c8a

Browse files
committed
feat: support DeployContract
1 parent 9ff22ed commit d277c8a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

internal/blockchain/cardano/cardano.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,21 @@ func (c *Cardano) SubmitNetworkAction(ctx context.Context, nsOpID string, signin
189189
}
190190

191191
func (c *Cardano) DeployContract(ctx context.Context, nsOpID, signingKey string, definition, contract *fftypes.JSONAny, input []interface{}, options map[string]interface{}) (submissionRejected bool, err error) {
192-
return true, errors.New("DeployContract not supported")
192+
body := map[string]interface{}{
193+
"id": nsOpID,
194+
"contract": contract,
195+
"definition": definition,
196+
}
197+
var resErr common.BlockchainRESTError
198+
res, err := c.client.R().
199+
SetContext(ctx).
200+
SetBody(body).
201+
SetError(&resErr).
202+
Post("/contracts/deploy")
203+
if err != nil || !res.IsSuccess() {
204+
return resErr.SubmissionRejected, common.WrapRESTError(ctx, &resErr, res, err, coremsgs.MsgCardanoconnectRESTErr)
205+
}
206+
return false, nil
193207
}
194208

195209
func (c *Cardano) ValidateInvokeRequest(ctx context.Context, parsedMethod interface{}, input map[string]interface{}, hasMessage bool) error {

0 commit comments

Comments
 (0)