Skip to content

Commit

Permalink
Ton package to contains types from tongo's root package
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksej-paschenko committed Sep 4, 2023
1 parent fa0c7f9 commit 75733ee
Show file tree
Hide file tree
Showing 63 changed files with 1,149 additions and 1,022 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ go get github.com/tonkeeper/tongo
## Basic types
Tongo operates with TON blockchain structures described in [block.tlb](https://github.com/ton-blockchain/ton/blob/master/crypto/block/block.tlb)
and some types described in [lite_api.tl](https://github.com/ton-blockchain/ton/blob/master/tl/generate/scheme/lite_api.tl).
Go definitions of this types you can find in files: `account.go`, `transactions.go`, `models.go` ...
Go definitions of these types you can find in files: `ton/account.go`, `ton/transactions.go`, `ton/models.go` ...

## Chat

Expand Down
4 changes: 2 additions & 2 deletions abi/decoder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"testing"

"github.com/tonkeeper/tongo"
"github.com/tonkeeper/tongo/boc"
"github.com/tonkeeper/tongo/ton"
"github.com/tonkeeper/tongo/tvm"
)

Expand Down Expand Up @@ -151,7 +151,7 @@ func TestSimpleGetMethod(t *testing.T) {
dataBytes, _ := hex.DecodeString(c.Data)
codeCell, _ := boc.DeserializeBoc(codeBytes)
dataCell, _ := boc.DeserializeBoc(dataBytes)
account, _ := tongo.AccountIDFromRaw(c.Account)
account, _ := ton.AccountIDFromRaw(c.Account)

var (
emulator *tvm.Emulator
Expand Down
23 changes: 11 additions & 12 deletions abi/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,23 @@ import (
"reflect"
"testing"

"github.com/tonkeeper/tongo/liteapi"

"github.com/tonkeeper/tongo"
"github.com/tonkeeper/tongo/boc"
"github.com/tonkeeper/tongo/liteapi"
"github.com/tonkeeper/tongo/tlb"
"github.com/tonkeeper/tongo/ton"
"github.com/tonkeeper/tongo/tvm"
)

func mustToAddress(x string) tongo.AccountID {
accountID, err := tongo.AccountIDFromRaw(x)
func mustToAddress(x string) ton.AccountID {
accountID, err := ton.AccountIDFromRaw(x)
if err != nil {
panic(err)
}
return accountID
}

func mustToMsgAddress(x string) tlb.MsgAddress {
accountID, err := tongo.AccountIDFromRaw(x)
accountID, err := ton.AccountIDFromRaw(x)
if err != nil {
panic(err)
}
Expand Down Expand Up @@ -140,11 +139,11 @@ func TestGetMethods(t *testing.T) {
Wallet: struct {
Workchain uint32
Address tlb.Bits256
}{0, tlb.Bits256(tongo.MustParseHash("f3b542fa6d15e4bba8c9aac63aa1b8a97d787ab7dcb34730e1e5a4e78e104b80"))},
}{0, tlb.Bits256(ton.MustParseHash("f3b542fa6d15e4bba8c9aac63aa1b8a97d787ab7dcb34730e1e5a4e78e104b80"))},
Beneficiary: struct {
Workchain uint32
Address tlb.Bits256
}{0, tlb.Bits256(tongo.MustParseHash("e01675b731ed41f3a186a29d4a203068f744f68162cc370b0cde92f24ff97de5"))},
}{0, tlb.Bits256(ton.MustParseHash("e01675b731ed41f3a186a29d4a203068f744f68162cc370b0cde92f24ff97de5"))},
Amount: 1000000000,
Period: 2629800,
StartTime: 1644413924,
Expand Down Expand Up @@ -208,7 +207,7 @@ func TestGetMethods(t *testing.T) {
if err != nil {
t.Fatalf("DecodeString() failed: %v", err)
}
accountID, err := tongo.AccountIDFromRaw(tt.account)
accountID, err := ton.AccountIDFromRaw(tt.account)
if err != nil {
t.Fatalf("AccountIDFromRaw() failed: %v", err)
}
Expand Down Expand Up @@ -248,7 +247,7 @@ func TestGetMethods(t *testing.T) {
}

func TestWhalesNominators(t *testing.T) {
address := tongo.MustParseAccountID("EQBI-wGVp_x0VFEjd7m9cEUD3tJ_bnxMSp0Tb9qz757ATEAM")
address := ton.MustParseAccountID("EQBI-wGVp_x0VFEjd7m9cEUD3tJ_bnxMSp0Tb9qz757ATEAM")
client, err := liteapi.NewClientWithDefaultMainnet()
if err != nil {
t.Fatal(err)
Expand All @@ -261,7 +260,7 @@ func TestWhalesNominators(t *testing.T) {
if len(members.List.Keys()) == 0 {
t.Fatal(len(members.List.Keys()))
}
memberAddress := tongo.NewAccountId(0, members.List.Keys()[1])
memberAddress := ton.NewAccountId(0, members.List.Keys()[1])
_, v, err = GetMember(context.Background(), client, address, memberAddress.ToMsgAddress())
if err != nil {
t.Fatal(err)
Expand All @@ -285,7 +284,7 @@ func TestWhalesNominators(t *testing.T) {

}
func mustAccountIDToMsgAddress(account string) tlb.MsgAddress {
accountID := tongo.MustParseAccountID(account)
accountID := ton.MustParseAccountID(account)
return accountID.ToMsgAddress()
}

Expand Down
4 changes: 2 additions & 2 deletions abi/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ func main() {
for _, f := range [][]string{
{types, "types.go", `"github.com/tonkeeper/tongo/tlb"`},
{msgDecoder, "messages.go", `"fmt"`, `"github.com/tonkeeper/tongo/boc"`, `"github.com/tonkeeper/tongo/tlb"`},
{getMethods, "get_methods.go", `"context"`, `"fmt"`, `"github.com/tonkeeper/tongo"`, `"github.com/tonkeeper/tongo/boc"`, `"github.com/tonkeeper/tongo/tlb"`},
{invocationOrder, "ordering.go", `"context"`, `"github.com/tonkeeper/tongo"`},
{getMethods, "get_methods.go", `"context"`, `"fmt"`, `"github.com/tonkeeper/tongo/ton"`, `"github.com/tonkeeper/tongo/boc"`, `"github.com/tonkeeper/tongo/tlb"`},
{invocationOrder, "ordering.go", `"context"`, `"github.com/tonkeeper/tongo/ton"`},
} {
file, err := os.Create(f[1])
if err != nil {
Expand Down
Loading

0 comments on commit 75733ee

Please sign in to comment.