Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import java.lang.reflect.Array;
import java.util.*;
Expand Down Expand Up @@ -139,7 +139,7 @@ else if (str.charAt(i) == ')') {
return Arrays.asList(tupleSeg);
}

static int findBoolLR(Type[] typeArray, int index, int delta) {
protected static int findBoolLR(Type[] typeArray, int index, int delta) {
int until = 0;
while (true) {
int currentIndex = index + delta * until;
Expand All @@ -158,7 +158,13 @@ else if (currentIndex != 0 && delta < 0)
return until;
}

static Object[] unifyToArrayOfObjects(Object val) {
/**
* Given an array/list-like object, infer an array of objects
* @param val an array/list-like object
* @return inferred array of objects
* @throws IllegalArgumentException if it cannot infer if the object is list or array
*/
protected static Object[] unifyToArrayOfObjects(Object val) {
if (val.getClass().isArray()) {
if (val instanceof Object[])
return (Object[]) val;
Expand All @@ -180,7 +186,7 @@ static Object[] unifyToArrayOfObjects(Object val) {
* @return the first 2 bytes of the ABI encoding byte array
* @throws IllegalArgumentException if the encoded byte array has length < 2
*/
public static byte[] getLengthEncoded(byte[] encoded) {
protected static byte[] getLengthEncoded(byte[] encoded) {
if (encoded.length < ABI_DYNAMIC_HEAD_BYTE_LEN)
throw new IllegalArgumentException("encode byte size too small, less than 2 bytes");
byte[] encodedLength = new byte[ABI_DYNAMIC_HEAD_BYTE_LEN];
Expand All @@ -195,7 +201,7 @@ public static byte[] getLengthEncoded(byte[] encoded) {
* @return the tailing bytes after the first 2 bytes of the ABI encoding byte array
* @throws IllegalArgumentException if the encoded byte array has length < 2
*/
public static byte[] getContentEncoded(byte[] encoded) {
protected static byte[] getContentEncoded(byte[] encoded) {
if (encoded.length < ABI_DYNAMIC_HEAD_BYTE_LEN)
throw new IllegalArgumentException("encode byte size too small, less than 2 bytes");
byte[] encodedString = new byte[encoded.length - ABI_DYNAMIC_HEAD_BYTE_LEN];
Expand All @@ -209,7 +215,7 @@ public static byte[] getContentEncoded(byte[] encoded) {
* @param t ABI type of the element of the ABI array
* @return a type-cast from ABI array to an ABI tuple type
*/
public static TypeTuple castToTupleType(int size, Type t) {
protected static TypeTuple castToTupleType(int size, Type t) {
List<Type> tupleTypes = new ArrayList<>();
for (int i = 0; i < size; i++)
tupleTypes.add(t);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.crypto.Address;
import org.apache.commons.lang3.ArrayUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.util.Encoder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

public class TypeArrayStatic extends Type {
public final Type elemType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

public class TypeBool extends Type {
public TypeBool() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

public class TypeByte extends Type {
public TypeByte() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.util.Encoder;
import org.apache.commons.lang3.ArrayUtils;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.algod.client.StringUtil;
import com.algorand.algosdk.util.Encoder;

import java.lang.reflect.Array;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.util.Encoder;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.util.Encoder;

import java.math.BigInteger;
import java.nio.ByteBuffer;

public class TypeUint extends Type {
public final int bitSize;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.crypto.Address;
import com.algorand.algosdk.util.Encoder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.util.Encoder;
import org.assertj.core.util.Arrays;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import com.algorand.algosdk.crypto.Address;
import com.algorand.algosdk.util.Encoder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.algorand.algosdk.util.abi;
package com.algorand.algosdk.abi;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
Expand Down