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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.23.x"
go-version: "1.25.x"
id: go

- name: Check out code into the Go module directory
Expand Down
39 changes: 30 additions & 9 deletions crypto/fixtures.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
// This file is part of Ark Go Crypto.
//
// (c) Ark Ecosystem <info@ark.io>
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

package crypto

import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
)

func GetFile(path string) string {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)

if err != nil {
log.Fatalf("Cannot read file %s: %s", path, err)
Expand Down Expand Up @@ -64,6 +57,15 @@ func GetBLSKeysFixture() []BLSKeyFixture {
return fixtures
}

func GetTransactionFixture(name string) TestingTransactionFixture {
data := GetFile(fmt.Sprintf("./fixtures/transactions/%s.json", name))

var fixture TestingTransactionFixture
_ = json.Unmarshal([]byte(data), &fixture)

return fixture
}

type TestingIdentityFixture struct {
Data struct {
PrivateKey string `json:"privateKey,omitempty"`
Expand Down Expand Up @@ -93,3 +95,22 @@ type BLSKeyFixture struct {
BLSPrivateKey string `json:"bls_private_key"`
Passphrase string `json:"passphrase"`
}

type TestingTransactionFixture struct {
Data struct {
Nonce string `json:"nonce"`
GasPrice string `json:"gasPrice"`
GasLimit string `json:"gasLimit"`
To string `json:"to"`
Value string `json:"value"`
Data string `json:"data"`
Network int `json:"network"`
V int `json:"v"`
R string `json:"r"`
S string `json:"s"`
SenderPublicKey string `json:"senderPublicKey"`
From string `json:"from"`
Hash string `json:"hash"`
} `json:"data"`
Serialized string `json:"serialized"`
}
18 changes: 18 additions & 0 deletions crypto/fixtures/transactions/multi_payment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"data": {
"nonce": "1",
"gasPrice": "5000000000",
"gasLimit": "200000",
"to": "0x00EFd0D4639191C49908A7BddbB9A11A994A8527",
"value": "300000",
"data": "084ce708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006f0182a0cc707b055322ccf6d4cb6a5aff1aeb22000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000030d40",
"network": 11812,
"v": 1,
"r": "9720cd5959af4fc513ec8f9c55a3f3b53a1f24a3a577e8132cadd81c116c6c82",
"s": "3411570db14d5e1a6673b2e80fe6cc22bf67752808ac4752c8bcfd9732e33dc8",
"senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d",
"from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd",
"hash": "f603e0b5fe0743021d2879ffe53ace7b40c9d823edbf058bd25a045753c82aa9"
},
"serialized": "f901700185012a05f20083030d409400efd0d4639191c49908a7bddbb9a11a994a8527830493e0b90104084ce708000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000006f0182a0cc707b055322ccf6d4cb6a5aff1aeb22000000000000000000000000c3bbe9b1cee1ff85ad72b87414b0e9b7f2366763000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000186a00000000000000000000000000000000000000000000000000000000000030d40825c6ca09720cd5959af4fc513ec8f9c55a3f3b53a1f24a3a577e8132cadd81c116c6c82a03411570db14d5e1a6673b2e80fe6cc22bf67752808ac4752c8bcfd9732e33dc8"
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 18 additions & 0 deletions crypto/fixtures/transactions/transfer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"data": {
"nonce": "1",
"gasPrice": "5000000000",
"gasLimit": "21000",
"to": "0x6F0182a0cc707b055322CcF6d4CB6a5Aff1aEb22",
"value": "100000000",
"data": "",
"network": 11812,
"v": 0,
"r": "a1f79cb40a4bb409d6cebd874002ceda3ec0ccb614c1d8155f5c2f7f798135f9",
"s": "2d2ef517aaf6feed747385e260c206f46b2ce9d6b2a585427a111685a097bd79",
"senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d",
"from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd",
"hash": "a39435ec5de418e77479856d06a653efc171afe43e091472af22ee359eeb83be"
},
"serialized": "f86a0185012a05f200825208946f0182a0cc707b055322ccf6d4cb6a5aff1aeb228405f5e10080825c6ba0a1f79cb40a4bb409d6cebd874002ceda3ec0ccb614c1d8155f5c2f7f798135f9a02d2ef517aaf6feed747385e260c206f46b2ce9d6b2a585427a111685a097bd79"
}
22 changes: 0 additions & 22 deletions crypto/fixtures/transactions/transfer/transfer-multi-sign.json

This file was deleted.

17 changes: 0 additions & 17 deletions crypto/fixtures/transactions/transfer/transfer-sign.json

This file was deleted.

This file was deleted.

18 changes: 18 additions & 0 deletions crypto/fixtures/transactions/unvote.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"data": {
"nonce": "1",
"gasPrice": "5000000000",
"gasLimit": "200000",
"to": "0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1",
"value": "0",
"data": "3174b689",
"network": 11812,
"v": 0,
"r": "7e05d686131973a9fbda9028f9df5702d9a229823b183caac03ec3a874ccec52",
"s": "1980fbc959612d8c7b97f6f16742259635f42a2039839a81aaaeb7ae6930a5f5",
"senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d",
"from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd",
"hash": "38d018d22e2cef185dc3c2f5d25ec63535160d8dfeaf78da8db719cb7ffc730d"
},
"serialized": "f86b0185012a05f20083030d4094535b3d7a252fa034ed71f0c53ec0c6f784cb64e180843174b689825c6ba07e05d686131973a9fbda9028f9df5702d9a229823b183caac03ec3a874ccec52a01980fbc959612d8c7b97f6f16742259635f42a2039839a81aaaeb7ae6930a5f5"
}
18 changes: 18 additions & 0 deletions crypto/fixtures/transactions/username_registration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"data": {
"nonce": "1",
"gasPrice": "5000000000",
"gasLimit": "200000",
"to": "0x2c1DE3b4Dbb4aDebEbB5dcECAe825bE2a9fc6eb6",
"value": "0",
"data": "36a94134000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000076669787475726500000000000000000000000000000000000000000000000000",
"network": 11812,
"v": 1,
"r": "80c77145c6b5450f4805e7c7b649b49653d151ca74275991ae49731084e35049",
"s": "1a25084fb0e997f93d9cc84472281f01c3e1fdeb15c29abf24f3469aeaac87c1",
"senderPublicKey": "0243333347c8cbf4e3cbc7a96964181d02a2b0c854faa2fef86b4b8d92afcf473d",
"from": "0x1E6747BEAa5B4076a6A98D735DF8c35a70D18Bdd",
"hash": "0fd23793ced45b59f54d6250b0d74860fb5960ffc971457c349032cc33cf560a"
},
"serialized": "f8cc0185012a05f20083030d40942c1de3b4dbb4adebebb5dcecae825be2a9fc6eb680b86436a94134000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000076669787475726500000000000000000000000000000000000000000000000000825c6ca080c77145c6b5450f4805e7c7b649b49653d151ca74275991ae49731084e35049a01a25084fb0e997f93d9cc84472281f01c3e1fdeb15c29abf24f3469aeaac87c1"
}

This file was deleted.

Loading
Loading