@aztec/foundation 0.0.0-test.0 → 0.0.1-commit.001888fc
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/array/array.d.ts +6 -9
- package/dest/array/array.d.ts.map +1 -1
- package/dest/array/array.js +11 -11
- package/dest/array/index.d.ts +2 -1
- package/dest/array/index.d.ts.map +1 -1
- package/dest/array/index.js +1 -0
- package/dest/array/sorted_array.d.ts +15 -0
- package/dest/array/sorted_array.d.ts.map +1 -0
- package/dest/array/sorted_array.js +109 -0
- package/dest/async-map/index.d.ts +1 -1
- package/dest/async-pool/index.d.ts +1 -1
- package/dest/async-pool/index.d.ts.map +1 -1
- package/dest/async-pool/index.js +1 -0
- package/dest/bigint/index.d.ts +7 -0
- package/dest/bigint/index.d.ts.map +1 -0
- package/dest/bigint/index.js +15 -0
- package/dest/bigint-buffer/index.d.ts +1 -3
- package/dest/bigint-buffer/index.d.ts.map +1 -1
- package/dest/branded-types/block_number.d.ts +56 -0
- package/dest/branded-types/block_number.d.ts.map +1 -0
- package/dest/branded-types/block_number.js +78 -0
- package/dest/branded-types/checkpoint_number.d.ts +54 -0
- package/dest/branded-types/checkpoint_number.d.ts.map +1 -0
- package/dest/branded-types/checkpoint_number.js +77 -0
- package/dest/branded-types/epoch.d.ts +42 -0
- package/dest/branded-types/epoch.d.ts.map +1 -0
- package/dest/branded-types/epoch.js +59 -0
- package/dest/branded-types/index.d.ts +7 -0
- package/dest/branded-types/index.d.ts.map +1 -0
- package/dest/branded-types/index.js +5 -0
- package/dest/branded-types/index_within_checkpoint.d.ts +42 -0
- package/dest/branded-types/index_within_checkpoint.d.ts.map +1 -0
- package/dest/branded-types/index_within_checkpoint.js +59 -0
- package/dest/branded-types/slot.d.ts +42 -0
- package/dest/branded-types/slot.d.ts.map +1 -0
- package/dest/branded-types/slot.js +59 -0
- package/dest/branded-types/types.d.ts +5 -0
- package/dest/branded-types/types.d.ts.map +1 -0
- package/dest/branded-types/types.js +1 -0
- package/dest/buffer/buffer16.d.ts +80 -0
- package/dest/buffer/buffer16.d.ts.map +1 -0
- package/dest/buffer/buffer16.js +102 -0
- package/dest/buffer/buffer32.d.ts +5 -9
- package/dest/buffer/buffer32.d.ts.map +1 -1
- package/dest/buffer/buffer32.js +9 -7
- package/dest/buffer/index.d.ts +3 -1
- package/dest/buffer/index.d.ts.map +1 -1
- package/dest/buffer/index.js +2 -0
- package/dest/buffer/utils.d.ts +3 -0
- package/dest/buffer/utils.d.ts.map +1 -0
- package/dest/buffer/utils.js +7 -0
- package/dest/collection/array.d.ts +28 -4
- package/dest/collection/array.d.ts.map +1 -1
- package/dest/collection/array.js +108 -3
- package/dest/collection/index.d.ts +1 -1
- package/dest/collection/object.d.ts +17 -1
- package/dest/collection/object.d.ts.map +1 -1
- package/dest/collection/object.js +25 -0
- package/dest/committable/committable.d.ts +1 -1
- package/dest/committable/committable.d.ts.map +1 -1
- package/dest/committable/index.d.ts +1 -1
- package/dest/config/env_var.d.ts +2 -2
- package/dest/config/env_var.d.ts.map +1 -1
- package/dest/config/index.d.ts +62 -4
- package/dest/config/index.d.ts.map +1 -1
- package/dest/config/index.js +158 -12
- package/dest/config/network_config.d.ts +72 -0
- package/dest/config/network_config.d.ts.map +1 -0
- package/dest/config/network_config.js +14 -0
- package/dest/config/network_name.d.ts +3 -0
- package/dest/config/network_name.d.ts.map +1 -0
- package/dest/config/network_name.js +21 -0
- package/dest/config/parse-env.d.ts +3 -0
- package/dest/config/parse-env.d.ts.map +1 -0
- package/dest/config/parse-env.js +7 -0
- package/dest/config/secret_value.d.ts +28 -0
- package/dest/config/secret_value.d.ts.map +1 -0
- package/dest/config/secret_value.js +36 -0
- package/dest/crypto/aes128/index.d.ts +3 -5
- package/dest/crypto/aes128/index.d.ts.map +1 -1
- package/dest/crypto/aes128/index.js +19 -6
- package/dest/crypto/bls/bn254_keystore.d.ts +296 -0
- package/dest/crypto/bls/bn254_keystore.d.ts.map +1 -0
- package/dest/crypto/bls/bn254_keystore.js +218 -0
- package/dest/crypto/bls/index.d.ts +13 -0
- package/dest/crypto/bls/index.d.ts.map +1 -0
- package/dest/crypto/bls/index.js +87 -0
- package/dest/crypto/bn254/index.d.ts +39 -0
- package/dest/crypto/bn254/index.d.ts.map +1 -0
- package/dest/crypto/bn254/index.js +56 -0
- package/dest/crypto/ecdsa/index.d.ts +3 -3
- package/dest/crypto/ecdsa/index.d.ts.map +1 -1
- package/dest/crypto/ecdsa/index.js +62 -48
- package/dest/crypto/ecdsa/signature.d.ts +3 -5
- package/dest/crypto/ecdsa/signature.d.ts.map +1 -1
- package/dest/crypto/ecdsa/signature.js +2 -2
- package/dest/crypto/grumpkin/index.d.ts +10 -15
- package/dest/crypto/grumpkin/index.d.ts.map +1 -1
- package/dest/crypto/grumpkin/index.js +61 -55
- package/dest/crypto/keccak/index.d.ts +3 -5
- package/dest/crypto/keccak/index.d.ts.map +1 -1
- package/dest/crypto/keys/index.d.ts +2 -4
- package/dest/crypto/keys/index.d.ts.map +1 -1
- package/dest/crypto/keys/index.js +8 -5
- package/dest/crypto/pedersen/index.d.ts +1 -1
- package/dest/crypto/pedersen/pedersen.noble.d.ts +3 -5
- package/dest/crypto/pedersen/pedersen.noble.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.d.ts +4 -6
- package/dest/crypto/pedersen/pedersen.wasm.d.ts.map +1 -1
- package/dest/crypto/pedersen/pedersen.wasm.js +24 -14
- package/dest/crypto/poseidon/index.d.ts +2 -5
- package/dest/crypto/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/poseidon/index.js +27 -21
- package/dest/crypto/random/index.d.ts +2 -4
- package/dest/crypto/random/index.d.ts.map +1 -1
- package/dest/crypto/random/index.js +2 -34
- package/dest/crypto/random/randomness_singleton.d.ts +4 -5
- package/dest/crypto/random/randomness_singleton.d.ts.map +1 -1
- package/dest/crypto/random/randomness_singleton.js +5 -5
- package/dest/crypto/schnorr/index.d.ts +3 -2
- package/dest/crypto/schnorr/index.d.ts.map +1 -1
- package/dest/crypto/schnorr/index.js +30 -38
- package/dest/crypto/schnorr/signature.d.ts +5 -7
- package/dest/crypto/schnorr/signature.d.ts.map +1 -1
- package/dest/crypto/schnorr/signature.js +2 -2
- package/dest/crypto/secp256k1/index.d.ts +5 -7
- package/dest/crypto/secp256k1/index.d.ts.map +1 -1
- package/dest/crypto/secp256k1/index.js +23 -18
- package/dest/crypto/secp256k1-signer/index.d.ts +1 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts +1 -1
- package/dest/crypto/secp256k1-signer/secp256k1_signer.d.ts.map +1 -1
- package/dest/crypto/secp256k1-signer/utils.d.ts +67 -5
- package/dest/crypto/secp256k1-signer/utils.d.ts.map +1 -1
- package/dest/crypto/secp256k1-signer/utils.js +118 -6
- package/dest/crypto/serialize.d.ts +5 -7
- package/dest/crypto/serialize.d.ts.map +1 -1
- package/dest/crypto/sha256/index.d.ts +23 -6
- package/dest/crypto/sha256/index.d.ts.map +1 -1
- package/dest/crypto/sha256/index.js +43 -1
- package/dest/crypto/sha512/index.d.ts +3 -5
- package/dest/crypto/sha512/index.d.ts.map +1 -1
- package/dest/crypto/sha512/index.js +1 -1
- package/dest/crypto/signature/index.d.ts +2 -4
- package/dest/crypto/signature/index.d.ts.map +1 -1
- package/dest/crypto/sync/index.d.ts +1 -1
- package/dest/crypto/sync/index.js +1 -1
- package/dest/crypto/sync/pedersen/index.d.ts +4 -6
- package/dest/crypto/sync/pedersen/index.d.ts.map +1 -1
- package/dest/crypto/sync/pedersen/index.js +18 -11
- package/dest/crypto/sync/poseidon/index.d.ts +2 -5
- package/dest/crypto/sync/poseidon/index.d.ts.map +1 -1
- package/dest/crypto/sync/poseidon/index.js +23 -16
- package/dest/curves/bls12/field.d.ts +148 -0
- package/dest/curves/bls12/field.d.ts.map +1 -0
- package/dest/curves/bls12/field.js +362 -0
- package/dest/curves/bls12/index.d.ts +3 -0
- package/dest/curves/bls12/index.d.ts.map +1 -0
- package/dest/curves/bls12/index.js +2 -0
- package/dest/curves/bls12/point.d.ts +229 -0
- package/dest/curves/bls12/point.d.ts.map +1 -0
- package/dest/curves/bls12/point.js +400 -0
- package/dest/curves/bn254/field.d.ts +181 -0
- package/dest/curves/bn254/field.d.ts.map +1 -0
- package/dest/{fields/fields.js → curves/bn254/field.js} +93 -62
- package/dest/curves/bn254/index.d.ts +3 -0
- package/dest/curves/bn254/index.d.ts.map +1 -0
- package/dest/curves/bn254/index.js +2 -0
- package/dest/curves/bn254/point.d.ts +54 -0
- package/dest/curves/bn254/point.d.ts.map +1 -0
- package/dest/curves/bn254/point.js +143 -0
- package/dest/curves/grumpkin/index.d.ts +10 -0
- package/dest/curves/grumpkin/index.d.ts.map +1 -0
- package/dest/curves/grumpkin/index.js +3 -0
- package/dest/{fields → curves/grumpkin}/point.d.ts +14 -7
- package/dest/curves/grumpkin/point.d.ts.map +1 -0
- package/dest/{fields → curves/grumpkin}/point.js +27 -10
- package/dest/decorators/index.d.ts +1 -1
- package/dest/decorators/memoize.d.ts +1 -1
- package/dest/decorators/memoize.d.ts.map +1 -1
- package/dest/error/index.d.ts +1 -1
- package/dest/eth-address/index.d.ts +18 -9
- package/dest/eth-address/index.d.ts.map +1 -1
- package/dest/eth-address/index.js +31 -2
- package/dest/eth-signature/eth_signature.d.ts +18 -15
- package/dest/eth-signature/eth_signature.d.ts.map +1 -1
- package/dest/eth-signature/eth_signature.js +37 -18
- package/dest/eth-signature/index.d.ts +1 -1
- package/dest/fs/index.d.ts +2 -1
- package/dest/fs/index.d.ts.map +1 -1
- package/dest/fs/index.js +1 -0
- package/dest/fs/run_in_dir.d.ts +1 -1
- package/dest/fs/try_rm_dir.d.ts +3 -0
- package/dest/fs/try_rm_dir.d.ts.map +1 -0
- package/dest/fs/try_rm_dir.js +16 -0
- package/dest/iterable/all.d.ts +1 -1
- package/dest/iterable/filter.d.ts +1 -1
- package/dest/iterable/filter.js +1 -1
- package/dest/iterable/index.d.ts +1 -1
- package/dest/iterable/isAsyncIt.d.ts +1 -1
- package/dest/iterable/map.d.ts +1 -1
- package/dest/iterable/map.js +1 -1
- package/dest/iterable/peek.d.ts +1 -1
- package/dest/iterable/sort.d.ts +1 -1
- package/dest/iterable/take.d.ts +1 -1
- package/dest/iterable/toArray.d.ts +1 -1
- package/dest/iterator/filter.d.ts +3 -0
- package/dest/iterator/filter.d.ts.map +1 -0
- package/dest/iterator/filter.js +7 -0
- package/dest/iterator/index.d.ts +2 -0
- package/dest/iterator/index.d.ts.map +1 -0
- package/dest/iterator/index.js +1 -0
- package/dest/jest/env.js +48 -0
- package/dest/jest/setup.js +28 -1
- package/dest/jest/setupAfterEnv.js +3 -0
- package/dest/json-rpc/client/fetch.d.ts +3 -3
- package/dest/json-rpc/client/fetch.d.ts.map +1 -1
- package/dest/json-rpc/client/fetch.js +16 -30
- package/dest/json-rpc/client/index.d.ts +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts +11 -4
- package/dest/json-rpc/client/safe_json_rpc_client.d.ts.map +1 -1
- package/dest/json-rpc/client/safe_json_rpc_client.js +173 -13
- package/dest/json-rpc/client/undici.d.ts +1 -1
- package/dest/json-rpc/client/undici.d.ts.map +1 -1
- package/dest/json-rpc/client/undici.js +27 -11
- package/dest/json-rpc/convert.d.ts +3 -10
- package/dest/json-rpc/convert.d.ts.map +1 -1
- package/dest/json-rpc/convert.js +1 -9
- package/dest/json-rpc/errors.d.ts +4 -0
- package/dest/json-rpc/errors.d.ts.map +1 -0
- package/dest/json-rpc/errors.js +6 -0
- package/dest/json-rpc/fixtures/class_a.d.ts +6 -4
- package/dest/json-rpc/fixtures/class_a.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/class_b.d.ts +6 -4
- package/dest/json-rpc/fixtures/class_b.d.ts.map +1 -1
- package/dest/json-rpc/fixtures/test_state.d.ts +1 -1
- package/dest/json-rpc/fixtures/test_state.d.ts.map +1 -1
- package/dest/json-rpc/index.d.ts +3 -2
- package/dest/json-rpc/index.d.ts.map +1 -1
- package/dest/json-rpc/index.js +2 -1
- package/dest/json-rpc/js_utils.d.ts +1 -1
- package/dest/json-rpc/js_utils.d.ts.map +1 -1
- package/dest/json-rpc/server/api_key_auth.d.ts +19 -0
- package/dest/json-rpc/server/api_key_auth.d.ts.map +1 -0
- package/dest/json-rpc/server/api_key_auth.js +57 -0
- package/dest/json-rpc/server/index.d.ts +2 -1
- package/dest/json-rpc/server/index.d.ts.map +1 -1
- package/dest/json-rpc/server/index.js +1 -0
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts +22 -23
- package/dest/json-rpc/server/safe_json_rpc_server.d.ts.map +1 -1
- package/dest/json-rpc/server/safe_json_rpc_server.js +161 -56
- package/dest/json-rpc/test/index.d.ts +1 -1
- package/dest/json-rpc/test/integration.d.ts +2 -3
- package/dest/json-rpc/test/integration.d.ts.map +1 -1
- package/dest/log/bigint-utils.d.ts +5 -0
- package/dest/log/bigint-utils.d.ts.map +1 -0
- package/dest/log/bigint-utils.js +21 -0
- package/dest/log/console.d.ts +1 -1
- package/dest/log/console.d.ts.map +1 -1
- package/dest/log/gcloud-logger-config.d.ts +1 -2
- package/dest/log/gcloud-logger-config.d.ts.map +1 -1
- package/dest/log/gcloud-logger-config.js +4 -9
- package/dest/log/index.d.ts +5 -5
- package/dest/log/index.d.ts.map +1 -1
- package/dest/log/index.js +4 -4
- package/dest/log/libp2p_logger.d.ts +5 -2
- package/dest/log/libp2p_logger.d.ts.map +1 -1
- package/dest/log/libp2p_logger.js +27 -6
- package/dest/log/log-filters.d.ts +17 -4
- package/dest/log/log-filters.d.ts.map +1 -1
- package/dest/log/log-filters.js +26 -12
- package/dest/log/log-levels.d.ts +1 -1
- package/dest/log/log_fn.d.ts +2 -2
- package/dest/log/log_fn.d.ts.map +1 -1
- package/dest/log/noir_debug_log_util.d.ts +14 -0
- package/dest/log/noir_debug_log_util.d.ts.map +1 -0
- package/dest/log/noir_debug_log_util.js +14 -0
- package/dest/log/pino-logger-server.d.ts +9 -0
- package/dest/log/pino-logger-server.d.ts.map +1 -0
- package/dest/log/pino-logger-server.js +18 -0
- package/dest/log/pino-logger.d.ts +40 -11
- package/dest/log/pino-logger.d.ts.map +1 -1
- package/dest/log/pino-logger.js +149 -30
- package/dest/message/index.d.ts +1 -1
- package/dest/message/index.d.ts.map +1 -1
- package/dest/mutex/index.d.ts +1 -1
- package/dest/mutex/index.d.ts.map +1 -1
- package/dest/mutex/mutex_database.d.ts +1 -1
- package/dest/mutex/mutex_database.d.ts.map +1 -1
- package/dest/noir/index.d.ts +1 -1
- package/dest/noir/noir_package_config.d.ts +9 -9
- package/dest/number/index.d.ts +3 -0
- package/dest/number/index.d.ts.map +1 -0
- package/dest/number/index.js +12 -0
- package/dest/profiler/index.d.ts +2 -0
- package/dest/profiler/index.d.ts.map +1 -0
- package/dest/profiler/index.js +1 -0
- package/dest/profiler/profiler.d.ts +8 -0
- package/dest/profiler/profiler.d.ts.map +1 -0
- package/dest/profiler/profiler.js +97 -0
- package/dest/promise/index.d.ts +1 -1
- package/dest/promise/running-promise.d.ts +2 -2
- package/dest/promise/running-promise.d.ts.map +1 -1
- package/dest/promise/running-promise.js +2 -2
- package/dest/promise/utils.d.ts +1 -1
- package/dest/queue/base_memory_queue.d.ts +2 -2
- package/dest/queue/base_memory_queue.d.ts.map +1 -1
- package/dest/queue/batch_queue.d.ts +2 -2
- package/dest/queue/batch_queue.d.ts.map +1 -1
- package/dest/queue/batch_queue.js +1 -1
- package/dest/queue/bounded_serial_queue.d.ts +1 -1
- package/dest/queue/bounded_serial_queue.d.ts.map +1 -1
- package/dest/queue/fifo_memory_queue.d.ts +1 -1
- package/dest/queue/fifo_memory_queue.d.ts.map +1 -1
- package/dest/queue/index.d.ts +1 -1
- package/dest/queue/priority_memory_queue.d.ts +1 -1
- package/dest/queue/priority_memory_queue.d.ts.map +1 -1
- package/dest/queue/priority_queue.d.ts +1 -1
- package/dest/queue/priority_queue.d.ts.map +1 -1
- package/dest/queue/semaphore.d.ts +5 -1
- package/dest/queue/semaphore.d.ts.map +1 -1
- package/dest/queue/serial_queue.d.ts +3 -3
- package/dest/queue/serial_queue.d.ts.map +1 -1
- package/dest/queue/serial_queue.js +7 -5
- package/dest/retry/index.d.ts +14 -3
- package/dest/retry/index.d.ts.map +1 -1
- package/dest/retry/index.js +13 -2
- package/dest/running-promise/index.d.ts +1 -1
- package/dest/schemas/api.d.ts +1 -1
- package/dest/schemas/api.d.ts.map +1 -1
- package/dest/schemas/index.d.ts +1 -1
- package/dest/schemas/parse.d.ts +1 -1
- package/dest/schemas/parse.js +1 -1
- package/dest/schemas/schemas.d.ts +21 -20
- package/dest/schemas/schemas.d.ts.map +1 -1
- package/dest/schemas/schemas.js +29 -11
- package/dest/schemas/types.d.ts +31 -1
- package/dest/schemas/types.d.ts.map +1 -1
- package/dest/schemas/types.js +25 -1
- package/dest/schemas/utils.d.ts +4 -6
- package/dest/schemas/utils.d.ts.map +1 -1
- package/dest/schemas/utils.js +15 -5
- package/dest/serialize/buffer_reader.d.ts +41 -6
- package/dest/serialize/buffer_reader.d.ts.map +1 -1
- package/dest/serialize/buffer_reader.js +70 -6
- package/dest/serialize/field_reader.d.ts +12 -3
- package/dest/serialize/field_reader.d.ts.map +1 -1
- package/dest/serialize/field_reader.js +19 -2
- package/dest/serialize/free_funcs.d.ts +25 -23
- package/dest/serialize/free_funcs.d.ts.map +1 -1
- package/dest/serialize/free_funcs.js +22 -28
- package/dest/serialize/index.d.ts +1 -1
- package/dest/serialize/serialize.d.ts +24 -7
- package/dest/serialize/serialize.d.ts.map +1 -1
- package/dest/serialize/serialize.js +32 -1
- package/dest/serialize/type_registry.d.ts +1 -1
- package/dest/serialize/type_registry.d.ts.map +1 -1
- package/dest/serialize/types.d.ts +1 -1
- package/dest/sleep/index.d.ts +4 -1
- package/dest/sleep/index.d.ts.map +1 -1
- package/dest/sleep/index.js +14 -1
- package/dest/string/index.d.ts +8 -3
- package/dest/string/index.d.ts.map +1 -1
- package/dest/string/index.js +27 -1
- package/dest/testing/files/index.d.ts +2 -3
- package/dest/testing/files/index.d.ts.map +1 -1
- package/dest/testing/files/index.js +3 -3
- package/dest/testing/formatting.d.ts +4 -0
- package/dest/testing/formatting.d.ts.map +1 -0
- package/dest/testing/formatting.js +3 -0
- package/dest/testing/index.d.ts +2 -1
- package/dest/testing/index.d.ts.map +1 -1
- package/dest/testing/index.js +1 -0
- package/dest/testing/port_allocator.d.ts +1 -1
- package/dest/testing/snapshot_serializer.d.ts +1 -1
- package/dest/testing/test_data.d.ts +1 -1
- package/dest/timer/date.d.ts +28 -2
- package/dest/timer/date.d.ts.map +1 -1
- package/dest/timer/date.js +41 -3
- package/dest/timer/elapsed.d.ts +1 -1
- package/dest/timer/index.d.ts +2 -2
- package/dest/timer/index.d.ts.map +1 -1
- package/dest/timer/index.js +1 -1
- package/dest/timer/timeout.d.ts +19 -6
- package/dest/timer/timeout.d.ts.map +1 -1
- package/dest/timer/timeout.js +43 -22
- package/dest/timer/timer.d.ts +1 -1
- package/dest/timer/timer.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts +1 -1
- package/dest/transport/dispatch/create_dispatch_fn.d.ts.map +1 -1
- package/dest/transport/dispatch/create_dispatch_proxy.d.ts +1 -1
- package/dest/transport/dispatch/messages.d.ts +1 -1
- package/dest/transport/index.d.ts +1 -2
- package/dest/transport/index.d.ts.map +1 -1
- package/dest/transport/index.js +0 -1
- package/dest/transport/interface/connector.d.ts +1 -1
- package/dest/transport/interface/connector.d.ts.map +1 -1
- package/dest/transport/interface/listener.d.ts +1 -2
- package/dest/transport/interface/listener.d.ts.map +1 -1
- package/dest/transport/interface/socket.d.ts +1 -1
- package/dest/transport/interface/socket.d.ts.map +1 -1
- package/dest/transport/interface/transferable.d.ts +1 -1
- package/dest/transport/node/index.d.ts +1 -1
- package/dest/transport/node/node_connector.d.ts +1 -2
- package/dest/transport/node/node_connector.d.ts.map +1 -1
- package/dest/transport/node/node_connector_socket.d.ts +1 -2
- package/dest/transport/node/node_connector_socket.d.ts.map +1 -1
- package/dest/transport/node/node_listener.d.ts +1 -2
- package/dest/transport/node/node_listener.d.ts.map +1 -1
- package/dest/transport/node/node_listener_socket.d.ts +1 -2
- package/dest/transport/node/node_listener_socket.d.ts.map +1 -1
- package/dest/transport/transport_client.d.ts +1 -2
- package/dest/transport/transport_client.d.ts.map +1 -1
- package/dest/transport/transport_client.js +2 -2
- package/dest/transport/transport_server.d.ts +1 -10
- package/dest/transport/transport_server.d.ts.map +1 -1
- package/dest/trees/balanced_merkle_tree_root.d.ts +17 -0
- package/dest/trees/balanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/balanced_merkle_tree_root.js +51 -0
- package/dest/trees/hasher.d.ts +7 -7
- package/dest/trees/hasher.d.ts.map +1 -1
- package/dest/trees/hasher.js +10 -5
- package/dest/trees/index.d.ts +5 -3
- package/dest/trees/index.d.ts.map +1 -1
- package/dest/trees/index.js +4 -2
- package/dest/trees/indexed_merkle_tree.d.ts +1 -3
- package/dest/trees/indexed_merkle_tree.d.ts.map +1 -1
- package/dest/trees/indexed_merkle_tree.js +1 -1
- package/dest/trees/indexed_merkle_tree_calculator.d.ts +2 -4
- package/dest/trees/indexed_merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/indexed_tree_leaf.d.ts +1 -3
- package/dest/trees/indexed_tree_leaf.d.ts.map +1 -1
- package/dest/trees/membership_witness.d.ts +10 -5
- package/dest/trees/membership_witness.d.ts.map +1 -1
- package/dest/trees/membership_witness.js +23 -1
- package/dest/trees/merkle_tree.d.ts +1 -3
- package/dest/trees/merkle_tree.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.d.ts +2 -4
- package/dest/trees/merkle_tree_calculator.d.ts.map +1 -1
- package/dest/trees/merkle_tree_calculator.js +2 -2
- package/dest/trees/sibling_path.d.ts +6 -41
- package/dest/trees/sibling_path.d.ts.map +1 -1
- package/dest/trees/sibling_path.js +3 -3
- package/dest/trees/unbalanced_merkle_tree_calculator.d.ts +48 -0
- package/dest/trees/unbalanced_merkle_tree_calculator.d.ts.map +1 -0
- package/dest/trees/unbalanced_merkle_tree_calculator.js +154 -0
- package/dest/trees/unbalanced_merkle_tree_root.d.ts +28 -0
- package/dest/trees/unbalanced_merkle_tree_root.d.ts.map +1 -0
- package/dest/trees/unbalanced_merkle_tree_root.js +84 -0
- package/dest/trees/unbalanced_tree_store.d.ts +6 -1
- package/dest/trees/unbalanced_tree_store.d.ts.map +1 -1
- package/dest/trees/unbalanced_tree_store.js +55 -1
- package/dest/types/index.d.ts +30 -3
- package/dest/types/index.d.ts.map +1 -1
- package/dest/types/index.js +6 -0
- package/dest/url/index.d.ts +1 -1
- package/dest/url/index.d.ts.map +1 -1
- package/dest/url/index.js +1 -1
- package/dest/validation/index.d.ts +1 -1
- package/package.json +80 -45
- package/src/array/array.ts +13 -16
- package/src/array/index.ts +1 -0
- package/src/array/sorted_array.ts +138 -0
- package/src/async-pool/index.ts +1 -0
- package/src/bigint/index.ts +20 -0
- package/src/branded-types/block_number.ts +117 -0
- package/src/branded-types/checkpoint_number.ts +115 -0
- package/src/branded-types/epoch.ts +88 -0
- package/src/branded-types/index.ts +7 -0
- package/src/branded-types/index_within_checkpoint.ts +88 -0
- package/src/branded-types/slot.ts +88 -0
- package/src/branded-types/types.ts +2 -0
- package/src/buffer/buffer16.ts +133 -0
- package/src/buffer/buffer32.ts +10 -8
- package/src/buffer/index.ts +2 -0
- package/src/buffer/utils.ts +8 -0
- package/src/collection/array.ts +118 -4
- package/src/collection/object.ts +37 -0
- package/src/config/env_var.ts +227 -60
- package/src/config/index.ts +241 -10
- package/src/config/network_config.ts +21 -0
- package/src/config/network_name.ts +31 -0
- package/src/config/parse-env.ts +4 -0
- package/src/config/secret_value.ts +49 -0
- package/src/crypto/aes128/index.ts +19 -10
- package/src/crypto/bls/bn254_keystore.ts +287 -0
- package/src/crypto/bls/index.ts +77 -0
- package/src/crypto/bn254/index.ts +64 -0
- package/src/crypto/ecdsa/index.ts +41 -23
- package/src/crypto/ecdsa/signature.ts +2 -2
- package/src/crypto/grumpkin/index.ts +38 -46
- package/src/crypto/keys/index.ts +6 -6
- package/src/crypto/pedersen/pedersen.wasm.ts +23 -19
- package/src/crypto/poseidon/index.ts +27 -29
- package/src/crypto/random/index.ts +2 -40
- package/src/crypto/random/randomness_singleton.ts +6 -4
- package/src/crypto/schnorr/index.ts +22 -18
- package/src/crypto/schnorr/signature.ts +2 -2
- package/src/crypto/secp256k1/index.ts +15 -11
- package/src/crypto/secp256k1-signer/utils.ts +152 -7
- package/src/crypto/sha256/index.ts +48 -1
- package/src/crypto/sha512/index.ts +1 -1
- package/src/crypto/signature/index.ts +1 -1
- package/src/crypto/sync/index.ts +1 -1
- package/src/crypto/sync/pedersen/index.ts +17 -16
- package/src/crypto/sync/poseidon/index.ts +23 -27
- package/src/curves/bls12/field.ts +463 -0
- package/src/curves/bls12/index.ts +2 -0
- package/src/curves/bls12/point.ts +450 -0
- package/src/{fields/fields.ts → curves/bn254/field.ts} +88 -63
- package/src/curves/bn254/index.ts +2 -0
- package/src/curves/bn254/point.ts +170 -0
- package/src/curves/grumpkin/index.ts +11 -0
- package/src/{fields → curves/grumpkin}/point.ts +27 -10
- package/src/eth-address/index.ts +35 -3
- package/src/eth-signature/eth_signature.ts +50 -22
- package/src/fs/index.ts +1 -0
- package/src/fs/try_rm_dir.ts +15 -0
- package/src/iterable/filter.ts +1 -1
- package/src/iterable/map.ts +1 -1
- package/src/iterator/filter.ts +11 -0
- package/src/iterator/index.ts +1 -0
- package/src/jest/env.mjs +52 -0
- package/src/jest/setup.mjs +31 -1
- package/src/jest/setupAfterEnv.mjs +3 -0
- package/src/json-rpc/client/fetch.ts +14 -33
- package/src/json-rpc/client/safe_json_rpc_client.ts +228 -13
- package/src/json-rpc/client/undici.ts +29 -18
- package/src/json-rpc/convert.ts +3 -12
- package/src/json-rpc/errors.ts +6 -0
- package/src/json-rpc/fixtures/class_a.ts +4 -1
- package/src/json-rpc/fixtures/class_b.ts +4 -1
- package/src/json-rpc/index.ts +2 -1
- package/src/json-rpc/server/api_key_auth.ts +63 -0
- package/src/json-rpc/server/index.ts +1 -0
- package/src/json-rpc/server/safe_json_rpc_server.ts +141 -48
- package/src/json-rpc/test/integration.ts +1 -1
- package/src/log/bigint-utils.ts +25 -0
- package/src/log/console.ts +4 -1
- package/src/log/gcloud-logger-config.ts +8 -7
- package/src/log/index.ts +4 -4
- package/src/log/libp2p_logger.ts +33 -7
- package/src/log/log-filters.ts +29 -11
- package/src/log/log_fn.ts +1 -1
- package/src/log/noir_debug_log_util.ts +21 -0
- package/src/log/pino-logger-server.ts +25 -0
- package/src/log/pino-logger.ts +175 -39
- package/src/message/index.ts +5 -1
- package/src/mutex/mutex_database.ts +2 -3
- package/src/number/index.ts +14 -0
- package/src/profiler/index.ts +1 -0
- package/src/profiler/profiler.ts +125 -0
- package/src/promise/running-promise.ts +2 -2
- package/src/queue/base_memory_queue.ts +1 -1
- package/src/queue/batch_queue.ts +1 -1
- package/src/queue/bounded_serial_queue.ts +4 -1
- package/src/queue/semaphore.ts +5 -0
- package/src/queue/serial_queue.ts +5 -5
- package/src/retry/index.ts +28 -5
- package/src/schemas/api.ts +4 -4
- package/src/schemas/parse.ts +1 -1
- package/src/schemas/schemas.ts +42 -13
- package/src/schemas/types.ts +33 -0
- package/src/schemas/utils.ts +21 -8
- package/src/serialize/buffer_reader.ts +96 -12
- package/src/serialize/field_reader.ts +28 -4
- package/src/serialize/free_funcs.ts +26 -32
- package/src/serialize/serialize.ts +35 -1
- package/src/sleep/index.ts +16 -1
- package/src/string/index.ts +36 -1
- package/src/testing/files/index.ts +7 -3
- package/src/testing/formatting.ts +3 -0
- package/src/testing/index.ts +1 -0
- package/src/timer/date.ts +61 -3
- package/src/timer/index.ts +1 -1
- package/src/timer/timeout.ts +54 -19
- package/src/transport/index.ts +0 -1
- package/src/transport/interface/connector.ts +0 -1
- package/src/transport/interface/listener.ts +2 -3
- package/src/transport/interface/socket.ts +2 -3
- package/src/transport/transport_client.ts +5 -6
- package/src/transport/transport_server.ts +4 -1
- package/src/trees/balanced_merkle_tree_root.ts +68 -0
- package/src/trees/hasher.ts +13 -4
- package/src/trees/index.ts +4 -2
- package/src/trees/indexed_merkle_tree.ts +6 -2
- package/src/trees/indexed_merkle_tree_calculator.ts +2 -2
- package/src/trees/membership_witness.ts +22 -1
- package/src/trees/merkle_tree.ts +4 -1
- package/src/trees/merkle_tree_calculator.ts +10 -5
- package/src/trees/sibling_path.ts +3 -3
- package/src/trees/unbalanced_merkle_tree_calculator.ts +176 -0
- package/src/trees/unbalanced_merkle_tree_root.ts +115 -0
- package/src/trees/unbalanced_tree_store.ts +62 -3
- package/src/types/index.ts +35 -4
- package/src/url/index.ts +0 -1
- package/dest/crypto/index.d.ts +0 -15
- package/dest/crypto/index.d.ts.map +0 -1
- package/dest/crypto/index.js +0 -14
- 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.elliptic.js +0 -582
- package/dest/fields/coordinate.d.ts +0 -68
- package/dest/fields/coordinate.d.ts.map +0 -1
- package/dest/fields/coordinate.js +0 -96
- 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/index.js +0 -3
- package/dest/fields/point.d.ts.map +0 -1
- package/dest/index.d.ts +0 -31
- package/dest/index.d.ts.map +0 -1
- package/dest/index.js +0 -31
- 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/server/telemetry.js +0 -0
- package/dest/log/debug.d.ts +0 -56
- package/dest/log/debug.d.ts.map +0 -1
- package/dest/log/debug.js +0 -75
- package/dest/log/log_history.d.ts +0 -31
- package/dest/log/log_history.d.ts.map +0 -1
- package/dest/log/log_history.js +0 -38
- package/dest/transport/browser/index.d.ts +0 -5
- package/dest/transport/browser/index.d.ts.map +0 -1
- package/dest/transport/browser/index.js +0 -4
- 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/message_port_socket.js +0 -42
- 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_connector.js +0 -19
- 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/shared_worker_listener.js +0 -33
- 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_connector.js +0 -30
- package/dest/transport/browser/worker_listener.d.ts +0 -39
- package/dest/transport/browser/worker_listener.d.ts.map +0 -1
- package/dest/transport/browser/worker_listener.js +0 -35
- 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_merkle_tree.js +0 -100
- package/dest/wasm/empty_wasi_sdk.d.ts +0 -130
- package/dest/wasm/empty_wasi_sdk.d.ts.map +0 -1
- package/dest/wasm/empty_wasi_sdk.js +0 -148
- package/dest/wasm/index.d.ts +0 -2
- package/dest/wasm/index.d.ts.map +0 -1
- package/dest/wasm/index.js +0 -1
- package/dest/wasm/wasm_module.d.ts +0 -136
- package/dest/wasm/wasm_module.d.ts.map +0 -1
- package/dest/wasm/wasm_module.js +0 -196
- package/dest/worker/browser/index.d.ts +0 -3
- package/dest/worker/browser/index.d.ts.map +0 -1
- package/dest/worker/browser/index.js +0 -2
- 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/start_web_module.js +0 -27
- 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_data_store.js +0 -29
- package/dest/worker/browser/web_worker.d.ts +0 -10
- package/dest/worker/browser/web_worker.d.ts.map +0 -1
- package/dest/worker/browser/web_worker.js +0 -25
- package/dest/worker/data_store.d.ts +0 -21
- package/dest/worker/data_store.d.ts.map +0 -1
- package/dest/worker/data_store.js +0 -3
- package/dest/worker/index.d.ts +0 -3
- package/dest/worker/index.d.ts.map +0 -1
- package/dest/worker/index.js +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/index.js +0 -2
- 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_data_store.js +0 -20
- 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/node_worker.js +0 -22
- 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/node/start_node_module.js +0 -31
- package/dest/worker/wasm_worker.d.ts +0 -9
- package/dest/worker/wasm_worker.d.ts.map +0 -1
- package/dest/worker/wasm_worker.js +0 -3
- package/dest/worker/worker_pool.d.ts +0 -40
- package/dest/worker/worker_pool.d.ts.map +0 -1
- package/dest/worker/worker_pool.js +0 -51
- package/src/crypto/index.ts +0 -14
- package/src/crypto/pedersen/pedersen.elliptic.ts +0 -584
- package/src/fields/coordinate.ts +0 -104
- package/src/fields/index.ts +0 -3
- package/src/index.ts +0 -31
- package/src/json-rpc/server/telemetry.ts +0 -0
- package/src/log/debug.ts +0 -104
- package/src/log/log_history.ts +0 -44
- package/src/transport/browser/index.ts +0 -4
- package/src/transport/browser/message_port_socket.ts +0 -48
- package/src/transport/browser/shared_worker_connector.ts +0 -21
- package/src/transport/browser/shared_worker_listener.ts +0 -53
- package/src/transport/browser/worker_connector.ts +0 -30
- package/src/transport/browser/worker_listener.ts +0 -54
- package/src/trees/unbalanced_merkle_tree.ts +0 -103
- package/src/wasm/README.md +0 -6
- package/src/wasm/empty_wasi_sdk.ts +0 -166
- package/src/wasm/fixtures/gcd.wasm +0 -0
- package/src/wasm/fixtures/gcd.wat +0 -27
- package/src/wasm/index.ts +0 -1
- package/src/wasm/wasm_module.ts +0 -260
- package/src/worker/browser/index.ts +0 -2
- package/src/worker/browser/start_web_module.ts +0 -24
- package/src/worker/browser/web_data_store.ts +0 -38
- package/src/worker/browser/web_worker.ts +0 -25
- package/src/worker/data_store.ts +0 -19
- package/src/worker/index.ts +0 -2
- package/src/worker/node/index.ts +0 -2
- package/src/worker/node/node_data_store.ts +0 -27
- package/src/worker/node/node_worker.ts +0 -23
- package/src/worker/node/start_node_module.ts +0 -30
- package/src/worker/wasm_worker.ts +0 -7
- package/src/worker/worker_pool.ts +0 -73
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An implementation of a TransportSocket using MessagePorts.
|
|
3
|
-
*/ export class MessagePortSocket {
|
|
4
|
-
port;
|
|
5
|
-
constructor(port){
|
|
6
|
-
this.port = port;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Send a message to the connected MessagePort, optionally transferring ownership of certain objects.
|
|
10
|
-
* The 'msg' parameter can be any structured data type and will be sent to the other end of the MessagePort.
|
|
11
|
-
* The optional 'transfer' parameter is an array of Transferable objects whose ownership will be transferred,
|
|
12
|
-
* making them inaccessible on the sending side. This can improve performance for large data transfers.
|
|
13
|
-
*
|
|
14
|
-
* @param msg - The message to be sent through the MessagePort.
|
|
15
|
-
* @param transfer - An optional array of Transferable objects to transfer ownership.
|
|
16
|
-
* @returns A Promise that resolves when the message has been sent.
|
|
17
|
-
*/ send(msg, transfer = []) {
|
|
18
|
-
this.port.postMessage(msg, transfer);
|
|
19
|
-
return Promise.resolve();
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Register a callback function to handle incoming messages from the MessagePort.
|
|
23
|
-
* The provided callback will be invoked with the message data whenever a new message arrives.
|
|
24
|
-
* Note that only one callback can be registered at a time. Subsequent calls to this method
|
|
25
|
-
* will overwrite the previously registered callback.
|
|
26
|
-
*
|
|
27
|
-
* @param cb - The callback function to handle incoming messages.
|
|
28
|
-
*/ registerHandler(cb) {
|
|
29
|
-
this.port.onmessage = (event)=>cb(event.data);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Close the MessagePort, unregister the message handler, and send an undefined message.
|
|
33
|
-
* The 'close' function is useful for gracefully shutting down a connection between two
|
|
34
|
-
* endpoints by sending an undefined message as an indication of disconnection before
|
|
35
|
-
* closing the port. After calling this method, the MessagePortSocket instance should not
|
|
36
|
-
* be used again.
|
|
37
|
-
*/ close() {
|
|
38
|
-
void this.send(undefined);
|
|
39
|
-
this.port.onmessage = null;
|
|
40
|
-
this.port.close();
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Connector } from '../interface/connector.js';
|
|
2
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
3
|
-
/**
|
|
4
|
-
* SharedWorkerConnector is an implementation of the Connector interface, specifically for SharedWorkers.
|
|
5
|
-
* It enables the creation of MessagePortSockets that communicate with a shared worker and allow
|
|
6
|
-
* multiple scripts to communicate with the worker using the same connection.
|
|
7
|
-
*/
|
|
8
|
-
export declare class SharedWorkerConnector implements Connector {
|
|
9
|
-
private worker;
|
|
10
|
-
constructor(worker: SharedWorker);
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new MessagePortSocket instance using the SharedWorker's port.
|
|
13
|
-
* This method allows for easy creation of sockets to communicate with the SharedWorker.
|
|
14
|
-
*
|
|
15
|
-
* @returns A Promise that resolves to a new MessagePortSocket instance.
|
|
16
|
-
*/
|
|
17
|
-
createSocket(): Promise<MessagePortSocket>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=shared_worker_connector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared_worker_connector.d.ts","sourceRoot":"","sources":["../../../src/transport/browser/shared_worker_connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,SAAS;IACzC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,YAAY;IAExC;;;;;OAKG;IACH,YAAY;CAGb"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
2
|
-
/**
|
|
3
|
-
* SharedWorkerConnector is an implementation of the Connector interface, specifically for SharedWorkers.
|
|
4
|
-
* It enables the creation of MessagePortSockets that communicate with a shared worker and allow
|
|
5
|
-
* multiple scripts to communicate with the worker using the same connection.
|
|
6
|
-
*/ export class SharedWorkerConnector {
|
|
7
|
-
worker;
|
|
8
|
-
constructor(worker){
|
|
9
|
-
this.worker = worker;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new MessagePortSocket instance using the SharedWorker's port.
|
|
13
|
-
* This method allows for easy creation of sockets to communicate with the SharedWorker.
|
|
14
|
-
*
|
|
15
|
-
* @returns A Promise that resolves to a new MessagePortSocket instance.
|
|
16
|
-
*/ createSocket() {
|
|
17
|
-
return Promise.resolve(new MessagePortSocket(this.worker.port));
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import EventEmitter from 'events';
|
|
3
|
-
import type { Listener } from '../interface/listener.js';
|
|
4
|
-
/**
|
|
5
|
-
* Represents the global scope of a Shared Worker.
|
|
6
|
-
* Provides functionality to handle incoming connections and manage communication with other scripts
|
|
7
|
-
* running in a shared context, enabling concurrent access and efficient resource sharing among those scripts.
|
|
8
|
-
*/
|
|
9
|
-
declare interface SharedWorkerGlobalScope {
|
|
10
|
-
/**
|
|
11
|
-
* Event handler for new connections to the Shared Worker.
|
|
12
|
-
*/
|
|
13
|
-
onconnect: (...args: any) => any;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* SharedWorkerListener is an extension of the EventEmitter class that implements the Listener interface.
|
|
17
|
-
* It provides functionality to handle incoming messages from a shared worker and emit events for new sockets
|
|
18
|
-
* created in response to these incoming connections. This class is meant to be used in the context of managing
|
|
19
|
-
* MessagePort connections within the SharedWorkerGlobalScope.
|
|
20
|
-
*/
|
|
21
|
-
export declare class SharedWorkerListener extends EventEmitter implements Listener {
|
|
22
|
-
private worker;
|
|
23
|
-
constructor(worker: SharedWorkerGlobalScope);
|
|
24
|
-
/**
|
|
25
|
-
* Initializes the shared worker listener by assigning the 'handleMessageEvent' method as the event handler
|
|
26
|
-
* for the 'onconnect' event of the SharedWorkerGlobalScope. The 'handleMessageEvent' function will be called
|
|
27
|
-
* whenever a new connection is established with the shared worker.
|
|
28
|
-
*/
|
|
29
|
-
open(): void;
|
|
30
|
-
/**
|
|
31
|
-
* Closes the SharedWorkerListener by detaching the 'onconnect' event handler.
|
|
32
|
-
* This stops the listener from emitting new sockets on incoming connections.
|
|
33
|
-
*/
|
|
34
|
-
close(): void;
|
|
35
|
-
private handleMessageEvent;
|
|
36
|
-
}
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=shared_worker_listener.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared_worker_listener.d.ts","sourceRoot":"","sources":["../../../src/transport/browser/shared_worker_listener.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;;GAIG;AACH,OAAO,WAAW,uBAAuB;IACvC;;OAEG;IACH,SAAS,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;CAClC;AAED;;;;;GAKG;AACH,qBAAa,oBAAqB,SAAQ,YAAa,YAAW,QAAQ;IAC5D,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,uBAAuB;IAInD;;;;OAIG;IACH,IAAI;IAIJ;;;OAGG;IACH,KAAK;IAIL,OAAO,CAAC,kBAAkB,CAMxB;CACH"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import EventEmitter from 'events';
|
|
2
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
3
|
-
/**
|
|
4
|
-
* SharedWorkerListener is an extension of the EventEmitter class that implements the Listener interface.
|
|
5
|
-
* It provides functionality to handle incoming messages from a shared worker and emit events for new sockets
|
|
6
|
-
* created in response to these incoming connections. This class is meant to be used in the context of managing
|
|
7
|
-
* MessagePort connections within the SharedWorkerGlobalScope.
|
|
8
|
-
*/ export class SharedWorkerListener extends EventEmitter {
|
|
9
|
-
worker;
|
|
10
|
-
constructor(worker){
|
|
11
|
-
super(), this.worker = worker, this.handleMessageEvent = (event)=>{
|
|
12
|
-
const [port] = event.ports;
|
|
13
|
-
if (!port) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
this.emit('new_socket', new MessagePortSocket(port));
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Initializes the shared worker listener by assigning the 'handleMessageEvent' method as the event handler
|
|
21
|
-
* for the 'onconnect' event of the SharedWorkerGlobalScope. The 'handleMessageEvent' function will be called
|
|
22
|
-
* whenever a new connection is established with the shared worker.
|
|
23
|
-
*/ open() {
|
|
24
|
-
this.worker.onconnect = this.handleMessageEvent;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Closes the SharedWorkerListener by detaching the 'onconnect' event handler.
|
|
28
|
-
* This stops the listener from emitting new sockets on incoming connections.
|
|
29
|
-
*/ close() {
|
|
30
|
-
this.worker.onconnect = ()=>{};
|
|
31
|
-
}
|
|
32
|
-
handleMessageEvent;
|
|
33
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Connector } from '../interface/connector.js';
|
|
2
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
3
|
-
/**
|
|
4
|
-
* WorkerConnector is a class implementing the Connector interface for creating communication sockets
|
|
5
|
-
* with Web Workers. It allows to establish a connection with the worker and create MessagePortSockets
|
|
6
|
-
* using MessageChannels, enabling seamless communication between the main thread and worker threads.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* const worker = new Worker('./myWorker.js');
|
|
10
|
-
* const connector = new WorkerConnector(worker);
|
|
11
|
-
* const socket = await connector.createSocket();
|
|
12
|
-
* socket.send('Hello, worker!');
|
|
13
|
-
*/
|
|
14
|
-
export declare class WorkerConnector implements Connector {
|
|
15
|
-
private worker;
|
|
16
|
-
constructor(worker: Worker);
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new MessagePortSocket instance by establishing a connection between the Worker and the main thread.
|
|
19
|
-
* A MessageChannel is created, and one of its ports is sent to the Worker using postMessage.
|
|
20
|
-
* The other port is used to create a new MessagePortSocket which is then returned as a Promise.
|
|
21
|
-
*
|
|
22
|
-
* @returns A Promise that resolves to a new MessagePortSocket instance.
|
|
23
|
-
*/
|
|
24
|
-
createSocket(): Promise<MessagePortSocket>;
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=worker_connector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker_connector.d.ts","sourceRoot":"","sources":["../../../src/transport/browser/worker_connector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,YAAW,SAAS;IACnC,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAElC;;;;;;OAMG;IACH,YAAY;CAKb"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
2
|
-
/**
|
|
3
|
-
* WorkerConnector is a class implementing the Connector interface for creating communication sockets
|
|
4
|
-
* with Web Workers. It allows to establish a connection with the worker and create MessagePortSockets
|
|
5
|
-
* using MessageChannels, enabling seamless communication between the main thread and worker threads.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* const worker = new Worker('./myWorker.js');
|
|
9
|
-
* const connector = new WorkerConnector(worker);
|
|
10
|
-
* const socket = await connector.createSocket();
|
|
11
|
-
* socket.send('Hello, worker!');
|
|
12
|
-
*/ export class WorkerConnector {
|
|
13
|
-
worker;
|
|
14
|
-
constructor(worker){
|
|
15
|
-
this.worker = worker;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new MessagePortSocket instance by establishing a connection between the Worker and the main thread.
|
|
19
|
-
* A MessageChannel is created, and one of its ports is sent to the Worker using postMessage.
|
|
20
|
-
* The other port is used to create a new MessagePortSocket which is then returned as a Promise.
|
|
21
|
-
*
|
|
22
|
-
* @returns A Promise that resolves to a new MessagePortSocket instance.
|
|
23
|
-
*/ createSocket() {
|
|
24
|
-
const channel = new MessageChannel();
|
|
25
|
-
this.worker.postMessage('', [
|
|
26
|
-
channel.port2
|
|
27
|
-
]);
|
|
28
|
-
return Promise.resolve(new MessagePortSocket(channel.port1));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import EventEmitter from 'events';
|
|
3
|
-
import type { Listener } from '../interface/listener.js';
|
|
4
|
-
/**
|
|
5
|
-
* Represents a DedicatedWorkerGlobalScope, which is the global execution context for a dedicated worker.
|
|
6
|
-
* Provides properties and methods to manage the worker's lifecycle and communication with other threads or workers.
|
|
7
|
-
*/
|
|
8
|
-
declare interface DedicatedWorkerGlobalScope {
|
|
9
|
-
/**
|
|
10
|
-
* Handler for incoming messages from other threads or workers.
|
|
11
|
-
*/
|
|
12
|
-
onmessage: any;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* WorkerListener is a class that extends EventEmitter and implements the Listener interface.
|
|
16
|
-
* It listens for incoming connections on a dedicated worker global scope, and emits a 'new_socket' event
|
|
17
|
-
* with a MessagePortSocket instance for each new connection. This allows applications to communicate
|
|
18
|
-
* with other workers or main thread through the MessagePortSocket abstraction.
|
|
19
|
-
*
|
|
20
|
-
* The open() method starts listening for incoming connections, while the close() method stops it.
|
|
21
|
-
*/
|
|
22
|
-
export declare class WorkerListener extends EventEmitter implements Listener {
|
|
23
|
-
private worker;
|
|
24
|
-
constructor(worker: DedicatedWorkerGlobalScope);
|
|
25
|
-
/**
|
|
26
|
-
* Initializes the WorkerListener by setting the 'onmessage' event handler of the worker.
|
|
27
|
-
* The 'onmessage' event will be triggered when the worker receives a message, and it will then
|
|
28
|
-
* call the handleMessageEvent method to handle incoming connections.
|
|
29
|
-
*/
|
|
30
|
-
open(): void;
|
|
31
|
-
/**
|
|
32
|
-
* Close the worker listener by removing the 'onmessage' event handler.
|
|
33
|
-
* This method effectively stops the WorkerListener from reacting to new incoming messages.
|
|
34
|
-
*/
|
|
35
|
-
close(): void;
|
|
36
|
-
private handleMessageEvent;
|
|
37
|
-
}
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=worker_listener.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker_listener.d.ts","sourceRoot":"","sources":["../../../src/transport/browser/worker_listener.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGzD;;;GAGG;AACH,OAAO,WAAW,0BAA0B;IAC1C;;OAEG;IACH,SAAS,EAAE,GAAG,CAAC;CAChB;AAED;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,YAAa,YAAW,QAAQ;IACtD,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,0BAA0B;IAItD;;;;OAIG;IACH,IAAI;IAIJ;;;OAGG;IACH,KAAK;IAIL,OAAO,CAAC,kBAAkB,CAMxB;CACH"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import EventEmitter from 'events';
|
|
2
|
-
import { MessagePortSocket } from './message_port_socket.js';
|
|
3
|
-
/**
|
|
4
|
-
* WorkerListener is a class that extends EventEmitter and implements the Listener interface.
|
|
5
|
-
* It listens for incoming connections on a dedicated worker global scope, and emits a 'new_socket' event
|
|
6
|
-
* with a MessagePortSocket instance for each new connection. This allows applications to communicate
|
|
7
|
-
* with other workers or main thread through the MessagePortSocket abstraction.
|
|
8
|
-
*
|
|
9
|
-
* The open() method starts listening for incoming connections, while the close() method stops it.
|
|
10
|
-
*/ export class WorkerListener extends EventEmitter {
|
|
11
|
-
worker;
|
|
12
|
-
constructor(worker){
|
|
13
|
-
super(), this.worker = worker, this.handleMessageEvent = (event)=>{
|
|
14
|
-
const [port] = event.ports;
|
|
15
|
-
if (!port) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
this.emit('new_socket', new MessagePortSocket(port));
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Initializes the WorkerListener by setting the 'onmessage' event handler of the worker.
|
|
23
|
-
* The 'onmessage' event will be triggered when the worker receives a message, and it will then
|
|
24
|
-
* call the handleMessageEvent method to handle incoming connections.
|
|
25
|
-
*/ open() {
|
|
26
|
-
this.worker.onmessage = this.handleMessageEvent;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Close the worker listener by removing the 'onmessage' event handler.
|
|
30
|
-
* This method effectively stops the WorkerListener from reacting to new incoming messages.
|
|
31
|
-
*/ close() {
|
|
32
|
-
this.worker.onmessage = ()=>{};
|
|
33
|
-
}
|
|
34
|
-
handleMessageEvent;
|
|
35
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
3
|
-
import { sha256Trunc } from '../crypto/sha256/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Computes the merkle root for an unbalanced tree.
|
|
6
|
-
*
|
|
7
|
-
* @dev Adapted from unbalanced_tree.ts.
|
|
8
|
-
* Calculates the tree upwards layer by layer until we reach the root.
|
|
9
|
-
* The L1 calculation instead computes the tree from right to left (slightly cheaper gas).
|
|
10
|
-
* TODO: A more thorough investigation of which method is cheaper, then use that method everywhere.
|
|
11
|
-
*/
|
|
12
|
-
export declare function computeUnbalancedMerkleRoot(leaves: Buffer[], emptyLeaf?: Buffer, hasher?: typeof sha256Trunc): Buffer;
|
|
13
|
-
export declare function findLeafLevelAndIndex(numLeaves: number, leafIndex: number): {
|
|
14
|
-
level: number;
|
|
15
|
-
indexAtLevel: number;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=unbalanced_merkle_tree.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unbalanced_merkle_tree.d.ts","sourceRoot":"","sources":["../../src/trees/unbalanced_merkle_tree.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;;;;;;GAOG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,qBAAc,GAAG,MAAM,CAwC9G;AAgDD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;;;EAGzE"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { padArrayEnd } from '../collection/array.js';
|
|
2
|
-
import { sha256Trunc } from '../crypto/sha256/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Computes the merkle root for an unbalanced tree.
|
|
5
|
-
*
|
|
6
|
-
* @dev Adapted from unbalanced_tree.ts.
|
|
7
|
-
* Calculates the tree upwards layer by layer until we reach the root.
|
|
8
|
-
* The L1 calculation instead computes the tree from right to left (slightly cheaper gas).
|
|
9
|
-
* TODO: A more thorough investigation of which method is cheaper, then use that method everywhere.
|
|
10
|
-
*/ export function computeUnbalancedMerkleRoot(leaves, emptyLeaf, hasher = sha256Trunc) {
|
|
11
|
-
// Pad leaves to 2
|
|
12
|
-
if (leaves.length < 2) {
|
|
13
|
-
if (emptyLeaf === undefined) {
|
|
14
|
-
throw new Error('Cannot compute a Merkle root with less than 2 leaves');
|
|
15
|
-
} else {
|
|
16
|
-
leaves = padArrayEnd(leaves, emptyLeaf, 2);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const depth = Math.ceil(Math.log2(leaves.length));
|
|
20
|
-
let [layerWidth, nodeToShift] = leaves.length & 1 ? [
|
|
21
|
-
leaves.length - 1,
|
|
22
|
-
leaves[leaves.length - 1]
|
|
23
|
-
] : [
|
|
24
|
-
leaves.length,
|
|
25
|
-
Buffer.alloc(0)
|
|
26
|
-
];
|
|
27
|
-
// Allocate this layer's leaves and init the next layer up
|
|
28
|
-
let thisLayer = leaves.slice(0, layerWidth);
|
|
29
|
-
let nextLayer = [];
|
|
30
|
-
for(let i = 0; i < depth; i++){
|
|
31
|
-
for(let j = 0; j < layerWidth; j += 2){
|
|
32
|
-
// Store the hash of each pair one layer up
|
|
33
|
-
nextLayer[j / 2] = hasher(Buffer.concat([
|
|
34
|
-
thisLayer[j],
|
|
35
|
-
thisLayer[j + 1]
|
|
36
|
-
]));
|
|
37
|
-
}
|
|
38
|
-
layerWidth /= 2;
|
|
39
|
-
if (layerWidth & 1) {
|
|
40
|
-
if (nodeToShift.length) {
|
|
41
|
-
// If the next layer has odd length, and we have a node that needs to be shifted up, add it here
|
|
42
|
-
nextLayer.push(nodeToShift);
|
|
43
|
-
layerWidth += 1;
|
|
44
|
-
nodeToShift = Buffer.alloc(0);
|
|
45
|
-
} else {
|
|
46
|
-
// If we don't have a node waiting to be shifted, store the next layer's final node to be shifted
|
|
47
|
-
layerWidth -= 1;
|
|
48
|
-
nodeToShift = nextLayer[layerWidth];
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// reset the layers
|
|
52
|
-
thisLayer = nextLayer;
|
|
53
|
-
nextLayer = [];
|
|
54
|
-
}
|
|
55
|
-
// return the root
|
|
56
|
-
return thisLayer[0];
|
|
57
|
-
}
|
|
58
|
-
function getMaxBalancedTreeDepth(numLeaves) {
|
|
59
|
-
return Math.floor(Math.log2(numLeaves));
|
|
60
|
-
}
|
|
61
|
-
function getMaxUnbalancedTreeDepth(numLeaves) {
|
|
62
|
-
return Math.ceil(Math.log2(numLeaves));
|
|
63
|
-
}
|
|
64
|
-
function findPosition(rootLevel, leafLevel, numLeaves, indexOffset, targetIndex) {
|
|
65
|
-
if (numLeaves <= 1) {
|
|
66
|
-
// Single leaf.
|
|
67
|
-
return {
|
|
68
|
-
level: rootLevel,
|
|
69
|
-
indexAtLevel: indexOffset
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
// The largest balanced tree that can be created with the given number of leaves.
|
|
73
|
-
const maxBalancedTreeDepth = getMaxBalancedTreeDepth(numLeaves);
|
|
74
|
-
const numBalancedLeaves = 2 ** maxBalancedTreeDepth;
|
|
75
|
-
const numRemainingLeaves = numLeaves - numBalancedLeaves;
|
|
76
|
-
if (targetIndex < numBalancedLeaves) {
|
|
77
|
-
// Target is in the balanced tree.
|
|
78
|
-
// - If numRemainingLeaves is 0: this balanced tree is grown from the current root.
|
|
79
|
-
// - If numRemainingLeaves is not 0: the remaining leaves will form another tree, which will become the right child of the root.
|
|
80
|
-
// And the balanced tree will be the left child of the root.
|
|
81
|
-
// There will be an extra level between the root of the balanced tree and the current root.
|
|
82
|
-
const extraLevel = numRemainingLeaves ? 1 : 0;
|
|
83
|
-
return {
|
|
84
|
-
level: rootLevel + maxBalancedTreeDepth + extraLevel,
|
|
85
|
-
indexAtLevel: indexOffset + targetIndex
|
|
86
|
-
};
|
|
87
|
-
} else {
|
|
88
|
-
// Target is in the right branch.
|
|
89
|
-
const rightBranchMaxLevel = getMaxUnbalancedTreeDepth(numRemainingLeaves);
|
|
90
|
-
const shiftedUp = leafLevel - rootLevel - rightBranchMaxLevel - 1;
|
|
91
|
-
const nextLeafLevel = leafLevel - shiftedUp;
|
|
92
|
-
const newIndexOffset = indexOffset + numBalancedLeaves >> shiftedUp;
|
|
93
|
-
const shiftedTargetIndex = targetIndex - numBalancedLeaves;
|
|
94
|
-
return findPosition(rootLevel + 1, nextLeafLevel, numRemainingLeaves, newIndexOffset, shiftedTargetIndex);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
export function findLeafLevelAndIndex(numLeaves, leafIndex) {
|
|
98
|
-
const maxLevel = getMaxUnbalancedTreeDepth(numLeaves);
|
|
99
|
-
return findPosition(0, maxLevel, numLeaves, 0, leafIndex);
|
|
100
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dummy implementation of a necessary part of the wasi api:
|
|
3
|
-
* https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
|
|
4
|
-
* We don't use these functions, but the environment expects them.
|
|
5
|
-
* TODO find a way to update off of wasi 12.
|
|
6
|
-
*/
|
|
7
|
-
export declare const getEmptyWasiSdk: (debug?: import("../log/log_fn.js").LogFn) => {
|
|
8
|
-
/**
|
|
9
|
-
* Retrieves the current time from the system clock.
|
|
10
|
-
* This function is a dummy implementation of the WASI API's `clock_time_get` method,
|
|
11
|
-
* which is expected by the environment but not used in this context.
|
|
12
|
-
*
|
|
13
|
-
* No input parameters or return values are required, as the purpose of this function
|
|
14
|
-
* is solely to satisfy the environment expectations and provide debugging information.
|
|
15
|
-
*/
|
|
16
|
-
clock_time_get(): void;
|
|
17
|
-
/**
|
|
18
|
-
* Dummy implementation of WASI's environ_get function.
|
|
19
|
-
* This function is used to obtain a snapshot of the current environment variables.
|
|
20
|
-
* In this dummy implementation, no actual actions are performed, but the debug logger logs 'environ_get' when called.
|
|
21
|
-
* Environment variables are not used in this context, so the real implementation is not required.
|
|
22
|
-
*
|
|
23
|
-
* @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md#environ_get
|
|
24
|
-
*/
|
|
25
|
-
environ_get(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Retrieves the environment variable sizes from the WebAssembly environment.
|
|
28
|
-
* This function is part of the WASI API and provides a dummy implementation to fulfill the expected APIs.
|
|
29
|
-
* It does not have any actual functionality, but serves as a placeholder in the environment.
|
|
30
|
-
*/
|
|
31
|
-
environ_sizes_get(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Closes a file descriptor, releasing any resources associated with it.
|
|
34
|
-
* This function does not perform any actual closing operation, but exists to
|
|
35
|
-
* satisfy the requirements of the WebAssembly System Interface (WASI) API,
|
|
36
|
-
* which expects certain functions to be present for compatibility purposes.
|
|
37
|
-
*
|
|
38
|
-
* @see https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
|
|
39
|
-
*/
|
|
40
|
-
fd_close(): void;
|
|
41
|
-
/**
|
|
42
|
-
* A dummy implementation of the 'fd_read' function from the WASI API.
|
|
43
|
-
* This function is required by the environment, but not used in this context.
|
|
44
|
-
* It would normally read data from a file descriptor into an array buffer,
|
|
45
|
-
* but here it simply logs the invocation for debugging purposes.
|
|
46
|
-
*/
|
|
47
|
-
fd_read(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Handles the file descriptor write operation.
|
|
50
|
-
* This dummy implementation of the WASI 'fd_write' function is part of the wasi API:
|
|
51
|
-
* https://github.com/WebAssembly/WASI/blob/main/phases/snapshot/docs.md
|
|
52
|
-
* The environment expects this function, but it is not used in the current implementation.
|
|
53
|
-
* It is used to write data from WebAssembly memory to a file descriptor.
|
|
54
|
-
*/
|
|
55
|
-
fd_write(): void;
|
|
56
|
-
/**
|
|
57
|
-
* Perform a file seek operation on the given file descriptor to change its current position.
|
|
58
|
-
* The new position is calculated using the provided offset and whence values.
|
|
59
|
-
* Throws an error if the file descriptor is invalid or the operation cannot be performed.
|
|
60
|
-
*
|
|
61
|
-
* @param fd - The file descriptor of the file to perform the seek operation on.
|
|
62
|
-
* @param offset - The relative offset to apply, based on the whence value.
|
|
63
|
-
* @param whence - The reference point from which the offset should be calculated. One of SEEK_SET (start), SEEK_CUR (current), or SEEK_END (end).
|
|
64
|
-
* @returns The new position in the file after the seek operation has been performed.
|
|
65
|
-
*/
|
|
66
|
-
fd_seek(): void;
|
|
67
|
-
/**
|
|
68
|
-
* This function is a dummy implementation of the 'fd_fdstat_get' function in the WebAssembly System Interface (WASI) API.
|
|
69
|
-
* Although not actually used in this context, it is present due to the environment's expectation of its existence.
|
|
70
|
-
* The 'fd_fdstat_get' function is typically responsible for obtaining file descriptor status information.
|
|
71
|
-
*/
|
|
72
|
-
fd_fdstat_get(): void;
|
|
73
|
-
/**
|
|
74
|
-
* Sets the file descriptor flags for a given file descriptor.
|
|
75
|
-
* This function is a dummy implementation of the WASI API function 'fd_fdstat_set_flags'.
|
|
76
|
-
* It currently does not perform any operation but logs the function call with a debug instance.
|
|
77
|
-
* This is provided since the environment expects this function to be present.
|
|
78
|
-
*/
|
|
79
|
-
fd_fdstat_set_flags(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Handles the `fd_prestat_get` function call for the dummy WebAssembly System Interface (WASI) implementation.
|
|
82
|
-
* This function is expected by the WASI environment, although it is not used in this implementation.
|
|
83
|
-
* The `fd_prestat_get` function retrieves pre-opened file descriptor properties.
|
|
84
|
-
*
|
|
85
|
-
* @returns A constant integer value indicating successful completion of the function call.
|
|
86
|
-
*/
|
|
87
|
-
fd_prestat_get(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Provides a dummy implementation for the `fd_prestat_dir_name` function, which is expected to be called by the WASI environment.
|
|
90
|
-
* This function is intended to retrieve the pre-opened directory's path associated with the given file descriptor. However, since it's a dummy implementation,
|
|
91
|
-
* it doesn't perform any actual operation and only logs the function call with the provided debug logger.
|
|
92
|
-
*
|
|
93
|
-
* @returns A constant number representing a dummy return value for the function call.
|
|
94
|
-
*/
|
|
95
|
-
fd_prestat_dir_name(): number;
|
|
96
|
-
/**
|
|
97
|
-
* Handles the opening of a file path within the WASI environment.
|
|
98
|
-
* This function is a dummy implementation required for compatibility with
|
|
99
|
-
* the WebAssembly System Interface (WASI) API, but it does not perform any
|
|
100
|
-
* actual file opening operation. It is mainly used for debugging purposes.
|
|
101
|
-
*/
|
|
102
|
-
path_open(): void;
|
|
103
|
-
/**
|
|
104
|
-
* Retrieve file system information of the specified path.
|
|
105
|
-
* This function retrieves statistics, such as size and permissions, associated with the file or directory
|
|
106
|
-
* identified by the given path. In case of an error or non-existing path, appropriate debug logs will be generated.
|
|
107
|
-
*
|
|
108
|
-
* @returns An object containing file statistics like size, permissions, etc.
|
|
109
|
-
*/
|
|
110
|
-
path_filestat_get(): void;
|
|
111
|
-
/**
|
|
112
|
-
* Terminate the process normally, performing the regular cleanup for terminating programs.
|
|
113
|
-
* The input 'status' represents the exit code and is used to indicate success or failure
|
|
114
|
-
* of the program execution. A zero value typically indicates successful execution,
|
|
115
|
-
* while non-zero values are treated as errors by the operating system.
|
|
116
|
-
*
|
|
117
|
-
* @param status - The exit code representing the success or failure of the program execution.
|
|
118
|
-
* @returns The exit status code.
|
|
119
|
-
*/
|
|
120
|
-
proc_exit(): number;
|
|
121
|
-
/**
|
|
122
|
-
* Generates a random number and returns it.
|
|
123
|
-
* This dummy implementation of 'random_get' method in the wasi API is expected by the environment.
|
|
124
|
-
* In this case, the function always returns 1 to maintain consistency with the environment's expectations.
|
|
125
|
-
*
|
|
126
|
-
* @returns A random number. In this implementation, always returns 1.
|
|
127
|
-
*/
|
|
128
|
-
random_get(): number;
|
|
129
|
-
};
|
|
130
|
-
//# sourceMappingURL=empty_wasi_sdk.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"empty_wasi_sdk.d.ts","sourceRoot":"","sources":["../../src/wasm/empty_wasi_sdk.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,eAAO,MAAM,eAAe;IAC1B;;;;;;;OAOG;;IAIH;;;;;;;OAOG;;IAIH;;;;OAIG;;IAIH;;;;;;;OAOG;;IAIH;;;;;OAKG;;IAIH;;;;;;OAMG;;IAIH;;;;;;;;;OASG;;IAIH;;;;OAIG;;IAIH;;;;;OAKG;;IAIH;;;;;;OAMG;;IAKH;;;;;;OAMG;;IAKH;;;;;OAKG;;IAIH;;;;;;OAMG;;IAIH;;;;;;;;OAQG;;IAKH;;;;;;OAMG;;CAKH,CAAC"}
|