-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from make-software/feature/CMW-608/parsing_tra…
…nsform Feature/cmw 608/parsing transform
- Loading branch information
Showing
4 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"key": "balance-cac81394a4906c62a999c4b3c24d886c452b0a9ed39419e6e8f861d72ee59303", | ||
"transform": { | ||
"AddUInt512": "100000000" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"key": "deploy-e379d531188e90892ca07dba8469def6f9a45e627717b2a3ae4a8ec440c9f001", | ||
"transform": { | ||
"WriteDeployInfo": { | ||
"deploy_hash": "e379d531188e90892ca07dba8469def6f9a45e627717b2a3ae4a8ec440c9f001", | ||
"transfers": [ | ||
"transfer-78c4663dd4b83fa35d031e8173dccb53431520adf559a3853892530946fcb777" | ||
], | ||
"from": "account-hash-e15156d73d79f92b13aa147552a01ef2a3d677134f13961b51033ffd9fba481c", | ||
"source": "uref-012e4506440c6bf5427d3d76ad20a1bdefc6bf5d79cee3d28bfaae36603f1133-007", | ||
"gas": "100000000" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package types | ||
|
||
import ( | ||
"encoding/json" | ||
"os" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/make-software/casper-go-sdk/types" | ||
) | ||
|
||
func Test_Transform_AddUInt512(t *testing.T) { | ||
fixture, err := os.ReadFile("../data/transform/AddUInt512.json") | ||
require.NoError(t, err) | ||
var transformKey types.TransformKey | ||
|
||
err = json.Unmarshal(fixture, &transformKey) | ||
require.NoError(t, err) | ||
|
||
val, err := transformKey.Transform.ParseAsUInt512() | ||
require.NoError(t, err) | ||
|
||
assert.True(t, transformKey.Transform.IsAddUint512()) | ||
assert.EqualValues(t, 100000000, val.Value().Int64()) | ||
} | ||
|
||
func Test_Transform_WriteDeployInfo(t *testing.T) { | ||
fixute, err := os.ReadFile("../data/transform/WriteDeployInfo.json") | ||
require.NoError(t, err) | ||
var transformKey types.TransformKey | ||
|
||
err = json.Unmarshal(fixute, &transformKey) | ||
require.NoError(t, err) | ||
|
||
val, err := transformKey.Transform.ParseAsWriteDeployInfo() | ||
require.NoError(t, err) | ||
|
||
assert.True(t, transformKey.Transform.IsWriteDeployInfo()) | ||
assert.EqualValues(t, 1, len(val.Transfers)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters