From 933db42876ccd03fa61e51596d040e83f88ee8c7 Mon Sep 17 00:00:00 2001 From: Toni Tabak Date: Fri, 19 Apr 2024 17:14:20 +0200 Subject: [PATCH 1/2] refactor(spec): extract and import rpc spec types from starknet-types --- package-lock.json | 55 +- package.json | 4 +- src/types/api/index.ts | 4 +- src/types/api/rpcspec_0_7/components.ts | 678 ------------------------ src/types/api/rpcspec_0_7/contract.ts | 1 - src/types/api/rpcspec_0_7/errors.ts | 1 - src/types/api/rpcspec_0_7/index.ts | 9 - src/types/api/rpcspec_0_7/methods.ts | 340 ------------ src/types/api/rpcspec_0_7/nonspec.ts | 193 ------- src/types/provider/spec.ts | 62 +-- src/types/typedData.ts | 2 +- src/utils/events.ts | 2 +- src/utils/typedData.ts | 7 +- src/wallet/account.ts | 21 +- src/wallet/connect.ts | 34 +- src/wallet/types.ts | 2 +- 16 files changed, 106 insertions(+), 1309 deletions(-) delete mode 100644 src/types/api/rpcspec_0_7/components.ts delete mode 100644 src/types/api/rpcspec_0_7/contract.ts delete mode 100644 src/types/api/rpcspec_0_7/errors.ts delete mode 100644 src/types/api/rpcspec_0_7/index.ts delete mode 100644 src/types/api/rpcspec_0_7/methods.ts delete mode 100644 src/types/api/rpcspec_0_7/nonspec.ts diff --git a/package-lock.json b/package-lock.json index 96000893e..32b0d75d2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "isomorphic-fetch": "^3.0.0", "lossless-json": "^4.0.1", "pako": "^2.0.4", - "starknet-types": "^0.0.5", + "starknet-types-07": "file:~/Work/types-js/ldist", "ts-mixer": "^6.0.3", "url-join": "^4.0.1" }, @@ -62,6 +62,52 @@ "typescript": "~5.4.0" } }, + "../starknet-types": { + "extraneous": true + }, + "../types-js": { + "name": "starknet-types", + "version": "0.7.1", + "license": "MIT", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^7.4.0", + "@typescript-eslint/parser": "^7.4.0", + "cz-conventional-changelog": "^3.3.0", + "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^18.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-prettier": "^5.1.3", + "prettier": "^3.2.5", + "prettier-plugin-import-sort": "^0.0.7", + "semantic-release": "^23.0.8", + "typescript": "^5.4.3" + } + }, + "../types-js/dist": { + "extraneous": true + }, + "../types-js/ldist": { + "name": "starknet-types", + "version": "0.7.1", + "license": "MIT", + "devDependencies": { + "@typescript-eslint/eslint-plugin": "^7.4.0", + "@typescript-eslint/parser": "^7.4.0", + "cz-conventional-changelog": "^3.3.0", + "eslint": "^8.57.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-airbnb-typescript": "^18.0.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-import": "^2.29.1", + "eslint-plugin-prettier": "^5.1.3", + "prettier": "^3.2.5", + "prettier-plugin-import-sort": "^0.0.7", + "semantic-release": "^23.0.8", + "typescript": "^5.4.3" + } + }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -17858,10 +17904,9 @@ "node": ">=8" } }, - "node_modules/starknet-types": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/starknet-types/-/starknet-types-0.0.5.tgz", - "integrity": "sha512-u6bbtMo7XSawor4OJg+QA7Lsr9nnBc/MdOwkcJsKiIKjQa9ox3UEUqqEoNz9ob6IwKcJWJSgCS0GzYp8b3oJ/A==" + "node_modules/starknet-types-07": { + "resolved": "../types-js/ldist", + "link": true }, "node_modules/stream-combiner2": { "version": "1.1.1", diff --git a/package.json b/package.json index 9b2f50624..2efa0806a 100644 --- a/package.json +++ b/package.json @@ -98,9 +98,9 @@ "isomorphic-fetch": "^3.0.0", "lossless-json": "^4.0.1", "pako": "^2.0.4", - "starknet-types": "^0.0.5", "ts-mixer": "^6.0.3", - "url-join": "^4.0.1" + "url-join": "^4.0.1", + "starknet-types-07": "file:~/Work/types-js/ldist" }, "lint-staged": { "*.ts": "eslint --cache --fix", diff --git a/src/types/api/index.ts b/src/types/api/index.ts index 56fb63876..fce1535a3 100644 --- a/src/types/api/index.ts +++ b/src/types/api/index.ts @@ -1,5 +1,5 @@ export * as JRPC from './jsonrpc'; export * as RPCSPEC06 from './rpcspec_0_6'; -export * as RPCSPEC07 from './rpcspec_0_7'; -export * from './rpcspec_0_7'; +export * as RPCSPEC07 from 'starknet-types-07'; +export * from 'starknet-types-07'; diff --git a/src/types/api/rpcspec_0_7/components.ts b/src/types/api/rpcspec_0_7/components.ts deleted file mode 100644 index 3694338e2..000000000 --- a/src/types/api/rpcspec_0_7/components.ts +++ /dev/null @@ -1,678 +0,0 @@ -/** - * PRIMITIVES - */ - -/** - * A field element. represented by at most 63 hex digits - * @pattern ^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,62})$ - */ -export type FELT = string; -/** - * an ethereum address represented as 40 hex digits - * @pattern ^0x[a-fA-F0-9]{40}$ - */ -export type ETH_ADDRESS = string; -/** - * A storage key. Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes. - * @pattern ^0x(0|[0-7]{1}[a-fA-F0-9]{0,62}$) - */ -export type STORAGE_KEY = string; -export type ADDRESS = FELT; -export type NUM_AS_HEX = string; -/** - * 64 bit integers, represented by hex string of length at most 16 - * "pattern": "^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,15})$" - */ -export type u64 = string; -/** - * 64 bit integers, represented by hex string of length at most 32 - * "pattern": "^0x(0|[a-fA-F1-9]{1}[a-fA-F0-9]{0,31})$" - */ -export type u128 = string; -export type SIGNATURE = Array; -export type BLOCK_NUMBER = number; -export type BLOCK_HASH = FELT; -export type TXN_HASH = FELT; -export type CHAIN_ID = NUM_AS_HEX; -export type STRUCT_ABI_TYPE = 'struct'; -export type EVENT_ABI_TYPE = 'event'; -export type FUNCTION_ABI_TYPE = 'function' | 'l1_handler' | 'constructor'; -// Represents the type of an entry point. -export type ENTRY_POINT_TYPE = 'EXTERNAL' | 'L1_HANDLER' | 'CONSTRUCTOR'; -// Represents the type of a function call. -export type CALL_TYPE = 'DELEGATE' | 'LIBRARY_CALL' | 'CALL'; -// Represents the status of the transaction -export type TXN_STATUS = 'RECEIVED' | 'REJECTED' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1'; -// Flags that indicate how to simulate a given transaction. By default, the sequencer behavior is replicated locally (enough funds are expected to be in the account, and the fee will be deducted from the balance before the simulation of the next transaction). To skip the fee charge, use the SKIP_FEE_CHARGE flag. -export type SIMULATION_FLAG = 'SKIP_VALIDATE' | 'SKIP_FEE_CHARGE'; -// Data availability mode -export type DA_MODE = 'L1' | 'L2'; -export type TXN_TYPE = 'DECLARE' | 'DEPLOY' | 'DEPLOY_ACCOUNT' | 'INVOKE' | 'L1_HANDLER'; -export type TXN_FINALITY_STATUS = 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1'; -export type TXN_EXECUTION_STATUS = 'SUCCEEDED' | 'REVERTED'; -export type BLOCK_STATUS = 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED'; -export type BLOCK_TAG = 'latest' | 'pending'; - -/** - * READ API - */ - -export type EVENTS_CHUNK = { - // Returns matching events - events: EMITTED_EVENT[]; - // Use this token in a subsequent query to obtain the next page. Should not appear if there are no more pages. - continuation_token?: string; -}; - -export type RESULT_PAGE_REQUEST = { - // The token returned from the previous query. If no token is provided the first page is returned. - continuation_token?: string; - // Chunk size - chunk_size: number; -}; - -export type EMITTED_EVENT = EVENT & { - block_hash: BLOCK_HASH; - block_number: BLOCK_NUMBER; - transaction_hash: TXN_HASH; -}; - -export type EVENT = { - from_address: ADDRESS; -} & EVENT_CONTENT; - -export type EVENT_CONTENT = { - keys: FELT[]; - data: FELT[]; -}; - -export type EVENT_FILTER = { - from_block?: BLOCK_ID; - to_block?: BLOCK_ID; - address?: ADDRESS; - keys?: FELT[][]; -}; - -export type BLOCK_ID = - | { - block_hash?: BLOCK_HASH; - block_number?: BLOCK_NUMBER; - } - | BLOCK_TAG; - -export type SYNC_STATUS = { - starting_block_hash: BLOCK_HASH; - starting_block_num: BLOCK_NUMBER; - current_block_hash: BLOCK_HASH; - current_block_num: BLOCK_NUMBER; - highest_block_hash: BLOCK_HASH; - highest_block_num: BLOCK_NUMBER; -}; - -export type NEW_CLASSES = { - class_hash: FELT; - compiled_class_hash: FELT; -}; - -export type REPLACED_CLASS = { - class_hash: FELT; - contract_address: FELT; -}; - -export type NONCE_UPDATE = { - contract_address: ADDRESS; - nonce: FELT; -}; - -export type STATE_DIFF = { - storage_diffs: CONTRACT_STORAGE_DIFF_ITEM[]; - deprecated_declared_classes: FELT[]; - declared_classes: NEW_CLASSES[]; - deployed_contracts: DEPLOYED_CONTRACT_ITEM[]; - replaced_classes: REPLACED_CLASS[]; - nonces: NONCE_UPDATE[]; -}; - -export type PENDING_STATE_UPDATE = { - old_root: FELT; - state_diff: STATE_DIFF; - block_hash: never; // diverge: this makes it distinct -}; - -export type STATE_UPDATE = { - block_hash: BLOCK_HASH; - old_root: FELT; - new_root: FELT; - state_diff: STATE_DIFF; -}; - -export type BLOCK_BODY_WITH_TX_HASHES = { - transactions: TXN_HASH[]; -}; - -export type BLOCK_BODY_WITH_TXS = { - transactions: (TXN & { - transaction_hash: TXN_HASH; - })[]; -}; - -export type BLOCK_BODY_WITH_RECEIPTS = { - transactions: { - transaction: TXN; - receipt: TXN_RECEIPT; - }[]; -}; - -export type BLOCK_HEADER = { - block_hash: BLOCK_HASH; - parent_hash: BLOCK_HASH; - block_number: BLOCK_NUMBER; - new_root: FELT; - timestamp: number; - sequencer_address: FELT; - l1_gas_price: RESOURCE_PRICE; - l1_data_gas_price: RESOURCE_PRICE; - l1_da_mode: 'BLOB' | 'CALLDATA'; - starknet_version: string; -}; - -export type PENDING_BLOCK_HEADER = { - parent_hash: BLOCK_HASH; - timestamp: number; - sequencer_address: FELT; - l1_gas_price: RESOURCE_PRICE; - l1_data_gas_price: RESOURCE_PRICE; - l1_da_mode: 'BLOB' | 'CALLDATA'; - starknet_version: string; -}; - -export type BLOCK_WITH_TX_HASHES = { status: BLOCK_STATUS } & BLOCK_HEADER & - BLOCK_BODY_WITH_TX_HASHES; - -export type BLOCK_WITH_TXS = { status: BLOCK_STATUS } & BLOCK_HEADER & BLOCK_BODY_WITH_TXS; - -export type BLOCK_WITH_RECEIPTS = { - status: BLOCK_STATUS; -} & BLOCK_HEADER & - BLOCK_BODY_WITH_RECEIPTS; - -export type PENDING_BLOCK_WITH_TX_HASHES = BLOCK_BODY_WITH_TX_HASHES & PENDING_BLOCK_HEADER; - -export type PENDING_BLOCK_WITH_TXS = BLOCK_BODY_WITH_TXS & PENDING_BLOCK_HEADER; - -export type PENDING_BLOCK_WITH_RECEIPTS = BLOCK_BODY_WITH_RECEIPTS & PENDING_BLOCK_HEADER; - -export type DEPLOYED_CONTRACT_ITEM = { - address: FELT; - class_hash: FELT; -}; - -export type CONTRACT_STORAGE_DIFF_ITEM = { - // The contract address for which the storage changed (in FELT format) - address: string; - // The changes in the storage of the contract - storage_entries: StorageDiffItem[]; -}; - -export type StorageDiffItem = { - // The key of the changed value (in FELT format) - key: string; - // The new value applied to the given address (in FELT format) - value: string; -}; - -export type TXN = INVOKE_TXN | L1_HANDLER_TXN | DECLARE_TXN | DEPLOY_TXN | DEPLOY_ACCOUNT_TXN; - -export type DECLARE_TXN = DECLARE_TXN_V0 | DECLARE_TXN_V1 | DECLARE_TXN_V2 | DECLARE_TXN_V3; - -export type DECLARE_TXN_V0 = { - type: 'DECLARE'; - sender_address: ADDRESS; - max_fee: FELT; - version: '0x0' | '0x100000000000000000000000000000000'; - signature: SIGNATURE; - class_hash: FELT; -}; - -export type DECLARE_TXN_V1 = { - type: 'DECLARE'; - sender_address: ADDRESS; - max_fee: FELT; - version: '0x1' | '0x100000000000000000000000000000001'; - signature: SIGNATURE; - nonce: FELT; - class_hash: FELT; -}; - -export type DECLARE_TXN_V2 = { - type: 'DECLARE'; - sender_address: ADDRESS; - compiled_class_hash: FELT; - max_fee: FELT; - version: '0x2' | '0x100000000000000000000000000000002'; - signature: SIGNATURE; - nonce: FELT; - class_hash: FELT; -}; - -export type DECLARE_TXN_V3 = { - type: 'DECLARE'; - sender_address: ADDRESS; - compiled_class_hash: FELT; - version: '0x3' | '0x100000000000000000000000000000003'; - signature: SIGNATURE; - nonce: FELT; - class_hash: FELT; - // new... - resource_bounds: RESOURCE_BOUNDS_MAPPING; - tip: u64; - paymaster_data: FELT[]; - account_deployment_data: FELT[]; - nonce_data_availability_mode: DA_MODE; - fee_data_availability_mode: DA_MODE; -}; - -export type BROADCASTED_TXN = - | BROADCASTED_INVOKE_TXN - | BROADCASTED_DECLARE_TXN - | BROADCASTED_DEPLOY_ACCOUNT_TXN; - -export type BROADCASTED_INVOKE_TXN = INVOKE_TXN; - -export type BROADCASTED_DEPLOY_ACCOUNT_TXN = DEPLOY_ACCOUNT_TXN; - -export type BROADCASTED_DECLARE_TXN = - | BROADCASTED_DECLARE_TXN_V1 - | BROADCASTED_DECLARE_TXN_V2 - | BROADCASTED_DECLARE_TXN_V3; - -export type BROADCASTED_DECLARE_TXN_V1 = { - type: 'DECLARE'; - sender_address: ADDRESS; - max_fee: FELT; - // todo: check if working, prev i fixed it with NUM_AS_HEX - version: '0x1' | '0x100000000000000000000000000000001'; - signature: SIGNATURE; - nonce: FELT; - contract_class: DEPRECATED_CONTRACT_CLASS; -}; - -export type BROADCASTED_DECLARE_TXN_V2 = { - type: 'DECLARE'; - sender_address: ADDRESS; - compiled_class_hash: FELT; - max_fee: FELT; - version: '0x2' | '0x100000000000000000000000000000002'; - signature: SIGNATURE; - nonce: FELT; - contract_class: CONTRACT_CLASS; -}; - -export type BROADCASTED_DECLARE_TXN_V3 = { - type: 'DECLARE'; - sender_address: ADDRESS; - compiled_class_hash: FELT; - version: '0x3' | '0x100000000000000000000000000000003'; - signature: SIGNATURE; - nonce: FELT; - contract_class: CONTRACT_CLASS; - // new... - resource_bounds: RESOURCE_BOUNDS_MAPPING; - tip: u64; - paymaster_data: FELT[]; - account_deployment_data: FELT[]; - nonce_data_availability_mode: DA_MODE; - fee_data_availability_mode: DA_MODE; -}; - -export type DEPLOY_ACCOUNT_TXN = DEPLOY_ACCOUNT_TXN_V1 | DEPLOY_ACCOUNT_TXN_V3; - -export type DEPLOY_ACCOUNT_TXN_V1 = { - type: 'DEPLOY_ACCOUNT'; - max_fee: FELT; - version: '0x1' | '0x100000000000000000000000000000001'; - signature: SIGNATURE; - nonce: FELT; - contract_address_salt: FELT; - constructor_calldata: FELT[]; - class_hash: FELT; -}; - -export type DEPLOY_ACCOUNT_TXN_V3 = { - type: 'DEPLOY_ACCOUNT'; - version: '0x3' | '0x100000000000000000000000000000003'; - signature: SIGNATURE; - nonce: FELT; - contract_address_salt: FELT; - constructor_calldata: FELT[]; - class_hash: FELT; - resource_bounds: RESOURCE_BOUNDS_MAPPING; - tip: u64; - paymaster_data: FELT[]; - nonce_data_availability_mode: DA_MODE; - fee_data_availability_mode: DA_MODE; -}; - -export type DEPLOY_TXN = { - type: 'DEPLOY'; - version: FELT; - contract_address_salt: FELT; - constructor_calldata: FELT[]; - class_hash: FELT; -}; - -export type INVOKE_TXN = INVOKE_TXN_V0 | INVOKE_TXN_V1 | INVOKE_TXN_V3; - -export type INVOKE_TXN_V0 = { - type: 'INVOKE'; - max_fee: FELT; - version: '0x0' | '0x100000000000000000000000000000000'; - signature: SIGNATURE; - contract_address: ADDRESS; - entry_point_selector: FELT; - calldata: FELT[]; -}; - -export type INVOKE_TXN_V1 = { - type: 'INVOKE'; - sender_address: ADDRESS; - calldata: FELT[]; - max_fee: FELT; - version: '0x1' | '0x100000000000000000000000000000001'; - signature: SIGNATURE; - nonce: FELT; -}; - -export type INVOKE_TXN_V3 = { - type: 'INVOKE'; - sender_address: ADDRESS; - calldata: FELT[]; - version: '0x3' | '0x100000000000000000000000000000003'; - signature: SIGNATURE; - nonce: FELT; - resource_bounds: RESOURCE_BOUNDS_MAPPING; - tip: u64; - paymaster_data: FELT[]; - account_deployment_data: FELT[]; - nonce_data_availability_mode: DA_MODE; - fee_data_availability_mode: DA_MODE; -}; - -export type L1_HANDLER_TXN = { - version: '0x0'; - type: 'L1_HANDLER'; - nonce: NUM_AS_HEX; -} & FUNCTION_CALL; - -export type COMMON_RECEIPT_PROPERTIES = { - transaction_hash: TXN_HASH; - actual_fee: FEE_PAYMENT; - finality_status: TXN_FINALITY_STATUS; - messages_sent: MSG_TO_L1[]; - events: EVENT[]; - execution_resources: EXECUTION_RESOURCES; -} & (SUCCESSFUL_COMMON_RECEIPT_PROPERTIES | REVERTED_COMMON_RECEIPT_PROPERTIES); - -type SUCCESSFUL_COMMON_RECEIPT_PROPERTIES = { - execution_status: 'SUCCEEDED'; -}; - -type REVERTED_COMMON_RECEIPT_PROPERTIES = { - execution_status: 'REVERTED'; - revert_reason: string; -}; - -export type INVOKE_TXN_RECEIPT = { - type: 'INVOKE'; -} & COMMON_RECEIPT_PROPERTIES; - -export type DECLARE_TXN_RECEIPT = { - type: 'DECLARE'; -} & COMMON_RECEIPT_PROPERTIES; - -export type DEPLOY_ACCOUNT_TXN_RECEIPT = { - type: 'DEPLOY_ACCOUNT'; - contract_address: FELT; -} & COMMON_RECEIPT_PROPERTIES; - -export type DEPLOY_TXN_RECEIPT = { - type: 'DEPLOY'; - contract_address: FELT; -} & COMMON_RECEIPT_PROPERTIES; - -export type L1_HANDLER_TXN_RECEIPT = { - type: 'L1_HANDLER'; - message_hash: NUM_AS_HEX; -} & COMMON_RECEIPT_PROPERTIES; - -export type TXN_RECEIPT = - | INVOKE_TXN_RECEIPT - | L1_HANDLER_TXN_RECEIPT - | DECLARE_TXN_RECEIPT - | DEPLOY_TXN_RECEIPT - | DEPLOY_ACCOUNT_TXN_RECEIPT; - -export type TXN_RECEIPT_WITH_BLOCK_INFO = TXN_RECEIPT & { - block_hash?: BLOCK_HASH; - block_number?: BLOCK_NUMBER; -}; - -export type MSG_TO_L1 = { - from_address: FELT; - to_address: FELT; - payload: FELT[]; -}; - -export type MSG_FROM_L1 = { - from_address: ETH_ADDRESS; - to_address: ADDRESS; - entry_point_selector: FELT; - payload: FELT[]; -}; - -export type FUNCTION_CALL = { - contract_address: ADDRESS; - entry_point_selector: FELT; - calldata: FELT[]; -}; - -export type CONTRACT_CLASS = { - sierra_program: FELT[]; - contract_class_version: string; - entry_points_by_type: { - CONSTRUCTOR: SIERRA_ENTRY_POINT[]; - EXTERNAL: SIERRA_ENTRY_POINT[]; - L1_HANDLER: SIERRA_ENTRY_POINT[]; - }; - abi: string; -}; - -export type DEPRECATED_CONTRACT_CLASS = { - program: string; - entry_points_by_type: { - CONSTRUCTOR: DEPRECATED_CAIRO_ENTRY_POINT[]; - EXTERNAL: DEPRECATED_CAIRO_ENTRY_POINT[]; - L1_HANDLER: DEPRECATED_CAIRO_ENTRY_POINT[]; - }; - abi: CONTRACT_ABI; -}; - -export type DEPRECATED_CAIRO_ENTRY_POINT = { - offset: NUM_AS_HEX | number; - selector: FELT; -}; - -export type SIERRA_ENTRY_POINT = { - selector: FELT; - function_idx: number; -}; - -export type CONTRACT_ABI = readonly CONTRACT_ABI_ENTRY[]; - -export type CONTRACT_ABI_ENTRY = { - selector: FELT; - input: string; - output: string; -}; - -export type STRUCT_ABI_ENTRY = { - type: STRUCT_ABI_TYPE; - name: string; - size: number; - members: STRUCT_MEMBER[]; -}; - -export type STRUCT_MEMBER = TYPED_PARAMETER & { - offset: number; -}; - -export type EVENT_ABI_ENTRY = { - type: EVENT_ABI_TYPE; - name: string; - keys: TYPED_PARAMETER[]; - data: TYPED_PARAMETER[]; -}; - -export type FUNCTION_STATE_MUTABILITY = 'view'; - -export type FUNCTION_ABI_ENTRY = { - type: FUNCTION_ABI_TYPE; - name: string; - inputs: TYPED_PARAMETER[]; - outputs: TYPED_PARAMETER[]; - stateMutability: FUNCTION_STATE_MUTABILITY; -}; - -export type TYPED_PARAMETER = { - name: string; - type: string; -}; - -export type SIMULATION_FLAG_FOR_ESTIMATE_FEE = 'SKIP_VALIDATE'; -export type PRICE_UNIT = 'WEI' | 'FRI'; - -export type FEE_ESTIMATE = { - gas_consumed: FELT; - gas_price: FELT; - data_gas_consumed: FELT; - data_gas_price: FELT; - overall_fee: FELT; - unit: PRICE_UNIT; -}; - -export type FEE_PAYMENT = { - amount: FELT; - unit: PRICE_UNIT; -}; - -export type RESOURCE_BOUNDS_MAPPING = { - l1_gas: RESOURCE_BOUNDS; - l2_gas: RESOURCE_BOUNDS; -}; - -export type RESOURCE_BOUNDS = { - max_amount: u64; - max_price_per_unit: u128; -}; - -export type RESOURCE_PRICE = { - price_in_fri: FELT; - price_in_wei: FELT; -}; - -export type COMPUTATION_RESOURCES = { - steps: number; - memory_holes?: number; - range_check_builtin_applications?: number; - pedersen_builtin_applications?: number; - poseidon_builtin_applications?: number; - ec_op_builtin_applications?: number; - ecdsa_builtin_applications?: number; - bitwise_builtin_applications?: number; - keccak_builtin_applications?: number; - segment_arena_builtin?: number; -}; - -export type EXECUTION_RESOURCES = COMPUTATION_RESOURCES & { - data_availability: { - l1_gas: number; - l1_data_gas: number; - }; -}; - -/** - * TRACE API - */ - -// Represents a transaction trace including the execution details. -export type TRANSACTION_TRACE = { - invoke_tx_trace?: INVOKE_TXN_TRACE; - declare_tx_trace?: DECLARE_TXN_TRACE; - deploy_account_tx_trace?: DEPLOY_ACCOUNT_TXN_TRACE; - l1_handler_tx_trace?: L1_HANDLER_TXN_TRACE; -}; - -// Represents a transaction trace for an invoke transaction. -export type INVOKE_TXN_TRACE = { - type: 'INVOKE'; - execute_invocation: FUNCTION_INVOCATION | { revert_reason: string }; - validate_invocation?: FUNCTION_INVOCATION; - fee_transfer_invocation?: FUNCTION_INVOCATION; - state_diff?: STATE_DIFF; - execution_resources: EXECUTION_RESOURCES; -}; - -// Represents a transaction trace for a declare transaction. -export type DECLARE_TXN_TRACE = { - type: 'DECLARE'; - validate_invocation?: FUNCTION_INVOCATION; - fee_transfer_invocation?: FUNCTION_INVOCATION; - state_diff?: STATE_DIFF; - execution_resources: EXECUTION_RESOURCES; -}; - -// Represents a transaction trace for a deploy account transaction. -export type DEPLOY_ACCOUNT_TXN_TRACE = { - type: 'DEPLOY_ACCOUNT'; - constructor_invocation: FUNCTION_INVOCATION; - validate_invocation?: FUNCTION_INVOCATION; - fee_transfer_invocation?: FUNCTION_INVOCATION; - state_diff?: STATE_DIFF; - execution_resources: EXECUTION_RESOURCES; -}; - -// Represents a transaction trace for an L1 handler transaction. -export type L1_HANDLER_TXN_TRACE = { - type: 'L1_HANDLER'; - function_invocation: FUNCTION_INVOCATION; - state_diff?: STATE_DIFF; - execution_resources: EXECUTION_RESOURCES; -}; - -// Represents a nested function call. -export type NESTED_CALL = FUNCTION_INVOCATION; - -// Represents a function invocation along with its execution details. -export type FUNCTION_INVOCATION = FUNCTION_CALL & { - caller_address: string; - class_hash: string; - entry_point_type: ENTRY_POINT_TYPE; - call_type: CALL_TYPE; - result: string[]; - calls: NESTED_CALL[]; - events: ORDERED_EVENT[]; - messages: ORDERED_MESSAGE[]; - execution_resources: COMPUTATION_RESOURCES; -}; - -// Represents an ordered event alongside its order within the transaction. -export type ORDERED_EVENT = { - order: number; - event: EVENT; -}; - -// Represents an ordered message alongside its order within the transaction. -export type ORDERED_MESSAGE = { - order: number; - message: MSG_TO_L1; -}; diff --git a/src/types/api/rpcspec_0_7/contract.ts b/src/types/api/rpcspec_0_7/contract.ts deleted file mode 100644 index 4b07cf29b..000000000 --- a/src/types/api/rpcspec_0_7/contract.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../rpcspec_0_6/contract'; diff --git a/src/types/api/rpcspec_0_7/errors.ts b/src/types/api/rpcspec_0_7/errors.ts deleted file mode 100644 index c94051dc6..000000000 --- a/src/types/api/rpcspec_0_7/errors.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../rpcspec_0_6/errors'; diff --git a/src/types/api/rpcspec_0_7/index.ts b/src/types/api/rpcspec_0_7/index.ts deleted file mode 100644 index f7c774a4f..000000000 --- a/src/types/api/rpcspec_0_7/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * version v0.7.1 - */ - -export { Methods } from './methods'; -export { ABI } from './contract'; -export * as Errors from './errors'; -export * as SPEC from './components'; -export * from './nonspec'; diff --git a/src/types/api/rpcspec_0_7/methods.ts b/src/types/api/rpcspec_0_7/methods.ts deleted file mode 100644 index 683890252..000000000 --- a/src/types/api/rpcspec_0_7/methods.ts +++ /dev/null @@ -1,340 +0,0 @@ -import { - ADDRESS, - BLOCK_ID, - BLOCK_NUMBER, - BROADCASTED_DECLARE_TXN, - BROADCASTED_DEPLOY_ACCOUNT_TXN, - BROADCASTED_INVOKE_TXN, - BROADCASTED_TXN, - CHAIN_ID, - EVENT_FILTER, - FELT, - FUNCTION_CALL, - MSG_FROM_L1, - RESULT_PAGE_REQUEST, - SIMULATION_FLAG, - SIMULATION_FLAG_FOR_ESTIMATE_FEE, - STORAGE_KEY, - TXN_HASH, -} from './components'; -import * as Errors from './errors'; -import { - BlockHashAndNumber, - BlockTransactionsTraces, - BlockWithTxHashes, - BlockWithTxReceipts, - BlockWithTxs, - ContractClass, - DeclaredTransaction, - DeployedAccountTransaction, - Events, - FeeEstimate, - InvokedTransaction, - Nonce, - SimulateTransactionResponse, - StateUpdate, - Syncing, - TransactionReceipt, - TransactionStatus, - TransactionTrace, - TransactionWithHash, -} from './nonspec'; - -export type Methods = ReadMethods & WriteMethods & TraceMethods; - -type ReadMethods = { - // Returns the version of the Starknet JSON-RPC specification being used - starknet_specVersion: { - params: []; - result: string; - }; - - // Get block information with transaction hashes given the block id - starknet_getBlockWithTxHashes: { - params: { - block_id: BLOCK_ID; - }; - result: BlockWithTxHashes; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Get block information with full transactions given the block id - starknet_getBlockWithTxs: { - params: { - block_id: BLOCK_ID; - }; - result: BlockWithTxs; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Get block information with full transactions and receipts given the block id - starknet_getBlockWithReceipts: { - params: { - block_id: BLOCK_ID; - }; - result: BlockWithTxReceipts; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Get the information about the result of executing the requested block - starknet_getStateUpdate: { - params: { - block_id: BLOCK_ID; - }; - result: StateUpdate; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Get the value of the storage at the given address and key - starknet_getStorageAt: { - params: { - contract_address: ADDRESS; - key: STORAGE_KEY; - block_id: BLOCK_ID; - }; - result: FELT; - errors: Errors.CONTRACT_NOT_FOUND | Errors.BLOCK_NOT_FOUND; - }; - - // Gets the transaction status (possibly reflecting that the tx is still in the mempool, or dropped from it) - starknet_getTransactionStatus: { - params: { - transaction_hash: TXN_HASH; - }; - result: TransactionStatus; - errors: Errors.TXN_HASH_NOT_FOUND; - }; - - // Get the details and status of a submitted transaction - starknet_getTransactionByHash: { - params: { - transaction_hash: TXN_HASH; - }; - result: TransactionWithHash; - errors: Errors.TXN_HASH_NOT_FOUND; - }; - - // Get the details of a transaction by a given block id and index - starknet_getTransactionByBlockIdAndIndex: { - params: { - block_id: BLOCK_ID; - index: number; - }; - result: TransactionWithHash; - errors: Errors.BLOCK_NOT_FOUND | Errors.INVALID_TXN_INDEX; - }; - - // Get the transaction receipt by the transaction hash - starknet_getTransactionReceipt: { - params: { - transaction_hash: TXN_HASH; - }; - result: TransactionReceipt; - errors: Errors.TXN_HASH_NOT_FOUND; - }; - - // Get the contract class definition in the given block associated with the given hash - starknet_getClass: { - params: { - block_id: BLOCK_ID; - class_hash: FELT; - }; - result: ContractClass; - errors: Errors.BLOCK_NOT_FOUND | Errors.CLASS_HASH_NOT_FOUND; - }; - - // Get the contract class hash in the given block for the contract deployed at the given address - starknet_getClassHashAt: { - params: { - block_id: BLOCK_ID; - contract_address: ADDRESS; - }; - result: FELT; - errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND; - }; - - // Get the contract class definition in the given block at the given address - starknet_getClassAt: { - params: { - block_id: BLOCK_ID; - contract_address: ADDRESS; - }; - result: ContractClass; - errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND; - }; - - // Get the number of transactions in a block given a block id - starknet_getBlockTransactionCount: { - params: { - block_id: BLOCK_ID; - }; - result: number; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Call a Starknet function without creating a Starknet transaction - starknet_call: { - params: { - request: FUNCTION_CALL; - block_id: BLOCK_ID; - }; - result: FELT[]; - errors: Errors.CONTRACT_NOT_FOUND | Errors.CONTRACT_ERROR | Errors.BLOCK_NOT_FOUND; - }; - - // Estimate the fee for Starknet transactions - starknet_estimateFee: { - params: { - request: BROADCASTED_TXN[]; - simulation_flags?: [SIMULATION_FLAG_FOR_ESTIMATE_FEE] | []; // Diverged from spec (0.5 can't be, 0.6 must be) - block_id: BLOCK_ID; - }; - result: FeeEstimate[]; - errors: Errors.TRANSACTION_EXECUTION_ERROR | Errors.BLOCK_NOT_FOUND; - }; - - // Estimate the L2 fee of a message sent on L1 - starknet_estimateMessageFee: { - params: { - message: MSG_FROM_L1; - block_id: BLOCK_ID; - }; - result: FeeEstimate; - errors: Errors.CONTRACT_ERROR | Errors.BLOCK_NOT_FOUND; - }; - - // Get the most recent accepted block number - starknet_blockNumber: { - params: []; - result: BLOCK_NUMBER; - errors: Errors.NO_BLOCKS; - }; - - // Get the most recent accepted block hash and number - starknet_blockHashAndNumber: { - params: []; - result: BlockHashAndNumber; - errors: Errors.NO_BLOCKS; - }; - - // Return the currently configured Starknet chain id - starknet_chainId: { - params: []; - result: CHAIN_ID; - }; - - // Returns an object about the sync status, or false if the node is not syncing - starknet_syncing: { - params: []; - result: Syncing; - }; - - // Returns all events matching the given filter - starknet_getEvents: { - params: { - filter: EVENT_FILTER & RESULT_PAGE_REQUEST; - }; - result: Events; - errors: - | Errors.PAGE_SIZE_TOO_BIG - | Errors.INVALID_CONTINUATION_TOKEN - | Errors.BLOCK_NOT_FOUND - | Errors.TOO_MANY_KEYS_IN_FILTER; - }; - - // Get the nonce associated with the given address in the given block - starknet_getNonce: { - params: { - block_id: BLOCK_ID; - contract_address: ADDRESS; - }; - result: Nonce; - errors: Errors.BLOCK_NOT_FOUND | Errors.CONTRACT_NOT_FOUND; - }; -}; - -type WriteMethods = { - // Submit a new transaction to be added to the chain - starknet_addInvokeTransaction: { - params: { - invoke_transaction: BROADCASTED_INVOKE_TXN; - }; - result: InvokedTransaction; - errors: - | Errors.INSUFFICIENT_ACCOUNT_BALANCE - | Errors.INSUFFICIENT_MAX_FEE - | Errors.INVALID_TRANSACTION_NONCE - | Errors.VALIDATION_FAILURE - | Errors.NON_ACCOUNT - | Errors.DUPLICATE_TX - | Errors.UNSUPPORTED_TX_VERSION - | Errors.UNEXPECTED_ERROR; - }; - - // Submit a new class declaration transaction - starknet_addDeclareTransaction: { - params: { - declare_transaction: BROADCASTED_DECLARE_TXN; - }; - result: DeclaredTransaction; - errors: - | Errors.CLASS_ALREADY_DECLARED - | Errors.COMPILATION_FAILED - | Errors.COMPILED_CLASS_HASH_MISMATCH - | Errors.INSUFFICIENT_ACCOUNT_BALANCE - | Errors.INSUFFICIENT_MAX_FEE - | Errors.INVALID_TRANSACTION_NONCE - | Errors.VALIDATION_FAILURE - | Errors.NON_ACCOUNT - | Errors.DUPLICATE_TX - | Errors.CONTRACT_CLASS_SIZE_IS_TOO_LARGE - | Errors.UNSUPPORTED_TX_VERSION - | Errors.UNSUPPORTED_CONTRACT_CLASS_VERSION - | Errors.UNEXPECTED_ERROR; - }; - - // Submit a new deploy account transaction - starknet_addDeployAccountTransaction: { - params: { - deploy_account_transaction: BROADCASTED_DEPLOY_ACCOUNT_TXN; - }; - result: DeployedAccountTransaction; - errors: - | Errors.INSUFFICIENT_ACCOUNT_BALANCE - | Errors.INSUFFICIENT_MAX_FEE - | Errors.INVALID_TRANSACTION_NONCE - | Errors.VALIDATION_FAILURE - | Errors.NON_ACCOUNT - | Errors.CLASS_HASH_NOT_FOUND - | Errors.DUPLICATE_TX - | Errors.UNSUPPORTED_TX_VERSION - | Errors.UNEXPECTED_ERROR; - }; -}; - -type TraceMethods = { - // For a given executed transaction, return the trace of its execution, including internal calls - starknet_traceTransaction: { - params: { transaction_hash: TXN_HASH }; - result: TransactionTrace; - errors: Errors.TXN_HASH_NOT_FOUND | Errors.NO_TRACE_AVAILABLE; - }; - - // Returns the execution traces of all transactions included in the given block - starknet_traceBlockTransactions: { - params: { block_id: BLOCK_ID }; - result: BlockTransactionsTraces; - errors: Errors.BLOCK_NOT_FOUND; - }; - - // Simulate a given sequence of transactions on the requested state, and generate the execution traces. If one of the transactions is reverted, raises CONTRACT_ERROR - starknet_simulateTransactions: { - params: { - block_id: BLOCK_ID; - transactions: Array; - simulation_flags: Array; - }; - result: SimulateTransactionResponse; - errors: Errors.BLOCK_NOT_FOUND | Errors.TRANSACTION_EXECUTION_ERROR; - }; -}; diff --git a/src/types/api/rpcspec_0_7/nonspec.ts b/src/types/api/rpcspec_0_7/nonspec.ts deleted file mode 100644 index 179c511b0..000000000 --- a/src/types/api/rpcspec_0_7/nonspec.ts +++ /dev/null @@ -1,193 +0,0 @@ -/** - * Types that are not in spec but required for UX - */ -import { - ADDRESS, - BLOCK_HASH, - BLOCK_NUMBER, - BLOCK_WITH_RECEIPTS, - BLOCK_WITH_TXS, - BLOCK_WITH_TX_HASHES, - BROADCASTED_TXN, - CHAIN_ID, - CONTRACT_CLASS, - CONTRACT_STORAGE_DIFF_ITEM, - DEPRECATED_CONTRACT_CLASS, - EMITTED_EVENT, - EVENT, - EVENTS_CHUNK, - EVENT_FILTER, - FEE_ESTIMATE, - FEE_PAYMENT, - FELT, - MSG_FROM_L1, - NONCE_UPDATE, - PENDING_BLOCK_WITH_RECEIPTS, - PENDING_BLOCK_WITH_TXS, - PENDING_BLOCK_WITH_TX_HASHES, - PENDING_STATE_UPDATE, - PRICE_UNIT, - REPLACED_CLASS, - RESOURCE_BOUNDS_MAPPING, - RESULT_PAGE_REQUEST, - SIMULATION_FLAG, - STATE_UPDATE, - SYNC_STATUS, - TRANSACTION_TRACE, - TXN, - TXN_EXECUTION_STATUS, - TXN_HASH, - TXN_RECEIPT, - TXN_RECEIPT_WITH_BLOCK_INFO, - TXN_STATUS, -} from './components'; - -// METHOD RESPONSES -// response starknet_getClass -export type ContractClass = CONTRACT_CLASS | DEPRECATED_CONTRACT_CLASS; -// response starknet_simulateTransactions -export type SimulateTransaction = { - transaction_trace: TRANSACTION_TRACE; - fee_estimation: FEE_ESTIMATE; -}; -export type SimulateTransactionResponse = SimulateTransaction[]; -// response starknet_estimateFee -export type FeeEstimate = FEE_ESTIMATE; -// response starknet_getTransactionByHash, starknet_getTransactionByBlockIdAndIndex -export type TransactionWithHash = TXN & { transaction_hash: TXN_HASH }; -// response starknet_blockHashAndNumber -export type BlockHashAndNumber = { block_hash: BLOCK_HASH; block_number: BLOCK_NUMBER }; -// response starknet_getBlockWithTxs -export type BlockWithTxs = BLOCK_WITH_TXS | PENDING_BLOCK_WITH_TXS; -// response starknet_getBlockWithTxHashes -export type BlockWithTxHashes = BLOCK_WITH_TX_HASHES | PENDING_BLOCK_WITH_TX_HASHES; -// response starknet_getBlockWithReceipts -export type BlockWithTxReceipts = BLOCK_WITH_RECEIPTS | PENDING_BLOCK_WITH_RECEIPTS; -// response starknet_getStateUpdate -export type StateUpdate = STATE_UPDATE | PENDING_STATE_UPDATE; -// response starknet_traceBlockTransactions -export type BlockTransactionsTraces = { transaction_hash: FELT; trace_root: TRANSACTION_TRACE }[]; -// response starknet_syncing -export type Syncing = false | SYNC_STATUS; -// response starknet_getEvents -export type Events = EVENTS_CHUNK; -export type EmittedEvent = EMITTED_EVENT; -export type Event = EVENT; -// response starknet_addInvokeTransaction -export type InvokedTransaction = { transaction_hash: TXN_HASH }; -// response starknet_addDeclareTransaction -export type DeclaredTransaction = { transaction_hash: TXN_HASH; class_hash: FELT }; -// response starknet_addDeployAccountTransaction -export type DeployedAccountTransaction = { transaction_hash: TXN_HASH; contract_address: FELT }; - -// Nice Components names -export type ContractAddress = ADDRESS; -export type Felt = FELT; -export type Nonce = FELT; -export type TransactionHash = TXN_HASH; -export type TransactionTrace = TRANSACTION_TRACE; -export type BlockHash = BLOCK_HASH; -export type TransactionReceipt = TXN_RECEIPT_WITH_BLOCK_INFO; -export type Receipt = TXN_RECEIPT_WITH_BLOCK_INFO & BlockHashAndNumber; -export type PendingReceipt = TXN_RECEIPT; -export type EventFilter = EVENT_FILTER & RESULT_PAGE_REQUEST; -export type SimulationFlags = Array; -export type L1Message = MSG_FROM_L1; -export type BaseTransaction = BROADCASTED_TXN; -export type ChainId = CHAIN_ID; -export type Transaction = TXN; -export type TransactionStatus = { - finality_status: TXN_STATUS; - execution_status?: TXN_EXECUTION_STATUS; -}; -export type ResourceBounds = RESOURCE_BOUNDS_MAPPING; -export type FeePayment = FEE_PAYMENT; -export type PriceUnit = PRICE_UNIT; - -// Diff Than Seq -export type StorageDiffs = Array; -export type DeprecatedDeclaredClasses = Array; -export type NonceUpdates = NONCE_UPDATE[]; -export type ReplacedClasses = REPLACED_CLASS[]; - -// Enums Derived From Spec Types (require manual check for changes) -export enum ETransactionType { - DECLARE = 'DECLARE', - DEPLOY = 'DEPLOY', - DEPLOY_ACCOUNT = 'DEPLOY_ACCOUNT', - INVOKE = 'INVOKE', - L1_HANDLER = 'L1_HANDLER', -} - -export enum ESimulationFlag { - SKIP_VALIDATE = 'SKIP_VALIDATE', - SKIP_FEE_CHARGE = 'SKIP_FEE_CHARGE', -} - -export enum ETransactionStatus { - RECEIVED = 'RECEIVED', - REJECTED = 'REJECTED', - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', -} - -export enum ETransactionFinalityStatus { - ACCEPTED_ON_L2 = 'ACCEPTED_ON_L2', - ACCEPTED_ON_L1 = 'ACCEPTED_ON_L1', -} -export enum ETransactionExecutionStatus { - SUCCEEDED = 'SUCCEEDED', - REVERTED = 'REVERTED', -} - -export enum EBlockTag { - LATEST = 'latest', - PENDING = 'pending', -} - -// 'L1' | 'L2' -export enum EDataAvailabilityMode { - L1 = 'L1', - L2 = 'L2', -} - -// 0 | 1 -export enum EDAMode { - L1, - L2, -} - -/** - * V_ Transaction versions HexString - * F_ Fee Transaction Versions HexString (2 ** 128 + TRANSACTION_VERSION) - */ -export enum ETransactionVersion { - V0 = '0x0', - V1 = '0x1', - V2 = '0x2', - V3 = '0x3', - F0 = '0x100000000000000000000000000000000', - F1 = '0x100000000000000000000000000000001', - F2 = '0x100000000000000000000000000000002', - F3 = '0x100000000000000000000000000000003', -} - -/** - * Old Transaction Versions - */ -export enum ETransactionVersion2 { - V0 = '0x0', - V1 = '0x1', - V2 = '0x2', - F0 = '0x100000000000000000000000000000000', - F1 = '0x100000000000000000000000000000001', - F2 = '0x100000000000000000000000000000002', -} - -/** - * V3 Transaction Versions - */ -export enum ETransactionVersion3 { - V3 = '0x3', - F3 = '0x100000000000000000000000000000003', -} diff --git a/src/types/provider/spec.ts b/src/types/provider/spec.ts index 3a51a7604..9e4e41628 100644 --- a/src/types/provider/spec.ts +++ b/src/types/provider/spec.ts @@ -1,9 +1,8 @@ // this file aims to unify the RPC specification types used by the common Provider class +import { RPCSPEC07 } from '../api'; import * as RPC06 from '../api/rpcspec_0_6'; -import * as RPC07 from '../api/rpcspec_0_7'; import { SPEC as SPEC06 } from '../api/rpcspec_0_6'; -import { SPEC as SPEC07 } from '../api/rpcspec_0_7'; // taken from type-fest type Simplify = { [K in keyof T]: T[K] } & {}; @@ -51,59 +50,62 @@ type Merge = Simplify< : T1 | T2 >; -export type BLOCK_HASH = Merge; -export type BLOCK_NUMBER = Merge; -export type FELT = Merge; -export type TXN_HASH = Merge; +export type BLOCK_HASH = Merge; +export type BLOCK_NUMBER = Merge; +export type FELT = Merge; +export type TXN_HASH = Merge; -export type PRICE_UNIT = Merge; -export type RESOURCE_PRICE = Merge; -export type SIMULATION_FLAG = Merge; +export type PRICE_UNIT = Merge; +export type RESOURCE_PRICE = Merge; +export type SIMULATION_FLAG = Merge; -export type STATE_UPDATE = Merge; -export type PENDING_STATE_UPDATE = Merge; +export type STATE_UPDATE = Merge; +export type PENDING_STATE_UPDATE = Merge< + SPEC06.PENDING_STATE_UPDATE, + RPCSPEC07.SPEC.PENDING_STATE_UPDATE +>; export type INVOKE_TXN_RECEIPT = Merge< SPEC06.INVOKE_TXN_RECEIPT, - SPEC07.INVOKE_TXN_RECEIPT & RPC07.BlockHashAndNumber + RPCSPEC07.SPEC.INVOKE_TXN_RECEIPT & RPCSPEC07.BlockHashAndNumber >; export type DECLARE_TXN_RECEIPT = Merge< SPEC06.DECLARE_TXN_RECEIPT, - SPEC07.DECLARE_TXN_RECEIPT & RPC07.BlockHashAndNumber + RPCSPEC07.SPEC.DECLARE_TXN_RECEIPT & RPCSPEC07.BlockHashAndNumber >; export type DEPLOY_ACCOUNT_TXN_RECEIPT = Merge< SPEC06.DEPLOY_ACCOUNT_TXN_RECEIPT, - SPEC07.DEPLOY_ACCOUNT_TXN_RECEIPT & RPC07.BlockHashAndNumber + RPCSPEC07.SPEC.DEPLOY_ACCOUNT_TXN_RECEIPT & RPCSPEC07.BlockHashAndNumber >; export type L1_HANDLER_TXN_RECEIPT = Merge< SPEC06.L1_HANDLER_TXN_RECEIPT, - SPEC07.L1_HANDLER_TXN_RECEIPT & RPC07.BlockHashAndNumber + RPCSPEC07.SPEC.L1_HANDLER_TXN_RECEIPT & RPCSPEC07.BlockHashAndNumber >; export type PENDING_INVOKE_TXN_RECEIPT = Merge< SPEC06.PENDING_INVOKE_TXN_RECEIPT, - SPEC07.INVOKE_TXN_RECEIPT + RPCSPEC07.SPEC.INVOKE_TXN_RECEIPT >; export type PENDING_DECLARE_TXN_RECEIPT = Merge< SPEC06.PENDING_DECLARE_TXN_RECEIPT, - SPEC07.DECLARE_TXN_RECEIPT + RPCSPEC07.SPEC.DECLARE_TXN_RECEIPT >; export type PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT = Merge< SPEC06.PENDING_DEPLOY_ACCOUNT_TXN_RECEIPT, - SPEC07.DEPLOY_ACCOUNT_TXN_RECEIPT + RPCSPEC07.SPEC.DEPLOY_ACCOUNT_TXN_RECEIPT >; export type PENDING_L1_HANDLER_TXN_RECEIPT = Merge< SPEC06.PENDING_L1_HANDLER_TXN_RECEIPT, - SPEC07.L1_HANDLER_TXN_RECEIPT + RPCSPEC07.SPEC.L1_HANDLER_TXN_RECEIPT >; -export type BlockWithTxHashes = Merge; -export type ContractClassPayload = Merge; -export type DeclaredTransaction = Merge; -export type FeeEstimate = Merge; -export type InvokedTransaction = Merge; -export type PendingReceipt = Merge; -export type Receipt = Merge; -export type ResourceBounds = Merge; -export type SimulateTransaction = Merge; -export type TransactionReceipt = Merge; -export type TransactionWithHash = Merge; +export type BlockWithTxHashes = Merge; +export type ContractClassPayload = Merge; +export type DeclaredTransaction = Merge; +export type FeeEstimate = Merge; +export type InvokedTransaction = Merge; +export type PendingReceipt = Merge; +export type Receipt = Merge; +export type ResourceBounds = Merge; +export type SimulateTransaction = Merge; +export type TransactionReceipt = Merge; +export type TransactionWithHash = Merge; diff --git a/src/types/typedData.ts b/src/types/typedData.ts index 691ba96f0..ba9e548af 100644 --- a/src/types/typedData.ts +++ b/src/types/typedData.ts @@ -6,4 +6,4 @@ export { type StarknetType, type StarknetDomain, type TypedData, -} from 'starknet-types'; +} from 'starknet-types-07'; diff --git a/src/utils/events.ts b/src/utils/events.ts index 13a8e79c0..700dd97b6 100644 --- a/src/utils/events.ts +++ b/src/utils/events.ts @@ -13,7 +13,7 @@ export function parseUDCEvent(txReceipt: InvokeTransactionReceiptResponse) { throw new Error('UDC emitted event is empty'); } const event = txReceipt.events.find( - (it) => cleanHex(it.from_address) === cleanHex(UDC.ADDRESS) + (it: any) => cleanHex(it.from_address) === cleanHex(UDC.ADDRESS) ) || { data: [], }; diff --git a/src/utils/typedData.ts b/src/utils/typedData.ts index 9a62b06b5..29117a193 100644 --- a/src/utils/typedData.ts +++ b/src/utils/typedData.ts @@ -370,11 +370,14 @@ export function encodeData( const targetType = types[type] ?? revisionConfiguration[revision].presetTypes[type]; const [returnTypes, values] = targetType.reduce<[string[], string[]]>( ([ts, vs], field) => { - if (data[field.name] === undefined || (data[field.name] === null && field.type !== 'enum')) { + if ( + data[field.name as keyof T['message']] === undefined || + (data[field.name as keyof T['message']] === null && field.type !== 'enum') + ) { throw new Error(`Cannot encode data: missing data for '${field.name}'`); } - const value = data[field.name]; + const value = data[field.name as keyof T['message']]; const ctx = { parent: type, key: field.name }; const [t, encodedValue] = encodeValue(types, field.type, value, ctx, revision); diff --git a/src/wallet/account.ts b/src/wallet/account.ts index 9bc7616cc..82d4e3cf6 100644 --- a/src/wallet/account.ts +++ b/src/wallet/account.ts @@ -3,7 +3,7 @@ import { type AddStarknetChainParameters, type NetworkChangeEventHandler, type WatchAssetParameters, -} from 'starknet-types'; +} from 'starknet-types-07'; import { Account, AccountInterface } from '../account'; import { ProviderInterface } from '../provider'; @@ -13,19 +13,16 @@ import { Call, CompiledSierra, DeclareContractPayload, - DeployAccountContractPayload, MultiDeployContractResponse, ProviderOptions, TypedData, UniversalDeployerContractPayload, } from '../types'; -import { CallData } from '../utils/calldata'; import { extractContractHashes } from '../utils/contract'; import { stringify } from '../utils/json'; import { buildUDCCall } from '../utils/transaction'; import { addDeclareTransaction, - addDeployAccountTransaction, addInvokeTransaction, addStarknetChain, getPermissions, @@ -72,7 +69,7 @@ export class WalletAccount extends Account implements AccountInterface { .request({ type: 'wallet_requestAccounts', params: { - silentMode: false, + silent_mode: false, }, }) .then((res) => { @@ -122,7 +119,7 @@ export class WalletAccount extends Account implements AccountInterface { const { contractAddress, entrypoint, calldata } = it; return { contract_address: contractAddress, - entrypoint, + entry_point: entrypoint, calldata, }; }); @@ -169,18 +166,6 @@ export class WalletAccount extends Account implements AccountInterface { }; } - override deployAccount(payload: DeployAccountContractPayload) { - const params = { - contract_address_salt: payload.addressSalt?.toString() || '0', - constructor_calldata: payload.constructorCalldata - ? CallData.compile(payload.constructorCalldata) - : [], - class_hash: payload.classHash, - }; - - return addDeployAccountTransaction(this.walletProvider, params); - } - override signMessage(typedData: TypedData) { return signMessage(this.walletProvider, typedData); } diff --git a/src/wallet/connect.ts b/src/wallet/connect.ts index 02a50da7a..b61afbf33 100644 --- a/src/wallet/connect.ts +++ b/src/wallet/connect.ts @@ -2,25 +2,24 @@ import { type WatchAssetParameters, type AccountChangeEventHandler, type AddDeclareTransactionParameters, - type AddDeployAccountTransactionParameters, type AddInvokeTransactionParameters, type AddStarknetChainParameters, type NetworkChangeEventHandler, - type StarknetChainId, + type ChainId, type StarknetWindowObject, type TypedData, -} from 'starknet-types'; +} from 'starknet-types-07'; /** * Request Permission for wallet account, return addresses that are allowed by user * @param silentMode false: request user interaction allowance. true: return only pre-allowed * @returns allowed accounts addresses */ -export function requestAccounts(swo: StarknetWindowObject, silentMode = false) { +export function requestAccounts(swo: StarknetWindowObject, silent_mode = false) { return swo.request({ type: 'wallet_requestAccounts', params: { - silentMode, + silent_mode, }, }); } @@ -63,7 +62,7 @@ export function addStarknetChain(swo: StarknetWindowObject, chain: AddStarknetCh * @param chainId StarknetChainId * @returns boolean */ -export function switchStarknetChain(swo: StarknetWindowObject, chainId: StarknetChainId) { +export function switchStarknetChain(swo: StarknetWindowObject, chainId: ChainId) { return swo.request({ type: 'wallet_switchStarknetChain', params: { @@ -98,7 +97,7 @@ export function addInvokeTransaction( params: AddInvokeTransactionParameters ) { return swo.request({ - type: 'starknet_addInvokeTransaction', + type: 'wallet_addInvokeTransaction', params, }); } @@ -113,22 +112,7 @@ export function addDeclareTransaction( params: AddDeclareTransactionParameters ) { return swo.request({ - type: 'starknet_addDeclareTransaction', - params, - }); -} - -/** - * Add a deploy account transaction to the wallet. - * @param params The parameters required for the deploy account transaction. - * @returns The result of adding the deploy account transaction. - */ -export function addDeployAccountTransaction( - swo: StarknetWindowObject, - params: AddDeployAccountTransactionParameters -) { - return swo.request({ - type: 'starknet_addDeployAccountTransaction', + type: 'wallet_addDeclareTransaction', params, }); } @@ -140,7 +124,7 @@ export function addDeployAccountTransaction( */ export function signMessage(swo: StarknetWindowObject, typedData: TypedData) { return swo.request({ - type: 'starknet_signTypedData', + type: 'wallet_signTypedData', params: typedData, }); } @@ -150,7 +134,7 @@ export function signMessage(swo: StarknetWindowObject, typedData: TypedData) { * @returns An array of supported specification strings. */ export function supportedSpecs(swo: StarknetWindowObject) { - return swo.request({ type: 'starknet_supportedSpecs' }); + return swo.request({ type: 'wallet_supportedSpecs' }); } export function onAccountChange(swo: StarknetWindowObject, callback: AccountChangeEventHandler) { diff --git a/src/wallet/types.ts b/src/wallet/types.ts index cfb569337..9c73f64bd 100644 --- a/src/wallet/types.ts +++ b/src/wallet/types.ts @@ -1,4 +1,4 @@ -import { type RpcMessage, type StarknetWindowObject } from 'starknet-types'; +import { type RpcMessage, type StarknetWindowObject } from 'starknet-types-07'; // ---- TT Request Handler export type RpcCall = Omit; From dceaf85f38273d0497156526e227ee98af988618 Mon Sep 17 00:00:00 2001 From: Toni Tabak Date: Mon, 22 Apr 2024 12:21:32 +0200 Subject: [PATCH 2/2] chore: add starknet types 0.7.2 --- package-lock.json | 259 +++++++++++++++++++++++++--------------------- package.json | 2 +- 2 files changed, 140 insertions(+), 121 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32b0d75d2..b99f26fad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "isomorphic-fetch": "^3.0.0", "lossless-json": "^4.0.1", "pako": "^2.0.4", - "starknet-types-07": "file:~/Work/types-js/ldist", + "starknet-types-07": "npm:starknet-types@^0.7.2", "ts-mixer": "^6.0.3", "url-join": "^4.0.1" }, @@ -68,6 +68,7 @@ "../types-js": { "name": "starknet-types", "version": "0.7.1", + "extraneous": true, "license": "MIT", "devDependencies": { "@typescript-eslint/eslint-plugin": "^7.4.0", @@ -88,26 +89,6 @@ "../types-js/dist": { "extraneous": true }, - "../types-js/ldist": { - "name": "starknet-types", - "version": "0.7.1", - "license": "MIT", - "devDependencies": { - "@typescript-eslint/eslint-plugin": "^7.4.0", - "@typescript-eslint/parser": "^7.4.0", - "cz-conventional-changelog": "^3.3.0", - "eslint": "^8.57.0", - "eslint-config-airbnb-base": "^15.0.0", - "eslint-config-airbnb-typescript": "^18.0.0", - "eslint-config-prettier": "^9.1.0", - "eslint-plugin-import": "^2.29.1", - "eslint-plugin-prettier": "^5.1.3", - "prettier": "^3.2.5", - "prettier-plugin-import-sort": "^0.0.7", - "semantic-release": "^23.0.8", - "typescript": "^5.4.3" - } - }, "node_modules/@aashutoshrathi/word-wrap": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", @@ -13239,9 +13220,9 @@ } }, "node_modules/npm": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/npm/-/npm-10.5.0.tgz", - "integrity": "sha512-Ejxwvfh9YnWVU2yA5FzoYLTW52vxHCz+MHrOFg9Cc8IFgF/6f5AGPAvb5WTay5DIUP1NIfN3VBZ0cLlGO0Ys+A==", + "version": "10.5.2", + "resolved": "https://registry.npmjs.org/npm/-/npm-10.5.2.tgz", + "integrity": "sha512-cHVG7QEJwJdZyOrK0dKX5uf3R5Fd0E8AcmSES1jLtO52UT1enUKZ96Onw/xwq4CbrTZEnDuu2Vf9kCQh/Sd12w==", "bundleDependencies": [ "@isaacs/string-locale-compare", "@npmcli/arborist", @@ -13250,6 +13231,7 @@ "@npmcli/map-workspaces", "@npmcli/package-json", "@npmcli/promise-spawn", + "@npmcli/redact", "@npmcli/run-script", "@sigstore/tuf", "abbrev", @@ -13320,27 +13302,28 @@ "@npmcli/arborist": "^7.2.1", "@npmcli/config": "^8.0.2", "@npmcli/fs": "^3.1.0", - "@npmcli/map-workspaces": "^3.0.4", - "@npmcli/package-json": "^5.0.0", + "@npmcli/map-workspaces": "^3.0.6", + "@npmcli/package-json": "^5.0.2", "@npmcli/promise-spawn": "^7.0.1", + "@npmcli/redact": "^1.1.0", "@npmcli/run-script": "^7.0.4", - "@sigstore/tuf": "^2.3.1", + "@sigstore/tuf": "^2.3.2", "abbrev": "^2.0.0", "archy": "~1.0.0", "cacache": "^18.0.2", "chalk": "^5.3.0", "ci-info": "^4.0.0", "cli-columns": "^4.0.0", - "cli-table3": "^0.6.3", + "cli-table3": "^0.6.4", "columnify": "^1.6.0", "fastest-levenshtein": "^1.0.16", "fs-minipass": "^3.0.3", - "glob": "^10.3.10", + "glob": "^10.3.12", "graceful-fs": "^4.2.11", "hosted-git-info": "^7.0.1", - "ini": "^4.1.1", - "init-package-json": "^6.0.0", - "is-cidr": "^5.0.3", + "ini": "^4.1.2", + "init-package-json": "^6.0.2", + "is-cidr": "^5.0.5", "json-parse-even-better-errors": "^3.0.1", "libnpmaccess": "^8.0.1", "libnpmdiff": "^6.0.3", @@ -13354,11 +13337,11 @@ "libnpmteam": "^6.0.0", "libnpmversion": "^5.0.1", "make-fetch-happen": "^13.0.0", - "minimatch": "^9.0.3", + "minimatch": "^9.0.4", "minipass": "^7.0.4", "minipass-pipeline": "^1.2.4", "ms": "^2.1.2", - "node-gyp": "^10.0.1", + "node-gyp": "^10.1.0", "nopt": "^7.2.0", "normalize-package-data": "^6.0.0", "npm-audit-report": "^5.0.0", @@ -13366,7 +13349,7 @@ "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", "npm-profile": "^9.0.0", - "npm-registry-fetch": "^16.1.0", + "npm-registry-fetch": "^16.2.0", "npm-user-validate": "^2.0.0", "npmlog": "^7.0.1", "p-map": "^4.0.0", @@ -13374,12 +13357,12 @@ "parse-conflict-json": "^3.0.1", "proc-log": "^3.0.0", "qrcode-terminal": "^0.12.0", - "read": "^2.1.0", + "read": "^3.0.1", "semver": "^7.6.0", - "spdx-expression-parse": "^3.0.1", + "spdx-expression-parse": "^4.0.0", "ssri": "^10.0.5", "supports-color": "^9.4.0", - "tar": "^6.2.0", + "tar": "^6.2.1", "text-table": "~0.2.0", "tiny-relative-date": "^1.3.0", "treeverse": "^3.0.0", @@ -13491,7 +13474,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/agent": { - "version": "2.2.1", + "version": "2.2.2", "dev": true, "inBundle": true, "license": "ISC", @@ -13500,14 +13483,14 @@ "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^10.0.1", - "socks-proxy-agent": "^8.0.1" + "socks-proxy-agent": "^8.0.3" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@npmcli/arborist": { - "version": "7.4.0", + "version": "7.4.2", "dev": true, "inBundle": true, "license": "ISC", @@ -13521,6 +13504,7 @@ "@npmcli/node-gyp": "^3.0.0", "@npmcli/package-json": "^5.0.0", "@npmcli/query": "^3.1.0", + "@npmcli/redact": "^1.1.0", "@npmcli/run-script": "^7.0.2", "bin-links": "^4.0.1", "cacache": "^18.0.0", @@ -13528,12 +13512,12 @@ "hosted-git-info": "^7.0.1", "json-parse-even-better-errors": "^3.0.0", "json-stringify-nice": "^1.1.4", - "minimatch": "^9.0.0", + "minimatch": "^9.0.4", "nopt": "^7.0.0", "npm-install-checks": "^6.2.0", "npm-package-arg": "^11.0.1", "npm-pick-manifest": "^9.0.0", - "npm-registry-fetch": "^16.0.0", + "npm-registry-fetch": "^16.2.0", "npmlog": "^7.0.1", "pacote": "^17.0.4", "parse-conflict-json": "^3.0.0", @@ -13554,14 +13538,14 @@ } }, "node_modules/npm/node_modules/@npmcli/config": { - "version": "8.2.0", + "version": "8.2.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "@npmcli/map-workspaces": "^3.0.2", "ci-info": "^4.0.0", - "ini": "^4.1.0", + "ini": "^4.1.2", "nopt": "^7.0.0", "proc-log": "^3.0.0", "read-package-json-fast": "^3.0.2", @@ -13612,7 +13596,7 @@ } }, "node_modules/npm/node_modules/@npmcli/git": { - "version": "5.0.4", + "version": "5.0.5", "dev": true, "inBundle": true, "license": "ISC", @@ -13647,7 +13631,7 @@ } }, "node_modules/npm/node_modules/@npmcli/map-workspaces": { - "version": "3.0.4", + "version": "3.0.6", "dev": true, "inBundle": true, "license": "ISC", @@ -13695,7 +13679,7 @@ } }, "node_modules/npm/node_modules/@npmcli/package-json": { - "version": "5.0.0", + "version": "5.0.2", "dev": true, "inBundle": true, "license": "ISC", @@ -13736,6 +13720,15 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, + "node_modules/npm/node_modules/@npmcli/redact": { + "version": "1.1.0", + "dev": true, + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^16.14.0 || >=18.0.0" + } + }, "node_modules/npm/node_modules/@npmcli/run-script": { "version": "7.0.4", "dev": true, @@ -13763,19 +13756,19 @@ } }, "node_modules/npm/node_modules/@sigstore/bundle": { - "version": "2.2.0", + "version": "2.3.1", "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/protobuf-specs": "^0.3.0" + "@sigstore/protobuf-specs": "^0.3.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@sigstore/core": { - "version": "1.0.0", + "version": "1.1.0", "dev": true, "inBundle": true, "license": "Apache-2.0", @@ -13784,23 +13777,23 @@ } }, "node_modules/npm/node_modules/@sigstore/protobuf-specs": { - "version": "0.3.0", + "version": "0.3.1", "dev": true, "inBundle": true, "license": "Apache-2.0", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/@sigstore/sign": { - "version": "2.2.3", + "version": "2.3.0", "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/bundle": "^2.2.0", + "@sigstore/bundle": "^2.3.0", "@sigstore/core": "^1.0.0", - "@sigstore/protobuf-specs": "^0.3.0", + "@sigstore/protobuf-specs": "^0.3.1", "make-fetch-happen": "^13.0.0" }, "engines": { @@ -13808,7 +13801,7 @@ } }, "node_modules/npm/node_modules/@sigstore/tuf": { - "version": "2.3.1", + "version": "2.3.2", "dev": true, "inBundle": true, "license": "Apache-2.0", @@ -13821,14 +13814,14 @@ } }, "node_modules/npm/node_modules/@sigstore/verify": { - "version": "1.1.0", + "version": "1.2.0", "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/bundle": "^2.2.0", - "@sigstore/core": "^1.0.0", - "@sigstore/protobuf-specs": "^0.3.0" + "@sigstore/bundle": "^2.3.1", + "@sigstore/core": "^1.1.0", + "@sigstore/protobuf-specs": "^0.3.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" @@ -13866,7 +13859,7 @@ } }, "node_modules/npm/node_modules/agent-base": { - "version": "7.1.0", + "version": "7.1.1", "dev": true, "inBundle": true, "license": "MIT", @@ -13954,12 +13947,15 @@ } }, "node_modules/npm/node_modules/binary-extensions": { - "version": "2.2.0", + "version": "2.3.0", "dev": true, "inBundle": true, "license": "MIT", "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/npm/node_modules/brace-expansion": { @@ -13972,7 +13968,7 @@ } }, "node_modules/npm/node_modules/builtins": { - "version": "5.0.1", + "version": "5.1.0", "dev": true, "inBundle": true, "license": "MIT", @@ -14040,7 +14036,7 @@ } }, "node_modules/npm/node_modules/cidr-regex": { - "version": "4.0.3", + "version": "4.0.5", "dev": true, "inBundle": true, "license": "BSD-2-Clause", @@ -14074,7 +14070,7 @@ } }, "node_modules/npm/node_modules/cli-table3": { - "version": "0.6.3", + "version": "0.6.4", "dev": true, "inBundle": true, "license": "MIT", @@ -14352,16 +14348,16 @@ } }, "node_modules/npm/node_modules/glob": { - "version": "10.3.10", + "version": "10.3.12", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", - "jackspeak": "^2.3.5", + "jackspeak": "^2.3.6", "minimatch": "^9.0.1", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", - "path-scurry": "^1.10.1" + "minipass": "^7.0.4", + "path-scurry": "^1.10.2" }, "bin": { "glob": "dist/esm/bin.mjs" @@ -14386,7 +14382,7 @@ "license": "ISC" }, "node_modules/npm/node_modules/hasown": { - "version": "2.0.1", + "version": "2.0.2", "dev": true, "inBundle": true, "license": "MIT", @@ -14485,7 +14481,7 @@ } }, "node_modules/npm/node_modules/ini": { - "version": "4.1.1", + "version": "4.1.2", "dev": true, "inBundle": true, "license": "ISC", @@ -14494,15 +14490,15 @@ } }, "node_modules/npm/node_modules/init-package-json": { - "version": "6.0.0", + "version": "6.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { + "@npmcli/package-json": "^5.0.0", "npm-package-arg": "^11.0.0", "promzard": "^1.0.0", - "read": "^2.0.0", - "read-package-json": "^7.0.0", + "read": "^3.0.1", "semver": "^7.3.5", "validate-npm-package-license": "^3.0.4", "validate-npm-package-name": "^5.0.0" @@ -14543,12 +14539,12 @@ } }, "node_modules/npm/node_modules/is-cidr": { - "version": "5.0.3", + "version": "5.0.5", "dev": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { - "cidr-regex": "4.0.3" + "cidr-regex": "^4.0.4" }, "engines": { "node": ">=14" @@ -14651,20 +14647,20 @@ "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { - "version": "8.0.2", + "version": "8.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "npm-package-arg": "^11.0.1", - "npm-registry-fetch": "^16.0.0" + "npm-registry-fetch": "^16.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmdiff": { - "version": "6.0.7", + "version": "6.0.9", "dev": true, "inBundle": true, "license": "ISC", @@ -14672,19 +14668,19 @@ "@npmcli/arborist": "^7.2.1", "@npmcli/disparity-colors": "^3.0.0", "@npmcli/installed-package-contents": "^2.0.2", - "binary-extensions": "^2.2.0", + "binary-extensions": "^2.3.0", "diff": "^5.1.0", - "minimatch": "^9.0.0", + "minimatch": "^9.0.4", "npm-package-arg": "^11.0.1", "pacote": "^17.0.4", - "tar": "^6.2.0" + "tar": "^6.2.1" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmexec": { - "version": "7.0.8", + "version": "7.0.10", "dev": true, "inBundle": true, "license": "ISC", @@ -14696,7 +14692,7 @@ "npmlog": "^7.0.1", "pacote": "^17.0.4", "proc-log": "^3.0.0", - "read": "^2.0.0", + "read": "^3.0.1", "read-package-json-fast": "^3.0.2", "semver": "^7.3.7", "walk-up-path": "^3.0.1" @@ -14706,7 +14702,7 @@ } }, "node_modules/npm/node_modules/libnpmfund": { - "version": "5.0.5", + "version": "5.0.7", "dev": true, "inBundle": true, "license": "ISC", @@ -14718,33 +14714,33 @@ } }, "node_modules/npm/node_modules/libnpmhook": { - "version": "10.0.1", + "version": "10.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" + "npm-registry-fetch": "^16.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmorg": { - "version": "6.0.2", + "version": "6.0.3", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" + "npm-registry-fetch": "^16.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmpack": { - "version": "6.0.7", + "version": "6.0.9", "dev": true, "inBundle": true, "license": "ISC", @@ -14759,7 +14755,7 @@ } }, "node_modules/npm/node_modules/libnpmpublish": { - "version": "9.0.4", + "version": "9.0.5", "dev": true, "inBundle": true, "license": "ISC", @@ -14767,7 +14763,7 @@ "ci-info": "^4.0.0", "normalize-package-data": "^6.0.0", "npm-package-arg": "^11.0.1", - "npm-registry-fetch": "^16.0.0", + "npm-registry-fetch": "^16.2.0", "proc-log": "^3.0.0", "semver": "^7.3.7", "sigstore": "^2.2.0", @@ -14778,25 +14774,25 @@ } }, "node_modules/npm/node_modules/libnpmsearch": { - "version": "7.0.1", + "version": "7.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "npm-registry-fetch": "^16.0.0" + "npm-registry-fetch": "^16.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" } }, "node_modules/npm/node_modules/libnpmteam": { - "version": "6.0.1", + "version": "6.0.2", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { "aproba": "^2.0.0", - "npm-registry-fetch": "^16.0.0" + "npm-registry-fetch": "^16.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" @@ -14850,7 +14846,7 @@ } }, "node_modules/npm/node_modules/minimatch": { - "version": "9.0.3", + "version": "9.0.4", "dev": true, "inBundle": true, "license": "ISC", @@ -15058,7 +15054,7 @@ } }, "node_modules/npm/node_modules/node-gyp": { - "version": "10.0.1", + "version": "10.1.0", "dev": true, "inBundle": true, "license": "MIT", @@ -15209,11 +15205,12 @@ } }, "node_modules/npm/node_modules/npm-registry-fetch": { - "version": "16.1.0", + "version": "16.2.0", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { + "@npmcli/redact": "^1.1.0", "make-fetch-happen": "^13.0.0", "minipass": "^7.0.2", "minipass-fetch": "^3.0.0", @@ -15321,12 +15318,12 @@ } }, "node_modules/npm/node_modules/path-scurry": { - "version": "1.10.1", + "version": "1.10.2", "dev": true, "inBundle": true, "license": "BlueOak-1.0.0", "dependencies": { - "lru-cache": "^9.1.1 || ^10.0.0", + "lru-cache": "^10.2.0", "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" }, "engines": { @@ -15337,7 +15334,7 @@ } }, "node_modules/npm/node_modules/postcss-selector-parser": { - "version": "6.0.15", + "version": "6.0.16", "dev": true, "inBundle": true, "license": "MIT", @@ -15396,12 +15393,12 @@ } }, "node_modules/npm/node_modules/promzard": { - "version": "1.0.0", + "version": "1.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "read": "^2.0.0" + "read": "^3.0.1" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -15416,12 +15413,12 @@ } }, "node_modules/npm/node_modules/read": { - "version": "2.1.0", + "version": "3.0.1", "dev": true, "inBundle": true, "license": "ISC", "dependencies": { - "mute-stream": "~1.0.0" + "mute-stream": "^1.0.0" }, "engines": { "node": "^14.17.0 || ^16.13.0 || >=18.0.0" @@ -15547,17 +15544,17 @@ } }, "node_modules/npm/node_modules/sigstore": { - "version": "2.2.2", + "version": "2.3.0", "dev": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { - "@sigstore/bundle": "^2.2.0", + "@sigstore/bundle": "^2.3.1", "@sigstore/core": "^1.0.0", - "@sigstore/protobuf-specs": "^0.3.0", - "@sigstore/sign": "^2.2.3", + "@sigstore/protobuf-specs": "^0.3.1", + "@sigstore/sign": "^2.3.0", "@sigstore/tuf": "^2.3.1", - "@sigstore/verify": "^1.1.0" + "@sigstore/verify": "^1.2.0" }, "engines": { "node": "^16.14.0 || >=18.0.0" @@ -15574,7 +15571,7 @@ } }, "node_modules/npm/node_modules/socks": { - "version": "2.8.0", + "version": "2.8.3", "dev": true, "inBundle": true, "license": "MIT", @@ -15583,17 +15580,17 @@ "smart-buffer": "^4.2.0" }, "engines": { - "node": ">= 16.0.0", + "node": ">= 10.0.0", "npm": ">= 3.0.0" } }, "node_modules/npm/node_modules/socks-proxy-agent": { - "version": "8.0.2", + "version": "8.0.3", "dev": true, "inBundle": true, "license": "MIT", "dependencies": { - "agent-base": "^7.0.2", + "agent-base": "^7.1.1", "debug": "^4.3.4", "socks": "^2.7.1" }, @@ -15611,6 +15608,16 @@ "spdx-license-ids": "^3.0.0" } }, + "node_modules/npm/node_modules/spdx-correct/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, "node_modules/npm/node_modules/spdx-exceptions": { "version": "2.5.0", "dev": true, @@ -15618,7 +15625,7 @@ "license": "CC-BY-3.0" }, "node_modules/npm/node_modules/spdx-expression-parse": { - "version": "3.0.1", + "version": "4.0.0", "dev": true, "inBundle": true, "license": "MIT", @@ -15712,7 +15719,7 @@ } }, "node_modules/npm/node_modules/tar": { - "version": "6.2.0", + "version": "6.2.1", "dev": true, "inBundle": true, "license": "ISC", @@ -15836,6 +15843,16 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/npm/node_modules/validate-npm-package-license/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "dev": true, + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, "node_modules/npm/node_modules/validate-npm-package-name": { "version": "5.0.0", "dev": true, @@ -17905,8 +17922,10 @@ } }, "node_modules/starknet-types-07": { - "resolved": "../types-js/ldist", - "link": true + "name": "starknet-types", + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/starknet-types/-/starknet-types-0.7.2.tgz", + "integrity": "sha512-r3JJ0rrK0g3FnVRGcFiLY+9YT5WZgxB4TKBfR44wYGevHtKEM6BM5B+Gn1eou1zV7xEAwz3GpmvLSQTUAzDhsw==" }, "node_modules/stream-combiner2": { "version": "1.1.1", diff --git a/package.json b/package.json index 2efa0806a..4ed042dda 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "pako": "^2.0.4", "ts-mixer": "^6.0.3", "url-join": "^4.0.1", - "starknet-types-07": "file:~/Work/types-js/ldist" + "starknet-types-07": "npm:starknet-types@^0.7.2" }, "lint-staged": { "*.ts": "eslint --cache --fix",