Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sui/move_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ type TypeOrigin struct {
}

type UpgradeInfo struct {
UpgradedId ObjectId
UpgradedVersion SequenceNumber
UpgradedId ObjectId `json:"upgraded_id"`
UpgradedVersion SequenceNumber `json:"upgraded_version"`
}
57 changes: 5 additions & 52 deletions suiclient/api_read_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,60 +161,13 @@ func TestGetLatestCheckpointSequenceNumber(t *testing.T) {
}

func TestGetObject(t *testing.T) {
type args struct {
ctx context.Context
objId *sui.ObjectId
}
api := suiclient.NewClient(conn.TestnetEndpointUrl)
coins, err := api.GetCoins(context.TODO(), &suiclient.GetCoinsRequest{
Owner: suisigner.TEST_ADDRESS,
Limit: 1,
api := suiclient.NewClient(conn.MainnetEndpointUrl)
object, err := api.GetObject(context.TODO(), &suiclient.GetObjectRequest{
ObjectId: sui.MustObjectIdFromHex("0x6"),
Options: &suiclient.SuiObjectDataOptions{ShowBcs: true},
})
require.NoError(t, err)

tests := []struct {
name string
api *suiclient.ClientImpl
args args
want int
wantErr bool
}{
{
name: "test for devnet",
api: api,
args: args{
ctx: context.TODO(),
objId: coins.Data[0].CoinObjectId,
},
want: 3,
wantErr: false,
},
}
for _, tt := range tests {
t.Run(
tt.name, func(t *testing.T) {
got, err := tt.api.GetObject(
tt.args.ctx, &suiclient.GetObjectRequest{
ObjectId: tt.args.objId,
Options: &suiclient.SuiObjectDataOptions{
ShowType: true,
ShowOwner: true,
ShowContent: true,
ShowDisplay: true,
ShowBcs: true,
ShowPreviousTransaction: true,
ShowStorageRebate: true,
},
},
)
if (err != nil) != tt.wantErr {
t.Errorf("GetObject() error: %v, wantErr %v", err, tt.wantErr)
return
}
t.Logf("%+v", got)
},
)
}
require.NotNil(t, object)
}

func TestGetProtocolConfig(t *testing.T) {
Expand Down
Loading