forked from Qortal/qortal
add endpoint
This commit is contained in:
parent
9428f9688f
commit
34382b6e69
@ -27,6 +27,7 @@ import org.qortal.api.ApiException;
|
||||
import org.qortal.api.ApiExceptionFactory;
|
||||
import org.qortal.data.at.ATData;
|
||||
import org.qortal.data.at.ATStateData;
|
||||
import org.qortal.data.transaction.CreationRequest;
|
||||
import org.qortal.data.transaction.DeployAtTransactionData;
|
||||
import org.qortal.repository.DataException;
|
||||
import org.qortal.repository.Repository;
|
||||
@ -156,6 +157,41 @@ public class AtResource {
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/createMachineState")
|
||||
@Operation(
|
||||
summary = "Create MachineState bytes from the provided parameters",
|
||||
requestBody = @RequestBody(
|
||||
required = true,
|
||||
content = @Content(
|
||||
mediaType = MediaType.APPLICATION_JSON,
|
||||
schema = @Schema(
|
||||
implementation = CreationRequest.class
|
||||
)
|
||||
)
|
||||
),
|
||||
responses = {
|
||||
@ApiResponse(
|
||||
description = "MachineState bytes",
|
||||
content = @Content(
|
||||
mediaType = MediaType.TEXT_PLAIN,
|
||||
schema = @Schema(
|
||||
type = "string"
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
)
|
||||
public byte[] createMachineState(CreationRequest request) {
|
||||
return MachineState.toCreationBytes(
|
||||
request.getCiyamAtVersion(),
|
||||
request.getCodeBytes(),
|
||||
request.getDataBytes(),
|
||||
request.getNumCallStackPages(),
|
||||
request.getNumUserStackPages(),
|
||||
request.getMinActivationAmount()
|
||||
);
|
||||
}
|
||||
@POST
|
||||
@Operation(
|
||||
summary = "Build raw, unsigned, DEPLOY_AT transaction",
|
||||
|
@ -0,0 +1,63 @@
|
||||
package org.qortal.data.transaction;
|
||||
|
||||
public class CreationRequest {
|
||||
|
||||
private short ciyamAtVersion;
|
||||
private byte[] codeBytes;
|
||||
private byte[] dataBytes;
|
||||
private short numCallStackPages;
|
||||
private short numUserStackPages;
|
||||
private long minActivationAmount;
|
||||
|
||||
// Default constructor for JSON deserialization
|
||||
public CreationRequest() {}
|
||||
|
||||
// Getters and setters
|
||||
public short getCiyamAtVersion() {
|
||||
return ciyamAtVersion;
|
||||
}
|
||||
|
||||
public void setCiyamAtVersion(short ciyamAtVersion) {
|
||||
this.ciyamAtVersion = ciyamAtVersion;
|
||||
}
|
||||
|
||||
public byte[] getCodeBytes() {
|
||||
return codeBytes;
|
||||
}
|
||||
|
||||
public void setCodeBytes(byte[] codeBytes) {
|
||||
this.codeBytes = codeBytes;
|
||||
}
|
||||
|
||||
public byte[] getDataBytes() {
|
||||
return dataBytes;
|
||||
}
|
||||
|
||||
public void setDataBytes(byte[] dataBytes) {
|
||||
this.dataBytes = dataBytes;
|
||||
}
|
||||
|
||||
public short getNumCallStackPages() {
|
||||
return numCallStackPages;
|
||||
}
|
||||
|
||||
public void setNumCallStackPages(short numCallStackPages) {
|
||||
this.numCallStackPages = numCallStackPages;
|
||||
}
|
||||
|
||||
public short getNumUserStackPages() {
|
||||
return numUserStackPages;
|
||||
}
|
||||
|
||||
public void setNumUserStackPages(short numUserStackPages) {
|
||||
this.numUserStackPages = numUserStackPages;
|
||||
}
|
||||
|
||||
public long getMinActivationAmount() {
|
||||
return minActivationAmount;
|
||||
}
|
||||
|
||||
public void setMinActivationAmount(long minActivationAmount) {
|
||||
this.minActivationAmount = minActivationAmount;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user