Skip to content

Commit

Permalink
added support of initial pending queries;
Browse files Browse the repository at this point in the history
implemented request to merge_inner_queries method;
supported off-chain signatures;
  • Loading branch information
neodix42 committed Jan 25, 2023
1 parent cae3340 commit 1a8036c
Show file tree
Hide file tree
Showing 10 changed files with 893 additions and 178 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ You can use each submodule individually. Click the module below to get more deta
* ✅ Get block transactions
* ✅ Get account transactions
* ✅ Deploy contracts and send external messages using Tonlib
* ✅ Wallets - Simple (V1), V2, V3, V4 (plugins), Lockup, Highload, DNS, Jetton, NFT, Payment-channels
* ✅ Wallets - Simple (V1), V2, V3, V4 (plugins), Lockup, Highload, DNS, Jetton, NFT, Payment-channels, Multisig
* ✅ HashMap, HashMapE, PfxHashMap and PfxHashMapE serialization / deserialization

### Todo
Expand Down
1 change: 1 addition & 0 deletions smartcontract/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ Currently, following wallet versions and revisions are supported:
* Jetton [(see usage example)](jetton-example.md)
* NFT [(see usage example)](nft-example.md)
* Payment channels [(see usage example)](./src/test/java/org/ton/java/smartcontract/integrationtests/TestPayments.java)
* Multisig [(see usage example)](./src/test/java/org/ton/java/smartcontract/integrationtests/TestWalletMultisig.java)
* Custom contract [(see usage example)](custom-smc-example.md)


Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,17 @@ public class MultisigConfig {
* Whitelist of allowed destinations
*/
public List<OwnerInfo> owners;
public List<PendingQuery> pendingQueries;

public long rootI;
/**
* Minimum amount of signatures for order to execute.
* <p>
* E.g. n = 5, k = 3, means at least 3 out of 5 signatures must be collected
*/
public long k;
public int k;
/**
* total amount of private kyes
*/
public long n;
public int n;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.ton.java.smartcontract.types;

import lombok.Builder;
import lombok.Getter;
import lombok.ToString;

@Builder
@Getter
@ToString
public class MultisigSignature {
long pubKeyPosition;
byte[] signature;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@
public class OwnerInfo {
byte[] publicKey;
long flood;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package org.ton.java.smartcontract.types;

import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
import org.ton.java.cell.Cell;

import java.math.BigInteger;

@Builder
@Getter
@ToString
public class PendingQuery {
BigInteger queryId;
long creatorI;
long cnt; // current number of collected confirmations

// bits of length n, with active bit at position of public keys array. 101 - signed with pubkey[0] and pubkey[2]
long cntBits;
Cell msg;
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ default ExternalMessage createExternalMessage(Cell signingMessage,

if (seqno == 0) {
if (isNull(getOptions().publicKey)) {
TweetNaclFast.Signature.KeyPair keyPair = Utils.generateSignatureKeyPairFromSeed(secretKey); //) TweetNaclFast.Box.keyPair_fromSecretKey(
TweetNaclFast.Signature.KeyPair keyPair = Utils.generateSignatureKeyPairFromSeed(secretKey);
getOptions().publicKey = keyPair.getPublicKey();
}
StateInit deploy = createStateInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.ton.java.tonlib.Tonlib;
import org.ton.java.tonlib.types.AccountAddressOnly;
import org.ton.java.tonlib.types.FullAccountState;
import org.ton.java.tonlib.types.VerbosityLevel;
import org.ton.java.utils.Utils;

import java.math.BigInteger;
Expand Down Expand Up @@ -134,4 +135,13 @@ public void deployFaucetWallet() {
.build();
tonlib.sendRawMessage(msg.message.toBocBase64(false));
}

@Test
public void topUpAnyContract() throws InterruptedException {
Tonlib tonlib = Tonlib.builder()
.testnet(true)
.verbosityLevel(VerbosityLevel.DEBUG)
.build();
TestFaucet.topUpContract(tonlib, Address.of("0QB0gEuvySej-7ZZBAdaBSydBB_oVYUUnp9Ciwm05kJsNKau"), Utils.toNano(5));
}
}

Large diffs are not rendered by default.

0 comments on commit 1a8036c

Please sign in to comment.