com.github.DNAProject.smartcontract.neovm.Record Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2018 The DNA Authors
* This file is part of The DNA library.
*
* The DNA is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The DNA is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with The DNA. If not, see .
*
*/
package com.github.DNAProject.smartcontract.neovm;
import com.alibaba.fastjson.JSON;
import com.github.DNAProject.DnaSdk;
import com.github.DNAProject.common.Common;
import com.github.DNAProject.common.ErrorCode;
import com.github.DNAProject.common.Helper;
import com.github.DNAProject.core.transaction.Transaction;
import com.github.DNAProject.crypto.KeyType;
import com.github.DNAProject.sdk.exception.SDKException;
import com.github.DNAProject.sdk.info.AccountInfo;
import com.github.DNAProject.smartcontract.neovm.abi.BuildParams;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
public class Record {
private DnaSdk sdk;
private String contractAddress = null;
public Record(DnaSdk sdk) {
this.sdk = sdk;
}
public void setContractAddress(String codeHash) {
this.contractAddress = codeHash.replace("0x", "");
}
public String getContractAddress() {
return contractAddress;
}
public String sendPut(String addr,String password,byte[] salt, String key,String value,long gaslimit,long gas) throws Exception {
if (contractAddress == null) {
throw new SDKException(ErrorCode.NullCodeHash);
}
if (key == null || value == null || key == "" || value == ""){
throw new SDKException(ErrorCode.NullKeyOrValue);
}
addr = addr.replace(Common.diddna,"");
byte[] did = (Common.diddna + addr).getBytes();
AccountInfo info = sdk.getWalletMgr().getAccountInfo(Common.diddna + addr, password,salt);
byte[] pk = Helper.hexToBytes(info.pubkey);
List list = new ArrayList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy