@arkecosystem/typescript-crypto 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +23 -23
- package/.github/workflows/format.yml +80 -0
- package/.github/workflows/publish.yml +1 -1
- package/.prettierrc.json +8 -0
- package/dist/enums/ContractAbiType.d.ts.map +1 -1
- package/dist/exceptions/index.d.ts.map +1 -1
- package/dist/identities/PrivateKey.d.ts +2 -2
- package/dist/identities/PrivateKey.d.ts.map +1 -1
- package/dist/identities/PrivateKey.js +1 -1
- package/dist/identities/WIF.d.ts.map +1 -1
- package/dist/identities/WIF.js +2 -2
- package/dist/index.js +532 -626
- package/dist/networks/AbstractNetwork.d.ts +1 -1
- package/dist/networks/AbstractNetwork.d.ts.map +1 -1
- package/dist/networks/Mainnet.d.ts +1 -1
- package/dist/networks/Mainnet.d.ts.map +1 -1
- package/dist/networks/Mainnet.js +1 -1
- package/dist/networks/Testnet.d.ts +1 -1
- package/dist/networks/Testnet.d.ts.map +1 -1
- package/dist/networks/Testnet.js +1 -1
- package/dist/transactions/Deserializer.d.ts +5 -5
- package/dist/transactions/Deserializer.d.ts.map +1 -1
- package/dist/transactions/Deserializer.js +18 -18
- package/dist/transactions/Serializer.d.ts +0 -1
- package/dist/transactions/Serializer.d.ts.map +1 -1
- package/dist/transactions/Serializer.js +0 -3
- package/dist/transactions/builders/AbstractTransactionBuilder.d.ts +7 -6
- package/dist/transactions/builders/AbstractTransactionBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/AbstractTransactionBuilder.js +15 -8
- package/dist/transactions/builders/EvmCallBuilder.d.ts +3 -3
- package/dist/transactions/builders/EvmCallBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/MultipaymentBuilder.d.ts +5 -4
- package/dist/transactions/builders/MultipaymentBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/MultipaymentBuilder.js +6 -2
- package/dist/transactions/builders/TransferBuilder.d.ts +4 -3
- package/dist/transactions/builders/TransferBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/TransferBuilder.js +4 -0
- package/dist/transactions/builders/UnvoteBuilder.d.ts +3 -3
- package/dist/transactions/builders/UnvoteBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/UnvoteBuilder.js +1 -1
- package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts +3 -3
- package/dist/transactions/builders/UsernameRegistrationBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/UsernameRegistrationBuilder.js +1 -1
- package/dist/transactions/builders/UsernameResignationBuilder.d.ts +3 -3
- package/dist/transactions/builders/UsernameResignationBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/UsernameResignationBuilder.js +1 -1
- package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts +3 -3
- package/dist/transactions/builders/ValidatorRegistrationBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/ValidatorRegistrationBuilder.js +4 -2
- package/dist/transactions/builders/ValidatorResignationBuilder.d.ts +3 -3
- package/dist/transactions/builders/ValidatorResignationBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/ValidatorResignationBuilder.js +1 -1
- package/dist/transactions/builders/VoteBuilder.d.ts +3 -3
- package/dist/transactions/builders/VoteBuilder.d.ts.map +1 -1
- package/dist/transactions/builders/VoteBuilder.js +1 -1
- package/dist/transactions/types/AbstractTransaction.d.ts +2 -5
- package/dist/transactions/types/AbstractTransaction.d.ts.map +1 -1
- package/dist/transactions/types/AbstractTransaction.js +13 -15
- package/dist/transactions/types/EvmCall.d.ts +0 -3
- package/dist/transactions/types/EvmCall.d.ts.map +1 -1
- package/dist/transactions/types/EvmCall.js +0 -8
- package/dist/transactions/types/Multipayment.d.ts +1 -3
- package/dist/transactions/types/Multipayment.d.ts.map +1 -1
- package/dist/transactions/types/Multipayment.js +1 -8
- package/dist/transactions/types/Transfer.d.ts +0 -3
- package/dist/transactions/types/Transfer.d.ts.map +1 -1
- package/dist/transactions/types/Transfer.js +0 -8
- package/dist/transactions/types/Unvote.d.ts +0 -3
- package/dist/transactions/types/Unvote.d.ts.map +1 -1
- package/dist/transactions/types/Unvote.js +0 -8
- package/dist/transactions/types/UsernameRegistration.d.ts +1 -3
- package/dist/transactions/types/UsernameRegistration.d.ts.map +1 -1
- package/dist/transactions/types/UsernameRegistration.js +0 -7
- package/dist/transactions/types/UsernameResignation.d.ts +0 -3
- package/dist/transactions/types/UsernameResignation.d.ts.map +1 -1
- package/dist/transactions/types/UsernameResignation.js +0 -7
- package/dist/transactions/types/ValidatorRegistration.d.ts +1 -3
- package/dist/transactions/types/ValidatorRegistration.d.ts.map +1 -1
- package/dist/transactions/types/ValidatorRegistration.js +0 -8
- package/dist/transactions/types/ValidatorResignation.d.ts +0 -3
- package/dist/transactions/types/ValidatorResignation.d.ts.map +1 -1
- package/dist/transactions/types/ValidatorResignation.js +0 -8
- package/dist/transactions/types/Vote.d.ts +1 -3
- package/dist/transactions/types/Vote.d.ts.map +1 -1
- package/dist/transactions/types/Vote.js +0 -8
- package/dist/types.d.ts +19 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/Abi/ArgumentDecoder.js +6 -6
- package/dist/utils/Abi/json/Abi.Consensus.json +15 -45
- package/dist/utils/Abi/json/Abi.Usernames.json +9 -27
- package/dist/utils/AbiDecoder.d.ts.map +1 -1
- package/dist/utils/AbiDecoder.js +3 -0
- package/dist/utils/AbiEncoder.d.ts +1 -1
- package/dist/utils/AbiEncoder.d.ts.map +1 -1
- package/dist/utils/AbiEncoder.js +2 -1
- package/dist/utils/Message.d.ts +1 -1
- package/dist/utils/Message.d.ts.map +1 -1
- package/dist/utils/Message.js +1 -1
- package/dist/utils/TransactionUtils.d.ts +0 -1
- package/dist/utils/TransactionUtils.d.ts.map +1 -1
- package/dist/utils/TransactionUtils.js +15 -18
- package/dist/utils/UnitConverter.d.ts.map +1 -1
- package/dist/utils/UnitConverter.js +12 -12
- package/eslint.config.mjs +19 -0
- package/jest.config.ts +6 -6
- package/package.json +6 -2
- package/src/enums/Constants.ts +1 -1
- package/src/enums/ContractAbiType.ts +4 -4
- package/src/exceptions/index.ts +1 -1
- package/src/identities/PrivateKey.ts +3 -3
- package/src/identities/WIF.ts +2 -3
- package/src/networks/AbstractNetwork.ts +3 -3
- package/src/networks/Mainnet.ts +3 -3
- package/src/networks/Testnet.ts +1 -1
- package/src/transactions/Deserializer.ts +39 -30
- package/src/transactions/Serializer.ts +1 -5
- package/src/transactions/builders/AbstractTransactionBuilder.ts +20 -11
- package/src/transactions/builders/EvmCallBuilder.ts +3 -3
- package/src/transactions/builders/MultipaymentBuilder.ts +13 -6
- package/src/transactions/builders/TransferBuilder.ts +8 -3
- package/src/transactions/builders/UnvoteBuilder.ts +4 -4
- package/src/transactions/builders/UsernameRegistrationBuilder.ts +4 -4
- package/src/transactions/builders/UsernameResignationBuilder.ts +4 -4
- package/src/transactions/builders/ValidatorRegistrationBuilder.ts +8 -5
- package/src/transactions/builders/ValidatorResignationBuilder.ts +4 -4
- package/src/transactions/builders/VoteBuilder.ts +4 -4
- package/src/transactions/types/AbstractTransaction.ts +17 -24
- package/src/transactions/types/EvmCall.ts +0 -15
- package/src/transactions/types/Multipayment.ts +3 -15
- package/src/transactions/types/Transfer.ts +0 -15
- package/src/transactions/types/Unvote.ts +0 -15
- package/src/transactions/types/UsernameRegistration.ts +1 -13
- package/src/transactions/types/UsernameResignation.ts +0 -14
- package/src/transactions/types/ValidatorRegistration.ts +1 -14
- package/src/transactions/types/ValidatorResignation.ts +0 -15
- package/src/transactions/types/Vote.ts +1 -14
- package/src/types.ts +19 -19
- package/src/utils/Abi/ArgumentDecoder.ts +6 -6
- package/src/utils/Abi/json/Abi.Consensus.json +1641 -1671
- package/src/utils/Abi/json/Abi.Multipayment.json +108 -108
- package/src/utils/Abi/json/Abi.Usernames.json +880 -898
- package/src/utils/AbiBase.ts +1 -1
- package/src/utils/AbiDecoder.ts +6 -3
- package/src/utils/AbiEncoder.ts +3 -2
- package/src/utils/Message.ts +1 -1
- package/src/utils/TransactionUtils.ts +24 -28
- package/src/utils/UnitConverter.ts +29 -29
- package/tests/fixtures/global.json +4 -4
- package/tests/fixtures/identity.json +10 -10
- package/tests/fixtures/transactions/evm-sign.json +4 -4
- package/tests/fixtures/transactions/multipayment-empty.json +4 -4
- package/tests/fixtures/transactions/multipayment-single.json +4 -4
- package/tests/fixtures/transactions/multipayment.json +4 -4
- package/tests/fixtures/transactions/transfer-0.json +4 -4
- package/tests/fixtures/transactions/transfer-large-amount.json +4 -4
- package/tests/fixtures/transactions/transfer.json +4 -4
- package/tests/fixtures/transactions/unvote.json +4 -4
- package/tests/fixtures/transactions/username-registration.json +4 -4
- package/tests/fixtures/transactions/username-resignation.json +4 -4
- package/tests/fixtures/transactions/validator-registration.json +4 -4
- package/tests/fixtures/transactions/validator-resignation.json +4 -4
- package/tests/fixtures/transactions/vote.json +4 -4
- package/tests/unit/configuration/Network.test.ts +52 -0
- package/tests/unit/identities/Address.test.ts +4 -4
- package/tests/unit/identities/PrivateKey.test.ts +5 -5
- package/tests/unit/identities/PublicKey.test.ts +9 -9
- package/tests/unit/identities/WIF.test.ts +1 -1
- package/tests/unit/transactions/Deserializer.test.ts +81 -63
- package/tests/unit/transactions/Serializer.test.ts +11 -1
- package/tests/unit/transactions/builders/EvmCallBuilder.test.ts +76 -9
- package/tests/unit/transactions/builders/MultipaymentBuilder.test.ts +125 -17
- package/tests/unit/transactions/builders/TransferBuilder.test.ts +146 -47
- package/tests/unit/transactions/builders/UnvoteBuilder.test.ts +75 -8
- package/tests/unit/transactions/builders/UsernameRegistrationBuilder.test.ts +75 -8
- package/tests/unit/transactions/builders/UsernameResignationBuilder.test.ts +75 -8
- package/tests/unit/transactions/builders/ValidatorRegistrationBuilder.test.ts +103 -8
- package/tests/unit/transactions/builders/ValidatorResignationBuilder.test.ts +75 -8
- package/tests/unit/transactions/builders/VoteBuilder.test.ts +75 -8
- package/tests/unit/transactions/types/AbstractTransaction.test.ts +27 -30
- package/tests/unit/transactions/types/EvmCall.test.ts +22 -0
- package/tests/unit/transactions/types/Multipayment.test.ts +38 -0
- package/tests/unit/transactions/types/Transfer.test.ts +18 -0
- package/tests/unit/transactions/types/Unvote.test.ts +18 -0
- package/tests/unit/transactions/types/UsernameRegistration.test.ts +22 -0
- package/tests/unit/transactions/types/UsernameResignation.test.ts +18 -0
- package/tests/unit/transactions/types/ValidatorRegistration.test.ts +22 -0
- package/tests/unit/transactions/types/ValidatorResignation.test.ts +18 -0
- package/tests/unit/transactions/types/Vote.test.ts +20 -0
- package/tests/unit/utils/Abi/ArgumentDecoder.test.ts +17 -16
- package/tests/unit/utils/AbiEncoder.test.ts +2 -2
- package/tests/unit/utils/Message.test.ts +1 -1
- package/tests/unit/utils/TransactionUtils.test.ts +1 -5
- package/tests/unit/utils/UnitConverter.test.ts +81 -47
- package/tsconfig.json +1 -1
- package/.eslintrc.js +0 -12
- package/prettier.config.js +0 -8
package/.github/workflows/ci.yml
CHANGED
@@ -3,34 +3,34 @@ name: CI
|
|
3
3
|
on: push
|
4
4
|
|
5
5
|
jobs:
|
6
|
-
|
7
|
-
|
6
|
+
build:
|
7
|
+
runs-on: ubuntu-latest
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
strategy:
|
10
|
+
matrix:
|
11
|
+
node-version: [20.19, 22.14, 23.10]
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v4
|
15
|
+
with:
|
16
|
+
ref: ${{ github.head_ref }}
|
17
|
+
token: ${{ secrets.GH_TOKEN }}
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
- uses: pnpm/action-setup@v4
|
20
|
+
with:
|
21
|
+
version: 10
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
- uses: actions/setup-node@v4
|
24
|
+
with:
|
25
|
+
node-version: ${{ matrix.node-version }}
|
26
|
+
cache: pnpm
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
- name: Update System
|
29
|
+
run: sudo apt-get update
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
- name: Install
|
32
|
+
run: pnpm install
|
33
33
|
|
34
|
-
|
34
|
+
- run: pnpm run build
|
35
35
|
|
36
|
-
|
36
|
+
- run: pnpm test
|
@@ -0,0 +1,80 @@
|
|
1
|
+
name: Format
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [ready_for_review, synchronize, opened]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
prettier:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
matrix:
|
13
|
+
node-version: [22.14]
|
14
|
+
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v4
|
17
|
+
with:
|
18
|
+
ref: ${{ github.head_ref }}
|
19
|
+
token: ${{ secrets.GH_TOKEN }}
|
20
|
+
|
21
|
+
- uses: pnpm/action-setup@v4
|
22
|
+
with:
|
23
|
+
version: 10
|
24
|
+
|
25
|
+
- uses: actions/setup-node@v4
|
26
|
+
with:
|
27
|
+
node-version: ${{ matrix.node-version }}
|
28
|
+
cache: pnpm
|
29
|
+
|
30
|
+
- name: Update System
|
31
|
+
run: sudo apt-get update
|
32
|
+
|
33
|
+
- name: Install
|
34
|
+
run: pnpm install
|
35
|
+
|
36
|
+
- name: Format
|
37
|
+
run: pnpm format
|
38
|
+
|
39
|
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
40
|
+
with:
|
41
|
+
commit_message: "style: resolve style guide violations"
|
42
|
+
branch: ${{ github.head_ref }}
|
43
|
+
|
44
|
+
eslint:
|
45
|
+
needs: prettier
|
46
|
+
|
47
|
+
runs-on: ubuntu-latest
|
48
|
+
|
49
|
+
strategy:
|
50
|
+
matrix:
|
51
|
+
node-version: [22.14]
|
52
|
+
|
53
|
+
steps:
|
54
|
+
- uses: actions/checkout@v4
|
55
|
+
with:
|
56
|
+
ref: ${{ github.head_ref }}
|
57
|
+
token: ${{ secrets.GH_TOKEN }}
|
58
|
+
|
59
|
+
- uses: pnpm/action-setup@v4
|
60
|
+
with:
|
61
|
+
version: 10
|
62
|
+
|
63
|
+
- uses: actions/setup-node@v4
|
64
|
+
with:
|
65
|
+
node-version: ${{ matrix.node-version }}
|
66
|
+
cache: pnpm
|
67
|
+
|
68
|
+
- name: Update System
|
69
|
+
run: sudo apt-get update
|
70
|
+
|
71
|
+
- name: Install
|
72
|
+
run: pnpm install
|
73
|
+
|
74
|
+
- name: Format
|
75
|
+
run: pnpm lint --fix
|
76
|
+
|
77
|
+
- uses: stefanzweifel/git-auto-commit-action@v4
|
78
|
+
with:
|
79
|
+
commit_message: "style: resolve style guide violations"
|
80
|
+
branch: ${{ github.head_ref }}
|
package/.prettierrc.json
ADDED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ContractAbiType.d.ts","sourceRoot":"","sources":["../../src/enums/ContractAbiType.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;
|
1
|
+
{"version":3,"file":"ContractAbiType.d.ts","sourceRoot":"","sources":["../../src/enums/ContractAbiType.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe;IAC1B,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,YAAY,iBAAiB;IAC7B,SAAS,cAAc;CACvB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/identities/PrivateKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAMnD,
|
1
|
+
{"version":3,"file":"PrivateKey.d.ts","sourceRoot":"","sources":["../../src/identities/PrivateKey.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAMnD,UAAU,oBAAoB;IAC7B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACV;AAED,qBAAa,UAAU;IACf,UAAU,EAAE,MAAM,CAAC;gBAEd,OAAO,EAAE,MAAM,CAAC,MAAM;IAIlC,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU;IAIrD,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAMvC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU;IAMjC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAW1D"}
|
@@ -24,7 +24,7 @@ export class PrivateKey {
|
|
24
24
|
return new PrivateKey(wallet);
|
25
25
|
}
|
26
26
|
static fromWif(wif) {
|
27
|
-
const decodedWif = WIF.decode(wif, Buffer.from(Network.get().
|
27
|
+
const decodedWif = WIF.decode(wif, Buffer.from(Network.get().wif(), "hex").readUInt8());
|
28
28
|
return PrivateKey.fromHex(Buffer.from(decodedWif.privateKey).toString("hex"));
|
29
29
|
}
|
30
30
|
sign(message) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WIF.d.ts","sourceRoot":"","sources":["../../src/identities/WIF.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WIF.d.ts","sourceRoot":"","sources":["../../src/identities/WIF.ts"],"names":[],"mappings":"AAIA,qBAAa,GAAG;IACf,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;CASjD"}
|
package/dist/identities/WIF.js
CHANGED
@@ -5,8 +5,8 @@ export class WIF {
|
|
5
5
|
static fromPassphrase(passphrase) {
|
6
6
|
const privateKey = PrivateKey.fromPassphrase(passphrase);
|
7
7
|
return WIFPackage.encode({
|
8
|
-
version: Buffer.from(Network.get().
|
9
|
-
privateKey: Buffer.from(privateKey.privateKey,
|
8
|
+
version: Buffer.from(Network.get().wif(), "hex").readUInt8(),
|
9
|
+
privateKey: Buffer.from(privateKey.privateKey, "hex"),
|
10
10
|
compressed: true,
|
11
11
|
});
|
12
12
|
}
|