Skip to content

Commit cfb8848

Browse files
authored
feat: remove amino-json patch (#199)
* chore: yarn updated yarn.lock * feat: remove amino-json patch * chore: generate proto without amino-json patch * fix: wallet callmethod type * fix: prettify all files + improve script logs * fix: deps issue * test: add e2e jest test + edit CI workflow
1 parent d2401c0 commit cfb8848

File tree

8 files changed

+173
-300
lines changed

8 files changed

+173
-300
lines changed

.github/workflows/test.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,14 @@ jobs:
1919
- name: Install modules
2020
run: yarn install
2121

22+
- name: Install Go
23+
uses: actions/setup-go@v6
24+
with:
25+
go-version: '1.23'
26+
27+
# Install gnodev only when this PR will be merged: https://github.com/gnolang/gno/pull/4763
28+
- name: Install gnodev
29+
run: curl -sSL https://raw.githubusercontent.com/gnolang/gno/master/misc/install.sh | bash
30+
2231
- name: Tests
23-
run: ./node_modules/.bin/jest --passWithNoTests
32+
run: ./node_modules/.bin/jest

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,8 @@
5454
"@gnolang/tm2-js-client": "^1.3.3",
5555
"long": "^5.3.2",
5656
"protobufjs": "^7.5.3"
57+
},
58+
"resolutions": {
59+
"@noble/hashes": "^1.8.0"
5760
}
5861
}

scripts/amino-json-compatibility.patch

Lines changed: 0 additions & 231 deletions
This file was deleted.

scripts/generate.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ FILES=$(find proto -type f -name "*.proto")
88

99
mkdir -p ${OUT_DIR}
1010

11+
echo "Generating TypeScript files from proto definitions..."
1112
for x in ${FILES}; do
1213
protoc \
1314
--plugin="./node_modules/.bin/protoc-gen-ts_proto" \
@@ -17,18 +18,7 @@ for x in ${FILES}; do
1718
${x}
1819
done
1920

20-
# Apply amino JSON compatibility changes to patch proto generated files.
21-
# Patch fixes two issues:
22-
# - Empty `max_deposit` is represented in JSON as an empty string in proto while omitted completely in Amino JSON
23-
# - Empty `google.protobuf.Any` fields are omitted in proto JSON while explicitly set to null in Amino JSON
24-
#
25-
# See:
26-
# https://github.com/gnolang/gno-js-client/pull/184
27-
# https://github.com/gnolang/gno-js-client/pull/46
28-
#
29-
# This is a short term solution that potentially requires maintaining the patch updated.
21+
echo "Prettifying generated files..."
3022
if [ $? -eq 0 ]; then
31-
# First prettify generated code to allow the patch to be applied
32-
${PRETTIER} --write ${OUT_DIR}/gno/bank.ts ${OUT_DIR}/gno/vm.ts && \
33-
git apply ./scripts/amino-json-compatibility.patch
23+
find ${OUT_DIR} -name "*.ts" -exec ${PRETTIER} --write {} +
3424
fi

0 commit comments

Comments
 (0)