Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: setup things for new network #302

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ dependencies {
intTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
intTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
// TODO very obsolete and should be refactored out or updated
implementation 'org.web3j:core:[4,5.0.0)'
implementation 'org.web3j:core:5.0.0'
implementation 'com.auth0:java-jwt:4.0.0'
implementation 'org.json:json:20220320' // To ensure obsolete trulioo code can compile
implementation group: 'com.github.cliftonlabs', name: 'json-simple', version: '[4.0.1, 5)'
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/alphawallet/ethereum/ERC721Token.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
package com.alphawallet.ethereum;

import org.web3j.abi.datatypes.Address;
import org.web3j.abi.datatypes.DynamicArray;
import org.web3j.abi.datatypes.DynamicBytes;
import org.web3j.abi.datatypes.DynamicStruct;
import org.web3j.abi.datatypes.Type;
import org.web3j.abi.datatypes.generated.Uint256;

import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ERC721Token extends DynamicStruct
public class ERC721Token extends DynamicArray
{
public Address address;
public Uint256 tokenId;
Expand Down
17 changes: 6 additions & 11 deletions src/main/java/org/tokenscript/attestation/demo/SmartContract.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public TicketAttestationReturn callVerifyTicketAttestation(byte[] attestation, S
}

private TicketAttestationReturn runVerifyTicketAttestationSC(Function function) {
Web3j web3j = getRinkebyWeb3j();
Web3j web3j = getWeb3j();
String result = callSmartContractFunction(web3j, function, TICKET_VERIFICATION_CONTRACT);
List<Type> responseValues = FunctionReturnDecoder.decode(result, function.getOutputParameters());
TicketAttestationReturn retVal = new TicketAttestationReturn();
Expand All @@ -89,7 +89,7 @@ private TicketAttestationReturn runVerifyTicketAttestationSC(Function function)

public AttestationReturn callVerifyNFTAttestation(byte[] att, String sender)
{
Web3j web3j = getRinkebyWeb3j();
Web3j web3j = getWeb3j();
Function function = verifyNFTAttestation(att, sender);
String result = callSmartContractFunction(web3j, function, ATTESTATION_VERIFICATION_CONTRACT);
List<Type> responseValues = FunctionReturnDecoder.decode(result, function.getOutputParameters());
Expand Down Expand Up @@ -143,7 +143,7 @@ private boolean callFunction(Function function)

private List<Address> callAddrFunction(Function function)
{
Web3j web3j = getRinkebyWeb3j();
Web3j web3j = getWeb3j();
List<Address> addrList = new ArrayList<>();

try
Expand Down Expand Up @@ -280,14 +280,9 @@ private OkHttpClient buildClient()
private Web3j getWeb3j()
{
//Infura
HttpService nodeService = new HttpService("https://kovan.infura.io/v3/b567f041158a4676898698c2d4c5f478", buildClient(), false);
return Web3j.build(nodeService);
}

private Web3j getRinkebyWeb3j()
{
//Infura
HttpService nodeService = new HttpService("https://rinkeby.infura.io/v3/b567f041158a4676898698c2d4c5f478", buildClient(), false);
//TODO update network
HttpService nodeService = new HttpService(
"https://goerli.infura.io/v3/b567f041158a4676898698c2d4c5f478", buildClient(), false);
return Web3j.build(nodeService);
}
}