Skip to content

Commit 9aa6a48

Browse files
authored
Fixed compatible transforms parsing (#131)
Fixed compatible transforms parsing
1 parent b521e48 commit 9aa6a48

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

tests/rpc/rpc_client_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ func Test_DefaultClient_GetTransaction_Example(t *testing.T) {
188188

189189
if tt.withTransfers {
190190
assert.NotEmpty(t, result.ExecutionInfo.ExecutionResult.Transfers)
191-
assert.NotEmpty(t, result.ExecutionInfo.ExecutionResult.Transfers[0].TransactionHash.TransactionV1)
191+
assert.NotEmpty(t, result.ExecutionInfo.ExecutionResult.Transfers[0].TransactionHash)
192+
assert.Equal(t, result.ExecutionInfo.ExecutionResult.Transfers[0].TransactionHash.String(),
193+
result.Transaction.Hash.ToHex())
192194
}
193195
})
194196
}

types/contract_package.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func (c *ContractGroup) UnmarshalJSON(data []byte) error {
4646
}
4747

4848
if temp.Group != "" {
49-
group.GroupName = temp.GroupName
49+
group.GroupName = temp.Group
5050
}
5151

5252
if len(temp.Keys) != 0 {

types/execution_result.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func NewExecutionResultFromV1(v1 ExecutionResultV1) ExecutionResult {
121121
transfers = append(transfers, Transfer{
122122
Amount: writeTransfer.Amount,
123123
TransactionHash: TransactionHash{
124-
TransactionV1: &transform.Key.Transfer.Hash,
124+
Deploy: &writeTransfer.DeployHash,
125125
},
126126
From: InitiatorAddr{
127127
AccountHash: &writeTransfer.From,

types/transaction.go

+10
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ type TransactionHash struct {
179179
TransactionV1 *key.Hash `json:"Version1,omitempty"`
180180
}
181181

182+
func (t *TransactionHash) String() string {
183+
if t.Deploy != nil {
184+
return t.Deploy.String()
185+
} else if t.TransactionV1 != nil {
186+
return t.TransactionV1.String()
187+
} else {
188+
return ""
189+
}
190+
}
191+
182192
func (t *TransactionV1) Sign(keys keypair.PrivateKey) error {
183193
signature, err := keys.Sign(t.Hash.Bytes())
184194
if err != nil {

0 commit comments

Comments
 (0)