Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/main/java/milfont/com/tezosj/data/TezosGateway.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public X509Certificate[] getAcceptedIssuers()

public JSONObject getHead() throws Exception
{
return (JSONObject) query("/chains/main/blocks/head", null);
return (JSONObject) query("/chains/main/blocks/head~2", null);
}

public JSONObject getAccountManagerForBlock(String blockHash, String accountID) throws Exception
Expand All @@ -195,7 +195,7 @@ public JSONObject getAccountManagerForBlock(String blockHash, String accountID)
// Gets the balance for a given address.
public JSONObject getBalance(String address) throws Exception
{
return (JSONObject) query("/chains/main/blocks/head/context/contracts/" + address + "/balance", null);
return (JSONObject) query("/chains/main/blocks/head~2/context/contracts/" + address + "/balance", null);
}

// Prepares and sends an operation to the Tezos node.
Expand All @@ -205,7 +205,7 @@ private JSONObject sendOperation(JSONArray operations, EncKeys encKeys) throws E
JSONObject head = new JSONObject();
String forgedOperationGroup = "";

head = (JSONObject) query("/chains/main/blocks/head/header", null);
head = (JSONObject) query("/chains/main/blocks/head~2/header", null);
forgedOperationGroup = forgeOperations(head, operations);

// Check for errors.
Expand Down Expand Up @@ -321,7 +321,7 @@ private JSONObject callRunOperation(JSONArray operations, EncKeys encKeys) throw
JSONObject head = new JSONObject();
String forgedOperationGroup = "";

head = (JSONObject) query("/chains/main/blocks/head/header", null);
head = (JSONObject) query("/chains/main/blocks/head~2/header", null);
forgedOperationGroup = forgeOperations(head, operations);

// Check for errors.
Expand Down Expand Up @@ -414,7 +414,7 @@ public JSONObject sendTransaction(String from, String to, BigDecimal amount, Big
}
}

head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), from);
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -498,7 +498,7 @@ public JSONObject reveal(String publicKeyHash, String publicKey, EncKeys encKeys
JSONObject account = new JSONObject();
Integer counter = 0;

head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), publicKeyHash);
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -583,7 +583,7 @@ private String forgeOperations(JSONObject blockHead, JSONArray operations) throw

private String nodeForgeOperations(String opGroup) throws Exception
{
JSONObject response = (JSONObject) query("/chains/main/blocks/head/helpers/forge/operations", opGroup);
JSONObject response = (JSONObject) query("/chains/main/blocks/head~2/helpers/forge/operations", opGroup);
String forgedOperation = (String) response.get("result");

return ((forgedOperation.replaceAll("\\n", "")).replaceAll("\"", "").replaceAll("'", ""));
Expand All @@ -610,7 +610,7 @@ private String computeOperationHash(SignedOperationGroup signedOpGroup) throws E

private JSONObject nodeApplyOperation(JSONArray payload) throws Exception
{
return (JSONObject) query("/chains/main/blocks/head/helpers/preapply/operations", payload.toString());
return (JSONObject) query("/chains/main/blocks/head~2/helpers/preapply/operations", payload.toString());
}

private JSONObject nodeRunOperation(JSONArray payload, String chainId) throws Exception
Expand All @@ -619,7 +619,7 @@ private JSONObject nodeRunOperation(JSONArray payload, String chainId) throws Ex
operation.put("operation", payload.get(0));
operation.put("chain_id", chainId);

return (JSONObject) query("/chains/main/blocks/head/helpers/scripts/run_operation", operation.toString());
return (JSONObject) query("/chains/main/blocks/head~2/helpers/scripts/run_operation", operation.toString());
}

private JSONObject applyOperation(JSONObject head, JSONArray operations, String operationGroupHash,
Expand Down Expand Up @@ -998,7 +998,7 @@ public JSONObject sendDelegationOperation(String delegator, String delegate, Big
}
}

head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), delegator);
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -1071,7 +1071,7 @@ public JSONObject sendOriginationOperation(String from, Boolean spendable, Boole
}
}

head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), from);
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -1194,7 +1194,7 @@ public JSONObject sendBatchTransactions(ArrayList<BatchTransactionItem> transact
roundedFee = item.getFee().setScale(6, BigDecimal.ROUND_HALF_UP);

// Get address counter.
head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), item.getFrom());
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -1266,7 +1266,7 @@ public Boolean waitForResult(String operationHash, Integer numberOfBlocksToWait)
{

// Get blockchain header.
response = (JSONObject) query("/chains/main/blocks/head/header", null);
response = (JSONObject) query("/chains/main/blocks/head~2/header", null);

// Acquaire current blockchain block (level) if it is zero yet.
if(currentBlockNumber == 0)
Expand Down Expand Up @@ -1444,7 +1444,7 @@ public JSONObject callContractEntryPoint(String from, String contract, BigDecima
}
}

head = new JSONObject(query("/chains/main/blocks/head/header", null).toString());
head = new JSONObject(query("/chains/main/blocks/head~2/header", null).toString());
account = getAccountForBlock(head.get("hash").toString(), from);
counter = Integer.parseInt(account.get("counter").toString());

Expand Down Expand Up @@ -1917,7 +1917,7 @@ private Pair buildParameterPairs(JSONObject jsonObj, Pair pair, List<String> par
private String[] getContractEntryPoints(String contractAddress) throws Exception
{
JSONObject response = (JSONObject) query(
"/chains/main/blocks/head/context/contracts/" + contractAddress + "/entrypoints", null);
"/chains/main/blocks/head~2/context/contracts/" + contractAddress + "/entrypoints", null);

JSONObject entryPointsJson = (JSONObject) response.get("entrypoints");

Expand Down Expand Up @@ -1956,7 +1956,7 @@ private String[] getContractEntryPointsParameters(String contractAddress, String
}

JSONObject response = (JSONObject) query(
"/chains/main/blocks/head/context/contracts/" + contractAddress + "/entrypoints/" + entrypoint, null);
"/chains/main/blocks/head~2/context/contracts/" + contractAddress + "/entrypoints/" + entrypoint, null);

JSONArray paramArray = decodeParameters(response, null);

Expand Down Expand Up @@ -2041,7 +2041,7 @@ public ArrayList<Map> getContractStorage(String contractAddress) throws Exceptio

ArrayList<Map> items = new ArrayList<Map>();

JSONObject response = (JSONObject) query("/chains/main/blocks/head/context/contracts/" + contractAddress + "/storage/", null);
JSONObject response = (JSONObject) query("/chains/main/blocks/head~2/context/contracts/" + contractAddress + "/storage/", null);

JSONArray storageArray = decodeParameters(response, null);

Expand Down Expand Up @@ -2116,7 +2116,7 @@ public Boolean waitForAndCheckResult(String operationHash, Integer numberOfBlock
{

// Get blockchain header.
response = (JSONObject) query("/chains/main/blocks/head/header", null);
response = (JSONObject) query("/chains/main/blocks/head~2/header", null);

// Acquaire current blockchain block (level) if it is zero yet.
if(currentBlockNumber == 0)
Expand Down Expand Up @@ -2281,7 +2281,7 @@ public JSONObject waitForAndCheckResultByDestinationAddress(String address, Inte
{

// Get blockchain header.
response = (JSONObject) query("/chains/main/blocks/head/header", null);
response = (JSONObject) query("/chains/main/blocks/head~2/header", null);

// Acquaire current blockchain block (level) if it is zero yet.
if(currentBlockNumber == 0)
Expand Down