base64 to byte array

This commit is contained in:
Phillip Lang Martinez 2023-08-22 22:46:58 -05:00
parent 34382b6e69
commit 24ff3ab581
2 changed files with 13 additions and 10 deletions

View File

@ -38,6 +38,7 @@ import org.qortal.transaction.Transaction.ValidationResult;
import org.qortal.transform.TransformationException; import org.qortal.transform.TransformationException;
import org.qortal.transform.transaction.DeployAtTransactionTransformer; import org.qortal.transform.transaction.DeployAtTransactionTransformer;
import org.qortal.utils.Base58; import org.qortal.utils.Base58;
import java.util.Base64;
@Path("/at") @Path("/at")
@Tag(name = "Automated Transactions") @Tag(name = "Automated Transactions")

View File

@ -1,10 +1,12 @@
package org.qortal.data.transaction; package org.qortal.data.transaction;
public class CreationRequest { import java.util.Base64;
public class CreationRequest {
private short ciyamAtVersion; private short ciyamAtVersion;
private byte[] codeBytes; private String codeBytesBase64;
private byte[] dataBytes; private String dataBytesBase64;
private short numCallStackPages; private short numCallStackPages;
private short numUserStackPages; private short numUserStackPages;
private long minActivationAmount; private long minActivationAmount;
@ -22,19 +24,19 @@ public class CreationRequest {
} }
public byte[] getCodeBytes() { public byte[] getCodeBytes() {
return codeBytes; return Base64.getDecoder().decode(this.codeBytesBase64);
} }
public void setCodeBytes(byte[] codeBytes) { public void setCodeBytesBase64(String codeBytesBase64) {
this.codeBytes = codeBytes; this.codeBytesBase64 = codeBytesBase64;
} }
public byte[] getDataBytes() { public byte[] getDataBytes() {
return dataBytes; return Base64.getDecoder().decode(this.dataBytesBase64);
} }
public void setDataBytes(byte[] dataBytes) { public void setDataBytesBase64(String dataBytesBase64) {
this.dataBytes = dataBytes; this.dataBytesBase64 = dataBytesBase64;
} }
public short getNumCallStackPages() { public short getNumCallStackPages() {
@ -60,4 +62,4 @@ public class CreationRequest {
public void setMinActivationAmount(long minActivationAmount) { public void setMinActivationAmount(long minActivationAmount) {
this.minActivationAmount = minActivationAmount; this.minActivationAmount = minActivationAmount;
} }
} }