@aztec/foundation 0.6.7 → 0.7.2
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/Dockerfile +15 -0
- package/package.json +1 -1
- package/src/abi/abi.ts +1 -1
- package/src/abi/decoder.test.ts +77 -0
- package/src/abi/decoder.ts +33 -10
- package/.tsbuildinfo +0 -1
- package/dest/abi/abi.d.ts +0 -232
- package/dest/abi/abi.d.ts.map +0 -1
- package/dest/abi/abi.js +0 -37
- package/dest/abi/abi_coder.d.ts +0 -8
- package/dest/abi/abi_coder.d.ts.map +0 -1
- package/dest/abi/abi_coder.js +0 -24
- package/dest/abi/decoder.d.ts +0 -42
- package/dest/abi/decoder.d.ts.map +0 -1
- package/dest/abi/decoder.js +0 -129
- package/dest/abi/encoder.d.ts +0 -10
- package/dest/abi/encoder.d.ts.map +0 -1
- package/dest/abi/encoder.js +0 -89
- package/dest/abi/encoder.test.d.ts +0 -2
- package/dest/abi/encoder.test.d.ts.map +0 -1
- package/dest/abi/encoder.test.js +0 -74
- package/dest/abi/function_selector.d.ts +0 -73
- package/dest/abi/function_selector.d.ts.map +0 -1
- package/dest/abi/function_selector.js +0 -104
- package/dest/abi/index.d.ts +0 -6
- package/dest/abi/index.d.ts.map +0 -1
- package/dest/abi/index.js +0 -6
- package/dest/async-map/async_map.test.d.ts +0 -2
- package/dest/async-map/async_map.test.d.ts.map +0 -1
- package/dest/async-map/async_map.test.js +0 -9
- package/dest/async-map/index.d.ts +0 -13
- package/dest/async-map/index.d.ts.map +0 -1
- package/dest/async-map/index.js +0 -19
- package/dest/aztec-address/index.d.ts +0 -114
- package/dest/aztec-address/index.d.ts.map +0 -1
- package/dest/aztec-address/index.js +0 -148
- package/dest/bigint-buffer/bigint-buffer.test.d.ts +0 -2
- package/dest/bigint-buffer/bigint-buffer.test.d.ts.map +0 -1
- package/dest/bigint-buffer/bigint-buffer.test.js +0 -18
- package/dest/bigint-buffer/index.d.ts +0 -35
- package/dest/bigint-buffer/index.d.ts.map +0 -1
- package/dest/bigint-buffer/index.js +0 -68
- package/dest/collection/array.d.ts +0 -30
- package/dest/collection/array.d.ts.map +0 -1
- package/dest/collection/array.js +0 -47
- package/dest/collection/index.d.ts +0 -2
- package/dest/collection/index.d.ts.map +0 -1
- package/dest/collection/index.js +0 -2
- package/dest/committable/committable.d.ts +0 -28
- package/dest/committable/committable.d.ts.map +0 -1
- package/dest/committable/committable.js +0 -41
- package/dest/committable/committable.test.d.ts +0 -2
- package/dest/committable/committable.test.d.ts.map +0 -1
- package/dest/committable/committable.test.js +0 -26
- package/dest/committable/index.d.ts +0 -2
- package/dest/committable/index.d.ts.map +0 -1
- package/dest/committable/index.js +0 -2
- package/dest/crypto/index.d.ts +0 -4
- package/dest/crypto/index.d.ts.map +0 -1
- package/dest/crypto/index.js +0 -4
- package/dest/crypto/keccak/index.d.ts +0 -20
- package/dest/crypto/keccak/index.d.ts.map +0 -1
- package/dest/crypto/keccak/index.js +0 -31
- package/dest/crypto/random/index.d.ts +0 -3
- package/dest/crypto/random/index.d.ts.map +0 -1
- package/dest/crypto/random/index.js +0 -36
- package/dest/crypto/random/index.test.d.ts +0 -2
- package/dest/crypto/random/index.test.d.ts.map +0 -1
- package/dest/crypto/random/index.test.js +0 -13
- package/dest/crypto/sha256/index.d.ts +0 -11
- package/dest/crypto/sha256/index.d.ts.map +0 -1
- package/dest/crypto/sha256/index.js +0 -14
- package/dest/crypto/sha256/index.test.d.ts +0 -2
- package/dest/crypto/sha256/index.test.d.ts.map +0 -1
- package/dest/crypto/sha256/index.test.js +0 -11
- package/dest/errors/index.d.ts +0 -8
- package/dest/errors/index.d.ts.map +0 -1
- package/dest/errors/index.js +0 -8
- package/dest/eth-address/eth_address.test.d.ts +0 -2
- package/dest/eth-address/eth_address.test.d.ts.map +0 -1
- package/dest/eth-address/eth_address.test.js +0 -95
- package/dest/eth-address/index.d.ts +0 -144
- package/dest/eth-address/index.d.ts.map +0 -1
- package/dest/eth-address/index.js +0 -228
- package/dest/fields/coordinate.d.ts +0 -67
- package/dest/fields/coordinate.d.ts.map +0 -1
- package/dest/fields/coordinate.js +0 -95
- package/dest/fields/coordinate.test.d.ts +0 -2
- package/dest/fields/coordinate.test.d.ts.map +0 -1
- package/dest/fields/coordinate.test.js +0 -22
- package/dest/fields/fields.d.ts +0 -177
- package/dest/fields/fields.d.ts.map +0 -1
- package/dest/fields/fields.js +0 -219
- package/dest/fields/grumpkin_scalar.d.ts +0 -96
- package/dest/fields/grumpkin_scalar.d.ts.map +0 -1
- package/dest/fields/grumpkin_scalar.js +0 -125
- package/dest/fields/grumpkin_scalar.test.d.ts +0 -2
- package/dest/fields/grumpkin_scalar.test.d.ts.map +0 -1
- package/dest/fields/grumpkin_scalar.test.js +0 -45
- package/dest/fields/index.d.ts +0 -5
- package/dest/fields/index.d.ts.map +0 -1
- package/dest/fields/index.js +0 -5
- package/dest/fields/point.d.ts +0 -105
- package/dest/fields/point.d.ts.map +0 -1
- package/dest/fields/point.js +0 -125
- package/dest/fifo/bounded_serial_queue.d.ts +0 -56
- package/dest/fifo/bounded_serial_queue.d.ts.map +0 -1
- package/dest/fifo/bounded_serial_queue.js +0 -94
- package/dest/fifo/index.d.ts +0 -5
- package/dest/fifo/index.d.ts.map +0 -1
- package/dest/fifo/index.js +0 -5
- package/dest/fifo/memory_fifo.d.ts +0 -55
- package/dest/fifo/memory_fifo.d.ts.map +0 -1
- package/dest/fifo/memory_fifo.js +0 -109
- package/dest/fifo/semaphore.d.ts +0 -23
- package/dest/fifo/semaphore.d.ts.map +0 -1
- package/dest/fifo/semaphore.js +0 -30
- package/dest/fifo/serial_queue.d.ts +0 -48
- package/dest/fifo/serial_queue.d.ts.map +0 -1
- package/dest/fifo/serial_queue.js +0 -74
- package/dest/json-rpc/class_converter.d.ts +0 -144
- package/dest/json-rpc/class_converter.d.ts.map +0 -1
- package/dest/json-rpc/class_converter.js +0 -100
- package/dest/json-rpc/client/index.d.ts +0 -2
- package/dest/json-rpc/client/index.d.ts.map +0 -1
- package/dest/json-rpc/client/index.js +0 -2
- package/dest/json-rpc/client/json_rpc_client.d.ts +0 -29
- package/dest/json-rpc/client/json_rpc_client.d.ts.map +0 -1
- package/dest/json-rpc/client/json_rpc_client.js +0 -104
- package/dest/json-rpc/client/json_rpc_client.test.d.ts +0 -2
- package/dest/json-rpc/client/json_rpc_client.test.d.ts.map +0 -1
- package/dest/json-rpc/client/json_rpc_client.test.js +0 -20
- package/dest/json-rpc/convert.d.ts +0 -28
- package/dest/json-rpc/convert.d.ts.map +0 -1
- package/dest/json-rpc/convert.js +0 -139
- package/dest/json-rpc/convert.test.d.ts +0 -2
- package/dest/json-rpc/convert.test.d.ts.map +0 -1
- package/dest/json-rpc/convert.test.js +0 -68
- 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_a.js +0 -17
- 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/class_b.js +0 -17
- package/dest/json-rpc/fixtures/test_state.d.ts +0 -47
- package/dest/json-rpc/fixtures/test_state.d.ts.map +0 -1
- package/dest/json-rpc/fixtures/test_state.js +0 -62
- package/dest/json-rpc/index.d.ts +0 -3
- package/dest/json-rpc/index.d.ts.map +0 -1
- package/dest/json-rpc/index.js +0 -3
- 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/js_utils.js +0 -18
- package/dest/json-rpc/server/index.d.ts +0 -3
- package/dest/json-rpc/server/index.d.ts.map +0 -1
- package/dest/json-rpc/server/index.js +0 -3
- package/dest/json-rpc/server/json_proxy.d.ts +0 -18
- package/dest/json-rpc/server/json_proxy.d.ts.map +0 -1
- package/dest/json-rpc/server/json_proxy.js +0 -36
- package/dest/json-rpc/server/json_rpc_server.d.ts +0 -34
- package/dest/json-rpc/server/json_rpc_server.d.ts.map +0 -1
- package/dest/json-rpc/server/json_rpc_server.js +0 -133
- package/dest/json-rpc/server/json_rpc_server.test.d.ts +0 -2
- package/dest/json-rpc/server/json_rpc_server.test.d.ts.map +0 -1
- package/dest/json-rpc/server/json_rpc_server.test.js +0 -22
- package/dest/log/console.d.ts +0 -11
- package/dest/log/console.d.ts.map +0 -1
- package/dest/log/console.js +0 -38
- package/dest/log/debug.d.ts +0 -43
- package/dest/log/debug.d.ts.map +0 -1
- package/dest/log/debug.js +0 -75
- package/dest/log/index.d.ts +0 -9
- package/dest/log/index.d.ts.map +0 -1
- package/dest/log/index.js +0 -5
- 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 -42
- package/dest/log/log_history.test.d.ts +0 -2
- package/dest/log/log_history.test.d.ts.map +0 -1
- package/dest/log/log_history.test.js +0 -78
- package/dest/log/logger.d.ts +0 -34
- package/dest/log/logger.d.ts.map +0 -1
- package/dest/log/logger.js +0 -78
- package/dest/mutex/index.d.ts +0 -53
- package/dest/mutex/index.d.ts.map +0 -1
- package/dest/mutex/index.js +0 -74
- package/dest/mutex/mutex.test.d.ts +0 -9
- package/dest/mutex/mutex.test.d.ts.map +0 -1
- package/dest/mutex/mutex.test.js +0 -58
- package/dest/mutex/mutex_database.d.ts +0 -10
- package/dest/mutex/mutex_database.d.ts.map +0 -1
- package/dest/mutex/mutex_database.js +0 -2
- package/dest/retry/index.d.ts +0 -44
- package/dest/retry/index.d.ts.map +0 -1
- package/dest/retry/index.js +0 -89
- package/dest/running-promise/index.d.ts +0 -35
- package/dest/running-promise/index.d.ts.map +0 -1
- package/dest/running-promise/index.js +0 -59
- package/dest/serialize/buffer_reader.d.ts +0 -188
- package/dest/serialize/buffer_reader.d.ts.map +0 -1
- package/dest/serialize/buffer_reader.js +0 -229
- package/dest/serialize/buffer_reader.test.d.ts +0 -2
- package/dest/serialize/buffer_reader.test.d.ts.map +0 -1
- package/dest/serialize/buffer_reader.test.js +0 -156
- package/dest/serialize/deserializer.d.ts +0 -134
- package/dest/serialize/deserializer.d.ts.map +0 -1
- package/dest/serialize/deserializer.js +0 -145
- package/dest/serialize/free_funcs.d.ts +0 -203
- package/dest/serialize/free_funcs.d.ts.map +0 -1
- package/dest/serialize/free_funcs.js +0 -250
- package/dest/serialize/index.d.ts +0 -6
- package/dest/serialize/index.d.ts.map +0 -1
- package/dest/serialize/index.js +0 -6
- package/dest/serialize/serialize.test.d.ts +0 -2
- package/dest/serialize/serialize.test.d.ts.map +0 -1
- package/dest/serialize/serialize.test.js +0 -68
- package/dest/serialize/serializer.d.ts +0 -89
- package/dest/serialize/serializer.d.ts.map +0 -1
- package/dest/serialize/serializer.js +0 -111
- package/dest/serialize/types.d.ts +0 -33
- package/dest/serialize/types.d.ts.map +0 -1
- package/dest/serialize/types.js +0 -22
- package/dest/sleep/index.d.ts +0 -52
- package/dest/sleep/index.d.ts.map +0 -1
- package/dest/sleep/index.js +0 -70
- package/dest/timer/index.d.ts +0 -3
- package/dest/timer/index.d.ts.map +0 -1
- package/dest/timer/index.js +0 -3
- package/dest/timer/timeout.d.ts +0 -41
- package/dest/timer/timeout.d.ts.map +0 -1
- package/dest/timer/timeout.js +0 -62
- package/dest/timer/timer.d.ts +0 -33
- package/dest/timer/timer.d.ts.map +0 -1
- package/dest/timer/timer.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 -5
- 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 -46
- 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 -21
- 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 -37
- 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 -39
- 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_fn.js +0 -18
- 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/create_dispatch_proxy.js +0 -56
- package/dest/transport/dispatch/messages.d.ts +0 -52
- package/dest/transport/dispatch/messages.d.ts.map +0 -1
- package/dest/transport/dispatch/messages.js +0 -12
- package/dest/transport/index.d.ts +0 -12
- package/dest/transport/index.d.ts.map +0 -1
- package/dest/transport/index.js +0 -12
- package/dest/transport/interface/connector.d.ts +0 -8
- package/dest/transport/interface/connector.d.ts.map +0 -1
- package/dest/transport/interface/connector.js +0 -2
- package/dest/transport/interface/listener.d.ts +0 -13
- package/dest/transport/interface/listener.d.ts.map +0 -1
- package/dest/transport/interface/listener.js +0 -2
- package/dest/transport/interface/socket.d.ts +0 -13
- package/dest/transport/interface/socket.d.ts.map +0 -1
- package/dest/transport/interface/socket.js +0 -2
- package/dest/transport/interface/transferable.d.ts +0 -68
- package/dest/transport/interface/transferable.d.ts.map +0 -1
- package/dest/transport/interface/transferable.js +0 -63
- package/dest/transport/node/index.d.ts +0 -3
- package/dest/transport/node/index.d.ts.map +0 -1
- package/dest/transport/node/index.js +0 -3
- 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.js +0 -28
- 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_connector_socket.js +0 -48
- 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.js +0 -30
- 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/node/node_listener_socket.js +0 -44
- package/dest/transport/transport_client.d.ts +0 -61
- package/dest/transport/transport_client.d.ts.map +0 -1
- package/dest/transport/transport_client.js +0 -94
- package/dest/transport/transport_server.d.ts +0 -56
- package/dest/transport/transport_server.d.ts.map +0 -1
- package/dest/transport/transport_server.js +0 -101
- package/dest/types/index.d.ts +0 -7
- package/dest/types/index.d.ts.map +0 -1
- package/dest/types/index.js +0 -2
- package/dest/url/index.d.ts +0 -9
- package/dest/url/index.d.ts.map +0 -1
- package/dest/url/index.js +0 -66
- 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 -166
- package/dest/wasm/index.d.ts +0 -2
- package/dest/wasm/index.d.ts.map +0 -1
- package/dest/wasm/index.js +0 -2
- package/dest/wasm/wasm_module.d.ts +0 -135
- package/dest/wasm/wasm_module.d.ts.map +0 -1
- package/dest/wasm/wasm_module.js +0 -205
- package/dest/wasm/wasm_module.test.d.ts +0 -2
- package/dest/wasm/wasm_module.test.d.ts.map +0 -1
- package/dest/wasm/wasm_module.test.js +0 -24
- 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 -3
- 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 -22
- package/dest/worker/browser/web_data_store.d.ts +0 -23
- package/dest/worker/browser/web_data_store.d.ts.map +0 -1
- package/dest/worker/browser/web_data_store.js +0 -32
- 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 -23
- package/dest/worker/data_store.d.ts +0 -20
- package/dest/worker/data_store.d.ts.map +0 -1
- package/dest/worker/data_store.js +0 -2
- package/dest/worker/index.d.ts +0 -3
- package/dest/worker/index.d.ts.map +0 -1
- package/dest/worker/index.js +0 -2
- 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 -3
- package/dest/worker/node/node_data_store.d.ts +0 -12
- package/dest/worker/node/node_data_store.d.ts.map +0 -1
- package/dest/worker/node/node_data_store.js +0 -21
- 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 -20
- 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 -26
- 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 -2
- 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 -62
package/dest/abi/encoder.test.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ABIParameterVisibility, FunctionType } from './abi.js';
|
|
2
|
-
import { encodeArguments } from './encoder.js';
|
|
3
|
-
describe('abi/encoder', () => {
|
|
4
|
-
it('throws when passing string argument as field', () => {
|
|
5
|
-
const testFunctionAbi = {
|
|
6
|
-
name: 'constructor',
|
|
7
|
-
functionType: FunctionType.SECRET,
|
|
8
|
-
isInternal: false,
|
|
9
|
-
parameters: [
|
|
10
|
-
{
|
|
11
|
-
name: 'owner',
|
|
12
|
-
type: {
|
|
13
|
-
kind: 'field',
|
|
14
|
-
},
|
|
15
|
-
visibility: ABIParameterVisibility.SECRET,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
returnTypes: [],
|
|
19
|
-
bytecode: '',
|
|
20
|
-
verificationKey: '',
|
|
21
|
-
};
|
|
22
|
-
const args = ['garbage'];
|
|
23
|
-
expect(() => encodeArguments(testFunctionAbi, args)).toThrowError('Invalid argument "garbage" of type field');
|
|
24
|
-
});
|
|
25
|
-
it('throws when passing string argument as integer', () => {
|
|
26
|
-
const testFunctionAbi = {
|
|
27
|
-
name: 'constructor',
|
|
28
|
-
functionType: FunctionType.SECRET,
|
|
29
|
-
isInternal: false,
|
|
30
|
-
parameters: [
|
|
31
|
-
{
|
|
32
|
-
name: 'isOwner',
|
|
33
|
-
type: {
|
|
34
|
-
sign: 'value',
|
|
35
|
-
width: 5,
|
|
36
|
-
kind: 'integer',
|
|
37
|
-
},
|
|
38
|
-
visibility: ABIParameterVisibility.SECRET,
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
returnTypes: [],
|
|
42
|
-
bytecode: '',
|
|
43
|
-
verificationKey: '',
|
|
44
|
-
};
|
|
45
|
-
const args = ['garbage'];
|
|
46
|
-
expect(() => encodeArguments(testFunctionAbi, args)).toThrowError('Cannot convert garbage to a BigInt');
|
|
47
|
-
});
|
|
48
|
-
it('throws when passing object argument as field', () => {
|
|
49
|
-
const testFunctionAbi = {
|
|
50
|
-
name: 'constructor',
|
|
51
|
-
functionType: FunctionType.SECRET,
|
|
52
|
-
isInternal: false,
|
|
53
|
-
parameters: [
|
|
54
|
-
{
|
|
55
|
-
name: 'owner',
|
|
56
|
-
type: {
|
|
57
|
-
kind: 'field',
|
|
58
|
-
},
|
|
59
|
-
visibility: ABIParameterVisibility.SECRET,
|
|
60
|
-
},
|
|
61
|
-
],
|
|
62
|
-
returnTypes: [],
|
|
63
|
-
bytecode: '',
|
|
64
|
-
verificationKey: '',
|
|
65
|
-
};
|
|
66
|
-
const args = [
|
|
67
|
-
{
|
|
68
|
-
value: 'garbage',
|
|
69
|
-
},
|
|
70
|
-
];
|
|
71
|
-
expect(() => encodeArguments(testFunctionAbi, args)).toThrowError('Argument for owner cannot be serialised to a field');
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW5jb2Rlci50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2FiaS9lbmNvZGVyLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLHNCQUFzQixFQUFlLFlBQVksRUFBRSxNQUFNLFVBQVUsQ0FBQztBQUM3RSxPQUFPLEVBQUUsZUFBZSxFQUFFLE1BQU0sY0FBYyxDQUFDO0FBRS9DLFFBQVEsQ0FBQyxhQUFhLEVBQUUsR0FBRyxFQUFFO0lBQzNCLEVBQUUsQ0FBQyw4Q0FBOEMsRUFBRSxHQUFHLEVBQUU7UUFDdEQsTUFBTSxlQUFlLEdBQWdCO1lBQ25DLElBQUksRUFBRSxhQUFhO1lBQ25CLFlBQVksRUFBRSxZQUFZLENBQUMsTUFBTTtZQUNqQyxVQUFVLEVBQUUsS0FBSztZQUNqQixVQUFVLEVBQUU7Z0JBQ1Y7b0JBQ0UsSUFBSSxFQUFFLE9BQU87b0JBQ2IsSUFBSSxFQUFFO3dCQUNKLElBQUksRUFBRSxPQUFPO3FCQUNkO29CQUNELFVBQVUsRUFBRSxzQkFBc0IsQ0FBQyxNQUFNO2lCQUMxQzthQUNGO1lBQ0QsV0FBVyxFQUFFLEVBQUU7WUFDZixRQUFRLEVBQUUsRUFBRTtZQUNaLGVBQWUsRUFBRSxFQUFFO1NBQ3BCLENBQUM7UUFDRixNQUFNLElBQUksR0FBRyxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBRXpCLE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxlQUFlLENBQUMsZUFBZSxFQUFFLElBQUksQ0FB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UFFO3dCQUNKLElBQUksRUFBRSxPQUFPO3FCQUNkO29CQUNELFVBQVUsRUFBRSxzQkFBc0IsQ0FBQyxNQUFNO2lCQUMxQzthQUNGO1lBQ0QsV0FBVyxFQUFFLEVBQUU7WUFDZixRQUFRLEVBQUUsRUFBRTtZQUNaLGVBQWUsRUFBRSxFQUFFO1NBQ3BCLENBQUM7UUFDRixNQUFNLElBQUksR0FBRztZQUNYO2dCQUNFLEtBQUssRUFBRSxTQUFTO2FBQ2pCO1NBQ0YsQ0FBQztRQUVGLE1BQU0sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxlQUFlLENBQUMsZUFBZSxFQUFFLElBQUksQ0FBQyxDQUFDLENBQUMsWUFBWSxDQUMvRCxvREFBb0QsQ0FDckQsQ0FBQztJQUNKLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDLENBQUMifQ==
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { ABIParameter } from '@aztec/foundation/abi';
|
|
3
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
4
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
5
|
-
/**
|
|
6
|
-
* A function selector is the first 4 bytes of the hash of a function signature.
|
|
7
|
-
*/
|
|
8
|
-
export declare class FunctionSelector {
|
|
9
|
-
value: number;
|
|
10
|
-
/**
|
|
11
|
-
* The size of the function selector in bytes.
|
|
12
|
-
*/
|
|
13
|
-
static SIZE: number;
|
|
14
|
-
constructor(/** number representing the function selector */ value: number);
|
|
15
|
-
/**
|
|
16
|
-
* Checks if the function selector is empty (all bytes are 0).
|
|
17
|
-
* @returns True if the function selector is empty (all bytes are 0).
|
|
18
|
-
*/
|
|
19
|
-
isEmpty(): boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Serialize as a buffer.
|
|
22
|
-
* @returns The buffer.
|
|
23
|
-
*/
|
|
24
|
-
toBuffer(): Buffer;
|
|
25
|
-
/**
|
|
26
|
-
* Serialize as a hex string.
|
|
27
|
-
* @returns The string.
|
|
28
|
-
*/
|
|
29
|
-
toString(): string;
|
|
30
|
-
/**
|
|
31
|
-
* Checks if this function selector is equal to another.
|
|
32
|
-
* @param other - The other function selector.
|
|
33
|
-
* @returns True if the function selectors are equal.
|
|
34
|
-
*/
|
|
35
|
-
equals(other: FunctionSelector): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Deserializes from a buffer or reader, corresponding to a write in cpp.
|
|
38
|
-
* @param buffer - Buffer or BufferReader to read from.
|
|
39
|
-
* @returns The FunctionSelector.
|
|
40
|
-
*/
|
|
41
|
-
static fromBuffer(buffer: Buffer | BufferReader): FunctionSelector;
|
|
42
|
-
/**
|
|
43
|
-
* Returns a new field with the same contents as this EthAddress.
|
|
44
|
-
*
|
|
45
|
-
* @returns An Fr instance.
|
|
46
|
-
*/
|
|
47
|
-
toField(): Fr;
|
|
48
|
-
/**
|
|
49
|
-
* Converts a field to function selector.
|
|
50
|
-
* @param fr - The field to convert.
|
|
51
|
-
* @returns The function selector.
|
|
52
|
-
*/
|
|
53
|
-
static fromField(fr: Fr): FunctionSelector;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a function selector from a signature.
|
|
56
|
-
* @param signature - Signature of the function to generate the selector for (e.g. "transfer(field,field)").
|
|
57
|
-
* @returns Function selector.
|
|
58
|
-
*/
|
|
59
|
-
static fromSignature(signature: string): FunctionSelector;
|
|
60
|
-
/**
|
|
61
|
-
* Creates a function selector for a given function name and parameters.
|
|
62
|
-
* @param name - The name of the function.
|
|
63
|
-
* @param parameters - An array of ABIParameter objects, each containing the type information of a function parameter.
|
|
64
|
-
* @returns A Buffer containing the 4-byte function selector.
|
|
65
|
-
*/
|
|
66
|
-
static fromNameAndParameters(name: string, parameters: ABIParameter[]): FunctionSelector;
|
|
67
|
-
/**
|
|
68
|
-
* Creates an empty function selector.
|
|
69
|
-
* @returns An empty function selector.
|
|
70
|
-
*/
|
|
71
|
-
static empty(): FunctionSelector;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=function_selector.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function_selector.d.ts","sourceRoot":"","sources":["../../src/abi/function_selector.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,uBAAuB,CAAC;AAG9E,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;GAEG;AACH,qBAAa,gBAAgB;IAMyC,KAAK,EAAE,MAAM;IALjF;;OAEG;IACH,OAAc,IAAI,SAAK;gBAEX,gDAAgD,CAAQ,KAAK,EAAE,MAAM;IAMjF;;;OAGG;IACI,OAAO,IAAI,OAAO;IAIzB;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;OAGG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO;IAIxC;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,GAAG,gBAAgB;IAMlE;;;;OAIG;IACI,OAAO;IAId;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,GAAG,gBAAgB;IAI1C;;;;OAIG;IACH,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB;IAIzD;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE;IAQrE;;;OAGG;IACH,MAAM,CAAC,KAAK,IAAI,gBAAgB;CAGjC"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { decodeFunctionSignature } from '@aztec/foundation/abi';
|
|
2
|
-
import { toBigIntBE, toBufferBE } from '@aztec/foundation/bigint-buffer';
|
|
3
|
-
import { keccak } from '@aztec/foundation/crypto';
|
|
4
|
-
import { Fr } from '@aztec/foundation/fields';
|
|
5
|
-
import { BufferReader } from '@aztec/foundation/serialize';
|
|
6
|
-
/**
|
|
7
|
-
* A function selector is the first 4 bytes of the hash of a function signature.
|
|
8
|
-
*/
|
|
9
|
-
export class FunctionSelector {
|
|
10
|
-
constructor(/** number representing the function selector */ value) {
|
|
11
|
-
this.value = value;
|
|
12
|
-
if (value > 2 ** (FunctionSelector.SIZE * 8) - 1) {
|
|
13
|
-
throw new Error(`Function selector must fit in ${FunctionSelector.SIZE} bytes.`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Checks if the function selector is empty (all bytes are 0).
|
|
18
|
-
* @returns True if the function selector is empty (all bytes are 0).
|
|
19
|
-
*/
|
|
20
|
-
isEmpty() {
|
|
21
|
-
return this.value === 0;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Serialize as a buffer.
|
|
25
|
-
* @returns The buffer.
|
|
26
|
-
*/
|
|
27
|
-
toBuffer() {
|
|
28
|
-
return toBufferBE(BigInt(this.value), FunctionSelector.SIZE);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Serialize as a hex string.
|
|
32
|
-
* @returns The string.
|
|
33
|
-
*/
|
|
34
|
-
toString() {
|
|
35
|
-
return this.toBuffer().toString('hex');
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Checks if this function selector is equal to another.
|
|
39
|
-
* @param other - The other function selector.
|
|
40
|
-
* @returns True if the function selectors are equal.
|
|
41
|
-
*/
|
|
42
|
-
equals(other) {
|
|
43
|
-
return this.value === other.value;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Deserializes from a buffer or reader, corresponding to a write in cpp.
|
|
47
|
-
* @param buffer - Buffer or BufferReader to read from.
|
|
48
|
-
* @returns The FunctionSelector.
|
|
49
|
-
*/
|
|
50
|
-
static fromBuffer(buffer) {
|
|
51
|
-
const reader = BufferReader.asReader(buffer);
|
|
52
|
-
const value = Number(toBigIntBE(reader.readBytes(FunctionSelector.SIZE)));
|
|
53
|
-
return new FunctionSelector(value);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Returns a new field with the same contents as this EthAddress.
|
|
57
|
-
*
|
|
58
|
-
* @returns An Fr instance.
|
|
59
|
-
*/
|
|
60
|
-
toField() {
|
|
61
|
-
return new Fr(this.value);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Converts a field to function selector.
|
|
65
|
-
* @param fr - The field to convert.
|
|
66
|
-
* @returns The function selector.
|
|
67
|
-
*/
|
|
68
|
-
static fromField(fr) {
|
|
69
|
-
return new FunctionSelector(Number(fr.value));
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Creates a function selector from a signature.
|
|
73
|
-
* @param signature - Signature of the function to generate the selector for (e.g. "transfer(field,field)").
|
|
74
|
-
* @returns Function selector.
|
|
75
|
-
*/
|
|
76
|
-
static fromSignature(signature) {
|
|
77
|
-
return FunctionSelector.fromBuffer(keccak(Buffer.from(signature)).subarray(0, FunctionSelector.SIZE));
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Creates a function selector for a given function name and parameters.
|
|
81
|
-
* @param name - The name of the function.
|
|
82
|
-
* @param parameters - An array of ABIParameter objects, each containing the type information of a function parameter.
|
|
83
|
-
* @returns A Buffer containing the 4-byte function selector.
|
|
84
|
-
*/
|
|
85
|
-
static fromNameAndParameters(name, parameters) {
|
|
86
|
-
const signature = decodeFunctionSignature(name, parameters);
|
|
87
|
-
const selector = FunctionSelector.fromSignature(signature);
|
|
88
|
-
// If using the debug logger here it kill the typing in the `server_world_state_synchroniser` and jest tests.
|
|
89
|
-
// console.log(`Function selector for ${signature} is ${selector}`);
|
|
90
|
-
return selector;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Creates an empty function selector.
|
|
94
|
-
* @returns An empty function selector.
|
|
95
|
-
*/
|
|
96
|
-
static empty() {
|
|
97
|
-
return new FunctionSelector(0);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* The size of the function selector in bytes.
|
|
102
|
-
*/
|
|
103
|
-
FunctionSelector.SIZE = 4;
|
|
104
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnVuY3Rpb25fc2VsZWN0b3IuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWJpL2Z1bmN0aW9uX3NlbGVjdG9yLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBZ0IsdUJBQXVCLEVBQUUsTUFBTSx1QkFBdUIsQ0FBQztBQUM5RSxPQUFPLEVBQUUsVUFBVSxFQUFFLFVBQVUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQ3pFLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUNsRCxPQUFPLEVBQUUsRUFBRSxFQUFFLE1BQU0sMEJBQTBCLENBQUM7QUFDOUMsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBRTNEOztHQUVHO0FBQ0gsTUFBTSxPQUFPLGdCQUFnQjtJQU0zQixZQUFZLGdEQUFnRCxDQUFRLEtBQWE7UUFBYixVQUFLLEdBQUwsS0FBSyxDQUFRO1FBQy9FLElBQUksS0FBSyxHQUFHLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDLElBQUksR0FBRyxDQUFDLENBQUMsR0FBRyxDQUFDLEVBQUU7WUFDaEQsTUFBTSxJQUFJLEtBQUssQ0FBQyxpQ0FBaUMsZ0JBQWdCLENBQUMsSUFBSSxTQUFTLENBQUMsQ0FBQztTQUNsRjtJQUNILENBQUM7SUFFRDs7O09BR0c7SUFDSSxPQUFPO1FBQ1osT0FBTyxJQUFJLENBQUMsS0FBSy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UQ7Ozs7T0FJRztJQUNILE1BQU0sQ0FBQyxhQUFhLENBQUMsU0FBaUI7UUFDcEMsT0FBTyxnQkFBZ0IsQ0FBQyxVQUFVLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsQ0FBQyxRQUFRLENBQUMsQ0FBQyxFQUFFLGdCQUFnQixDQUFDLElBQUksQ0FBQyxDQUFDLENBQUM7SUFDeEcsQ0FBQztJQUVEOzs7OztPQUtHO0lBQ0gsTUFBTSxDQUFDLHFCQUFxQixDQUFDLElBQVksRUFBRSxVQUEwQjtRQUNuRSxNQUFNLFNBQVMsR0FBRyx1QkFBdUIsQ0FBQyxJQUFJLEVBQUUsVUFBVSxDQUFDLENBQUM7UUFDNUQsTUFBTSxRQUFRLEdBQUcsZ0JBQWdCLENBQUMsYUFBYSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQzNELDZHQUE2RztRQUM3RyxvRUFBb0U7UUFDcEUsT0FBTyxRQUFRLENBQUM7SUFDbEIsQ0FBQztJQUVEOzs7T0FHRztJQUNILE1BQU0sQ0FBQyxLQUFLO1FBQ1YsT0FBTyxJQUFJLGdCQUFnQixDQUFDLENBQUMsQ0FBQyxDQUFDO0lBQ2pDLENBQUM7O0FBdEdEOztHQUVHO0FBQ1cscUJBQUksR0FBRyxDQUFDLENBQUMifQ==
|
package/dest/abi/index.d.ts
DELETED
package/dest/abi/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/abi/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
package/dest/abi/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './abi.js';
|
|
2
|
-
export * from './abi_coder.js';
|
|
3
|
-
export * from './encoder.js';
|
|
4
|
-
export * from './decoder.js';
|
|
5
|
-
export * from './function_selector.js';
|
|
6
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYWJpL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyxjQUFjLENBQUM7QUFDN0IsY0FBYyx3QkFBd0IsQ0FBQyJ9
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async_map.test.d.ts","sourceRoot":"","sources":["../../src/async-map/async_map.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { asyncMap } from './index.js';
|
|
2
|
-
describe('asyncMap', () => {
|
|
3
|
-
test('execute list item sequentially', async () => {
|
|
4
|
-
const sleepAndLog = (ms, idx) => new Promise(resolve => setTimeout(() => resolve(idx), ms));
|
|
5
|
-
const result = await asyncMap([100, 0, 30, 1], (ms, i) => sleepAndLog(ms, i));
|
|
6
|
-
expect(result).toEqual([0, 1, 2, 3]);
|
|
7
|
-
});
|
|
8
|
-
});
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXN5bmNfbWFwLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXN5bmMtbWFwL2FzeW5jX21hcC50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxZQUFZLENBQUM7QUFFdEMsUUFBUSxDQUFDLFVBQVUsRUFBRSxHQUFHLEVBQUU7SUFDeEIsSUFBSSxDQUFDLGdDQUFnQyxFQUFFLEtBQUssSUFBSSxFQUFFO1FBQ2hELE1BQU0sV0FBVyxHQUFHLENBQUMsRUFBVSxFQUFFLEdBQVcsRUFBRSxFQUFFLENBQUMsSUFBSSxPQUFPLENBQUMsT0FBTyxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsR0FBRyxFQUFFLENBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFDNUcsTUFBTSxNQUFNLEdBQUcsTUFBTSxRQUFRLENBQUMsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxFQUFFLEVBQUUsRUFBRSxDQUFDLENBQUMsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDLFdBQVcsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUM5RSxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUN2QyxDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDIn0=
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps an array of elements by applying an asynchronous function to each element in sequence,
|
|
3
|
-
* and returns a new array with the results. The function receives each element of the array
|
|
4
|
-
* and its index as arguments, and should return a Promise that resolves to the desired value.
|
|
5
|
-
*
|
|
6
|
-
* @typeParam T - The original array element type.
|
|
7
|
-
* @typeParam U - The resulting array element type.
|
|
8
|
-
* @param arr - The array to map.
|
|
9
|
-
* @param fn - The async function to apply on each element of the array.
|
|
10
|
-
* @returns A Promise that resolves to a new array containing the mapped values.
|
|
11
|
-
*/
|
|
12
|
-
export declare function asyncMap<T, U>(arr: T[], fn: (e: T, i: number) => Promise<U>): Promise<U[]>;
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/async-map/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC,CAMhG"}
|
package/dest/async-map/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps an array of elements by applying an asynchronous function to each element in sequence,
|
|
3
|
-
* and returns a new array with the results. The function receives each element of the array
|
|
4
|
-
* and its index as arguments, and should return a Promise that resolves to the desired value.
|
|
5
|
-
*
|
|
6
|
-
* @typeParam T - The original array element type.
|
|
7
|
-
* @typeParam U - The resulting array element type.
|
|
8
|
-
* @param arr - The array to map.
|
|
9
|
-
* @param fn - The async function to apply on each element of the array.
|
|
10
|
-
* @returns A Promise that resolves to a new array containing the mapped values.
|
|
11
|
-
*/
|
|
12
|
-
export async function asyncMap(arr, fn) {
|
|
13
|
-
const results = [];
|
|
14
|
-
for (let i = 0; i < arr.length; ++i) {
|
|
15
|
-
results.push(await fn(arr[i], i));
|
|
16
|
-
}
|
|
17
|
-
return results;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXN5bmMtbWFwL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7O0dBVUc7QUFDSCxNQUFNLENBQUMsS0FBSyxVQUFVLFFBQVEsQ0FBTyxHQUFRLEVBQUUsRUFBbUM7SUFDaEYsTUFBTSxPQUFPLEdBQVEsRUFBRSxDQUFDO0lBQ3hCLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxHQUFHLENBQUMsTUFBTSxFQUFFLEVBQUUsQ0FBQyxFQUFFO1FBQ25DLE9BQU8sQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUM7S0FDbkM7SUFDRCxPQUFPLE9BQU8sQ0FBQztBQUNqQixDQUFDIn0=
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { Fr } from '../fields/index.js';
|
|
3
|
-
import { BufferReader } from '../serialize/buffer_reader.js';
|
|
4
|
-
/**
|
|
5
|
-
* AztecAddress represents a 32-byte address in the Aztec Protocol. It provides methods to create, manipulate, and
|
|
6
|
-
* compare addresses. The maximum value of an address is determined by the field modulus and all instances of AztecAddress
|
|
7
|
-
* should have a value less than or equal to this max value. This class also provides helper functions to convert
|
|
8
|
-
* addresses from strings, buffers, and other formats.
|
|
9
|
-
*/
|
|
10
|
-
export declare class AztecAddress {
|
|
11
|
-
/**
|
|
12
|
-
* The buffer field.
|
|
13
|
-
*/
|
|
14
|
-
readonly buffer: Buffer;
|
|
15
|
-
static SIZE_IN_BYTES: number;
|
|
16
|
-
static ZERO: AztecAddress;
|
|
17
|
-
static MODULUS: bigint;
|
|
18
|
-
static MAX_VALUE: bigint;
|
|
19
|
-
constructor(
|
|
20
|
-
/**
|
|
21
|
-
* The buffer field.
|
|
22
|
-
*/
|
|
23
|
-
buffer: Buffer);
|
|
24
|
-
/**
|
|
25
|
-
* Generates a random AztecAddress instance, using the Fr field (a finite field) to create a random value
|
|
26
|
-
* within a valid range and then converting it into a Buffer of a fixed size in bytes.
|
|
27
|
-
*
|
|
28
|
-
* @returns A new AztecAddress instance with a random value.
|
|
29
|
-
*/
|
|
30
|
-
static random(): AztecAddress;
|
|
31
|
-
/**
|
|
32
|
-
* Creates an AztecAddress instance from a given buffer or BufferReader.
|
|
33
|
-
* If the input is a Buffer, it wraps it in a BufferReader before processing.
|
|
34
|
-
* Throws an error if the input length is not equal to the expected size.
|
|
35
|
-
*
|
|
36
|
-
* @param buffer - The input buffer or BufferReader containing the address data.
|
|
37
|
-
* @returns - A new AztecAddress instance with the extracted address data.
|
|
38
|
-
*/
|
|
39
|
-
static fromBuffer(buffer: Buffer | BufferReader): AztecAddress;
|
|
40
|
-
/**
|
|
41
|
-
* Create an AztecAddress instance from a hex-encoded string.
|
|
42
|
-
* The input 'address' should be prefixed with '0x' or not, and have exactly 64 hex characters.
|
|
43
|
-
* Throws an error if the input length is invalid or address value is out of range.
|
|
44
|
-
*
|
|
45
|
-
* @param address - The hex-encoded string representing the Aztec address.
|
|
46
|
-
* @returns An AztecAddress instance.
|
|
47
|
-
*/
|
|
48
|
-
static fromString(address: string): AztecAddress;
|
|
49
|
-
/**
|
|
50
|
-
* Creates an AztecAddress from a bigint.
|
|
51
|
-
* The provided value must be within the range of a field.
|
|
52
|
-
* @param address - The bigint representation of the address.
|
|
53
|
-
* @returns An AztecAddress instance.
|
|
54
|
-
*/
|
|
55
|
-
static fromBigInt(address: bigint): AztecAddress;
|
|
56
|
-
/**
|
|
57
|
-
* Converts the AztecAddress instance into a Buffer.
|
|
58
|
-
* This method should be used when encoding the address for storage, transmission or serialization purposes.
|
|
59
|
-
*
|
|
60
|
-
* @returns A Buffer representation of the AztecAddress instance.
|
|
61
|
-
*/
|
|
62
|
-
toBuffer(): Buffer;
|
|
63
|
-
/**
|
|
64
|
-
* Convert the AztecAddress to a hexadecimal string representation, with a "0x" prefix.
|
|
65
|
-
* The resulting string will have a length of 66 characters (including the prefix).
|
|
66
|
-
*
|
|
67
|
-
* @returns A hexadecimal string representation of the AztecAddress.
|
|
68
|
-
*/
|
|
69
|
-
toString(): `0x${string}`;
|
|
70
|
-
/**
|
|
71
|
-
* Returns a shortened string representation of the AztecAddress, displaying only the first 10 characters and last 4 characters.
|
|
72
|
-
* This is useful for human-readable displays where the full address is not necessary.
|
|
73
|
-
*
|
|
74
|
-
* @returns A shortened string representation of the address.
|
|
75
|
-
*/
|
|
76
|
-
toShortString(): string;
|
|
77
|
-
/**
|
|
78
|
-
* Returns this address from a Field element.
|
|
79
|
-
* @param field - The Field element to convert.
|
|
80
|
-
* @returns An Address Object from a Field element with the same value.
|
|
81
|
-
*/
|
|
82
|
-
static fromField(field: Fr): AztecAddress;
|
|
83
|
-
/**
|
|
84
|
-
* Returns this address as a field element.
|
|
85
|
-
* @returns A field element with the same value as the address.
|
|
86
|
-
*/
|
|
87
|
-
toField(): Fr;
|
|
88
|
-
/**
|
|
89
|
-
* Returns this address as a bigint. Useful for creating maps indexed by addresses.
|
|
90
|
-
* @returns A bigint with the same value as the address.
|
|
91
|
-
*/
|
|
92
|
-
toBigInt(): bigint;
|
|
93
|
-
/**
|
|
94
|
-
* Determines if this AztecAddress instance is equal to the given AztecAddress instance.
|
|
95
|
-
* Equality is based on the content of their respective buffers.
|
|
96
|
-
*
|
|
97
|
-
* @param other - The AztecAddress instance to compare against.
|
|
98
|
-
* @returns True if the buffers of both instances are equal, false otherwise.
|
|
99
|
-
*/
|
|
100
|
-
equals(other: AztecAddress): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Checks if the AztecAddress is zero.
|
|
103
|
-
*
|
|
104
|
-
* @returns Returns true if the AztecAddress is equal to the zero address, otherwise returns false.
|
|
105
|
-
*/
|
|
106
|
-
isZero(): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Friendly representation for debugging purposes.
|
|
109
|
-
*
|
|
110
|
-
* @returns A hex string representing the address.
|
|
111
|
-
*/
|
|
112
|
-
toFriendlyJSON(): `0x${string}`;
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aztec-address/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D;;;;;GAKG;AACH,qBAAa,YAAY;IAOrB;;OAEG;aACa,MAAM,EAAE,MAAM;IAThC,MAAM,CAAC,aAAa,SAAM;IAC1B,MAAM,CAAC,IAAI,eAA8D;IACzE,MAAM,CAAC,OAAO,SAAuE;IACrF,MAAM,CAAC,SAAS,SAA6B;;IAG3C;;OAEG;IACa,MAAM,EAAE,MAAM;IAQhC;;;;;OAKG;IACH,MAAM,CAAC,MAAM;IAIb;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY;IAK/C;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM;IAQjC;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM;IAIjC;;;;;OAKG;IACH,QAAQ;IAIR;;;;;OAKG;IACH,QAAQ,IAAI,KAAK,MAAM,EAAE;IAIzB;;;;;OAKG;IACH,aAAa;IAKb;;;;OAIG;IACH,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,GAAG,YAAY;IAIzC;;;OAGG;IACH,OAAO;IAIP;;;OAGG;IACH,QAAQ;IAIR;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,YAAY;IAI1B;;;;OAIG;IACH,MAAM;IAIN;;;;OAIG;IACH,cAAc;CAGf"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { toBigIntBE, toBufferBE } from '../bigint-buffer/index.js';
|
|
2
|
-
import { Fr } from '../fields/index.js';
|
|
3
|
-
import { BufferReader } from '../serialize/buffer_reader.js';
|
|
4
|
-
/**
|
|
5
|
-
* AztecAddress represents a 32-byte address in the Aztec Protocol. It provides methods to create, manipulate, and
|
|
6
|
-
* compare addresses. The maximum value of an address is determined by the field modulus and all instances of AztecAddress
|
|
7
|
-
* should have a value less than or equal to this max value. This class also provides helper functions to convert
|
|
8
|
-
* addresses from strings, buffers, and other formats.
|
|
9
|
-
*/
|
|
10
|
-
export class AztecAddress {
|
|
11
|
-
constructor(
|
|
12
|
-
/**
|
|
13
|
-
* The buffer field.
|
|
14
|
-
*/
|
|
15
|
-
buffer) {
|
|
16
|
-
this.buffer = buffer;
|
|
17
|
-
const value = toBigIntBE(buffer);
|
|
18
|
-
if (value > AztecAddress.MAX_VALUE) {
|
|
19
|
-
throw new Error(`AztecAddress out of range ${value}.`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Generates a random AztecAddress instance, using the Fr field (a finite field) to create a random value
|
|
24
|
-
* within a valid range and then converting it into a Buffer of a fixed size in bytes.
|
|
25
|
-
*
|
|
26
|
-
* @returns A new AztecAddress instance with a random value.
|
|
27
|
-
*/
|
|
28
|
-
static random() {
|
|
29
|
-
return new AztecAddress(toBufferBE(Fr.random().value, AztecAddress.SIZE_IN_BYTES));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Creates an AztecAddress instance from a given buffer or BufferReader.
|
|
33
|
-
* If the input is a Buffer, it wraps it in a BufferReader before processing.
|
|
34
|
-
* Throws an error if the input length is not equal to the expected size.
|
|
35
|
-
*
|
|
36
|
-
* @param buffer - The input buffer or BufferReader containing the address data.
|
|
37
|
-
* @returns - A new AztecAddress instance with the extracted address data.
|
|
38
|
-
*/
|
|
39
|
-
static fromBuffer(buffer) {
|
|
40
|
-
const reader = BufferReader.asReader(buffer);
|
|
41
|
-
return new this(reader.readBytes(this.SIZE_IN_BYTES));
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Create an AztecAddress instance from a hex-encoded string.
|
|
45
|
-
* The input 'address' should be prefixed with '0x' or not, and have exactly 64 hex characters.
|
|
46
|
-
* Throws an error if the input length is invalid or address value is out of range.
|
|
47
|
-
*
|
|
48
|
-
* @param address - The hex-encoded string representing the Aztec address.
|
|
49
|
-
* @returns An AztecAddress instance.
|
|
50
|
-
*/
|
|
51
|
-
static fromString(address) {
|
|
52
|
-
const buf = Buffer.from(address.replace(/^0x/i, ''), 'hex');
|
|
53
|
-
if (buf.length !== AztecAddress.SIZE_IN_BYTES) {
|
|
54
|
-
throw new Error(`Invalid length ${buf.length}.`);
|
|
55
|
-
}
|
|
56
|
-
return new AztecAddress(buf);
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Creates an AztecAddress from a bigint.
|
|
60
|
-
* The provided value must be within the range of a field.
|
|
61
|
-
* @param address - The bigint representation of the address.
|
|
62
|
-
* @returns An AztecAddress instance.
|
|
63
|
-
*/
|
|
64
|
-
static fromBigInt(address) {
|
|
65
|
-
return new AztecAddress(toBufferBE(address, AztecAddress.SIZE_IN_BYTES));
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Converts the AztecAddress instance into a Buffer.
|
|
69
|
-
* This method should be used when encoding the address for storage, transmission or serialization purposes.
|
|
70
|
-
*
|
|
71
|
-
* @returns A Buffer representation of the AztecAddress instance.
|
|
72
|
-
*/
|
|
73
|
-
toBuffer() {
|
|
74
|
-
return this.buffer;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Convert the AztecAddress to a hexadecimal string representation, with a "0x" prefix.
|
|
78
|
-
* The resulting string will have a length of 66 characters (including the prefix).
|
|
79
|
-
*
|
|
80
|
-
* @returns A hexadecimal string representation of the AztecAddress.
|
|
81
|
-
*/
|
|
82
|
-
toString() {
|
|
83
|
-
return `0x${this.buffer.toString('hex')}`;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Returns a shortened string representation of the AztecAddress, displaying only the first 10 characters and last 4 characters.
|
|
87
|
-
* This is useful for human-readable displays where the full address is not necessary.
|
|
88
|
-
*
|
|
89
|
-
* @returns A shortened string representation of the address.
|
|
90
|
-
*/
|
|
91
|
-
toShortString() {
|
|
92
|
-
const str = this.toString();
|
|
93
|
-
return `${str.slice(0, 10)}...${str.slice(-4)}`;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Returns this address from a Field element.
|
|
97
|
-
* @param field - The Field element to convert.
|
|
98
|
-
* @returns An Address Object from a Field element with the same value.
|
|
99
|
-
*/
|
|
100
|
-
static fromField(field) {
|
|
101
|
-
return new AztecAddress(toBufferBE(field.value, AztecAddress.SIZE_IN_BYTES));
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns this address as a field element.
|
|
105
|
-
* @returns A field element with the same value as the address.
|
|
106
|
-
*/
|
|
107
|
-
toField() {
|
|
108
|
-
return Fr.fromBuffer(this.toBuffer());
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Returns this address as a bigint. Useful for creating maps indexed by addresses.
|
|
112
|
-
* @returns A bigint with the same value as the address.
|
|
113
|
-
*/
|
|
114
|
-
toBigInt() {
|
|
115
|
-
return toBigIntBE(this.buffer);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Determines if this AztecAddress instance is equal to the given AztecAddress instance.
|
|
119
|
-
* Equality is based on the content of their respective buffers.
|
|
120
|
-
*
|
|
121
|
-
* @param other - The AztecAddress instance to compare against.
|
|
122
|
-
* @returns True if the buffers of both instances are equal, false otherwise.
|
|
123
|
-
*/
|
|
124
|
-
equals(other) {
|
|
125
|
-
return this.buffer.equals(other.buffer);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Checks if the AztecAddress is zero.
|
|
129
|
-
*
|
|
130
|
-
* @returns Returns true if the AztecAddress is equal to the zero address, otherwise returns false.
|
|
131
|
-
*/
|
|
132
|
-
isZero() {
|
|
133
|
-
return this.equals(AztecAddress.ZERO);
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Friendly representation for debugging purposes.
|
|
137
|
-
*
|
|
138
|
-
* @returns A hex string representing the address.
|
|
139
|
-
*/
|
|
140
|
-
toFriendlyJSON() {
|
|
141
|
-
return this.toString();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
AztecAddress.SIZE_IN_BYTES = 32;
|
|
145
|
-
AztecAddress.ZERO = new AztecAddress(Buffer.alloc(AztecAddress.SIZE_IN_BYTES));
|
|
146
|
-
AztecAddress.MODULUS = 0x30644e72e131a029b85045b68181585d2833e84879b9709143e1f593f0000001n;
|
|
147
|
-
AztecAddress.MAX_VALUE = AztecAddress.MODULUS - 1n;
|
|
148
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvYXp0ZWMtYWRkcmVzcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLFVBQVUsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ25FLE9BQU8sRUFBRSxFQUFFLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQztBQUN4QyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sK0JBQStCLENBQUM7QUFFN0Q7Ozs7O0dBS0c7QUFDSCxNQUFNLE9BQU8sWUFBWTtJQU12QjtJQUNFOztPQUVHO0lBQ2EsTUFBYztRQUFkLFdBQU0sR0FBTixNQUFNLENBQVE7UUFFOUIsTUFBTSxLQUFLLEdBQUcsVUFBVSxDQUFDLE1BQU0sQ0FBQyxDQUFDO1FBQ2pDLElBQUksS0FBSyxHQUFHLFlBQVksQ0FBQyxTQUFTLEVBQUU7WUFDbEMsTUFBTSxJQUFJLEtBQUssQ0FBQyw2QkFBNkIsS0FBSyxHQUFHLENBQUMsQ0FBQztTQUN4RDtJQUNILENBQUM7SUFFRDs7Ozs7T0FLRztJQUNILE1BQU0s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osT0FBTyxJQUFJLENBQUMsTUFBTSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUN4QyxDQUFDO0lBRUQ7Ozs7T0FJRztJQUNILGNBQWM7UUFDWixPQUFPLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztJQUN6QixDQUFDOztBQXJKTSwwQkFBYSxHQUFHLEVBQUUsQ0FBQztBQUNuQixpQkFBSSxHQUFHLElBQUksWUFBWSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLGFBQWEsQ0FBQyxDQUFDLENBQUM7QUFDbEUsb0JBQU8sR0FBRyxtRUFBbUUsQ0FBQztBQUM5RSxzQkFBUyxHQUFHLFlBQVksQ0FBQyxPQUFPLEdBQUcsRUFBRSxDQUFDIn0=
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bigint-buffer.test.d.ts","sourceRoot":"","sources":["../../src/bigint-buffer/bigint-buffer.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { toHex } from './index.js';
|
|
2
|
-
describe('bigint-buffer', () => {
|
|
3
|
-
describe('toHex', () => {
|
|
4
|
-
it('does not pad even length', () => {
|
|
5
|
-
expect(toHex(16n)).toEqual('0x10');
|
|
6
|
-
});
|
|
7
|
-
it('pads odd length hex to even length', () => {
|
|
8
|
-
expect(toHex(10n)).toEqual('0x0a');
|
|
9
|
-
});
|
|
10
|
-
it('pads zero to even length', () => {
|
|
11
|
-
expect(toHex(0n)).toEqual('0x00');
|
|
12
|
-
});
|
|
13
|
-
it('pads zero to 32 bytes', () => {
|
|
14
|
-
expect(toHex(0n, true)).toEqual('0x0000000000000000000000000000000000000000000000000000000000000000');
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmlnaW50LWJ1ZmZlci50ZXN0Lmpz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