Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Adding support for Tuples and adding example tests for nested containers #1068

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
- name: Test Types
run: |
yarn test-types
- name: Test Nested Containers
run: |
yarn test-nested-containers
- name: Build
run: |
yarn build-web
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-edge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Test Types
run: |
yarn test-types
- name: Test Nested Containers
run: |
yarn test-nested-containers
- name: Build
run: |
yarn build-web
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ jobs:
- name: Test Types
run: |
yarn test-types
- name: Test Nested Containers
run: |
yarn test-nested-containers
- name: Build
run: |
yarn build-web
Expand Down Expand Up @@ -107,6 +110,9 @@ jobs:
- name: Test Types
run: |
yarn test-types
- name: Test Nested Containers
run: |
yarn test-nested-containers
- name: Build
run: |
yarn build-web
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
"test": "jest src/tests/*eosjs* --coverage --coverageDirectory './coverage/test'",
"test-node": "jest src/tests/*node*",
"test-node-coverage": "jest src/tests/*node* --coverage --coverageDirectory './coverage/test-node'",
"test-nested-containers": "jest src/tests/nested-containers.test.ts --coverage --coverageDirectory './coverage/nested-containers'",
"test-types": "jest src/tests/type-checks.test.ts --coverage --coverageDirectory './coverage/test-types'",
"test-all": "yarn test && yarn test-node && yarn test-types && yarn cypress",
"test-all": "yarn test && yarn test-node && yarn test-types && yarn test-nested-containers && yarn cypress",
"build": "rimraf dist && tsc -p ./tsconfig.json",
"build-web": "webpack --config webpack.prod.js && webpack --config webpack.debug.js",
"build-production": "yarn build && yarn build-web && yarn test-all",
Expand Down
6 changes: 6 additions & 0 deletions src/eosjs-serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,12 @@ function serializeStruct(
if (this.base) {
this.base.serialize(buffer, data, state, allowExtensions);
}
if (Array.isArray(data)) { // Tuple
this.fields.forEach((field: Field, index: number) => {
field.type.serialize(buffer, data[index], state, allowExtensions);
});
return;
}
for (const field of this.fields) {
if (field.name in data) {
if (state.skippedBinaryExtension) {
Expand Down
650 changes: 650 additions & 0 deletions src/tests/nested-containers.test.ts

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2323,9 +2323,9 @@ [email protected]:
bigi "^1.1.0"

electron-to-chromium@^1.4.17:
version "1.4.20"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.20.tgz#8fbf9677ccac19b4249c0a6204e0943d9d66ce30"
integrity sha512-N7ZVNrdzX8NE90OXEFBMsBf3fp8P/vVDUER3WCUZjzC7OkNTXHVoF6W9qVhq8+dA8tGnbDajzUpj2ISNVVyj+Q==
version "1.4.21"
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.21.tgz#edf7d9477980079d840570c34ab4c4a5bef4c2bd"
integrity sha512-T04U2ciApGbm+dESFEBbewi2Xt0Dgyww8M4n4sOt9lnmFuYbaHEDWCROkx4jvAZDUWWry9YOdnAs+7468q80Qg==

[email protected], elliptic@^6.5.3:
version "6.5.4"
Expand Down Expand Up @@ -4025,7 +4025,7 @@ jest-worker@^26.6.2:
merge-stream "^2.0.0"
supports-color "^7.0.0"

jest-worker@^27.0.6:
jest-worker@^27.4.1:
version "27.4.5"
resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-27.4.5.tgz#d696e3e46ae0f24cff3fa7195ffba22889262242"
integrity sha512-f2s8kEdy15cv9r7q4KkzGXvlY0JTcmCbMHZBfSQDwW77REr45IDWwd0lksDFeVHH2jJ5pqb90T77XscrjeGzzg==
Expand Down Expand Up @@ -5669,11 +5669,11 @@ terminal-link@^2.0.0:
supports-hyperlinks "^2.0.0"

terser-webpack-plugin@^5.1.3:
version "5.2.5"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz#ce65b9880a0c36872555c4874f45bbdb02ee32c9"
integrity sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==
version "5.3.0"
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.3.0.tgz#21641326486ecf91d8054161c816e464435bae9f"
integrity sha512-LPIisi3Ol4chwAaPP8toUJ3L4qCM1G0wao7L3qNv57Drezxj6+VEyySpPw4B1HSO2Eg/hDY/MNF5XihCAoqnsQ==
dependencies:
jest-worker "^27.0.6"
jest-worker "^27.4.1"
schema-utils "^3.1.1"
serialize-javascript "^6.0.0"
source-map "^0.6.1"
Expand Down