Skip to content

Commit

Permalink
feat: APIGetContractByID (needed for integration test)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomshinichi committed May 27, 2019
1 parent 9bf402a commit 1bf0497
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions aeternity/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,20 @@ func getOracleQueriesByPubkey(node *apiclient.Node, pubkey string) (oracleQuerie
oracleQueries = r.Payload
return
}

// APIGetContractByID gets a contract by ct_ ID
func (ae *Ae) APIGetContractByID(ctID string) (contract *models.ContractObject, err error) {
return getContractByID(ae.Node, ctID)
}

// getContractByID get a contract by ct_ ID
func getContractByID(node *apiclient.Node, ctID string) (contract *models.ContractObject, err error) {
p := external.NewGetContractParams().WithPubkey(ctID)
r, err := node.External.GetContract(p)
if err != nil {
err = fmt.Errorf("Error: %v", getErrorReason(err))
return
}
contract = r.Payload
return
}

0 comments on commit 1bf0497

Please sign in to comment.