File tree Expand file tree Collapse file tree 8 files changed +17
-31
lines changed
ton-kotlin-block/src/commonMain/kotlin/org/ton/block
commonMain/kotlin/org/ton/contract/wallet
commonTest/kotlin/org/ton/contract/wallet/v1
ton-kotlin-liteclient/jvm/test
ton-kotlin-tlb/src/commonMain/kotlin/org/ton/tlb Expand file tree Collapse file tree 8 files changed +17
-31
lines changed Original file line number Diff line number Diff line change @@ -11,10 +11,10 @@ import kotlin.jvm.JvmStatic
1111
1212@JsonClassDiscriminator(" @type" )
1313@Serializable
14- sealed interface CommonMsgInfo : TlbObject {
15- companion object : TlbCodec <CommonMsgInfo > by CommonMsgInfoTlbCombinator {
14+ public sealed interface CommonMsgInfo : TlbObject {
15+ public companion object : TlbCodec <CommonMsgInfo > by CommonMsgInfoTlbCombinator {
1616 @JvmStatic
17- fun tlbCodec (): TlbCombinator <CommonMsgInfo > = CommonMsgInfoTlbCombinator
17+ public fun tlbCodec (): TlbCombinator <CommonMsgInfo > = CommonMsgInfoTlbCombinator
1818 }
1919}
2020
Original file line number Diff line number Diff line change @@ -52,11 +52,11 @@ public data class Just<X>(
5252) : Maybe<X> {
5353 override fun print (printer : TlbPrettyPrinter ): TlbPrettyPrinter = printer {
5454 type(" just" ) {
55- field(" value" , value as Any )
55+ field(" value" , value)
5656 }
5757 }
5858
59- override fun toString (): String = " (just \n value: $value ) "
59+ override fun toString (): String = print ().toString()
6060}
6161
6262private class MaybeTlbCombinator (
Original file line number Diff line number Diff line change @@ -52,16 +52,7 @@ public data class Message<X>(
5252 ): TlbConstructor <Message <X >> = MessageTlbConstructor (x)
5353 }
5454
55- override fun toString (): String = buildString {
56- append(" (message\n " )
57- append(" info:" )
58- append(info)
59- append(" init:" )
60- append(init )
61- append(" body:" )
62- append(body.toString())
63- append(" )" )
64- }
55+ override fun toString (): String = print ().toString()
6556}
6657
6758operator fun <X : Any > Message.Companion.invoke (x : TlbCodec <X >) = tlbCodec(x)
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ abstract class AbstractContractV3(
2020 override fun createDataInit (): Cell = CellBuilder .createCell {
2121 storeUInt(0 , 32 ) // seqno
2222 storeUInt(subwalletId, 32 )
23- storeBits(privateKey.publicKey().key.toBitString() )
23+ storeBits(privateKey.publicKey().key)
2424 }
2525
2626 override fun createSigningMessage (seqno : Int , builder : CellBuilder .() -> Unit ): Cell = CellBuilder .createCell {
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ abstract class AbstractContractV4(
2121 override fun createDataInit (): Cell = CellBuilder .createCell {
2222 storeUInt(0 , 32 ) // seqno
2323 storeUInt(subwalletId, 32 )
24- storeBits(privateKey.publicKey().key.toBitString() )
24+ storeBits(privateKey.publicKey().key)
2525 storeUInt(0 , 1 ) // plugins dict empty
2626 }
2727
Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import org.ton.boc.BagOfCells
99import org.ton.cell.Cell
1010import org.ton.cell.CellBuilder
1111import org.ton.contract.wallet.liteClient
12- import org.ton.crypto.encodeHex
1312import org.ton.crypto.hex
1413import org.ton.tlb.constructor.AnyTlbConstructor
1514import org.ton.tlb.storeTlb
@@ -88,7 +87,7 @@ class WalletV1R3Test {
8887 Cell (" FF0020DD2082014C97BA218201339CBAB19C71B0ED44D0D31FD70BFFE304E0A4F260810200D71820D70B1FED44D0D31FD3FFD15112BAF2A122F901541044F910F2A2F80001D31F3120D74A96D307D402FB00DED1A4C8CB1FCBFFC9ED54" ),
8988 Cell (" 000000003B6A27BCCEB6A42D62A3A8D02A6F0D73653215771DE243A63AC048A18B59DA29" )
9089 )
91- assertEquals(actual, expected )
90+ assertEquals(expected, actual )
9291 }
9392
9493 @Test
@@ -107,14 +106,6 @@ class WalletV1R3Test {
107106 val expectedBoc =
108107 BagOfCells (hex(" b5ee9c720101030100f10002cf880083a2c647078b8a66f9765a64401ce06b507a077e2e426e1c0eb9d0dfc45bc7ac11985b73c78dd0fef1ad628feeba22ce006ddd70361e50f671607a41713ad2373bd9c24dac2cb48bf838599e15897e063f5d528e5bdc150d40e28e78aff0c798c08000000010010200baff0020dd2082014c97ba218201339cbab19c71b0ed44d0d31fd70bffe304e0a4f260810200d71820d70b1fed44d0d31fd3ffd15112baf2a122f901541044f910f2a2f80001d31f3120d74a96d307d402fb00ded1a4c8cb1fcbffc9ed540048000000003b6a27bcceb6a42d62a3a8d02a6f0d73653215771de243a63ac048a18b59da29" ))
109108 assertEquals(expectedBoc, actualBoc)
110-
111-
112- println (" ---" )
113- println (actualBoc)
114-
115- println (" ---" )
116- println (actualBoc.toByteArray().encodeHex())
117-
118109// assertEquals(expected, hex(actual).uppercase())
119110 }
120111
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import org.ton.crypto.base64
1010import org.ton.lite.client.LiteClient
1111import kotlin.test.assertNotNull
1212import kotlin.test.assertTrue
13+ import kotlin.time.ExperimentalTime
1314
1415class LiteClientTest2 {
1516 private fun getClient () = LiteClient (
@@ -25,6 +26,7 @@ class LiteClientTest2 {
2526 coroutineContext = Dispatchers .Default
2627 )
2728
29+ @ExperimentalTime
2830 @Test
2931 fun getAccount () {
3032 val liteClient = getClient()
Original file line number Diff line number Diff line change @@ -52,11 +52,13 @@ public abstract class TlbCombinator<T : Any>(
5252 }
5353
5454 override fun storeTlb (cellBuilder : CellBuilder , value : T ) {
55- val constructor = findTlbStorerOrNull(value) ? : throw UnknownTlbConstructorException ()
56- if (constructor is TlbConstructor <* >) {
57- cellBuilder.storeBits(constructor .id)
55+ val storer = findTlbStorerOrNull(value) ? : throw UnknownTlbConstructorException ()
56+ if (storer is TlbConstructorProvider <* >) {
57+ cellBuilder.storeBits(storer.tlbConstructor().id)
58+ } else if (storer is TlbConstructor <* >) {
59+ cellBuilder.storeBits(storer.id)
5860 }
59- return constructor .storeTlb(cellBuilder, value)
61+ return storer .storeTlb(cellBuilder, value)
6062 }
6163
6264 protected open fun findTlbLoaderOrNull (cellSlice : CellSlice ): TlbLoader <out T >? {
You can’t perform that action at this time.
0 commit comments