-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeployContract implementation for Tezos connector #1481
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -311,7 +311,35 @@ func (t *Tezos) SubmitNetworkAction(ctx context.Context, nsOpID string, signingK | |
} | ||
|
||
func (t *Tezos) DeployContract(ctx context.Context, nsOpID, signingKey string, definition, contract *fftypes.JSONAny, input []interface{}, options map[string]interface{}) (submissionRejected bool, err error) { | ||
return true, i18n.NewError(ctx, coremsgs.MsgNotSupportedByBlockchainPlugin) | ||
if t.metrics.IsMetricsEnabled() { | ||
t.metrics.BlockchainContractDeployment() | ||
} | ||
headers := TezosconnectMessageHeaders{ | ||
Type: core.DeployContract, | ||
ID: nsOpID, | ||
} | ||
body := map[string]interface{}{ | ||
"headers": &headers, | ||
"contract": contract, | ||
"from": signingKey, | ||
} | ||
|
||
body, err = t.applyOptions(ctx, body, options) | ||
if err != nil { | ||
return true, err | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For clarification, let's use resErr.SubmissionRejected instead as we did it below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. resErr.SubmissionRejected is a bool value, applyOptions returns error There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean, instead of 'true' value |
||
} | ||
|
||
var resErr common.BlockchainRESTError | ||
res, err := t.client.R(). | ||
SetContext(ctx). | ||
SetBody(body). | ||
SetError(&resErr). | ||
Post("/") | ||
if err != nil || !res.IsSuccess() { | ||
return resErr.SubmissionRejected, common.WrapRESTError(ctx, &resErr, res, err, coremsgs.MsgTezosconnectRESTErr) | ||
} | ||
|
||
return false, nil | ||
} | ||
|
||
func (t *Tezos) ValidateInvokeRequest(ctx context.Context, parsedMethod interface{}, input map[string]interface{}, hasMessage bool) error { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check doesn't make sense since at line 743 we already set "from" to signingKey