diff --git a/README.md b/README.md
index 0501fab1..6d289b53 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ Do not forget to place tonlibjson library to your project. Latest Tonlib librari
io.github.neodix42
smartcontract
- 0.1.2
+ 0.1.3
```
@@ -32,7 +32,7 @@ Do not forget to place tonlibjson library to your project. Latest Tonlib librari
io.github.neodix42
ton4j
- 0.1.2
+ 0.1.3
```
diff --git a/address/README.md b/address/README.md
index 3b5fca3b..51c03edf 100644
--- a/address/README.md
+++ b/address/README.md
@@ -6,7 +6,7 @@
io.github.neodix42
address
- 0.1.2
+ 0.1.3
```
@@ -17,7 +17,7 @@
io.github.neodix42.ton4j
address
- 0.1.2
+ 0.1.3
```
diff --git a/address/pom.xml b/address/pom.xml
index 77e9c837..b4ed76d9 100644
--- a/address/pom.xml
+++ b/address/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/bitstring/README.md b/bitstring/README.md
index 527b7466..9540b3b2 100644
--- a/bitstring/README.md
+++ b/bitstring/README.md
@@ -6,7 +6,7 @@
io.github.neodix42
bitstring
- 0.1.2
+ 0.1.3
```
@@ -16,7 +16,7 @@
io.github.neodix42.ton4j
bitstring
- 0.1.2
+ 0.1.3
```
diff --git a/bitstring/pom.xml b/bitstring/pom.xml
index c60b4484..fc5f3432 100644
--- a/bitstring/pom.xml
+++ b/bitstring/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/cell/README.md b/cell/README.md
index 4a0130cf..39defa54 100644
--- a/cell/README.md
+++ b/cell/README.md
@@ -6,7 +6,7 @@
io.github.neodix42
cell
- 0.1.2
+ 0.1.3
```
@@ -16,7 +16,7 @@
io.github.neodix42.ton4j
cell
- 0.1.2
+ 0.1.3
```
diff --git a/cell/pom.xml b/cell/pom.xml
index 21da23af..58b38363 100644
--- a/cell/pom.xml
+++ b/cell/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/mnemonic/README.md b/mnemonic/README.md
index 2182759e..4cb33ccc 100644
--- a/mnemonic/README.md
+++ b/mnemonic/README.md
@@ -6,7 +6,7 @@
io.github.neodix42
mnemonic
- 0.1.2
+ 0.1.3
```
@@ -16,7 +16,7 @@
io.github.neodix42.ton4j
mnemonic
- 0.1.2
+ 0.1.3
```
diff --git a/mnemonic/pom.xml b/mnemonic/pom.xml
index 4cc5fc44..645c4de9 100644
--- a/mnemonic/pom.xml
+++ b/mnemonic/pom.xml
@@ -5,7 +5,7 @@
top
io.github.neodix42
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/pom.xml b/pom.xml
index 90b0ee36..b23f7f57 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
io.github.neodix42
top
pom
- 0.1.2
+ 0.1.3
bitstring
diff --git a/smartcontract/README.md b/smartcontract/README.md
index d4e26c15..d29671f2 100644
--- a/smartcontract/README.md
+++ b/smartcontract/README.md
@@ -7,7 +7,7 @@
io.github.neodix42
smartcontract
- 0.1.2
+ 0.1.3
```
@@ -18,7 +18,7 @@
io.github.neodix42.ton4j
smartcontract
- 0.1.2
+ 0.1.3
```
diff --git a/smartcontract/pom.xml b/smartcontract/pom.xml
index b4023bae..a08cdaf0 100644
--- a/smartcontract/pom.xml
+++ b/smartcontract/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/smartcontract/src/main/java/org/ton/java/smartcontract/types/WalletVersion.java b/smartcontract/src/main/java/org/ton/java/smartcontract/types/WalletVersion.java
index da9dda33..5d80c704 100644
--- a/smartcontract/src/main/java/org/ton/java/smartcontract/types/WalletVersion.java
+++ b/smartcontract/src/main/java/org/ton/java/smartcontract/types/WalletVersion.java
@@ -25,7 +25,11 @@ public enum WalletVersion {
/**
* reserved for internal usage
*/
- config("Config");
+ config("Config"),
+ /**
+ * reserved for internal usage
+ */
+ unidentified("Unidentified");
private final String value;
diff --git a/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/Wallet.java b/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/Wallet.java
index 303cc4ac..6947e284 100644
--- a/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/Wallet.java
+++ b/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/Wallet.java
@@ -56,6 +56,7 @@ public T create() {
case multisig -> new MultisigWallet(options);
case master -> throw new Error("not implemented");
case config -> throw new Error("not implemented");
+ case unidentified -> throw new Error("not implemented");
};
return (T) result;
diff --git a/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/v4/WalletV4ContractR2.java b/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/v4/WalletV4ContractR2.java
index bbf4526e..6ac3ae4e 100644
--- a/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/v4/WalletV4ContractR2.java
+++ b/smartcontract/src/main/java/org/ton/java/smartcontract/wallet/v4/WalletV4ContractR2.java
@@ -313,4 +313,109 @@ private SubscriptionInfo parseSubscriptionData(List subscriptionData) {
.subscriptionId(subscriptionId.getNumber().longValue())
.build();
}
+
+
+ /**
+ * Sends amount of toncoins to destination address using auto-fetched seqno without the body and default send-mode 3
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount) {
+ long seqno = getSeqno(tonlib);
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno);
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using specified seqno with the body and default send-mode 3
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param body byte[]
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, long seqno, byte[] body) {
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, body);
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using specified seqno with the body and specified send-mode
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param body byte[]
+ * @param sendMode byte
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, long seqno, byte[] body, byte sendMode) {
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, body, sendMode);
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using auto-fetched seqno with the body and default send-mode 3
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param body byte[]
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, byte[] body) {
+ long seqno = getSeqno(tonlib);
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, body);
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using specified seqno with the comment and default send-mode 3
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param seqno long
+ * @param comment String
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, long seqno, String comment) {
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, CellBuilder.beginCell().storeUint(0, 32).storeString(comment).endCell());
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using auto-fetched seqno without the body and default send-mode 3
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param comment String
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, String comment) {
+ long seqno = getSeqno(tonlib);
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, CellBuilder.beginCell().storeUint(0, 32).storeString(comment).endCell());
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
+
+ /**
+ * Sends amount of toncoins to destination address using auto-fetched seqno with the body and specified send-mode
+ *
+ * @param tonlib Tonlib
+ * @param secretKey byte[]
+ * @param destinationAddress Address
+ * @param amount BigInteger
+ * @param body byte[]
+ * @param sendMode byte
+ */
+ public void sendTonCoins(Tonlib tonlib, byte[] secretKey, Address destinationAddress, BigInteger amount, byte[] body, byte sendMode) {
+ long seqno = getSeqno(tonlib);
+ ExternalMessage msg = createTransferMessage(secretKey, destinationAddress, amount, seqno, body, sendMode);
+ tonlib.sendRawMessage(msg.message.toBocBase64(false));
+ }
}
diff --git a/smartcontract/src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletV4R2PluginsDeployTransfer.java b/smartcontract/src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletV4R2PluginsDeployTransfer.java
index 717db81e..eda75af1 100644
--- a/smartcontract/src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletV4R2PluginsDeployTransfer.java
+++ b/smartcontract/src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletV4R2PluginsDeployTransfer.java
@@ -23,6 +23,7 @@
import java.util.List;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+import static org.ton.java.smartcontract.TestFaucet.FAUCET_ADDRESS_RAW;
@Slf4j
@RunWith(JUnit4.class)
@@ -49,8 +50,7 @@ public void testPlugins() throws InterruptedException {
.build())
.build();
- Wallet wallet = new Wallet(WalletVersion.V4R2, options);
- WalletV4ContractR2 contract = wallet.create();
+ WalletV4ContractR2 contract = new Wallet(WalletVersion.V4R2, options).create();
InitExternalMessage msg = contract.createInitExternalMessage(keyPair.getSecretKey());
Address walletAddress = msg.address;
@@ -233,5 +233,7 @@ public void testPlugins() throws InterruptedException {
List list = contract.getPluginsList(tonlib);
log.info("pluginsList: {}", list);
assertThat(list.isEmpty()).isTrue();
+
+ contract.sendTonCoins(tonlib, keyPair.getSecretKey(), Address.of(FAUCET_ADDRESS_RAW), Utils.toNano(0.33));
}
}
diff --git a/tlb/pom.xml b/tlb/pom.xml
index 857c96f7..0085d45d 100644
--- a/tlb/pom.xml
+++ b/tlb/pom.xml
@@ -5,7 +5,7 @@
top
io.github.neodix42
- 0.1.2
+ 0.1.3
4.0.0
@@ -47,7 +47,7 @@
io.github.neodix42
cell
- 0.1.2
+ 0.1.3
compile
diff --git a/tonlib/README.md b/tonlib/README.md
index 9808fca3..fab4698f 100644
--- a/tonlib/README.md
+++ b/tonlib/README.md
@@ -8,7 +8,7 @@ Java Tonlib library uses JNA to access methods in native Tonlib shared library.
io.github.neodix42
tonlib
- 0.1.2
+ 0.1.3
```
@@ -18,7 +18,7 @@ Java Tonlib library uses JNA to access methods in native Tonlib shared library.
io.github.neodix42.ton4j
tonlib
- 0.1.2
+ 0.1.3
```
diff --git a/tonlib/pom.xml b/tonlib/pom.xml
index 272f76a2..478dbf31 100644
--- a/tonlib/pom.xml
+++ b/tonlib/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0
diff --git a/tonlib/src/main/java/org/ton/java/tonlib/Tonlib.java b/tonlib/src/main/java/org/ton/java/tonlib/Tonlib.java
index 0b59ad60..5f3b24b9 100644
--- a/tonlib/src/main/java/org/ton/java/tonlib/Tonlib.java
+++ b/tonlib/src/main/java/org/ton/java/tonlib/Tonlib.java
@@ -8,6 +8,7 @@
import lombok.Builder;
import lombok.extern.java.Log;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
import org.ton.java.address.Address;
import org.ton.java.cell.Cell;
import org.ton.java.cell.CellBuilder;
@@ -333,6 +334,10 @@ public BlockIdExt lookupBlock(long seqno, long workchain, long shard, long lt, l
return gson.fromJson(result, BlockIdExt.class);
}
+ public BlockIdExt lookupBlock(long seqno, long workchain, long shard, long lt) {
+ return lookupBlock(seqno, workchain, shard, lt, 0);
+ }
+
public MasterChainInfo getLast() {
GetLastQuery getLastQuery = GetLastQuery.builder().build();
@@ -419,36 +424,13 @@ public BlockHeader getBlockHeader(BlockIdExt fullblock) {
//@formatter:off
+
/**
- * TL Spec:
- * raw.getTransactions account_address:accountAddress from_transaction_id:internal.transactionId = raw.Transactions;
- * accountAddress account_address:string = AccountAddress;
- * internal.transactionId lt:int64 hash:bytes = internal.TransactionId;
- * :param account_address: str with raw or user friendly address
- * :param from_transaction_lt: from transaction lt
- * :param from_transaction_hash: from transaction hash in HEX representation
- * :return: dict as
- * {
- * '@type': 'raw.transactions',
- * 'transactions': list[dict as {
- * '@type': 'raw.transaction',
- * 'utime': int,
- * 'data': str,
- * 'transaction_id': internal.transactionId,
- * 'fee': str,
- * 'in_msg': dict as {
- * '@type': 'raw.message',
- * 'source': str,
- * 'destination': str,
- * 'value': str,
- * 'message': str
- * },
- * 'out_msgs': list[dict as raw.message]
- * }],
- * 'previous_transaction_id': internal.transactionId
- * }
+ * @param address String
+ * @param fromTxLt BigInteger
+ * @param fromTxHash String in base64 format
+ * @return RawTransactions
*/
- //@formatter:on
public RawTransactions getRawTransactions(String address, BigInteger fromTxLt, String fromTxHash) {
if (isNull(fromTxLt) || isNull(fromTxHash)) {
@@ -471,11 +453,11 @@ public RawTransactions getRawTransactions(String address, BigInteger fromTxLt, S
}
/**
- * Simliar to getRawTransactions but limits the number of txs
+ * Similar to getRawTransactions but limits the number of txs
*
* @param address String
* @param fromTxLt BigInteger
- * @param fromTxHash String
+ * @param fromTxHash String in base64 format
* @param limit int
* @return RawTransactions
*/
@@ -500,6 +482,10 @@ public RawTransactions getRawTransactions(String address, BigInteger fromTxLt, S
RawTransactions rawTransactions = gson.fromJson(result, RawTransactions.class);
+ if (isNull(rawTransactions.getTransactions())) {
+ throw new Error("lite-server cannot return any transactions");
+ }
+
if (limit > rawTransactions.getTransactions().size()) {
limit = rawTransactions.getTransactions().size();
}
@@ -510,11 +496,21 @@ public RawTransactions getRawTransactions(String address, BigInteger fromTxLt, S
.build();
}
+ /**
+ * @param address String
+ * @param fromTxLt BigInteger
+ * @param fromTxHash String in base64 format
+ * @param historyLimit int
+ * @return RawTransactions
+ */
public RawTransactions getAllRawTransactions(String address, BigInteger fromTxLt, String fromTxHash, int historyLimit) {
List transactions = new ArrayList<>();
RawTransactions rawTransactions = getRawTransactions(address, fromTxLt, fromTxHash);
+ if (isNull(rawTransactions.getTransactions())) {
+ throw new Error("lite-server cannot return any transactions");
+ }
transactions.addAll(rawTransactions.getTransactions());
while (rawTransactions.getPrevious_transaction_id().getLt().compareTo(BigInteger.ZERO) != 0) {
@@ -622,6 +618,37 @@ public RawAccountState getRawAccountState(Address address) {
return gson.fromJson(result, RawAccountState.class);
}
+ /**
+ * Returns status of an address.
+ *
+ * @param address Address
+ * @return String, uninitialized, frozen or active
+ */
+ public String getRawAccountStatus(Address address) {
+ AccountAddressOnly accountAddressOnly = AccountAddressOnly.builder()
+ .account_address(address.toString(false))
+ .build();
+
+ GetRawAccountStateQueryOnly getAccountStateQuery = GetRawAccountStateQueryOnly.builder().account_address(accountAddressOnly).build();
+
+ send(gson.toJson(getAccountStateQuery));
+
+ String result = syncAndRead();
+
+ RawAccountState state = gson.fromJson(result, RawAccountState.class);
+
+ if (StringUtils.isEmpty(state.getCode())) {
+ if (StringUtils.isEmpty(state.getFrozen_hash())) {
+ return "uninitialized";
+ } else {
+ return "frozen";
+ }
+ } else {
+ return "active";
+ }
+
+ }
+
/**
* With comparison to getRawAccountState returns wallet_id and seqno and always returns code and data.
*
@@ -884,4 +911,87 @@ public boolean createAndSendMessage(String destinationAddress, String body, Stri
}
}
}
+
+ public RawTransaction tryLocateTxByIncomingMessage(Address source, Address destination, long creationLt) {
+ Shards shards = getShards(0, creationLt, 0);
+ for (BlockIdExt shardData : shards.getShards()) {
+ for (int b = 0; b < 3; b++) {
+ BlockIdExt block = lookupBlock(0, shardData.getWorkchain(), shardData.getShard(), creationLt + b * 1000000L);
+ BlockTransactions txs = getBlockTransactions(block, 40);
+
+ Pair candidate = null;
+ int count = 0;
+
+ for (ShortTxId tx : txs.getTransactions()) {
+ if (tx.getAccount().equals(Utils.bytesToBase64(destination.hashPart))) {
+ count++;
+ if (isNull(candidate) || (candidate.getRight() < tx.getLt())) {
+ candidate = Pair.of(tx.getHash(), tx.getLt());
+ }
+ }
+ }
+
+ if (nonNull(candidate)) {
+ RawTransactions transactions = getRawTransactions(
+ destination.toString(false),
+ BigInteger.valueOf(candidate.getRight()),
+ candidate.getLeft(),
+ Math.max(count, 10));
+
+ for (RawTransaction tx : transactions.getTransactions()) {
+ RawMessage in_msg = tx.getIn_msg();
+ String txSource = in_msg.getSource().getAccount_address();
+ if (StringUtils.isNoneEmpty(txSource) && (Address.of(txSource).toString(false).equals(source.toString(false)))) {
+ if (in_msg.getCreated_lt() == creationLt) {
+ return tx;
+ }
+ }
+ }
+ }
+ }
+ }
+ throw new Error("Transaction not found");
+ }
+
+ public RawTransaction tryLocateTxByOutcomingMessage(Address source, Address destination, long creationLt) {
+ Shards shards = getShards(0, creationLt, 0);
+ for (BlockIdExt shardData : shards.getShards()) {
+ BlockIdExt block = lookupBlock(0, shardData.getWorkchain(), shardData.getShard(), creationLt);
+ BlockTransactions txs = getBlockTransactions(block, 40);
+
+ Pair candidate = null;
+ int count = 0;
+
+ for (ShortTxId tx : txs.getTransactions()) {
+ if (tx.getAccount().equals(Utils.bytesToBase64(source.hashPart))) {
+ count++;
+ if (isNull(candidate) || (candidate.getRight() < tx.getLt())) {
+ candidate = Pair.of(tx.getHash(), tx.getLt());
+ }
+ }
+ }
+
+ if (nonNull(candidate)) {
+ RawTransactions transactions = getRawTransactions(
+ source.toString(false),
+ BigInteger.valueOf(candidate.getRight()),
+ candidate.getLeft(),
+ Math.max(count, 10));
+
+ for (RawTransaction tx : transactions.getTransactions()) {
+ for (RawMessage out_msg : tx.getOut_msgs()) {
+ String txDestination = out_msg.getDestination().getAccount_address();
+ if (StringUtils.isNoneEmpty(txDestination) && (Address.of(txDestination).toString(false).equals(destination.toString(false)))) {
+ if (out_msg.getCreated_lt() == creationLt) {
+ return tx;
+ }
+ }
+ }
+ }
+ }
+
+ }
+ throw new Error("Transaction not found");
+ }
+
}
diff --git a/tonlib/src/test/java/org/ton/java/tonlib/TestTonlibJson.java b/tonlib/src/test/java/org/ton/java/tonlib/TestTonlibJson.java
index 876f4316..9e82e091 100644
--- a/tonlib/src/test/java/org/ton/java/tonlib/TestTonlibJson.java
+++ b/tonlib/src/test/java/org/ton/java/tonlib/TestTonlibJson.java
@@ -6,6 +6,7 @@
import com.iwebpp.crypto.TweetNaclFast;
import com.sun.jna.Native;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -25,6 +26,7 @@
import java.util.Map;
import java.util.Objects;
+import static java.util.Objects.nonNull;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
@Slf4j
@@ -214,7 +216,8 @@ public void testTonlibGetTxsWithLimitByAddress() {
public void testTonlibGetAllTxsByAddress() {
Tonlib tonlib = Tonlib.builder().build();
- Address address = Address.of(TON_FOUNDATION);
+// Address address = Address.of(TON_FOUNDATION);
+ Address address = Address.of("EQAL66-DGwFvP046ysD_o18wvwt-0A6_aJoVmQpVNIqV_ZvK");
log.info("address: " + address.toString(true));
@@ -233,7 +236,7 @@ public void testTonlibGetAllTxsByAddress() {
}
}
- assertThat(rawTransactions.getTransactions().size()).isGreaterThan(50);
+ assertThat(rawTransactions.getTransactions().size()).isLessThan(10);
}
@Test
@@ -249,7 +252,7 @@ public void testTonlibGetAllTxsByAddressSmallHistoryLimit() {
log.info("total txs: {}", rawTransactions.getTransactions().size());
for (RawTransaction tx : rawTransactions.getTransactions()) {
- if ((tx.getIn_msg() != null) && (!tx.getIn_msg().getSource().getAccount_address().equals(""))) {
+ if (nonNull(tx.getIn_msg()) && (StringUtils.isNoneEmpty(tx.getIn_msg().getSource().getAccount_address()))) {
log.info("<<<<< {} - {} : {} ", tx.getIn_msg().getSource().getAccount_address(), tx.getIn_msg().getDestination().getAccount_address(), Utils.formatNanoValue(tx.getIn_msg().getValue()));
}
if (tx.getOut_msgs() != null) {
@@ -495,19 +498,83 @@ public void testTonlibRunMethodComputeReturnedStake() {
}
@Test
- public void testTonlib3() {
+ public void testTonlibMyLocalTon() {
+ Tonlib tonlib = Tonlib.builder()
+ .verbosityLevel(VerbosityLevel.DEBUG)
+ .pathToGlobalConfig("G:\\Git_Projects\\MyLocalTon\\myLocalTon\\genesis\\db\\my-ton-global.config.json")
+ .ignoreCache(true)
+ .build();
+
+ FullAccountState accountState1 = tonlib.getAccountState(Address.of("-1:85cda44e9838bf5a8c6d1de95c3e22b92884ae70ee1b550723a92a8ca0df3321"));
+ RawAccountState accountState2 = tonlib.getRawAccountState(Address.of("-1:85cda44e9838bf5a8c6d1de95c3e22b92884ae70ee1b550723a92a8ca0df3321"));
+
+ log.info("full accountState {}", accountState1);
+ log.info("raw accountState {}", accountState2);
+ }
+
+ @Test
+ public void testTonlibLookupBlock() {
+ Tonlib tonlib = Tonlib.builder()
+ .keystoreInMemory(true)
+ .verbosityLevel(VerbosityLevel.DEBUG)
+ .build();
+
+ Shards shards = tonlib.getShards(0, 31800427000002L, 0);
+ log.info("shards-- {}", shards.getShards());
+
+ BlockIdExt shard = shards.getShards().get(0);
+
+ BlockIdExt fullblock = tonlib.lookupBlock(0, shard.getWorkchain(), shard.getShard(), 31800427000002L + 1000000, 0);
+ log.info("fullBlock-- {}", fullblock);
+ }
+
+ @Test
+ public void testTonlibTryLocateTxByIncomingMessage() {
+ Tonlib tonlib = Tonlib.builder()
+ .build();
+
+ RawTransaction tx = tonlib.tryLocateTxByIncomingMessage(
+ Address.of("EQAuMjwyuQBaaxM6ooRJWbuUacQvBgVEWQOSSlbMERG0ljRD"),
+ Address.of("EQDEruSI2frAF-GdzpjDLWWBKnwREDAJmu7eIEFG6zdUlXVE"),
+ 26521292000002L);
+
+ log.info("found tx {}", tx);
+
+ assertThat(tx.getIn_msg()).isNotNull();
+ }
+
+ @Test
+ public void testTonlibTryLocateTxByOutcomingMessage() {
+ Tonlib tonlib = Tonlib.builder()
+ .build();
+
+ RawTransaction tx = tonlib.tryLocateTxByOutcomingMessage(
+ Address.of("EQAuMjwyuQBaaxM6ooRJWbuUacQvBgVEWQOSSlbMERG0ljRD"),
+ Address.of("EQDEruSI2frAF-GdzpjDLWWBKnwREDAJmu7eIEFG6zdUlXVE"),
+ 26521292000002L);
+
+ log.info("found tx {}", tx);
+
+ assertThat(tx.getIn_msg()).isNotNull();
+ assertThat(tx.getOut_msgs()).isNotNull();
+ }
+
+
+ @Test
+ public void testTonlibStateAndStatus() {
Tonlib tonlib = Tonlib.builder()
.verbosityLevel(VerbosityLevel.DEBUG)
.build();
int i = 0;
FullAccountState accountState1 = tonlib.getAccountState(Address.of("EQCtPHFrtkIw3UC2rNfSgVWYT1MiMLDUtgMy2M7j1P_eNMDq"));
+ String accountState1Status = tonlib.getRawAccountStatus(Address.of("EQCtPHFrtkIw3UC2rNfSgVWYT1MiMLDUtgMy2M7j1P_eNMDq"));
log.info("==========================================");
RawAccountState accountState2 = tonlib.getRawAccountState(Address.of("EQCtPHFrtkIw3UC2rNfSgVWYT1MiMLDUtgMy2M7j1P_eNMDq"));
log.info("{} with balance {} and code [{}]: {}", "EQCtPHFrtkIw3UC2rNfSgVWYT1MiMLDUtgMy2M7j1P_eNMDq", i, accountState1.getBalance(), accountState1);
log.info("{} with balance {} and code [{}]: {}", "EQCtPHFrtkIw3UC2rNfSgVWYT1MiMLDUtgMy2M7j1P_eNMDq", i, accountState2.getBalance(), accountState2);
log.info("wallet_id {}, seqno {}", accountState1.getAccount_state().getWallet_id(), accountState1.getAccount_state().getSeqno());
- log.info("frozen_hash {}", accountState1.getAccount_state().getFrozen_hash());
+ log.info("frozen_hash {}, status {}", accountState1.getAccount_state().getFrozen_hash(), accountState1Status);
log.info("frozen_hash {}", accountState2.getFrozen_hash());
assertThat(accountState1.getBalance()).isEqualTo(accountState2.getBalance());
}
diff --git a/utils/README.md b/utils/README.md
index 9c9b9d07..2e469bda 100644
--- a/utils/README.md
+++ b/utils/README.md
@@ -7,7 +7,7 @@
io.github.neodix42
utils
- 0.1.2
+ 0.1.3
```
@@ -18,7 +18,7 @@
io.github.neodix42.ton4j
utils
- 0.1.2
+ 0.1.3
```
diff --git a/utils/pom.xml b/utils/pom.xml
index 84f18691..3c4f9dd2 100644
--- a/utils/pom.xml
+++ b/utils/pom.xml
@@ -6,7 +6,7 @@
io.github.neodix42
top
- 0.1.2
+ 0.1.3
4.0.0