Advertisement
Brord

CDA new depositAddress

Apr 5th, 2019
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.14 KB | None | 0 0
  1.         String network = "nodes.devnet.iota.org";
  2.         int port = 443;
  3.            
  4.         IotaAPI api = new IotaAPI.Builder()
  5.                 .host(network)
  6.                 .port(port)
  7.                 .protocol("https")
  8.                 .timeout(500)
  9.                 .localPoW(new PearlDiverLocalPoW())
  10.                 .build();  
  11.        
  12.         String seed = "9999999999TESTSEED9999999";
  13.        
  14.         IotaAccount account = new IotaAccount.Builder(seed)
  15.                 .api(api)
  16.                 .securityLevel(2)
  17.                 .mwm(14)
  18.                 .store(new AccountFileStore("account.store"))
  19.                 .build();
  20.  
  21.         // One hour timeout
  22.         Date hour = new Date(System.currentTimeMillis() + 1000 * 60 * 60);
  23.         Future<ConditionalDepositAddress> dep = account.newDepositAddress(hour, false, 1000);
  24.  
  25.         String magnet = DepositFactory.get().build(dep.get(), MagnetMethod.class);
  26.  
  27.         // iota://YWEQLREFJQORXXKKEBBBDKOPAXHXJRGVPBUTBJFSRPPYVWWYUWSBDJTIUBJVFREXEAUZWRICKH9VBSQE9KPNLTCLNC/?timeout_at=1554472983208&multi_use=false&expected_amount=1000
  28.         System.out.println(magnet);
  29.  
  30.         account.shutdown();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement