Skip to content

Commit

Permalink
make WalletAccount, Domain and TonProof public in TonConnect
Browse files Browse the repository at this point in the history
  • Loading branch information
neodix42 committed Sep 12, 2024
1 parent 7bef8f0 commit bd68112
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 3 deletions.
6 changes: 6 additions & 0 deletions address/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,11 @@
<artifactId>commons-io</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.neodix42</groupId>
<artifactId>fift</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.ton.java.address;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.ton.java.fift.FiftRunner;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Paths;

@Slf4j
@RunWith(JUnit4.class)
public class TestAddressWithFift {
@Test
public void testAddressWithFift() throws URISyntaxException {

URL resource = TestAddressWithFift.class.getResource("/test-address.fif");
File fiftFile = Paths.get(resource.toURI()).toFile();
String absolutePath = fiftFile.getAbsolutePath();

FiftRunner fiftRunner = FiftRunner.builder().build();

String result = fiftRunner.run(fiftFile.getParent(), "-s", absolutePath, "EQDkZIvi6fkgNVxLOgw5hzquGhxhUvhvJ4B836p-NQ-iLKCv");
log.info("output: {}", result);

result = fiftRunner.run(fiftFile.getParent(), "-s", absolutePath, "Ef--_tW1zCy5ehTig0JrBEAiE67bbnSmqVtkuU8FFqlNUT9n");
log.info("output: {}", result);

result = fiftRunner.run(fiftFile.getParent(), "-s", absolutePath, "-1:0000d5b5cc2cb97a14e283426b04402213aedb6e74a6a95b64b94f0516a90000");
log.info("output: {}", result);

result = fiftRunner.run(fiftFile.getParent(), "-s", absolutePath, "EQCnuv-ZuR0QsIh5vwxUBuzzocSowbCa7ctdwl6QizBKzGVM");
log.info("output: {}", result);
}
}
22 changes: 22 additions & 0 deletions address/src/test/resources/test-address.fif
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/fift -s
"TonUtil.fif" include
"Asm.fif" include

$1 $>smca 0= abort"bad address"
rot . swap x. . cr

$1 $>smca
constant result
constant flags
constant wallet_addr
constant wc

."result: " result . cr
."flags: " flags . cr
."wallet_addr: " wallet_addr x. cr
."wc: " wc . cr
."Source wallet address = " wc wallet_addr .addr cr
."Non-bounceable address (for init only): " wc wallet_addr 1 .Addr cr
."Bounceable address (for later access): " wc wallet_addr 0 .Addr cr
."Non-bounceable address, Base64url (for init): " wc wallet_addr 5 .Addr cr
."Bounceable address, Base64url (for later access): " wc wallet_addr 4 .Addr cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Setter
@Getter
@ToString
class Domain {
public class Domain {
private int lengthBytes;
private String value;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Setter
@Getter
@ToString
class TonProof {
public class TonProof {
private long timestamp;
private Domain domain;
private String signature; // Base64UrlSafe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@Setter
@Getter
@ToString
class WalletAccount {
public class WalletAccount {
private String address;
private String publicKey;
private int chain;
Expand Down

0 comments on commit bd68112

Please sign in to comment.