From 337b05ca7fa207932deface0b27b24bb04bab27e Mon Sep 17 00:00:00 2001 From: notV4l Date: Thu, 4 May 2023 18:21:56 +0200 Subject: [PATCH 1/3] fix: validation errors on starknet_write_api --- api/starknet_write_api.json | 5 +---- package.json | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api/starknet_write_api.json b/api/starknet_write_api.json index 557eeb4..806648b 100644 --- a/api/starknet_write_api.json +++ b/api/starknet_write_api.json @@ -105,7 +105,7 @@ }, "errors": [ { - "$ref": "#/components/errors/CLASS_HASH_NOT_FOUND" + "$ref": "./api/starknet_api_openrpc.json#/components/errors/CLASS_HASH_NOT_FOUND" } ] } @@ -148,9 +148,6 @@ "code": 50, "message": "Invalid contract class" }, - "CLASS_HASH_NOT_FOUND": { - "$ref": "./api/starknet_api_openrpc.json#/components/errors/CLASS_HASH_NOT_FOUND" - }, "CLASS_ALREADY_DECLARED": { "code": 51, "message": "Class already declared" diff --git a/package.json b/package.json index f60c7e0..8e0b9a7 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,10 @@ "url": "https://github.com/starkware-libs/starknet-specs.git" }, "scripts": { - "validate_all": "node validate.js api/starknet_api_openrpc.json && node validate.js api/starknet_write_api.json && node validate.js api/starknet_trace_api_openrpc.json" + "validate_all": "node validate.js api/starknet_api_openrpc.json && node validate.js api/starknet_write_api.json && node validate.js api/starknet_trace_api_openrpc.json", + "gen_api": " node ./node_modules/@open-rpc/typings/build/cli.js -d ./api/starknet_api_openrpc.json --output-ts . --name-ts starknet_api", + "gen_write_api": " node ./node_modules/@open-rpc/typings/build/cli.js -d ./api/starknet_write_api.json --output-ts . --name-ts starknet_write_api", + "gen_trace_api": " node ./node_modules/@open-rpc/typings/build/cli.js -d ./api/starknet_trace_api_openrpc.json --output-ts . --name-ts starknet_trace_api" }, "author": "Lior Schejter", "license": "MIT", @@ -16,4 +19,4 @@ "fs-extra": "10.1.0", "@json-schema-tools/dereferencer": "1.5.4" } -} +} \ No newline at end of file From f4b1e2637581ed8df3d01f7b5ed28fc8345f7ebe Mon Sep 17 00:00:00 2001 From: notV4l Date: Thu, 4 May 2023 18:25:03 +0200 Subject: [PATCH 2/3] add @open-rpc/typings --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8e0b9a7..9233cd2 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,9 @@ "author": "Lior Schejter", "license": "MIT", "dependencies": { + "@json-schema-tools/dereferencer": "1.5.4", "@open-rpc/schema-utils-js": "^1.16.1", - "fs-extra": "10.1.0", - "@json-schema-tools/dereferencer": "1.5.4" + "@open-rpc/typings": "^1.12.3", + "fs-extra": "10.1.0" } -} \ No newline at end of file +} From 443c47f4e75d0a1cf480729bb65aa9071c8439e1 Mon Sep 17 00:00:00 2001 From: notV4l Date: Thu, 4 May 2023 18:26:42 +0200 Subject: [PATCH 3/3] fix typings generation for starknet_write_api --- api/starknet_write_api.json | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/api/starknet_write_api.json b/api/starknet_write_api.json index 806648b..e47c630 100644 --- a/api/starknet_write_api.json +++ b/api/starknet_write_api.json @@ -141,6 +141,66 @@ }, "FUNCTION_CALL": { "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FUNCTION_CALL" + }, + "SIERRA_ENTRY_POINT": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/SIERRA_ENTRY_POINT" + }, + "BROADCASTED_TXN_COMMON_PROPERTIES": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_TXN_COMMON_PROPERTIES" + }, + "INVOKE_TXN_V0": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN_V0" + }, + "INVOKE_TXN_V1": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/INVOKE_TXN_V1" + }, + "ADDRESS": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/ADDRESS" + }, + "BROADCASTED_DECLARE_TXN_V1": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_DECLARE_TXN_V1" + }, + "DEPRECATED_CONTRACT_CLASS": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPRECATED_CONTRACT_CLASS" + }, + "DEPRECATED_CAIRO_ENTRY_POINT": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPRECATED_CAIRO_ENTRY_POINT" + }, + "CONTRACT_ABI": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_ABI" + }, + "CONTRACT_ABI_ENTRY": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/CONTRACT_ABI_ENTRY" + }, + "FUNCTION_ABI_ENTRY": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FUNCTION_ABI_ENTRY" + }, + "FUNCTION_ABI_TYPE": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/FUNCTION_ABI_TYPE" + }, + "TYPED_PARAMETER": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/TYPED_PARAMETER" + }, + "EVENT_ABI_ENTRY": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EVENT_ABI_ENTRY" + }, + "EVENT_ABI_TYPE": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/EVENT_ABI_TYPE" + }, + "STRUCT_ABI_ENTRY": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/STRUCT_ABI_ENTRY" + }, + "STRUCT_ABI_TYPE": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/STRUCT_ABI_TYPE" + }, + "STRUCT_MEMBER": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/STRUCT_MEMBER" + }, + "BROADCASTED_DECLARE_TXN_V2": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/BROADCASTED_DECLARE_TXN_V2" + }, + "DEPLOY_ACCOUNT_TXN_PROPERTIES": { + "$ref": "./api/starknet_api_openrpc.json#/components/schemas/DEPLOY_ACCOUNT_TXN_PROPERTIES" } }, "errors": {