@aztec/foundation 0.74.0 → 0.75.0-commit.c03ba01a2a4122e43e90d5133ba017e54b90e9d2
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/dest/abi/abi.js +157 -93
- package/dest/abi/buffer.js +9 -9
- package/dest/abi/decoder.js +89 -86
- package/dest/abi/encoder.js +91 -87
- package/dest/abi/event_selector.js +25 -33
- package/dest/abi/function_selector.js +28 -33
- package/dest/abi/index.js +0 -1
- package/dest/abi/note_selector.js +15 -21
- package/dest/abi/selector.js +22 -29
- package/dest/abi/u128.js +11 -5
- package/dest/abi/utils.js +9 -20
- package/dest/array/array.js +19 -26
- package/dest/array/index.js +0 -1
- package/dest/async-map/index.js +2 -4
- package/dest/async-pool/index.js +6 -9
- package/dest/aztec-address/index.js +14 -19
- package/dest/bigint-buffer/index.js +6 -13
- package/dest/buffer/buffer32.js +53 -66
- package/dest/buffer/index.js +0 -1
- package/dest/collection/array.js +47 -59
- package/dest/collection/index.js +0 -1
- package/dest/collection/object.js +9 -9
- package/dest/committable/committable.js +15 -20
- package/dest/committable/index.js +0 -1
- package/dest/config/env_var.js +1 -2
- package/dest/config/index.js +31 -36
- package/dest/crypto/index.js +0 -1
- package/dest/crypto/keccak/index.js +60 -69
- package/dest/crypto/keys/index.js +1 -2
- package/dest/crypto/pedersen/index.js +0 -1
- package/dest/crypto/pedersen/pedersen.elliptic.js +153 -146
- package/dest/crypto/pedersen/pedersen.noble.js +140 -142
- package/dest/crypto/pedersen/pedersen.wasm.js +14 -13
- package/dest/crypto/poseidon/index.js +10 -14
- package/dest/crypto/random/index.js +7 -12
- package/dest/crypto/random/randomness_singleton.js +12 -12
- package/dest/crypto/secp256k1-signer/index.js +0 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.js +8 -9
- package/dest/crypto/secp256k1-signer/utils.js +11 -16
- package/dest/crypto/sha256/index.js +80 -30
- package/dest/crypto/sha512/index.js +2 -4
- package/dest/crypto/sync/index.js +0 -1
- package/dest/crypto/sync/pedersen/index.js +14 -13
- package/dest/crypto/sync/poseidon/index.js +10 -14
- package/dest/decorators/index.js +0 -1
- package/dest/decorators/memoize.js +1 -2
- package/dest/error/index.js +6 -19
- package/dest/eth-address/index.js +92 -113
- package/dest/eth-signature/eth_signature.js +21 -27
- package/dest/eth-signature/index.js +0 -1
- package/dest/fields/coordinate.js +47 -46
- package/dest/fields/fields.js +112 -127
- package/dest/fields/index.js +0 -1
- package/dest/fields/point.js +119 -129
- package/dest/fs/index.js +0 -1
- package/dest/fs/run_in_dir.js +6 -6
- package/dest/index.js +0 -2
- package/dest/iterable/all.js +3 -4
- package/dest/iterable/filter.js +10 -11
- package/dest/iterable/index.js +0 -1
- package/dest/iterable/isAsyncIt.js +1 -3
- package/dest/iterable/map.js +10 -11
- package/dest/iterable/peek.js +14 -14
- package/dest/iterable/sort.js +4 -5
- package/dest/iterable/take.js +6 -7
- package/dest/iterable/toArray.js +1 -2
- package/dest/jest/setup.js +7 -0
- package/dest/json-rpc/client/fetch.js +21 -19
- package/dest/json-rpc/client/index.js +0 -1
- package/dest/json-rpc/client/safe_json_rpc_client.js +16 -8
- package/dest/json-rpc/convert.js +10 -20
- package/dest/json-rpc/fixtures/class_a.js +8 -5
- package/dest/json-rpc/fixtures/class_b.js +8 -5
- package/dest/json-rpc/fixtures/test_state.js +53 -40
- package/dest/json-rpc/index.js +0 -1
- package/dest/json-rpc/js_utils.js +2 -5
- package/dest/json-rpc/server/index.js +0 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +145 -101
- package/dest/json-rpc/server/telemetry.js +0 -2
- package/dest/json-rpc/test/index.js +0 -1
- package/dest/json-rpc/test/integration.js +8 -3
- package/dest/log/console.js +14 -16
- package/dest/log/debug.js +9 -18
- package/dest/log/gcloud-logger-config.js +17 -15
- package/dest/log/index.js +0 -1
- package/dest/log/log-filters.js +13 -11
- package/dest/log/log-levels.js +10 -2
- package/dest/log/log_fn.js +1 -2
- package/dest/log/log_history.js +21 -25
- package/dest/log/pino-logger.js +82 -64
- package/dest/message/index.js +7 -3
- package/dest/mutex/index.js +34 -32
- package/dest/mutex/mutex_database.js +4 -2
- package/dest/noir/index.js +0 -1
- package/dest/noir/noir_package_config.js +13 -8
- package/dest/promise/index.js +0 -1
- package/dest/promise/running-promise.js +28 -28
- package/dest/promise/utils.js +3 -5
- package/dest/queue/base_memory_queue.js +51 -59
- package/dest/queue/bounded_serial_queue.js +41 -51
- package/dest/queue/fifo_memory_queue.js +4 -8
- package/dest/queue/index.js +0 -1
- package/dest/queue/priority_memory_queue.js +3 -4
- package/dest/queue/priority_queue.js +5 -5
- package/dest/queue/semaphore.js +15 -19
- package/dest/queue/serial_queue.js +37 -47
- package/dest/retry/index.js +21 -18
- package/dest/running-promise/index.js +0 -1
- package/dest/schemas/api.js +2 -7
- package/dest/schemas/index.js +0 -1
- package/dest/schemas/parse.js +4 -8
- package/dest/schemas/schemas.js +33 -48
- package/dest/schemas/types.js +1 -2
- package/dest/schemas/utils.js +18 -31
- package/dest/serialize/buffer_reader.js +164 -188
- package/dest/serialize/field_reader.js +70 -79
- package/dest/serialize/free_funcs.js +40 -37
- package/dest/serialize/index.js +0 -1
- package/dest/serialize/serialize.js +72 -83
- package/dest/serialize/type_registry.js +10 -14
- package/dest/serialize/types.js +4 -5
- package/dest/sleep/index.js +25 -29
- package/dest/string/index.js +0 -1
- package/dest/testing/files/index.js +5 -8
- package/dest/testing/index.js +0 -1
- package/dest/testing/port_allocator.js +7 -10
- package/dest/testing/snapshot_serializer.js +14 -9
- package/dest/testing/test_data.js +7 -8
- package/dest/timer/date.js +9 -7
- package/dest/timer/elapsed.js +10 -7
- package/dest/timer/index.js +0 -1
- package/dest/timer/timeout.js +34 -34
- package/dest/timer/timer.js +17 -21
- package/dest/transport/browser/index.js +0 -1
- package/dest/transport/browser/message_port_socket.js +26 -30
- package/dest/transport/browser/shared_worker_connector.js +8 -10
- package/dest/transport/browser/shared_worker_listener.js +13 -17
- package/dest/transport/browser/worker_connector.js +12 -12
- package/dest/transport/browser/worker_listener.js +13 -17
- package/dest/transport/dispatch/create_dispatch_fn.js +2 -4
- package/dest/transport/dispatch/create_dispatch_proxy.js +16 -13
- package/dest/transport/dispatch/messages.js +4 -3
- package/dest/transport/index.js +0 -1
- package/dest/transport/interface/connector.js +3 -2
- package/dest/transport/interface/listener.js +4 -2
- package/dest/transport/interface/socket.js +7 -2
- package/dest/transport/interface/transferable.js +7 -9
- package/dest/transport/node/index.js +0 -1
- package/dest/transport/node/node_connector.js +9 -11
- package/dest/transport/node/node_connector_socket.js +21 -25
- package/dest/transport/node/node_listener.js +11 -15
- package/dest/transport/node/node_listener_socket.js +23 -27
- package/dest/transport/transport_client.js +47 -46
- package/dest/transport/transport_server.js +68 -55
- package/dest/trees/index.js +0 -1
- package/dest/trees/unbalanced_merkle_tree.js +26 -16
- package/dest/trees/unbalanced_tree_store.js +43 -29
- package/dest/types/index.js +1 -3
- package/dest/url/index.js +4 -8
- package/dest/validation/index.js +2 -5
- package/dest/wasm/empty_wasi_sdk.js +142 -160
- package/dest/wasm/index.js +0 -1
- package/dest/wasm/wasm_module.js +80 -90
- package/dest/worker/browser/index.js +0 -1
- package/dest/worker/browser/start_web_module.js +9 -5
- package/dest/worker/browser/web_data_store.js +12 -15
- package/dest/worker/browser/web_worker.js +6 -5
- package/dest/worker/data_store.js +3 -2
- package/dest/worker/index.js +0 -1
- package/dest/worker/node/index.js +0 -1
- package/dest/worker/node/node_data_store.js +4 -5
- package/dest/worker/node/node_worker.js +6 -5
- package/dest/worker/node/start_node_module.js +9 -5
- package/dest/worker/wasm_worker.js +3 -2
- package/dest/worker/worker_pool.js +32 -43
- package/package.json +3 -4
- package/src/fields/fields.ts +2 -2
- package/src/index.ts +0 -1
- package/src/queue/serial_queue.ts +1 -1
- package/src/testing/files/index.ts +2 -1
- package/src/wasm/index.ts +1 -1
- package/src/worker/index.ts +1 -1
- package/dest/abi/abi.d.ts +0 -853
- package/dest/abi/abi.d.ts.map +0 -1
- package/dest/abi/buffer.d.ts +0 -18
- package/dest/abi/buffer.d.ts.map +0 -1
- package/dest/abi/decoder.d.ts +0 -58
- package/dest/abi/decoder.d.ts.map +0 -1
- package/dest/abi/encoder.d.ts +0 -16
- package/dest/abi/encoder.d.ts.map +0 -1
- package/dest/abi/event_selector.d.ts +0 -52
- package/dest/abi/event_selector.d.ts.map +0 -1
- package/dest/abi/function_selector.d.ts +0 -65
- package/dest/abi/function_selector.d.ts.map +0 -1
- package/dest/abi/index.d.ts +0 -10
- package/dest/abi/index.d.ts.map +0 -1
- package/dest/abi/note_selector.d.ts +0 -42
- package/dest/abi/note_selector.d.ts.map +0 -1
- package/dest/abi/selector.d.ts +0 -42
- package/dest/abi/selector.d.ts.map +0 -1
- package/dest/abi/u128.d.ts +0 -13
- package/dest/abi/u128.d.ts.map +0 -1
- package/dest/abi/utils.d.ts +0 -44
- package/dest/abi/utils.d.ts.map +0 -1
- package/dest/array/array.d.ts +0 -71
- package/dest/array/array.d.ts.map +0 -1
- package/dest/array/index.d.ts +0 -2
- package/dest/array/index.d.ts.map +0 -1
- package/dest/async-map/index.d.ts +0 -13
- package/dest/async-map/index.d.ts.map +0 -1
- package/dest/async-pool/index.d.ts +0 -3
- package/dest/async-pool/index.d.ts.map +0 -1
- package/dest/aztec-address/index.d.ts +0 -57
- package/dest/aztec-address/index.d.ts.map +0 -1
- package/dest/bigint-buffer/index.d.ts +0 -42
- package/dest/bigint-buffer/index.d.ts.map +0 -1
- package/dest/blob/blob.d.ts +0 -154
- package/dest/blob/blob.d.ts.map +0 -1
- package/dest/blob/blob.js +0 -264
- package/dest/blob/encoding.d.ts +0 -53
- package/dest/blob/encoding.d.ts.map +0 -1
- package/dest/blob/encoding.js +0 -87
- package/dest/blob/errors.d.ts +0 -4
- package/dest/blob/errors.d.ts.map +0 -1
- package/dest/blob/errors.js +0 -7
- package/dest/blob/index.d.ts +0 -6
- package/dest/blob/index.d.ts.map +0 -1
- package/dest/blob/index.js +0 -22
- package/dest/blob/interface.d.ts +0 -10
- package/dest/blob/interface.d.ts.map +0 -1
- package/dest/blob/interface.js +0 -2
- package/dest/blob/mocks.d.ts +0 -20
- package/dest/blob/mocks.d.ts.map +0 -1
- package/dest/blob/mocks.js +0 -42
- package/dest/buffer/buffer32.d.ts +0 -91
- package/dest/buffer/buffer32.d.ts.map +0 -1
- package/dest/buffer/index.d.ts +0 -2
- package/dest/buffer/index.d.ts.map +0 -1
- package/dest/collection/array.d.ts +0 -101
- package/dest/collection/array.d.ts.map +0 -1
- package/dest/collection/index.d.ts +0 -3
- package/dest/collection/index.d.ts.map +0 -1
- package/dest/collection/object.d.ts +0 -14
- package/dest/collection/object.d.ts.map +0 -1
- package/dest/committable/committable.d.ts +0 -28
- package/dest/committable/committable.d.ts.map +0 -1
- package/dest/committable/index.d.ts +0 -2
- package/dest/committable/index.d.ts.map +0 -1
- package/dest/config/env_var.d.ts +0 -2
- package/dest/config/env_var.d.ts.map +0 -1
- package/dest/config/index.d.ts +0 -66
- package/dest/config/index.d.ts.map +0 -1
- package/dest/crypto/index.d.ts +0 -9
- package/dest/crypto/index.d.ts.map +0 -1
- package/dest/crypto/keccak/index.d.ts +0 -28
- package/dest/crypto/keccak/index.d.ts.map +0 -1
- package/dest/crypto/keys/index.d.ts +0 -5
- package/dest/crypto/keys/index.d.ts.map +0 -1
- package/dest/crypto/pedersen/index.d.ts +0 -2
- package/dest/crypto/pedersen/index.d.ts.map +0 -1
- package/dest/crypto/pedersen/pedersen.elliptic.d.ts +0 -13
- package/dest/crypto/pedersen/pedersen.elliptic.d.ts.map +0 -1
- package/dest/crypto/pedersen/pedersen.noble.d.ts +0 -11
- package/dest/crypto/pedersen/pedersen.noble.d.ts.map +0 -1
- package/dest/crypto/pedersen/pedersen.wasm.d.ts +0 -21
- package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +0 -1
- package/dest/crypto/poseidon/index.d.ts +0 -26
- package/dest/crypto/poseidon/index.d.ts.map +0 -1
- package/dest/crypto/random/index.d.ts +0 -25
- package/dest/crypto/random/index.d.ts.map +0 -1
- package/dest/crypto/random/randomness_singleton.d.ts +0 -25
- package/dest/crypto/random/randomness_singleton.d.ts.map +0 -1
- package/dest/crypto/secp256k1-signer/index.d.ts +0 -3
- package/dest/crypto/secp256k1-signer/index.d.ts.map +0 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +0 -24
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +0 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts +0 -40
- package/dest/crypto/secp256k1-signer/utils.d.ts.map +0 -1
- package/dest/crypto/sha256/index.d.ts +0 -20
- package/dest/crypto/sha256/index.d.ts.map +0 -1
- package/dest/crypto/sha512/index.d.ts +0 -11
- package/dest/crypto/sha512/index.d.ts.map +0 -1
- package/dest/crypto/sync/index.d.ts +0 -3
- package/dest/crypto/sync/index.d.ts.map +0 -1
- package/dest/crypto/sync/pedersen/index.d.ts +0 -21
- package/dest/crypto/sync/pedersen/index.d.ts.map +0 -1
- package/dest/crypto/sync/poseidon/index.d.ts +0 -26
- package/dest/crypto/sync/poseidon/index.d.ts.map +0 -1
- package/dest/decorators/index.d.ts +0 -2
- package/dest/decorators/index.d.ts.map +0 -1
- package/dest/decorators/memoize.d.ts +0 -2
- package/dest/decorators/memoize.d.ts.map +0 -1
- package/dest/error/index.d.ts +0 -21
- package/dest/error/index.d.ts.map +0 -1
- package/dest/eth-address/index.d.ts +0 -134
- package/dest/eth-address/index.d.ts.map +0 -1
- package/dest/eth-signature/eth_signature.d.ts +0 -62
- package/dest/eth-signature/eth_signature.d.ts.map +0 -1
- package/dest/eth-signature/index.d.ts +0 -2
- package/dest/eth-signature/index.d.ts.map +0 -1
- package/dest/fields/coordinate.d.ts +0 -68
- package/dest/fields/coordinate.d.ts.map +0 -1
- package/dest/fields/fields.d.ts +0 -176
- package/dest/fields/fields.d.ts.map +0 -1
- package/dest/fields/index.d.ts +0 -4
- package/dest/fields/index.d.ts.map +0 -1
- package/dest/fields/point.d.ts +0 -175
- package/dest/fields/point.d.ts.map +0 -1
- package/dest/fs/index.d.ts +0 -2
- package/dest/fs/index.d.ts.map +0 -1
- package/dest/fs/run_in_dir.d.ts +0 -2
- package/dest/fs/run_in_dir.d.ts.map +0 -1
- package/dest/index.d.ts +0 -34
- package/dest/index.d.ts.map +0 -1
- package/dest/iterable/all.d.ts +0 -9
- package/dest/iterable/all.d.ts.map +0 -1
- package/dest/iterable/filter.d.ts +0 -10
- package/dest/iterable/filter.d.ts.map +0 -1
- package/dest/iterable/index.d.ts +0 -8
- package/dest/iterable/index.d.ts.map +0 -1
- package/dest/iterable/isAsyncIt.d.ts +0 -7
- package/dest/iterable/isAsyncIt.d.ts.map +0 -1
- package/dest/iterable/map.d.ts +0 -12
- package/dest/iterable/map.d.ts.map +0 -1
- package/dest/iterable/peek.d.ts +0 -19
- package/dest/iterable/peek.d.ts.map +0 -1
- package/dest/iterable/sort.d.ts +0 -14
- package/dest/iterable/sort.d.ts.map +0 -1
- package/dest/iterable/take.d.ts +0 -10
- package/dest/iterable/take.d.ts.map +0 -1
- package/dest/iterable/toArray.d.ts +0 -2
- package/dest/iterable/toArray.d.ts.map +0 -1
- package/dest/json-rpc/client/fetch.d.ts +0 -21
- package/dest/json-rpc/client/fetch.d.ts.map +0 -1
- package/dest/json-rpc/client/index.d.ts +0 -3
- package/dest/json-rpc/client/index.d.ts.map +0 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +0 -13
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +0 -1
- package/dest/json-rpc/convert.d.ts +0 -20
- package/dest/json-rpc/convert.d.ts.map +0 -1
- package/dest/json-rpc/fixtures/class_a.d.ts +0 -11
- package/dest/json-rpc/fixtures/class_a.d.ts.map +0 -1
- package/dest/json-rpc/fixtures/class_b.d.ts +0 -11
- package/dest/json-rpc/fixtures/class_b.d.ts.map +0 -1
- package/dest/json-rpc/fixtures/test_state.d.ts +0 -89
- package/dest/json-rpc/fixtures/test_state.d.ts.map +0 -1
- package/dest/json-rpc/index.d.ts +0 -2
- package/dest/json-rpc/index.d.ts.map +0 -1
- package/dest/json-rpc/js_utils.d.ts +0 -13
- package/dest/json-rpc/js_utils.d.ts.map +0 -1
- package/dest/json-rpc/server/index.d.ts +0 -2
- package/dest/json-rpc/server/index.d.ts.map +0 -1
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +0 -140
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +0 -1
- package/dest/json-rpc/server/telemetry.d.ts +0 -2
- package/dest/json-rpc/server/telemetry.d.ts.map +0 -1
- package/dest/json-rpc/test/index.d.ts +0 -2
- package/dest/json-rpc/test/index.d.ts.map +0 -1
- package/dest/json-rpc/test/integration.d.ts +0 -13
- package/dest/json-rpc/test/integration.d.ts.map +0 -1
- package/dest/log/console.d.ts +0 -11
- package/dest/log/console.d.ts.map +0 -1
- package/dest/log/debug.d.ts +0 -56
- package/dest/log/debug.d.ts.map +0 -1
- package/dest/log/gcloud-logger-config.d.ts +0 -14
- package/dest/log/gcloud-logger-config.d.ts.map +0 -1
- package/dest/log/index.d.ts +0 -6
- package/dest/log/index.d.ts.map +0 -1
- package/dest/log/log-filters.d.ts +0 -7
- package/dest/log/log-filters.d.ts.map +0 -1
- package/dest/log/log-levels.d.ts +0 -3
- package/dest/log/log-levels.d.ts.map +0 -1
- package/dest/log/log_fn.d.ts +0 -7
- package/dest/log/log_fn.d.ts.map +0 -1
- package/dest/log/log_history.d.ts +0 -31
- package/dest/log/log_history.d.ts.map +0 -1
- package/dest/log/pino-logger.d.ts +0 -53
- package/dest/log/pino-logger.d.ts.map +0 -1
- package/dest/message/index.d.ts +0 -32
- package/dest/message/index.d.ts.map +0 -1
- package/dest/mutex/index.d.ts +0 -53
- package/dest/mutex/index.d.ts.map +0 -1
- package/dest/mutex/mutex_database.d.ts +0 -10
- package/dest/mutex/mutex_database.d.ts.map +0 -1
- package/dest/noir/index.d.ts +0 -2
- package/dest/noir/index.d.ts.map +0 -1
- package/dest/noir/noir_package_config.d.ts +0 -129
- package/dest/noir/noir_package_config.d.ts.map +0 -1
- package/dest/promise/index.d.ts +0 -3
- package/dest/promise/index.d.ts.map +0 -1
- package/dest/promise/running-promise.d.ts +0 -41
- package/dest/promise/running-promise.d.ts.map +0 -1
- package/dest/promise/utils.d.ts +0 -12
- package/dest/promise/utils.d.ts.map +0 -1
- package/dest/queue/base_memory_queue.d.ts +0 -65
- package/dest/queue/base_memory_queue.d.ts.map +0 -1
- package/dest/queue/bounded_serial_queue.d.ts +0 -56
- package/dest/queue/bounded_serial_queue.d.ts.map +0 -1
- package/dest/queue/fifo_memory_queue.d.ts +0 -21
- package/dest/queue/fifo_memory_queue.d.ts.map +0 -1
- package/dest/queue/index.d.ts +0 -6
- package/dest/queue/index.d.ts.map +0 -1
- package/dest/queue/priority_memory_queue.d.ts +0 -13
- package/dest/queue/priority_memory_queue.d.ts.map +0 -1
- package/dest/queue/priority_queue.d.ts +0 -14
- package/dest/queue/priority_queue.d.ts.map +0 -1
- package/dest/queue/semaphore.d.ts +0 -23
- package/dest/queue/semaphore.d.ts.map +0 -1
- package/dest/queue/serial_queue.d.ts +0 -49
- package/dest/queue/serial_queue.d.ts.map +0 -1
- package/dest/retry/index.d.ts +0 -44
- package/dest/retry/index.d.ts.map +0 -1
- package/dest/running-promise/index.d.ts +0 -2
- package/dest/running-promise/index.d.ts.map +0 -1
- package/dest/schemas/api.d.ts +0 -21
- package/dest/schemas/api.d.ts.map +0 -1
- package/dest/schemas/index.d.ts +0 -6
- package/dest/schemas/index.d.ts.map +0 -1
- package/dest/schemas/parse.d.ts +0 -9
- package/dest/schemas/parse.d.ts.map +0 -1
- package/dest/schemas/schemas.d.ts +0 -60
- package/dest/schemas/schemas.d.ts.map +0 -1
- package/dest/schemas/types.d.ts +0 -3
- package/dest/schemas/types.d.ts.map +0 -1
- package/dest/schemas/utils.d.ts +0 -53
- package/dest/schemas/utils.d.ts.map +0 -1
- package/dest/serialize/buffer_reader.d.ts +0 -239
- package/dest/serialize/buffer_reader.d.ts.map +0 -1
- package/dest/serialize/field_reader.d.ts +0 -112
- package/dest/serialize/field_reader.d.ts.map +0 -1
- package/dest/serialize/free_funcs.d.ts +0 -105
- package/dest/serialize/free_funcs.d.ts.map +0 -1
- package/dest/serialize/index.d.ts +0 -7
- package/dest/serialize/index.d.ts.map +0 -1
- package/dest/serialize/serialize.d.ts +0 -182
- package/dest/serialize/serialize.d.ts.map +0 -1
- package/dest/serialize/type_registry.d.ts +0 -23
- package/dest/serialize/type_registry.d.ts.map +0 -1
- package/dest/serialize/types.d.ts +0 -33
- package/dest/serialize/types.d.ts.map +0 -1
- package/dest/sleep/index.d.ts +0 -51
- package/dest/sleep/index.d.ts.map +0 -1
- package/dest/string/index.d.ts +0 -11
- package/dest/string/index.d.ts.map +0 -1
- package/dest/testing/files/index.d.ts +0 -19
- package/dest/testing/files/index.d.ts.map +0 -1
- package/dest/testing/index.d.ts +0 -4
- package/dest/testing/index.d.ts.map +0 -1
- package/dest/testing/port_allocator.d.ts +0 -10
- package/dest/testing/port_allocator.d.ts.map +0 -1
- package/dest/testing/snapshot_serializer.d.ts +0 -5
- package/dest/testing/snapshot_serializer.d.ts.map +0 -1
- package/dest/testing/test_data.d.ts +0 -7
- package/dest/testing/test_data.d.ts.map +0 -1
- package/dest/timer/date.d.ts +0 -13
- package/dest/timer/date.d.ts.map +0 -1
- package/dest/timer/elapsed.d.ts +0 -13
- package/dest/timer/elapsed.d.ts.map +0 -1
- package/dest/timer/index.d.ts +0 -5
- package/dest/timer/index.d.ts.map +0 -1
- package/dest/timer/timeout.d.ts +0 -41
- package/dest/timer/timeout.d.ts.map +0 -1
- package/dest/timer/timer.d.ts +0 -37
- package/dest/timer/timer.d.ts.map +0 -1
- package/dest/transport/browser/index.d.ts +0 -5
- package/dest/transport/browser/index.d.ts.map +0 -1
- package/dest/transport/browser/message_port_socket.d.ts +0 -37
- package/dest/transport/browser/message_port_socket.d.ts.map +0 -1
- package/dest/transport/browser/shared_worker_connector.d.ts +0 -19
- package/dest/transport/browser/shared_worker_connector.d.ts.map +0 -1
- package/dest/transport/browser/shared_worker_listener.d.ts +0 -38
- package/dest/transport/browser/shared_worker_listener.d.ts.map +0 -1
- package/dest/transport/browser/worker_connector.d.ts +0 -26
- package/dest/transport/browser/worker_connector.d.ts.map +0 -1
- package/dest/transport/browser/worker_listener.d.ts +0 -39
- package/dest/transport/browser/worker_listener.d.ts.map +0 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts +0 -25
- package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +0 -1
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts +0 -102
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts.map +0 -1
- package/dest/transport/dispatch/messages.d.ts +0 -52
- package/dest/transport/dispatch/messages.d.ts.map +0 -1
- package/dest/transport/index.d.ts +0 -12
- package/dest/transport/index.d.ts.map +0 -1
- package/dest/transport/interface/connector.d.ts +0 -8
- package/dest/transport/interface/connector.d.ts.map +0 -1
- package/dest/transport/interface/listener.d.ts +0 -13
- package/dest/transport/interface/listener.d.ts.map +0 -1
- package/dest/transport/interface/socket.d.ts +0 -13
- package/dest/transport/interface/socket.d.ts.map +0 -1
- package/dest/transport/interface/transferable.d.ts +0 -68
- package/dest/transport/interface/transferable.d.ts.map +0 -1
- package/dest/transport/node/index.d.ts +0 -3
- package/dest/transport/node/index.d.ts.map +0 -1
- package/dest/transport/node/node_connector.d.ts +0 -28
- package/dest/transport/node/node_connector.d.ts.map +0 -1
- package/dest/transport/node/node_connector_socket.d.ts +0 -42
- package/dest/transport/node/node_connector_socket.d.ts.map +0 -1
- package/dest/transport/node/node_listener.d.ts +0 -26
- package/dest/transport/node/node_listener.d.ts.map +0 -1
- package/dest/transport/node/node_listener_socket.d.ts +0 -37
- package/dest/transport/node/node_listener_socket.d.ts.map +0 -1
- package/dest/transport/transport_client.d.ts +0 -61
- package/dest/transport/transport_client.d.ts.map +0 -1
- package/dest/transport/transport_server.d.ts +0 -56
- package/dest/transport/transport_server.d.ts.map +0 -1
- package/dest/trees/index.d.ts +0 -59
- package/dest/trees/index.d.ts.map +0 -1
- package/dest/trees/unbalanced_merkle_tree.d.ts +0 -17
- package/dest/trees/unbalanced_merkle_tree.d.ts.map +0 -1
- package/dest/trees/unbalanced_tree_store.d.ts +0 -19
- package/dest/trees/unbalanced_tree_store.d.ts.map +0 -1
- package/dest/types/index.d.ts +0 -19
- package/dest/types/index.d.ts.map +0 -1
- package/dest/url/index.d.ts +0 -9
- package/dest/url/index.d.ts.map +0 -1
- package/dest/validation/index.d.ts +0 -9
- package/dest/validation/index.d.ts.map +0 -1
- package/dest/wasm/empty_wasi_sdk.d.ts +0 -130
- package/dest/wasm/empty_wasi_sdk.d.ts.map +0 -1
- package/dest/wasm/index.d.ts +0 -2
- package/dest/wasm/index.d.ts.map +0 -1
- package/dest/wasm/wasm_module.d.ts +0 -136
- package/dest/wasm/wasm_module.d.ts.map +0 -1
- package/dest/worker/browser/index.d.ts +0 -3
- package/dest/worker/browser/index.d.ts.map +0 -1
- package/dest/worker/browser/start_web_module.d.ts +0 -7
- package/dest/worker/browser/start_web_module.d.ts.map +0 -1
- package/dest/worker/browser/web_data_store.d.ts +0 -24
- package/dest/worker/browser/web_data_store.d.ts.map +0 -1
- package/dest/worker/browser/web_worker.d.ts +0 -10
- package/dest/worker/browser/web_worker.d.ts.map +0 -1
- package/dest/worker/data_store.d.ts +0 -21
- package/dest/worker/data_store.d.ts.map +0 -1
- package/dest/worker/index.d.ts +0 -3
- package/dest/worker/index.d.ts.map +0 -1
- package/dest/worker/node/index.d.ts +0 -3
- package/dest/worker/node/index.d.ts.map +0 -1
- package/dest/worker/node/node_data_store.d.ts +0 -13
- package/dest/worker/node/node_data_store.d.ts.map +0 -1
- package/dest/worker/node/node_worker.d.ts +0 -6
- package/dest/worker/node/node_worker.d.ts.map +0 -1
- package/dest/worker/node/start_node_module.d.ts +0 -7
- package/dest/worker/node/start_node_module.d.ts.map +0 -1
- package/dest/worker/wasm_worker.d.ts +0 -9
- package/dest/worker/wasm_worker.d.ts.map +0 -1
- package/dest/worker/worker_pool.d.ts +0 -40
- package/dest/worker/worker_pool.d.ts.map +0 -1
- package/src/blob/blob.ts +0 -311
- package/src/blob/encoding.ts +0 -98
- package/src/blob/errors.ts +0 -6
- package/src/blob/index.ts +0 -22
- package/src/blob/interface.ts +0 -11
- package/src/blob/mocks.ts +0 -48
package/dest/retry/index.d.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** An error that indicates that the operation should not be retried. */
|
|
2
|
-
export declare class NoRetryError extends Error {
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* Generates a backoff sequence for retrying operations with an increasing delay.
|
|
6
|
-
* The backoff sequence follows this pattern: 1, 1, 1, 2, 4, 8, 16, 32, 64, ...
|
|
7
|
-
* This generator can be used in combination with the `retry` function to perform
|
|
8
|
-
* retries with exponential backoff and capped at 64 seconds between attempts.
|
|
9
|
-
*
|
|
10
|
-
* @returns A generator that yields the next backoff value in seconds as an integer.
|
|
11
|
-
*/
|
|
12
|
-
export declare function backoffGenerator(): Generator<number, void, unknown>;
|
|
13
|
-
/**
|
|
14
|
-
* Generates a backoff sequence based on the array of retry intervals to use with the `retry` function.
|
|
15
|
-
* @param retries - Intervals to retry (in seconds).
|
|
16
|
-
* @returns A generator sequence.
|
|
17
|
-
*/
|
|
18
|
-
export declare function makeBackoff(retries: number[]): Generator<number, void, unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Retry a given asynchronous function with a specific backoff strategy, until it succeeds or backoff generator ends.
|
|
21
|
-
* It logs the error and retry interval in case an error is caught. The function can be named for better log output.
|
|
22
|
-
*
|
|
23
|
-
* @param fn - The asynchronous function to be retried.
|
|
24
|
-
* @param name - The optional name of the operation, used for logging purposes.
|
|
25
|
-
* @param backoff - The optional backoff generator providing the intervals in seconds between retries. Defaults to a predefined series.
|
|
26
|
-
* @param log - Logger to use for logging.
|
|
27
|
-
* @param failSilently - Do not log errors while retrying.
|
|
28
|
-
* @returns A Promise that resolves with the successful result of the provided function, or rejects if backoff generator ends.
|
|
29
|
-
* @throws If `NoRetryError` is thrown by the `fn`, it is rethrown.
|
|
30
|
-
*/
|
|
31
|
-
export declare function retry<Result>(fn: () => Promise<Result>, name?: string, backoff?: Generator<number, void, unknown>, log?: import("../log/pino-logger.js").Logger, failSilently?: boolean): Promise<Result>;
|
|
32
|
-
/**
|
|
33
|
-
* Retry an asynchronous function until it returns a truthy value or the specified timeout is exceeded.
|
|
34
|
-
* The function is retried periodically with a fixed interval between attempts. The operation can be named for better error messages.
|
|
35
|
-
* Will never timeout if the value is 0.
|
|
36
|
-
*
|
|
37
|
-
* @param fn - The asynchronous function to be retried, which should return a truthy value upon success or undefined otherwise.
|
|
38
|
-
* @param name - The optional name of the operation, used for generating timeout error message.
|
|
39
|
-
* @param timeout - The optional maximum time, in seconds, to keep retrying before throwing a timeout error. Defaults to 0 (never timeout).
|
|
40
|
-
* @param interval - The optional interval, in seconds, between retry attempts. Defaults to 1 second.
|
|
41
|
-
* @returns A Promise that resolves with the successful (truthy) result of the provided function, or rejects if timeout is exceeded.
|
|
42
|
-
*/
|
|
43
|
-
export declare function retryUntil<T>(fn: () => Promise<T | undefined>, name?: string, timeout?: number, interval?: number): Promise<NonNullable<Awaited<T>>>;
|
|
44
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/retry/index.ts"],"names":[],"mappings":"AAKA,wEAAwE;AACxE,qBAAa,YAAa,SAAQ,KAAK;CAAG;AAE1C;;;;;;;GAOG;AACH,wBAAiB,gBAAgB,qCAMhC;AAED;;;;GAIG;AACH,wBAAiB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,oCAI7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAChC,EAAE,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACzB,IAAI,SAAc,EAClB,OAAO,mCAAqB,EAC5B,GAAG,yCAAmC,EACtC,YAAY,UAAQ,mBAoBrB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,EAAE,IAAI,SAAK,EAAE,OAAO,SAAI,EAAE,QAAQ,SAAI,oCAczG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/running-promise/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAC"}
|
package/dest/schemas/api.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type z } from 'zod';
|
|
2
|
-
import { type ZodNullableOptional } from './utils.js';
|
|
3
|
-
type ZodParameterTypeFor<T> = undefined extends T ? ZodNullableOptional<z.ZodType<T, z.ZodTypeDef, any>> : z.ZodType<T, z.ZodTypeDef, any>;
|
|
4
|
-
type ZodReturnTypeFor<T> = z.ZodType<T, z.ZodTypeDef, any>;
|
|
5
|
-
type ZodMapParameterTypes<T> = T extends [] ? [] : T extends [item: infer Head, ...infer Rest] ? [ZodParameterTypeFor<Head>, ...{
|
|
6
|
-
[K in keyof Rest]: ZodParameterTypeFor<Rest[K]>;
|
|
7
|
-
}] : T extends [item?: infer Head, ...infer Rest] ? [ZodNullableOptional<ZodParameterTypeFor<Head>>, ...{
|
|
8
|
-
[K in keyof Rest]: ZodParameterTypeFor<Rest[K]>;
|
|
9
|
-
}] : never;
|
|
10
|
-
/** Maps all functions in an interface to their schema representation. */
|
|
11
|
-
export type ApiSchemaFor<T> = {
|
|
12
|
-
[K in keyof T]: T[K] extends (...args: infer Args) => Promise<infer Ret> ? z.ZodFunction<z.ZodTuple<ZodMapParameterTypes<Args>, z.ZodUnknown>, ZodReturnTypeFor<Ret>> : never;
|
|
13
|
-
};
|
|
14
|
-
/** Generic Api schema not bounded to a specific implementation. */
|
|
15
|
-
export type ApiSchema = {
|
|
16
|
-
[key: string]: z.ZodFunction<z.ZodTuple<any, any>, z.ZodTypeAny>;
|
|
17
|
-
};
|
|
18
|
-
/** Return whether an API schema defines a valid function schema for a given method name. */
|
|
19
|
-
export declare function schemaHasMethod(schema: ApiSchema, methodName: string): boolean;
|
|
20
|
-
export {};
|
|
21
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/schemas/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD,KAAK,mBAAmB,CAAC,CAAC,IAAI,SAAS,SAAS,CAAC,GAC7C,mBAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,GACpD,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAEpC,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAS3D,KAAK,oBAAoB,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,GACvC,EAAE,GACF,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAC3C,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,GACnF,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAC5C,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC,GACxG,KAAK,CAAC;AAEV,yEAAyE;AACzE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC,GACpE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAC1F,KAAK;CACV,CAAC;AAEF,mEAAmE;AACnE,MAAM,MAAM,SAAS,GAAG;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;CAClE,CAAC;AAEF,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAOpE"}
|
package/dest/schemas/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC"}
|
package/dest/schemas/parse.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
/** Parses the given arguments using a tuple from the provided schemas. */
|
|
3
|
-
export declare function parse<T extends [] | [z.ZodTypeAny, ...z.ZodTypeAny[]]>(args: IArguments, ...schemas: T): z.AssertArray<{ [k in keyof T]: T[k] extends z.ZodType<any, any, any> ? T[k]["_output"] : never; }>;
|
|
4
|
-
/**
|
|
5
|
-
* Parses the given arguments against a tuple, allowing empty for optional items.
|
|
6
|
-
* @dev Zod doesn't like tuplues with optional items. See https://github.com/colinhacks/zod/discussions/949.
|
|
7
|
-
*/
|
|
8
|
-
export declare function parseWithOptionals<T extends z.AnyZodTuple>(args: any[], schema: T): Promise<T['_output']>;
|
|
9
|
-
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/schemas/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAAC,uGAEtG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAMzG"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { type AbiDecoded } from '../abi/decoder.js';
|
|
5
|
-
import { EventSelector } from '../abi/event_selector.js';
|
|
6
|
-
import { FunctionSelector } from '../abi/function_selector.js';
|
|
7
|
-
import { NoteSelector } from '../abi/note_selector.js';
|
|
8
|
-
import { AztecAddress } from '../aztec-address/index.js';
|
|
9
|
-
import { Buffer32 } from '../buffer/buffer32.js';
|
|
10
|
-
import { EthAddress } from '../eth-address/index.js';
|
|
11
|
-
import { Fq, Fr } from '../fields/fields.js';
|
|
12
|
-
import { Point } from '../fields/point.js';
|
|
13
|
-
import { type ZodFor } from './types.js';
|
|
14
|
-
/** Validation schemas for common types. Every schema must match its toJSON. */
|
|
15
|
-
export declare const schemas: {
|
|
16
|
-
/** Accepts a hex string. */
|
|
17
|
-
EthAddress: z.ZodType<EthAddress, any, string>;
|
|
18
|
-
/** Accepts a hex string. */
|
|
19
|
-
AztecAddress: z.ZodType<AztecAddress, any, string>;
|
|
20
|
-
/** Accepts a hex string. */
|
|
21
|
-
FunctionSelector: z.ZodType<FunctionSelector, any, string>;
|
|
22
|
-
/** Accepts a hex string. */
|
|
23
|
-
NoteSelector: z.ZodType<NoteSelector, any, string>;
|
|
24
|
-
/** Accepts a hex string. */
|
|
25
|
-
EventSelector: z.ZodType<EventSelector, any, string>;
|
|
26
|
-
/** Accepts a hex string. */
|
|
27
|
-
Fr: z.ZodType<Fr, any, string>;
|
|
28
|
-
/** Accepts a hex string. */
|
|
29
|
-
Fq: z.ZodType<Fq, any, string>;
|
|
30
|
-
/** Point. Serialized as a hex string. */
|
|
31
|
-
Point: z.ZodType<Point, any, string>;
|
|
32
|
-
/** Coerces any input to bigint. */
|
|
33
|
-
BigInt: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodBigInt>;
|
|
34
|
-
/** Coerces any input to integer number. */
|
|
35
|
-
Integer: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
36
|
-
/** Coerces input to UInt32. */
|
|
37
|
-
UInt32: z.ZodPipeline<z.ZodUnion<[z.ZodBigInt, z.ZodNumber, z.ZodString]>, z.ZodNumber>;
|
|
38
|
-
/** Accepts a hex string as a Buffer32 type. */
|
|
39
|
-
Buffer32: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer32, string>;
|
|
40
|
-
/** Accepts a base64 string or an object `{ type: 'Buffer', data: [byte, byte...] }` as a buffer. */
|
|
41
|
-
Buffer: z.ZodUnion<[z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer, string>, z.ZodEffects<z.ZodObject<{
|
|
42
|
-
type: z.ZodLiteral<"Buffer">;
|
|
43
|
-
data: z.ZodArray<z.ZodNumber, "many">;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
type: "Buffer";
|
|
46
|
-
data: number[];
|
|
47
|
-
}, {
|
|
48
|
-
type: "Buffer";
|
|
49
|
-
data: number[];
|
|
50
|
-
}>, Buffer, {
|
|
51
|
-
type: "Buffer";
|
|
52
|
-
data: number[];
|
|
53
|
-
}>]>;
|
|
54
|
-
/** Accepts a hex string as a buffer. */
|
|
55
|
-
BufferHex: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>, Buffer, string>;
|
|
56
|
-
/** Hex string with an optional 0x prefix which gets removed as part of the parsing. */
|
|
57
|
-
HexString: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
58
|
-
};
|
|
59
|
-
export declare const AbiDecodedSchema: ZodFor<AbiDecoded>;
|
|
60
|
-
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/schemas.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,+EAA+E;AAC/E,eAAO,MAAM,OAAO;IAClB,4BAA4B;;IAG5B,4BAA4B;;IAG5B,4BAA4B;;IAG5B,4BAA4B;;IAG5B,4BAA4B;;IAG5B,4BAA4B;;IAG5B,4BAA4B;;IAG5B,yCAAyC;;IAGzC,mCAAmC;;IAGnC,2CAA2C;;IAG3C,+BAA+B;;IAS/B,+CAA+C;;IAG/C,oGAAoG;;;;;;;;;;;;;;IAWpG,wCAAwC;;IAOxC,uFAAuF;;CAExF,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,UAAU,CAM9C,CAAC"}
|
package/dest/schemas/types.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schemas/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC"}
|
package/dest/schemas/utils.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { type ParseInput, type ParseReturnType, type ZodObject, ZodOptional, type ZodRawShape, type ZodType, type ZodTypeAny, z } from 'zod';
|
|
4
|
-
import { type ZodFor } from './types.js';
|
|
5
|
-
export declare const hexSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
6
|
-
/** Schema for a buffer represented as a base64 string. */
|
|
7
|
-
export declare const bufferSchema: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, Buffer, string>;
|
|
8
|
-
export declare class ZodNullableOptional<T extends ZodTypeAny> extends ZodOptional<T> {
|
|
9
|
-
_isNullableOptional: boolean;
|
|
10
|
-
_parse(input: ParseInput): ParseReturnType<this['_output']>;
|
|
11
|
-
static create<T extends ZodTypeAny>(type: T): ZodNullableOptional<T>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Declares a parameter as optional. Use this over z.optional in order to accept nulls as undefineds.
|
|
15
|
-
* This is required as JSON does not have an undefined type, and null is used to represent it, so we
|
|
16
|
-
* need to convert nulls to undefineds as we parse.
|
|
17
|
-
*/
|
|
18
|
-
export declare function optional<T extends ZodTypeAny>(schema: T): ZodNullableOptional<T>;
|
|
19
|
-
type ToJsonIs<T, TRet> = T extends {
|
|
20
|
-
toJSON(): TRet;
|
|
21
|
-
} ? T : never;
|
|
22
|
-
/**
|
|
23
|
-
* Creates a schema that accepts a hex string and uses it to hydrate an instance.
|
|
24
|
-
* @param klazz - Class that implements either fromString or fromBuffer.
|
|
25
|
-
* @returns A schema for the class.
|
|
26
|
-
*/
|
|
27
|
-
export declare function hexSchemaFor<TClass extends {
|
|
28
|
-
fromString(str: string): any;
|
|
29
|
-
} | {
|
|
30
|
-
fromBuffer(buf: Buffer): any;
|
|
31
|
-
}>(klazz: TClass, refinement?: (input: string) => boolean): ZodType<TClass extends {
|
|
32
|
-
fromString(str: string): infer TInstance;
|
|
33
|
-
} | {
|
|
34
|
-
fromBuffer(buf: Buffer): infer TInstance;
|
|
35
|
-
} ? ToJsonIs<TInstance, string> : never, any, string>;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a schema that accepts a base64 string and uses it to hydrate an instance.
|
|
38
|
-
* @param klazz - Class that implements fromBuffer.
|
|
39
|
-
* @returns A schema for the class.
|
|
40
|
-
*/
|
|
41
|
-
export declare function bufferSchemaFor<TClass extends {
|
|
42
|
-
fromBuffer(buf: Buffer): any;
|
|
43
|
-
}>(klazz: TClass): ZodType<TClass extends {
|
|
44
|
-
fromBuffer(buf: Buffer): infer TInstance;
|
|
45
|
-
} ? ToJsonIs<TInstance, Buffer> : never, any, string>;
|
|
46
|
-
/** Creates a schema for a js Map type that matches the serialization used in jsonStringify. */
|
|
47
|
-
export declare function mapSchema<TKey, TValue>(key: ZodFor<TKey>, value: ZodFor<TValue>): ZodFor<Map<TKey, TValue>>;
|
|
48
|
-
/** Creates a schema for a js Set type that matches the serialization used in jsonStringify. */
|
|
49
|
-
export declare function setSchema<T>(value: ZodFor<T>): ZodFor<Set<T>>;
|
|
50
|
-
/** Given an already parsed and validated object, extracts the keys defined in the given schema. Does not validate again. */
|
|
51
|
-
export declare function pickFromSchema<T extends object, S extends ZodObject<ZodRawShape>>(obj: T, schema: S): Partial<T>;
|
|
52
|
-
export {};
|
|
53
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/schemas/utils.ts"],"names":[],"mappings":";;AAAA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,eAAe,EAEpB,KAAK,SAAS,EACd,WAAW,EAEX,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,CAAC,EACF,MAAM,KAAK,CAAC;AAIb,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AAEzC,eAAO,MAAM,SAAS,yEAAiF,CAAC;AAKxG,0DAA0D;AAC1D,eAAO,MAAM,YAAY,yEAKwB,CAAC;AAElD,qBAAa,mBAAmB,CAAC,CAAC,SAAS,UAAU,CAAE,SAAQ,WAAW,CAAC,CAAC,CAAC;IAC3E,mBAAmB,UAAQ;IAElB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,eAAe,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;WAQpD,MAAM,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAM9E;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,CAAC,0BAEvD;AAED,KAAK,QAAQ,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS;IAAE,MAAM,IAAI,IAAI,CAAA;CAAE,GAAG,CAAC,GAAG,KAAK,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,SAAS;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAAG;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7G,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GACtC,OAAO,CACR,MAAM,SAAS;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,SAAS,CAAA;CAAE,GAAG;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,SAAS,CAAA;CAAE,GACtG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,GAC3B,KAAK,EACT,GAAG,EACH,MAAM,CACP,CAMA;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,SAAS;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC7E,KAAK,EAAE,MAAM,GACZ,OAAO,CACR,MAAM,SAAS;IAAE,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,SAAS,CAAA;CAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,GAAG,KAAK,EACjG,GAAG,EACH,MAAM,CACP,CAEA;AAED,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAE3G;AAED,+FAA+F;AAC/F,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAE7D;AAED,4HAA4H;AAC5H,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,SAAS,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,cAEnG"}
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { type Tuple } from './types.js';
|
|
4
|
-
/**
|
|
5
|
-
* The BufferReader class provides a utility for reading various data types from a buffer.
|
|
6
|
-
* It supports reading numbers, booleans, byte arrays, Fr and Fq field elements,
|
|
7
|
-
* vectors, arrays, objects, strings, and maps. It maintains an internal index to
|
|
8
|
-
* keep track of the current reading position in the buffer.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* Create a new instance of BufferReader with a buffer and an optional offset.
|
|
12
|
-
* Use the provided methods to read desired data types from the buffer.
|
|
13
|
-
* The reading methods automatically advance the internal index.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* const reader = new BufferReader(someBuffer);
|
|
17
|
-
* const num = reader.readNumber();
|
|
18
|
-
* const bool = reader.readBoolean();
|
|
19
|
-
* const byteArray = reader.readBytes(4);
|
|
20
|
-
*/
|
|
21
|
-
export declare class BufferReader {
|
|
22
|
-
#private;
|
|
23
|
-
private buffer;
|
|
24
|
-
private index;
|
|
25
|
-
constructor(buffer: Buffer, offset?: number);
|
|
26
|
-
/**
|
|
27
|
-
* Creates a BufferReader instance from either a Buffer or an existing BufferReader.
|
|
28
|
-
* If the input is a Buffer, it creates a new BufferReader with the given buffer.
|
|
29
|
-
* If the input is already a BufferReader, it returns the input unchanged.
|
|
30
|
-
*
|
|
31
|
-
* @param bufferOrReader - A Buffer or BufferReader to initialize the BufferReader.
|
|
32
|
-
* @returns An instance of BufferReader.
|
|
33
|
-
*/
|
|
34
|
-
static asReader(bufferOrReader: Uint8Array | Buffer | BufferReader): BufferReader;
|
|
35
|
-
/** Returns true if the underlying buffer has been consumed completely. */
|
|
36
|
-
isEmpty(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Reads a 32-bit unsigned integer from the buffer at the current index position.
|
|
39
|
-
* Updates the index position by 4 bytes after reading the number.
|
|
40
|
-
*
|
|
41
|
-
* @returns The read 32-bit unsigned integer value.
|
|
42
|
-
*/
|
|
43
|
-
readNumber(): number;
|
|
44
|
-
/**
|
|
45
|
-
* Reads `count` 32-bit unsigned integers from the buffer at the current index position.
|
|
46
|
-
* @param count - The number of 32-bit unsigned integers to read.
|
|
47
|
-
* @returns An array of 32-bit unsigned integers.
|
|
48
|
-
*/
|
|
49
|
-
readNumbers<N extends number>(count: N): Tuple<number, N>;
|
|
50
|
-
/**
|
|
51
|
-
* Reads a 256-bit unsigned integer from the buffer at the current index position.
|
|
52
|
-
* Updates the index position by 32 bytes after reading the number.
|
|
53
|
-
*
|
|
54
|
-
* Assumes the number is stored in big-endian format.
|
|
55
|
-
*
|
|
56
|
-
* @returns The read 256 bit value as a bigint.
|
|
57
|
-
*/
|
|
58
|
-
readUInt256(): bigint;
|
|
59
|
-
/**
|
|
60
|
-
* Reads a 16-bit unsigned integer from the buffer at the current index position.
|
|
61
|
-
* Updates the index position by 2 bytes after reading the number.
|
|
62
|
-
*
|
|
63
|
-
* @returns The read 16 bit value.
|
|
64
|
-
*/
|
|
65
|
-
readUInt16(): number;
|
|
66
|
-
/**
|
|
67
|
-
* Reads a 8-bit unsigned integer from the buffer at the current index position.
|
|
68
|
-
* Updates the index position by 1 byte after reading the number.
|
|
69
|
-
*
|
|
70
|
-
* @returns The read 8 bit value.
|
|
71
|
-
*/
|
|
72
|
-
readUInt8(): number;
|
|
73
|
-
/**
|
|
74
|
-
* Reads and returns the next boolean value from the buffer.
|
|
75
|
-
* Advances the internal index by 1, treating the byte at the current index as a boolean value.
|
|
76
|
-
* Returns true if the byte is non-zero, false otherwise.
|
|
77
|
-
*
|
|
78
|
-
* @returns A boolean value representing the byte at the current index.
|
|
79
|
-
*/
|
|
80
|
-
readBoolean(): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Reads a specified number of bytes from the buffer and returns a new Buffer containing those bytes.
|
|
83
|
-
* Advances the reader's index by the number of bytes read. Throws an error if there are not enough
|
|
84
|
-
* bytes left in the buffer to satisfy the requested number of bytes.
|
|
85
|
-
*
|
|
86
|
-
* @param n - The number of bytes to read from the buffer.
|
|
87
|
-
* @returns A new Buffer containing the read bytes.
|
|
88
|
-
*/
|
|
89
|
-
readBytes(n: number): Buffer;
|
|
90
|
-
/** Reads until the end of the buffer. */
|
|
91
|
-
readToEnd(): Buffer;
|
|
92
|
-
/**
|
|
93
|
-
* Reads a vector of numbers from the buffer and returns it as an array of numbers.
|
|
94
|
-
* The method utilizes the 'readVector' method, passing a deserializer that reads numbers.
|
|
95
|
-
*
|
|
96
|
-
* @returns An array of numbers representing the vector read from the buffer.
|
|
97
|
-
*/
|
|
98
|
-
readNumberVector(): number[];
|
|
99
|
-
/**
|
|
100
|
-
* Reads a vector of fixed size from the buffer and deserializes its elements using the provided itemDeserializer object.
|
|
101
|
-
* The 'itemDeserializer' object should have a 'fromBuffer' method that takes a BufferReader instance and returns the deserialized element.
|
|
102
|
-
* The method first reads the size of the vector (a number) from the buffer, then iterates through its elements,
|
|
103
|
-
* deserializing each one using the 'fromBuffer' method of 'itemDeserializer'.
|
|
104
|
-
*
|
|
105
|
-
* @param itemDeserializer - Object with 'fromBuffer' method to deserialize vector elements.
|
|
106
|
-
* @returns An array of deserialized elements of type T.
|
|
107
|
-
*/
|
|
108
|
-
readVector<T>(itemDeserializer: {
|
|
109
|
-
/**
|
|
110
|
-
* A method to deserialize data from a buffer.
|
|
111
|
-
*/
|
|
112
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
113
|
-
}): T[];
|
|
114
|
-
/**
|
|
115
|
-
* Reads a vector of fixed size from the buffer and deserializes its elements using the provided itemDeserializer object.
|
|
116
|
-
* The 'itemDeserializer' object should have a 'fromBuffer' method that takes a BufferReader instance and returns the deserialized element.
|
|
117
|
-
* The method first reads the size of the vector (a number) from the buffer, then iterates through its elements,
|
|
118
|
-
* deserializing each one using the 'fromBuffer' method of 'itemDeserializer'.
|
|
119
|
-
*
|
|
120
|
-
* @param itemDeserializer - Object with 'fromBuffer' method to deserialize vector elements.
|
|
121
|
-
* @returns An array of deserialized elements of type T.
|
|
122
|
-
*/
|
|
123
|
-
readVectorUint8Prefix<T>(itemDeserializer: {
|
|
124
|
-
/**
|
|
125
|
-
* A method to deserialize data from a buffer.
|
|
126
|
-
*/
|
|
127
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
128
|
-
}): T[];
|
|
129
|
-
/**
|
|
130
|
-
* Read an array of a fixed size with elements of type T from the buffer.
|
|
131
|
-
* The 'itemDeserializer' object should have a 'fromBuffer' method that takes a BufferReader instance as input,
|
|
132
|
-
* and returns an instance of the desired deserialized data type T.
|
|
133
|
-
* This method will call the 'fromBuffer' method for each element in the array and return the resulting array.
|
|
134
|
-
*
|
|
135
|
-
* @param size - The fixed number of elements in the array.
|
|
136
|
-
* @param itemDeserializer - An object with a 'fromBuffer' method to deserialize individual elements of type T.
|
|
137
|
-
* @returns An array of instances of type T.
|
|
138
|
-
*/
|
|
139
|
-
readArray<T, N extends number>(size: N, itemDeserializer: {
|
|
140
|
-
/**
|
|
141
|
-
* A function for deserializing data from a BufferReader instance.
|
|
142
|
-
*/
|
|
143
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
144
|
-
}): Tuple<T, N>;
|
|
145
|
-
/**
|
|
146
|
-
* Read a variable sized Buffer array where elements are represented by length + data.
|
|
147
|
-
* The method consecutively looks for a number which is the size of the proceeding buffer,
|
|
148
|
-
* then reads the bytes until it reaches the end of the reader's internal buffer.
|
|
149
|
-
* NOTE: if `size` is not provided, this will run to the end of the reader's buffer.
|
|
150
|
-
* @param size - Size of the buffer array in bytes (full remaining buffer length if left empty).
|
|
151
|
-
* @returns An array of variable sized buffers.
|
|
152
|
-
*/
|
|
153
|
-
readBufferArray(size?: number): Buffer[];
|
|
154
|
-
/**
|
|
155
|
-
* Reads a serialized object from a buffer and returns the deserialized object using the given deserializer.
|
|
156
|
-
*
|
|
157
|
-
* @typeparam T - The type of the deserialized object.
|
|
158
|
-
* @param deserializer - An object with a 'fromBuffer' method that takes a BufferReader instance and returns an instance of the deserialized object.
|
|
159
|
-
* @returns The deserialized object of type T.
|
|
160
|
-
*/
|
|
161
|
-
readObject<T>(deserializer: {
|
|
162
|
-
/**
|
|
163
|
-
* A method that takes a BufferReader instance and returns an instance of the deserialized data type.
|
|
164
|
-
*/
|
|
165
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
166
|
-
}): T;
|
|
167
|
-
/**
|
|
168
|
-
* Returns a Buffer containing the next n bytes from the current buffer without modifying the reader's index position.
|
|
169
|
-
* If n is not provided or exceeds the remaining length of the buffer, it returns all bytes from the current position till the end of the buffer.
|
|
170
|
-
*
|
|
171
|
-
* @param n - The number of bytes to peek from the current buffer. (Optional).
|
|
172
|
-
* @returns A Buffer with the next n bytes or the remaining bytes if n is not provided or exceeds the buffer length.
|
|
173
|
-
*/
|
|
174
|
-
peekBytes(n?: number): Buffer;
|
|
175
|
-
/**
|
|
176
|
-
* Reads a string from the buffer and returns it.
|
|
177
|
-
* The method first reads the size of the string, then reads the corresponding
|
|
178
|
-
* number of bytes from the buffer and converts them to a string.
|
|
179
|
-
*
|
|
180
|
-
* @returns The read string from the buffer.
|
|
181
|
-
*/
|
|
182
|
-
readString(): string;
|
|
183
|
-
/**
|
|
184
|
-
* Reads a buffer from the current position of the reader and advances the index.
|
|
185
|
-
* The method first reads the size (number) of bytes to be read, and then returns
|
|
186
|
-
* a Buffer with that size containing the bytes. Useful for reading variable-length
|
|
187
|
-
* binary data encoded as (size, data) format.
|
|
188
|
-
*
|
|
189
|
-
* @returns A Buffer containing the read bytes.
|
|
190
|
-
*/
|
|
191
|
-
readBuffer(): Buffer;
|
|
192
|
-
/**
|
|
193
|
-
* Reads a buffer from the current position of the reader and advances the index.
|
|
194
|
-
* The method first reads the size (number) of bytes to be read, and then returns
|
|
195
|
-
* a Buffer with that size containing the bytes. Useful for reading variable-length
|
|
196
|
-
* binary data encoded as (size, data) format.
|
|
197
|
-
*
|
|
198
|
-
* @returns A Buffer containing the read bytes.
|
|
199
|
-
*/
|
|
200
|
-
readUint8Array(): Uint8Array;
|
|
201
|
-
/**
|
|
202
|
-
* Reads and constructs a map object from the current buffer using the provided deserializer.
|
|
203
|
-
* The method reads the number of entries in the map, followed by iterating through each key-value pair.
|
|
204
|
-
* The key is read as a string, while the value is obtained using the passed deserializer's `fromBuffer` method.
|
|
205
|
-
* The resulting map object is returned, containing all the key-value pairs read from the buffer.
|
|
206
|
-
*
|
|
207
|
-
* @param deserializer - An object with a `fromBuffer` method to deserialize the values in the map.
|
|
208
|
-
* @returns A map object with string keys and deserialized values based on the provided deserializer.
|
|
209
|
-
*/
|
|
210
|
-
readMap<T>(deserializer: {
|
|
211
|
-
/**
|
|
212
|
-
* Deserializes an element of type T from a BufferReader instance.
|
|
213
|
-
*/
|
|
214
|
-
fromBuffer: (reader: BufferReader) => T;
|
|
215
|
-
}): {
|
|
216
|
-
[key: string]: T;
|
|
217
|
-
};
|
|
218
|
-
/**
|
|
219
|
-
* Get the length of the reader's buffer.
|
|
220
|
-
* @returns The length of the underlying reader's buffer.
|
|
221
|
-
*/
|
|
222
|
-
getLength(): number;
|
|
223
|
-
/**
|
|
224
|
-
* Gets bytes remaining to be read from the buffer.
|
|
225
|
-
* @returns Bytes remaining to be read from the buffer.
|
|
226
|
-
*/
|
|
227
|
-
remainingBytes(): number;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* A deserializer
|
|
231
|
-
*/
|
|
232
|
-
export interface FromBuffer<T> {
|
|
233
|
-
/**
|
|
234
|
-
* Deserializes an object from a buffer
|
|
235
|
-
* @param buffer - The buffer to deserialize.
|
|
236
|
-
*/
|
|
237
|
-
fromBuffer(buffer: Buffer): T;
|
|
238
|
-
}
|
|
239
|
-
//# sourceMappingURL=buffer_reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buffer_reader.d.ts","sourceRoot":"","sources":["../../src/serialize/buffer_reader.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,YAAY;;IAEX,OAAO,CAAC,MAAM;IAD1B,OAAO,CAAC,KAAK,CAAS;gBACF,MAAM,EAAE,MAAM,EAAE,MAAM,SAAI;IAI9C;;;;;;;OAOG;WACW,QAAQ,CAAC,cAAc,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY;IAYxF,0EAA0E;IACnE,OAAO,IAAI,OAAO;IAIzB;;;;;OAKG;IACI,UAAU,IAAI,MAAM;IAM3B;;;;OAIG;IACI,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAKhE;;;;;;;OAOG;IACI,WAAW,IAAI,MAAM;IAY5B;;;;;OAKG;IACI,UAAU,IAAI,MAAM;IAM3B;;;;;OAKG;IACI,SAAS,IAAI,MAAM;IAM1B;;;;;;OAMG;IACI,WAAW,IAAI,OAAO;IAM7B;;;;;;;OAOG;IACI,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAMnC,yCAAyC;IAClC,SAAS,IAAI,MAAM;IAM1B;;;;;OAKG;IACI,gBAAgB,IAAI,MAAM,EAAE;IAMnC;;;;;;;;OAQG;IACI,UAAU,CAAC,CAAC,EAAE,gBAAgB,EAAE;QACrC;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,GAAG,CAAC,EAAE;IASP;;;;;;;;OAQG;IACI,qBAAqB,CAAC,CAAC,EAAE,gBAAgB,EAAE;QAChD;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,GAAG,CAAC,EAAE;IASP;;;;;;;;;OASG;IACI,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAClC,IAAI,EAAE,CAAC,EACP,gBAAgB,EAAE;QAChB;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,GACA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAKd;;;;;;;OAOG;IACI,eAAe,CAAC,IAAI,SAAK,GAAG,MAAM,EAAE;IAiB3C;;;;;;OAMG;IACI,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE;QACjC;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,GAAG,CAAC;IAIL;;;;;;OAMG;IACI,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM;IAKpC;;;;;;OAMG;IACI,UAAU,IAAI,MAAM;IAI3B;;;;;;;OAOG;IACI,UAAU,IAAI,MAAM;IAM3B;;;;;;;OAOG;IACI,cAAc,IAAI,UAAU;IAMnC;;;;;;;;OAQG;IACI,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE;QAC9B;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,YAAY,KAAK,CAAC,CAAC;KACzC,GAAG;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,CAAA;KAAE;IAWxB;;;OAGG;IACI,SAAS,IAAI,MAAM;IAI1B;;;OAGG;IACI,cAAc,IAAI,MAAM;CAWhC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;CAC/B"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Fq, type Fr } from '../fields/fields.js';
|
|
2
|
-
import { type Tuple } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* The FieldReader class provides a utility for reading various data types from a field array.
|
|
5
|
-
*
|
|
6
|
-
* Usage:
|
|
7
|
-
* Create a new instance of FieldReader with an array of fields and an optional offset.
|
|
8
|
-
* Use the provided methods to read desired data types from the field array.
|
|
9
|
-
* The reading methods automatically advance the internal index.
|
|
10
|
-
*/
|
|
11
|
-
export declare class FieldReader {
|
|
12
|
-
private fields;
|
|
13
|
-
private index;
|
|
14
|
-
private length;
|
|
15
|
-
constructor(fields: Fr[], offset?: number);
|
|
16
|
-
/**
|
|
17
|
-
* Creates a FieldReader instance from either a field array or an existing FieldReader.
|
|
18
|
-
*
|
|
19
|
-
* @param fields - A field array or FieldReader to initialize the FieldReader.
|
|
20
|
-
* @returns An instance of FieldReader.
|
|
21
|
-
*/
|
|
22
|
-
static asReader(fields: Fr[] | FieldReader): FieldReader;
|
|
23
|
-
/**
|
|
24
|
-
* Skips the next n fields.
|
|
25
|
-
*
|
|
26
|
-
* @param n - The number of fields to skip.
|
|
27
|
-
*/
|
|
28
|
-
skip(n: number): void;
|
|
29
|
-
/**
|
|
30
|
-
* Returns the current cursor position.
|
|
31
|
-
*
|
|
32
|
-
* @returns The current cursor position.
|
|
33
|
-
*/
|
|
34
|
-
get cursor(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Reads a single field from the array.
|
|
37
|
-
*
|
|
38
|
-
* @returns A field.
|
|
39
|
-
*/
|
|
40
|
-
readField(): Fr;
|
|
41
|
-
/**
|
|
42
|
-
* Peeks at the next field without advancing the cursor.
|
|
43
|
-
*
|
|
44
|
-
* @returns A field.
|
|
45
|
-
*/
|
|
46
|
-
peekField(): Fr;
|
|
47
|
-
/**
|
|
48
|
-
* Reads a Fq from the array.
|
|
49
|
-
*
|
|
50
|
-
* @returns An Fq.
|
|
51
|
-
*/
|
|
52
|
-
readFq(): Fq;
|
|
53
|
-
/**
|
|
54
|
-
* Reads and returns the next boolean value from the field array.
|
|
55
|
-
* Advances the internal index by 1, treating the field at the current index as a boolean value.
|
|
56
|
-
* Returns true if the field is non-zero, false otherwise.
|
|
57
|
-
* Throw if the value is not 0 or 1.
|
|
58
|
-
*
|
|
59
|
-
* @returns A boolean value representing the field at the current index.
|
|
60
|
-
*/
|
|
61
|
-
readBoolean(): boolean;
|
|
62
|
-
/**
|
|
63
|
-
* Reads a 32-bit unsigned integer from the field array at the current index position.
|
|
64
|
-
* Updates the index position by 1 after reading the number.
|
|
65
|
-
* Throw if the value is greater than 2 ** 32.
|
|
66
|
-
*
|
|
67
|
-
* @returns The read 32-bit unsigned integer value.
|
|
68
|
-
*/
|
|
69
|
-
readU32(): number;
|
|
70
|
-
/**
|
|
71
|
-
* Read an array of a fixed size field array.
|
|
72
|
-
*
|
|
73
|
-
* @param size - The fixed number of fields in the array.
|
|
74
|
-
* @returns An array of fields.
|
|
75
|
-
*/
|
|
76
|
-
readFieldArray<N extends number>(size: N): Tuple<Fr, N>;
|
|
77
|
-
/**
|
|
78
|
-
* Read an array of a fixed size with elements of type T from the field array.
|
|
79
|
-
* The 'itemDeserializer' object should have a 'fromFields' method that takes a FieldReader instance as input,
|
|
80
|
-
* and returns an instance of the desired deserialized data type T.
|
|
81
|
-
* This method will call the 'fromFields' method for each element in the array and return the resulting array.
|
|
82
|
-
*
|
|
83
|
-
* @param size - The fixed number of elements in the array.
|
|
84
|
-
* @param itemDeserializer - An object with a 'fromFields' method to deserialize individual elements of type T.
|
|
85
|
-
* @returns An array of instances of type T.
|
|
86
|
-
*/
|
|
87
|
-
readArray<T, N extends number>(size: N, itemDeserializer: {
|
|
88
|
-
/**
|
|
89
|
-
* A function for deserializing data from a FieldReader instance.
|
|
90
|
-
*/
|
|
91
|
-
fromFields: (reader: FieldReader) => T;
|
|
92
|
-
}): Tuple<T, N>;
|
|
93
|
-
/**
|
|
94
|
-
* Reads a serialized object from a field array and returns the deserialized object using the given deserializer.
|
|
95
|
-
*
|
|
96
|
-
* @typeparam T - The type of the deserialized object.
|
|
97
|
-
* @param deserializer - An object with a 'fromFields' method that takes a FieldReader instance and returns an instance of the deserialized object.
|
|
98
|
-
* @returns The deserialized object of type T.
|
|
99
|
-
*/
|
|
100
|
-
readObject<T>(deserializer: {
|
|
101
|
-
/**
|
|
102
|
-
* A method that takes a FieldReader instance and returns an instance of the deserialized data type.
|
|
103
|
-
*/
|
|
104
|
-
fromFields: (reader: FieldReader) => T;
|
|
105
|
-
}): T;
|
|
106
|
-
/**
|
|
107
|
-
* Returns whether the reader has finished reading all fields.
|
|
108
|
-
* @returns A bool.
|
|
109
|
-
*/
|
|
110
|
-
isFinished(): boolean;
|
|
111
|
-
}
|
|
112
|
-
//# sourceMappingURL=field_reader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"field_reader.d.ts","sourceRoot":"","sources":["../../src/serialize/field_reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC;;;;;;;GAOG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,MAAM;IAF1B,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAS;gBACH,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,SAAI;IAQ5C;;;;;OAKG;WACW,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,WAAW,GAAG,WAAW;IAQ/D;;;;OAIG;IACI,IAAI,CAAC,CAAC,EAAE,MAAM;IAOrB;;;;OAIG;IACH,IAAW,MAAM,WAEhB;IAED;;;;OAIG;IACI,SAAS,IAAI,EAAE;IAOtB;;;;OAIG;IACI,SAAS,IAAI,EAAE;IAOtB;;;;OAIG;IACI,MAAM,IAAI,EAAE;IAInB;;;;;;;OAOG;IACI,WAAW,IAAI,OAAO;IAS7B;;;;;;OAMG;IACI,OAAO,IAAI,MAAM;IASxB;;;;;OAKG;IACI,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;IAQ9D;;;;;;;;;OASG;IACI,SAAS,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAClC,IAAI,EAAE,CAAC,EACP,gBAAgB,EAAE;QAChB;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC;KACxC,GACA,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAKd;;;;;;OAMG;IACI,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE;QACjC;;WAEG;QACH,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,CAAC,CAAC;KACxC,GAAG,CAAC;IAIL;;;OAGG;IACI,UAAU,IAAI,OAAO;CAG7B"}
|