one link at a time

pull/1009/head
James Sangalli 5 years ago
parent b3626076f8
commit 033a5a2411
  1. 15
      dmz/src/main/java/com/alphawallet/token/web/Service/SpawnableLinkGenerator.java

@ -13,14 +13,14 @@ import java.util.List;
class SpawnableLinkGenerator { class SpawnableLinkGenerator {
private static List<BigInteger> tokens = new ArrayList<>(); private static List<BigInteger> tokens = new ArrayList<>();
private static final String contractAddress = "0xE4Eb58eB8D83043a875d7Cfd557a269c413702Ed"; private static final String contractAddress = "0xC1c14278Cc455d9dFA0b0257aF40862bD8677EFC";
private static ParseMagicLink parseMagicLink = new ParseMagicLink(new CryptoFunctions(), null); private static ParseMagicLink parseMagicLink = new ParseMagicLink(new CryptoFunctions(), null);
//TODO set private key & chain id //TODO set private key & chain id
private static final BigInteger privateKey = BigInteger.TEN; private static final BigInteger privateKey = BigInteger.TEN;
private static final int chainId = 3; private static final int chainId = 4;
// Time todo put in right format & set each time // Time todo put in right format & set each time
private static final String date = "20200706210000+0300"; private static final String date = "20240706210000+0300";
// Cities // Cities
private static final long COPENHAGEN = 1; private static final long COPENHAGEN = 1;
private static final long SAINT_PETERSBERG = 2; private static final long SAINT_PETERSBERG = 2;
@ -71,7 +71,7 @@ class SpawnableLinkGenerator {
public static void main(String[] args) throws SalesOrderMalformed { public static void main(String[] args) throws SalesOrderMalformed {
//TODO set token ids here //TODO set token ids here
new SpawnableLinkGenerator(date, LONDON, PARKEN_STADIUM, TEAM_A, TEAM_B, 10); new SpawnableLinkGenerator(date, LONDON, PARKEN_STADIUM, TEAM_A, TEAM_B, 5);
} }
private SpawnableLinkGenerator( private SpawnableLinkGenerator(
@ -84,18 +84,15 @@ class SpawnableLinkGenerator {
) throws SalesOrderMalformed { ) throws SalesOrderMalformed {
// Set values here // Set values here
setTokenIds(date, city, venue, teamA, teamB, THE_CLUB, quantity); setTokenIds(date, city, venue, teamA, teamB, THE_CLUB, quantity);
createSpawnableLink(5); createSpawnableLink();
} }
private void createSpawnableLink(int quantity) throws SalesOrderMalformed { private void createSpawnableLink() throws SalesOrderMalformed {
byte[] message = parseMagicLink.getSpawnableBytes(tokens, contractAddress, BigInteger.ZERO, expiry); byte[] message = parseMagicLink.getSpawnableBytes(tokens, contractAddress, BigInteger.ZERO, expiry);
byte[] signature = signMagicLink(message); byte[] signature = signMagicLink(message);
byte[] linkData = ParseMagicLink.generateSpawnableLeadingLinkBytes(tokens, contractAddress, BigInteger.ZERO, expiry); byte[] linkData = ParseMagicLink.generateSpawnableLeadingLinkBytes(tokens, contractAddress, BigInteger.ZERO, expiry);
String link = parseMagicLink.completeUniversalLink(chainId, linkData, signature); String link = parseMagicLink.completeUniversalLink(chainId, linkData, signature);
while(quantity > 0) {
System.out.println(link); System.out.println(link);
quantity--;
}
} }
private void setTokenIds(String date, long city, long venue, String teamA, String teamB, long category, int quantity) private void setTokenIds(String date, long city, long venue, String teamA, String teamB, long category, int quantity)

Loading…
Cancel
Save