diff --git a/.docker/wallets/wallet1.json b/.docker/wallets/wallet1.json index 299884352..0e7102d1c 100644 --- a/.docker/wallets/wallet1.json +++ b/.docker/wallets/wallet1.json @@ -6,7 +6,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", + "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/.docker/wallets/wallet1_solo.json b/.docker/wallets/wallet1_solo.json index 0494afa1f..cc6da19a8 100644 --- a/.docker/wallets/wallet1_solo.json +++ b/.docker/wallets/wallet1_solo.json @@ -6,7 +6,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", + "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", @@ -48,7 +48,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "110c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2110b413073b3bb", + "script": "EQwhArNiK/QBe9/jF8WK7V9MdT8ga324lgRvp9d0u8S/f43CEQtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/.docker/wallets/wallet2.json b/.docker/wallets/wallet2.json index de64de712..954833570 100644 --- a/.docker/wallets/wallet2.json +++ b/.docker/wallets/wallet2.json @@ -6,7 +6,7 @@ "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { - "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", + "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/.docker/wallets/wallet3.json b/.docker/wallets/wallet3.json index 0a9065893..09a5aa8b7 100644 --- a/.docker/wallets/wallet3.json +++ b/.docker/wallets/wallet3.json @@ -6,7 +6,7 @@ "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { - "script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4", + "script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/.docker/wallets/wallet4.json b/.docker/wallets/wallet4.json index 585b7c062..0a6c5fd06 100644 --- a/.docker/wallets/wallet4.json +++ b/.docker/wallets/wallet4.json @@ -6,7 +6,7 @@ "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { - "script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4", + "script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/consensus/testdata/wallet1.json b/pkg/consensus/testdata/wallet1.json index 299884352..0e7102d1c 100644 --- a/pkg/consensus/testdata/wallet1.json +++ b/pkg/consensus/testdata/wallet1.json @@ -6,7 +6,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", + "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/consensus/testdata/wallet2.json b/pkg/consensus/testdata/wallet2.json index de64de712..954833570 100644 --- a/pkg/consensus/testdata/wallet2.json +++ b/pkg/consensus/testdata/wallet2.json @@ -6,7 +6,7 @@ "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { - "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", + "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/consensus/testdata/wallet3.json b/pkg/consensus/testdata/wallet3.json index 0a9065893..09a5aa8b7 100644 --- a/pkg/consensus/testdata/wallet3.json +++ b/pkg/consensus/testdata/wallet3.json @@ -6,7 +6,7 @@ "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { - "script": "0c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee6990b410a906ad4", + "script": "DCED2QwH32PmkM53kS4Qq1GsyUS2aGAje2CMT4+DCece5pkLQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYU172i51nsGS1P72gYq4czWdbUvMBQvrJnrJ1VEMZhmXPN6iX4jkmixC", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/consensus/testdata/wallet4.json b/pkg/consensus/testdata/wallet4.json index 585b7c062..0a6c5fd06 100644 --- a/pkg/consensus/testdata/wallet4.json +++ b/pkg/consensus/testdata/wallet4.json @@ -6,7 +6,7 @@ "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { - "script": "0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620b410a906ad4", + "script": "DCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYW1FxFURLUrFCzLRwoChXHGn77Fy8qDB5j1sUjpbi6mk4J1KgTR8vvAk", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/wallet/account.go b/pkg/wallet/account.go index 22a440877..544e94d60 100644 --- a/pkg/wallet/account.go +++ b/pkg/wallet/account.go @@ -2,8 +2,6 @@ package wallet import ( "bytes" - "encoding/hex" - "encoding/json" "errors" "fmt" @@ -86,37 +84,6 @@ func (c Contract) ScriptHash() util.Uint160 { return hash.Hash160(c.Script) } -// MarshalJSON implements json.Marshaler interface. -func (c Contract) MarshalJSON() ([]byte, error) { - var cc contract - - cc.Script = hex.EncodeToString(c.Script) - cc.Parameters = c.Parameters - cc.Deployed = c.Deployed - - return json.Marshal(cc) -} - -// UnmarshalJSON implements json.Unmarshaler interface. -func (c *Contract) UnmarshalJSON(data []byte) error { - var cc contract - - if err := json.Unmarshal(data, &cc); err != nil { - return err - } - - script, err := hex.DecodeString(cc.Script) - if err != nil { - return err - } - - c.Script = script - c.Parameters = cc.Parameters - c.Deployed = cc.Deployed - - return nil -} - // NewAccount creates a new Account with a random generated PrivateKey. func NewAccount() (*Account, error) { priv, err := keys.NewPrivateKey() diff --git a/pkg/wallet/account_test.go b/pkg/wallet/account_test.go index 4672a64bd..836718b8d 100644 --- a/pkg/wallet/account_test.go +++ b/pkg/wallet/account_test.go @@ -66,7 +66,7 @@ func TestNewAccountFromEncryptedWIF(t *testing.T) { func TestContract_MarshalJSON(t *testing.T) { var c Contract - data := []byte(`{"script":"0102","parameters":[{"name":"name0", "type":"Signature"}],"deployed":false}`) + data := []byte(`{"script":"AQI=","parameters":[{"name":"name0", "type":"Signature"}],"deployed":false}`) require.NoError(t, json.Unmarshal(data, &c)) require.Equal(t, []byte{1, 2}, c.Script) diff --git a/pkg/wallet/testdata/wallet1.json b/pkg/wallet/testdata/wallet1.json index 299884352..0e7102d1c 100644 --- a/pkg/wallet/testdata/wallet1.json +++ b/pkg/wallet/testdata/wallet1.json @@ -6,7 +6,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", + "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", diff --git a/pkg/wallet/testdata/wallet2.json b/pkg/wallet/testdata/wallet2.json index 5c83a2e09..9fbfa2656 100644 --- a/pkg/wallet/testdata/wallet2.json +++ b/pkg/wallet/testdata/wallet2.json @@ -6,7 +6,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "0c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20b410a906ad4", + "script": "DCECs2Ir9AF73+MXxYrtX0x1PyBrfbiWBG+n13S7xL9/jcILQQqQatQ=", "parameters": [ { "name": "parameter0", @@ -23,7 +23,7 @@ "key": "6PYSxdYbqJQKJcE7L8SUummK4X95aK14KA9obhw3fw6SX3rMRofPzpnr8L", "label": "", "contract": { - "script": "130c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0c2102a7bc55fe8684e0119768d104ba30795bdcc86619e864add26156723ed185cd620c2102b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc20c2103d90c07df63e690ce77912e10ab51acc944b66860237b608c4f8f8309e71ee699140b413073b3bb", + "script": "EwwhAhA6f33QFlWFl/eWDSfFFqQ5T9loueZRVetLAT5AQEBuDCECp7xV/oaE4BGXaNEEujB5W9zIZhnoZK3SYVZyPtGFzWIMIQKzYiv0AXvf4xfFiu1fTHU/IGt9uJYEb6fXdLvEv3+NwgwhA9kMB99j5pDOd5EuEKtRrMlEtmhgI3tgjE+PgwnnHuaZFAtBMHOzuw==", "parameters": [ { "name": "parameter0", @@ -48,7 +48,7 @@ "key": "6PYVQUTQLzdhtdnNLSBkse2DGG5gpPFuNGjaBZxYuJ4XsQrtVNy1E9k7R9", "label": "", "contract": { - "script": "0c2102103a7f7dd016558597f7960d27c516a4394fd968b9e65155eb4b013e4040406e0b410a906ad4", + "script": "DCECEDp/fdAWVYWX95YNJ8UWpDlP2Wi55lFV60sBPkBAQG4LQQqQatQ=", "parameters": [ { "name": "parameter0",