diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf03e38..0bcb4af 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,10 +7,10 @@ cloudbuild:rust-artifact: - master variables: CONFIG_BUILDER: gcr.io/dexpa-175115/rust/rust-builder:v1.64.0 - BINARY_NAME: ton-wallet-api - CONFIG_APPLICATION: ton-wallet-api + BINARY_NAME: tycho-wallet-api + CONFIG_APPLICATION: tycho-wallet-api CONFIG_GROUP: ton - IMAGE_NAME: gcr.io/broxus/ton/ton-wallet-api/ton-wallet-api + IMAGE_NAME: gcr.io/broxus/ton/tycho-wallet-api/tycho-wallet-api BUILD: test before_script: - export COMMIT_TIME=$(git show -s --format=%ct $CI_COMMIT_SHA) @@ -25,10 +25,10 @@ cloudbuild:rust-artifact-prod: - prod variables: CONFIG_BUILDER: gcr.io/dexpa-175115/rust/rust-builder:v1.64.0 - BINARY_NAME: ton-wallet-api - CONFIG_APPLICATION: ton-wallet-api + BINARY_NAME: tycho-wallet-api + CONFIG_APPLICATION: tycho-wallet-api CONFIG_GROUP: ton - IMAGE_NAME: gcr.io/broxus/ton/ton-wallet-api/ton-wallet-api + IMAGE_NAME: gcr.io/broxus/ton/tycho-wallet-api/tycho-wallet-api BUILD: prod before_script: - export COMMIT_TIME=$(git show -s --format=%ct $CI_COMMIT_SHA) diff --git a/.sqlx/query-003d995c8bc07194ea8318c9dfdb53e298d385b6f428169ca15494c903aa9443.json b/.sqlx/query-003d995c8bc07194ea8318c9dfdb53e298d385b6f428169ca15494c903aa9443.json new file mode 100644 index 0000000..dae62ae --- /dev/null +++ b/.sqlx/query-003d995c8bc07194ea8318c9dfdb53e298d385b6f428169ca15494c903aa9443.json @@ -0,0 +1,249 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transactions\n (id, service_id, message_hash, transaction_hash, transaction_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data, value, fee, balance_change, direction, status, error, aborted, bounce, multisig_transaction_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)\n RETURNING id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Varchar", + "Numeric", + "Timestamp", + "Int4", + "Varchar", + "Int4", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Numeric", + "Numeric", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + "Text", + "Bool", + "Bool", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "003d995c8bc07194ea8318c9dfdb53e298d385b6f428169ca15494c903aa9443" +} diff --git a/.sqlx/query-091fd0c15e1a898226e63188b8f16353b7965c7f26068299d9254057191fe3f6.json b/.sqlx/query-091fd0c15e1a898226e63188b8f16353b7965c7f26068299d9254057191fe3f6.json new file mode 100644 index 0000000..ca2e1b6 --- /dev/null +++ b/.sqlx/query-091fd0c15e1a898226e63188b8f16353b7965c7f26068299d9254057191fe3f6.json @@ -0,0 +1,35 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO api_service\n (id, name)\n VALUES ($1, $2)\n RETURNING\n id as \"id: _\", name, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: _", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "091fd0c15e1a898226e63188b8f16353b7965c7f26068299d9254057191fe3f6" +} diff --git a/.sqlx/query-0facebc5e6e892b488e4001fdfa2ea9b56612f7b646a1237a54a183925155035.json b/.sqlx/query-0facebc5e6e892b488e4001fdfa2ea9b56612f7b646a1237a54a183925155035.json new file mode 100644 index 0000000..0e94f75 --- /dev/null +++ b/.sqlx/query-0facebc5e6e892b488e4001fdfa2ea9b56612f7b646a1237a54a183925155035.json @@ -0,0 +1,187 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transaction_events\n (id, service_id, transaction_id, message_hash, account_workchain_id, account_hex, transaction_direction, transaction_status, event_status)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)\n RETURNING\n id,\n service_id as \"service_id: _\",\n transaction_id,\n $10 as transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n sender_workchain_id,\n sender_hex,\n balance_change,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "0facebc5e6e892b488e4001fdfa2ea9b56612f7b646a1237a54a183925155035" +} diff --git a/.sqlx/query-10eee935829d032c8430fc5df7f83b54205f9533f9e17f06a3a08cb4d6e02c4d.json b/.sqlx/query-10eee935829d032c8430fc5df7f83b54205f9533f9e17f06a3a08cb4d6e02c4d.json new file mode 100644 index 0000000..d2df24e --- /dev/null +++ b/.sqlx/query-10eee935829d032c8430fc5df7f83b54205f9533f9e17f06a3a08cb4d6e02c4d.json @@ -0,0 +1,60 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT service_id as \"service_id: _\", account_workchain_id, account_hex, balance, root_address, created_at, updated_at\n FROM token_balances\n WHERE service_id = $1 AND account_workchain_id = $2 AND account_hex = $3 ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "10eee935829d032c8430fc5df7f83b54205f9533f9e17f06a3a08cb4d6e02c4d" +} diff --git a/.sqlx/query-154e7ca519b49f84360a28497cf1002e0034beb19b914b4f932792d34252cdc0.json b/.sqlx/query-154e7ca519b49f84360a28497cf1002e0034beb19b914b4f932792d34252cdc0.json new file mode 100644 index 0000000..ac41781 --- /dev/null +++ b/.sqlx/query-154e7ca519b49f84360a28497cf1002e0034beb19b914b4f932792d34252cdc0.json @@ -0,0 +1,164 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp,\n message_hash, owner_message_hash, account_workchain_id, account_hex,\n value, sender_workchain_id, sender_hex, root_address, payload, error, block_hash,\n block_time, direction as \"direction: _\", status as \"status: _\", in_message_hash,\n created_at, updated_at\n FROM token_transactions\n WHERE service_id = $1 AND transaction_hash = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "154e7ca519b49f84360a28497cf1002e0034beb19b914b4f932792d34252cdc0" +} diff --git a/.sqlx/query-17ab517e20f0176b8b31091bda0d95f2ec0749c5a29f68a11d73d1ba0f16f2f5.json b/.sqlx/query-17ab517e20f0176b8b31091bda0d95f2ec0749c5a29f68a11d73d1ba0f16f2f5.json new file mode 100644 index 0000000..c2ec3f3 --- /dev/null +++ b/.sqlx/query-17ab517e20f0176b8b31091bda0d95f2ec0749c5a29f68a11d73d1ba0f16f2f5.json @@ -0,0 +1,153 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT tte.id,\n tte.service_id as \"service_id: _\",\n tte.token_transaction_id,\n tt.transaction_hash as token_transaction_hash,\n tte.message_hash,\n tte.account_workchain_id,\n tte.account_hex,\n tte.owner_message_hash,\n tte.value,\n tte.sender_workchain_id,\n tte.sender_hex,\n tte.root_address,\n tte.transaction_direction as \"transaction_direction: _\",\n tte.transaction_status as \"transaction_status: _\",\n tte.event_status as \"event_status: _\",\n tte.created_at, tte.updated_at\n FROM token_transaction_events tte\n LEFT JOIN token_transactions tt on tt.id = tte.token_transaction_id\n WHERE tte.service_id = $1 AND tte.message_hash = $2 AND tte.account_workchain_id = $3 AND tte.account_hex = $4", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "17ab517e20f0176b8b31091bda0d95f2ec0749c5a29f68a11d73d1ba0f16f2f5" +} diff --git a/.sqlx/query-18287bd5dabce8ec1529d836952ec6cf8845214bedba6b0ee2916a878271f75c.json b/.sqlx/query-18287bd5dabce8ec1529d836952ec6cf8845214bedba6b0ee2916a878271f75c.json new file mode 100644 index 0000000..32e38e5 --- /dev/null +++ b/.sqlx/query-18287bd5dabce8ec1529d836952ec6cf8845214bedba6b0ee2916a878271f75c.json @@ -0,0 +1,159 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE transaction_events te SET event_status = $1\n FROM transactions t\n WHERE te.message_hash = $2 AND te.account_workchain_id = $3 AND te.account_hex = $4\n AND te.transaction_id = t.id\n RETURNING te.id,\n te.service_id as \"service_id: _\",\n te.transaction_id,\n t.transaction_hash,\n te.message_hash,\n te.account_workchain_id,\n te.account_hex,\n te.sender_workchain_id,\n te.sender_hex,\n te.balance_change,\n te.transaction_direction as \"transaction_direction: _\",\n te.transaction_status as \"transaction_status: _\",\n te.event_status as \"event_status: _\",\n te.multisig_transaction_id, te.created_at, te.updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "18287bd5dabce8ec1529d836952ec6cf8845214bedba6b0ee2916a878271f75c" +} diff --git a/.sqlx/query-1a40bb0bbfb663962fee164dd62d2fec1bfd6be6f60ba95d44426cc6c1ec3480.json b/.sqlx/query-1a40bb0bbfb663962fee164dd62d2fec1bfd6be6f60ba95d44426cc6c1ec3480.json new file mode 100644 index 0000000..c6a0ece --- /dev/null +++ b/.sqlx/query-1a40bb0bbfb663962fee164dd62d2fec1bfd6be6f60ba95d44426cc6c1ec3480.json @@ -0,0 +1,29 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO token_owners (address, owner_account_workchain_id, owner_account_hex, root_address, code_hash, version)\n VALUES ($1, $2, $3, $4, $5, $6::twa_token_wallet_version)\n ON CONFLICT DO NOTHING", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar", + "Int4", + "Varchar", + "Varchar", + "Bytea", + { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + ] + }, + "nullable": [] + }, + "hash": "1a40bb0bbfb663962fee164dd62d2fec1bfd6be6f60ba95d44426cc6c1ec3480" +} diff --git a/.sqlx/query-20466082ed454f972beb4fe446245f7bb02990e10dee2441d8e23c56cc9fdce3.json b/.sqlx/query-20466082ed454f972beb4fe446245f7bb02990e10dee2441d8e23c56cc9fdce3.json new file mode 100644 index 0000000..bd813b5 --- /dev/null +++ b/.sqlx/query-20466082ed454f972beb4fe446245f7bb02990e10dee2441d8e23c56cc9fdce3.json @@ -0,0 +1,207 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE service_id = $1 AND message_hash = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "20466082ed454f972beb4fe446245f7bb02990e10dee2441d8e23c56cc9fdce3" +} diff --git a/.sqlx/query-2d3d4085e79a22f13a763825fa93ad53f802c6d0659526834d7a2274e34270e3.json b/.sqlx/query-2d3d4085e79a22f13a763825fa93ad53f802c6d0659526834d7a2274e34270e3.json new file mode 100644 index 0000000..47dbdec --- /dev/null +++ b/.sqlx/query-2d3d4085e79a22f13a763825fa93ad53f802c6d0659526834d7a2274e34270e3.json @@ -0,0 +1,190 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transaction_events\n (id, service_id, transaction_id, message_hash, account_workchain_id, account_hex, sender_workchain_id, sender_hex, balance_change, transaction_direction, transaction_status, event_status)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)\n RETURNING id,\n service_id as \"service_id: _\",\n transaction_id,\n $13 as transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n sender_workchain_id,\n sender_hex,\n balance_change,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Int4", + "Varchar", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "2d3d4085e79a22f13a763825fa93ad53f802c6d0659526834d7a2274e34270e3" +} diff --git a/.sqlx/query-2dd2d90343440d7cc157d91a432b0331398146d17aea479fbf66c641b0c67a2b.json b/.sqlx/query-2dd2d90343440d7cc157d91a432b0331398146d17aea479fbf66c641b0c67a2b.json new file mode 100644 index 0000000..69f785b --- /dev/null +++ b/.sqlx/query-2dd2d90343440d7cc157d91a432b0331398146d17aea479fbf66c641b0c67a2b.json @@ -0,0 +1,202 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO token_transactions\n (id, service_id, transaction_hash, transaction_timestamp, message_hash, owner_message_hash,\n account_workchain_id, account_hex, value, sender_workchain_id, sender_hex, root_address,\n payload, error, block_hash, block_time, direction, status, in_message_hash)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)\n RETURNING id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp, message_hash,\n owner_message_hash, account_workchain_id, account_hex, value, sender_workchain_id, sender_hex,\n root_address, payload, error, block_hash, block_time, direction as \"direction: _\",\n status as \"status: _\", in_message_hash, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Timestamp", + "Varchar", + "Varchar", + "Int4", + "Varchar", + "Numeric", + "Int4", + "Varchar", + "Varchar", + "Bytea", + "Varchar", + "Varchar", + "Int4", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + }, + "Varchar" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "2dd2d90343440d7cc157d91a432b0331398146d17aea479fbf66c641b0c67a2b" +} diff --git a/.sqlx/query-3120532132a680c4b958ba594c77988725c0f0ded1ef328400c9145ba74741cb.json b/.sqlx/query-3120532132a680c4b958ba594c77988725c0f0ded1ef328400c9145ba74741cb.json new file mode 100644 index 0000000..bd600d7 --- /dev/null +++ b/.sqlx/query-3120532132a680c4b958ba594c77988725c0f0ded1ef328400c9145ba74741cb.json @@ -0,0 +1,163 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE token_transaction_events tte SET event_status = $1\n FROM token_transactions tt\n WHERE tte.service_id = $2 AND tte.id = $3\n AND tte.token_transaction_id = tt.id\n RETURNING tte.id,\n tte.service_id as \"service_id: _\",\n tte.token_transaction_id,\n tt.transaction_hash as token_transaction_hash,\n tte.message_hash,\n tte.account_workchain_id,\n tte.account_hex,\n tte.owner_message_hash,\n tte.value,\n tte.sender_workchain_id,\n tte.sender_hex,\n tte.root_address,\n tte.transaction_direction as \"transaction_direction: _\",\n tte.transaction_status as \"transaction_status: _\",\n tte.event_status as \"event_status: _\",\n tte.created_at, tte.updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "3120532132a680c4b958ba594c77988725c0f0ded1ef328400c9145ba74741cb" +} diff --git a/.sqlx/query-360413903546da5311999f0665280dc8c1e82fb74be273da9ae8f3debd2dafcf.json b/.sqlx/query-360413903546da5311999f0665280dc8c1e82fb74be273da9ae8f3debd2dafcf.json new file mode 100644 index 0000000..5c83a55 --- /dev/null +++ b/.sqlx/query-360413903546da5311999f0665280dc8c1e82fb74be273da9ae8f3debd2dafcf.json @@ -0,0 +1,60 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT service_id as \"service_id: _\", account_workchain_id, account_hex, balance, root_address, created_at, updated_at\n FROM token_balances\n WHERE account_workchain_id = $1 AND account_hex = $2 and root_address = $3", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int4", + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "360413903546da5311999f0665280dc8c1e82fb74be273da9ae8f3debd2dafcf" +} diff --git a/.sqlx/query-3a035e9d20a1c694c8193bafdcd2726a5440068fd9c8991cffd0f06a2d66598f.json b/.sqlx/query-3a035e9d20a1c694c8193bafdcd2726a5440068fd9c8991cffd0f06a2d66598f.json new file mode 100644 index 0000000..62dc4a2 --- /dev/null +++ b/.sqlx/query-3a035e9d20a1c694c8193bafdcd2726a5440068fd9c8991cffd0f06a2d66598f.json @@ -0,0 +1,164 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp,\n message_hash, owner_message_hash, account_workchain_id, account_hex,\n value, sender_workchain_id, sender_hex, root_address, payload, error, block_hash,\n block_time, direction as \"direction: _\", status as \"status: _\", in_message_hash,\n created_at, updated_at\n FROM token_transactions\n WHERE service_id = $1 AND id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "3a035e9d20a1c694c8193bafdcd2726a5440068fd9c8991cffd0f06a2d66598f" +} diff --git a/.sqlx/query-3aa8d5a1ad4aa31c3c86cfe2664c5acd0ef2e297c81f631938ded4ca29c361aa.json b/.sqlx/query-3aa8d5a1ad4aa31c3c86cfe2664c5acd0ef2e297c81f631938ded4ca29c361aa.json new file mode 100644 index 0000000..b07a192 --- /dev/null +++ b/.sqlx/query-3aa8d5a1ad4aa31c3c86cfe2664c5acd0ef2e297c81f631938ded4ca29c361aa.json @@ -0,0 +1,190 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transaction_events\n (id, service_id, transaction_id, message_hash, account_workchain_id, account_hex, balance_change, transaction_direction, transaction_status, event_status, multisig_transaction_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)\n ON CONFLICT (transaction_id, transaction_status)\n DO UPDATE SET updated_at = $12\n RETURNING\n id,\n service_id as \"service_id: _\",\n transaction_id,\n $13 as transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n sender_workchain_id,\n sender_hex,\n balance_change,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Int8", + "Timestamp", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "3aa8d5a1ad4aa31c3c86cfe2664c5acd0ef2e297c81f631938ded4ca29c361aa" +} diff --git a/.sqlx/query-3aeff4a59e43c7842d108fcef08a2d25662a4d6e89a14421402f1aa2c588e350.json b/.sqlx/query-3aeff4a59e43c7842d108fcef08a2d25662a4d6e89a14421402f1aa2c588e350.json new file mode 100644 index 0000000..8e5ccac --- /dev/null +++ b/.sqlx/query-3aeff4a59e43c7842d108fcef08a2d25662a4d6e89a14421402f1aa2c588e350.json @@ -0,0 +1,218 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE status = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "3aeff4a59e43c7842d108fcef08a2d25662a4d6e89a14421402f1aa2c588e350" +} diff --git a/.sqlx/query-3e6e4d0484e73d766a26f1d7ae14d863d8de3bba743cb863ea0060f2a6b0eac5.json b/.sqlx/query-3e6e4d0484e73d766a26f1d7ae14d863d8de3bba743cb863ea0060f2a6b0eac5.json new file mode 100644 index 0000000..c29cc02 --- /dev/null +++ b/.sqlx/query-3e6e4d0484e73d766a26f1d7ae14d863d8de3bba743cb863ea0060f2a6b0eac5.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT name, address, version as \"version: _\"\n FROM token_whitelist", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "3e6e4d0484e73d766a26f1d7ae14d863d8de3bba743cb863ea0060f2a6b0eac5" +} diff --git a/.sqlx/query-3ed5a8c725e537965ebc5c9eb31781918c432b48c652f6ec297557957b321b2a.json b/.sqlx/query-3ed5a8c725e537965ebc5c9eb31781918c432b48c652f6ec297557957b321b2a.json new file mode 100644 index 0000000..835f146 --- /dev/null +++ b/.sqlx/query-3ed5a8c725e537965ebc5c9eb31781918c432b48c652f6ec297557957b321b2a.json @@ -0,0 +1,56 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO token_whitelist\n (name, address, version)\n VALUES ($1, $2, $3::twa_token_wallet_version)\n RETURNING\n name, address, version as \"version: _\" ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [ + "Varchar", + "Varchar", + { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "3ed5a8c725e537965ebc5c9eb31781918c432b48c652f6ec297557957b321b2a" +} diff --git a/.sqlx/query-4150e501539963b5ec62445ec7a28070ac9cee88a0a228e804c6cffff67dc2ff.json b/.sqlx/query-4150e501539963b5ec62445ec7a28070ac9cee88a0a228e804c6cffff67dc2ff.json new file mode 100644 index 0000000..68cb9e3 --- /dev/null +++ b/.sqlx/query-4150e501539963b5ec62445ec7a28070ac9cee88a0a228e804c6cffff67dc2ff.json @@ -0,0 +1,146 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT te.id,\n te.service_id as \"service_id: _\",\n te.transaction_id,\n t.transaction_hash,\n te.message_hash,\n te.account_workchain_id,\n te.account_hex,\n te.sender_workchain_id,\n te.sender_hex,\n te.balance_change,\n te.transaction_direction as \"transaction_direction: _\",\n te.transaction_status as \"transaction_status: _\",\n te.event_status as \"event_status: _\",\n te.multisig_transaction_id,\n te.created_at,\n te.updated_at\n FROM transaction_events te\n LEFT JOIN transactions t ON t.id = te.transaction_id\n WHERE te.service_id = $1 AND te.id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "4150e501539963b5ec62445ec7a28070ac9cee88a0a228e804c6cffff67dc2ff" +} diff --git a/.sqlx/query-44c761460198b7ba1f86638d4843870af011e3c2184829c501cdb7a43a226d2c.json b/.sqlx/query-44c761460198b7ba1f86638d4843870af011e3c2184829c501cdb7a43a226d2c.json new file mode 100644 index 0000000..f3f00bf --- /dev/null +++ b/.sqlx/query-44c761460198b7ba1f86638d4843870af011e3c2184829c501cdb7a43a226d2c.json @@ -0,0 +1,14 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO last_key_blocks (block_id) VALUES ($1)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "44c761460198b7ba1f86638d4843870af011e3c2184829c501cdb7a43a226d2c" +} diff --git a/.sqlx/query-47260c5134c6f5d11cdc50f4d393eacce7a00a7292dd250d5276c152c4fd3fa2.json b/.sqlx/query-47260c5134c6f5d11cdc50f4d393eacce7a00a7292dd250d5276c152c4fd3fa2.json new file mode 100644 index 0000000..8f4f06e --- /dev/null +++ b/.sqlx/query-47260c5134c6f5d11cdc50f4d393eacce7a00a7292dd250d5276c152c4fd3fa2.json @@ -0,0 +1,162 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT tte.id,\n tte.service_id as \"service_id: _\",\n tte.token_transaction_id,\n tt.transaction_hash as token_transaction_hash,\n tte.message_hash,\n tte.account_workchain_id,\n tte.account_hex,\n tte.owner_message_hash,\n tte.value,\n tte.sender_workchain_id,\n tte.sender_hex,\n tte.root_address,\n tte.transaction_direction as \"transaction_direction: _\",\n tte.transaction_status as \"transaction_status: _\",\n tte.event_status as \"event_status: _\",\n tte.created_at, tte.updated_at\n FROM token_transaction_events tte\n LEFT JOIN token_transactions tt on tt.id = tte.token_transaction_id\n WHERE tte.service_id = $1 AND tte.event_status = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "47260c5134c6f5d11cdc50f4d393eacce7a00a7292dd250d5276c152c4fd3fa2" +} diff --git a/.sqlx/query-4a678bf15a0e55d5042795ff424bf3c3f232df49a211549c2527e3003b334d43.json b/.sqlx/query-4a678bf15a0e55d5042795ff424bf3c3f232df49a211549c2527e3003b334d43.json new file mode 100644 index 0000000..0ba9462 --- /dev/null +++ b/.sqlx/query-4a678bf15a0e55d5042795ff424bf3c3f232df49a211549c2527e3003b334d43.json @@ -0,0 +1,62 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO token_balances\n (service_id, account_workchain_id, account_hex, balance, root_address)\n VALUES ($1, $2, $3, $4, $5)\n RETURNING\n service_id as \"service_id: _\", account_workchain_id, account_hex, balance, root_address, created_at, updated_at\n", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int4", + "Varchar", + "Numeric", + "Varchar" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "4a678bf15a0e55d5042795ff424bf3c3f232df49a211549c2527e3003b334d43" +} diff --git a/.sqlx/query-5566757821f2f6e500698f5c657e834e5276be5b732722328d65fe834d4d7312.json b/.sqlx/query-5566757821f2f6e500698f5c657e834e5276be5b732722328d65fe834d4d7312.json new file mode 100644 index 0000000..f272574 --- /dev/null +++ b/.sqlx/query-5566757821f2f6e500698f5c657e834e5276be5b732722328d65fe834d4d7312.json @@ -0,0 +1,238 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transactions\n (id, service_id, message_hash, account_workchain_id, account_hex, original_value, original_outputs, direction, status, aborted, bounce)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)\n RETURNING id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Numeric", + "Jsonb", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + "Bool", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "5566757821f2f6e500698f5c657e834e5276be5b732722328d65fe834d4d7312" +} diff --git a/.sqlx/query-56eb31cbdb81de76179b601f386de4df724d5d1a9ce07b328f732c95b47384af.json b/.sqlx/query-56eb31cbdb81de76179b601f386de4df724d5d1a9ce07b328f732c95b47384af.json new file mode 100644 index 0000000..cfff479 --- /dev/null +++ b/.sqlx/query-56eb31cbdb81de76179b601f386de4df724d5d1a9ce07b328f732c95b47384af.json @@ -0,0 +1,196 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO token_transaction_events\n (id, service_id, token_transaction_id, message_hash, account_workchain_id, account_hex,\n owner_message_hash,value, sender_workchain_id, sender_hex, root_address,\n transaction_direction, transaction_status, event_status)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)\n RETURNING id,\n service_id as \"service_id: _\",\n token_transaction_id,\n $15 as token_transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n owner_message_hash,\n value,\n sender_workchain_id,\n sender_hex,\n root_address,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Varchar", + "Numeric", + "Int4", + "Varchar", + "Varchar", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "56eb31cbdb81de76179b601f386de4df724d5d1a9ce07b328f732c95b47384af" +} diff --git a/.sqlx/query-5feb3d6ed3913fea68ed03acafa998e579845b49cb8bcdf0375171e60f83af8d.json b/.sqlx/query-5feb3d6ed3913fea68ed03acafa998e579845b49cb8bcdf0375171e60f83af8d.json new file mode 100644 index 0000000..6d9614e --- /dev/null +++ b/.sqlx/query-5feb3d6ed3913fea68ed03acafa998e579845b49cb8bcdf0375171e60f83af8d.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT callback\n FROM api_service_callback\n WHERE service_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "callback", + "type_info": "Text" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false + ] + }, + "hash": "5feb3d6ed3913fea68ed03acafa998e579845b49cb8bcdf0375171e60f83af8d" +} diff --git a/.sqlx/query-6354909cc69073914a8d53e10c484e2057c9589fb4ee2c2b3ee9ae7000d17dda.json b/.sqlx/query-6354909cc69073914a8d53e10c484e2057c9589fb4ee2c2b3ee9ae7000d17dda.json new file mode 100644 index 0000000..fdf9c4e --- /dev/null +++ b/.sqlx/query-6354909cc69073914a8d53e10c484e2057c9589fb4ee2c2b3ee9ae7000d17dda.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id,\n service_id as \"service_id: _\",\n key,\n secret,\n whitelist,\n created_at\n FROM api_service_key WHERE key = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "key", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "secret", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "whitelist", + "type_info": "Jsonb" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false + ] + }, + "hash": "6354909cc69073914a8d53e10c484e2057c9589fb4ee2c2b3ee9ae7000d17dda" +} diff --git a/.sqlx/query-63c7a9e7ca3875b256f24ded7fbcf7a75bee2f013fc7f4edaec1b6a0f5212b4e.json b/.sqlx/query-63c7a9e7ca3875b256f24ded7fbcf7a75bee2f013fc7f4edaec1b6a0f5212b4e.json new file mode 100644 index 0000000..c93cbbe --- /dev/null +++ b/.sqlx/query-63c7a9e7ca3875b256f24ded7fbcf7a75bee2f013fc7f4edaec1b6a0f5212b4e.json @@ -0,0 +1,209 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE service_id = $1 AND message_hash = $2 AND account_workchain_id = $3 AND account_hex = $4 and direction = 'Send'::twa_transaction_direction", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "63c7a9e7ca3875b256f24ded7fbcf7a75bee2f013fc7f4edaec1b6a0f5212b4e" +} diff --git a/.sqlx/query-640401f007915a8b0a2fec2bb6e14e0630b36280c90578eb8119cfb32f727b1e.json b/.sqlx/query-640401f007915a8b0a2fec2bb6e14e0630b36280c90578eb8119cfb32f727b1e.json new file mode 100644 index 0000000..34214ba --- /dev/null +++ b/.sqlx/query-640401f007915a8b0a2fec2bb6e14e0630b36280c90578eb8119cfb32f727b1e.json @@ -0,0 +1,249 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transactions\n (id, service_id, message_hash, transaction_hash, transaction_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data, value, fee, balance_change, direction, status, error, aborted, bounce, multisig_transaction_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22)\n RETURNING id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Varchar", + "Numeric", + "Timestamp", + "Int4", + "Varchar", + "Int4", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Numeric", + "Numeric", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + "Text", + "Bool", + "Bool", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "640401f007915a8b0a2fec2bb6e14e0630b36280c90578eb8119cfb32f727b1e" +} diff --git a/.sqlx/query-68af7ffe899dc3e539b887f1ac630b1cfc13f4618efd7427b401318673e174c2.json b/.sqlx/query-68af7ffe899dc3e539b887f1ac630b1cfc13f4618efd7427b401318673e174c2.json new file mode 100644 index 0000000..a06534a --- /dev/null +++ b/.sqlx/query-68af7ffe899dc3e539b887f1ac630b1cfc13f4618efd7427b401318673e174c2.json @@ -0,0 +1,190 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transaction_events\n (id, service_id, transaction_id, message_hash, account_workchain_id, account_hex, balance_change, transaction_direction, transaction_status, event_status, multisig_transaction_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)\n ON CONFLICT (transaction_id, transaction_status)\n DO UPDATE SET updated_at = $12\n RETURNING id,\n service_id as \"service_id: _\",\n transaction_id,\n $13 as transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n sender_workchain_id,\n sender_hex,\n balance_change,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Int8", + "Timestamp", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "68af7ffe899dc3e539b887f1ac630b1cfc13f4618efd7427b401318673e174c2" +} diff --git a/.sqlx/query-741d23196ccb745277150a668b5572e67990d2c389eba59ead58315e49e5a8f0.json b/.sqlx/query-741d23196ccb745277150a668b5572e67990d2c389eba59ead58315e49e5a8f0.json new file mode 100644 index 0000000..0681798 --- /dev/null +++ b/.sqlx/query-741d23196ccb745277150a668b5572e67990d2c389eba59ead58315e49e5a8f0.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO api_service_callback\n (id, service_id, callback, created_at) VALUES ($1, $2, $3, $4)\n ON CONFLICT (service_id)\n DO UPDATE SET callback = $3", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Text", + "Timestamp" + ] + }, + "nullable": [] + }, + "hash": "741d23196ccb745277150a668b5572e67990d2c389eba59ead58315e49e5a8f0" +} diff --git a/.sqlx/query-74d26929cd254f8ca6a66a60de4dca95ea6b355bdb3e04e03444f6f014555e67.json b/.sqlx/query-74d26929cd254f8ca6a66a60de4dca95ea6b355bdb3e04e03444f6f014555e67.json new file mode 100644 index 0000000..f503944 --- /dev/null +++ b/.sqlx/query-74d26929cd254f8ca6a66a60de4dca95ea6b355bdb3e04e03444f6f014555e67.json @@ -0,0 +1,66 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT address, owner_account_workchain_id, owner_account_hex, root_address, code_hash, created_at, version as \"version: _\"\n FROM token_owners ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "owner_account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "owner_account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "code_hash", + "type_info": "Bytea" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "74d26929cd254f8ca6a66a60de4dca95ea6b355bdb3e04e03444f6f014555e67" +} diff --git a/.sqlx/query-7a408d09748e749b5c02f0eab8fb3f4155c18be80d475d072422a02160ba71a7.json b/.sqlx/query-7a408d09748e749b5c02f0eab8fb3f4155c18be80d475d072422a02160ba71a7.json new file mode 100644 index 0000000..ae2ab16 --- /dev/null +++ b/.sqlx/query-7a408d09748e749b5c02f0eab8fb3f4155c18be80d475d072422a02160ba71a7.json @@ -0,0 +1,44 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT name, address, version as \"version: _\"\n FROM token_whitelist\n WHERE address = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "name", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "7a408d09748e749b5c02f0eab8fb3f4155c18be80d475d072422a02160ba71a7" +} diff --git a/.sqlx/query-8029d3ffd702535b2ea3d36610c2e557cc6fd9f136033a043394f7d5aab98aec.json b/.sqlx/query-8029d3ffd702535b2ea3d36610c2e557cc6fd9f136033a043394f7d5aab98aec.json new file mode 100644 index 0000000..5a01334 --- /dev/null +++ b/.sqlx/query-8029d3ffd702535b2ea3d36610c2e557cc6fd9f136033a043394f7d5aab98aec.json @@ -0,0 +1,158 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE transaction_events te SET event_status = $1\n FROM transactions t\n WHERE te.service_id = $2 AND te.id = $3\n AND te.transaction_id = t.id\n RETURNING te.id,\n te.service_id as \"service_id: _\",\n te.transaction_id,\n t.transaction_hash,\n te.message_hash,\n te.account_workchain_id,\n te.account_hex,\n te.sender_workchain_id,\n te.sender_hex,\n te.balance_change,\n te.transaction_direction as \"transaction_direction: _\",\n te.transaction_status as \"transaction_status: _\",\n te.event_status as \"event_status: _\",\n te.multisig_transaction_id, te.created_at, te.updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "8029d3ffd702535b2ea3d36610c2e557cc6fd9f136033a043394f7d5aab98aec" +} diff --git a/.sqlx/query-8d7ce1366663f290e4b39fe251e929976e5a6afa8d1940cd5a048033bce80fbe.json b/.sqlx/query-8d7ce1366663f290e4b39fe251e929976e5a6afa8d1940cd5a048033bce80fbe.json new file mode 100644 index 0000000..dfcbfa8 --- /dev/null +++ b/.sqlx/query-8d7ce1366663f290e4b39fe251e929976e5a6afa8d1940cd5a048033bce80fbe.json @@ -0,0 +1,209 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE service_id = $1 AND message_hash = $2 AND account_workchain_id = $3 AND account_hex = $4 and direction = 'Send'::twa_transaction_direction\n FOR UPDATE", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "8d7ce1366663f290e4b39fe251e929976e5a6afa8d1940cd5a048033bce80fbe" +} diff --git a/.sqlx/query-8f570865727553da5877fc92ec7be220616074f816910ca7ef183aed70e3dfb8.json b/.sqlx/query-8f570865727553da5877fc92ec7be220616074f816910ca7ef183aed70e3dfb8.json new file mode 100644 index 0000000..9155757 --- /dev/null +++ b/.sqlx/query-8f570865727553da5877fc92ec7be220616074f816910ca7ef183aed70e3dfb8.json @@ -0,0 +1,54 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO api_service_key\n (service_id, key, secret)\n VALUES ($1, $2, $3)\n RETURNING\n id, service_id as \"service_id: _\", key, secret, whitelist, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "key", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "secret", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "whitelist", + "type_info": "Jsonb" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false + ] + }, + "hash": "8f570865727553da5877fc92ec7be220616074f816910ca7ef183aed70e3dfb8" +} diff --git a/.sqlx/query-957f4145c738e0c81e9f0d1c6ea312966f50f802f8b1365b2fa20330277eb4ac.json b/.sqlx/query-957f4145c738e0c81e9f0d1c6ea312966f50f802f8b1365b2fa20330277eb4ac.json new file mode 100644 index 0000000..6b6878d --- /dev/null +++ b/.sqlx/query-957f4145c738e0c81e9f0d1c6ea312966f50f802f8b1365b2fa20330277eb4ac.json @@ -0,0 +1,114 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, service_id as \"service_id: _\", workchain_id, hex, base64url, public_key, private_key, account_type as \"account_type: _\", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at\n FROM address\n WHERE service_id = $1 AND workchain_id = $2 AND hex = $3", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "hex", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base64url", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "public_key", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "private_key", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "account_type: _", + "type_info": { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + } + }, + { + "ordinal": 8, + "name": "custodians", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "confirmations", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "custodians_public_keys", + "type_info": "Jsonb" + }, + { + "ordinal": 11, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 13, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "957f4145c738e0c81e9f0d1c6ea312966f50f802f8b1365b2fa20330277eb4ac" +} diff --git a/.sqlx/query-98b635d34705dfa730dd754f788a7e65651477cba1d39668db2027fe34778115.json b/.sqlx/query-98b635d34705dfa730dd754f788a7e65651477cba1d39668db2027fe34778115.json new file mode 100644 index 0000000..fd76b55 --- /dev/null +++ b/.sqlx/query-98b635d34705dfa730dd754f788a7e65651477cba1d39668db2027fe34778115.json @@ -0,0 +1,68 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT address, owner_account_workchain_id, owner_account_hex, root_address, code_hash, created_at, version as \"version: _\"\n FROM token_owners\n WHERE address = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "owner_account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "owner_account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "code_hash", + "type_info": "Bytea" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "98b635d34705dfa730dd754f788a7e65651477cba1d39668db2027fe34778115" +} diff --git a/.sqlx/query-98f411962f3db5f2736c502c9b21b19771567b8a09c3e163770388e78047e60c.json b/.sqlx/query-98f411962f3db5f2736c502c9b21b19771567b8a09c3e163770388e78047e60c.json new file mode 100644 index 0000000..0a7a142 --- /dev/null +++ b/.sqlx/query-98f411962f3db5f2736c502c9b21b19771567b8a09c3e163770388e78047e60c.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT block_id FROM last_key_blocks", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "block_id", + "type_info": "Varchar" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false + ] + }, + "hash": "98f411962f3db5f2736c502c9b21b19771567b8a09c3e163770388e78047e60c" +} diff --git a/.sqlx/query-a57ceea571bf12a91fabfb81b376b9d6a3515f1a3c4b99a6e82378f96d157265.json b/.sqlx/query-a57ceea571bf12a91fabfb81b376b9d6a3515f1a3c4b99a6e82378f96d157265.json new file mode 100644 index 0000000..4c3cfe1 --- /dev/null +++ b/.sqlx/query-a57ceea571bf12a91fabfb81b376b9d6a3515f1a3c4b99a6e82378f96d157265.json @@ -0,0 +1,236 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE transactions SET\n (transaction_hash, transaction_lt, transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, messages, messages_hash, data, value, fee, balance_change, status, error, updated_at, multisig_transaction_id) =\n ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)\n WHERE message_hash = $17 AND account_workchain_id = $18 and account_hex = $19 and direction = 'Send'::twa_transaction_direction\n RETURNING id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Varchar", + "Numeric", + "Int8", + "Timestamp", + "Int4", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Numeric", + "Numeric", + "Numeric", + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + "Text", + "Timestamp", + "Int8", + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "a57ceea571bf12a91fabfb81b376b9d6a3515f1a3c4b99a6e82378f96d157265" +} diff --git a/.sqlx/query-aaca2c63063e1d159c736c81e986d20cb10920fd95853a6c5212f6b1bb3b9df8.json b/.sqlx/query-aaca2c63063e1d159c736c81e986d20cb10920fd95853a6c5212f6b1bb3b9df8.json new file mode 100644 index 0000000..6484663 --- /dev/null +++ b/.sqlx/query-aaca2c63063e1d159c736c81e986d20cb10920fd95853a6c5212f6b1bb3b9df8.json @@ -0,0 +1,52 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id,\n service_id as \"service_id: _\",\n key,\n secret,\n whitelist,\n created_at\n FROM api_service_key WHERE service_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "key", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "secret", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "whitelist", + "type_info": "Jsonb" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false, + true, + false + ] + }, + "hash": "aaca2c63063e1d159c736c81e986d20cb10920fd95853a6c5212f6b1bb3b9df8" +} diff --git a/.sqlx/query-b07560cf0c54dddc13cb6f941fa45d536b2e7d85e0e86e22fa911156d9704168.json b/.sqlx/query-b07560cf0c54dddc13cb6f941fa45d536b2e7d85e0e86e22fa911156d9704168.json new file mode 100644 index 0000000..8a9b19c --- /dev/null +++ b/.sqlx/query-b07560cf0c54dddc13cb6f941fa45d536b2e7d85e0e86e22fa911156d9704168.json @@ -0,0 +1,113 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, service_id as \"service_id: _\", workchain_id, hex, base64url, public_key, private_key, account_type as \"account_type: _\", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at\n FROM address\n WHERE workchain_id = $1 AND hex = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "hex", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base64url", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "public_key", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "private_key", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "account_type: _", + "type_info": { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + } + }, + { + "ordinal": 8, + "name": "custodians", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "confirmations", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "custodians_public_keys", + "type_info": "Jsonb" + }, + { + "ordinal": 11, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 13, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "b07560cf0c54dddc13cb6f941fa45d536b2e7d85e0e86e22fa911156d9704168" +} diff --git a/.sqlx/query-b0759e8b3570c43e0dee8e5bef62cabbf1fdcd8087b64abcabfa9fab34efa843.json b/.sqlx/query-b0759e8b3570c43e0dee8e5bef62cabbf1fdcd8087b64abcabfa9fab34efa843.json new file mode 100644 index 0000000..bdce570 --- /dev/null +++ b/.sqlx/query-b0759e8b3570c43e0dee8e5bef62cabbf1fdcd8087b64abcabfa9fab34efa843.json @@ -0,0 +1,164 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp,\n message_hash, owner_message_hash, account_workchain_id, account_hex,\n value, sender_workchain_id, sender_hex, root_address, payload, error, block_hash,\n block_time, direction as \"direction: _\", status as \"status: _\", in_message_hash,\n created_at, updated_at\n FROM token_transactions\n WHERE service_id = $1 AND in_message_hash = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "b0759e8b3570c43e0dee8e5bef62cabbf1fdcd8087b64abcabfa9fab34efa843" +} diff --git a/.sqlx/query-b6e0976bf2960fb60ed91fe0cded10324cc45c67d8e5d28950dfafa7e98880da.json b/.sqlx/query-b6e0976bf2960fb60ed91fe0cded10324cc45c67d8e5d28950dfafa7e98880da.json new file mode 100644 index 0000000..42aa2c4 --- /dev/null +++ b/.sqlx/query-b6e0976bf2960fb60ed91fe0cded10324cc45c67d8e5d28950dfafa7e98880da.json @@ -0,0 +1,134 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO address\n (id, service_id, workchain_id, hex, base64url, public_key, private_key, account_type, custodians, confirmations, custodians_public_keys)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8::twa_account_type, $9, $10, $11)\n RETURNING\n id, service_id as \"service_id: _\", workchain_id, hex, base64url, public_key, private_key, account_type as \"account_type: _\", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at\n", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "hex", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base64url", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "public_key", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "private_key", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "account_type: _", + "type_info": { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + } + }, + { + "ordinal": 8, + "name": "custodians", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "confirmations", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "custodians_public_keys", + "type_info": "Jsonb" + }, + { + "ordinal": 11, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 13, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Int4", + "Varchar", + "Varchar", + "Varchar", + "Varchar", + { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + }, + "Int4", + "Int4", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "b6e0976bf2960fb60ed91fe0cded10324cc45c67d8e5d28950dfafa7e98880da" +} diff --git a/.sqlx/query-bcce9e04f2999da5a59f0b9880d30fd335fc0522a931eed882f5813904b975d3.json b/.sqlx/query-bcce9e04f2999da5a59f0b9880d30fd335fc0522a931eed882f5813904b975d3.json new file mode 100644 index 0000000..7fbec0e --- /dev/null +++ b/.sqlx/query-bcce9e04f2999da5a59f0b9880d30fd335fc0522a931eed882f5813904b975d3.json @@ -0,0 +1,206 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE messages_hash @> $1::jsonb FOR UPDATE", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "bcce9e04f2999da5a59f0b9880d30fd335fc0522a931eed882f5813904b975d3" +} diff --git a/.sqlx/query-bea373addcff988470868b63ed5630b82402146a833bb310ae665a86f0f8fa52.json b/.sqlx/query-bea373addcff988470868b63ed5630b82402146a833bb310ae665a86f0f8fa52.json new file mode 100644 index 0000000..b818959 --- /dev/null +++ b/.sqlx/query-bea373addcff988470868b63ed5630b82402146a833bb310ae665a86f0f8fa52.json @@ -0,0 +1,110 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, service_id as \"service_id: _\", workchain_id, hex, base64url, public_key, private_key, account_type as \"account_type: _\", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at\n FROM address", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "hex", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base64url", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "public_key", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "private_key", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "account_type: _", + "type_info": { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + } + }, + { + "ordinal": 8, + "name": "custodians", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "confirmations", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "custodians_public_keys", + "type_info": "Jsonb" + }, + { + "ordinal": 11, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 13, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "bea373addcff988470868b63ed5630b82402146a833bb310ae665a86f0f8fa52" +} diff --git a/.sqlx/query-c267b3e6cb8238d9cf959388712fa5aef740721b153ac22fe4a71c64e7f48282.json b/.sqlx/query-c267b3e6cb8238d9cf959388712fa5aef740721b153ac22fe4a71c64e7f48282.json new file mode 100644 index 0000000..6bd2ecc --- /dev/null +++ b/.sqlx/query-c267b3e6cb8238d9cf959388712fa5aef740721b153ac22fe4a71c64e7f48282.json @@ -0,0 +1,153 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE token_transaction_events SET (owner_message_hash, updated_at) = ($2, $3)\n WHERE token_transaction_id = $1\n RETURNING id,\n service_id as \"service_id: _\",\n token_transaction_id,\n $4 as token_transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n owner_message_hash,\n value,\n sender_workchain_id,\n sender_hex,\n root_address,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Timestamp", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "c267b3e6cb8238d9cf959388712fa5aef740721b153ac22fe4a71c64e7f48282" +} diff --git a/.sqlx/query-c589c2de0424b15cc5711524a96afa87e37e93c45867a655fe2f23befeaf03c8.json b/.sqlx/query-c589c2de0424b15cc5711524a96afa87e37e93c45867a655fe2f23befeaf03c8.json new file mode 100644 index 0000000..37f2e41 --- /dev/null +++ b/.sqlx/query-c589c2de0424b15cc5711524a96afa87e37e93c45867a655fe2f23befeaf03c8.json @@ -0,0 +1,165 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE token_transactions SET (owner_message_hash, updated_at) = ($2, $3)\n WHERE id = $1\n RETURNING id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp, message_hash,\n owner_message_hash, account_workchain_id, account_hex, value, sender_workchain_id, sender_hex, root_address, payload, error,\n block_hash, block_time, direction as \"direction: _\", status as \"status: _\", in_message_hash,\n created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Timestamp" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "c589c2de0424b15cc5711524a96afa87e37e93c45867a655fe2f23befeaf03c8" +} diff --git a/.sqlx/query-cd402400d4b0c62f598ac78c03bcd37bc5e6189b89d06a5920714433d0dc2574.json b/.sqlx/query-cd402400d4b0c62f598ac78c03bcd37bc5e6189b89d06a5920714433d0dc2574.json new file mode 100644 index 0000000..00f5689 --- /dev/null +++ b/.sqlx/query-cd402400d4b0c62f598ac78c03bcd37bc5e6189b89d06a5920714433d0dc2574.json @@ -0,0 +1,112 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, service_id as \"service_id: _\", workchain_id, hex, base64url, public_key, private_key, account_type as \"account_type: _\", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at\n FROM address\n WHERE created_at > $1\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 3, + "name": "hex", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "base64url", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "public_key", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "private_key", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "account_type: _", + "type_info": { + "Custom": { + "name": "twa_account_type", + "kind": { + "Enum": [ + "HighloadWallet", + "Wallet", + "SafeMultisig", + "EverWallet" + ] + } + } + } + }, + { + "ordinal": 8, + "name": "custodians", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "confirmations", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "custodians_public_keys", + "type_info": "Jsonb" + }, + { + "ordinal": 11, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 13, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Timestamp" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + true, + true, + true, + false, + false, + false + ] + }, + "hash": "cd402400d4b0c62f598ac78c03bcd37bc5e6189b89d06a5920714433d0dc2574" +} diff --git a/.sqlx/query-d6c5883cfab5c8538a70cc613534d6a5b992affc341a1f722d9c7f8aec7f9b57.json b/.sqlx/query-d6c5883cfab5c8538a70cc613534d6a5b992affc341a1f722d9c7f8aec7f9b57.json new file mode 100644 index 0000000..90bb9b0 --- /dev/null +++ b/.sqlx/query-d6c5883cfab5c8538a70cc613534d6a5b992affc341a1f722d9c7f8aec7f9b57.json @@ -0,0 +1,164 @@ +{ + "db_name": "PostgreSQL", + "query": "\n UPDATE token_transaction_events tte SET event_status = $1\n FROM token_transactions tt\n WHERE tte.message_hash = $2 AND tte.account_workchain_id = $3 AND tte.account_hex = $4\n AND tte.token_transaction_id = tt.id\n RETURNING tte.id,\n tte.service_id as \"service_id: _\",\n tte.token_transaction_id,\n tt.transaction_hash as token_transaction_hash,\n tte.message_hash,\n tte.account_workchain_id,\n tte.account_hex,\n tte.owner_message_hash,\n tte.value,\n tte.sender_workchain_id,\n tte.sender_hex,\n tte.root_address,\n tte.transaction_direction as \"transaction_direction: _\",\n tte.transaction_status as \"transaction_status: _\",\n tte.event_status as \"event_status: _\",\n tte.created_at, tte.updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "token_transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "token_transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 14, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 15, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 16, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + false, + true, + true, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "d6c5883cfab5c8538a70cc613534d6a5b992affc341a1f722d9c7f8aec7f9b57" +} diff --git a/.sqlx/query-d9c08ca482e3d9afcec1c81ace7cf0151ce954a6876fde2373b5b7e2705e78f7.json b/.sqlx/query-d9c08ca482e3d9afcec1c81ace7cf0151ce954a6876fde2373b5b7e2705e78f7.json new file mode 100644 index 0000000..4fdff90 --- /dev/null +++ b/.sqlx/query-d9c08ca482e3d9afcec1c81ace7cf0151ce954a6876fde2373b5b7e2705e78f7.json @@ -0,0 +1,252 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transactions\n (id, service_id, message_hash, transaction_hash, transaction_lt, transaction_timeout, transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data, original_value, original_outputs, value, fee, balance_change, direction, status, error, aborted, bounce)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25)\n RETURNING id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Varchar", + "Numeric", + "Int8", + "Int8", + "Timestamp", + "Int4", + "Varchar", + "Int4", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Numeric", + "Jsonb", + "Numeric", + "Numeric", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + "Text", + "Bool", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "d9c08ca482e3d9afcec1c81ace7cf0151ce954a6876fde2373b5b7e2705e78f7" +} diff --git a/.sqlx/query-dd2936a6e948e3d92ad582961837e7dc86c558628d12e57434f78e9d8a0c3c1d.json b/.sqlx/query-dd2936a6e948e3d92ad582961837e7dc86c558628d12e57434f78e9d8a0c3c1d.json new file mode 100644 index 0000000..0a0d81c --- /dev/null +++ b/.sqlx/query-dd2936a6e948e3d92ad582961837e7dc86c558628d12e57434f78e9d8a0c3c1d.json @@ -0,0 +1,207 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE service_id = $1 AND transaction_hash = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "dd2936a6e948e3d92ad582961837e7dc86c558628d12e57434f78e9d8a0c3c1d" +} diff --git a/.sqlx/query-e55197c085ef0ccb649eb7cab10c2c04ae0fbcb24b90bd108bbedbcd9ff7b8a6.json b/.sqlx/query-e55197c085ef0ccb649eb7cab10c2c04ae0fbcb24b90bd108bbedbcd9ff7b8a6.json new file mode 100644 index 0000000..6a4d13e --- /dev/null +++ b/.sqlx/query-e55197c085ef0ccb649eb7cab10c2c04ae0fbcb24b90bd108bbedbcd9ff7b8a6.json @@ -0,0 +1,206 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE messages_hash @> $1::jsonb", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "e55197c085ef0ccb649eb7cab10c2c04ae0fbcb24b90bd108bbedbcd9ff7b8a6" +} diff --git a/.sqlx/query-e6fb0b53c580114a04d1c0dafe291df2a40bb513af65ec8986c7c04a742c2b44.json b/.sqlx/query-e6fb0b53c580114a04d1c0dafe291df2a40bb513af65ec8986c7c04a742c2b44.json new file mode 100644 index 0000000..aca068a --- /dev/null +++ b/.sqlx/query-e6fb0b53c580114a04d1c0dafe291df2a40bb513af65ec8986c7c04a742c2b44.json @@ -0,0 +1,189 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO transaction_events\n (id, service_id, transaction_id, message_hash, account_workchain_id, account_hex, balance_change, transaction_direction, transaction_status, event_status, multisig_transaction_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)\n RETURNING id,\n service_id as \"service_id: _\",\n transaction_id,\n $12 as transaction_hash,\n message_hash,\n account_workchain_id,\n account_hex,\n sender_workchain_id,\n sender_hex,\n balance_change,\n transaction_direction as \"transaction_direction: _\",\n transaction_status as \"transaction_status: _\",\n event_status as \"event_status: _\",\n multisig_transaction_id, created_at, updated_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Text" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Varchar", + "Int4", + "Varchar", + "Numeric", + { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + }, + { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + }, + "Int8", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + null, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "e6fb0b53c580114a04d1c0dafe291df2a40bb513af65ec8986c7c04a742c2b44" +} diff --git a/.sqlx/query-eddc4a03595d835065196419598143d7beab7186e6ddcc7431b4762ade34fccb.json b/.sqlx/query-eddc4a03595d835065196419598143d7beab7186e6ddcc7431b4762ade34fccb.json new file mode 100644 index 0000000..d96ed13 --- /dev/null +++ b/.sqlx/query-eddc4a03595d835065196419598143d7beab7186e6ddcc7431b4762ade34fccb.json @@ -0,0 +1,61 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT service_id as \"service_id: _\", account_workchain_id, account_hex, balance, root_address, created_at, updated_at\n FROM token_balances\n WHERE service_id = $1 AND account_workchain_id = $2 AND account_hex = $3 and root_address = $4", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "balance", + "type_info": "Numeric" + }, + { + "ordinal": 4, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int4", + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "eddc4a03595d835065196419598143d7beab7186e6ddcc7431b4762ade34fccb" +} diff --git a/.sqlx/query-f09a0d5c3af66fc9255d8faae853fbb8528afc6ccac8b6b8f7596790bde8793b.json b/.sqlx/query-f09a0d5c3af66fc9255d8faae853fbb8528afc6ccac8b6b8f7596790bde8793b.json new file mode 100644 index 0000000..a4609ae --- /dev/null +++ b/.sqlx/query-f09a0d5c3af66fc9255d8faae853fbb8528afc6ccac8b6b8f7596790bde8793b.json @@ -0,0 +1,207 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", message_hash, transaction_hash, transaction_lt, transaction_timeout,\n transaction_scan_lt, transaction_timestamp, sender_workchain_id, sender_hex, account_workchain_id, account_hex, messages, messages_hash, data,\n original_value, original_outputs, value, fee, balance_change, direction as \"direction: _\", status as \"status: _\",\n error, aborted, bounce, multisig_transaction_id, created_at, updated_at\n FROM transactions\n WHERE service_id = $1 AND id = $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "transaction_lt", + "type_info": "Numeric" + }, + { + "ordinal": 5, + "name": "transaction_timeout", + "type_info": "Int8" + }, + { + "ordinal": 6, + "name": "transaction_scan_lt", + "type_info": "Int8" + }, + { + "ordinal": 7, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 8, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 9, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 10, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "messages", + "type_info": "Jsonb" + }, + { + "ordinal": 13, + "name": "messages_hash", + "type_info": "Jsonb" + }, + { + "ordinal": 14, + "name": "data", + "type_info": "Jsonb" + }, + { + "ordinal": 15, + "name": "original_value", + "type_info": "Numeric" + }, + { + "ordinal": 16, + "name": "original_outputs", + "type_info": "Jsonb" + }, + { + "ordinal": 17, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 18, + "name": "fee", + "type_info": "Numeric" + }, + { + "ordinal": 19, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 20, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 21, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 22, + "name": "error", + "type_info": "Text" + }, + { + "ordinal": 23, + "name": "aborted", + "type_info": "Bool" + }, + { + "ordinal": 24, + "name": "bounce", + "type_info": "Bool" + }, + { + "ordinal": 25, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 26, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 27, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + true, + true, + true, + true, + true, + true, + true, + false, + false, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "f09a0d5c3af66fc9255d8faae853fbb8528afc6ccac8b6b8f7596790bde8793b" +} diff --git a/.sqlx/query-f52f3f7896390c399a2e726075442c84c792f8b85b7283addc9571e518e2dfcc.json b/.sqlx/query-f52f3f7896390c399a2e726075442c84c792f8b85b7283addc9571e518e2dfcc.json new file mode 100644 index 0000000..f7223cc --- /dev/null +++ b/.sqlx/query-f52f3f7896390c399a2e726075442c84c792f8b85b7283addc9571e518e2dfcc.json @@ -0,0 +1,148 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT te.id,\n te.service_id as \"service_id: _\",\n te.transaction_id,\n t.transaction_hash,\n te.message_hash,\n te.account_workchain_id,\n te.account_hex,\n te.sender_workchain_id,\n te.sender_hex,\n te.balance_change,\n te.transaction_direction as \"transaction_direction: _\",\n te.transaction_status as \"transaction_status: _\",\n te.event_status as \"event_status: _\",\n te.multisig_transaction_id, te.created_at, te.updated_at\n FROM transaction_events te\n LEFT JOIN transactions t on t.id = te.transaction_id\n WHERE te.service_id = $1 AND te.message_hash = $2 AND te.account_workchain_id = $3 AND te.account_hex = $4", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 6, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 8, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "balance_change", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "transaction_direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 11, + "name": "transaction_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "PartiallyDone", + "Error" + ] + } + } + } + }, + { + "ordinal": 12, + "name": "event_status: _", + "type_info": { + "Custom": { + "name": "twa_transaction_event_status", + "kind": { + "Enum": [ + "New", + "Notified", + "Error" + ] + } + } + } + }, + { + "ordinal": 13, + "name": "multisig_transaction_id", + "type_info": "Int8" + }, + { + "ordinal": 14, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 15, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text", + "Int4", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + true, + false, + false, + false, + true, + true, + true, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "f52f3f7896390c399a2e726075442c84c792f8b85b7283addc9571e518e2dfcc" +} diff --git a/.sqlx/query-f5eb1778f8d89e57ae3320cd1595de9825a42d9642374494b2795d080897b2ef.json b/.sqlx/query-f5eb1778f8d89e57ae3320cd1595de9825a42d9642374494b2795d080897b2ef.json new file mode 100644 index 0000000..4921492 --- /dev/null +++ b/.sqlx/query-f5eb1778f8d89e57ae3320cd1595de9825a42d9642374494b2795d080897b2ef.json @@ -0,0 +1,70 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT address, owner_account_workchain_id, owner_account_hex, root_address, code_hash, created_at, version as \"version: _\"\n FROM token_owners\n WHERE owner_account_workchain_id = $1 AND owner_account_hex = $2 AND root_address = $3", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "address", + "type_info": "Varchar" + }, + { + "ordinal": 1, + "name": "owner_account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "owner_account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 4, + "name": "code_hash", + "type_info": "Bytea" + }, + { + "ordinal": 5, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 6, + "name": "version: _", + "type_info": { + "Custom": { + "name": "twa_token_wallet_version", + "kind": { + "Enum": [ + "OldTip3v4", + "Tip3" + ] + } + } + } + } + ], + "parameters": { + "Left": [ + "Int4", + "Text", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "f5eb1778f8d89e57ae3320cd1595de9825a42d9642374494b2795d080897b2ef" +} diff --git a/.sqlx/query-fe806a6afc3ffb3027a6d01552407a8e7517e63afba46e18cdfff8e9337fd3bd.json b/.sqlx/query-fe806a6afc3ffb3027a6d01552407a8e7517e63afba46e18cdfff8e9337fd3bd.json new file mode 100644 index 0000000..a4e3091 --- /dev/null +++ b/.sqlx/query-fe806a6afc3ffb3027a6d01552407a8e7517e63afba46e18cdfff8e9337fd3bd.json @@ -0,0 +1,164 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT id, service_id as \"service_id: _\", transaction_hash, transaction_timestamp,\n message_hash, owner_message_hash, account_workchain_id, account_hex,\n value, sender_workchain_id, sender_hex, root_address, payload, error, block_hash, block_time,\n direction as \"direction: _\", status as \"status: _\", in_message_hash, created_at, updated_at\n FROM token_transactions\n WHERE service_id = $1 AND (message_hash = $2 OR owner_message_hash = $2 OR in_message_hash = $2)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "service_id: _", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "transaction_hash", + "type_info": "Varchar" + }, + { + "ordinal": 3, + "name": "transaction_timestamp", + "type_info": "Timestamp" + }, + { + "ordinal": 4, + "name": "message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "owner_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "account_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 7, + "name": "account_hex", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "value", + "type_info": "Numeric" + }, + { + "ordinal": 9, + "name": "sender_workchain_id", + "type_info": "Int4" + }, + { + "ordinal": 10, + "name": "sender_hex", + "type_info": "Varchar" + }, + { + "ordinal": 11, + "name": "root_address", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "payload", + "type_info": "Bytea" + }, + { + "ordinal": 13, + "name": "error", + "type_info": "Varchar" + }, + { + "ordinal": 14, + "name": "block_hash", + "type_info": "Varchar" + }, + { + "ordinal": 15, + "name": "block_time", + "type_info": "Int4" + }, + { + "ordinal": 16, + "name": "direction: _", + "type_info": { + "Custom": { + "name": "twa_transaction_direction", + "kind": { + "Enum": [ + "Send", + "Receive" + ] + } + } + } + }, + { + "ordinal": 17, + "name": "status: _", + "type_info": { + "Custom": { + "name": "twa_token_transaction_status", + "kind": { + "Enum": [ + "New", + "Done", + "Error" + ] + } + } + } + }, + { + "ordinal": 18, + "name": "in_message_hash", + "type_info": "Varchar" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamp" + }, + { + "ordinal": 20, + "name": "updated_at", + "type_info": "Timestamp" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + true, + true, + false, + true, + false, + false, + false, + true, + true, + false, + true, + true, + true, + true, + false, + false, + true, + false, + false + ] + }, + "hash": "fe806a6afc3ffb3027a6d01552407a8e7517e63afba46e18cdfff8e9337fd3bd" +} diff --git a/Cargo.lock b/Cargo.lock index ac153ac..506a970 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,22 +1,17 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] -name = "addr2line" -version = "0.24.2" +name = "Inflector" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" dependencies = [ - "gimli", + "lazy_static", + "regex", ] -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "aead" version = "0.5.2" @@ -27,36 +22,25 @@ dependencies = [ "generic-array", ] -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] - [[package]] name = "ahash" version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom", + "getrandom 0.2.16", "once_cell", "version_check", ] [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", - "getrandom", + "getrandom 0.3.4", "once_cell", "version_check", "zerocopy", @@ -64,24 +48,53 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" dependencies = [ "memchr", ] [[package]] -name = "allocator-api2" -version = "0.2.18" +name = "aide" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +checksum = "5678d2978845ddb4bd736a026f467dd652d831e9e6254b0e41b07f7ee7523309" +dependencies = [ + "aide-macros", + "axum", + "axum-extra", + "bytes", + "cfg-if", + "http 1.4.0", + "indexmap", + "schemars", + "serde", + "serde_json", + "serde_qs", + "thiserror 1.0.69", + "tower-layer", + "tower-service", + "tracing", +] [[package]] -name = "android-tzdata" -version = "0.1.1" +name = "aide-macros" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0487f8598afe49e6bc950a613a678bd962c4a6f431022ded62643c8b990301a" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android_system_properties" @@ -93,48 +106,67 @@ dependencies = [ ] [[package]] -name = "anyhow" -version = "1.0.91" +name = "anstream" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] [[package]] -name = "arc-swap" -version = "1.7.1" +name = "anstyle" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] -name = "argh" -version = "0.1.12" +name = "anstyle-parse" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7af5ba06967ff7214ce4c7419c7d185be7ecd6cc4965a8f6e1d8ce0398aad219" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ - "argh_derive", - "argh_shared", + "utf8parse", ] [[package]] -name = "argh_derive" -version = "0.1.12" +name = "anstyle-query" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56df0aeedf6b7a2fc67d06db35b09684c3e8da0c95f8f27685cb17e08413d87a" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "argh_shared", - "proc-macro2", - "quote", - "syn 2.0.82", + "windows-sys 0.61.2", ] [[package]] -name = "argh_shared" -version = "0.1.12" +name = "anstyle-wincon" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5693f39141bda5760ecc4111ab08da40565d1771038c4a0250f03457ec707531" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ - "serde", + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "arc-swap" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69f7f8c3906b62b754cd5326047894316021dcfe5a194c8ea52bdd94934a3457" + [[package]] name = "argon2" version = "0.4.1" @@ -152,15 +184,21 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] @@ -180,24 +218,48 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "aws-lc-rs" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b5ce75405893cd713f9ab8e297d8e438f624dde7d706108285f7e17a25a180f" +dependencies = [ + "aws-lc-sys", + "zeroize", +] + +[[package]] +name = "aws-lc-sys" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "179c3777a8b5e70e90ea426114ffc565b2c1a9f82f6c4a0c5a34aa6ef5e781b6" +dependencies = [ + "cc", + "cmake", + "dunce", + "fs_extra", +] [[package]] name = "axum" -version = "0.5.17" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acee9fd5073ab6b045a275b3e709c163dd36c90685219cb21804a147b58dba43" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", - "bitflags 1.3.2", + "axum-macros", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.8.1", + "hyper-util", "itoa", "matchit", "memchr", @@ -205,46 +267,72 @@ dependencies = [ "multer", "percent-encoding", "pin-project-lite", + "rustversion", "serde", "serde_json", + "serde_path_to_error", "serde_urlencoded", "sync_wrapper", "tokio", "tower", - "tower-http", "tower-layer", "tower-service", + "tracing", ] [[package]] name = "axum-core" -version = "0.2.9" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e5939e02c56fecd5c017c37df4238c0a839fa76b7f97acdd7efb804fd181cc" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", "futures-util", - "http 0.2.12", - "http-body 0.4.6", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", "tower-layer", "tower-service", + "tracing", ] [[package]] -name = "backtrace" -version = "0.3.74" +name = "axum-extra" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", + "axum", + "axum-core", + "bytes", + "fastrand", + "futures-util", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "mime", + "multer", + "pin-project-lite", + "serde", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d123550fa8d071b7255cb0cc04dc302baa6c8c4a79f55701552684d8399bce" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -259,12 +347,6 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -273,15 +355,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" [[package]] name = "bigdecimal" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" +checksum = "560f42649de9fa436b73517378a147ec21f6c997a546581df4b4b31677828934" dependencies = [ "autocfg", "libm", @@ -293,37 +375,29 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.5" +version = "0.72.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088" +checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cexpr", "clang-sys", - "itertools 0.12.1", - "lazy_static", - "lazycell", + "itertools 0.13.0", "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 2.1.1", "shlex", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" dependencies = [ - "serde", + "serde_core", ] [[package]] @@ -335,6 +409,21 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "blake3" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "memmap2", + "rayon-core", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -354,32 +443,19 @@ dependencies = [ ] [[package]] -name = "broxus-util" -version = "0.2.7" +name = "bumpalo" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bed246b9cbc85608c996cc7077b4c70ae7a1445436e76087c507751e621ed7d" -dependencies = [ - "base64 0.13.1", - "config", - "errno", - "hex", - "log", - "log4rs", - "public-ip", - "regex", - "serde", - "serde_yaml", - "thiserror", - "tikv-jemalloc-sys", - "tikv-jemallocator", - "url", -] +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] -name = "bumpalo" -version = "3.16.0" +name = "bumpalo-herd" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "c51ab7ee02d3459317cc16fec045966c9120733a10229541acaf3cc81b137c95" +dependencies = [ + "bumpalo", +] [[package]] name = "byteorder" @@ -389,36 +465,67 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +dependencies = [ + "serde", +] [[package]] name = "bytesize" -version = "1.3.0" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" +checksum = "2e93abca9e28e0a1b9877922aacb20576e05d4679ffa78c3d6dc22a26a216659" dependencies = [ "serde", ] [[package]] name = "bzip2-sys" -version = "0.1.11+1.0.8" +version = "0.1.13+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" dependencies = [ "cc", - "libc", "pkg-config", ] +[[package]] +name = "cassadilia" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b241c1e0296981e531864393cabeccba83061a6e79e5556cc267eca5cf2f0d92" +dependencies = [ + "ahash 0.8.12", + "blake3", + "bytes", + "hex", + "libc", + "parking_lot", + "serde", + "serde_json", + "tempfile", + "thiserror 2.0.17", + "tracing", +] + +[[package]] +name = "castaway" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" -version = "1.1.31" +version = "1.2.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "c481bdbf0ed3b892f6f806287d72acd515b352a4ec27a208489b8c1bc839633a" dependencies = [ + "find-msvc-tools", "jobserver", "libc", "shlex", @@ -435,9 +542,15 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chacha20" @@ -465,17 +578,16 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -501,27 +613,67 @@ dependencies = [ ] [[package]] -name = "concurrent-queue" -version = "2.5.0" +name = "clap" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +checksum = "c9e340e012a1bf4935f5282ed1436d1489548e8f72308207ea5df0e23d2d03f8" dependencies = [ - "crossbeam-utils", + "clap_builder", + "clap_derive", ] [[package]] -name = "config" -version = "0.13.4" +name = "clap_builder" +version = "4.5.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23738e11972c7643e4ec947840fc463b6a571afcd3e735bdfce7d03c7a784aca" +checksum = "d76b5d13eaa18c901fd2f7fca939fefe3a0727a953561fefdf3b2922b8569d00" dependencies = [ - "async-trait", - "lazy_static", - "nom", - "pathdiff", - "serde", - "serde_json", - "yaml-rust", + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "clap_lex" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" + +[[package]] +name = "cmake" +version = "0.1.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7caa3f9de89ddbe2c607f4101924c5abec803763ae9534e4f4d7d8f84aa81f0" +dependencies = [ + "cc", +] + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", ] [[package]] @@ -530,6 +682,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + [[package]] name = "convert_case" version = "0.6.0" @@ -549,6 +707,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -563,18 +731,18 @@ checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" [[package]] name = "cpufeatures" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.2.1" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" dependencies = [ "crc-catalog", ] @@ -586,18 +754,42 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] -name = "crossbeam-deque" -version = "0.8.5" +name = "crc32c" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +checksum = "3a47af21622d091a8f0fb295b88bc886ac74efcc613efc19f5d0b21de5c89e47" dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", + "rustc_version", ] [[package]] -name = "crossbeam-epoch" -version = "0.9.18" +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-channel" +version = "0.5.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ @@ -606,33 +798,33 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" [[package]] name = "crypto-common" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ "generic-array", - "rand_core", + "rand_core 0.6.4", "typenum", ] @@ -648,23 +840,14 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.11.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" +checksum = "25fab6889090c8133f3deb8f73ba3c65a7f456f66436fc012a1b1e272b1e103e" dependencies = [ "generic-array", "subtle", ] -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -688,7 +871,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] @@ -699,44 +882,79 @@ checksum = "1c359b7249347e46fb28804470d071c921156ad62b3eef5d34e2ba867533dec8" dependencies = [ "byteorder", "digest 0.9.0", - "rand_core", + "rand_core 0.6.4", "subtle-ng", "zeroize", ] [[package]] name = "darling" -version = "0.10.2" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.21.3", + "darling_macro 0.21.3", ] [[package]] name = "darling_core" -version = "0.10.2" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 1.0.109", + "syn 2.0.111", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.111", ] [[package]] name = "darling_macro" -version = "0.10.2" +version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core", + "darling_core 0.20.11", "quote", - "syn 1.0.109", + "syn 2.0.111", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", + "quote", + "syn 2.0.111", ] [[package]] @@ -753,26 +971,30 @@ dependencies = [ ] [[package]] -name = "data-encoding" -version = "2.6.0" +name = "dashmap" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] [[package]] -name = "debugid" -version = "0.8.0" +name = "data-encoding" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" -dependencies = [ - "serde", - "uuid", -] +checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "der" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ "const-oid", "pem-rfc7468", @@ -781,49 +1003,13 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" -dependencies = [ - "darling", - "derive_builder_core", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_builder_core" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "derive_more" version = "1.0.0" @@ -842,16 +1028,10 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", "unicode-xid", ] -[[package]] -name = "destructure_traitobject" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c877555693c14d2f84191cfd3ad8582790fc52b5e2274b40b59cf5f5cea25c7" - [[package]] name = "digest" version = "0.9.0" @@ -874,15 +1054,14 @@ dependencies = [ ] [[package]] -name = "dns-lookup" -version = "1.0.8" +name = "displaydoc" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ecafc952c4528d9b51a458d1a8904b81783feff9fde08ab6ed2545ff396872" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ - "cfg-if", - "libc", - "socket2 0.4.10", - "winapi", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] @@ -897,11 +1076,17 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + [[package]] name = "dyn-clone" -version = "1.0.17" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" [[package]] name = "ed25519" @@ -912,14 +1097,24 @@ dependencies = [ "signature 1.6.4", ] +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature 2.2.0", +] + [[package]] name = "ed25519-dalek" version = "1.0.1" source = "git+https://github.com/broxus/ed25519-dalek.git#e5d68fd1490a7f6a0d473c6c1b1acef868960471" dependencies = [ "curve25519-dalek-ng", - "ed25519", - "rand", + "ed25519 1.5.3", + "rand 0.8.5", "serde", "sha2 0.9.9", "zeroize", @@ -927,18 +1122,18 @@ dependencies = [ [[package]] name = "either" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ "serde", ] [[package]] name = "encoding_rs" -version = "0.8.34" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -951,34 +1146,21 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "enum-as-inner" -version = "0.3.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570d109b813e904becc80d8d5da38376818a143348413f7149f1340fe04754d4" +checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" dependencies = [ - "heck 0.4.1", + "heck 0.5.0", "proc-macro2", "quote", - "syn 1.0.109", -] - -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", + "syn 2.0.111", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "erased-serde" @@ -991,12 +1173,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1012,9 +1194,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "5.3.1" +version = "5.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +checksum = "e13b66accf52311f30a0db42147dadea9850cb48cd070028831ae5f5d4b856ab" dependencies = [ "concurrent-queue", "parking", @@ -1022,65 +1204,19 @@ dependencies = [ ] [[package]] -name = "everscale-crypto" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0304a55e328ca4f354e59e6816bccb43b03f681b85b31c6bd10ea7233d62b5" -dependencies = [ - "curve25519-dalek", - "generic-array", - "hex", - "rand", - "sha2 0.10.8", - "tl-proto", -] - -[[package]] -name = "everscale-network" -version = "0.5.5" +name = "exponential-backoff" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f25d8b1ab4e223f7141db064f5b5d197d1c20cd1d44560661748ae7dc1fbf8" +checksum = "949eb68d436415e37b7a69c49a9900d5337616b0e420377ccc48038b86261e16" dependencies = [ - "aes", - "ahash 0.8.11", - "anyhow", - "async-trait", - "bytes", - "crossbeam-queue", - "ctr", - "dashmap", - "everscale-crypto", - "everscale-raptorq", - "frunk_core", - "futures-util", - "generic-array", - "hex", - "libc", - "once_cell", - "parking_lot", - "rand", - "serde", - "sha2 0.10.8", - "smallvec", - "thiserror", - "tl-proto", - "tokio", - "tokio-util", - "tracing", - "zstd", + "fastrand", ] -[[package]] -name = "everscale-raptorq" -version = "1.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719e7eca52068b4712789379ef850e5c08b3316bccab5be12d1cb9fcb323a57c" - [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fdlimit" @@ -1089,7 +1225,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182f7dbc2ef73d9ef67351c5fbbea084729c48362d3ce9dd44c28e32e277fe5" dependencies = [ "libc", - "thiserror", + "thiserror 1.0.69", ] [[package]] @@ -1098,6 +1234,12 @@ version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + [[package]] name = "flume" version = "0.11.1" @@ -1117,9 +1259,15 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.3" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foldhash" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] name = "foreign-types" @@ -1138,21 +1286,18 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" dependencies = [ "percent-encoding", ] [[package]] -name = "frunk_core" -version = "0.4.3" +name = "fs_extra" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3529a07095650187788833d585c219761114005d5976185760cf794d265b6a5c" -dependencies = [ - "serde", -] +checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "futures" @@ -1221,7 +1366,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] @@ -1264,74 +1409,63 @@ dependencies = [ "version_check", ] +[[package]] +name = "getip" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271272f4aa3689fd08e21dc3d2656156a67271a0bc21a370c8cc9a7b212d51a0" +dependencies = [ + "futures-util", + "hickory-client", + "thiserror 2.0.17", + "tokio", +] + [[package]] name = "getrandom" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "glob" -version = "0.3.1" +name = "getrandom" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "global-config" -version = "0.1.0" -source = "git+https://github.com/broxus/ton-indexer.git#72f9e6335a0b51d7675206867eaf835cf25f3854" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ - "anyhow", - "base64 0.13.1", - "everscale-crypto", - "everscale-network", - "serde", - "serde_json", - "ton_block", + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", ] [[package]] -name = "h2" -version = "0.3.26" +name = "glob" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 0.2.12", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "h2" -version = "0.4.6" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.1.0", + "http 1.4.0", "indexmap", "slab", "tokio", @@ -1353,27 +1487,34 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ - "ahash 0.8.11", "allocator-api2", + "equivalent", + "foldhash 0.1.5", ] [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "foldhash", + "foldhash 0.2.0", ] [[package]] name = "hashlink" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.5", ] [[package]] @@ -1389,22 +1530,54 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] -name = "hermit-abi" -version = "0.3.9" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hermit-abi" -version = "0.4.0" +name = "hickory-client" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" +checksum = "c466cd63a4217d5b2b8e32f23f58312741ce96e3c84bf7438677d2baff0fc555" +dependencies = [ + "cfg-if", + "data-encoding", + "futures-channel", + "futures-util", + "hickory-proto", + "once_cell", + "radix_trie", + "rand 0.9.2", + "thiserror 2.0.17", + "tokio", + "tracing", +] [[package]] -name = "hex" -version = "0.4.3" +name = "hickory-proto" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" +dependencies = [ + "async-trait", + "cfg-if", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "once_cell", + "rand 0.9.2", + "ring", + "thiserror 2.0.17", + "tinyvec", + "tokio", + "tracing", + "url", +] [[package]] name = "hkdf" @@ -1431,7 +1604,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac 0.11.1", + "crypto-mac 0.11.0", "digest 0.9.0", ] @@ -1457,28 +1630,23 @@ dependencies = [ [[package]] name = "hmac-sha256" -version = "1.1.7" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3688e69b38018fec1557254f64c8dc2cc8ec502890182f395dbb0aa997aa5735" +checksum = "ad6880c8d4a9ebf39c6e8b77007ce223f646a4d21ce29d99f70cb16420545425" [[package]] -name = "home" -version = "0.5.9" +name = "hmac-sha512" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] +checksum = "77e806677ce663d0a199541030c816847b36e8dc095f70dae4a4f4ad63da5383" [[package]] -name = "hostname" -version = "0.3.1" +name = "home" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ - "libc", - "match_cfg", - "winapi", + "windows-sys 0.61.2", ] [[package]] @@ -1494,12 +1662,11 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -1521,33 +1688,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.4.0", ] [[package]] name = "http-body-util" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", - "http 1.1.0", + "futures-core", + "http 1.4.0", "http-body 1.0.1", "pin-project-lite", ] -[[package]] -name = "http-range-header" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add0ab9360ddbd88cfeb3bd9574a1d85cfdfa14db10b3e21d3700dbc4328758f" - [[package]] name = "httparse" -version = "1.9.5" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -1557,28 +1718,27 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" -version = "2.1.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "135b12329e5e3ce057a9f972339ea52bc954fe1e9358ef27f95e89716fbc5424" [[package]] name = "hyper" -version = "0.14.31" +version = "0.14.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c08302e8fa335b151b788c775ff56e7a03ae64ff85c548ee820fecb70356e85" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" dependencies = [ "bytes", "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", "http 0.2.12", "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.7", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -1587,83 +1747,99 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", - "h2 0.4.6", - "http 1.1.0", + "futures-core", + "h2", + "http 1.4.0", "http-body 1.0.1", "httparse", "httpdate", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", "want", ] [[package]] -name = "hyper-system-resolver" -version = "0.5.0" +name = "hyper-rustls" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eea26c5d0b6ab9d72219f65000af310f042a740926f7b2fa3553e774036e2e7" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "derive_builder", - "dns-lookup", - "hyper 0.14.31", + "http 1.4.0", + "hyper 1.8.1", + "hyper-util", + "rustls", + "rustls-native-certs", + "rustls-pki-types", "tokio", + "tokio-rustls", "tower-service", - "tracing", ] [[package]] name = "hyper-tls" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" dependencies = [ "bytes", - "hyper 0.14.31", + "http-body-util", + "hyper 1.8.1", + "hyper-util", "native-tls", "tokio", "tokio-native-tls", + "tower-service", ] [[package]] name = "hyper-util" -version = "0.1.9" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" dependencies = [ + "base64 0.22.1", "bytes", "futures-channel", + "futures-core", "futures-util", - "http 1.1.0", + "http 1.4.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.8.1", + "ipnet", + "libc", + "percent-encoding", "pin-project-lite", - "socket2 0.5.7", + "socket2 0.6.1", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", - "windows-core", + "windows-core 0.62.2", ] [[package]] @@ -1675,6 +1851,87 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1683,61 +1940,68 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.2.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", ] [[package]] -name = "idna" -version = "0.5.0" +name = "idna_adapter" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.6.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.16.1", + "serde", + "serde_core", ] [[package]] name = "inout" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" dependencies = [ "generic-array", ] [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] -name = "is-terminal" -version = "0.4.13" +name = "iri-string" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261f68e344040fbd0edea105bef17c66edf46f984ddb1115b775ce31be948f4b" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" dependencies = [ - "hermit-abi 0.4.0", - "libc", - "windows-sys 0.52.0", + "memchr", + "serde", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + [[package]] name = "itertools" version = "0.10.5" @@ -1749,34 +2013,36 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jobserver" -version = "0.1.32" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" dependencies = [ + "getrandom 0.3.4", "libc", ] [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "464a3709c7f55f1f721e5389aa6ea4e3bc6aba669353300af094b29ffbdde1d8" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1789,44 +2055,48 @@ dependencies = [ "spin", ] -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - [[package]] name = "libc" -version = "0.2.161" +version = "0.2.178" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091" [[package]] name = "libloading" -version = "0.8.5" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] name = "libm" -version = "0.2.8" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "libredox" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags", + "libc", + "redox_syscall", +] [[package]] name = "librocksdb-sys" -version = "0.16.0+8.10.0" +version = "0.17.3+10.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce3d60bc059831dc1c83903fb45c103f75db65c5a7bf22272764d9cc683e348c" +checksum = "cef2a00ee60fe526157c9023edab23943fae1ce2ab6f4abb2a807c1746835de9" dependencies = [ "bindgen", "bzip2-sys", "cc", - "glob", "libc", "libz-sys", "lz4-sys", @@ -1846,7 +2116,7 @@ dependencies = [ "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", - "rand", + "rand 0.8.5", "serde", "sha2 0.9.9", "typenum", @@ -1884,16 +2154,15 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ - "cc", "pkg-config", "vcpkg", ] [[package]] name = "libz-sys" -version = "1.1.20" +version = "1.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472" +checksum = "15d118bbf3771060e7311cc7bb0545b01d08a8b4a7de949198dec1fa0ca1c0f7" dependencies = [ "cc", "pkg-config", @@ -1901,68 +2170,33 @@ dependencies = [ ] [[package]] -name = "linked-hash-map" -version = "0.5.6" +name = "linux-raw-sys" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] -name = "linux-raw-sys" -version = "0.4.14" +name = "litemap" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" [[package]] name = "lock_api" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" dependencies = [ - "autocfg", "scopeguard", ] [[package]] name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -dependencies = [ - "serde", -] - -[[package]] -name = "log-mdc" -version = "0.1.0" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7" - -[[package]] -name = "log4rs" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0816135ae15bd0391cf284eab37e6e3ee0a6ee63d2ceeb659862bd8d0a984ca6" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" dependencies = [ - "anyhow", - "arc-swap", - "chrono", - "derivative", - "fnv", - "humantime", - "libc", - "log", - "log-mdc", - "once_cell", - "parking_lot", - "rand", - "serde", - "serde-value", - "serde_json", - "serde_yaml", - "thiserror", - "thread-id", - "typemap-ors", - "winapi", + "serde_core", ] [[package]] @@ -1974,6 +2208,12 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "lz4-sys" version = "1.11.1+lz4-1.10.0" @@ -1985,22 +2225,19 @@ dependencies = [ ] [[package]] -name = "match_cfg" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" - -[[package]] -name = "matches" -version = "0.1.10" +name = "matchers" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" +dependencies = [ + "regex-automata", +] [[package]] name = "matchit" -version = "0.5.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "md-5" @@ -2014,9 +2251,18 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] [[package]] name = "memzero" @@ -2037,40 +2283,51 @@ dependencies = [ [[package]] name = "metrics" -version = "0.22.3" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be3cbd384d4e955b231c895ce10685e3d8260c5ccffae898c96c723b0772835" +checksum = "5d5312e9ba3771cfa961b585728215e3d972c950a3eed9252aa093d6301277e8" dependencies = [ - "ahash 0.8.11", - "portable-atomic 1.9.0", + "ahash 0.8.12", + "portable-atomic 1.11.1", ] [[package]] -name = "metrics" -version = "0.24.0" +name = "metrics-exporter-prometheus" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae428771d17306715c5091d446327d1cfdedc82185c65ba8423ab404e45bf10" +checksum = "dd7399781913e5393588a8d8c6a2867bf85fb38eaf2502fdce465aad2dc6f034" dependencies = [ - "ahash 0.8.11", - "portable-atomic 1.9.0", + "base64 0.22.1", + "http-body-util", + "hyper 1.8.1", + "hyper-util", + "indexmap", + "ipnet", + "metrics 0.24.3", + "metrics-util 0.19.1", + "quanta", + "thiserror 1.0.69", + "tokio", + "tracing", ] [[package]] name = "metrics-exporter-prometheus" -version = "0.16.0" +version = "0.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b6f8152da6d7892ff1b7a1c0fa3f435e92b5918ad67035c3bb432111d9a29b" +checksum = "2b166dea96003ee2531cf14833efedced545751d800f03535801d833313f8c15" dependencies = [ "base64 0.22.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.8.1", + "hyper-rustls", "hyper-util", "indexmap", "ipnet", - "metrics 0.24.0", - "metrics-util", + "metrics 0.24.3", + "metrics-util 0.20.1", "quanta", - "thiserror", + "thiserror 2.0.17", "tokio", "tracing", ] @@ -2088,15 +2345,33 @@ dependencies = [ [[package]] name = "metrics-util" -version = "0.18.0" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8496cc523d1f94c1385dd8f0f0c2c480b2b8aeccb5b7e4485ad6365523ae376" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", + "hashbrown 0.15.5", + "metrics 0.24.3", + "quanta", + "rand 0.9.2", + "rand_xoshiro", + "sketches-ddsketch", +] + +[[package]] +name = "metrics-util" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b482df36c13dd1869d73d14d28cd4855fbd6cfc32294bee109908a9f4a4ed7" +checksum = "cdfb1365fea27e6dd9dc1dbc19f570198bc86914533ad639dae939635f096be4" dependencies = [ "crossbeam-epoch", "crossbeam-utils", - "hashbrown 0.15.0", - "metrics 0.24.0", + "hashbrown 0.16.1", + "metrics 0.24.3", "quanta", + "rand 0.9.2", + "rand_xoshiro", "sketches-ddsketch", ] @@ -2113,38 +2388,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] -name = "miniz_oxide" -version = "0.8.0" +name = "mio" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ - "adler2", + "libc", + "wasi", + "windows-sys 0.61.2", ] [[package]] -name = "mio" -version = "1.0.2" +name = "moka" +version = "0.12.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "8261cd88c312e0004c1d51baad2980c66528dfdb2bee62003e643a4d8f86b077" dependencies = [ - "hermit-abi 0.3.9", - "libc", - "wasi", - "windows-sys 0.52.0", + "crossbeam-channel", + "crossbeam-epoch", + "crossbeam-utils", + "equivalent", + "parking_lot", + "portable-atomic 1.11.1", + "rustc_version", + "smallvec", + "tagptr", + "uuid", ] [[package]] name = "multer" -version = "2.1.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" dependencies = [ "bytes", "encoding_rs", "futures-util", - "http 0.2.12", + "http 1.4.0", "httparse", - "log", "memchr", "mime", "spin", @@ -2153,9 +2435,9 @@ dependencies = [ [[package]] name = "native-tls" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ "libc", "log", @@ -2163,7 +2445,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] @@ -2171,7 +2453,7 @@ dependencies = [ [[package]] name = "nekoton" version = "0.13.1" -source = "git+https://github.com/broxus/nekoton.git?rev=561b60e7a47e994500dce9f25933dd8d8fb2987a#561b60e7a47e994500dce9f25933dd8d8fb2987a" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" dependencies = [ "anyhow", "async-trait", @@ -2183,7 +2465,7 @@ dependencies = [ "ed25519-dalek", "erased-serde", "futures-util", - "getrandom", + "getrandom 0.2.16", "hex", "hmac 0.11.0", "log", @@ -2195,12 +2477,13 @@ dependencies = [ "parking_lot", "pbkdf2 0.12.2", "quick_cache 0.4.3", - "rand", + "rand 0.8.5", "secstr", "serde", "serde_json", - "sha2 0.10.8", - "thiserror", + "sha2 0.10.9", + "slip10_ed25519", + "thiserror 1.0.69", "tiny-bip39", "tiny-hderive", "tokio", @@ -2214,7 +2497,7 @@ dependencies = [ [[package]] name = "nekoton-abi" version = "0.13.0" -source = "git+https://github.com/broxus/nekoton.git?rev=561b60e7a47e994500dce9f25933dd8d8fb2987a#561b60e7a47e994500dce9f25933dd8d8fb2987a" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" dependencies = [ "anyhow", "base64 0.13.1", @@ -2226,11 +2509,11 @@ dependencies = [ "num-bigint", "num-traits", "once_cell", - "rustc-hash", + "rustc-hash 1.1.0", "serde", "serde_json", "smallvec", - "thiserror", + "thiserror 1.0.69", "ton_abi", "ton_block", "ton_executor", @@ -2241,14 +2524,15 @@ dependencies = [ [[package]] name = "nekoton-contracts" version = "0.13.0" -source = "git+https://github.com/broxus/nekoton.git?rev=561b60e7a47e994500dce9f25933dd8d8fb2987a#561b60e7a47e994500dce9f25933dd8d8fb2987a" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" dependencies = [ "anyhow", "nekoton-abi", + "nekoton-jetton", "nekoton-utils", "once_cell", "serde", - "thiserror", + "thiserror 1.0.69", "ton_abi", "ton_block", "ton_types", @@ -2257,7 +2541,7 @@ dependencies = [ [[package]] name = "nekoton-derive" version = "0.13.0" -source = "git+https://github.com/broxus/nekoton.git?rev=561b60e7a47e994500dce9f25933dd8d8fb2987a#561b60e7a47e994500dce9f25933dd8d8fb2987a" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" dependencies = [ "either", "proc-macro2", @@ -2266,21 +2550,38 @@ dependencies = [ ] [[package]] -name = "nekoton-utils" +name = "nekoton-jetton" version = "0.13.0" -source = "git+https://github.com/broxus/nekoton.git?rev=561b60e7a47e994500dce9f25933dd8d8fb2987a#561b60e7a47e994500dce9f25933dd8d8fb2987a" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" dependencies = [ "anyhow", - "base64 0.13.1", - "chacha20poly1305", - "ed25519-dalek", + "lazy_static", + "nekoton-utils", + "num-bigint", + "num-traits", + "serde", + "sha2 0.10.9", + "ton_abi", + "ton_block", + "ton_types", +] + +[[package]] +name = "nekoton-utils" +version = "0.13.0" +source = "git+https://github.com/broxus/nekoton.git#9c87c3d74dccf21c474a9ad8c2cc24c8eae96c11" +dependencies = [ + "anyhow", + "base64 0.13.1", + "chacha20poly1305", + "ed25519-dalek", "hex", "hmac 0.11.0", "pbkdf2 0.12.2", "secstr", "serde", - "sha2 0.10.8", - "thiserror", + "sha2 0.10.9", + "thiserror 1.0.69", "ton_block", "ton_types", "zeroize", @@ -2314,6 +2615,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "num" version = "0.4.3" @@ -2340,17 +2650,16 @@ dependencies = [ [[package]] name = "num-bigint-dig" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" dependencies = [ - "byteorder", "lazy_static", "libm", "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -2423,23 +2732,41 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.36.5" +name = "objc2-core-foundation" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" dependencies = [ - "memchr", + "bitflags", +] + +[[package]] +name = "objc2-io-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fafba39597d6dc1fb709123dfa8289d39406734be322956a69f0931c73bb15" +dependencies = [ + "libc", + "objc2-core-foundation", ] [[package]] name = "once_cell" -version = "1.20.2" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" dependencies = [ + "critical-section", "parking_lot_core", + "portable-atomic 1.11.1", ] +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + [[package]] name = "opaque-debug" version = "0.3.1" @@ -2448,11 +2775,11 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.68" +version = "0.10.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +checksum = "08838db121398ad17ab8531ce9de97b244589089e290a384c900cb9ff7434328" dependencies = [ - "bitflags 2.6.0", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -2469,20 +2796,20 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] name = "openssl-probe" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.104" +version = "0.9.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +checksum = "82cab2d520aa75e3c58898289429321eb788c3106963d0dc886ec7a5f4adc321" dependencies = [ "cc", "libc", @@ -2515,15 +2842,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ordered-float" -version = "2.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f19d67e5a2795c94e73e0bb1cc1a7edeb2e28efd39e2e1c9b7a40c1108b11c" -dependencies = [ - "num-traits", -] - [[package]] name = "parking" version = "2.2.1" @@ -2532,9 +2850,9 @@ checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.3" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" dependencies = [ "lock_api", "parking_lot_core", @@ -2542,15 +2860,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.10" +version = "0.9.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-link 0.2.1", ] [[package]] @@ -2560,7 +2878,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2570,19 +2888,13 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "pathdiff" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" - [[package]] name = "pbkdf2" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f05894bce6a1ba4be299d0c5f29563e08af2bc18bb7d48313113bed71e904739" dependencies = [ - "crypto-mac 0.11.1", + "crypto-mac 0.11.0", ] [[package]] @@ -2606,26 +2918,25 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.1" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" [[package]] name = "pest" -version = "2.7.14" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "cbcfd20a6d4eeba40179f05735784ad32bdaef05ce8e8af05f180d45bb3e7e22" dependencies = [ "memchr", - "thiserror", "ucd-trie", ] [[package]] name = "pest_derive" -version = "2.7.14" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" +checksum = "51f72981ade67b1ca6adc26ec221be9f463f2b5839c7508998daa17c23d94d7f" dependencies = [ "pest", "pest_generator", @@ -2633,53 +2944,32 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.14" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" +checksum = "dee9efd8cdb50d719a80088b76f81aec7c41ed6d522ee750178f83883d271625" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] name = "pest_meta" -version = "2.7.14" +version = "2.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" +checksum = "bf1d70880e76bdc13ba52eafa6239ce793d85c8e43896507e43dd8984ff05b82" dependencies = [ - "once_cell", "pest", - "sha2 0.10.8", -] - -[[package]] -name = "pin-project" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", + "sha2 0.10.9", ] [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2710,9 +3000,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "poly1305" @@ -2733,7 +3023,7 @@ checksum = "e53c4222f9cb717bca4be9858e03b93d3d03025fa04caca85e1637cc72cbce8b" dependencies = [ "anyhow", "futures-util", - "hyper 0.14.31", + "hyper 0.14.32", "log", "num-traits", "parking_lot", @@ -2747,14 +3037,23 @@ version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e30165d31df606f5726b090ec7592c308a0eaf61721ff64c9a3018e344a8753e" dependencies = [ - "portable-atomic 1.9.0", + "portable-atomic 1.11.1", ] [[package]] name = "portable-atomic" -version = "1.9.0" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" + +[[package]] +name = "potential_utf" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] [[package]] name = "powerfmt" @@ -2764,48 +3063,27 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ "zerocopy", ] [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] -[[package]] -name = "public-ip" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4c40db5262d93298c363a299f8bc1b3a956a78eecddba3bc0e58b76e2f419a" -dependencies = [ - "dns-lookup", - "futures-core", - "futures-util", - "http 0.2.12", - "hyper 0.14.31", - "hyper-system-resolver", - "pin-project-lite", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "trust-dns-client", - "trust-dns-proto", -] - [[package]] name = "quanta" -version = "0.12.3" +version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" +checksum = "f3ab5a9d756f0d97bdc89019bd2e4ea098cf9cde50ee7564dde6b81ccc8f06c7" dependencies = [ "crossbeam-utils", "libc", @@ -2822,7 +3100,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a4b807ec70346b4fac3c13ae967634237847d49871f623fe0d455403346bad4" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", "equivalent", "hashbrown 0.14.5", "parking_lot", @@ -2830,25 +3108,86 @@ dependencies = [ [[package]] name = "quick_cache" -version = "0.5.2" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb55a1aa7668676bb93926cd4e9cdfe60f03bb866553bcca9112554911b6d3dc" +checksum = "7ada44a88ef953a3294f6eb55d2007ba44646015e18613d2f213016379203ef3" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.16.1", "parking_lot", ] +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.1.1", + "rustls", + "socket2 0.6.1", + "thiserror 2.0.17", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash 2.1.1", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.17", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.1", + "tracing", + "windows-sys 0.60.2", +] + [[package]] name = "quote" -version = "1.0.37" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + [[package]] name = "radix_trie" version = "0.2.1" @@ -2866,8 +3205,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", ] [[package]] @@ -2877,7 +3226,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -2886,23 +3245,41 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_xoshiro" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" +dependencies = [ + "rand_core 0.9.3", ] [[package]] name = "raw-cpuid" -version = "11.2.0" +version = "11.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" +checksum = "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -2910,9 +3287,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -2920,18 +3297,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.7" +version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] name = "regex" -version = "1.11.0" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -2941,9 +3318,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.8" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -2952,48 +3329,62 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.5" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" [[package]] name = "reqwest" -version = "0.11.27" +version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ - "base64 0.21.7", + "base64 0.22.1", "bytes", "encoding_rs", "futures-core", - "futures-util", - "h2 0.3.26", - "http 0.2.12", - "http-body 0.4.6", - "hyper 0.14.31", + "h2", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "hyper 1.8.1", + "hyper-rustls", "hyper-tls", - "ipnet", + "hyper-util", "js-sys", "log", "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", + "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", ] [[package]] @@ -3007,9 +3398,9 @@ dependencies = [ [[package]] name = "rocksdb" -version = "0.22.0" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bd13e55d6d7b8cd0ea569161127567cd587676c99f4472f779a0279aa60a7a7" +checksum = "ddb7af00d2b17dbd07d82c0063e25411959748ff03e8d4f96134c2ff41fce34f" dependencies = [ "libc", "librocksdb-sys", @@ -3017,9 +3408,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" dependencies = [ "const-oid", "digest 0.10.7", @@ -3028,7 +3419,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature 2.2.0", "spki", "subtle", @@ -3036,16 +3427,16 @@ dependencies = [ ] [[package]] -name = "rustc-demangle" -version = "0.1.24" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "1.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustc_version" @@ -3058,45 +3449,132 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.37" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] -name = "rustls-pemfile" -version = "1.0.4" +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "aws-lc-rs", + "log", + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9980d917ebb0c0536119ba501e90834767bffc3d60641457fd84a1f3fd337923" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework 3.5.1", +] + +[[package]] +name = "rustls-pki-types" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "708c0f9d5f54ba0272468c1d306a52c495b31fa155e91bc25371e6df7996908c" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" dependencies = [ - "base64 0.21.7", + "aws-lc-rs", + "ring", + "rustls-pki-types", + "untrusted", ] [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scc" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" +dependencies = [ + "sdd", +] [[package]] name = "schannel" -version = "0.1.26" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891d81b926048e76efe18581bf793546b4c0eaf8448d72be8de2bbee5fd166e1" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "bigdecimal", + "chrono", + "dyn-clone", + "indexmap", + "schemars_derive", + "serde", + "serde_json", + "uuid", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" dependencies = [ - "windows-sys 0.59.0", + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.111", ] [[package]] @@ -3105,6 +3583,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sdd" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" + [[package]] name = "secstr" version = "0.5.1" @@ -3121,8 +3605,21 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", - "core-foundation", + "bitflags", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3297343eaf830f66ede390ea39da1d462b6b0c1b000f420d0a83f898bbbe6ef" +dependencies = [ + "bitflags", + "core-foundation 0.10.1", "core-foundation-sys", "libc", "security-framework-sys", @@ -3130,9 +3627,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.12.0" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", "libc", @@ -3140,143 +3637,86 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] -name = "sentry" -version = "0.27.0" +name = "serde" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73642819e7fa63eb264abc818a2f65ac8764afbe4870b5ee25bcecc491be0d4c" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ - "httpdate", - "log", - "reqwest", - "sentry-backtrace", - "sentry-contexts", - "sentry-core", - "sentry-log", - "sentry-panic", - "tokio", + "serde_core", + "serde_derive", ] [[package]] -name = "sentry-backtrace" -version = "0.27.0" +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49bafa55eefc6dbc04c7dac91e8c8ab9e89e9414f3193c105cabd991bbc75134" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ - "backtrace", - "once_cell", - "regex", - "sentry-core", + "serde_derive", ] [[package]] -name = "sentry-contexts" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c63317c4051889e73f0b00ce4024cae3e6a225f2e18a27d2c1522eb9ce2743da" -dependencies = [ - "hostname", - "libc", - "rustc_version", - "sentry-core", - "uname", -] - -[[package]] -name = "sentry-core" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a4591a2d128af73b1b819ab95f143bc6a2fbe48cd23a4c45e1ee32177e66ae6" -dependencies = [ - "log", - "once_cell", - "rand", - "sentry-types", - "serde", - "serde_json", -] - -[[package]] -name = "sentry-log" -version = "0.27.0" +name = "serde_derive" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58a76b41861ebde9b0a689fa13080ad5508583e094c48acad461eec5acd7fc5f" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ - "log", - "sentry-core", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] -name = "sentry-panic" -version = "0.27.0" +name = "serde_derive_internals" +version = "0.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "696c74c5882d5a0d5b4a31d0ff3989b04da49be7983b7f52a52c667da5b480bf" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ - "sentry-backtrace", - "sentry-core", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] -name = "sentry-types" -version = "0.27.0" +name = "serde_json" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "823923ae5f54a729159d720aa12181673044ee5c79cbda3be09e56f885e5468f" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ - "debugid", - "getrandom", - "hex", + "itoa", + "memchr", + "ryu", "serde", - "serde_json", - "thiserror", - "time", - "url", - "uuid", -] - -[[package]] -name = "serde" -version = "1.0.213" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" -dependencies = [ - "serde_derive", + "serde_core", ] [[package]] -name = "serde-value" -version = "0.7.0" +name = "serde_path_to_error" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" dependencies = [ - "ordered-float", + "itoa", "serde", + "serde_core", ] [[package]] -name = "serde_derive" -version = "1.0.213" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.82", -] - -[[package]] -name = "serde_json" -version = "1.0.132" +name = "serde_qs" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "cd34f36fe4c5ba9654417139a9b3a20d2e1de6012ee678ad14d240c22c78d8d6" dependencies = [ - "itoa", - "memchr", - "ryu", + "axum", + "futures", + "percent-encoding", "serde", + "thiserror 1.0.69", ] [[package]] @@ -3330,15 +3770,24 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", "cpufeatures", "digest 0.10.7", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "1.3.0" @@ -3347,9 +3796,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "7664a098b8e616bdfcc2dc0e9ac44eb231eedf41db4e9fe95d8d32ec728dedad" dependencies = [ "libc", ] @@ -3367,7 +3816,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -3378,40 +3827,46 @@ checksum = "c1e9a774a6c28142ac54bb25d25562e6bcf957493a184f15ad4eebccb23e410a" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "slip10_ed25519" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "4be0ff28bf14f9610a342169084e87a4f435ad798ec528dc7579a3678fa9dc9a" dependencies = [ - "autocfg", + "hmac-sha512", ] [[package]] name = "smallvec" -version = "1.13.2" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] [[package]] name = "socket2" -version = "0.4.10" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", - "winapi", + "windows-sys 0.52.0", ] [[package]] name = "socket2" -version = "0.5.7" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.60.2", ] [[package]] @@ -3433,21 +3888,11 @@ dependencies = [ "der", ] -[[package]] -name = "sqlformat" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bba3a93db0cc4f7bdece8bb09e77e2e785c20bfebf79eb8340ed80708048790" -dependencies = [ - "nom", - "unicode_categories", -] - [[package]] name = "sqlx" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3458,40 +3903,35 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" dependencies = [ - "atoi", + "base64 0.22.1", "bigdecimal", - "byteorder", "bytes", "chrono", "crc", "crossbeam-queue", "either", "event-listener", - "futures-channel", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.14.5", + "hashbrown 0.15.5", "hashlink", - "hex", "indexmap", "log", "memchr", "native-tls", "once_cell", - "paste", "percent-encoding", "serde", "serde_json", - "sha2 0.10.8", + "sha2 0.10.9", "smallvec", - "sqlformat", - "thiserror", + "thiserror 2.0.17", "tokio", "tokio-stream", "tracing", @@ -3501,22 +3941,22 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] name = "sqlx-macros-core" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" dependencies = [ "dotenvy", "either", @@ -3527,27 +3967,26 @@ dependencies = [ "quote", "serde", "serde_json", - "sha2 0.10.8", + "sha2 0.10.9", "sqlx-core", "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.82", - "tempfile", + "syn 2.0.111", "tokio", "url", ] [[package]] name = "sqlx-mysql" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" dependencies = [ "atoi", "base64 0.22.1", "bigdecimal", - "bitflags 2.6.0", + "bitflags", "byteorder", "bytes", "chrono", @@ -3569,15 +4008,15 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "serde", "sha1", - "sha2 0.10.8", + "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.17", "tracing", "uuid", "whoami", @@ -3585,14 +4024,14 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" dependencies = [ "atoi", "base64 0.22.1", "bigdecimal", - "bitflags 2.6.0", + "bitflags", "byteorder", "chrono", "crc", @@ -3600,7 +4039,6 @@ dependencies = [ "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", @@ -3612,14 +4050,14 @@ dependencies = [ "memchr", "num-bigint", "once_cell", - "rand", + "rand 0.8.5", "serde", "serde_json", - "sha2 0.10.8", + "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", - "thiserror", + "thiserror 2.0.17", "tracing", "uuid", "whoami", @@ -3627,9 +4065,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" dependencies = [ "atoi", "chrono", @@ -3645,6 +4083,7 @@ dependencies = [ "serde", "serde_urlencoded", "sqlx-core", + "thiserror 2.0.17", "tracing", "url", "uuid", @@ -3652,9 +4091,9 @@ dependencies = [ [[package]] name = "stable_deref_trait" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" [[package]] name = "stringprep" @@ -3669,9 +4108,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.9.3" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "strum" @@ -3694,9 +4133,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.1" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "subtle-ng" @@ -3717,9 +4156,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.82" +version = "2.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" +checksum = "390cc9a294ab71bdb1aa2e99d13be9c753cd2d7bd6560c77118597410c4d2e87" dependencies = [ "proc-macro2", "quote", @@ -3728,9 +4167,23 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] [[package]] name = "sysinfo" @@ -3744,87 +4197,128 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "windows", + "windows 0.52.0", +] + +[[package]] +name = "sysinfo" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f" +dependencies = [ + "libc", + "memchr", + "ntapi", + "objc2-core-foundation", + "objc2-io-kit", + "windows 0.61.3", ] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 1.3.2", - "core-foundation", + "bitflags", + "core-foundation 0.9.4", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", ] +[[package]] +name = "tagptr" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b2093cf4c8eb1e67749a6762251bc9cd836b6fc171623bd0a9d324d37af2417" + [[package]] name = "tempfile" -version = "3.13.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.4", "once_cell", "rustix", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "thiserror" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "winapi-util", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "1.0.65" +version = "2.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +dependencies = [ + "thiserror-impl 2.0.17", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ - "thiserror-impl", + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", +] + +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", ] [[package]] -name = "thread-id" -version = "4.2.2" +name = "tikv-jemalloc-ctl" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe8f25bbdd100db7e1d34acf7fd2dc59c4bf8f7483f505eaa7d4f12f76cc0ea" +checksum = "661f1f6a57b3a36dc9174a2c10f19513b4866816e13425d3e418b11cc37bc24c" dependencies = [ "libc", - "winapi", + "paste", + "tikv-jemalloc-sys", ] [[package]] name = "tikv-jemalloc-sys" -version = "0.5.4+5.3.0-patched" +version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b" dependencies = [ "cc", "libc", @@ -3832,9 +4326,9 @@ dependencies = [ [[package]] name = "tikv-jemallocator" -version = "0.5.4" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +checksum = "0359b4327f954e0567e69fb191cf1436617748813819c94b8cd4a431422d053a" dependencies = [ "libc", "tikv-jemalloc-sys", @@ -3842,9 +4336,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" dependencies = [ "deranged", "itoa", @@ -3857,15 +4351,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" dependencies = [ "num-conv", "time-core", @@ -3880,10 +4374,10 @@ dependencies = [ "hmac 0.11.0", "once_cell", "pbkdf2 0.9.0", - "rand", - "rustc-hash", + "rand 0.8.5", + "rustc-hash 1.1.0", "sha2 0.9.9", - "thiserror", + "thiserror 1.0.69", "unicode-normalization", "zeroize", ] @@ -3900,11 +4394,21 @@ dependencies = [ "sha2 0.9.9", ] +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" dependencies = [ "tinyvec_macros", ] @@ -3917,71 +4421,70 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tl-proto" -version = "0.4.10" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a6732eb43532a3f636dbd7e3ad8f438af07430aee7ec3c0ac8daf1bbae20317" +checksum = "ce1835e6f318b9a4d93f949c68afa6b7475f37b7cfef3640bfde9132eeb53202" dependencies = [ "bytes", "digest 0.10.7", - "sha2 0.10.8", + "sha2 0.10.9", "smallvec", - "thiserror", + "thiserror 2.0.17", "tl-proto-proc", ] [[package]] name = "tl-proto-proc" -version = "0.4.7" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "140da3028e6bc0a46b168845e3f5252e906d0fbdcc6074f96424fe830c86b9ae" +checksum = "d5befd708aeec539f76e4db4c850567026dac292569ff731de600b7cd7aaab3b" dependencies = [ "proc-macro2", "quote", - "rustc-hash", - "syn 2.0.82", + "rustc-hash 2.1.1", + "syn 2.0.111", "tl-scheme", ] [[package]] name = "tl-scheme" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c495d2f03b113ab2ac9eab55168855ef43c04e0097b58f3eb1287a5da73e51b8" +checksum = "1f0c39863b77e0997772c8e1f19ae9cef5d57d73bbc1fd1a211e0a91668b54d6" dependencies = [ "crc", "pest", "pest_derive", - "rustc-hash", - "thiserror", + "rustc-hash 2.1.1", + "thiserror 2.0.17", ] [[package]] name = "tokio" -version = "1.41.0" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2 0.6.1", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] @@ -3994,11 +4497,21 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f4e6ce100d0eb49a2734f8c0812bcd324cf357d21810932c5df6b96ef2b86f1" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -4007,183 +4520,70 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.12" +version = "0.7.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", + "slab", "tokio", ] [[package]] -name = "ton-indexer" -version = "0.4.1" -source = "git+https://github.com/broxus/ton-indexer.git#72f9e6335a0b51d7675206867eaf835cf25f3854" +name = "ton_abi" +version = "2.1.0" +source = "git+https://github.com/broxus/ton-labs-abi#7d84f87a1799b727e33f9b09c8e38c764fbd5c68" dependencies = [ - "ahash 0.8.11", "anyhow", - "arc-swap", - "async-trait", "base64 0.13.1", - "broxus-util", - "bumpalo", - "bytes", - "bytesize", - "countme", - "crc", - "dashmap", - "everscale-network", - "fdlimit", - "futures-util", - "global-config", + "byteorder", + "ed25519 1.5.3", + "ed25519-dalek", "hex", - "humantime", - "libc", - "metrics 0.22.3", + "num-bigint", "num-traits", - "once_cell", - "parking_lot", - "quick_cache 0.5.2", - "rand", - "rlimit", "serde", "serde_json", - "sha2 0.10.8", + "sha2 0.9.9", "smallvec", - "sysinfo", - "thiserror", - "tl-proto", - "tokio", - "tokio-util", + "thiserror 1.0.69", "ton_block", "ton_types", - "tracing", - "triomphe", - "weedb", ] [[package]] -name = "ton-wallet-api" -version = "1.0.2" +name = "ton_block" +version = "1.9.73" +source = "git+https://github.com/broxus/ton-labs-block#f1c3e222ee6a2b2ccf663f4f2df5e1335b95961a" dependencies = [ "anyhow", - "argh", - "argon2", - "async-trait", - "axum", "base64 0.13.1", - "bigdecimal", - "broxus-util", - "chacha20poly1305", - "chrono", - "config", - "dashmap", - "derive_more", + "crc", + "ed25519 1.5.3", "ed25519-dalek", - "env_logger", - "everscale-network", - "futures", "hex", - "hmac-sha256", - "http 0.2.12", - "hyper 0.14.31", - "itertools 0.10.5", - "lazy_static", - "librocksdb-sys", "log", - "log4rs", - "lru", - "metrics 0.20.1", - "metrics-exporter-prometheus", - "nekoton", - "nekoton-abi", - "nekoton-contracts", - "nekoton-utils", - "num-bigint", + "num", "num-traits", - "opg", - "parking_lot", - "pomfrit", - "rand", - "regex", - "reqwest", - "rustc-hash", - "sentry", - "serde", - "serde_json", - "serde_yaml", - "sqlx", - "strum", - "strum_macros", - "sysinfo", - "thiserror", - "tokio", - "tokio-util", - "ton-indexer", - "ton_abi", - "ton_block", + "rand 0.8.5", + "rustc-hash 1.1.0", + "sha2 0.9.9", + "smallvec", + "thiserror 1.0.69", "ton_types", - "tower", - "tower-http", - "tracing", - "uuid", ] [[package]] -name = "ton_abi" -version = "2.1.0" -source = "git+https://github.com/broxus/ton-labs-abi#b8834529ef8fa121d534fca6554c0e95d4019998" -dependencies = [ - "anyhow", - "base64 0.13.1", - "byteorder", - "ed25519", - "ed25519-dalek", - "hex", - "num-bigint", - "num-traits", - "serde", - "serde_json", - "sha2 0.9.9", - "smallvec", - "thiserror", - "ton_block", - "ton_types", -] - -[[package]] -name = "ton_block" -version = "1.9.73" -source = "git+https://github.com/broxus/ton-labs-block#eb87ac3abcf6b489d51e4da2e52f850594a1644f" -dependencies = [ - "anyhow", - "base64 0.13.1", - "crc", - "ed25519", - "ed25519-dalek", - "hex", - "log", - "num", - "num-traits", - "rand", - "rustc-hash", - "sha2 0.9.9", - "smallvec", - "thiserror", - "ton_types", -] - -[[package]] -name = "ton_executor" -version = "1.15.54" -source = "git+https://github.com/broxus/ton-labs-executor.git#2a38890d53f9c3dad84b3fb9a58e3bb62ba20f44" +name = "ton_executor" +version = "1.15.54" +source = "git+https://github.com/broxus/ton-labs-executor.git#b299a0fc8f3c3ecc28e8e38a9c014be56d4ce52d" dependencies = [ "anyhow", "log", - "thiserror", + "thiserror 1.0.69", "ton_block", "ton_types", "ton_vm", @@ -4192,56 +4592,56 @@ dependencies = [ [[package]] name = "ton_types" version = "1.10.2" -source = "git+https://github.com/broxus/ton-labs-types#3324562d7ff1ebec66d996128573966c1b53862b" +source = "git+https://github.com/broxus/ton-labs-types#8556b60547a20f16d50abcab084479d0c9db3756" dependencies = [ "anyhow", "base64 0.13.1", "countme", "crc", - "dashmap", + "dashmap 5.5.3", "hex", "log", "num", "num-derive", "num-traits", - "rand", - "rustc-hash", + "rand 0.8.5", + "rustc-hash 1.1.0", "sha2 0.9.9", "smallvec", - "thiserror", + "thiserror 1.0.69", ] [[package]] name = "ton_vm" version = "1.8.29" -source = "git+https://github.com/broxus/ton-labs-vm.git#41a85bcde18bc524c18448ffc6aea35aa383c54a" +source = "git+https://github.com/broxus/ton-labs-vm.git#211bd88f46fa257ac4b939447f209465d3e201e1" dependencies = [ "anyhow", - "ed25519", + "ed25519 1.5.3", "ed25519-dalek", "hex", "lazy_static", "log", "num", "num-traits", - "rand", + "rand 0.8.5", "sha2 0.9.9", "smallvec", - "thiserror", + "thiserror 1.0.69", "ton_block", "ton_types", ] [[package]] name = "tower" -version = "0.4.13" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "pin-project", "pin-project-lite", + "sync_wrapper", "tokio", "tokio-util", "tower-layer", @@ -4251,17 +4651,17 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.3.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f873044bf02dd1e8239e9c1293ea39dad76dc594ec16185d0a1bf31d8dc8d858" +checksum = "9cf146f99d442e8e68e585f5d798ccd3cad9a7835b917e09728880a862706456" dependencies = [ - "bitflags 1.3.2", + "bitflags", "bytes", - "futures-core", "futures-util", - "http 0.2.12", - "http-body 0.4.6", - "http-range-header", + "http 1.4.0", + "http-body 1.0.1", + "http-body-util", + "iri-string", "pin-project-lite", "tokio", "tower", @@ -4284,9 +4684,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "2d15d90a0b5c19378952d479dc858407149d7bb45a14de0142f6c534b16fc647" dependencies = [ "log", "pin-project-lite", @@ -4294,113 +4694,496 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "786d480bce6247ab75f005b14ae1624ad978d3029d9113f0a22fa1ac773faeaf" +dependencies = [ + "crossbeam-channel", + "thiserror 2.0.17", + "time", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "7a04e24fab5c89c6a36eb8558c9656f30d81de51dfa4d3b45f26b21d61fa0a6c" dependencies = [ "once_cell", + "valuable", ] [[package]] -name = "tracing-futures" -version = "0.2.5" +name = "tracing-log" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "futures", - "futures-task", - "pin-project", + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-stackdriver" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80048836e000e1f058562f01d69cc46f476955bf389c0dc2d2d7edb98ca63ac1" +dependencies = [ + "Inflector", + "serde", + "serde_json", + "thiserror 1.0.69", + "time", + "tracing-core", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex-automata", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", ] [[package]] name = "triomphe" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" +checksum = "dd69c5aa8f924c7519d6372789a74eac5b94fb0f8fcf0d4a97eb0bfc3e785f39" dependencies = [ "serde", "stable_deref_trait", ] [[package]] -name = "trust-dns-client" -version = "0.20.4" +name = "try-lock" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b4ef9b9bde0559b78a4abb00339143750085f05e5a453efb7b8bef1061f09dc" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "tycho-block-util" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" dependencies = [ - "cfg-if", - "data-encoding", - "futures-channel", + "anyhow", + "arc-swap", + "bytes", + "hex", + "metrics 0.24.3", + "parking_lot", + "rayon", + "thiserror 2.0.17", + "tl-proto", + "tycho-storage-traits", + "tycho-types", + "tycho-util", +] + +[[package]] +name = "tycho-build-info" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "anyhow", +] + +[[package]] +name = "tycho-core" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "ahash 0.8.12", + "anyhow", + "arc-swap", + "async-trait", + "bitflags", + "bumpalo", + "bumpalo-herd", + "bytes", + "bytesize", + "cassadilia", + "castaway", + "clap", + "crc32c", + "dashmap 6.1.0", "futures-util", - "lazy_static", - "log", - "radix_trie", - "rand", - "thiserror", - "time", + "humantime", + "metrics 0.24.3", + "moka", + "parking_lot", + "parking_lot_core", + "pin-project-lite", + "quick_cache 0.6.18", + "rand 0.9.2", + "scopeguard", + "serde", + "sha2 0.10.9", + "smallvec", + "tempfile", + "thiserror 2.0.17", + "tl-proto", "tokio", - "trust-dns-proto", + "tracing", + "triomphe", + "tycho-block-util", + "tycho-build-info", + "tycho-crypto", + "tycho-network", + "tycho-storage", + "tycho-types", + "tycho-util", + "weedb", ] [[package]] -name = "trust-dns-proto" -version = "0.20.4" +name = "tycho-crypto" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca94d4e9feb6a181c690c4040d7a24ef34018d8313ac5044a61d21222ae24e31" +checksum = "5dc575bf266a635aed302ac1f42c405693b06eb2750648b195c762bc01546530" dependencies = [ - "async-trait", - "cfg-if", - "data-encoding", - "enum-as-inner", - "futures-channel", - "futures-io", + "curve25519-dalek", + "generic-array", + "hex", + "rand 0.9.2", + "serde", + "sha2 0.10.9", + "tl-proto", +] + +[[package]] +name = "tycho-executor" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "148f0edab661a199f2be88448f8a463ca107a7db370e6abf58ac8b2116ec24e0" +dependencies = [ + "ahash 0.8.12", + "anyhow", + "num-bigint", + "thiserror 2.0.17", + "tycho-types", + "tycho-vm", +] + +[[package]] +name = "tycho-network" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "ahash 0.8.12", + "anyhow", + "arc-swap", + "base64 0.22.1", + "bytes", + "bytesize", + "castaway", + "dashmap 6.1.0", + "ed25519 2.2.3", + "exponential-backoff", "futures-util", - "idna 0.2.3", - "ipnet", - "lazy_static", - "log", - "rand", + "hex", + "indexmap", + "metrics 0.24.3", + "moka", + "parking_lot", + "pin-project-lite", + "pkcs8", + "quinn", + "rand 0.9.2", + "ring", + "rustls", + "rustls-pki-types", + "rustls-webpki", + "serde", + "socket2 0.6.1", + "thiserror 2.0.17", + "tl-proto", + "tokio", + "tokio-util", + "tracing", + "tycho-crypto", + "tycho-util", +] + +[[package]] +name = "tycho-storage" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "anyhow", + "arc-swap", + "bytesize", + "fdlimit", + "libc", + "metrics 0.24.3", + "rand 0.9.2", + "rlimit", + "scopeguard", + "serde", + "tempfile", + "tokio", + "tracing", + "tycho-storage-traits", + "tycho-util", + "weedb", +] + +[[package]] +name = "tycho-storage-traits" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "bytes", "smallvec", - "thiserror", - "tinyvec", + "tycho-types", +] + +[[package]] +name = "tycho-types" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2ccb37e250becb5c4b827536644c777c247b41ac6c9ddd30902ff1db29818a7" +dependencies = [ + "ahash 0.8.12", + "base64 0.22.1", + "bitflags", + "blake3", + "crc32c", + "dashmap 6.1.0", + "hex", + "num-bigint", + "num-traits", + "rand 0.9.2", + "rayon", + "scc", + "serde", + "sha2 0.10.9", + "smallvec", + "thiserror 2.0.17", + "tl-proto", + "tycho-crypto", + "tycho-types-proc", + "typeid", +] + +[[package]] +name = "tycho-types-proc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad05cf4ab89631f8c11d85c3aa80f781502440f75361d251f866e0d76ae9d31" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "tycho-util" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "ahash 0.8.12", + "anyhow", + "base64 0.22.1", + "bytes", + "bytesize", + "castaway", + "crossbeam-deque", + "dashmap 6.1.0", + "futures-executor", + "futures-util", + "getip", + "humantime", + "libc", + "metrics 0.24.3", + "metrics-exporter-prometheus 0.17.2", + "rand 0.9.2", + "rayon", + "scopeguard", + "serde", + "serde_json", + "serde_path_to_error", + "sysinfo 0.37.2", + "thiserror 2.0.17", + "tikv-jemalloc-ctl", + "tl-proto", "tokio", - "url", + "tracing", + "tracing-appender", + "tracing-stackdriver", + "tracing-subscriber", + "tycho-util-proc", + "walkdir", + "zstd-safe", + "zstd-sys", ] [[package]] -name = "try-lock" -version = "0.2.5" +name = "tycho-util-proc" +version = "0.3.5" +source = "git+https://github.com/broxus/tycho.git?rev=bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e#bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "tycho-vm" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +checksum = "013cf249ea5a32b38050adfc8cbca471da017c0c03292e7462665859638226ac" +dependencies = [ + "ahash 0.8.12", + "anyhow", + "bitflags", + "blake2", + "dyn-clone", + "num-bigint", + "num-integer", + "num-traits", + "sha2 0.10.9", + "thiserror 2.0.17", + "tl-proto", + "tycho-crypto", + "tycho-types", + "tycho-vm-proc", +] [[package]] -name = "typemap-ors" -version = "1.0.0" +name = "tycho-vm-proc" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a68c24b707f02dd18f1e4ccceb9d49f2058c2fb86384ef9972592904d7a28867" +checksum = "94d448e5c9526dcfdd2d3f63d9e13de2a207e1aadf906ea4d1e61e45f0aeceb3" dependencies = [ - "unsafe-any-ors", + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.111", ] +[[package]] +name = "tycho-wallet-api" +version = "1.0.0" +dependencies = [ + "aide", + "anyhow", + "argon2", + "async-trait", + "axum", + "base64 0.13.1", + "bigdecimal", + "chacha20poly1305", + "chrono", + "clap", + "dashmap 5.5.3", + "derive_more", + "ed25519-dalek", + "futures", + "futures-util", + "hex", + "hmac-sha256", + "http 0.2.12", + "itertools 0.10.5", + "lazy_static", + "log", + "lru", + "metrics 0.20.1", + "metrics-exporter-prometheus 0.16.2", + "nekoton", + "nekoton-abi", + "nekoton-contracts", + "nekoton-utils", + "num-bigint", + "num-traits", + "opg", + "parking_lot", + "pomfrit", + "rand 0.8.5", + "rayon", + "regex", + "reqwest", + "rustc-hash 1.1.0", + "schemars", + "serde", + "serde_json", + "serde_yaml", + "sqlx", + "strum", + "strum_macros", + "sysinfo 0.30.13", + "thiserror 1.0.69", + "tikv-jemallocator", + "tokio", + "tokio-util", + "ton_abi", + "ton_block", + "ton_types", + "tower", + "tower-http", + "tower-service", + "tracing", + "tracing-subscriber", + "tycho-block-util", + "tycho-core", + "tycho-executor", + "tycho-storage", + "tycho-types", + "tycho-util", + "tycho-vm", + "uuid", +] + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + [[package]] name = "typenum" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "ucd-trie" @@ -4408,41 +5191,32 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" -[[package]] -name = "uname" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72f89f0ca32e4db1c04e2a72f5345d59796d4866a1ee0609084569f73683dc8" -dependencies = [ - "libc", -] - [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" [[package]] name = "unicode-normalization" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" dependencies = [ "tinyvec", ] [[package]] name = "unicode-properties" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-segmentation" @@ -4456,12 +5230,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "unicode_categories" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" - [[package]] name = "universal-hash" version = "0.5.1" @@ -4472,43 +5240,60 @@ dependencies = [ "subtle", ] -[[package]] -name = "unsafe-any-ors" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a303d30665362d9680d7d91d78b23f5f899504d4f08b3c4cf08d055d87c0ad" -dependencies = [ - "destructure_traitobject", -] - [[package]] name = "unsafe-libyaml" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.5.2" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", "serde", ] +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" -version = "1.11.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" dependencies = [ - "getrandom", - "serde", + "getrandom 0.3.4", + "js-sys", + "serde_core", + "wasm-bindgen", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "vcpkg" version = "0.2.15" @@ -4521,6 +5306,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -4532,9 +5327,18 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +dependencies = [ + "wit-bindgen", +] [[package]] name = "wasite" @@ -4544,47 +5348,35 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "0d759f433fa64a2d763d1340820e46e111a7a5ab75f993d1852d70b03dbb80fd" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.95" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.82", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "836d9622d604feee9e5de25ac10e3ea5f2d65b41eac0d9ce72eb5deae707ce7c" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "48cb0d2638f8baedbc542ed444afc0644a29166f1595371af4fecf8ce1e7eeb3" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4592,28 +5384,41 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "cefb59d5cd5f92d9dcf80e4683949f15ca4b511f4ac0a6e14d4e1ac60c6ecd40" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.82", - "wasm-bindgen-backend", + "syn 2.0.111", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "cbc538057e648b67f72a982e708d485b2efa771e1ac05fec311f9f63e5800db4" +dependencies = [ + "unicode-ident", +] [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b32828d774c412041098d182a8b38b16ea816958e07cf40eec2bc080ae137ac" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ "js-sys", "wasm-bindgen", @@ -4621,24 +5426,24 @@ dependencies = [ [[package]] name = "weedb" -version = "0.2.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c86ce614b17179303bf714b8a2e296dac8f7e2f1c690ee768b43f92f0d6062c" +checksum = "b7769a20b8caefbfd7005172847727296a96c9aa19531f8f153219bc6b1fb00a" dependencies = [ "librocksdb-sys", - "metrics 0.22.3", + "metrics 0.24.3", "rocksdb", - "thiserror", + "thiserror 2.0.17", "tracing", ] [[package]] name = "whoami" -version = "1.5.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +checksum = "5d4a4db5077702ca3015d3d02d74974948aba2ad9e12ab7df718ee64ccd7e97d" dependencies = [ - "redox_syscall", + "libredox", "wasite", ] @@ -4660,11 +5465,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4679,10 +5484,32 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ - "windows-core", + "windows-core 0.52.0", "windows-targets 0.52.6", ] +[[package]] +name = "windows" +version = "0.61.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893" +dependencies = [ + "windows-collections", + "windows-core 0.61.2", + "windows-future", + "windows-link 0.1.3", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8" +dependencies = [ + "windows-core 0.61.2", +] + [[package]] name = "windows-core" version = "0.52.0" @@ -4692,6 +5519,134 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.1.3", + "windows-result 0.3.4", + "windows-strings 0.4.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-future" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1" +dependencies = [ + "windows-core 0.61.2", + "windows-link 0.1.3", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link 0.2.1", + "windows-result 0.4.1", + "windows-strings 0.5.1", +] + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link 0.2.1", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link 0.1.3", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link 0.2.1", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4712,11 +5667,20 @@ dependencies = [ [[package]] name = "windows-sys" -version = "0.59.0" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.52.6", + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", ] [[package]] @@ -4743,13 +5707,39 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows-threading" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6" +dependencies = [ + "windows-link 0.1.3", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -4762,6 +5752,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -4774,6 +5770,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -4786,12 +5788,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -4804,6 +5818,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -4816,6 +5836,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -4828,6 +5854,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -4841,50 +5873,92 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winreg" -version = "0.50.0" +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "wit-bindgen" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "cfg-if", - "windows-sys 0.48.0", + "stable_deref_trait", + "yoke-derive", + "zerofrom", ] [[package]] -name = "yaml-rust" -version = "0.4.5" +name = "yoke-derive" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ - "linked-hash-map", + "proc-macro2", + "quote", + "syn 2.0.111", + "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "fd74ec98b9250adb3ca554bdde269adf631549f51d8a8f8f0a10b50f1cb298c3" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "d8a8d209fdf45cf5138cbb5a506f6b52522a25afccc534d1475dad8e31105c6a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", + "synstructure", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" dependencies = [ "zeroize_derive", ] @@ -4897,34 +5971,58 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.111", ] [[package]] -name = "zstd" -version = "0.12.4" +name = "zerotrie" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" dependencies = [ - "zstd-safe", + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.111", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "8f49c4d5f0abb602a93fb8736af2a4f4dd9512e36f7f570d66e65ff867ed3b9d" dependencies = [ - "libc", "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" +version = "2.0.16+zstd.1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +checksum = "91e19ebc2adc8f83e43039e79776e3fda8ca919132d68a1fed6a5faca2683748" dependencies = [ + "bindgen", "cc", "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 7de98d8..e45c495 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,35 +1,32 @@ [package] -name = "ton-wallet-api" -version = "1.0.2" +name = "tycho-wallet-api" +version = "1.0.0" edition = "2021" authors = ["Broxus team"] publish = false license-file = "LICENSE" [dependencies] +aide = { version = "0.13.5", features = ["axum", "axum-extra", "scalar", "macros"] } anyhow = "1.0" -axum = { version = "0.5.15", features = ["multipart"] } -argh = "0.1" +axum = { version = "0.7", features = ["multipart", "macros"] } argon2 = "0.4.1" async-trait = "0.1" base64 = "0.13" bigdecimal = { version = "0.4.5", features = ["serde"] } chacha20poly1305 = "0.10.1" chrono = { version = "0.4", features = ["serde"] } -config = { version = "0.13.2", default-features = false, features = ["yaml"] } +clap = { version = "4.5.3", features = ["derive"] } dashmap = "5.3.4" derive_more = { version = "1.0.0", features = ["full"] } -env_logger = "0.10.0" -everscale-network = "^0.5.4" futures = "0.3" +futures-util = "0.3.31" hex = "0.4" hmac-sha256 = "1.1.4" http = "0.2" -hyper = { version = "0.14" } itertools = "0.10.1" lazy_static = "1.4.0" log = { version = "0.4", features = ["std", "serde"] } -log4rs = "1.0" lru = "0.8" metrics = "0.20.1" metrics-exporter-prometheus = { version = "0.16.0", default-features = false, features = ["http-listener"] } @@ -39,10 +36,11 @@ opg = { version = "0.2", features = ["uuid"] } parking_lot = "0.12.0" pomfrit = "0.1" rand = "0.8" +rayon = "1.10" regex = "1.5" -reqwest = { version = "0.11.27", features = ["json"] } +reqwest = { version = "0.12", features = ["json"] } rustc-hash = "1.1.0" -sentry = { version = "0.27.0", features = ["log", "debug-logs"] } +schemars = { version = "0.8.13", features = ["chrono", "bigdecimal04", "uuid1"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_yaml = "0.9.4" @@ -50,37 +48,44 @@ sqlx = { version = "0.8.2", features = ["runtime-tokio-native-tls", "postgres", strum = "0.24.1" strum_macros = "0.24.1" thiserror = "1.0" -tokio = { version = "1.41", features = ["sync", "fs", "rt-multi-thread", "macros", "signal", "parking_lot"] } -tokio-util = "0.7.12" -tower = { version = "0.4.13", features = ["limit"] } -tower-http = { version = "0.3.4", features = ["trace", "cors", "limit", "set-header", "metrics"] } -tracing = "0.1.34" +tokio = { version = "1", features = ["sync", "fs", "rt-multi-thread", "macros", "signal", "parking_lot"] } +tokio-util = "0.7" +tower = { version = "0.5", features = ["limit"] } +tower-http = { version = "0.6", features = ["trace", "cors", "limit", "set-header", "metrics"] } +tower-service = "0.3.3" +tracing = "0.1" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } +tycho-types = { version = "0.3.1", features = ["tycho", "stats", "serde"] } uuid = { version = "1.1", features = ["v4", "serde"] } ed25519-dalek = { git = "https://github.com/broxus/ed25519-dalek.git" } +tikv-jemallocator = { version = "0.6.0", features = [ + "unprefixed_malloc_on_supported_platforms", + "background_threads", +] } + +tycho-block-util = { git = "https://github.com/broxus/tycho.git", rev = "bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" } +tycho-core = { git = "https://github.com/broxus/tycho.git", rev = "bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e", features = ["cli"] } +tycho-storage = { git = "https://github.com/broxus/tycho.git", rev = "bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e" } +tycho-util = { git = "https://github.com/broxus/tycho.git", rev = "bb2d3cca4c3dd010a4e1aef82e2f76655fc23a3e", features = ["cli"] } + +tycho-vm = "0.3.0" +tycho-executor = "0.3.0" + # TON specific dependencies ton_block = { git = "https://github.com/broxus/ton-labs-block" } ton_abi = { git = "https://github.com/broxus/ton-labs-abi" } ton_types = { git = "https://github.com/broxus/ton-labs-types" } # Nekoton SDK -nekoton = { git = "https://github.com/broxus/nekoton.git", default-features = true, rev="561b60e7a47e994500dce9f25933dd8d8fb2987a" } -nekoton-abi = { git = "https://github.com/broxus/nekoton.git", features = ["derive"], rev="561b60e7a47e994500dce9f25933dd8d8fb2987a" } -nekoton-utils = { git = "https://github.com/broxus/nekoton.git", rev="561b60e7a47e994500dce9f25933dd8d8fb2987a" } -nekoton-contracts = { git = "https://github.com/broxus/nekoton.git", rev="561b60e7a47e994500dce9f25933dd8d8fb2987a" } +nekoton = { git = "https://github.com/broxus/nekoton.git", default-features = true } +nekoton-abi = { git = "https://github.com/broxus/nekoton.git", features = ["derive"] } +nekoton-utils = { git = "https://github.com/broxus/nekoton.git" } +nekoton-contracts = { git = "https://github.com/broxus/nekoton.git" } -# Broxus utils -broxus-util = { version = "0.2", features = ["alloc", "public-ip", "config", "log4rs"] } - -# Indexer engine -ton-indexer = { git = "https://github.com/broxus/ton-indexer.git" } sysinfo = "0.30.13" -librocksdb-sys = "^0.16.0" - [features] default = [] -ton = ["ton_block/ton", "ton-indexer/ton"] -venom = ["ton_block/venom", "ton-indexer/venom"] diff --git a/README.md b/README.md index b4fbcd3..ba43e5f 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ tracked, and there is a whitelist of root token addresses to be tracked in the s in the database, where you can specify the url of your backend to which callbacks will come for all transactions. It takes about 20 minutes to synchronize the node. -Both the ton-wallet-api and callback requests use HMAC signatures in the headers. +Both the tycho-wallet-api and callback requests use HMAC signatures in the headers. ### Runtime requirements - CPU: 4 cores, 2 GHz @@ -32,25 +32,25 @@ Both the ton-wallet-api and callback requests use HMAC signatures in the headers ### How to run natively To simplify the build and create some semblance of standardization in this repository -there is a set of scripts for configuring the ton-wallet-api. +there is a set of scripts for configuring the tycho-wallet-api. NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modify them a little for other distros. -1. ##### Setup ton-wallet-api service +1. ##### Setup tycho-wallet-api service ```bash ./scripts/setup.sh -t native --database-url ${DATABASE_URL} ``` - DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/ton_wallet_api) + DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/tycho_wallet_api) - > At this stage, a systemd service `ton-wallet-api` is created. Configs and keys will be in `/etc/ton-wallet-api` - > and TON node DB will be in `/var/db/ton-wallet-api`. + > At this stage, a systemd service `tycho-wallet-api` is created. Configs and keys will be in `/etc/tycho-wallet-api` + > and TON node DB will be in `/var/db/tycho-wallet-api`. **Do not start this service yet!** 2. ##### Prepare config Either add the environment variables to the `[Service]` section of unit file. - It is located at `/etc/systemd/system/ton-wallet-api.service`. + It is located at `/etc/systemd/system/tycho-wallet-api.service`. ```unit file (systemd) [Service] @@ -58,7 +58,7 @@ NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modif Environment=DB_HOST=db_host Environment=DB_USER=db_user Environment=DB_PASSWORD=db_password - Environment=DB_NAME=ton_wallet_api + Environment=DB_NAME=tycho_wallet_api Environment=SECRET=secret Environment=SALT=salt ... @@ -71,7 +71,13 @@ NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modif ###### How to gen SALT ```bash cargo build --release - ./target/release/ton-wallet-api salt + ./target/release/tycho-wallet-api salt + ``` + + ###### How to gen config + ```bash + cargo build --release + SALT=salt SECRET=secret ./target/release/tycho-wallet-api server --init-config config.json ``` 3. ##### Create api service @@ -79,20 +85,20 @@ NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modif ./scripts/api_service.sh -t native --database-url ${DATABASE_URL} --id ${SERVICE_ID} --name ${SERVICE_NAME} --key ${SERVICE_KEY} --secret ${SERVICE_SECRET} ``` - DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/ton_wallet_api) \ + DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/tycho_wallet_api) \ SERVICE_ID - Service id (UUID4) (example: 1fa337bd-2947-4809-9a7a-f04b4f9b738a) \ SERVICE_NAME - Service name (example: test) \ SERVICE_KEY - Public key (example: apiKey) \ SERVICE_SECRET - Secret key (example: apiSecret) -4. ##### Enable and start ton-wallet-api service +4. ##### Enable and start tycho-wallet-api service ```bash - systemctl enable ton-wallet-api - systemctl start ton-wallet-api + systemctl enable tycho-wallet-api + systemctl start tycho-wallet-api # Optionally check if it is running normally. It will take some time to start. - # ton-wallet-api is fully operational when it prints `listening on ${your_listen_address}` - journalctl -fu ton-wallet-api + # tycho-wallet-api is fully operational when it prints `listening on ${your_listen_address}` + journalctl -fu tycho-wallet-api ``` > Wallet API has a two built-in Prometheus metrics exporters: API and Node. @@ -121,7 +127,7 @@ NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modif ./scripts/update.sh -t native --database-url ${DATABASE_URL} ``` - DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/ton_wallet_api) + DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/tycho_wallet_api) ### Let's start using Wallet API @@ -151,7 +157,7 @@ NOTE: scripts are prepared and tested on **Ubuntu 20.04**. You may need to modif ./scripts/root_token.sh -t native --database-url ${DATABASE_URL} --name ${TOKEN_NAME} --address ${TOKEN_ADDRESS} --version ${TOKEN_CONTRACT_VERSION} ``` - DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/ton_wallet_api) \ + DATABASE_URL - Postgres connection url (example: postgresql://postgres:postgres@127.0.0.1/tycho_wallet_api) \ TOKEN_NAME - Token name (example: WTON) \ TOKEN_ADDRESS - Token address (example: 0:0ee39330eddb680ce731cd6a443c71d9069db06d149a9bec9569d1eb8d04eb37) TOKEN_CONTRACT_VERSION - "Tip3" or "OldTip3v4" @@ -279,55 +285,223 @@ echo -en "$stringToSign" | openssl sha256 -hmac "$secret" -binary | base64 > NOTE: The syntax `${VAR}` can also be used everywhere in config. It will be > replaced by the value of the environment variable `VAR`. -```yaml ---- -# Server address -server_addr: "0.0.0.0:8080" -# Database URL -database_url: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}" -# Database Connection Pools -db_pool_size: 5 -ton_core: - # UDP port, used for ADNL node. Default: 30303 - adnl_port: 30303 - # Root directory for ton-wallet-api DB. Default: "./db" - db_path: "/var/ton-wallet-api/db" - # Path to ADNL keys. - # NOTE: Will be generated if it was not there. - # Default: "./adnl-keys.json" - keys_path: "/var/ton-wallet-api/adnl-keys.json" -metrics_settings: - # Listen address of metrics. Used by the client to gather prometheus metrics. - # Default: "127.0.0.1:10000" - listen_address: "127.0.0.1:10000" - # URL path to the metrics. Default: "/" - # Example: `curl http://127.0.0.1:10000/` - metrics_path: "/" - # Metrics update interval in seconds. Default: 10 - collection_interval_sec: 10 -# log4rs settings. -# See https://docs.rs/log4rs/1.0.0/log4rs/ for more details -logger_settings: - appenders: - stdout: - kind: console - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" - root: - level: error - appenders: - - stdout - loggers: - ton_wallet_api: - level: info - appenders: - - stdout - additive: false - ton_indexer: - level: error - appenders: - - stdout - additive: false +```json +{ + "public_ip": null, + "local_ip": "0.0.0.0", + "port": 30000, + "network": { + "quic": null, + "connection_manager_channel_capacity": 128, + "connectivity_check_interval": "5s", + "max_frame_size": "8.4 MB", + "connect_timeout": "10s", + "connection_backoff": "10s", + "max_connection_backoff": "1m", + "connection_error_delay": "3s", + "max_concurrent_outstanding_connections": 100, + "max_concurrent_connections": null, + "active_peers_event_channel_capacity": 128, + "max_concurrent_requests_per_peer": 128, + "shutdown_idle_timeout": "1m", + "enable_0rtt": false, + "connection_metrics": null + }, + "dht": { + "max_k": 6, + "max_peer_info_ttl": "1h", + "max_stored_value_ttl": "1h", + "max_storage_capacity": "16.8 MB", + "storage_item_time_to_idle": null, + "local_info_refresh_period": "1m", + "local_info_announce_period": "10m", + "local_info_announce_period_max_jitter": "1m", + "routing_table_refresh_period": "10m", + "routing_table_refresh_period_max_jitter": "1m", + "announced_peers_channel_capacity": 10 + }, + "peer_resolver": { + "max_parallel_resolve_requests": 100, + "min_ttl_sec": 600, + "update_before_sec": 1200, + "fast_retry_count": 10, + "min_successfull_resolve_interval": "1m", + "min_retry_interval": "1s", + "max_retry_interval": "2m", + "stale_retry_interval": "10m" + }, + "overlay": { + "public_overlay_peer_store_period": "3m", + "public_overlay_peer_store_max_jitter": "30s", + "public_overlay_peer_store_max_entries": 20, + "public_overlay_peer_exchange_period": "3m", + "public_overlay_peer_exchange_max_jitter": "30s", + "public_overlay_peer_collect_period": "10s", + "public_overlay_peer_collect_max_jitter": "5s", + "public_overlay_peer_discovery_period": "3m", + "public_overlay_peer_discovery_max_jitter": "30s", + "exchange_public_entries_batch": 20 + }, + "public_overlay_client": { + "neighbors": { + "update_interval": "2m", + "ping_interval": "30s", + "apply_score_interval": "10s", + "keep": 5, + "max_ping_tasks": 5, + "default_roundtrip": "300ms", + "send_timeout": { + "secs": 0, + "nanos": 500000000 + }, + "query_timeout": { + "secs": 1, + "nanos": 0 + } + }, + "validators": { + "ping_interval": "1m", + "ping_timeout": "1s", + "keep": 5, + "max_ping_tasks": 5, + "send_timeout": { + "secs": 0, + "nanos": 500000000 + } + } + }, + "storage": { + "root_dir": "./db", + "rocksdb_enable_metrics": true, + "rocksdb_lru_capacity": "134.2 MB", + "cells_cache_size": "1.9 GB", + "archive_chunk_size": "1024.0 KB", + "split_block_tasks": 100, + "archives_gc": { + "persistent_state_offset": "5m" + }, + "states_gc": { + "random_offset": true, + "interval": "1m" + }, + "blocks_gc": { + "type": "BeforeSafeDistance", + "safe_distance": 1000, + "min_interval": "1m", + "enable_for_sync": true, + "max_blocks_per_batch": 100000 + }, + "blocks_cache": { + "ttl": "5m", + "size": "500.0 MB" + } + }, + "blockchain_rpc_client": { + "min_broadcast_timeout": "100ms", + "too_new_archive_threshold": 4, + "download_retries": 10 + }, + "blockchain_rpc_service": { + "max_key_blocks_list_len": 8, + "serve_persistent_states": true + }, + "blockchain_block_provider": { + "get_next_block_polling_interval": "1s", + "get_block_polling_interval": "1s", + "get_next_block_timeout": "2m", + "get_block_timeout": "1m" + }, + "archive_block_provider": { + "max_archive_to_memory_size": "100.0 MB" + }, + "rpc": null, + "metrics": { + "listen_addr": "127.0.0.1:10000" + }, + "threads": { + "rayon_threads": 8, + "tokio_workers": 8 + }, + "profiling": { + "profiling_dir": "" + }, + "logger_config": { + "outputs": [ + { + "type": "Stderr" + } + ] + }, + "starter": { + "custom_boot_offset": null + }, + "api": { + "server_addr": "${SERVER_ADDR}", + "database_url": "postgresql://postgres:postgres@${DATABASE_ADDR}:5432/tycho_wallet_api", + "db_pool_size": 8, + "key": [ + 101, + 247, + 113, + 21, + 159, + 244, + 255, + 167, + 16, + 129, + 32, + 34, + 161, + 5, + 240, + 97, + 250, + 232, + 42, + 55, + 221, + 67, + 175, + 105, + 229, + 178, + 134, + 166, + 208, + 30, + 180, + 236 + ], + "api_metrics_addr": null, + "node_metrics_settings": null, + "logger_settings": { + "appenders": { + "stdout": { + "kind": "console", + "encoder": { + "pattern": "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" + } + } + }, + "root": { + "level": "info", + "appenders": [ + "stdout" + ] + }, + "loggers": { + "tycho_wallet_api": { + "level": "info", + "appenders": [ + "stdout" + ], + "additive": false + } + } + } + } +} ``` ### How to Run via Docker/Podman @@ -379,7 +553,7 @@ Once the images are built, you can run the container using Podman or Docker. podman run --network=host ever-wallet ``` - This will run the `ton-wallet-api` server using the default configuration files already existing in the container. + This will run the `tycho-wallet-api` server using the default configuration files already existing in the container. Errors shall be expected at this step. ```bash @@ -394,7 +568,7 @@ Once the images are built, you can run the container using Podman or Docker. ```bash podman run --network=host \ - -v /tmp/everscale-data:/var/db/ton-wallet-api + -v /tmp/everscale-data:/var/db/tycho-wallet-api -e DB_USER=everscale \ -e DB_PASSWORD=everscale \ -e DB_HOST=localhost \ @@ -412,4 +586,4 @@ Once the images are built, you can run the container using Podman or Docker. When the node is out of sync, which especially applies for Venom, removing database and re-syncing node may help to restore service operations. -`rm -rf /var/db/ton-wallet-api` +`rm -rf /var/db/tycho-wallet-api` diff --git a/config/prod/config.json b/config/prod/config.json new file mode 100644 index 0000000..f9b7737 --- /dev/null +++ b/config/prod/config.json @@ -0,0 +1,216 @@ +{ + "public_ip": null, + "local_ip": "0.0.0.0", + "port": 30000, + "network": { + "quic": null, + "connection_manager_channel_capacity": 128, + "connectivity_check_interval": "5s", + "max_frame_size": "8.4 MB", + "connect_timeout": "10s", + "connection_backoff": "10s", + "max_connection_backoff": "1m", + "connection_error_delay": "3s", + "max_concurrent_outstanding_connections": 100, + "max_concurrent_connections": null, + "active_peers_event_channel_capacity": 128, + "max_concurrent_requests_per_peer": 128, + "shutdown_idle_timeout": "1m", + "enable_0rtt": false, + "connection_metrics": null + }, + "dht": { + "max_k": 6, + "max_peer_info_ttl": "1h", + "max_stored_value_ttl": "1h", + "max_storage_capacity": "16.8 MB", + "storage_item_time_to_idle": null, + "local_info_refresh_period": "1m", + "local_info_announce_period": "10m", + "local_info_announce_period_max_jitter": "1m", + "routing_table_refresh_period": "10m", + "routing_table_refresh_period_max_jitter": "1m", + "announced_peers_channel_capacity": 10 + }, + "peer_resolver": { + "max_parallel_resolve_requests": 100, + "min_ttl_sec": 600, + "update_before_sec": 1200, + "fast_retry_count": 10, + "min_successfull_resolve_interval": "1m", + "min_retry_interval": "1s", + "max_retry_interval": "2m", + "stale_retry_interval": "10m" + }, + "overlay": { + "public_overlay_peer_store_period": "3m", + "public_overlay_peer_store_max_jitter": "30s", + "public_overlay_peer_store_max_entries": 20, + "public_overlay_peer_exchange_period": "3m", + "public_overlay_peer_exchange_max_jitter": "30s", + "public_overlay_peer_collect_period": "10s", + "public_overlay_peer_collect_max_jitter": "5s", + "public_overlay_peer_discovery_period": "3m", + "public_overlay_peer_discovery_max_jitter": "30s", + "exchange_public_entries_batch": 20 + }, + "public_overlay_client": { + "neighbors": { + "update_interval": "2m", + "ping_interval": "30s", + "apply_score_interval": "10s", + "keep": 5, + "max_ping_tasks": 5, + "default_roundtrip": "300ms", + "send_timeout": { + "secs": 0, + "nanos": 500000000 + }, + "query_timeout": { + "secs": 1, + "nanos": 0 + } + }, + "validators": { + "ping_interval": "1m", + "ping_timeout": "1s", + "keep": 5, + "max_ping_tasks": 5, + "send_timeout": { + "secs": 0, + "nanos": 500000000 + } + } + }, + "storage": { + "root_dir": "./db", + "rocksdb_enable_metrics": true, + "rocksdb_lru_capacity": "134.2 MB", + "cells_cache_size": "1.9 GB", + "archive_chunk_size": "1024.0 KB", + "split_block_tasks": 100, + "archives_gc": { + "persistent_state_offset": "5m" + }, + "states_gc": { + "random_offset": true, + "interval": "1m" + }, + "blocks_gc": { + "type": "BeforeSafeDistance", + "safe_distance": 1000, + "min_interval": "1m", + "enable_for_sync": true, + "max_blocks_per_batch": 100000 + }, + "blocks_cache": { + "ttl": "5m", + "size": "500.0 MB" + } + }, + "blockchain_rpc_client": { + "min_broadcast_timeout": "100ms", + "too_new_archive_threshold": 4, + "download_retries": 10 + }, + "blockchain_rpc_service": { + "max_key_blocks_list_len": 8, + "serve_persistent_states": true + }, + "blockchain_block_provider": { + "get_next_block_polling_interval": "1s", + "get_block_polling_interval": "1s", + "get_next_block_timeout": "2m", + "get_block_timeout": "1m" + }, + "archive_block_provider": { + "max_archive_to_memory_size": "100.0 MB" + }, + "rpc": null, + "metrics": { + "listen_addr": "127.0.0.1:10000" + }, + "threads": { + "rayon_threads": 8, + "tokio_workers": 8 + }, + "profiling": { + "profiling_dir": "" + }, + "logger_config": { + "outputs": [ + { + "type": "Stderr" + } + ] + }, + "starter": { + "custom_boot_offset": null + }, + "api": { + "server_addr": "127.0.0.1:8080", + "database_url": "postgresql://postgres:postgres@127.0.0.1:5432/tycho_wallet_api", + "db_pool_size": 8, + "key": [ + 101, + 247, + 113, + 21, + 159, + 244, + 255, + 167, + 16, + 129, + 32, + 34, + 161, + 5, + 240, + 97, + 250, + 232, + 42, + 55, + 221, + 67, + 175, + 105, + 229, + 178, + 134, + 166, + 208, + 30, + 180, + 236 + ], + "api_metrics_addr": null, + "node_metrics_settings": null, + "logger_settings": { + "appenders": { + "stdout": { + "kind": "console", + "encoder": { + "pattern": "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" + } + } + }, + "root": { + "level": "info", + "appenders": [ + "stdout" + ] + }, + "loggers": { + "tycho_wallet_api": { + "level": "info", + "appenders": [ + "stdout" + ], + "additive": false + } + } + } + } +} \ No newline at end of file diff --git a/config/prod/config.yaml b/config/prod/config.yaml deleted file mode 100644 index 143dd44..0000000 --- a/config/prod/config.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -server_addr: "0.0.0.0:8080" -database_url: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}" -db_pool_size: 5 -ton_core: - adnl_port: 30310 - db_path: "/var/ton/ton-wallet-api/data" - keys_path: "/var/ton/ton-wallet-api/data/adnl-keys.json" - recover_indexer: true - start_from: 23051378 -api_metrics_addr: "0.0.0.0:9999" -node_metrics_settings: - listen_address: "0.0.0.0:10000" - metrics_path: "/metrics" - collection_interval_sec: 10 -logger_settings: - appenders: - stdout: - kind: console - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" - root: - level: error - appenders: - - stdout - loggers: - ton_wallet_api: - level: info - appenders: - - stdout - additive: false - tower_http: - level: info - appenders: - - stdout - additive: false - ton_indexer: - level: error - appenders: - - stdout - additive: false - tiny_adnl: - level: error - appenders: - - stdout - additive: false - pomfrit: - level: info - appenders: - - stdout - additive: false diff --git a/config/prod/global-config.json b/config/prod/global-config.json new file mode 100644 index 0000000..a9b7a9c --- /dev/null +++ b/config/prod/global-config.json @@ -0,0 +1,103 @@ +{ + "bootstrap_peers": [ + { + "id": "23ecc8ae7a19b8bc7bd2a5eccfc87875a38ade6598bed613e149e9f0103d8548", + "address_list": ["57.129.53.62:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "S+8qP0sL64kOGDwY5VBKz/RsD6HGZx0LYswnFlt9q5AhEaoA4JcLUsPPENj5zfPdhm9bMedjIMtzPEkvYsSFCA==" + }, + { + "id": "a8541e256904f36cbae7cf03d10c5a20c55a8c6473a09bf2c65ed9826c267485", + "address_list": ["57.129.53.60:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "pA8b1RtNsckjVDtzM4ZM5mFCkFLQdWYXMoEE6rjhFdSo/jk9MVDa+QgujdQIJyrWg/4tEPI+Fbe63W8z4h3TBw==" + }, + { + "id": "85ee82cf5eec189141ff48b7aaa27f4a17c0a6d0c5459f99d255497c75898fe2", + "address_list": ["57.129.53.58:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "6BFSI97s4CS9FBp7kE2JLIysFY9nwhezeQPjLpYFLn+KJHeeoGxgH8xF/6kbmOU7nxscmVV5Dk0aBmfWh8n/Bw==" + }, + { + "id": "ccbf488d1a8f98ce173733188ea47cb537ca3baa47cc25b960f6e6b1f0595768", + "address_list": ["57.129.53.63:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "brYwODCysagSj1qooysnaaJ1xSNRMB2DH+WXLQ/YAjCv1bNf9E/HCdUbcC3f4tn9sWb6do+1CjO2enHl5JDjBQ==" + }, + { + "id": "1778eb66b9386bcc37031cad14d73e4554413b23d16b4b680726375a622f3a5b", + "address_list": ["57.129.53.59:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "BZhVYgAjOP4RX0PnL9ACNMyYN8ElI/t3lMSTCckxEUfltBd32k2FC/MnVqaGyHf4NUW1jCTxgcozcaZDi7dxDQ==" + }, + { + "id": "dd3a881a8fe874b9f6f398a18da66363743675f453470a2639411c6ebd3e33c4", + "address_list": ["57.129.53.61:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "w7BKzJ8zewRbKJRufBKnvCzmPqf+wOJvgInQPHkBduC6JSaCDSeaXugSxFX27RWj498pIxptBmPifl8IDCQwDg==" + }, + { + "id": "1bee52331b5e4987993a3fc9b86493dbcb024a9099b728a57907df0a19a6e386", + "address_list": ["57.129.53.57:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "Z4nRrO8fFjDncvI5nXvVweVkXixtyoHkGIq4TH/tjNl9dMj0PgwQe2/rQGapGsCxwJP2m307UrTOVvj7lvEQDw==" + }, + { + "id": "91c88f5066a4fcccb4e3cdd0d9ca0980c01657ecf68feb429e60c0af63aa026a", + "address_list": ["79.137.100.38:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "yq2G5OfFH7Yeusl3poyWqBHQ8tLrahfVdgJE1Gk+zslaJANDKzuIAZ03dvB8DuuqPVmvuKTOOuG3zttWEHFSDg==" + }, + { + "id": "46130918ae9128cd1386a1d3e0199883832e242776332680d023efd017e8f24e", + "address_list": ["79.137.100.31:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "yDHieT5xIm+En0+L5JoUqnff67AVntJt7t1/JzvQR7b13GpIgnN7iybyeAt6C37j7pXDDUgh5zHPhB4zyxUUCQ==" + }, + { + "id": "28fa39e1bddd9c35a108a4d50ec3e2abe72e52df4600133fa6b83ec88f4d1c16", + "address_list": ["79.137.100.39:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "EsXtOT5rmMwq40ejiWLHqlmGgT3gCHXUBp98mq9M7kVDZEF8Sg694Eg4ElBsazfOA8nR3rjMIkNf3lP9zeAlCw==" + }, + { + "id": "a73d64ecf807634d9fbbf094bf20734b6e0b39f2665ca9cc1de876f84dbdb17b", + "address_list": ["79.137.100.30:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "ToKLDeUoffmefqG6uG+RAg/jByUbaXvY09r4TS902cndlMJ8YUFlAzchM816SsT/eNdN/QS3K/QPam4IhVyaAg==" + }, + { + "id": "4122dfc139febe5a86e59c975062fe3206cbbf6dc814dba175ca5d41b026f7f0", + "address_list": ["79.137.100.34:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "ZBwSHcbPVeoiispCbkxxpolm+kAumDZpfDfv48VQlJr3vMoA0rdYgF4fWzZXR7SOsXfKQU/KS+FJ7gFEDqRkCA==" + }, + { + "id": "f630e9314c9d21d28b8dc4dde7507bf1e0d13a7dae540f08f8b00ea100c4bd34", + "address_list": ["79.137.100.33:30000"], + "created_at": 1738174526, + "expires_at": 4294967295, + "signature": "hhlNUKbwAD+v3TBzYZa+uIiOXvaMx0KsAnbpBWonhPOlw9CV51ptTuGzhnmzCpnzrft2H51BHBIaRmjLVI9qDg==" + } + ], + "zerostate": { + "root_hash": "68ce2ad5df408d4776d91467ff1b88a77e059a2cbff404dd6870154d78899ea9", + "file_hash": "538111b4d0f2cda3b7d5e0389c74a0f5e6028583d92cf0f85d6f39a39f5a8551" + }, + "mempool": { + "start_round": 28924049, + "genesis_millis": 1746729231652 + } +} \ No newline at end of file diff --git a/config/prod/ton-global.config.json b/config/prod/ton-global.config.json deleted file mode 100644 index c7d6c61..0000000 --- a/config/prod/ton-global.config.json +++ /dev/null @@ -1,575 +0,0 @@ -{ - "@type": "config.global", - "dht": { - "@type": "dht.config.global", - "k": 6, - "a": 3, - "static_nodes": { - "@type": "dht.nodes", - "nodes": [ - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "yoZCHgn+HwnUw2YI67UBKvGBrqMOXaxLNT1bNkrwOsU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 869426051, - "port": 30303 - } - ], - "version": 1643142875, - "reinit_date": 1643142875, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142875, - "signature": "gpLPupTxag2TmYOGlu/LugTsQPa8+67jZNF9vH5EcXlCvgRVODC98fsVDO72TthtuPAxTXF+UuCpKrLr2zBJAg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "dPUiLsnbJ9O5Vgd/oojfd09+X5K27qAUptiW7Tsp9/s=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1841613196, - "port": 30303 - } - ], - "version": 1643142880, - "reinit_date": 1643142880, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142880, - "signature": "nlV4gBis2qhw47OR4rgx2VlFu0YNHT2GLf4PVM/Nnl5Ss7Nzy2ermRhGLkLkTNIa+xbmZzJitusZQ6UBxfGgAQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "HnwMW9jjnlTHDCnnz/QPTRcLm+ETz7Esps6/BsQumGM=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923141656, - "port": 30303 - } - ], - "version": 1643142884, - "reinit_date": 1643142884, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142884, - "signature": "qYsnLXB8qQfFFafOynpc91DgdjIDljRU0yuXkSPHkywzYXWkX0I6OZCHfMGgg8LdnFaER6r1nmLVkb9PeSXtAw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "9pBcFKa1v8r535ppWYUikUOHwkqBGoRFafIq1WkY2ng=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923175805, - "port": 30303 - } - ], - "version": 1643142888, - "reinit_date": 1643142888, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142888, - "signature": "up+SFzbCJa8VGY9Meknms0dfTdQeNO63no9Rb1TYScNvromu2BJM87YBKfIqhvQTVv5aDOu0a7EucK9lR7cZAQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "RyGm/Etnz6lkDsP6s4QmBJrtm5ktGv0y66LG6zpSfHA=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -957035945, - "port": 30303 - } - ], - "version": 1643142893, - "reinit_date": 1643142893, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142893, - "signature": "HZOqgQL9uEwwwR0AgHmuBLyWkkHXqjSVljG7lLoCIzG9MK276KBtfs73JrGKYg1NjepAqeEOeeexqmoqfuqMDQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "Ycffl7rN8v+TMyTfq1hTwpUfmWYAnfb55/O7oi/sA6c=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923175806, - "port": 30303 - } - ], - "version": 1643142897, - "reinit_date": 1643142897, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142897, - "signature": "mKKfEsfKrsVBtw28pSa8Jm8I1My4Zy4tJSYbS2aMyNJ8xfSUszwSlojlu9xmTfePWVagK1cgTlD8R6gj5FLRBw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "Xf9VAGLBw4PlUyLN3XFibYfSQ7kBqcfkZHzJRK2k6hs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -957035859, - "port": 30303 - } - ], - "version": 1643142901, - "reinit_date": 1643142901, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142901, - "signature": "vr4kx21lMEzSww7vds2v7FNyq0sbY+K2bUQsGzQzsCHCnIBZhVEGKAFk6pYIlx0yoDjqZGEgvZ5lTSby/Xw9AQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "05jCdKl0FbZXiBpM/CuV7pGdOj7svG8TWvAeuMMgMKI=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923163299, - "port": 30303 - } - ], - "version": 1643142906, - "reinit_date": 1643142906, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142906, - "signature": "1auAFFWpcaiiyOzZdiMmlMnvM72nw6Cl33+CKrmoxRumQ947GSYn1lTJSFvnHIM93/tRq+MqkRDZJvrb7Bx+Cg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "VQksc1Cu5M7e4Oekdl5Riko6f2I5ZUy7K9nq8ZUPSiY=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -957035946, - "port": 30303 - } - ], - "version": 1643142911, - "reinit_date": 1643142911, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142911, - "signature": "oxWBQWuLQqMBkj76y6eOrY5v3M2QHvrRPVHjKaLZX5191wo8D6fTkjGHNG1QV/ZTLEVxeObCtthamWOB6XPTCQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "h5RY3jHGCLcFLxC87YpNOJhfFl3d99qPDQY4i49yRNU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923141658, - "port": 30303 - } - ], - "version": 1643142915, - "reinit_date": 1643142915, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142915, - "signature": "gbVVvCyy+bVLAWWfiIUpJwVHEv89Q5xQSqFELEmS8mRt8QozvUaOXWNyBfVJ+yRc1zLNNcmvks7gQY5lMQyJDQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "qck6z6nx5xBca/IYaQVBsOkIGxcseCoRgQ4hO9iL8Sc=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923163300, - "port": 30303 - } - ], - "version": 1643142919, - "reinit_date": 1643142919, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142919, - "signature": "oACrpCmQ1tCCNbH0FcsxoWVwsAU5N2h474+sNsTUFDqUGBLSQAoQP9LwmfbZW4phYI5VWCutUR4dYejgefqsBQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "I3wkxyB2zE1r1bznM+1dWHUvjSHcGNkboUhaL5a/+Mg=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923141654, - "port": 30303 - } - ], - "version": 1643142924, - "reinit_date": 1643142924, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142924, - "signature": "enfSwHe1mGLSX/Xc9Nx2kNG6HqrE9kZUbMiBOD8fzyh1nqo9UVxlI8ZOdfCcUpdravPtCQERADchk46eGHusCw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "O4eQWez6Y418lqCNrjLQ+F/MEEO6g5fPNBSExiUEKRo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1841613187, - "port": 30303 - } - ], - "version": 1643142928, - "reinit_date": 1643142928, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142928, - "signature": "VNFgnRLJs6FAOZ8Qx8dfjWgllbqxJzwQ9B4joY8d2D9XMvUy5L8WoElq9qkqfs2zxWEMpUe6nS71NcD/svpXBg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "UBPOO6+kop1s/r4yA4Q3Zm2UcLvPDNoSUtgN06uC1vs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923175802, - "port": 30303 - } - ], - "version": 1643142932, - "reinit_date": 1643142932, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142932, - "signature": "S/NRZAeyUdXTAZJTm0E3hv7hPRmAV+dYBTMxmvrrkly0rlOz2ZoWO0yAYCtLG8hBEaiEUEUflmN12pz5hfpMCA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "8VZsoie0igWXH37MAYKVvLuMp2mtYcKf6pFV34J7G6w=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923175803, - "port": 30303 - } - ], - "version": 1643142936, - "reinit_date": 1643142936, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142936, - "signature": "gs/BE0tKDFChjh6DyYt2c7gM07hFlx2e/lCuf1GFHfUwTcO5JkS2t5KoQVbTQ/bqhsxtVWQnnVAHuMM60pnDAA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "W5v0ywIBV8DoXxjdP04Ltqd48hW196n28TKeFrmJgMU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -957035858, - "port": 30303 - } - ], - "version": 1643142941, - "reinit_date": 1643142941, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142941, - "signature": "3AKBy9ufaJXSraNF8dGXRqake1p1RqRkUHCQM/LUnA1/ZogiC+2KFuaROCs4nOdYcqFbgGzyy6W4kHXsfaWTBw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "In5e0h2t4WmqKpi22WA4bIOUyt1Osf0k9z6cIzh7FOo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923141657, - "port": 30303 - } - ], - "version": 1643142945, - "reinit_date": 1643142945, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142945, - "signature": "rE6Q6OO+8Oas+ySpVlfk9Ve1C0rm8WQb8DIZQ+Nw+iher7ysc3xlC2iLrbDZze55ArKnCoL7kxhs6cx93C4dBQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "r9VQO0vrEZsdAKRI0u/Ve9TtIA7YpxtNc6f1vgs68JE=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1841613188, - "port": 30303 - } - ], - "version": 1643142950, - "reinit_date": 1643142950, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142950, - "signature": "COfg4XoFDBPER/uf56xtz+3GTMjZbI3aKCpaf41z8WunVdyL6Mvmy7/jXB72/gvdiKUwqse6MLR0aXKefA/gAA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "TihsBNEOupf0i8wq+iJ2BHtFcoSuGLIskljmphHKUQs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1841613186, - "port": 30303 - } - ], - "version": 1643142955, - "reinit_date": 1643142955, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142955, - "signature": "Y2JVXcCKXEMqp+KWHF5yWLZNJSwhKZMY9UfznGVgJ8M7gRLQosatIk12YWwH82NvLv6vYNxMKdACeQlmx2RPCA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "xgL8SRDNYQAHqskcPgSlQuOM/Q5eVue+mPN6+L/7O/o=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923175804, - "port": 30303 - } - ], - "version": 1643142959, - "reinit_date": 1643142959, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142959, - "signature": "VpkxeG89CjnhIVsw3JS3/wDb9ZhjuYyCWRS0aHn0KTYgvVgNQvK2jiICHEyhe1VqAtgDBUiDvsokf3WImmmgDA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "baXfnNYKYAHvDbS1bywJufTzzM9cNpMSKH0AnW2NXfo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -1923163301, - "port": 30303 - } - ], - "version": 1643142963, - "reinit_date": 1643142963, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142963, - "signature": "3hFbuRlbQ3JB3deSh+uqrRUmhvWvTZJheXddrT+GcGXnk6KOZcRQOWG3suScrNXq8XaQPd9pqPRxVOQAR98gDw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "WCFlPl/iGqT5sOCiE01ewYPwXQ/m4ZDDmlFVLyFY9Aw=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861526975, - "port": 30303 - } - ], - "version": 1643142968, - "reinit_date": 1643142968, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142968, - "signature": "QJVPStDhScf66ZJg6/VfC6xWhvqvalLAHVa6hrKUQyTC8GDV/cLXTCfk9Phy6xBlhwbtDoZhJokdDJrkXcZADg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "YEChGA84Jca/s/jLWYIQjJeGVmYmuqEybtbI9Zk0u2c=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -2021848959, - "port": 30303 - } - ], - "version": 1643142974, - "reinit_date": 1643142974, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142974, - "signature": "6MVl8vhaa2vG4pVE6FVd8Nu56Q+s0ZHdGHz/fvsy8hzSTM3FMIXPGDhvvjhT7DvPIOutSCpBojALPJMoQuvfDw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "SGafiKgWaXuyIbcm7fnRVhXFyfGa24Er3LEXMXcZp1A=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 869430532, - "port": 30303 - } - ], - "version": 1643142979, - "reinit_date": 1643142979, - "priority": 0, - "expire_at": 0 - }, - "version": 1643142979, - "signature": "QGdMo8Qxuo3TMuzI+9fewGhUEBTkGB3299rSO+P7F1SDqd5E4c9lsG6zFTEwSGyIcj+p9F3jRpd83fX/Wg8TCg==" - } - ] - } - }, - "validator": { - "@type": "validator.config.global", - "zero_state": { - "workchain": -1, - "shard": -9223372036854775808, - "seqno": 0, - "root_hash": "WP/KGheNr/cF3lQhblQzyb0ufYUAcNM004mXhHq56EU=", - "file_hash": "0nC4eylStbp9qnCq8KjDYb789NjS25L5ZA1UQwcIOOQ=" - } - } -} \ No newline at end of file diff --git a/config/test/config.json b/config/test/config.json new file mode 100644 index 0000000..2207431 --- /dev/null +++ b/config/test/config.json @@ -0,0 +1,186 @@ +{ + "public_ip": null, + "local_ip": "0.0.0.0", + "port": 30000, + "network": { + "quic": null, + "connection_manager_channel_capacity": 128, + "connectivity_check_interval": "5s", + "max_frame_size": "8.4 MB", + "connect_timeout": "10s", + "connection_backoff": "10s", + "max_connection_backoff": "1m", + "connection_error_delay": "3s", + "max_concurrent_outstanding_connections": 100, + "max_concurrent_connections": null, + "active_peers_event_channel_capacity": 128, + "max_concurrent_requests_per_peer": 128, + "shutdown_idle_timeout": "1m", + "enable_0rtt": false, + "connection_metrics": null + }, + "dht": { + "max_k": 6, + "max_peer_info_ttl": "1h", + "max_stored_value_ttl": "1h", + "max_storage_capacity": "16.8 MB", + "storage_item_time_to_idle": null, + "local_info_refresh_period": "1m", + "local_info_announce_period": "10m", + "local_info_announce_period_max_jitter": "1m", + "routing_table_refresh_period": "10m", + "routing_table_refresh_period_max_jitter": "1m", + "announced_peers_channel_capacity": 10 + }, + "peer_resolver": { + "max_parallel_resolve_requests": 100, + "min_ttl_sec": 600, + "update_before_sec": 1200, + "fast_retry_count": 10, + "min_successfull_resolve_interval": "1m", + "min_retry_interval": "1s", + "max_retry_interval": "2m", + "stale_retry_interval": "10m" + }, + "overlay": { + "public_overlay_peer_store_period": "3m", + "public_overlay_peer_store_max_jitter": "30s", + "public_overlay_peer_store_max_entries": 20, + "public_overlay_peer_exchange_period": "3m", + "public_overlay_peer_exchange_max_jitter": "30s", + "public_overlay_peer_collect_period": "10s", + "public_overlay_peer_collect_max_jitter": "5s", + "public_overlay_peer_discovery_period": "3m", + "public_overlay_peer_discovery_max_jitter": "30s", + "exchange_public_entries_batch": 20 + }, + "public_overlay_client": { + "neighbors": { + "update_interval": "2m", + "ping_interval": "30s", + "apply_score_interval": "10s", + "keep": 5, + "max_ping_tasks": 5, + "default_roundtrip": "300ms", + "send_timeout": "500ms", + "query_timeout": "1s" + }, + "validators": { + "ping_interval": "1m", + "ping_timeout": "1s", + "keep": 5, + "max_ping_tasks": 5, + "send_timeout": "500ms" + } + }, + "storage": { + "root_dir": "./db", + "rocksdb_enable_metrics": true, + "rocksdb_lru_capacity": "2.1 GB" + }, + "core_storage": { + "cells_cache_size": "256.0 MB", + "archives_gc": { + "persistent_state_offset": "5m" + }, + "states_gc": { + "random_offset": true, + "interval": "1m" + }, + "blocks_gc": { + "type": "BeforeSafeDistance", + "safe_distance": 1000, + "min_interval": "1m", + "enable_for_sync": true, + "max_blocks_per_batch": 100000 + }, + "blocks_cache": { + "ttl": "5m", + "size": "500.0 MB" + }, + "blob_db": { + "pre_create_cas_tree": true + } + }, + "blockchain_rpc_client": { + "min_broadcast_timeout": "100ms", + "too_new_archive_threshold": 4, + "download_retries": 10 + }, + "blockchain_rpc_service": { + "max_key_blocks_list_len": 8, + "serve_persistent_states": true + }, + "blockchain_block_provider": { + "get_next_block_polling_interval": "1s", + "get_block_polling_interval": "1s", + "get_next_block_timeout": "2m", + "get_block_timeout": "1m" + }, + "archive_block_provider": { + "max_archive_to_memory_size": "100.0 MB" + }, + "rpc": null, + "metrics": { + "listen_addr": "127.0.0.1:10000" + }, + "threads": { + "rayon_threads": 12, + "tokio_workers": 12 + }, + "profiling": { + "profiling_dir": "" + }, + "logger_config": { + "outputs": [ + { + "type": "Stderr" + } + ] + }, + "starter": { + "custom_boot_offset": null + }, + "api": { + "server_addr": "127.0.0.1:8080", + "database_url": "postgresql://postgres:postgres@127.0.0.1:5432/tycho_wallet_api", + "db_pool_size": 8, + "key": [ + 254, + 253, + 72, + 225, + 66, + 168, + 192, + 96, + 74, + 166, + 65, + 13, + 126, + 27, + 103, + 57, + 71, + 225, + 209, + 133, + 243, + 170, + 5, + 92, + 239, + 36, + 235, + 63, + 254, + 182, + 107, + 132 + ], + "api_metrics_addr": null, + "node_metrics_settings": null, + "public_url": null + } +} \ No newline at end of file diff --git a/config/test/config.yaml b/config/test/config.yaml deleted file mode 100644 index 4a1f254..0000000 --- a/config/test/config.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -server_addr: "0.0.0.0:8080" -database_url: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}" -db_pool_size: 5 -ton_core: - adnl_port: 30310 - db_path: "/var/ton/ton-wallet-api/data" - keys_path: "/var/ton/ton-wallet-api/data/adnl-keys.json" - recover_indexer: true -api_metrics_addr: "0.0.0.0:9999" -node_metrics_settings: - listen_address: "0.0.0.0:10000" - metrics_path: "/metrics" - collection_interval_sec: 10 -logger_settings: - appenders: - stdout: - kind: console - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" - root: - level: error - appenders: - - stdout - loggers: - ton_wallet_api: - level: info - appenders: - - stdout - additive: false - tower_http: - level: info - appenders: - - stdout - additive: false - ton_indexer: - level: error - appenders: - - stdout - additive: false - tiny_adnl: - level: error - appenders: - - stdout - additive: false diff --git a/config/test/global-config.json b/config/test/global-config.json new file mode 100644 index 0000000..8cb7338 --- /dev/null +++ b/config/test/global-config.json @@ -0,0 +1,129 @@ +{ + "bootstrap_peers": [ + { + "id": "18e186f43eb2164e700b9f769364782ba7e7e10beb83c5499a2af9b7189e047a", + "address_list": [ + "45.92.131.15:30000" + ], + "created_at": 1741701048, + "expires_at": 4294967295, + "signature": "BfQ+DSUx/php60P4IukZAVsltYNNVu1wt3yznG+mMtAnhbvqCsegvSKmhSLxLj6QOhCk6JJ3C4DmKP6w1p4ECw==" + }, + { + "id": "b65977938c53320e2c54e03975950ea1560913a9b97f50a42522ad15694f7016", + "address_list": [ + "45.92.131.16:30000" + ], + "created_at": 1741701048, + "expires_at": 4294967295, + "signature": "0QN/Cre228uILh+8+MXK7aPPMOogtRrFDpWIzlMZgLwZj7bac4VPwop1+nZ9H+zClejglNGr2J/wFthtsYeBCg==" + }, + { + "id": "71433aac2435a5eed9f5baea3f44da7a5f149ae2476fcbe78253ad39609ebdc9", + "address_list": [ + "45.92.131.17:30000" + ], + "created_at": 1741701048, + "expires_at": 4294967295, + "signature": "h3zU8p7UknWiZfNTHst7pAgm2VxCXdJ+fTQfB+Jov10LoDEMHzZFcSKgpG1ph0XRocl8b2XhRGQuVq6yjSxqCQ==" + }, + { + "id": "bdcbf462eff4c6cf38ec8740973ce557778a20598b771c62c6528b6ce6df364e", + "address_list": [ + "194.0.107.2:30000" + ], + "created_at": 1741701048, + "expires_at": 4294967295, + "signature": "iUuRJMCxRRuZZuosut4d5vle0KO5f5JuGy117YOegYHEavIgKlKCxTyf3+n7aoVOc3juWWEh8P/pLR7nOQsEDw==" + }, + { + "id": "d80ec747625d7940b45b478ad94746a89bc7c8e848ccbe6aaca982a0332fb6f4", + "address_list": [ + "194.0.107.3:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "s+cGP+QRNsq/UT5rxRjdltNq/yHgrWHZEsnSZM+M6mMhJeOYB1iZQqgFDIhk0qDPfG71tG36yEOmPLJiS+zWBQ==" + }, + { + "id": "966ef478293afebd9b8913646e5b5e7881fbcc994a121c18666111d9ee2dcf27", + "address_list": [ + "194.0.107.4:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "Y8CJftbIXRFI4MAbcNeYmgaPF9+f7DT+nd6/gK6eNba5vfbVNVF71/gdnWR6IUu/E7tRcwysXX4jNV9Vxq/5AQ==" + }, + { + "id": "f5ed69c810d14533c81074b3698e523bec0452a41809487b277896fdce8e25d1", + "address_list": [ + "194.0.107.5:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "PN3r2hOOR3DF1CHt3G6MrYx01+P3g5XYinBm5ZjzPn8nlvBh7qtpYjkGtyztdJMHta/U249Ty5BXITWoYNY/Aw==" + }, + { + "id": "cc02616327cb38af9488d1ccb5441b5608541e251da3720448f3a8243589111b", + "address_list": [ + "194.0.107.6:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "k8I3cVM0ELVeOshZe/KLYmp7j/xxV0k4RIsn2JsDRYiXIc0HHnzKc8KGbLVpS7/6DB6to/OrVplt22SMoXRaAA==" + }, + { + "id": "fa7e5dcb7af82915d502a8aac4578f3f3bf08656b37c95236676434e6c148c3e", + "address_list": [ + "194.0.107.7:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "sZFPKcU6/JkbxvwPq3hWvxC9grxq0vuEtY4AklwD9Y0WQrrZpG6ewhFDQLB4napDFvDoE4a1d3Gim4TOrSTTDg==" + }, + { + "id": "9d10bad3ec84506542dee0b5fcbb9384cc9f71cbe72ac88956a04d3e103fe63d", + "address_list": [ + "194.0.107.8:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "oBwv6S1zu1sDXy/iKrmmNmsGGlF3GtIcY5vOwaD17hFDDhWOWz3Dd4UHYvh6CAZpR5T2kOVtbvs3kZZ2FxwbDQ==" + }, + { + "id": "e2a087b9b47b7d12ec8db2c5a139671ca79f4cb266d6ef5d071469c6f25be7f1", + "address_list": [ + "194.0.107.9:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "pJu7KEmAXqtqvNtRt416UuE/gUpPvisQ80g3Fu2g+UX/e4wzqqASTsVHmU2QT1yXpUl/1PUsdLL/bL3LcvqsAg==" + }, + { + "id": "13ce86f27c4a02728b2bb457980c327fc4280f449cbdc82711d7648a3e9fe8aa", + "address_list": [ + "194.0.107.10:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "LWDwvojEz/oGCn7yrmHFtIsYQBcED0bkJhnZL8gTqD+BzBg24g2GW8AGuaWI0I6G8YPGv8DcVNLPpSVaasZxBQ==" + }, + { + "id": "f398a8599afd472e94e139fc10ffd9775579e4d9b8ae767b50ebe8f0df1468f1", + "address_list": [ + "194.0.107.11:30000" + ], + "created_at": 1741701049, + "expires_at": 4294967295, + "signature": "5rwS2ETu7Xqoh3cPi3unnqWOfcSOQT/kw/Z9YwH3bgrXWx13M+RtjgAeZ3CNSxgSK4qNNFqZzqb0EExtAfsuAA==" + } + ], + "zerostate": { + "root_hash": "fdd82b5fc143b114389463dee30f9aaf99b8e14f503e1fc7a88542c0275bdbb2", + "file_hash": "74b30c8a96a96a63110d01ad54040ec7bc1a500f6d2c18b5b32c7943578a1789" + }, + "mempool": { + "start_round": 32396325, + "genesis_millis": 1749559078161 + } +} \ No newline at end of file diff --git a/config/test/ton-global.config.json b/config/test/ton-global.config.json deleted file mode 100644 index 0eeaba1..0000000 --- a/config/test/ton-global.config.json +++ /dev/null @@ -1,552 +0,0 @@ -{ - "@type": "config.global", - "dht": { - "@type": "dht.config.global", - "k": 6, - "a": 3, - "static_nodes": { - "@type": "dht.nodes", - "nodes": [ - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "yoZCHgn+HwnUw2YI67UBKvGBrqMOXaxLNT1bNkrwOsU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 869426051, - "port": 30303 - } - ], - "version": 1639685498, - "reinit_date": 1639685498, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685498, - "signature": "kQstkdIP0Q+f3TSCoGmEns8dxfFj6I8pKR2ZxcxO/JqWHe1+jycZmXVoQ4h0QngXnZtBrfF+UTHIViWKrmlBBw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "qY1NUHKA8hqnCet9zaNxoHXO0mRwhwV57l+aGbfreAs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134135, - "port": 30303 - } - ], - "version": 1639685501, - "reinit_date": 1639685501, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685501, - "signature": "aqgQmn8D13pICA3NFlV9uGgOAkp/tmMxNxyyFrzWBJe7kl8XJ/5b1fYWx7qainPv8R8YNLdG5qBqukkZprw6DA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "TQuJAtN98qQXXrk1tte+r3A2G5KWXA9mRPFS17cI+Eo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -642332569, - "port": 30303 - } - ], - "version": 1639685505, - "reinit_date": 1639685505, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685505, - "signature": "7+U297n62oY1OmuMvkESqLHyEc/IePTrtWhyWt2S2C4E8pbAqJirb006YMHjkdPH9i1/9XBM1nc5dsw7eb0vAw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "ID9uWD4NucBtXK3c6Uc4yNpWrhSkpLpI0rarUr28cYg=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134095, - "port": 30303 - } - ], - "version": 1639685508, - "reinit_date": 1639685508, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685508, - "signature": "EX8GoiZ3n2A29BKhbPcnsLQx/ttNVKMTYGwIQSojb5BLC5lS3UgrpTK1Yoj8Rj/qDgdexZaZuwxxLJeiY/U2CA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "eiLFk/SdYANdfDjJmdvd3gjSdS33K1xf4JYXwoZ6/GA=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134168, - "port": 30303 - } - ], - "version": 1639685512, - "reinit_date": 1639685512, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685512, - "signature": "OwpLDPZiuNG8r7vpjA0WpwGry18P+L6O/PReY+DNfTldeXIDiOcf6QwqDcIGQtoh9bCqs0Yf+EqJiQ3ME7MJAA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "5G3YCox6ogUUndervdAdl7g1sxq0DwyIdXyxTphyRpU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134134, - "port": 30303 - } - ], - "version": 1639685516, - "reinit_date": 1639685516, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685516, - "signature": "Yxi+DuP0iMcWmB/IJBxVF2RuWbpW97t0kvHcbQiDFckngAhbTqE1JE+Y+FfJ9OjcBLr748IWKgp/DOxryjOoCQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "ENErYuaVEe4NzC2A4S0cs2FlKwJSVnuTIDoOrDveF6s=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134142, - "port": 30303 - } - ], - "version": 1639685519, - "reinit_date": 1639685519, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685519, - "signature": "ANjfaH2iPlWpC6H6zK0H2sKATgvAMLLmPhX2WAkE/5WXC+F0pUEO0KA+/21SEpAsclvG2TpQsYtiQuUOg7P+BA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "Cy3JkbDWQjWk7TOWuud9LewXtNPsio+D3KgC3HgR+CU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134162, - "port": 30303 - } - ], - "version": 1639685523, - "reinit_date": 1639685523, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685523, - "signature": "J81Eo4ZPK98V/7xXOXjkpv08OuSSWIAD7L+uPCH7ywVEf3waInXM0ujlDgkjMxaBA/bcDpU6ALJJE6iekJi6Ag==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "DvNytBI8DKy9KB+E+cMIfKbC4pGoe9hQ5NKqsrzgPZ0=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134127, - "port": 30303 - } - ], - "version": 1639685527, - "reinit_date": 1639685527, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685527, - "signature": "p1RZ5cF6ZuQvTc5hl0DEMH51znkiw/qWniiBhovsvKrIdxkkBbuhCmqa6it8uKx7Pm5YwpvL+uhIbpkPUep0CQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "q+myNccB1QLCLwzkzpX+1JPkHCDl9rq4KLkfDT/AZTY=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -642332572, - "port": 30303 - } - ], - "version": 1639685530, - "reinit_date": 1639685530, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685530, - "signature": "45pNdIMtqoEJpDmonz/9UO4JqL/f+iQ2pVdtGEVXsplWxlEsuVzWZz+dUBpxnKJsPWBgtXaOOhvHsUX7+z48CQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "C+2PgNmodDMCMXjHhsMTw8tWsBFQ11QBxSXp1H7KIx8=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134102, - "port": 30303 - } - ], - "version": 1639685534, - "reinit_date": 1639685534, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685534, - "signature": "Q0fzr7AyYO2YZNrc8oqqM43NKOpTEFYOuD0ezRvg1kZdh2/PXEf5P9B62fFj6Myhm6xsN0GKhMmKbX2P/EeUBQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "6UiZChhK6O9pIj4Gbco0R6HTLxYiiZSXWKdShnlx1DI=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134118, - "port": 30303 - } - ], - "version": 1639685538, - "reinit_date": 1639685538, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685538, - "signature": "kiIgAVunk5TuC47B2SHPEhcU9NWhli2pFxVKFMPPyE3LB55emLsDiCEpOGKv7lG1toheh0S42NdrTl9gylnvAA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "XyWFE+xphs6R/6Tbqj7Ukc2jS1hjEMbSG/7AkUbv58E=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134160, - "port": 30303 - } - ], - "version": 1639685541, - "reinit_date": 1639685541, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685541, - "signature": "a9w23TJ0/rEZPsKYafsPERIBenq2nalFzRyl2qzjnFxKTt94XXa5e2jooNKrwjHQ0ua5XN00e/m9fCwYe4ZvBg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "1uTa6eIl80X91jW43aT8r3d67sc8XBKkBwU/OrvyUzk=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134137, - "port": 30303 - } - ], - "version": 1639685545, - "reinit_date": 1639685545, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685545, - "signature": "PnA4rlg2euR4QJwieMp/1EAQksOrvSs8LwFZ+72FXmtD2XqUprYOiRAbUwvzNyhE+SmFcubWXFoJrON84P8SCA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "yU5QTNWPeL4384c5ZwEbiMlYn2Xl4+hlTsQyiR+2drs=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -642332602, - "port": 30303 - } - ], - "version": 1639685549, - "reinit_date": 1639685549, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685549, - "signature": "qSYgpxhLM5FgNLCTbOfByZqG730UKd3riMtf82nItDVli9JkJegvKt3op0BELwdJlzUbwAiB2e43H0a0rlPOBw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "RM2rjdrXw01arg6yFiiJEEzg9Ok0uL/Xl3/4N9MPfdQ=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134103, - "port": 30303 - } - ], - "version": 1639685552, - "reinit_date": 1639685552, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685552, - "signature": "p+WQgyrQ4q9gw53XKXk7n5p3IHmsaSrbXXsoyyqESQX1WZxumfytN0CzNyARR6nI9XR5WfBsnKW/S2Zc/dj9Cg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "+1qW8/j9Le37TG1KQddz7dmwT2lzCtpnnKoSBfJxdnQ=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": -642332571, - "port": 30303 - } - ], - "version": 1639685556, - "reinit_date": 1639685556, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685556, - "signature": "XEhMCihtUZr/vL1E1U+dVM7Y2p8zvAYQoNmx2IIw9OzDVk/oN493MR2vjCLxX/u5/sKy+vb9I/8ND+6PjNxgAQ==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "anvHFhj9+xSavT595W4mevH1/pyDtURXdsQ/N7CGvSo=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134177, - "port": 30303 - } - ], - "version": 1639685559, - "reinit_date": 1639685559, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685559, - "signature": "UOLKi7GVExYPshm82wAi1pu1yQj/pbLTibGg5vCBLDdduArczcNz+P4OBPHg/Hv0Gx5TkqCXv53c7jDG9NDjCw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "OVw1YD2P/ND3UTKHitBOtu3Z2XnRnoUdl9CUZBAUSHU=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134099, - "port": 30303 - } - ], - "version": 1639685563, - "reinit_date": 1639685563, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685563, - "signature": "wWIDi9i3+5i/8mjlrT9oKEs1rdL9Lc3JXYXGuiig0sPmJstR82X1xICKTIpAIOLvmiS1Svx4FTTXz7oNUZ4uDA==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "1FefiTgpJi4A8LLiVRpZN9dszQs2aQVMTFcp73QNx6M=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134157, - "port": 30303 - } - ], - "version": 1639685566, - "reinit_date": 1639685566, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685566, - "signature": "5TD/fAF1CHtjkEZxliGlJc+hH0ChfYMoKJNTuRAip598dBAwES34xD5nhMRd3WHkwWhhnRqHl6FCqDxfUdtHCw==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "xUO75gZaviAQEsEof4s8VdleKew6UCwHUIbkn/EC3XI=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134126, - "port": 30303 - } - ], - "version": 1639685570, - "reinit_date": 1639685570, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685570, - "signature": "jcDgLk3SfEAllcbPr3T6fzkn7Xo5FmbfwNBJPsTZiqfI/mG6B2ZG2DvuNfzQQa7nt5mVd5NbGZx7MiC7NfxqDg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "ZMEf46HJQFVVgXRgtHJRt7kYk5imbN1806gCY1JKGTc=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 861134139, - "port": 30303 - } - ], - "version": 1639685573, - "reinit_date": 1639685573, - "priority": 0, - "expire_at": 0 - }, - "version": 1639685573, - "signature": "5CVNBp3i5lq2jdhcenUX1qhPc5YwnDTRVnOw3P51e0vJuGuKxUItjKCdyEQoarDCPMPduSEepXizYRpXipknDg==" - }, - { - "@type": "dht.node", - "id": { - "@type": "pub.ed25519", - "key": "6J+6Wl3KvHLPOuvfQiQQN6TpTYutwlOdi6p5EgjB0A0=" - }, - "addr_list": { - "@type": "adnl.addressList", - "addrs": [ - { - "@type": "adnl.address.udp", - "ip": 868462708, - "port": 30303 - } - ], - "version": 0, - "reinit_date": 0, - "priority": 0, - "expire_at": 0 - }, - "version": -1, - "signature": "qDsz2H3I/+5LnKez/8eEBeoLZH6Fugt2dapyIvbwXvC8Pqd1Yn7Hpey2RbGHu5+K7hqLfEwXpOxDQoBZ2xPHAQ==" - } - ] - } - }, - "validator": { - "@type": "validator.config.global", - "zero_state": { - "workchain": -1, - "shard": -9223372036854775808, - "seqno": 0, - "root_hash": "WP/KGheNr/cF3lQhblQzyb0ufYUAcNM004mXhHq56EU=", - "file_hash": "0nC4eylStbp9qnCq8KjDYb789NjS25L5ZA1UQwcIOOQ=" - } - } -} diff --git a/default.nix b/default.nix index c431f33..b14a099 100644 --- a/default.nix +++ b/default.nix @@ -18,7 +18,7 @@ let merged-openssl = pkgs.symlinkJoin { name = "merged-openssl"; paths = [ pkgs.openssl.out pkgs.openssl.dev ]; }; in naersk.buildPackage { - name = "ever-wallet-api"; + name = "tycho-wallet-api"; root = pkgs.lib.sourceFilesBySuffices ./. [".rs" ".toml" ".lock" ".html" ".css" ".png" ".sh" ".sql" ".proto" ".json"]; buildInputs = with pkgs; [ sqlx-cli openssl pkgconfig clang llvm llvmPackages.libclang zlib cacert curl postgresql pkg-config ]; LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib"; diff --git a/deploy.dockerfile b/deploy.dockerfile index 27fb334..c250a77 100644 --- a/deploy.dockerfile +++ b/deploy.dockerfile @@ -9,18 +9,18 @@ RUN apt-get update && \ WORKDIR /app -RUN mkdir -p /etc/ton-wallet-api && mkdir -p /var/db/ton-wallet-api +RUN mkdir -p /etc/tycho-wallet-api && mkdir -p /var/db/tycho-wallet-api -COPY --from=builder /app/target/release/ton-wallet-api /usr/local/bin/ton-wallet-api -COPY --from=builder /app/scripts/contrib/config.yaml /etc/ton-wallet-api/config.yaml +COPY --from=builder /app/target/release/tycho-wallet-api /usr/local/bin/tycho-wallet-api +COPY --from=builder /app/scripts/contrib/config.json /etc/tycho-wallet-api/config.json # Download external configuration file -RUN curl -so /etc/ton-wallet-api/ton-global.config.json \ - https://raw.githubusercontent.com/tonlabs/main.ton.dev/master/configs/ton-global.config.json +RUN curl -so /etc/tycho-wallet-api/global-config.json \ + https://testnet.tychoprotocol.com/global-config.json # Restart systemd-timesyncd service RUN systemctl enable systemd-timesyncd.service -WORKDIR /etc/ton-wallet-api +WORKDIR /etc/tycho-wallet-api # Default command for the container (optional) -CMD ["/usr/local/bin/ton-wallet-api", "server", "--config", "/etc/ton-wallet-api/config.yaml", "--global-config", "/etc/ton-wallet-api/ton-global.config.json"] +CMD ["/usr/local/bin/tycho-wallet-api", "server", "--config", "/etc/tycho-wallet-api/config.json", "--global-config", "/etc/tycho-wallet-api/global-config.json", "--keys", "/etc/tycho-wallet-api/keys.json"] diff --git a/nix/local-test.nix b/nix/local-test.nix index 3d95e83..001ac6e 100644 --- a/nix/local-test.nix +++ b/nix/local-test.nix @@ -7,7 +7,7 @@ nixpkgs.overlays = [ (import ./overlay.nix) ]; - services.ever-wallet-api = { + services.tycho-wallet-api = { enable = true; port = 7354; chain = "Everscale"; diff --git a/nix/module.nix b/nix/module.nix index fdf56f7..57f7fe6 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -2,25 +2,25 @@ with lib; # use the functions from lib, such as mkIf let # the values of the options set for the service by the user of the service - cfg = config.services.ever-wallet-api; + cfg = config.services.tycho-wallet-api; in { ##### interface. here we define the options that users of our service can specify options = { - # the options for our service will be located under services.ever-wallet-api - services.ever-wallet-api = { + # the options for our service will be located under services.tycho-wallet-api + services.tycho-wallet-api = { enable = mkOption { type = types.bool; default = true; description = '' - Whether to enable ever-wallet-api node by default. + Whether to enable tycho-wallet-api node by default. ''; }; package = mkOption { type = types.package; - default = pkgs.ever-wallet-api; - defaultText = "pkgs.ever-wallet-api"; + default = pkgs.tycho-wallet-api; + defaultText = "pkgs.tycho-wallet-api"; description = '' - Which ever-wallet-api package to use with the service. + Which tycho-wallet-api package to use with the service. ''; }; @@ -48,14 +48,14 @@ in { datadir = mkOption { type = types.str; - default = "/var/lib/ever-wallet-api"; + default = "/var/lib/tycho-wallet-api"; description = '' Path to service state on filesystem. ''; }; configdir = mkOption { type = types.str; - default = "ever-wallet-api"; + default = "tycho-wallet-api"; description = '' Path to service configs and keys on filesystem. The /etc/ prefix is appended automatically. ''; @@ -77,14 +77,14 @@ in { }; dbUser = mkOption { type = types.str; - default = "ever-wallet-api"; + default = "tycho-wallet-api"; description = '' Which username to use in PostgreSQL. ''; }; dbDatabase = mkOption { type = types.str; - default = "ever-wallet-api"; + default = "tycho-wallet-api"; description = '' Which database name to use in PostgreSQL. ''; @@ -142,7 +142,7 @@ in { ton_core: # UDP port, used for ADNL node. Default: 30303 adnl_port: ${builtins.toString cfg.adnlPort} - # Root directory for ton-wallet-api DB. Default: "./db" + # Root directory for tycho-wallet-api DB. Default: "./db" db_path: "${cfg.datadir}/db" # Path to ADNL keys. # NOTE: Will be generated if it was not there. @@ -173,7 +173,7 @@ in { appenders: - stdout loggers: - ton_wallet_api: + tycho_wallet_api: level: debug appenders: - stdout @@ -245,23 +245,23 @@ in { ##### implementation config = mkIf cfg.enable { # only apply the following settings if enabled # User to run the node - users.users.ever-wallet-api = { - name = "ever-wallet-api"; - group = "ever-wallet-api"; + users.users.tycho-wallet-api = { + name = "tycho-wallet-api"; + group = "tycho-wallet-api"; extraGroups = [ ]; - description = "ever-wallet-api daemon user"; + description = "tycho-wallet-api daemon user"; home = cfg.datadir; isSystemUser = true; }; - users.groups.ever-wallet-api = {}; - environment.etc."${cfg.configdir}/config.yaml" = { + users.groups.tycho-wallet-api = {}; + environment.etc."${cfg.configdir}/config.json" = { text = cfg.config; }; - environment.etc."${cfg.configdir}/ton-global.config.json" = { - text = builtins.readFile ./ton-global.config.json; + environment.etc."${cfg.configdir}/global-config.json" = { + text = builtins.readFile ./global-config.json; }; # Create systemd service - systemd.services.ever-wallet-api = { + systemd.services.tycho-wallet-api = { enable = true; description = "Service that indexes transactions for Ever or Venom"; after = ["network.target" cfg.dbPasswordFileService cfg.everSecretFileService cfg.everSaltFileService]; @@ -272,14 +272,15 @@ in { export SECRET=$(cat ${cfg.everSecretFile} | xargs echo -n) export SALT=$(cat ${cfg.everSaltFile} | xargs echo -n) - ${cfg.package}/bin/ton-wallet-api server \ - --config /etc/${cfg.configdir}/config.yaml \ - --global-config /etc/${cfg.configdir}/ton-global.config.json + ${cfg.package}/bin/tycho-wallet-api server \ + --config /etc/${cfg.configdir}/config.json \ + --global-config /etc/${cfg.configdir}/global-config.json \ + --keys /etc/${cfg.configdir}/keys.json ''; serviceConfig = { Restart = "always"; RestartSec = 30; - User = "ever-wallet-api"; + User = "tycho-wallet-api"; WorkingDirectory = "${cfg.datadir}"; }; wantedBy = ["multi-user.target"]; @@ -295,18 +296,18 @@ in { } ]; }; - # Init folder for ever-wallet-api data + # Init folder for tycho-wallet-api data system.activationScripts = { - intever-wallet-api = { + inttycho-wallet-api = { text = '' if [ ! -d "${cfg.datadir}" ]; then mkdir -p ${cfg.datadir} - chown ever-wallet-api ${cfg.datadir} + chown tycho-wallet-api ${cfg.datadir} fi if [ ! -d "${cfg.configdir}" ]; then mkdir -p ${cfg.configdir} fi - chown ton-wallet-api ${cfg.configdir} + chown tycho-wallet-api ${cfg.configdir} DB_PASSWORD=$(cat ${cfg.dbPasswordFile} | xargs echo -n) DATABASE_URL="postgresql://${cfg.dbUser}:''${DB_PASSWORD}@${cfg.dbHost}/${cfg.dbDatabase}" diff --git a/nix/overlay.nix b/nix/overlay.nix index 36b9e49..c839b01 100644 --- a/nix/overlay.nix +++ b/nix/overlay.nix @@ -1,8 +1,8 @@ self: super: { -# ever-wallet-api = import (builtins.fetchGit { -# url = "git@github.com:NCrashed/ever-wallet-api.git"; +# tycho-wallet-api = import (builtins.fetchGit { +# url = "git@github.com:NCrashed/tycho-wallet-api.git"; # ref = "master"; # rev = "6a78807b10aaa622883dd0ef61acc60edcd4a23b"; # }); - ever-wallet-api = import ../default.nix; + tycho-wallet-api = import ../default.nix; } \ No newline at end of file diff --git a/packer/gcp/build.sh b/packer/gcp/build.sh index 70d61a2..9fc05e5 100644 --- a/packer/gcp/build.sh +++ b/packer/gcp/build.sh @@ -7,17 +7,17 @@ echo "INFO: copy binaries..." wget -q https://storage.googleapis.com/broxus-infrastructure/sqlx -O /usr/local/bin/sqlx chmod +x /usr/local/bin/sqlx -cd /tmp/build/ton-wallet-api +cd /tmp/build/tycho-wallet-api curl -sSO https://dl.google.com/cloudagents/add-google-cloud-ops-agent-repo.sh sudo bash add-google-cloud-ops-agent-repo.sh --also-install -mkdir -p /opt/ton/ton-wallet-api -mkdir -p /var/ton/ton-wallet-api +mkdir -p /opt/ton/tycho-wallet-api +mkdir -p /var/ton/tycho-wallet-api -cp -r /tmp/build/ton-wallet-api/scripts/* /opt/ton/ton-wallet-api -chmod +x /opt/ton/ton-wallet-api/* +cp -r /tmp/build/tycho-wallet-api/scripts/* /opt/ton/tycho-wallet-api +chmod +x /opt/ton/tycho-wallet-api/* -rm -rf /tmp/build/ton-wallet-api +rm -rf /tmp/build/tycho-wallet-api echo "INFO: create user..." @@ -28,9 +28,9 @@ chown ton:ton -R /opt/ton echo "INFO: create service..." -cat > "/etc/systemd/system/ton-wallet-api.service" << EOL +cat > "/etc/systemd/system/tycho-wallet-api.service" << EOL [Unit] -Description=ton-wallet-api +Description=tycho-wallet-api After=network.target StartLimitIntervalSec=0 @@ -40,18 +40,18 @@ Group=ton Type=simple Restart=always RestartSec=60 -WorkingDirectory=/opt/ton/ton-wallet-api +WorkingDirectory=/opt/ton/tycho-wallet-api ExecStart=bash ./run.sh [Install] WantedBy=multi-user.target EOL -systemctl enable ton-wallet-api +systemctl enable tycho-wallet-api -cat > "/etc/systemd/system/ton-wallet-api-updater.service" << EOL +cat > "/etc/systemd/system/tycho-wallet-api-updater.service" << EOL [Unit] -Description=ton-wallet-api-updater +Description=tycho-wallet-api-updater After=network.target StartLimitIntervalSec=0 @@ -59,29 +59,29 @@ StartLimitIntervalSec=0 Type=simple Restart=always RestartSec=60 -WorkingDirectory=/opt/ton/ton-wallet-api +WorkingDirectory=/opt/ton/tycho-wallet-api ExecStart=bash ./updater.sh [Install] WantedBy=multi-user.target EOL -systemctl enable ton-wallet-api-updater +systemctl enable tycho-wallet-api-updater -cat > "/etc/systemd/system/ton-wallet-api-create-fs.service" << EOL +cat > "/etc/systemd/system/tycho-wallet-api-create-fs.service" << EOL [Unit] -Description=ton-wallet-api-create-fs +Description=tycho-wallet-api-create-fs Requires=local-fs.target After=local-fs.target StartLimitIntervalSec=0 [Service] Type=oneshot -WorkingDirectory=/opt/ton/ton-wallet-api +WorkingDirectory=/opt/ton/tycho-wallet-api ExecStart=bash ./create-fs.sh [Install] WantedBy=multi-user.target EOL -systemctl enable ton-wallet-api-create-fs +systemctl enable tycho-wallet-api-create-fs diff --git a/packer/gcp/image.json b/packer/gcp/image.json index 73dcf71..93986ea 100644 --- a/packer/gcp/image.json +++ b/packer/gcp/image.json @@ -8,8 +8,8 @@ "project_id": "{{user `gcp_project_id`}}", "source_image_family": "ubuntu-2004-lts", "zone": "{{user `gcp_zone`}}", - "image_family": "ton-wallet-api", - "image_name": "ton-wallet-api-{{isotime \"20060102t030405\"}}", + "image_family": "tycho-wallet-api", + "image_name": "tycho-wallet-api-{{isotime \"20060102t030405\"}}", "preemptible": true, "ssh_username": "packer", "disk_size": "50", @@ -20,7 +20,7 @@ { "type": "shell", "inline": [ - "mkdir -p /tmp/build/ton-wallet-api" + "mkdir -p /tmp/build/tycho-wallet-api" ], "inline_shebang": "/bin/bash -e" }, @@ -28,12 +28,12 @@ { "type": "file", "source": "build.sh", - "destination": "/tmp/build/ton-wallet-api/build.sh" + "destination": "/tmp/build/tycho-wallet-api/build.sh" }, { "type": "file", "source": "scripts", - "destination": "/tmp/build/ton-wallet-api" + "destination": "/tmp/build/tycho-wallet-api" }, { @@ -44,7 +44,7 @@ { "type": "shell", "inline": [ - "sudo /tmp/build/ton-wallet-api/build.sh" + "sudo /tmp/build/tycho-wallet-api/build.sh" ] } ] diff --git a/packer/gcp/scripts/create-fs.sh b/packer/gcp/scripts/create-fs.sh index 9989b08..b8153d5 100644 --- a/packer/gcp/scripts/create-fs.sh +++ b/packer/gcp/scripts/create-fs.sh @@ -6,15 +6,15 @@ echo "INFO: check file system..." sleep 60; -if ! test -f /var/ton/ton-wallet-api/data/ready; then +if ! test -f /var/ton/tycho-wallet-api/data/ready; then echo "INFO: create raid..." mdadm --create --verbose /dev/md0 --level=0 --raid-devices=4 /dev/nvme0n1 /dev/nvme0n2 /dev/nvme0n3 /dev/nvme0n4 mkfs.ext4 -F /dev/md0 - mount /dev/md0 /var/ton/ton-wallet-api - mkdir /var/ton/ton-wallet-api/data - touch /var/ton/ton-wallet-api/data/ready - chown -R ton:ton /var/ton/ton-wallet-api/data - echo '/dev/md0 /var/ton/ton-wallet-api ext4 defaults,nofail,discard 0 0' | tee -a /etc/fstab + mount /dev/md0 /var/ton/tycho-wallet-api + mkdir /var/ton/tycho-wallet-api/data + touch /var/ton/tycho-wallet-api/data/ready + chown -R ton:ton /var/ton/tycho-wallet-api/data + echo '/dev/md0 /var/ton/tycho-wallet-api ext4 defaults,nofail,discard 0 0' | tee -a /etc/fstab fi echo "INFO: file system is ready now" diff --git a/packer/gcp/scripts/run.sh b/packer/gcp/scripts/run.sh index 68f7761..d22ec8d 100644 --- a/packer/gcp/scripts/run.sh +++ b/packer/gcp/scripts/run.sh @@ -2,7 +2,7 @@ set -e -while true; do echo 'Waiting file system bean ready...'; if test -f /var/ton/ton-wallet-api/data/ready; then break; fi; sleep 5; done; echo 'File system is ready now'; +while true; do echo 'Waiting file system bean ready...'; if test -f /var/ton/tycho-wallet-api/data/ready; then break; fi; sleep 5; done; echo 'File system is ready now'; SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P) . "${SCRIPT_DIR}/env.sh" @@ -13,6 +13,6 @@ cd app sqlx migrate run cd .. -echo "INFO: start ton-wallet-api server..." +echo "INFO: start tycho-wallet-api server..." -app/ton-wallet-api server --config app/config/config.yaml --global-config app/config/ton-global.config.json +app/tycho-wallet-api server --config app/config/config.json --global-config app/config/global-config.json --keys app/config/keys.json diff --git a/packer/gcp/scripts/updater.sh b/packer/gcp/scripts/updater.sh index 2c520f8..23982d6 100644 --- a/packer/gcp/scripts/updater.sh +++ b/packer/gcp/scripts/updater.sh @@ -3,7 +3,7 @@ set -e SERVICE_DIR=app -SERVICE=ton-wallet-api +SERVICE=tycho-wallet-api USER=ton GROUP=ton diff --git a/rust-toolchain.toml b/rust-toolchain.toml deleted file mode 100644 index 371758d..0000000 --- a/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "1.78.0" \ No newline at end of file diff --git a/scripts/api_service.sh b/scripts/api_service.sh index d64d0bb..2565101 100755 --- a/scripts/api_service.sh +++ b/scripts/api_service.sh @@ -8,7 +8,7 @@ function print_help() { echo ' -h,--help Print this help message and exit' echo ' -t,--type TYPE Installation type: native' echo ' --database-url Postgres connection url which is needed to create' - echo ' database and make migration before running ton-wallet-api.' + echo ' database and make migration before running tycho-wallet-api.' echo ' example: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}"' echo ' --id Service id (UUID)' echo ' --name Service name' @@ -97,11 +97,11 @@ while [[ $# -gt 0 ]]; do done if [[ "$setup_type" == "native" ]]; then - ton_wallet_api_binary="/usr/local/bin/ton-wallet-api api_service" + tycho_wallet_api_binary="/usr/local/bin/tycho-wallet-api api_service" else echo 'ERROR: Unexpected' exit 1 fi echo "Exporting keys from $path" -sudo -E bash -c "DATABASE_URL=$database_url $ton_wallet_api_binary --id $service_id --name $service_name --key $service_key --secret $service_secret" +sudo -E bash -c "DATABASE_URL=$database_url $tycho_wallet_api_binary --id $service_id --name $service_name --key $service_key --secret $service_secret" diff --git a/scripts/contrib/config.yaml b/scripts/contrib/config.yaml index 2f04090..f201b18 100644 --- a/scripts/contrib/config.yaml +++ b/scripts/contrib/config.yaml @@ -6,14 +6,14 @@ database_url: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}" # Database connections db_pool_size: 5 ton_core: - # Root directory for ton-wallet-api DB. Default: "./db" - db_path: "/var/db/ton-wallet-api" + # Root directory for tycho-wallet-api DB. Default: "./db" + db_path: "/var/db/tycho-wallet-api" # UDP port, used for ADNL node. Default: 30303 adnl_port: 30000 # Path to temporary ADNL keys. # NOTE: Will be generated if it was not there. # Default: "./adnl-keys.json" - keys_path: "/etc/ton-wallet-api/adnl-keys.json" + keys_path: "/etc/tycho-wallet-api/adnl-keys.json" node_metrics_settings: # Listen address of metrics. Used by the client to gather prometheus metrics. # Default: "127.0.0.1:10000" @@ -36,7 +36,7 @@ logger_settings: appenders: - stdout loggers: - ton_wallet_api: + tycho_wallet_api: level: info appenders: - stdout diff --git a/scripts/contrib/ton-wallet-api.native.service b/scripts/contrib/ton-wallet-api.native.service deleted file mode 100644 index f1ebc82..0000000 --- a/scripts/contrib/ton-wallet-api.native.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=ton-wallet-api -After=network.target -StartLimitIntervalSec=0 - -[Service] -Type=simple -Restart=no -WorkingDirectory=/etc/ton-wallet-api -ExecStart=/usr/local/bin/ton-wallet-api server --config /etc/ton-wallet-api/config.yaml --global-config /etc/ton-wallet-api/ton-global.config.json - -[Install] -WantedBy=multi-user.target diff --git a/scripts/contrib/tycho-wallet-api.native.service b/scripts/contrib/tycho-wallet-api.native.service new file mode 100644 index 0000000..e56693d --- /dev/null +++ b/scripts/contrib/tycho-wallet-api.native.service @@ -0,0 +1,13 @@ +[Unit] +Description=tycho-wallet-api +After=network.target +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=no +WorkingDirectory=/etc/tycho-wallet-api +ExecStart=/usr/local/bin/tycho-wallet-api server --config /etc/tycho-wallet-api/config.json --global-config /etc/tycho-wallet-api/global-config.json --keys /etc/tycho-wallet-api/keys.json + +[Install] +WantedBy=multi-user.target diff --git a/scripts/root_token.sh b/scripts/root_token.sh index eaa8304..b0e1353 100755 --- a/scripts/root_token.sh +++ b/scripts/root_token.sh @@ -8,7 +8,7 @@ function print_help() { echo ' -h,--help Print this help message and exit' echo ' -t,--type TYPE Installation type: native' echo ' --database-url Postgres connection url which is needed to create' - echo ' database and make migration before running ton-wallet-api.' + echo ' database and make migration before running tycho-wallet-api.' echo ' example: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}"' echo ' --name Token name (ticker)' echo ' --address Token address' @@ -85,7 +85,7 @@ while [[ $# -gt 0 ]]; do done if [[ "$setup_type" == "native" ]]; then - ton_wallet_api_binary="/usr/local/bin/ton-wallet-api root_token" + tycho_wallet_api_binary="/usr/local/bin/tycho-wallet-api root_token" else echo 'ERROR: Unexpected' exit 1 @@ -96,4 +96,4 @@ if [[ $version != "Tip3" ]] && [[ $version != "OldTip3v4" ]]; then exit 1 fi -sudo -E bash -c "DATABASE_URL=$database_url $ton_wallet_api_binary --name $token_name --address $token_address --version $version" +sudo -E bash -c "DATABASE_URL=$database_url $tycho_wallet_api_binary --name $token_name --address $token_address --version $version" diff --git a/scripts/setup.sh b/scripts/setup.sh index 451a583..82eada4 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -11,10 +11,10 @@ function print_help() { echo ' -h,--help Print this help message and exit' echo ' -t,--type TYPE Installation types: native' echo ' -n,--network One of two networks:' - echo ' - Everscale' - echo ' - Venom' + echo ' - Testnet' + echo ' - Production' echo ' --database-url Postgres connection url which is needed to create' - echo ' database and make migration before running ton-wallet-api.' + echo ' database and make migration before running tycho-wallet-api.' echo ' example: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}"' } @@ -74,15 +74,15 @@ if [[ "$setup_type" != "native" ]]; then exit 1 fi -if [[ "$network" != "Everscale" ]] && [[ "$network" != "Venom" ]]; then +if [[ "$network" != "Testnet" ]] && [[ "$network" != "Production" ]]; then echo 'ERROR: Unknown network' echo '' print_help exit 1 fi -service_path="/etc/systemd/system/ton-wallet-api.service" -config_path="/etc/ton-wallet-api/config.yaml" +service_path="/etc/systemd/system/tycho-wallet-api.service" +config_path="/etc/tycho-wallet-api/config.json" if [[ "$setup_type" == "native" ]]; then echo 'INFO: Running native installation' @@ -98,24 +98,24 @@ if [[ "$setup_type" == "native" ]]; then echo 'INFO: installing sqlx-cli' cargo install sqlx-cli - echo 'INFO: building ton-wallet-api' + echo 'INFO: building tycho-wallet-api' cd "$REPO_DIR" - if [[ "$network" == "Everscale" ]]; then + if [[ "$network" == "Testnet" ]]; then + RUSTFLAGS="-C target_cpu=native" SQLX_OFFLINE=true cargo build --release + elif [[ "$network" == "Production" ]]; then RUSTFLAGS="-C target_cpu=native" SQLX_OFFLINE=true cargo build --release - elif [[ "$network" == "Venom" ]]; then - RUSTFLAGS="-C target_cpu=native" SQLX_OFFLINE=true cargo build --release --features venom else echo 'ERROR: Unexpected' exit 1 fi - sudo cp "$REPO_DIR/target/release/ton-wallet-api" /usr/local/bin/ton-wallet-api + sudo cp "$REPO_DIR/target/release/tycho-wallet-api" /usr/local/bin/tycho-wallet-api echo 'INFO: creating systemd service' if [[ -f "$service_path" ]]; then echo "WARN: $service_path already exists" else - sudo cp "$SCRIPT_DIR/contrib/ton-wallet-api.native.service" "$service_path" + sudo cp "$SCRIPT_DIR/contrib/tycho-wallet-api.native.service" "$service_path" fi else @@ -124,15 +124,15 @@ else fi echo "INFO: preparing environment" -sudo mkdir -p /etc/ton-wallet-api -sudo mkdir -p /var/db/ton-wallet-api +sudo mkdir -p /etc/tycho-wallet-api +sudo mkdir -p /var/db/tycho-wallet-api if [[ -f "$config_path" ]]; then echo "WARN: $config_path already exists" else - sudo cp -n "$SCRIPT_DIR/contrib/config.yaml" "$config_path" + sudo cp -n "$SCRIPT_DIR/contrib/config.json" "$config_path" fi -sudo curl -so /etc/ton-wallet-api/ton-global.config.json \ - https://raw.githubusercontent.com/tonlabs/main.ton.dev/master/configs/ton-global.config.json +sudo curl -so /etc/tycho-wallet-api/global-config.json \ + https://testnet.tychoprotocol.com/global-config.json echo 'INFO: restarting timesyncd' sudo systemctl restart systemd-timesyncd.service @@ -145,11 +145,11 @@ cargo sqlx migrate run --database-url "$database_url" echo 'INFO: done' echo '' -echo 'INFO: Systemd service: ton-wallet-api' -echo ' Keys and configs: /etc/ton-wallet-api' -echo ' Node DB and stuff: /var/db/ton-wallet-api' +echo 'INFO: Systemd service: tycho-wallet-api' +echo ' Keys and configs: /etc/tycho-wallet-api' +echo ' Node DB and stuff: /var/db/tycho-wallet-api' echo '' -echo 'NOTE: replace all "${..}" variables in /etc/ton-wallet-api/config.yaml' -echo ' or specify them in /etc/systemd/system/ton-wallet-api.service' +echo 'NOTE: replace all "${..}" variables in /etc/tycho-wallet-api/config.json' +echo ' or specify them in /etc/systemd/system/tycho-wallet-api.service' echo ' in "[Service]" section with something like this:' echo ' Environment=SECRET=secret' diff --git a/scripts/update.sh b/scripts/update.sh index 3d2f22b..ac3db1b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -9,14 +9,14 @@ function print_help() { echo '' echo 'Options:' echo ' -h,--help Print this help message and exit' - echo ' -f,--force Clear "/var/db/ton-wallet-api" on update' + echo ' -f,--force Clear "/var/db/tycho-wallet-api" on update' echo ' -s,--sync Restart "timesyncd" service' echo ' -t,--type TYPE Installation types: native' echo ' -n,--network One of two networks:' - echo ' - Everscale' - echo ' - Venom' + echo ' - Testnet' + echo ' - Production' echo ' --database-url Postgres connection url which is needed to create' - echo ' database and make migration before running ton-wallet-api.' + echo ' database and make migration before running tycho-wallet-api.' echo ' example: "postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}"' } @@ -86,21 +86,21 @@ if [[ "$setup_type" != "native" ]]; then exit 1 fi -if [[ "$network" != "Everscale" ]] && [[ "$network" != "Venom" ]]; then +if [[ "$network" != "Testnet" ]] && [[ "$network" != "Production" ]]; then echo 'ERROR: Unknown network' echo '' print_help exit 1 fi -echo "INFO: stopping ton-wallet-api service" -sudo systemctl stop ton-wallet-api +echo "INFO: stopping tycho-wallet-api service" +sudo systemctl stop tycho-wallet-api if [[ "$force" == "true" ]]; then - echo "INFO: removing ton-wallet-api db" - sudo rm -rf /var/db/ton-wallet-api + echo "INFO: removing tycho-wallet-api db" + sudo rm -rf /var/db/tycho-wallet-api else - echo 'INFO: skipping "/var/db/ton-wallet-api" deletion' + echo 'INFO: skipping "/var/db/tycho-wallet-api" deletion' fi if [[ "$setup_type" == "native" ]]; then @@ -108,17 +108,17 @@ if [[ "$setup_type" == "native" ]]; then source "$HOME/.cargo/env" - echo 'INFO: building ton-wallet-api' + echo 'INFO: building tycho-wallet-api' cd "$REPO_DIR" - if [[ "$network" == "Everscale" ]]; then + if [[ "$network" == "Testnet" ]]; then + RUSTFLAGS="-C target_cpu=native" cargo build --release + elif [[ "$network" == "Production" ]]; then RUSTFLAGS="-C target_cpu=native" cargo build --release - elif [[ "$network" == "Venom" ]]; then - RUSTFLAGS="-C target_cpu=native" cargo build --release --features venom else echo 'ERROR: Unexpected' exit 1 fi - sudo cp "$REPO_DIR/target/release/ton-wallet-api" /usr/local/bin/ton-wallet-api + sudo cp "$REPO_DIR/target/release/tycho-wallet-api" /usr/local/bin/tycho-wallet-api else echo 'ERROR: Unexpected' @@ -126,7 +126,7 @@ else fi echo "INFO: preparing environment" -sudo mkdir -p /var/db/ton-wallet-api +sudo mkdir -p /var/db/tycho-wallet-api if [[ "$restart_timesyncd" == "true" ]]; then echo 'INFO: restarting timesyncd' @@ -136,12 +136,12 @@ fi echo 'INFO: apply database migration' cargo sqlx migrate run --database-url "$database_url" -echo 'INFO: restarting ton-wallet-api service' -sudo systemctl restart ton-wallet-api +echo 'INFO: restarting tycho-wallet-api service' +sudo systemctl restart tycho-wallet-api echo 'INFO: done' echo '' -echo 'INFO: Systemd service: ton-wallet-api' -echo ' Keys and configs: /etc/ton-wallet-api' -echo ' Node DB and stuff: /var/db/ton-wallet-api' +echo 'INFO: Systemd service: tycho-wallet-api' +echo ' Keys and configs: /etc/tycho-wallet-api' +echo ' Node DB and stuff: /var/db/tycho-wallet-api' echo '' diff --git a/shell.nix b/shell.nix index 7bd9ec6..97ef1e2 100644 --- a/shell.nix +++ b/shell.nix @@ -5,7 +5,7 @@ let libclang = pkgs.llvmPackages_14.libclang; stdenv = pkgs.stdenv; in stdenv.mkDerivation rec { - name = "ever-wallet-api"; + name = "tycho-wallet-api"; env = buildEnv { name = name; paths = buildInputs; }; buildInputs = [ diff --git a/src/api/controllers/address.rs b/src/api/controllers/address.rs index 8814982..5e3c068 100644 --- a/src/api/controllers/address.rs +++ b/src/api/controllers/address.rs @@ -1,5 +1,5 @@ -use axum::extract::Path; -use axum::{Extension, Json}; +use axum::extract::{Path, State}; +use axum::Json; use tokio::time::Instant; use metrics::{histogram, increment_counter}; @@ -11,9 +11,9 @@ use crate::api::*; use crate::models::*; pub async fn post_address_create( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -31,8 +31,8 @@ pub async fn post_address_create( } pub async fn post_address_check( + State(ctx): State, Json(req): Json, - Extension(ctx): Extension>, ) -> Result> { let address = ctx .ton_service @@ -45,7 +45,7 @@ pub async fn post_address_check( pub async fn get_address_balance( Path(address): Path
, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let address = ctx @@ -59,7 +59,7 @@ pub async fn get_address_balance( pub async fn get_address_info( Path(address): Path
, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let address = ctx @@ -73,7 +73,7 @@ pub async fn get_address_info( pub async fn get_token_address_balance( Path(address): Path
, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let addresses = ctx @@ -88,3 +88,12 @@ pub async fn get_token_address_balance( Ok(Json(TokenBalanceResponse::from(addresses))) } + +pub async fn post_address_subscription( + State(ctx): State, + Json(req): Json, +) -> Result> { + let result = ctx.ton_service.add_account_subscription(req.address).await; + + Ok(Json(AddAccountSubscriptionResponse::from(result))) +} diff --git a/src/api/controllers/authorization.rs b/src/api/controllers/authorization.rs index de8f74c..288c470 100644 --- a/src/api/controllers/authorization.rs +++ b/src/api/controllers/authorization.rs @@ -1,32 +1,40 @@ use std::sync::Arc; +use aide::{OperationInput, OperationOutput}; use axum::async_trait; -use axum::body::{boxed, Body, Full}; -use axum::extract::{FromRequest, OriginalUri, RequestParts}; +use axum::body::Body; +use axum::extract::{FromRequest, FromRequestParts, OriginalUri}; +use axum::http::request::Parts; use axum::http::Request; +use axum::http::{Method, StatusCode}; use axum::middleware::Next; use axum::response::IntoResponse; -use http::{Method, StatusCode}; +use schemars::JsonSchema; +use crate::api::int_schema; use crate::models::*; use crate::services::*; pub async fn verify_auth( req: Request, - next: Next, + next: Next, auth_service: Arc, ) -> impl IntoResponse { match check_api_key(req, auth_service).await { Ok(req) => next.run(req).await, Err(err) => { - log::error!("Failed to check auth. Err: {:?}", &err); - Rejection("Failed to authorize".to_string(), StatusCode::UNAUTHORIZED).into_response() + tracing::error!("Failed to check auth. Err: {:?}", &err); + Rejection { + reason: "Failed to authorize".to_string(), + status_code: StatusCode::UNAUTHORIZED, + } + .into_response() } } } async fn check_api_key( - req: Request, + mut req: Request, auth_service: Arc, ) -> anyhow::Result> { let api_key_opt = req.headers().get("api-key"); @@ -70,22 +78,12 @@ async fn check_api_key( let method = req.method().clone(); - let mut parts = RequestParts::new(req); - let body = match method { Method::GET => String::new(), _ => { - let body = parts.take_body(); - - let bytes = match body { - Some(b) => hyper::body::to_bytes(b).await?, - None => anyhow::bail!("Request body is empty"), - }; - parts.body_mut().replace(hyper::Body::from(bytes.clone())); - - let new_body = boxed(Full::from(bytes.clone())); - let body_bytes = hyper::body::to_bytes(new_body).await?; - + let (parts, body) = req.into_parts(); + let body_bytes = axum::body::to_bytes(body, 100000).await?; + req = Request::from_parts(parts, Body::from(body_bytes.to_vec())); String::from_utf8(body_bytes.to_vec())? } }; @@ -95,38 +93,53 @@ async fn check_api_key( .await?; // Forward service id to request handler - parts.extensions_mut().insert(IdExtractor(service_id)); + req.extensions_mut().insert(IdExtractor(service_id)); - Ok(Request::from_request(&mut parts).await.expect("can't fail")) + Ok(Request::from_request(req, &auth_service) + .await + .expect("can't fail")) } +#[derive(Debug, Clone)] pub struct IdExtractor(pub ServiceId); #[async_trait] -impl FromRequest for IdExtractor +impl FromRequestParts for IdExtractor where - B: Send, // required by `async_trait` + S: Send + Sync, { type Rejection = Rejection; - async fn from_request(req: &mut RequestParts) -> Result { - let extensions = req.extensions(); - - let id: Option<&IdExtractor> = extensions.get(); + async fn from_request_parts( + parts: &mut Parts, + _state: &S, + ) -> Result { + let id: Option<&IdExtractor> = parts.extensions.get(); match id { Some(service_id) => Ok(IdExtractor(service_id.0)), - None => Err(Rejection( - "Service id not found".to_string(), - StatusCode::UNAUTHORIZED, - )), + None => Err(Rejection { + reason: "Service id not found".to_string(), + status_code: StatusCode::UNAUTHORIZED, + }), } } } -pub struct Rejection(String, StatusCode); +#[derive(Debug, Clone, JsonSchema)] +pub struct Rejection { + pub reason: String, + #[schemars(schema_with = "int_schema")] + pub status_code: StatusCode, +} impl IntoResponse for Rejection { fn into_response(self) -> axum::response::Response { - (self.1, self.0).into_response() + (self.status_code, self.reason).into_response() } } + +impl OperationOutput for Rejection { + type Inner = Self; +} + +impl OperationInput for IdExtractor {} diff --git a/src/api/controllers/blockchain.rs b/src/api/controllers/blockchain.rs index a8220dc..672faf7 100644 --- a/src/api/controllers/blockchain.rs +++ b/src/api/controllers/blockchain.rs @@ -1,10 +1,11 @@ -use axum::{Extension, Json}; +use axum::extract::State; +use axum::Json; use crate::api::responses::*; use crate::api::*; pub async fn get_blockchain_info( - Extension(ctx): Extension>, + State(ctx): State, ) -> Result> { let info = ctx.ton_service.get_blockchain_info().await?; diff --git a/src/api/controllers/docs.rs b/src/api/controllers/docs.rs deleted file mode 100644 index a8c38c2..0000000 --- a/src/api/controllers/docs.rs +++ /dev/null @@ -1,826 +0,0 @@ -#![allow(clippy::needless_update)] - -use nekoton_utils::TrustMe; -use opg::*; - -use crate::api::requests; -use crate::api::responses; - -use crate::models::*; - -pub fn swagger(prod_url: &str) -> String { - let api = describe_api! { - info: { - title: "Everscale API", - version: "4.0.0", - description: r##"Everscale Wallet API Specification"##, - }, - servers: { - prod_url - }, - tags: { - address, - events, - tokens, - misc, - metrics, - blockchain, - }, - paths: { - ("address" / "check"): { - POST: { - tags: { address }, - summary: "Check address", - description: "Check correction of EVER address.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::AddressCheckRequest, - 200: responses::CheckedAddressResponse, - } - }, - ("address" / "create"): { - POST: { - tags: { address }, - summary: "Address creation", - description: "Create user address.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::CreateAddressRequest, - 200: responses::AddressResponse, - } - }, - ("address" / { address: String }): { - GET: { - tags: { address }, - summary: "Address balance", - description: "Get address balance.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::AddressBalanceResponse, - } - }, - ("address" / { address: String } / "info"): { - GET: { - tags: { address }, - summary: "Address info", - description: "Get address info.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::AddressInfoResponse, - } - }, - ("transactions"): { - POST: { - tags: { transactions }, - summary: "Search transactions", - description: "Search transactions.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTransactionsRequest, - 200: responses::TonTransactionsResponse, - } - }, - ("transactions" / "create"): { - POST: { - tags: { transactions }, - summary: "Create transaction", - description: "Send transaction.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTransactionSendRequest, - 200: responses::TransactionResponse, - callbacks: { - transactionSent: { - ("callbackUrl"): { - POST: { - description: "Event transaction sent. If address are not \ - deployed the event will be sent a twice since in this case \ - will be created two transactions.", - parameters: { - (header "timestamp"), - (header "sign") - }, - body: AccountTransactionEvent, - 200: None, - } - } - } - } - } - }, - ("transactions" / "confirm"): { - POST: { - tags: { transactions }, - summary: "Create confirm transaction", - description: "Confirm transaction.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTransactionConfirmRequest, - 200: responses::TransactionResponse, - callbacks: { - transactionSent: { - ("callbackUrl"): { - POST: { - description: "Event transaction sent. If address are not \ - deployed the event will be sent a twice since in this case \ - will be created two transactions.", - parameters: { - (header "timestamp"), - (header "sign") - }, - body: AccountTransactionEvent, - 200: None, - } - } - } - } - } - }, - ("transactions" / "id" / { id: String }): { - GET: { - tags: { transactions }, - summary: "Get transaction", - description: "Get transaction by internal id (uuid).", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TransactionResponse, - } - }, - ("transactions" / "h" / { transaction_hash: String }): { - GET: { - tags: { transactions }, - summary: "Get transaction", - description: "Get transaction by transaction hash.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TransactionResponse, - } - }, - ("transactions" / "mh" / { message_hash: String }): { - GET: { - tags: { transactions }, - summary: "Get transaction", - description: "Get transaction by message hash.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TransactionResponse, - } - }, - ("events" / "id" / { id: String }): { - GET: { - tags: { events }, - summary: "Get event", - description: "Get event by id.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TransactionEventResponse, - } - }, - ("events" ): { - POST: { - tags: { events }, - summary: "Get events", - description: "Get events.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTransactionEventsRequest, - 200: responses::TonEventsResponse, - } - }, - ("events" / "mark" ): { - POST: { - tags: { events }, - summary: "Mark event", - description: "Mark event by id.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonMarkEventsRequest, - 200: responses::MarkEventsResponse, - } - }, - ("events" / "mark" / "all" ): { - POST: { - tags: { events }, - summary: "Mark events", - description: "Mark events by status optional.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::MarkAllTransactionEventRequest, - 200: responses::MarkEventsResponse, - } - }, - ("tokens" / "address" / { address: String }): { - GET: { - tags: { address, tokens }, - summary: "Address tokens balances", - description: "Get address tokens balances.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TokenBalanceResponse, - } - }, - ("tokens" / "events" ): { - POST: { - tags: { events, tokens }, - summary: "Get token events", - description: "Get token events.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTokenTransactionEventsRequest, - 200: responses::TonTokenEventsResponse, - } - }, - ("tokens" / "events" / "mark" ): { - POST: { - tags: { events, tokens }, - summary: "Mark tokens event", - description: "Mark tokens event by id.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTokenMarkEventsRequest, - 200: responses::MarkTokenEventsResponse, - } - }, - ("tokens" / "transactions" / "mh" / { message_hash: String }): { - GET: { - tags: { transactions, tokens }, - summary: "Get tokens transaction", - description: "Get tokens transaction by message hash.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TokenTransactionResponse, - } - }, - ("tokens" / "transactions" / "id" / { id: String }): { - GET: { - tags: { transactions, tokens }, - summary: "Get tokens transaction", - description: "Get tokens transaction by id.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TokenTransactionResponse, - } - }, - ("tokens" / "transactions" / "create"): { - POST: { - tags: { transactions, tokens }, - summary: "Create token transaction", - description: "Send token transaction.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTokenTransactionSendRequest, - 200: responses::TokenTransactionResponse, - callbacks: { - tokenTransactionSent: { - ("callbackUrl"): { - POST: { - description: "Event token transaction sent. If address are not \ - deployed the event will be sent a twice since in this case \ - will be created two transactions.", - parameters: { - (header "timestamp"), - (header "sign") - }, - body: AccountTransactionEvent, - 200: None, - } - } - } - } - } - }, - ("tokens" / "transactions" / "burn"): { - POST: { - tags: { transactions, tokens }, - summary: "Burn token transaction", - description: "Burn token transaction.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTokenTransactionBurnRequest, - 200: responses::TokenTransactionResponse, - callbacks: { - tokenTransactionSent: { - ("callbackUrl"): { - POST: { - description: "Event token transaction burn.", - parameters: { - (header "timestamp"), - (header "sign") - }, - body: AccountTransactionEvent, - 200: None, - } - } - } - } - } - }, - ("tokens" / "transactions" / "mint"): { - POST: { - tags: { transactions, tokens }, - summary: "Mint token transaction", - description: "Mint token transaction.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::TonTokenTransactionMintRequest, - 200: responses::TokenTransactionResponse, - callbacks: { - tokenTransactionSent: { - ("callbackUrl"): { - POST: { - description: "Event token transaction mint.", - parameters: { - (header "timestamp"), - (header "sign") - }, - body: AccountTransactionEvent, - 200: None, - } - } - } - } - } - }, - ("tokens" / "whitelist"): { - GET: { - tags: { tokens }, - summary: "Get list of allowed non-native tokens", - description: "It provides tokenRoots of TIP3 tokens which may be accepted by wallets.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::TokenWhitelistResponse, - } - }, - ("read-contract"): { - POST: { - tags: { misc }, - summary: "Read contract data", - description: "Execute function of generic contract", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::ExecuteContractRequest, - 200: responses::ReadContractResponse, - } - }, - ("encode-into-cell"): { - POST: { - tags: { misc }, - summary: "Encode tvm cell", - description: "Create cell from custom tokens and get base64 cell representation", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::EncodeParamRequest, - 200: responses::EncodedCellResponse, - } - }, - ("prepare-message"): { - POST: { - tags: { misc }, - summary: "Prepare message from params", - description: "Prepare unsigned message from specified tokens", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::PrepareMessageRequest, - 200: responses::UnsignedMessageHashResponse, - } - }, - ("send-signed-message"): { - POST: { - tags: { misc }, - summary: "Send signed message", - description: "Seng signed message", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::SignedMessageRequest, - 200: responses::TransactionResponse, - } - }, - ("send-message"): { - POST: { - tags: { misc }, - summary: "Prepare and send message from params", - description: "Prepare unsigned message from specified tokens, sign and send it", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::SendMessageRequest, - 200: responses::SignedMessageHashResponse, - } - }, - ("callback"): { - POST: { - tags: { misc }, - summary: "Set service callback endpoint", - description: "Provides Everwallet API with webhook to call on each network event", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - body: requests::SetCallbackRequest, - 200: responses::SetCallbackResponse, - } - }, - ("metrics"): { - GET: { - tags: { metrics }, - summary: "Get metrics", - description: "Get metrics of api health.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::MetricsResponse, - } - }, - ("blockchain"): { - GET: { - tags: { blockchain }, - summary: "Get network status of the Wallet API node", - description: "Provides blockchain-related information and node syncronization status.", - parameters: { - (header "api-key"): { - description: "API Key", - }, - (header "sign"): { - description: "Signature", - }, - (header "timestamp"): { - description: "Timestamp in ms", - }, - (header "x-real-ip"): { - required: false - }, - }, - 200: responses::BlockchainInfoResponse, - } - }, - } - }; - - serde_yaml::to_string(&api).trust_me() -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn generate_docs() { - println!("{}", swagger("prod_url")); - } -} diff --git a/src/api/controllers/events.rs b/src/api/controllers/events.rs index 473e4c8..2934639 100644 --- a/src/api/controllers/events.rs +++ b/src/api/controllers/events.rs @@ -1,5 +1,5 @@ -use axum::extract::Path; -use axum::{Extension, Json}; +use axum::extract::{Path, State}; +use axum::Json; use uuid::Uuid; use crate::api::controllers::*; @@ -9,9 +9,9 @@ use crate::api::*; use crate::models::*; pub async fn post_events( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transactions_events = ctx .ton_service @@ -32,9 +32,9 @@ pub async fn post_events( } pub async fn post_events_mark( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transaction = ctx.ton_service.mark_event(&service_id, &req.id).await; @@ -42,9 +42,9 @@ pub async fn post_events_mark( } pub async fn post_events_mark_all( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transactions = ctx .ton_service @@ -55,9 +55,9 @@ pub async fn post_events_mark_all( } pub async fn post_tokens_events( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transactions_events = ctx .ton_service @@ -80,9 +80,9 @@ pub async fn post_tokens_events( } pub async fn post_tokens_events_mark( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transaction = ctx.ton_service.mark_token_event(&service_id, &req.id).await; @@ -91,7 +91,7 @@ pub async fn post_tokens_events_mark( pub async fn get_events_id( Path(id): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let event = ctx diff --git a/src/api/controllers/misc.rs b/src/api/controllers/misc.rs index abb4753..14104da 100644 --- a/src/api/controllers/misc.rs +++ b/src/api/controllers/misc.rs @@ -1,4 +1,5 @@ -use axum::{Extension, Json}; +use axum::extract::State; +use axum::Json; use metrics::{histogram, increment_counter}; use tokio::time::Instant; use uuid::Uuid; @@ -10,8 +11,8 @@ use crate::api::*; use crate::models::*; pub async fn post_read_contract( + State(ctx): State, Json(req): Json, - Extension(ctx): Extension>, ) -> Result> { let start = Instant::now(); @@ -40,8 +41,8 @@ pub async fn post_read_contract( } pub async fn post_encode_tvm_cell( + State(ctx): State, Json(req): Json, - Extension(ctx): Extension>, ) -> Result> { let start = Instant::now(); @@ -63,8 +64,8 @@ pub async fn post_encode_tvm_cell( } pub async fn post_prepare_generic_message( + State(ctx): State, Json(req): Json, - Extension(ctx): Extension>, ) -> Result> { let start = Instant::now(); @@ -106,8 +107,8 @@ pub async fn post_prepare_generic_message( } pub async fn post_send_signed_message( + State(ctx): State, Json(req): Json, - Extension(ctx): Extension>, ) -> Result> { let start = Instant::now(); @@ -144,9 +145,9 @@ pub async fn post_send_signed_message( } pub async fn post_send_generic_message( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -186,9 +187,9 @@ pub async fn post_send_generic_message( } pub async fn post_set_callback( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); let callback = req; @@ -206,7 +207,7 @@ pub async fn post_set_callback( } pub async fn get_token_whitelist( - Extension(ctx): Extension>, + State(ctx): State, ) -> Result> { let start = Instant::now(); @@ -227,3 +228,17 @@ pub async fn get_token_whitelist( Ok(Json(whitelist)) } + +pub async fn post_resubscribe_for_all_accounts( + State(ctx): State, +) -> Result> { + let start = Instant::now(); + + ctx.ton_service.resubscribe_for_all_accounts().await?; + + let elapsed = start.elapsed(); + histogram!("execution_time_seconds", elapsed, "method" => "resubscribeForAllAccounts"); + increment_counter!("requests_processed", "method" => "resubscribeForAllAccounts"); + + Ok(Json(ResubscribeResponse {})) +} diff --git a/src/api/controllers/mod.rs b/src/api/controllers/mod.rs index 8b104b5..f41611c 100644 --- a/src/api/controllers/mod.rs +++ b/src/api/controllers/mod.rs @@ -1,10 +1,9 @@ +use axum::http::StatusCode; use axum::response::IntoResponse; -use http::StatusCode; pub use self::address::*; pub use self::authorization::*; pub use self::blockchain::*; -pub use self::docs::*; pub use self::events::*; pub use self::misc::*; pub use self::ton_metrics::*; @@ -13,7 +12,6 @@ pub use self::transactions::*; mod address; mod authorization; mod blockchain; -mod docs; mod events; mod misc; mod ton_metrics; diff --git a/src/api/controllers/ton_metrics.rs b/src/api/controllers/ton_metrics.rs index 8f49836..d84d8f1 100644 --- a/src/api/controllers/ton_metrics.rs +++ b/src/api/controllers/ton_metrics.rs @@ -1,11 +1,10 @@ -use axum::{Extension, Json}; +use axum::extract::State; +use axum::Json; use crate::api::responses::*; use crate::api::*; -pub async fn get_ton_metrics( - Extension(ctx): Extension>, -) -> Result> { +pub async fn get_ton_metrics(State(ctx): State) -> Result> { let metrics = ctx.ton_service.get_metrics().await?; Ok(Json(MetricsResponse::from(metrics))) diff --git a/src/api/controllers/transactions.rs b/src/api/controllers/transactions.rs index c30f213..8793fe8 100644 --- a/src/api/controllers/transactions.rs +++ b/src/api/controllers/transactions.rs @@ -1,5 +1,5 @@ -use axum::extract::Path; -use axum::{Extension, Json}; +use axum::extract::{Path, State}; +use axum::Json; use metrics::{histogram, increment_counter}; use tokio::time::Instant; use uuid::Uuid; @@ -10,9 +10,9 @@ use crate::api::responses::*; use crate::api::*; pub async fn post_transactions( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let transactions = ctx .ton_service @@ -33,9 +33,9 @@ pub async fn post_transactions( } pub async fn post_transactions_create( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -53,9 +53,9 @@ pub async fn post_transactions_create( } pub async fn post_transactions_confirm( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -74,7 +74,7 @@ pub async fn post_transactions_confirm( pub async fn get_transactions_mh( Path(message_hash): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let transaction = ctx @@ -88,7 +88,7 @@ pub async fn get_transactions_mh( pub async fn get_transactions_h( Path(hash): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let transaction = ctx @@ -102,7 +102,7 @@ pub async fn get_transactions_h( pub async fn get_transactions_id( Path(id): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let transaction = ctx @@ -116,7 +116,7 @@ pub async fn get_transactions_id( pub async fn get_tokens_transactions_id( Path(internal_id): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let transaction = ctx @@ -130,7 +130,7 @@ pub async fn get_tokens_transactions_id( pub async fn get_tokens_transactions_mh( Path(message_hash): Path, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, ) -> Result> { let transaction = ctx @@ -143,9 +143,9 @@ pub async fn get_tokens_transactions_mh( } pub async fn post_tokens_transactions_create( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -163,9 +163,9 @@ pub async fn post_tokens_transactions_create( } pub async fn post_tokens_transactions_burn( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); @@ -183,9 +183,9 @@ pub async fn post_tokens_transactions_burn( } pub async fn post_tokens_transactions_mint( - Json(req): Json, - Extension(ctx): Extension>, + State(ctx): State, IdExtractor(service_id): IdExtractor, + Json(req): Json, ) -> Result> { let start = Instant::now(); diff --git a/src/api/docs.rs b/src/api/docs.rs new file mode 100644 index 0000000..cac5d58 --- /dev/null +++ b/src/api/docs.rs @@ -0,0 +1,37 @@ +use std::sync::Arc; + +use aide::axum::routing::get; +use aide::axum::{ApiRouter, IntoApiResponse}; +use aide::openapi::OpenApi; +use aide::scalar::Scalar; +use axum::response::IntoResponse; +use axum::{Extension, Json}; + +pub fn route() -> ApiRouter { + // We infer the return types for these routes + // as an example. + // + // As a result, the `serve_redoc` route will + // have the `text/html` content-type correctly set + // with a 200 status. + aide::gen::infer_responses(true); + + let router = ApiRouter::new() + .route( + "/", + get(Scalar::new("/docs/private/api.json") + .with_title("tycho wallet api") + .axum_handler()), + ) + .route("/private/api.json", get(serve_docs)); + + // Afterwards we disable response inference because + // it might be incorrect for other routes. + aide::gen::infer_responses(false); + + router +} + +pub async fn serve_docs(Extension(api): Extension>) -> impl IntoApiResponse { + Json(api).into_response() +} diff --git a/src/api/error.rs b/src/api/error.rs index 9294432..eaddb77 100644 --- a/src/api/error.rs +++ b/src/api/error.rs @@ -1,10 +1,10 @@ +use aide::OperationOutput; use axum::{ http::StatusCode, response::{IntoResponse, Response}, Json, }; use tokio::sync::oneshot; -use tracing::log; use crate::api::controllers::ControllersError; use crate::client::TonClientError; @@ -119,66 +119,70 @@ impl Error { Self::Sqlx(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("SQLx error: {:?}", e); + tracing::error!("SQLx error: {:?}", e); } Self::Serde(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("Serde error: {:?}", e); + tracing::error!("Serde error: {:?}", e); } Self::Ed25519(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("Ed25519 error: {:?}", e); + tracing::error!("Ed25519 error: {:?}", e); } Self::RecvError(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("RecvError error: {:?}", e); + tracing::error!("RecvError error: {:?}", e); } Self::TokensJson(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("TokensJson error: {:?}", e); + tracing::error!("TokensJson error: {:?}", e); } Self::FromHexError(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("FromHexError error: {:?}", e); + tracing::error!("FromHexError error: {:?}", e); } Self::TryFromSliceError(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("TryFromSliceError error: {:?}", e); + tracing::error!("TryFromSliceError error: {:?}", e); } Self::Anyhow(ref e) => { // TODO: we probably want to use `tracing` instead // so that this gets linked to the HTTP request by `TraceLayer`. - log::error!("Generic error: {:?}", e); + tracing::error!("Generic error: {:?}", e); } // Other errors get mapped normally. Self::TonService(ref e) => { - log::error!("Ton service error: {:?}", e); + tracing::error!("Ton service error: {:?}", e); } // Other errors get mapped normally. Self::TonClient(ref e) => { - log::error!("Ton client error: {:?}", e); + tracing::error!("Ton client error: {:?}", e); } Self::Controllers(ref e) => { - log::error!("Controllers error: {:?}", e); + tracing::error!("Controllers error: {:?}", e); } } self.to_string() } } + +impl OperationOutput for Error { + type Inner = Self; +} diff --git a/src/api/mod.rs b/src/api/mod.rs index 3a9f8ef..ebe06c4 100644 --- a/src/api/mod.rs +++ b/src/api/mod.rs @@ -1,13 +1,17 @@ +use std::future::IntoFuture; use std::net::SocketAddr; use std::sync::Arc; +use aide::openapi::{Info, OpenApi, Server}; +use aide::transform::{TransformOpenApi, TransformPathItem}; use anyhow::Context; -use axum::handler::Handler; -use http::method::Method; -use http::Request; -use hyper::Body; +use axum::body::Body; +use axum::extract::Request; +use axum::http::Method; +use futures_util::future::BoxFuture; use metrics::{describe_counter, describe_histogram}; use metrics_exporter_prometheus::Matcher; +use schemars::schema::{InstanceType, SchemaObject}; use tower::ServiceBuilder; use tower_http::cors::{AllowHeaders, AllowMethods, AllowOrigin, CorsLayer}; use tower_http::trace::TraceLayer; @@ -18,6 +22,7 @@ use crate::services::{AuthService, StorageHandler, TonService}; pub use self::error::*; mod controllers; +mod docs; mod error; mod requests; mod responses; @@ -29,50 +34,66 @@ const EXPONENTIAL_SECONDS: &[f64] = &[ type Result = std::result::Result; -pub async fn http_service( - server_addr: SocketAddr, - metrics_addr: Option, - auth_service: Arc, - ton_service: Arc, - memory_storage: Arc, -) { - describe_counter!("requests_processed", "number of requests processed"); - describe_histogram!( - "execution_time_seconds", - metrics::Unit::Milliseconds, - "execution time of request handler" - ); - if let Some(metrics_addr) = metrics_addr { - if let Err(e) = install_monitoring(metrics_addr) { - log::error!("Failed to install monitoring: {e:?}"); +pub struct Api { + serve_fn: Box BoxFuture<'static, std::io::Result<()>> + Send>, +} + +impl Api { + pub async fn bind( + server_addr: SocketAddr, + public_url: Option, + metrics_addr: Option, + auth_service: Arc, + ton_service: Arc, + memory_storage: Arc, + ) -> std::io::Result { + describe_counter!("requests_processed", "number of requests processed"); + describe_histogram!( + "execution_time_seconds", + metrics::Unit::Milliseconds, + "execution time of request handler" + ); + if let Some(metrics_addr) = metrics_addr { + if let Err(e) = install_monitoring(metrics_addr) { + tracing::error!("Failed to install monitoring: {e:?}"); + } } - } + let mut api = + get_open_api(public_url.unwrap_or_else(|| "http://localhost:8080".to_string())); - let app = router::router(auth_service, ton_service, memory_storage) - .layer( - ServiceBuilder::new().layer( - CorsLayer::new() - .allow_headers(AllowHeaders::any()) - .allow_origin(AllowOrigin::any()) - .allow_methods(AllowMethods::list([ - Method::GET, - Method::POST, - Method::OPTIONS, - ])), - ), - ) - .layer( - TraceLayer::new_for_http().on_request(|request: &Request, _span: &Span| { - tracing::info!("started {} {}", request.method(), request.uri().path()) - }), - ) - .fallback(controllers::handler_404.into_service()); + let app = router::router(auth_service, ton_service, memory_storage) + .finish_api_with(&mut api, api_docs) + .layer( + ServiceBuilder::new().layer( + CorsLayer::new() + .allow_headers(AllowHeaders::any()) + .allow_origin(AllowOrigin::any()) + .allow_methods(AllowMethods::list([ + Method::GET, + Method::POST, + Method::OPTIONS, + ])), + ), + ) + .layer(TraceLayer::new_for_http().on_request( + |request: &Request, _span: &Span| { + tracing::info!("started {} {}", request.method(), request.uri().path()) + }, + )) + .fallback(controllers::handler_404); + + let listener = tokio::net::TcpListener::bind(server_addr).await.unwrap(); + + let serve = axum::serve(listener, app); + + Ok(Self { + serve_fn: Box::new(move || Box::pin(serve.into_future())), + }) + } - axum::Server::bind(&server_addr) - .serve(app.into_make_service()) - .await - .context("Failed to start HTTP server") - .unwrap(); + pub async fn serve(self) -> std::io::Result<()> { + (self.serve_fn)().await + } } fn install_monitoring(metrics_addr: SocketAddr) -> anyhow::Result<()> { @@ -87,7 +108,45 @@ fn install_monitoring(metrics_addr: SocketAddr) -> anyhow::Result<()> { .context("Failed installing metrics exporter") } +#[derive(Clone)] pub struct ApiContext { ton_service: Arc, memory_storage: Arc, } + +fn taged(tag: &'static str) -> impl FnOnce(TransformPathItem) -> TransformPathItem { + |item| item.tag(tag) +} + +fn get_open_api(url: String) -> OpenApi { + OpenApi { + info: Info { + description: Some("Tycho Wallet API".to_string()), + ..Info::default() + }, + servers: vec![Server { + url, + description: Some("Production".to_string()), + variables: Default::default(), + extensions: Default::default(), + }], + ..OpenApi::default() + } +} + +fn api_docs(api: TransformOpenApi) -> TransformOpenApi { + api.title("Tycho Wallet API") + .summary("Tycho Wallet indexer") +} + +pub(super) fn int_schema(_: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { + let object_schema = schemars::schema::SchemaObject { + instance_type: Some(InstanceType::Number.into()), + ..Default::default() + }; + object_schema.into() +} +pub(super) fn any_schema(_: &mut schemars::SchemaGenerator) -> schemars::schema::Schema { + let object_schema = SchemaObject::default(); + object_schema.into() +} diff --git a/src/api/requests/address.rs b/src/api/requests/address.rs index 72ff443..94f01d0 100644 --- a/src/api/requests/address.rs +++ b/src/api/requests/address.rs @@ -1,18 +1,16 @@ -use opg::OpgModel; +use schemars::JsonSchema; use serde::Deserialize; use crate::models::*; -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressCheckRequest")] pub struct AddressCheckRequest { pub address: Address, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("CreateAddressRequest")] pub struct CreateAddressRequest { pub account_type: Option, pub workchain_id: Option, @@ -32,3 +30,9 @@ impl From for CreateAddress { } } } + +#[derive(Deserialize, JsonSchema)] +#[serde(rename_all = "camelCase")] +pub struct AddAccountSubscriptionRequest { + pub address: String, +} diff --git a/src/api/requests/events.rs b/src/api/requests/events.rs index 5326305..9cc847a 100644 --- a/src/api/requests/events.rs +++ b/src/api/requests/events.rs @@ -1,14 +1,14 @@ use derive_more::Constructor; -use opg::OpgModel; + +use schemars::JsonSchema; use serde::Deserialize; use uuid::Uuid; use crate::models::*; use crate::prelude::*; -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionEventsRequest")] pub struct TonTransactionEventsRequest { pub limit: Option, pub offset: Option, @@ -41,23 +41,20 @@ impl From for TransactionsEventsSearch { } } -#[derive(Deserialize, OpgModel, Constructor)] +#[derive(Deserialize, Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonMarkEventsRequest")] pub struct TonMarkEventsRequest { pub id: Uuid, } -#[derive(Deserialize, OpgModel, Constructor)] +#[derive(Deserialize, Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("MarkAllTransactionEventRequest")] pub struct MarkAllTransactionEventRequest { pub event_status: Option, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTokenTransactionEventsRequest")] pub struct TonTokenTransactionEventsRequest { pub limit: Option, pub offset: Option, @@ -94,9 +91,8 @@ impl From for TokenTransactionsEventsSearch { } } -#[derive(Deserialize, OpgModel, Constructor)] +#[derive(Deserialize, Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTokenMarkEventsRequest")] pub struct TonTokenMarkEventsRequest { pub id: Uuid, } diff --git a/src/api/requests/misc.rs b/src/api/requests/misc.rs index f535da5..db5d711 100644 --- a/src/api/requests/misc.rs +++ b/src/api/requests/misc.rs @@ -1,12 +1,14 @@ use bigdecimal::BigDecimal; -use opg::OpgModel; + +use schemars::JsonSchema; use serde::Deserialize; use ton_abi::Param; use uuid::Uuid; +use crate::api::any_schema; use crate::models::*; -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct ExecuteContractRequest { pub target_account_addr: String, @@ -14,23 +16,22 @@ pub struct ExecuteContractRequest { pub responsible: Option, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct FunctionDetailsDTO { pub function_name: String, pub input_params: Vec, - #[opg(string, format = "any[]")] + #[schemars(schema_with = "any_schema")] pub output_params: Vec, - #[opg(string, format = "any[]")] + #[schemars(schema_with = "any_schema")] pub headers: Vec, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct InputParamDTO { - #[opg(string, format = "any")] + #[schemars(schema_with = "any_schema")] pub param: Param, - #[opg(string, format = "any")] pub value: serde_json::Value, } @@ -43,20 +44,20 @@ impl From for InputParam { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct EncodeParamRequest { pub input_params: Vec, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct PrepareMessageRequest { pub sender_addr: String, pub public_key: String, pub target_account_addr: String, pub execution_flag: u8, - #[opg("value", string)] + pub value: BigDecimal, pub bounce: bool, pub account_type: AccountType, @@ -64,7 +65,7 @@ pub struct PrepareMessageRequest { pub function_details: Option, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SignedMessageRequest { pub sender_addr: String, @@ -72,14 +73,14 @@ pub struct SignedMessageRequest { pub signature: String, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SendMessageRequest { pub id: Option, pub sender_addr: String, pub target_account_addr: String, pub execution_flag: u8, - #[opg("value", string)] + pub value: BigDecimal, pub bounce: bool, pub account_type: AccountType, @@ -87,7 +88,7 @@ pub struct SendMessageRequest { pub function_details: Option, } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SetCallbackRequest { pub callback: String, diff --git a/src/api/requests/transactions.rs b/src/api/requests/transactions.rs index abe21a8..d37bda3 100644 --- a/src/api/requests/transactions.rs +++ b/src/api/requests/transactions.rs @@ -2,22 +2,21 @@ use bigdecimal::BigDecimal; use derive_more::Constructor; use nekoton_utils::TrustMe; use num_traits::FromPrimitive; -use opg::OpgModel; + +use schemars::JsonSchema; use serde::Deserialize; use uuid::Uuid; use crate::models::*; use crate::prelude::*; -#[derive(Deserialize, OpgModel, Constructor)] +#[derive(Deserialize, Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionSendRequest")] pub struct TonTransactionSendRequest { pub id: Option, pub from_address: Address, pub outputs: Vec, pub bounce: Option, - #[opg("base64 encoded payload", string, optional)] pub payload: Option, } @@ -33,12 +32,10 @@ impl From for TransactionSend { } } -#[derive(Deserialize, OpgModel, Constructor)] +#[derive(Deserialize, Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionSendOutputRequest")] pub struct TonTransactionSendOutputRequest { pub recipient_address: Address, - #[opg("value", string)] pub value: BigDecimal, pub output_type: Option, } @@ -53,9 +50,8 @@ impl From for TransactionSendOutput { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionConfirmRequest")] pub struct TonTransactionConfirmRequest { pub id: Option, pub address: Address, @@ -72,9 +68,8 @@ impl From for TransactionConfirm { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionsRequest")] pub struct TonTransactionsRequest { pub id: Option, pub message_hash: Option, @@ -107,22 +102,17 @@ impl From for TransactionsSearch { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTokenTransactionSendRequest")] pub struct TonTokenTransactionSendRequest { pub id: Option, pub from_address: Address, pub root_address: Address, pub recipient_address: Address, - #[opg("sendGasTo", string, optional)] pub send_gas_to: Option
, - #[opg("value", string)] pub value: BigDecimal, pub notify_receiver: Option, - #[opg("fee", string, optional)] pub fee: Option, - #[opg("base64 encoded payload", string, optional)] pub payload: Option, } @@ -144,19 +134,15 @@ impl From for TokenTransactionSend { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTokenTransactionBurnRequest")] pub struct TonTokenTransactionBurnRequest { pub id: Option, pub from_address: Address, pub root_address: Address, - #[opg("sendGasTo", string, optional)] pub send_gas_to: Option
, pub callback_to: Address, - #[opg("value", string)] pub value: BigDecimal, - #[opg("fee", string, optional)] pub fee: Option, } @@ -176,22 +162,17 @@ impl From for TokenTransactionBurn { } } -#[derive(Deserialize, OpgModel)] +#[derive(Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTokenTransactionMintRequest")] pub struct TonTokenTransactionMintRequest { pub id: Option, pub owner_address: Address, pub root_address: Address, - #[opg("value", string)] pub value: BigDecimal, pub recipient_address: Address, - #[opg("deployWalletValue", string, optional)] pub deploy_wallet_value: Option, - #[opg("sendGasTo", string, optional)] pub send_gas_to: Option
, pub notify: Option, - #[opg("fee", string, optional)] pub fee: Option, } diff --git a/src/api/responses/address.rs b/src/api/responses/address.rs index 0d1d001..8de8900 100644 --- a/src/api/responses/address.rs +++ b/src/api/responses/address.rs @@ -2,25 +2,24 @@ use std::str::FromStr; use bigdecimal::BigDecimal; use derive_more::Constructor; -use nekoton_utils::{pack_std_smc_addr, TrustMe}; -use opg::OpgModel; +use nekoton_utils::TrustMe; +use tycho_types::models::StdAddr; + +use schemars::JsonSchema; use serde::Serialize; -use ton_block::MsgAddressInt; use uuid::Uuid; use crate::api::*; use crate::models::*; -#[derive(Serialize, OpgModel, Constructor)] +#[derive(Serialize, JsonSchema, Constructor)] #[serde(rename_all = "camelCase")] -#[opg("AddressValidResponse")] pub struct AddressValidResponse { pub valid: bool, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressResponse")] pub struct AddressResponse { pub status: TonStatus, pub data: Option, @@ -44,9 +43,8 @@ impl From> for AddressResponse { } } -#[derive(Serialize, opg::OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("CheckedAddressResponse")] pub struct CheckedAddressResponse { pub status: TonStatus, pub data: Option, @@ -67,9 +65,8 @@ impl From> for CheckedAddressResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressBalanceResponse")] pub struct AddressBalanceResponse { pub status: TonStatus, pub data: Option, @@ -93,31 +90,26 @@ impl From> for AddressBalanceResponse } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressBalanceDataResponse")] pub struct AddressBalanceDataResponse { pub id: Uuid, pub address: Account, pub account_type: AccountType, pub account_status: AccountStatus, - #[opg("balance", string)] pub balance: BigDecimal, - #[opg("networkBalance", string)] pub network_balance: BigDecimal, pub last_transaction_hash: Option, pub last_transaction_lt: Option, pub sync_u_time: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub created_at: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub updated_at: i64, } impl AddressBalanceDataResponse { pub fn new(a: AddressDb, b: NetworkAddressData) -> Self { - let account = MsgAddressInt::from_str(&format!("{}:{}", a.workchain_id, a.hex)).trust_me(); - let base64url = Address(pack_std_smc_addr(true, &account, true).trust_me()); + let account = StdAddr::from_str(&format!("{}:{}", a.workchain_id, a.hex)).trust_me(); + let base64url = Address(account.display_base64_url(true).to_string()); Self { id: a.id, @@ -133,15 +125,14 @@ impl AddressBalanceDataResponse { last_transaction_hash: b.last_transaction_hash, last_transaction_lt: b.last_transaction_lt, sync_u_time: b.sync_u_time, - created_at: a.created_at.timestamp_millis(), - updated_at: a.updated_at.timestamp_millis(), + created_at: a.created_at.and_utc().timestamp_millis(), + updated_at: a.updated_at.and_utc().timestamp_millis(), } } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressInfoResponse")] pub struct AddressInfoResponse { pub status: TonStatus, pub data: Option, @@ -165,28 +156,24 @@ impl From> for AddressInfoResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AddressInfoDataResponse")] pub struct AddressInfoDataResponse { pub id: Uuid, pub address: Account, pub account_type: AccountType, - #[opg("balance", string)] pub balance: BigDecimal, pub custodians: Option, pub confirmations: Option, pub custodians_public_keys: Option>, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub created_at: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub updated_at: i64, } impl AddressInfoDataResponse { pub fn new(a: AddressDb) -> Self { - let account = MsgAddressInt::from_str(&format!("{}:{}", a.workchain_id, a.hex)).trust_me(); - let base64url = Address(pack_std_smc_addr(true, &account, true).trust_me()); + let account = StdAddr::from_str(&format!("{}:{}", a.workchain_id, a.hex)).trust_me(); + let base64url = Address(account.display_base64_url(true).to_string()); Self { id: a.id, @@ -202,15 +189,14 @@ impl AddressInfoDataResponse { .custodians_public_keys .and_then(|k| serde_json::from_value(k).unwrap_or_default()), balance: a.balance, - created_at: a.created_at.timestamp_millis(), - updated_at: a.updated_at.timestamp_millis(), + created_at: a.created_at.and_utc().timestamp_millis(), + updated_at: a.updated_at.and_utc().timestamp_millis(), } } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenBalanceResponse")] pub struct TokenBalanceResponse { pub status: TonStatus, pub data: Option>, @@ -234,30 +220,24 @@ impl From, Error>> for TokenBalanceResponse } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenBalanceDataResponse")] pub struct TokenBalanceDataResponse { pub service_id: ServiceId, pub address: Account, - #[opg("balance", string)] pub balance: BigDecimal, - #[opg("networkBalance", string)] pub network_balance: BigDecimal, pub account_status: AccountStatus, pub root_address: String, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub created_at: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub updated_at: i64, } impl TokenBalanceDataResponse { pub fn new(a: TokenBalanceFromDb, b: NetworkTokenAddressData) -> Self { let account = - MsgAddressInt::from_str(&format!("{}:{}", a.account_workchain_id, a.account_hex)) - .trust_me(); - let base64url = Address(pack_std_smc_addr(true, &account, true).trust_me()); + StdAddr::from_str(&format!("{}:{}", a.account_workchain_id, a.account_hex)).trust_me(); + let base64url = Address(account.display_base64_url(true).to_string()); Self { service_id: a.service_id, @@ -270,8 +250,30 @@ impl TokenBalanceDataResponse { account_status: b.account_status, network_balance: b.network_balance, root_address: a.root_address, - created_at: a.created_at.timestamp_millis(), - updated_at: a.updated_at.timestamp_millis(), + created_at: a.created_at.and_utc().timestamp_millis(), + updated_at: a.updated_at.and_utc().timestamp_millis(), + } + } +} + +#[derive(Serialize, JsonSchema)] +#[serde(rename_all = "camelCase")] +pub struct AddAccountSubscriptionResponse { + pub status: TonStatus, + pub error_message: Option, +} + +impl From> for AddAccountSubscriptionResponse { + fn from(r: Result<(), Error>) -> Self { + match r { + Ok(()) => Self { + status: TonStatus::Ok, + error_message: None, + }, + Err(e) => Self { + status: TonStatus::Error, + error_message: Some(e.get_error()), + }, } } } diff --git a/src/api/responses/blockchain.rs b/src/api/responses/blockchain.rs index bf31209..416ee35 100644 --- a/src/api/responses/blockchain.rs +++ b/src/api/responses/blockchain.rs @@ -1,11 +1,10 @@ -use opg::OpgModel; +use schemars::JsonSchema; use serde::Serialize; use crate::models::*; -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("BlockchainInfoResponse")] pub struct BlockchainInfoResponse { pub tip_block_ts: u32, pub synced: bool, diff --git a/src/api/responses/events.rs b/src/api/responses/events.rs index ac36e35..2614619 100644 --- a/src/api/responses/events.rs +++ b/src/api/responses/events.rs @@ -1,20 +1,18 @@ -use opg::OpgModel; +use schemars::JsonSchema; use serde::Serialize; use crate::api::*; use crate::models::*; -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("EventsResponse")] pub struct EventsResponse { pub count: i32, pub items: Vec, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonEventsResponse")] pub struct TonEventsResponse { pub status: TonStatus, pub data: Option, @@ -38,9 +36,8 @@ impl From> for TonEventsResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("MarkEventsResponse")] pub struct MarkEventsResponse { pub status: TonStatus, pub error_message: Option, @@ -76,9 +73,8 @@ impl From, Error>> for MarkEventsResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonEventsResponse")] pub struct TonTokenEventsResponse { pub status: TonStatus, pub data: Option, @@ -102,17 +98,15 @@ impl From> for TonTokenEventsResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenEventsResponse")] pub struct TokenEventsResponse { pub count: i32, pub items: Vec, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("MarkTokenEventsResponse")] pub struct MarkTokenEventsResponse { pub status: TonStatus, pub error_message: Option, @@ -133,9 +127,8 @@ impl From> for MarkTokenEventsResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionEventResponse")] pub struct TransactionEventResponse { pub status: TonStatus, pub data: Option, diff --git a/src/api/responses/misc.rs b/src/api/responses/misc.rs index 6bd31db..b704685 100644 --- a/src/api/responses/misc.rs +++ b/src/api/responses/misc.rs @@ -1,40 +1,44 @@ use crate::models::WhitelistedTokenFromDb; use nekoton_contracts::tip3_any::TokenWalletVersion; -use opg::OpgModel; + +use schemars::JsonSchema; use serde::Serialize; -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] +#[serde(rename_all = "camelCase")] +pub struct ResubscribeResponse {} + +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct ReadContractResponse { - #[opg(string, format = "any")] pub object: serde_json::Value, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct EncodedCellResponse { pub base64_cell: String, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct UnsignedMessageHashResponse { pub unsigned_message_hash: String, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SignedMessageHashResponse { pub signed_message_hash: String, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct SetCallbackResponse { pub callback: String, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] pub struct WhitelistedTokenResponse { pub name: String, @@ -52,9 +56,8 @@ impl From for WhitelistedTokenResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenWhitelistResponse")] pub struct TokenWhitelistResponse { pub count: i32, pub items: Vec, diff --git a/src/api/responses/ton_metrics.rs b/src/api/responses/ton_metrics.rs index 476e0b4..5dbfbbe 100644 --- a/src/api/responses/ton_metrics.rs +++ b/src/api/responses/ton_metrics.rs @@ -1,11 +1,10 @@ -use opg::OpgModel; +use schemars::JsonSchema; use serde::Serialize; use crate::models::*; -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("MetricsResponse")] pub struct MetricsResponse { pub gen_utime: u32, } diff --git a/src/api/responses/transactions.rs b/src/api/responses/transactions.rs index f9acdd4..2a17530 100644 --- a/src/api/responses/transactions.rs +++ b/src/api/responses/transactions.rs @@ -2,17 +2,17 @@ use std::str::FromStr; use bigdecimal::BigDecimal; use nekoton_utils::pack_std_smc_addr; -use opg::OpgModel; +use tycho_types::models::StdAddr; + +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use ton_block::MsgAddressInt; use uuid::Uuid; use crate::api::*; use crate::models::*; -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionResponse")] pub struct TransactionResponse { pub status: TonStatus, pub data: Option, @@ -36,27 +36,22 @@ impl From> for TransactionResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionDataResponse")] pub struct TransactionDataResponse { - #[opg("id", string)] pub id: Uuid, pub message_hash: String, pub transaction_hash: Option, pub transaction_lt: Option, pub transaction_timeout: Option, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] pub transaction_timestamp: Option, pub account: Account, pub sender: Option, - #[opg("value", string)] pub value: Option, - #[opg("originalValue", string)] pub original_value: Option, - #[opg("fee", string)] + pub fee: Option, - #[opg("balanceChange", string)] + pub balance_change: BigDecimal, pub out_messages: Option>, pub original_outputs: Option>, @@ -66,9 +61,9 @@ pub struct TransactionDataResponse { pub bounce: bool, pub error: Option, pub multisig_transaction_id: Option, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] + pub created_at: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] + pub updated_at: i64, } @@ -77,10 +72,9 @@ impl From for TransactionDataResponse { let sender = if let (Some(sender_hex), Some(sender_workchain_id)) = (c.sender_hex, c.sender_workchain_id) { - let sender = - MsgAddressInt::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)) - .unwrap_or_default(); - let sender_base64url = Address(pack_std_smc_addr(true, &sender, true).unwrap()); + let sender = StdAddr::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)) + .unwrap_or_default(); + let sender_base64url = Address(sender.display_base64_url(true).to_string()); Some(Account { workchain_id: sender_workchain_id, hex: Address(sender_hex), @@ -119,9 +113,8 @@ impl From for TransactionDataResponse { }; let account = - MsgAddressInt::from_str(&format!("{}:{}", c.account_workchain_id, c.account_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &account, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", c.account_workchain_id, c.account_hex)).unwrap(); + let base64url = Address(account.display_base64_url(true).to_string()); TransactionDataResponse { id: c.id, @@ -145,39 +138,37 @@ impl From for TransactionDataResponse { status: c.status, aborted: c.aborted, bounce: c.bounce, - transaction_timestamp: c.transaction_timestamp.map(|t| t.timestamp_millis()), - created_at: c.created_at.timestamp_millis(), - updated_at: c.updated_at.timestamp_millis(), + transaction_timestamp: c + .transaction_timestamp + .map(|t| t.and_utc().timestamp_millis()), + created_at: c.created_at.and_utc().timestamp_millis(), + updated_at: c.updated_at.and_utc().timestamp_millis(), error: c.error, multisig_transaction_id: c.multisig_transaction_id, } } } -#[derive(Serialize, Deserialize, OpgModel)] +#[derive(Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionMessage")] pub struct TransactionMessage { pub message_hash: String, - #[opg("value", string)] + pub value: BigDecimal, - #[opg("fee", string)] + pub fee: BigDecimal, pub recipient: Account, } -#[derive(Serialize, Deserialize, OpgModel)] +#[derive(Serialize, Deserialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionOutput")] pub struct TransactionOutput { - #[opg("value", string)] pub value: BigDecimal, pub recipient: Account, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TonTransactionsResponse")] pub struct TonTransactionsResponse { pub status: TonStatus, pub data: Option, @@ -201,17 +192,15 @@ impl From> for TonTransactionsResponse { } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TransactionsResponse")] pub struct TransactionsResponse { pub count: i32, pub items: Vec, } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenTransactionResponse")] pub struct TokenTransactionResponse { pub status: TonStatus, pub data: Option, @@ -235,15 +224,14 @@ impl From> for TokenTransactionRespo } } -#[derive(Serialize, OpgModel)] +#[derive(Serialize, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("TokenTransactionDataResponse")] pub struct TokenTransactionDataResponse { pub id: Uuid, pub transaction_hash: Option, pub message_hash: String, pub account: Account, - #[opg("value", string)] + pub value: BigDecimal, pub root_address: String, pub error: Option, @@ -251,9 +239,9 @@ pub struct TokenTransactionDataResponse { pub block_time: Option, pub direction: TonTransactionDirection, pub status: TonTokenTransactionStatus, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] + pub created_at: i64, - #[opg("UTC timestamp in milliseconds", integer, format = "int64")] + pub updated_at: i64, pub payload: Option, } @@ -261,9 +249,8 @@ pub struct TokenTransactionDataResponse { impl From for TokenTransactionDataResponse { fn from(c: TokenTransactionFromDb) -> Self { let account = - MsgAddressInt::from_str(&format!("{}:{}", c.account_workchain_id, c.account_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &account, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", c.account_workchain_id, c.account_hex)).unwrap(); + let base64url = Address(account.display_base64_url(true).to_string()); let payload = c.payload.map(base64::encode); TokenTransactionDataResponse { @@ -282,8 +269,8 @@ impl From for TokenTransactionDataResponse { block_time: c.block_time, direction: c.direction, status: c.status, - created_at: c.created_at.timestamp_millis(), - updated_at: c.updated_at.timestamp_millis(), + created_at: c.created_at.and_utc().timestamp_millis(), + updated_at: c.updated_at.and_utc().timestamp_millis(), payload, } } diff --git a/src/api/router/address.rs b/src/api/router/address.rs index dfb23aa..37da9b5 100644 --- a/src/api/router/address.rs +++ b/src/api/router/address.rs @@ -1,14 +1,50 @@ -use axum::{ - routing::{get, post}, - Router, -}; +use aide::axum::{routing::get_with, routing::post_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{ + controllers, + responses::{ + AddAccountSubscriptionResponse, AddressBalanceResponse, AddressInfoResponse, + AddressResponse, CheckedAddressResponse, + }, + taged, ApiContext, +}; -pub fn router() -> Router { - Router::new() - .route("/check", post(controllers::post_address_check)) - .route("/create", post(controllers::post_address_create)) - .route("/:address", get(controllers::get_address_balance)) - .route("/:address/info", get(controllers::get_address_info)) +pub fn router() -> ApiRouter { + ApiRouter::new() + .api_route_with( + "/check", + post_with(controllers::post_address_check, |op| { + op.response::<200, Json>() + }), + taged("address"), + ) + .api_route_with( + "/create", + post_with(controllers::post_address_create, |op| { + op.response::<200, Json>() + }), + taged("address"), + ) + .api_route_with( + "/subscribe", + post_with(controllers::post_address_subscription, |op| { + op.response::<200, Json>() + }), + taged("address"), + ) + .api_route_with( + "/:address", + get_with(controllers::get_address_balance, |op| { + op.response::<200, Json>() + }), + taged("address"), + ) + .api_route_with( + "/:address/info", + get_with(controllers::get_address_info, |op| { + op.response::<200, Json>() + }), + taged("address"), + ) } diff --git a/src/api/router/blockchain.rs b/src/api/router/blockchain.rs index a270675..6f8af66 100644 --- a/src/api/router/blockchain.rs +++ b/src/api/router/blockchain.rs @@ -1,7 +1,14 @@ -use axum::{routing::get, Router}; +use aide::axum::{routing::get_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{controllers, responses::BlockchainInfoResponse, taged, ApiContext}; -pub fn router() -> Router { - Router::new().route("/", get(controllers::get_blockchain_info)) +pub fn router() -> ApiRouter { + ApiRouter::new().api_route_with( + "/", + get_with(controllers::get_blockchain_info, |op| { + op.response::<200, Json>() + }), + taged("blockchain"), + ) } diff --git a/src/api/router/events.rs b/src/api/router/events.rs index 59b7205..5289874 100644 --- a/src/api/router/events.rs +++ b/src/api/router/events.rs @@ -1,14 +1,40 @@ -use axum::{ - routing::{get, post}, - Router, -}; +use aide::axum::{routing::get_with, routing::post_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{ + controllers, + responses::{MarkEventsResponse, TonEventsResponse, TransactionEventResponse}, + taged, ApiContext, +}; -pub fn router() -> Router { - Router::new() - .route("/", post(controllers::post_events)) - .route("/mark", post(controllers::post_events_mark)) - .route("/mark/all", post(controllers::post_events_mark_all)) - .route("/id/:id", get(controllers::get_events_id)) +pub fn router() -> ApiRouter { + ApiRouter::new() + .api_route_with( + "/", + post_with(controllers::post_events, |op| { + op.response::<200, Json>() + }), + taged("events"), + ) + .api_route_with( + "/mark", + post_with(controllers::post_events_mark, |op| { + op.response::<200, Json>() + }), + taged("events"), + ) + .api_route_with( + "/mark/all", + post_with(controllers::post_events_mark_all, |op| { + op.response::<200, Json>() + }), + taged("events"), + ) + .api_route_with( + "/id/:id", + get_with(controllers::get_events_id, |op| { + op.response::<200, Json>() + }), + taged("events"), + ) } diff --git a/src/api/router/misc.rs b/src/api/router/misc.rs index 45ac366..7bbff04 100644 --- a/src/api/router/misc.rs +++ b/src/api/router/misc.rs @@ -1,22 +1,64 @@ -use axum::{routing::post, Router}; +use aide::axum::{routing::post_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{ + controllers, + responses::{ + EncodedCellResponse, ReadContractResponse, ResubscribeResponse, SetCallbackResponse, + SignedMessageHashResponse, TransactionResponse, UnsignedMessageHashResponse, + }, + taged, ApiContext, +}; -pub fn router() -> Router { - Router::new() - .route("/callback", post(controllers::post_set_callback)) - .route("/read-contract", post(controllers::post_read_contract)) - .route("/encode-into-cell", post(controllers::post_encode_tvm_cell)) - .route( +pub fn router() -> ApiRouter { + ApiRouter::new() + .api_route_with( + "/callback", + post_with(controllers::post_set_callback, |op| { + op.response::<200, Json>() + }), + taged("misc"), + ) + .api_route_with( + "/read-contract", + post_with(controllers::post_read_contract, |op| { + op.response::<200, Json>() + }), + taged("misc"), + ) + .api_route_with( + "/encode-into-cell", + post_with(controllers::post_encode_tvm_cell, |op| { + op.response::<200, Json>() + }), + taged("misc"), + ) + .api_route_with( "/prepare-message", - post(controllers::post_prepare_generic_message), + post_with(controllers::post_prepare_generic_message, |op| { + op.response::<200, Json>() + }), + taged("misc"), ) - .route( + .api_route_with( "/send-signed-message", - post(controllers::post_send_signed_message), + post_with(controllers::post_send_signed_message, |op| { + op.response::<200, Json>() + }), + taged("misc"), ) - .route( + .api_route_with( "/send-message", - post(controllers::post_send_generic_message), + post_with(controllers::post_send_generic_message, |op| { + op.response::<200, Json>() + }), + taged("misc"), + ) + .api_route_with( + "/refresh-all-accounts-subscriptions", + post_with(controllers::post_resubscribe_for_all_accounts, |op| { + op.response::<200, Json>() + }), + taged("misc"), ) } diff --git a/src/api/router/mod.rs b/src/api/router/mod.rs index 164d8a1..677acfa 100644 --- a/src/api/router/mod.rs +++ b/src/api/router/mod.rs @@ -1,12 +1,8 @@ -use std::convert::Infallible; use std::sync::Arc; use std::time::Duration; -use axum::response::IntoResponse; -use axum::routing::get_service; -use axum::{Extension, Router}; +use aide::axum::ApiRouter; use metrics::{describe_gauge, gauge}; -use tower::service_fn; use tower_http::metrics::InFlightRequestsLayer; use crate::api::*; @@ -26,7 +22,7 @@ pub fn router( auth_service: Arc, ton_service: Arc, memory_storage: Arc, -) -> Router { +) -> ApiRouter { describe_gauge!("in_flight_requests", "number of inflight requests"); let (in_flight_requests_layer, counter) = InFlightRequestsLayer::pair(); tokio::spawn(async { @@ -37,29 +33,12 @@ pub fn router( .await; }); - Router::new() - .nest( + aide::axum::ApiRouter::new() + .nest_api_service("/docs", docs::route()) + .nest_api_service( API_PREFIX, api_router(auth_service, ton_service, memory_storage), ) - .route( - "/", - get_service(service_fn(|_: _| async move { - Ok::<_, Infallible>( - controllers::swagger(&format!("https://tonapi.broxus.com{}", API_PREFIX)) - .into_response(), - ) - })), - ) - .route( - "/swagger.yaml", - get_service(service_fn(|_: _| async move { - Ok::<_, Infallible>( - controllers::swagger(&format!("https://tonapi.broxus.com{}", API_PREFIX)) - .into_response(), - ) - })), - ) .layer(in_flight_requests_layer) } @@ -67,8 +46,8 @@ fn api_router( auth_service: Arc, ton_service: Arc, memory_storage: Arc, -) -> Router { - Router::new() +) -> ApiRouter { + aide::axum::ApiRouter::new() .nest("/blockchain", blockchain::router()) .nest("/address", address::router()) .nest("/events", events::router()) @@ -79,8 +58,8 @@ fn api_router( .layer(axum::middleware::from_fn(move |req, next| { controllers::verify_auth(req, next, auth_service.clone()) })) - .layer(Extension(Arc::new(ApiContext { + .with_state(ApiContext { ton_service, memory_storage, - }))) + }) } diff --git a/src/api/router/tokens.rs b/src/api/router/tokens.rs index 2bd5656..7b98852 100644 --- a/src/api/router/tokens.rs +++ b/src/api/router/tokens.rs @@ -1,37 +1,86 @@ -use axum::{ - routing::{get, post}, - Router, -}; +use aide::axum::{routing::get_with, routing::post_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{ + controllers, + responses::{ + CheckedAddressResponse, MarkTokenEventsResponse, TokenBalanceResponse, + TokenTransactionResponse, TokenWhitelistResponse, TonTokenEventsResponse, + TransactionResponse, + }, + taged, ApiContext, +}; -pub fn router() -> Router { - Router::new() - .route( +pub fn router() -> ApiRouter { + ApiRouter::new() + .api_route_with( + "/check", + post_with(controllers::post_address_check, |op| { + op.response::<200, Json>() + }), + taged("tokens"), + ) + .api_route_with( "/address/:address", - get(controllers::get_token_address_balance), + get_with(controllers::get_token_address_balance, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route( + .api_route_with( "/transactions/id/:internal_id", - get(controllers::get_tokens_transactions_id), + get_with(controllers::get_tokens_transactions_id, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route( + .api_route_with( "/transactions/mh/:message_hash", - get(controllers::get_tokens_transactions_mh), + get_with(controllers::get_tokens_transactions_mh, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route( + .api_route_with( "/transactions/create", - post(controllers::post_tokens_transactions_create), + post_with(controllers::post_tokens_transactions_create, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route( + .api_route_with( "/transactions/burn", - post(controllers::post_tokens_transactions_burn), + post_with(controllers::post_tokens_transactions_burn, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route( + .api_route_with( "/transactions/mint", - post(controllers::post_tokens_transactions_mint), + post_with(controllers::post_tokens_transactions_mint, |op| { + op.response::<200, Json>() + }), + taged("tokens"), + ) + .api_route_with( + "/events", + post_with(controllers::post_tokens_events, |op| { + op.response::<200, Json>() + }), + taged("tokens"), + ) + .api_route_with( + "/events/mark", + post_with(controllers::post_tokens_events_mark, |op| { + op.response::<200, Json>() + }), + taged("tokens"), + ) + .api_route_with( + "/whitelist", + get_with(controllers::get_token_whitelist, |op| { + op.response::<200, Json>() + }), + taged("tokens"), ) - .route("/events", post(controllers::post_tokens_events)) - .route("/events/mark", post(controllers::post_tokens_events_mark)) - .route("/whitelist", get(controllers::get_token_whitelist)) } diff --git a/src/api/router/ton_metrics.rs b/src/api/router/ton_metrics.rs index bbcb19f..0a5923a 100644 --- a/src/api/router/ton_metrics.rs +++ b/src/api/router/ton_metrics.rs @@ -1,7 +1,14 @@ -use axum::{routing::get, Router}; +use aide::axum::{routing::get_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{controllers, responses::MetricsResponse, taged, ApiContext}; -pub fn router() -> Router { - Router::new().route("/", get(controllers::get_ton_metrics)) +pub fn router() -> ApiRouter { + ApiRouter::new().api_route_with( + "/", + get_with(controllers::get_ton_metrics, |op| { + op.response::<200, Json>() + }), + taged("metrics"), + ) } diff --git a/src/api/router/transactions.rs b/src/api/router/transactions.rs index e3eaaaa..8d5c87a 100644 --- a/src/api/router/transactions.rs +++ b/src/api/router/transactions.rs @@ -1,16 +1,54 @@ -use axum::{ - routing::{get, post}, - Router, -}; +use aide::axum::{routing::get_with, routing::post_with, ApiRouter}; +use axum::Json; -use crate::api::controllers; +use crate::api::{ + controllers, + responses::{TonTransactionsResponse, TransactionResponse}, + taged, ApiContext, +}; -pub fn router() -> Router { - Router::new() - .route("/", post(controllers::post_transactions)) - .route("/create", post(controllers::post_transactions_create)) - .route("/confirm", post(controllers::post_transactions_confirm)) - .route("/id/:id", get(controllers::get_transactions_id)) - .route("/h/:hash", get(controllers::get_transactions_h)) - .route("/mh/:message_hash", get(controllers::get_transactions_mh)) +pub fn router() -> ApiRouter { + ApiRouter::new() + .api_route_with( + "/", + post_with(controllers::post_transactions, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) + .api_route_with( + "/create", + post_with(controllers::post_transactions_create, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) + .api_route_with( + "/confirm", + post_with(controllers::post_transactions_confirm, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) + .api_route_with( + "/id/:id", + get_with(controllers::get_transactions_id, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) + .api_route_with( + "/h/:hash", + get_with(controllers::get_transactions_h, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) + .api_route_with( + "/mh/:message_hash", + get_with(controllers::get_transactions_mh, |op| { + op.response::<200, Json>() + }), + taged("transactions"), + ) } diff --git a/src/client/callback/mod.rs b/src/client/callback/mod.rs index 6c60a49..d60fe89 100644 --- a/src/client/callback/mod.rs +++ b/src/client/callback/mod.rs @@ -1,8 +1,7 @@ use anyhow::Result; use chrono::Utc; -use http::Method; use nekoton_utils::TrustMe; -use reqwest::Url; +use reqwest::{Method, StatusCode, Url}; use crate::models::*; @@ -33,7 +32,7 @@ impl CallbackClient { payload: AccountTransactionEvent, secret: String, ) -> Result<()> { - let nonce = Utc::now().naive_utc().timestamp() * 1000; + let nonce = Utc::now().naive_utc().and_utc().timestamp() * 1000; let body = serde_json::to_string(&payload)?; @@ -51,7 +50,7 @@ impl CallbackClient { .send() .await?; - if res.status() != http::StatusCode::OK { + if res.status() != StatusCode::OK { anyhow::bail!(format!( "Received status is not 200. Payload: {:#?}. Receive: {:?}.", payload, res diff --git a/src/client/ton/mod.rs b/src/client/ton/mod.rs index e6ee5b9..47f66b7 100644 --- a/src/client/ton/mod.rs +++ b/src/client/ton/mod.rs @@ -1,9 +1,10 @@ -use std::sync::atomic::Ordering; +use std::str::FromStr; use std::sync::Arc; +use anyhow::anyhow; +use axum::http::StatusCode; use bigdecimal::{BigDecimal, ToPrimitive}; use ed25519_dalek::{Keypair, PublicKey, SecretKey, Signer}; -use http::StatusCode; use nekoton::core::models::Expiration; use nekoton::core::ton_wallet::multisig::DeployParams; use nekoton::core::ton_wallet::{MultisigType, TransferAction}; @@ -16,6 +17,8 @@ use num_traits::FromPrimitive; use tokio::sync::oneshot; use ton_block::{GetRepresentationHash, MsgAddressInt}; use ton_types::{deserialize_tree_of_cells, SliceData, UInt256}; +use tycho_types::cell::HashBytes; +use tycho_types::models::StdAddr; use uuid::Uuid; use crate::api::*; @@ -49,16 +52,15 @@ impl TonClient { .await? .into_iter() .map(|item| { - nekoton_utils::repack_address(&format!("{}:{}", item.workchain_id, item.hex)) - .trust_me() + StdAddr::from_str(&format!("{}:{}", item.workchain_id, item.hex)).trust_me() }) - .collect::>(); + .collect::>(); // Subscribe to ton accounts let owner_accounts = owner_addresses .iter() - .map(|item| UInt256::from_be_bytes(&item.address().get_bytestring(0))) - .collect::>(); + .map(|item| item.address) + .collect::>(); self.ton_core.add_ton_account_subscription(owner_accounts); @@ -66,7 +68,9 @@ impl TonClient { } pub async fn create_address(&self, payload: CreateAddress) -> Result { - let generated_key = nekoton::crypto::generate_key(nekoton::crypto::MnemonicType::Labs(0)); + let generated_key = nekoton::crypto::generate_key(nekoton::crypto::MnemonicType::Bip39( + nekoton::crypto::Bip39MnemonicData::labs_old(0), + )); let Keypair { public, secret } = nekoton::crypto::derive_from_phrase( &generated_key.words.join(" "), @@ -150,7 +154,8 @@ impl TonClient { }; // Subscribe to accounts - let account = UInt256::from_be_bytes(&hex::decode(address.address().to_hex_string())?); + let account = HashBytes::from_str(&address.address().to_hex_string()) + .map_err(|_| anyhow!("Couldn't parse address"))?; self.ton_core.add_ton_account_subscription([account]); Ok(CreatedAddress { @@ -273,7 +278,6 @@ impl TonClient { ) -> Result<(SentTransaction, SignedMessage), Error> { let original_value = transaction.outputs.iter().map(|o| o.value.clone()).sum(); let original_outputs = serde_json::to_value(transaction.outputs.clone())?; - let bounce = transaction.bounce.unwrap_or_default(); let public_key = PublicKey::from_bytes(public_key)?; @@ -301,7 +305,10 @@ impl TonClient { for item in transaction.outputs { let flags = item.output_type.unwrap_or_default(); let destination = nekoton_utils::repack_address(&item.recipient_address.0)?; - let amount = item.value.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let amount = item + .value + .to_u128() + .ok_or(TonClientError::ParseBigDecimal)?; let body = payload_cell .as_ref() .map(|c| SliceData::load_cell(c.clone())) @@ -316,7 +323,6 @@ impl TonClient { state_init: None, }); } - nekoton::core::ton_wallet::highload_wallet_v2::prepare_transfer( &SimpleClock, &public_key, @@ -333,11 +339,10 @@ impl TonClient { .outputs .first() .ok_or(TonClientError::RecipientNotFound)?; - let destination = nekoton_utils::repack_address(&recipient.recipient_address.0)?; let amount = recipient .value - .to_u64() + .to_u128() .ok_or(TonClientError::ParseBigDecimal)?; let flags = recipient.output_type.clone().unwrap_or_default(); let body = payload_cell.map(SliceData::load_cell).transpose()?; @@ -350,13 +355,11 @@ impl TonClient { body, state_init: None, }]; - let seqno_offset = nekoton::core::ton_wallet::wallet_v3::estimate_seqno_offset( &SimpleClock, ¤t_state, &[], ); - nekoton::core::ton_wallet::wallet_v3::prepare_transfer( &SimpleClock, &public_key, @@ -371,14 +374,12 @@ impl TonClient { .outputs .first() .ok_or(TonClientError::RecipientNotFound)?; - let destination = nekoton_utils::repack_address(&recipient.recipient_address.0)?; let amount = recipient .value - .to_u64() + .to_u128() .ok_or(TonClientError::ParseBigDecimal)?; let flags = recipient.output_type.clone().unwrap_or_default(); - let has_multiple_owners = match custodians { Some(custodians) => *custodians > 1, None => return Err(TonClientError::CustodiansNotFound.into()), @@ -394,7 +395,6 @@ impl TonClient { body, state_init: None, }; - nekoton::core::ton_wallet::multisig::prepare_transfer( &SimpleClock, MultisigType::SafeMultisigWallet, @@ -413,12 +413,14 @@ impl TonClient { for item in transaction.outputs { let flags = item.output_type.unwrap_or_default(); let destination = nekoton_utils::repack_address(&item.recipient_address.0)?; - let amount = item.value.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let amount = item + .value + .to_u128() + .ok_or(TonClientError::ParseBigDecimal)?; let body = payload_cell .as_ref() .map(|c| SliceData::load_cell(c.clone())) .transpose()?; - gifts.push(nekoton::core::ton_wallet::Gift { flags: flags.into(), bounce, @@ -428,7 +430,6 @@ impl TonClient { state_init: None, }); } - nekoton::core::ton_wallet::ever_wallet::prepare_transfer( &SimpleClock, &public_key, @@ -439,26 +440,22 @@ impl TonClient { )? } }; - let unsigned_message = match transfer_action { TransferAction::Sign(unsigned_message) => unsigned_message, TransferAction::DeployFirst => { return Err(TonClientError::AccountNotDeployed(address.to_string()).into()) } }; - let key_pair = Keypair { secret: SecretKey::from_bytes(private_key)?, public: public_key, }; - let data_to_sign = ton_abi::extend_signature_with_id( unsigned_message.hash(), self.ton_core.signature_id(), ); let signature = key_pair.sign(&data_to_sign); let signed_message = unsigned_message.sign(&signature.to_bytes())?; - let sent_transaction = SentTransaction { id: transaction.id, message_hash: signed_message.message.hash()?.to_hex_string(), @@ -469,7 +466,6 @@ impl TonClient { aborted: false, bounce, }; - Ok((sent_transaction, signed_message)) } @@ -592,7 +588,7 @@ impl TonClient { let (value, _) = input.value.clone().as_bigint_and_exponent(); let tokens = value.to_biguint().ok_or(TonClientError::ParseBigUint)?; - let attached_amount = input.fee.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let attached_amount = input.fee.to_u128().ok_or(TonClientError::ParseBigDecimal)?; // parse input payload let payload_cell = match &input.payload { @@ -663,7 +659,7 @@ impl TonClient { let (value, _) = input.value.clone().as_bigint_and_exponent(); let tokens = value.to_biguint().ok_or(TonClientError::ParseBigUint)?; - let attached_amount = input.fee.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let attached_amount = input.fee.to_u128().ok_or(TonClientError::ParseBigDecimal)?; let internal_message = prepare_token_burn( owner.clone(), @@ -723,7 +719,7 @@ impl TonClient { None => owner.clone(), }; - let attached_amount = input.fee.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let attached_amount = input.fee.to_u128().ok_or(TonClientError::ParseBigDecimal)?; let internal_message = prepare_token_mint( owner.clone(), @@ -787,24 +783,18 @@ impl TonClient { let gen_utime = self.ton_core.current_utime(); let network_id = match () { - _ if cfg!(feature = "venom") => VENOM_CHAIN_ID, - _ if cfg!(feature = "ton") => TON_CHAIN_ID, - _ => EVER_CHAIN_ID, + _ => TYCHO_TESTNET_CHAIN_ID, }; let subscriber_metrics = self.ton_core.context.ton_subscriber.metrics(); - let indexer_metrics = self.ton_core.context.ton_engine.metrics(); - - let last_mc_block_seqno = indexer_metrics.last_mc_block_seqno.load(Ordering::Acquire); - let mc_time_diff = indexer_metrics.mc_time_diff.load(Ordering::Acquire); Ok(BlockchainInfo { network_id, synced: subscriber_metrics.ready, subscriber_pending_messages: subscriber_metrics.pending_message_count, tip_block_ts: gen_utime, - masterchain_height: last_mc_block_seqno, - masterchain_last_updated: mc_time_diff, + masterchain_height: 0, + masterchain_last_updated: 0, }) } @@ -820,15 +810,15 @@ impl TonClient { let state = match self.ton_core.get_contract_state(&contract_address) { Ok(a) => a, Err(e) => { - log::error!("Failed to get contract state: {e:?}"); + tracing::error!("Failed to get contract state: {e:?}"); return Ok(None); } }; let res = if responsible { - function.run_local_responsible(&SimpleClock, state.account, input) + function.run_local_responsible(&SimpleClock, state.account, input, &[]) } else { - function.run_local(&SimpleClock, state.account, input) + function.run_local(&SimpleClock, state.account, input, &[]) }; res.map(Some) @@ -906,7 +896,7 @@ impl TonClient { let body = function_data.map(SliceData::load_builder).transpose()?; let destination = nekoton_utils::repack_address(target_addr)?; - let amount = value.to_u64().ok_or(TonClientError::ParseBigDecimal)?; + let amount = value.to_u128().ok_or(TonClientError::ParseBigDecimal)?; let transfer_action = match account_type { AccountType::Wallet => { let account = UInt256::from_be_bytes(&address.address().get_bytestring(0)); @@ -1016,8 +1006,16 @@ impl TonClient { } pub fn add_ton_account_subscription(&self, account: UInt256) { + let account = HashBytes::from_slice(account.as_slice()); self.ton_core.add_ton_account_subscription([account]) } + + pub fn add_ton_account_subscriptions(&self, accounts: I) + where + I: Iterator, + { + self.ton_core.add_ton_account_subscription(accounts) + } } #[derive(thiserror::Error, Debug)] @@ -1198,6 +1196,4 @@ fn build_token_transaction( Ok((sent_transaction, signed_message)) } -const EVER_CHAIN_ID: i32 = 42; -const VENOM_CHAIN_ID: i32 = 1; -const TON_CHAIN_ID: i32 = -239; +const TYCHO_TESTNET_CHAIN_ID: i32 = -4000; diff --git a/src/cmd/run.rs b/src/cmd/run.rs new file mode 100644 index 0000000..1c63b99 --- /dev/null +++ b/src/cmd/run.rs @@ -0,0 +1,214 @@ +use std::net::SocketAddr; +use std::path::PathBuf; + +use anyhow::{Context, Result}; +use clap::Parser; +use serde::{Deserialize, Serialize}; +use tycho_core::block_strider::ShardStateApplier; + +use tycho_core::block_strider::MetricsSubscriber; +use tycho_core::block_strider::{BlockProviderExt, ColdBootType}; +use tycho_core::blockchain_rpc::NoopBroadcastListener; +use tycho_core::global_config::GlobalConfig; +use tycho_core::node::{NodeBase, NodeBaseConfig, NodeBootArgs, NodeKeys}; +use tycho_util::cli; +use tycho_util::cli::config::ThreadPoolConfig; +use tycho_util::cli::logger::LoggerConfig; +use tycho_util::cli::metrics::MetricsConfig; +use tycho_util::config::PartialConfig; +use tycho_util::futures::JoinTask; +use tycho_util::serde_helpers::{load_json_from_file, save_json_to_file}; + +use tycho_wallet_api::api::Api; +use tycho_wallet_api::server::*; +use tycho_wallet_api::settings::*; + +#[derive(Parser)] +pub struct Cmd { + /// dump the node config template + #[clap( + short = 'i', + long, + conflicts_with_all = ["config", "global_config", "keys", "logger_config", "import_zerostate", "cold_boot"] + )] + pub init_config: Option, + + #[clap( + long, + short, + conflicts_with_all = ["config", "global_config", "keys", "logger_config", "import_zerostate", "cold_boot"] + )] + pub all: bool, + + /// overwrite the existing config + #[clap(short, long)] + pub force: bool, + + /// path to the node config + #[clap(long, required_unless_present = "init_config")] + pub config: Option, + + /// path to the global config + #[clap(long, required_unless_present = "init_config")] + pub global_config: Option, + + /// path to node keys + #[clap(long, required_unless_present = "init_config")] + pub keys: Option, + + /// path to the logger config + #[clap(long)] + pub logger_config: Option, + + /// list of zerostate files to import + #[clap(long)] + pub import_zerostate: Option>, + + /// Overwrite cold boot type. Default: `latest-persistent` + #[clap(long)] + pub cold_boot: Option, +} + +impl Cmd { + pub fn run(self) -> Result<()> { + std::panic::set_hook(Box::new(|info| { + use std::io::Write; + let backtrace = std::backtrace::Backtrace::capture(); + + tracing::error!("{info}\n{backtrace}"); + std::io::stderr().flush().ok(); + std::io::stdout().flush().ok(); + std::process::exit(1); + })); + + if let Some(config_path) = self.init_config { + if config_path.exists() && !self.force { + anyhow::bail!("config file already exists, use --force to overwrite"); + } + + let config = NodeConfig::default(); + return if self.all { + save_json_to_file(config, config_path) + } else { + save_json_to_file(config.into_partial(), config_path) + }; + } + + let node_config: NodeConfig = + load_json_from_file(self.config.as_ref().context("no config")?) + .context("failed to load node config")?; + + cli::logger::init_logger(&node_config.logger_config, self.logger_config.clone())?; + cli::logger::set_abort_with_tracing(); + + node_config.threads.init_reclaimer().unwrap(); + node_config.threads.init_global_rayon_pool().unwrap(); + node_config + .threads + .build_tokio_runtime()? + .block_on(cli::signal::run_or_terminate(self.run_impl(node_config))) + } + + async fn run_impl(self, node_config: NodeConfig) -> Result<()> { + if let Some(metrics) = &node_config.metrics { + tycho_util::cli::metrics::init_metrics(metrics)?; + } + + // Build node. + let keys = NodeKeys::load_or_create(self.keys.unwrap())?; + let global_config = GlobalConfig::from_file(self.global_config.unwrap()) + .context("failed to load global config")?; + let public_ip = cli::resolve_public_ip(node_config.base.public_ip).await?; + let public_addr = SocketAddr::new(public_ip, node_config.base.port); + + let node = NodeBase::builder(&node_config.base, &global_config) + .init_network(public_addr, &keys.as_secret())? + .init_storage() + .await? + .init_blockchain_rpc(NoopBroadcastListener, NoopBroadcastListener)? + .build()?; + + let context = EngineContext::new( + node_config.api, + node.core_storage.clone(), + node.blockchain_rpc_client.clone(), + ) + .await?; + + // Sync node. + node.wait_for_neighbours(3).await; + + let boot_type = self.cold_boot.unwrap_or(ColdBootType::LatestPersistent); + let init_block_id = node + .boot_ext(NodeBootArgs { + boot_type, + zerostates: self.import_zerostate, + queue_state_handler: None, + ignore_states: false, + }) + .await?; + tracing::info!(%init_block_id, "node initialized"); + node.update_validator_set_from_shard_state(&init_block_id) + .await?; + + // Build strider. + let archive_block_provider = node.build_archive_block_provider(); + let storage_block_provider = node.build_storage_block_provider(); + let blockchain_block_provider = node + .build_blockchain_block_provider() + .with_fallback(archive_block_provider.clone()); + + let block_strider = node.build_strider( + archive_block_provider.chain((blockchain_block_provider, storage_block_provider)), + ( + ShardStateApplier::new(node.core_storage.clone(), context.clone()), + MetricsSubscriber, + ), + ); + + context + .start(&init_block_id) + .await + .context("failed to start context")?; + + let api = Api::bind( + context.config.server_addr, + context.config.public_url.clone(), + context.config.api_metrics_addr, + context.auth_service.clone(), + context.ton_service.clone(), + context.memory_storage.clone(), + ) + .await + .context("failed to bind API service")?; + tracing::info!("created api"); + // Start API + let api_fut = JoinTask::new(api.serve()); + + // Run block strider + tracing::info!("block strider started"); + tokio::select! { + res = block_strider.run() => res?, + res = api_fut => res? + } + tracing::info!("block strider finished"); + + Ok(()) + } +} + +#[derive(Default, Debug, Clone, Serialize, Deserialize, PartialConfig)] +#[serde(default)] +struct NodeConfig { + #[partial] + #[serde(flatten)] + base: NodeBaseConfig, + #[important] + threads: ThreadPoolConfig, + #[important] + logger_config: LoggerConfig, + #[important] + metrics: Option, + #[important] + api: AppConfig, +} diff --git a/src/lib.rs b/src/lib.rs index cf0fd37..cd54b1f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -2,6 +2,8 @@ #![allow(clippy::too_many_arguments)] #![allow(clippy::inconsistent_struct_constructor)] +use std::sync::OnceLock; + pub mod api; pub mod client; pub mod commands; @@ -13,3 +15,11 @@ pub mod settings; pub mod sqlx_client; pub mod ton_core; pub mod utils; + +pub static BIN_VERSION: &str = "TYCHO_WALLET_API_VERSION"; +pub static BIN_BUILD: &str = "TYCHO_WALLET_API_BUILD"; + +pub fn version_string() -> &'static str { + static STRING: OnceLock = OnceLock::new(); + STRING.get_or_init(|| format!("(release {BIN_VERSION}) (build {BIN_BUILD})")) +} diff --git a/src/main.rs b/src/main.rs index 3575510..698b592 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,157 +1,127 @@ -use std::sync::Arc; +use std::process::ExitCode; -use anyhow::{Context, Result}; -use argh::FromArgs; -use tokio::sync::mpsc; +use anyhow::Result; +use clap::Args; +use clap::{Parser, Subcommand}; +use tycho_wallet_api::commands::*; -use ton_wallet_api::commands::*; -use ton_wallet_api::server::*; -use ton_wallet_api::settings::*; +mod cmd { + pub mod run; +} #[global_allocator] -static GLOBAL: broxus_util::alloc::Allocator = broxus_util::alloc::allocator(); +static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; -#[tokio::main] -async fn main() -> Result<()> { - run(argh::from_env()).await -} +#[allow(clippy::print_stderr)] +fn main() -> ExitCode { + if std::env::var("RUST_BACKTRACE").is_err() { + // Enable backtraces on panics by default. + std::env::set_var("RUST_BACKTRACE", "1"); + } + if std::env::var("RUST_LIB_BACKTRACE").is_err() { + // Disable backtraces in libraries by default + std::env::set_var("RUST_LIB_BACKTRACE", "0"); + } -async fn run(app: App) -> Result<()> { - match app.command { - Subcommand::Server(run) => { - let config: AppConfig = broxus_util::read_config(&run.config)?; - run.execute(config).await + match App::parse().run() { + Ok(()) => ExitCode::SUCCESS, + Err(err) => { + eprintln!("Error: {err:?}"); + ExitCode::FAILURE } - Subcommand::RootToken(run) => run.execute().await, - Subcommand::ApiService(run) => run.execute().await, - Subcommand::Salt(run) => run.execute().await, } } -#[derive(Debug, FromArgs)] -#[argh(description = "")] -struct App { - #[argh(subcommand)] - command: Subcommand, +#[derive(Parser)] +#[clap(version = tycho_wallet_api::version_string())] +#[clap(subcommand_required = true)] +pub struct App { + #[clap(subcommand)] + cmd: SubCmd, +} + +impl App { + pub fn run(self) -> Result<()> { + match self.cmd { + SubCmd::Server(cmd) => cmd.run(), + SubCmd::RootToken(cmd) => cmd.run(), + SubCmd::ApiService(cmd) => cmd.run(), + SubCmd::Salt(cmd) => cmd.run(), + } + } } -#[derive(Debug, FromArgs)] -#[argh(subcommand)] -enum Subcommand { - Server(CmdServer), +#[derive(Subcommand)] +enum SubCmd { + Server(cmd::run::Cmd), RootToken(CmdRootToken), ApiService(CmdApiService), Salt(CmdSalt), } -#[derive(Debug, FromArgs)] -/// Starts relay node -#[argh(subcommand, name = "server")] -struct CmdServer { - /// path to config file ('config.yaml' by default) - #[argh(option, short = 'c', default = "String::from(\"config.yaml\")")] - config: String, - - /// path to global config file - #[argh(option, short = 'g')] - global_config: String, -} - -impl CmdServer { - async fn execute(self, config: AppConfig) -> Result<()> { - let ton_wallet_api = Arc::new(TonWalletApi { - engine: Default::default(), - }); - - let global_config = ton_indexer::GlobalConfig::from_file(&self.global_config) - .context("Failed to open global config")?; - - broxus_util::init_logger(&config.logger_settings).context("Failed to init logger")?; - - log::info!("Initializing ton-wallet-api..."); - let mut shutdown_requests_rx = ton_wallet_api.init(config, global_config).await?; - log::info!("Initialized ton-wallet-api"); - - shutdown_requests_rx.recv().await; - Ok(()) - } -} - -#[derive(Debug, FromArgs)] -/// Add root token address -#[argh(subcommand, name = "root_token")] +#[derive(Args, Clone)] struct CmdRootToken { /// root token name - #[argh(option, short = 'n')] - name: String, + #[clap(short, long)] + pub name: String, /// root token address - #[argh(option, short = 'a')] - address: String, + #[clap(short, long)] + pub address: String, /// root token version - #[argh(option, short = 'v')] - version: String, + #[clap(short, long)] + pub version: String, } impl CmdRootToken { - async fn execute(self) -> Result<()> { - add_root_token(self.name, self.address, self.version).await + fn run(self) -> Result<()> { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .worker_threads(2) + .build()? + .block_on(add_root_token(self.name, self.address, self.version)) } } -#[derive(Debug, FromArgs)] -/// Create a new api service -#[argh(subcommand, name = "api_service")] +#[derive(Args, Clone)] struct CmdApiService { /// service id - #[argh(option, short = 'i')] + #[clap(short = 'i')] id: Option, /// service name - #[argh(option, short = 'n')] + #[clap(short = 'n')] name: String, /// service key - #[argh(option, short = 'k')] + #[clap(short = 'k')] key: String, /// service secret - #[argh(option, short = 's')] + #[clap(short = 's')] secret: String, } impl CmdApiService { - async fn execute(self) -> Result<()> { - create_api_service(self.id, self.name, self.key, self.secret).await + fn run(self) -> Result<()> { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .worker_threads(2) + .build()? + .block_on(create_api_service( + self.id, + self.name, + self.key, + self.secret, + )) } } -#[derive(Debug, FromArgs)] -/// Create a new api service -#[argh(subcommand, name = "salt")] +#[derive(Args, Clone)] struct CmdSalt {} impl CmdSalt { - async fn execute(self) -> Result<()> { - generate_salt().await - } -} - -struct TonWalletApi { - engine: tokio::sync::Mutex>>, -} - -impl TonWalletApi { - async fn init( - &self, - config: AppConfig, - global_config: ton_indexer::GlobalConfig, - ) -> Result { - let (shutdown_requests_tx, shutdown_requests_rx) = mpsc::unbounded_channel(); - - let engine = Engine::new(config, global_config, shutdown_requests_tx) - .await - .context("Failed to create engine")?; - *self.engine.lock().await = Some(engine.clone()); - - engine.start().await.context("Failed to start engine")?; - - Ok(shutdown_requests_rx) + fn run(self) -> Result<()> { + tokio::runtime::Builder::new_multi_thread() + .enable_all() + .worker_threads(2) + .build()? + .block_on(generate_salt()) } } diff --git a/src/models/account_enums.rs b/src/models/account_enums.rs index 991fd78..5b00ca4 100644 --- a/src/models/account_enums.rs +++ b/src/models/account_enums.rs @@ -1,17 +1,16 @@ use std::str::FromStr; use nekoton::core::models::TokenWalletVersion; -use nekoton_utils::pack_std_smc_addr; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use strum_macros::EnumString; -use ton_block::{AccountState, MsgAddressInt}; +use tycho_types::models::{AccountState, StdAddr}; use crate::models::{Address, AddressDb}; #[derive( - Debug, Default, Deserialize, Serialize, Clone, opg::OpgModel, Eq, PartialEq, sqlx::Type, Copy, + Debug, Default, Deserialize, Serialize, Clone, JsonSchema, Eq, PartialEq, sqlx::Type, Copy, )] -#[opg("AccountType")] #[sqlx(type_name = "twa_account_type", rename_all = "PascalCase")] pub enum AccountType { #[default] @@ -21,8 +20,7 @@ pub enum AccountType { EverWallet, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, sqlx::Type, Eq, PartialEq)] -#[opg("AccountStatus")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, sqlx::Type, Eq, PartialEq)] #[sqlx(type_name = "twa_account_status", rename_all = "PascalCase")] pub enum AccountStatus { Active, @@ -33,17 +31,26 @@ pub enum AccountStatus { impl From for AccountStatus { fn from(state: AccountState) -> Self { match state { - AccountState::AccountUninit => AccountStatus::UnInit, - AccountState::AccountActive { .. } => AccountStatus::Active, - AccountState::AccountFrozen { .. } => AccountStatus::Frozen, + AccountState::Uninit => AccountStatus::UnInit, + AccountState::Active(_) => AccountStatus::Active, + AccountState::Frozen(_) => AccountStatus::Frozen, + } + } +} + +impl From for AccountStatus { + fn from(state: ton_block::AccountState) -> Self { + match state { + ton_block::AccountState::AccountUninit => AccountStatus::UnInit, + ton_block::AccountState::AccountActive { .. } => AccountStatus::Active, + ton_block::AccountState::AccountFrozen { .. } => AccountStatus::Frozen, } } } #[derive( - Debug, Deserialize, Serialize, Clone, opg::OpgModel, Eq, PartialEq, sqlx::Type, Copy, EnumString, + Debug, Deserialize, Serialize, Clone, JsonSchema, Eq, PartialEq, sqlx::Type, Copy, EnumString, )] -#[opg("TokenWalletVersion")] #[sqlx(type_name = "twa_token_wallet_version", rename_all = "PascalCase")] pub enum TokenWalletVersionDb { OldTip3v4, @@ -68,9 +75,8 @@ impl From for TokenWalletVersion { } } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel)] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("Account")] pub struct Account { pub workchain_id: i32, pub hex: Address, @@ -79,8 +85,8 @@ pub struct Account { impl From for Account { fn from(a: AddressDb) -> Self { - let account = MsgAddressInt::from_str(&format!("{}:{}", a.workchain_id, a.hex)).unwrap(); - let base64url = Address(pack_std_smc_addr(true, &account, true).unwrap()); + let account = StdAddr::from_str(&format!("{}:{}", a.workchain_id, a.hex)).unwrap(); + let base64url = Address(account.display_base64_url(true).to_string()); Self { workchain_id: a.workchain_id, hex: Address(a.hex), @@ -89,15 +95,13 @@ impl From for Account { } } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, PartialEq, Eq)] -#[opg("TonStatus")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq, Eq)] pub enum TonStatus { Ok, Error, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, PartialEq, Eq, sqlx::Type)] -#[opg("TonTransactionStatus")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq, Eq, sqlx::Type)] #[sqlx(type_name = "twa_transaction_status", rename_all = "PascalCase")] pub enum TonTransactionStatus { New, @@ -106,8 +110,7 @@ pub enum TonTransactionStatus { Error, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, PartialEq, Eq, sqlx::Type)] -#[opg("TonTransactionStatus")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq, Eq, sqlx::Type)] #[sqlx(type_name = "twa_token_transaction_status", rename_all = "PascalCase")] pub enum TonTokenTransactionStatus { New, @@ -125,8 +128,7 @@ impl From for TonTransactionStatus { } } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, PartialEq, Eq, sqlx::Type, Copy)] -#[opg("TonEventStatus")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq, Eq, sqlx::Type, Copy)] #[sqlx(type_name = "twa_transaction_event_status", rename_all = "PascalCase")] pub enum TonEventStatus { New, @@ -134,24 +136,21 @@ pub enum TonEventStatus { Error, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, PartialEq, Eq, sqlx::Type)] -#[opg("TonTransactionDirection")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema, PartialEq, Eq, sqlx::Type)] #[sqlx(type_name = "twa_transaction_direction", rename_all = "PascalCase")] pub enum TonTransactionDirection { Send, Receive, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel)] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema)] #[serde(rename_all = "lowercase")] -#[opg("AccountAddressType")] pub enum AccountAddressType { Internal, External, } -#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel)] -#[opg("TransactionSendOutputType")] +#[derive(Debug, Deserialize, Serialize, Clone, JsonSchema)] pub enum TransactionsSearchOrdering { CreatedAtAsc, CreatedAtDesc, @@ -161,8 +160,7 @@ pub enum TransactionsSearchOrdering { TransactionTimestampDesc, } -#[derive(Debug, Default, Deserialize, Serialize, Clone, Eq, PartialEq, opg::OpgModel)] -#[opg("TransactionSendOutputType")] +#[derive(Debug, Default, Deserialize, Serialize, Clone, Eq, PartialEq, JsonSchema)] pub enum TransactionSendOutputType { #[default] Normal, diff --git a/src/models/account_transaction_event.rs b/src/models/account_transaction_event.rs index f3fb2d1..d048bf8 100644 --- a/src/models/account_transaction_event.rs +++ b/src/models/account_transaction_event.rs @@ -1,16 +1,15 @@ use std::str::FromStr; use bigdecimal::BigDecimal; -use nekoton_utils::pack_std_smc_addr; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use ton_block::MsgAddressInt; +use tycho_types::models::StdAddr; use uuid::Uuid; use crate::models::*; -#[derive(Debug, Serialize, Deserialize, Clone, derive_more::Constructor, opg::OpgModel)] +#[derive(Debug, Serialize, Deserialize, Clone, derive_more::Constructor, JsonSchema)] #[serde(rename_all = "camelCase")] -#[opg("AccountTokenTransactionEventResponse")] pub struct AccountTransactionEvent { pub id: Uuid, pub transaction_id: Uuid, @@ -19,7 +18,6 @@ pub struct AccountTransactionEvent { pub owner_message_hash: Option, pub account: Account, pub sender: Option, - #[opg("balanceChange", string, optional)] pub balance_change: Option, pub root_address: Option, pub transaction_direction: TonTransactionDirection, @@ -33,17 +31,15 @@ pub struct AccountTransactionEvent { impl From for AccountTransactionEvent { fn from(t: TokenTransactionEventDb) -> Self { let account = - MsgAddressInt::from_str(&format!("{}:{}", t.account_workchain_id, t.account_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &account, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", t.account_workchain_id, t.account_hex)).unwrap(); + let base64url = Address(account.display_base64_url(true).to_string()); let sender = if let (Some(sender_workchain_id), Some(sender_hex)) = (t.sender_workchain_id, t.sender_hex) { let sender = - MsgAddressInt::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &sender, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)).unwrap(); + let base64url = Address(sender.display_base64_url(true).to_string()); Some(Account { workchain_id: sender_workchain_id, hex: Address(sender_hex), @@ -71,8 +67,8 @@ impl From for AccountTransactionEvent { transaction_status: t.transaction_status.into(), event_status: t.event_status, multisig_transaction_id: None, - created_at: t.created_at.timestamp_millis(), - updated_at: t.updated_at.timestamp_millis(), + created_at: t.created_at.and_utc().timestamp_millis(), + updated_at: t.updated_at.and_utc().timestamp_millis(), } } } @@ -80,17 +76,15 @@ impl From for AccountTransactionEvent { impl From for AccountTransactionEvent { fn from(t: TransactionEventDb) -> Self { let account = - MsgAddressInt::from_str(&format!("{}:{}", t.account_workchain_id, t.account_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &account, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", t.account_workchain_id, t.account_hex)).unwrap(); + let base64url = Address(account.display_base64_url(true).to_string()); let sender = if let (Some(sender_workchain_id), Some(sender_hex)) = (t.sender_workchain_id, t.sender_hex) { let sender = - MsgAddressInt::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)) - .unwrap(); - let base64url = Address(pack_std_smc_addr(true, &sender, true).unwrap()); + StdAddr::from_str(&format!("{}:{}", sender_workchain_id, sender_hex)).unwrap(); + let base64url = Address(sender.display_base64_url(true).to_string()); Some(Account { workchain_id: sender_workchain_id, hex: Address(sender_hex), @@ -118,8 +112,8 @@ impl From for AccountTransactionEvent { transaction_status: t.transaction_status, event_status: t.event_status, multisig_transaction_id: t.multisig_transaction_id, - created_at: t.created_at.timestamp_millis(), - updated_at: t.updated_at.timestamp_millis(), + created_at: t.created_at.and_utc().timestamp_millis(), + updated_at: t.updated_at.and_utc().timestamp_millis(), } } } diff --git a/src/models/address.rs b/src/models/address.rs index 722114b..9ad59fb 100644 --- a/src/models/address.rs +++ b/src/models/address.rs @@ -1,4 +1,6 @@ use bigdecimal::BigDecimal; +use schemars::JsonSchema; +use ton_block::MsgAddressInt; use crate::models::*; @@ -17,9 +19,8 @@ use crate::models::*; derive_more::Into, serde::Serialize, serde::Deserialize, - opg::OpgModel, + JsonSchema, )] -#[opg(inline, string)] pub struct Address(pub String); #[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Eq, PartialEq)] @@ -97,7 +98,7 @@ pub struct NetworkAddressData { } impl NetworkAddressData { - pub fn uninit(owner: &ton_block::MsgAddressInt) -> NetworkAddressData { + pub fn uninit(owner: &MsgAddressInt) -> NetworkAddressData { NetworkAddressData { workchain_id: owner.workchain_id(), hex: owner.address().to_hex_string(), diff --git a/src/models/owners_cache.rs b/src/models/owners_cache.rs index 588362c..bb294ea 100644 --- a/src/models/owners_cache.rs +++ b/src/models/owners_cache.rs @@ -38,7 +38,7 @@ impl OwnersCache { got.owner_account_workchain_id, got.owner_account_hex )) .trust_me(), - root_address: nekoton_utils::repack_address(&got.root_address).trust_me(), + root_address: MsgAddressInt::from_str(&got.root_address).trust_me(), code_hash: got.code_hash, version: got.version.into(), } @@ -60,7 +60,7 @@ impl OwnersCache { version: value.version.into(), }; if let Err(e) = self.db.new_token_owner(&owner).await { - log::error!("Failed inserting owner info: {}", e) + tracing::error!("Failed inserting owner info: {}", e) } } } @@ -80,14 +80,14 @@ impl OwnersCache { let mut cache = LruCache::new(NonZeroUsize::new(5000).trust_me()); balances.into_iter().for_each(|x| { cache.put( - nekoton_utils::repack_address(&x.address).trust_me(), + MsgAddressInt::from_str(&x.address).trust_me(), OwnerInfo { owner_address: MsgAddressInt::from_str(&format!( "{}:{}", x.owner_account_workchain_id, x.owner_account_hex )) .trust_me(), - root_address: nekoton_utils::repack_address(&x.root_address).trust_me(), + root_address: MsgAddressInt::from_str(&x.root_address).trust_me(), code_hash: x.code_hash, version: x.version.into(), }, diff --git a/src/models/service_id.rs b/src/models/service_id.rs index 28ba0b6..5d98823 100644 --- a/src/models/service_id.rs +++ b/src/models/service_id.rs @@ -2,6 +2,7 @@ use std::fmt; use std::fmt::Display; use std::str::FromStr; +use schemars::JsonSchema; use uuid::Uuid; #[derive( @@ -14,10 +15,9 @@ use uuid::Uuid; PartialEq, Eq, Hash, - opg::OpgModel, sqlx::Type, + JsonSchema, )] -#[opg("Service UUID (v4)")] #[sqlx(transparent)] pub struct ServiceId(pub Uuid); diff --git a/src/models/states_cache.rs b/src/models/states_cache.rs index b44351f..9e00718 100644 --- a/src/models/states_cache.rs +++ b/src/models/states_cache.rs @@ -4,13 +4,13 @@ use lru::LruCache; use nekoton::transport::models::ExistingContract; use nekoton_utils::TrustMe; use parking_lot::Mutex; -use ton_block::MsgAddressInt; +use ton_block::StdAddr; use crate::sqlx_client::*; #[derive(Clone)] pub struct StatesCache { - cache: Arc>>, + cache: Arc>>, db: SqlxClient, } @@ -33,7 +33,7 @@ impl StatesCache { }) } - pub async fn get(&self, address: &MsgAddressInt) -> Option { + pub async fn get(&self, address: &StdAddr) -> Option { let state = { let mut lock = self.cache.lock(); lock.get(address).cloned() @@ -53,7 +53,7 @@ impl StatesCache { } } - pub async fn insert(&self, key: MsgAddressInt, value: ExistingContract) { + pub async fn insert(&self, key: StdAddr, value: ExistingContract) { { self.cache.lock().put(key.clone(), value.clone()); } @@ -63,7 +63,7 @@ impl StatesCache { .update_root_token_state(&key.to_string(), serde_json::json!(value)) .await { - log::error!("Failed inserting root token state: {}", e) + tracing::error!("Failed inserting root token state: {}", e) } } } diff --git a/src/models/transactions.rs b/src/models/transactions.rs index 8437dee..12cf206 100644 --- a/src/models/transactions.rs +++ b/src/models/transactions.rs @@ -53,11 +53,11 @@ pub struct TransactionConfirm { /*#[derive(Debug, Deserialize, Serialize, Clone)] pub struct TokenTransactionSend { pub id: uuid::Uuid, - pub owner: MsgAddressInt, - pub token_wallet: MsgAddressInt, + pub owner: StdAddr, + pub token_wallet: StdAddr, pub version: TokenWalletVersion, pub destination: TransferRecipient, - pub send_gas_to: MsgAddressInt, + pub send_gas_to: StdAddr, pub tokens: BigDecimal, pub notify_receiver: bool, pub attached_amount: u64, diff --git a/src/server.rs b/src/server.rs index 7286e2a..72f2fa5 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,12 +1,17 @@ use std::sync::Arc; +use anyhow::Context; use anyhow::Result; -use pomfrit::formatter::*; +use futures::future::BoxFuture; use sqlx::postgres::PgPoolOptions; use tokio::sync::mpsc; use tokio::sync::Mutex; +use tycho_core::block_strider::StateSubscriber; +use tycho_core::block_strider::StateSubscriberContext; +use tycho_core::blockchain_rpc::BlockchainRpcClient; +use tycho_core::storage::CoreStorage; +use tycho_types::models::BlockId; -use crate::api::*; use crate::client::*; use crate::models::*; use crate::prelude::*; @@ -16,60 +21,7 @@ use crate::sqlx_client::*; use crate::ton_core::*; use crate::utils::*; -pub struct Engine { - context: Arc, - _node_metrics_exporter: Arc, -} - -impl Engine { - pub async fn new( - config: AppConfig, - global_config: ton_indexer::GlobalConfig, - shutdown_requests_tx: ShutdownRequestsTx, - ) -> Result> { - let (metrics_exporter, metrics_writer) = - pomfrit::create_exporter(config.node_metrics_settings.clone()).await?; - - let context = EngineContext::new(config, global_config, shutdown_requests_tx).await?; - - let engine = Arc::new(Self { - context, - _node_metrics_exporter: metrics_exporter, - }); - - metrics_writer.spawn({ - let engine = Arc::downgrade(&engine); - move |buffer| { - let engine = match engine.upgrade() { - Some(engine) => engine, - None => return, - }; - - buffer.write(LabeledTonSubscriberMetrics(&engine.context)); - } - }); - - Ok(engine) - } - - pub async fn start(self: &Arc) -> Result<()> { - self.context.start().await?; - - tokio::spawn(http_service( - self.context.config.server_addr, - self.context.config.api_metrics_addr, - self.context.auth_service.clone(), - self.context.ton_service.clone(), - self.context.memory_storage.clone(), - )); - - // Done - Ok(()) - } -} - pub struct EngineContext { - pub shutdown_requests_tx: ShutdownRequestsTx, pub auth_service: Arc, pub ton_core: Arc, pub ton_client: Arc, @@ -80,10 +32,10 @@ pub struct EngineContext { } impl EngineContext { - async fn new( + pub async fn new( config: AppConfig, - global_config: ton_indexer::GlobalConfig, - shutdown_requests_tx: ShutdownRequestsTx, + storage: CoreStorage, + blockchain_rpc_client: BlockchainRpcClient, ) -> Result> { let pool = PgPoolOptions::new() .max_connections(config.db_pool_size) @@ -101,14 +53,13 @@ impl EngineContext { let (ton_transaction_tx, ton_transaction_rx) = mpsc::unbounded_channel(); let (token_transaction_tx, token_transaction_rx) = mpsc::unbounded_channel(); - let node_config = config.ton_core.clone(); let ton_core = TonCore::new( - node_config, - global_config, sqlx_client.clone(), owners_cache, ton_transaction_tx, token_transaction_tx, + storage, + blockchain_rpc_client, ) .await?; @@ -126,7 +77,6 @@ impl EngineContext { let memory_storage = Arc::new(StorageHandler::default()); let engine_context = Arc::new(Self { - shutdown_requests_tx, auth_service, ton_core, ton_client, @@ -138,14 +88,24 @@ impl EngineContext { engine_context.start_listening_ton_transaction(ton_transaction_rx); engine_context.start_listening_token_transaction(token_transaction_rx); + engine_context.start_updating_accounts_subscription(); Ok(engine_context) } - async fn start(&self) -> Result<()> { - self.ton_client.start().await?; - self.ton_service.start().await?; - self.ton_core.start().await?; + pub async fn start(&self, last_block_id: &BlockId) -> Result<()> { + self.ton_client + .start() + .await + .context("failed to start ton_client")?; + self.ton_service + .start() + .await + .context("failed to start ton_service")?; + self.ton_core + .start(last_block_id) + .await + .context("failed to start ton_core")?; Ok(()) } @@ -158,7 +118,7 @@ impl EngineContext { let engine_context = match engine_context.upgrade() { Some(engine_context) => engine_context, None => { - log::error!("Engine is already dropped"); + tracing::error!("Engine is already dropped"); return; } }; @@ -176,7 +136,7 @@ impl EngineContext { } Err(err) => { state.send(HandleTransactionStatus::Fail).ok(); - log::error!("Failed to create receive transaction with message hash '{}': {:?}", message_hash, err) + tracing::error!("Failed to create receive transaction with message hash '{}': {:?}", message_hash, err) } } } @@ -210,7 +170,7 @@ impl EngineContext { } Err(err) => { state.send(HandleTransactionStatus::Fail).ok(); - log::error!( + tracing::error!( "Failed to update token transaction with message hash '{}': {:?}", transaction.message_hash, err @@ -220,7 +180,7 @@ impl EngineContext { } Err(err) => { state.send(HandleTransactionStatus::Fail).ok(); - log::error!( + tracing::error!( "Failed to upsert sent transaction with message hash '{}': {:?}", transaction.message_hash, err @@ -244,7 +204,7 @@ impl EngineContext { let engine_context = match engine_context.upgrade() { Some(engine_context) => engine_context, None => { - log::error!("Engine is already dropped"); + tracing::error!("Engine is already dropped"); return; } }; @@ -263,7 +223,7 @@ impl EngineContext { } Err(e) => { state.send(HandleTransactionStatus::Fail).ok(); - log::error!( + tracing::error!( "Failed to create token transaction with message hash '{}': {:?}", message_hash, e @@ -277,6 +237,31 @@ impl EngineContext { }); } + fn start_updating_accounts_subscription(self: &Arc) { + let engine_context = Arc::downgrade(self); + + tokio::spawn(async move { + loop { + let engine_context = match engine_context.upgrade() { + Some(engine_context) => engine_context, + None => { + tracing::error!("Engine is already dropped"); + return; + } + }; + + engine_context + .ton_service + .resubscribe_for_accounts_created_last_minute() + .await + .unwrap_or_else(|e| { + tracing::error!("Failed to update accounts: {}", e); + }); + tokio::time::sleep(std::time::Duration::from_secs(30)).await; + } + }); + } + fn get_guard(&self, account: String) -> Arc> { use dashmap::mapref::entry::Entry; @@ -299,56 +284,18 @@ impl EngineContext { } } -struct LabeledTonSubscriberMetrics<'a>(&'a EngineContext); - -impl std::fmt::Display for LabeledTonSubscriberMetrics<'_> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - use std::sync::atomic::Ordering; - - let metrics = self.0.ton_core.context.ton_subscriber.metrics(); - let indexer_metrics = self.0.ton_core.context.ton_engine.metrics(); - - f.begin_metric("ton_subscriber_ready") - .value(metrics.ready as u8)?; - - if metrics.current_utime > 0 { - let mc_time_diff = indexer_metrics.mc_time_diff.load(Ordering::Acquire); - let shard_client_time_diff = indexer_metrics - .shard_client_time_diff - .load(Ordering::Acquire); - - let last_mc_block_seqno = indexer_metrics.last_mc_block_seqno.load(Ordering::Acquire); - let last_shard_client_mc_block_seqno = indexer_metrics - .last_shard_client_mc_block_seqno - .load(Ordering::Acquire); - - f.begin_metric("ton_subscriber_current_utime") - .value(metrics.current_utime)?; - - if let Some(signature_id) = metrics.signature_id { - f.begin_metric("ton_subscriber_signature_id") - .value(signature_id)?; - } - - f.begin_metric("ton_subscriber_time_diff") - .value(mc_time_diff)?; - - f.begin_metric("ton_subscriber_shard_client_time_diff") - .value(shard_client_time_diff)?; - - f.begin_metric("ton_subscriber_mc_block_seqno") - .value(last_mc_block_seqno)?; - - f.begin_metric("ton_subscriber_shard_client_mc_block_seqno") - .value(last_shard_client_mc_block_seqno)?; - } +pub type ShutdownRequestsRx = mpsc::UnboundedReceiver<()>; +pub type ShutdownRequestsTx = mpsc::UnboundedSender<()>; - f.begin_metric("ton_subscriber_pending_message_count") - .value(metrics.pending_message_count)?; +impl StateSubscriber for EngineContext { + type HandleStateFut<'a> = BoxFuture<'a, Result<()>>; - Ok(()) + fn handle_state<'a>(&'a self, cx: &'a StateSubscriberContext) -> Self::HandleStateFut<'a> { + Box::pin( + self.ton_core + .context + .ton_subscriber + .process_block(&cx.block, &cx.state), + ) } } - -pub type ShutdownRequestsRx = mpsc::UnboundedReceiver<()>; -pub type ShutdownRequestsTx = mpsc::UnboundedSender<()>; diff --git a/src/services/auth.rs b/src/services/auth.rs index 38c1aae..890ccb4 100644 --- a/src/services/auth.rs +++ b/src/services/auth.rs @@ -2,7 +2,8 @@ use std::collections::HashMap; use std::sync::Arc; use anyhow::Context; -use chrono::{NaiveDateTime, Utc}; +use chrono::DateTime; +use chrono::Utc; use parking_lot::Mutex; use crate::models::*; @@ -57,7 +58,9 @@ impl AuthService { let timestamp = timestamp_ms / 1000; let now = Utc::now().naive_utc(); - let then = NaiveDateTime::from_timestamp_opt(timestamp, 0).context("Invalid timestamp")?; + let then = DateTime::from_timestamp(timestamp, 0) + .context("Invalid timestamp")? + .naive_utc(); let delta = (now - then).num_seconds(); if delta > TIMESTAMP_EXPIRED_SEC { diff --git a/src/services/ton.rs b/src/services/ton.rs index fa25210..782aa7e 100644 --- a/src/services/ton.rs +++ b/src/services/ton.rs @@ -2,15 +2,17 @@ use std::convert::TryInto; use std::str::FromStr; use std::sync::{Arc, Weak}; +use axum::http::StatusCode; use bigdecimal::BigDecimal; -use http::StatusCode; +use chrono::Utc; use nekoton::crypto::{SignedMessage, UnsignedMessage}; -use nekoton_utils::{repack_address, unpack_std_smc_addr}; +use nekoton_utils::{repack_address, unpack_std_smc_addr, TrustMe}; use serde_json::Value; use ton_abi::contract::ABI_VERSION_2_2; use ton_abi::{Param, Token, TokenValue}; use ton_block::{GetRepresentationHash, MsgAddressInt, Serializable}; use ton_types::{BuilderData, UInt256}; +use tycho_types::cell::HashBytes; use uuid::Uuid; use crate::api::*; @@ -56,7 +58,8 @@ impl TonService { let account = UInt256::from_be_bytes(&hex::decode(transaction.account_hex.clone())?); let message_hash = UInt256::from_be_bytes(&hex::decode(transaction.message_hash.clone())?); - let expire_at = transaction.created_at.timestamp() as u32 + DEFAULT_EXPIRATION_TIMEOUT; + let expire_at = + transaction.created_at.and_utc().timestamp() as u32 + DEFAULT_EXPIRATION_TIMEOUT; let rx = self .ton_api_client @@ -578,7 +581,7 @@ impl TonService { .await?; if address_db.balance < input.fee { - log::error!( + tracing::error!( "Address balance is not enough to pay fee for token transfer. Balance: {}. Fee: {}", address_db.balance, input.fee @@ -597,7 +600,7 @@ impl TonService { .await?; if token_balance.balance < input.value { - log::error!( + tracing::error!( "Token balance is not enough to make request; Balance: {}. Sent amount: {}", token_balance.balance, input.value @@ -670,7 +673,7 @@ impl TonService { .await?; if address_db.balance < input.fee { - log::error!( + tracing::error!( "Address balance is not enough to pay fee for token transfer. Balance: {}. Fee: {}", address_db.balance, input.fee @@ -689,7 +692,7 @@ impl TonService { .await?; if token_balance.balance < input.value { - log::error!( + tracing::error!( "Token balance is not enough to make request; Balance: {}. Sent amount: {}", token_balance.balance, input.value @@ -767,7 +770,7 @@ impl TonService { .await?; if address_db.balance < input.fee { - log::error!( + tracing::error!( "Address balance is not enough to pay fee for token transfer. Balance: {}. Fee: {}", address_db.balance, input.fee @@ -883,7 +886,7 @@ impl TonService { let tokens = match output.tokens { Some(tokens) => { if tokens.is_empty() { - log::warn!("No response tokens in execution output") + tracing::warn!("No response tokens in execution output") } tokens } @@ -1052,8 +1055,11 @@ impl TonService { pub fn encode_tvm_cell(&self, data: Vec) -> Result { let mut tokens: Vec = Vec::new(); for d in data { - let token_value = - ton_abi::token::Tokenizer::tokenize_parameter(&d.param.kind, &d.value)?; + let token_value = ton_abi::token::Tokenizer::tokenize_parameter( + &d.param.kind, + &d.value, + &d.param.name, + )?; let token = Token::new(&d.param.name, token_value); tokens.push(token); } @@ -1095,6 +1101,50 @@ impl TonService { Ok(hash) } + pub async fn add_account_subscription(self: &Arc, address: String) -> Result<(), Error> { + let address = MsgAddressInt::from_str(&address)?; + self.ton_api_client + .add_ton_account_subscription(address.hash()?); + Ok(()) + } + + pub async fn resubscribe_for_all_accounts(self: &Arc) -> Result<(), Error> { + let addresses = self + .sqlx_client + .get_all_addresses() + .await? + .into_iter() + .map(|item| { + let mut result = HashBytes::default(); + hex::decode_to_slice(item.hex, &mut result.0).trust_me(); + result + }); + + self.ton_api_client.add_ton_account_subscriptions(addresses); + Ok(()) + } + + pub async fn resubscribe_for_accounts_created_last_minute( + self: &Arc, + ) -> Result<(), Error> { + let now = Utc::now().naive_utc(); + let address_dbs = self + .sqlx_client + .get_addresses_created_after(now - chrono::Duration::minutes(1)) + .await?; + if address_dbs.is_empty() { + return Ok(()); + } + let addresses = address_dbs.into_iter().map(|item| { + let mut result = HashBytes::default(); + hex::decode_to_slice(item.hex, &mut result.0).trust_me(); + result + }); + + self.ton_api_client.add_ton_account_subscriptions(addresses); + Ok(()) + } + pub async fn set_callback( &self, service_id: &ServiceId, @@ -1213,7 +1263,7 @@ impl TonService { { tokio::spawn(async move { if let Err(e) = fut.await { - log::error!("Failed to {}: {:?}", name, e); + tracing::error!("Failed to {}: {:?}", name, e); } }); } @@ -1226,7 +1276,7 @@ async fn wait_message( ) -> Result<(), Error> { match rx.await? { MessageStatus::Delivered => { - log::info!("Successfully sent message `{}`", transaction.message_hash) + tracing::info!("Successfully sent message `{}`", transaction.message_hash) } MessageStatus::Expired => { let ton_service = match ton_service.upgrade() { diff --git a/src/settings.rs b/src/settings.rs index 33aa769..8b53c32 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -1,4 +1,4 @@ -use std::net::SocketAddr; +use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::path::Path; use anyhow::{Context, Result}; @@ -6,11 +6,10 @@ use argon2::password_hash::PasswordHasher; use nekoton_utils::TrustMe; use serde::{Deserialize, Serialize}; -use crate::ton_core::*; - -#[derive(Serialize, Deserialize)] +#[derive(Serialize, Deserialize, Debug, Clone)] pub struct AppConfig { /// Listen address of service. + #[serde(default = "default_server_addr")] pub server_addr: SocketAddr, /// Postgres database url. @@ -24,10 +23,6 @@ pub struct AppConfig { #[serde(default = "default_key")] pub key: Vec, - /// TON node settings - #[serde(default)] - pub ton_core: NodeConfig, - /// API prometheus metrics exporter settings. /// Completely disable when not specified #[serde(default)] @@ -38,21 +33,22 @@ pub struct AppConfig { #[serde(default)] pub node_metrics_settings: Option, - /// log4rs settings. - /// See [docs](https://docs.rs/log4rs/1.0.0/log4rs/) for more details - #[serde(default = "default_logger_settings")] - pub logger_settings: serde_yaml::Value, + /// Public url of service + pub public_url: Option, } -impl ConfigExt for ton_indexer::GlobalConfig { - fn from_file

(path: &P) -> Result - where - P: AsRef, - { - let file = std::fs::File::open(path)?; - let reader = std::io::BufReader::new(file); - let config = serde_json::from_reader(reader)?; - Ok(config) +impl Default for AppConfig { + fn default() -> Self { + Self { + server_addr: default_server_addr(), + database_url: "postgresql://postgres:postgres@127.0.0.1:5432/tycho_wallet_api" + .to_string(), + db_pool_size: 8, + key: default_key(), + api_metrics_addr: Default::default(), + node_metrics_settings: Default::default(), + public_url: Default::default(), + } } } @@ -62,6 +58,10 @@ pub trait ConfigExt: Sized { P: AsRef; } +fn default_server_addr() -> SocketAddr { + SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080) +} + fn default_key() -> Vec { fn key() -> Result> { let secret = std::env::var("SECRET")?; @@ -96,24 +96,3 @@ fn default_key() -> Vec { ), } } - -fn default_logger_settings() -> serde_yaml::Value { - const DEFAULT_LOG4RS_SETTINGS: &str = r##" - appenders: - stdout: - kind: console - encoder: - pattern: "{d(%Y-%m-%d %H:%M:%S %Z)(utc)} - {h({l})} {M} = {m} {n}" - root: - level: info - appenders: - - stdout - loggers: - ton_wallet_api: - level: info - appenders: - - stdout - additive: false - "##; - serde_yaml::from_str(DEFAULT_LOG4RS_SETTINGS).trust_me() -} diff --git a/src/sqlx_client/addresses.rs b/src/sqlx_client/addresses.rs index 1154ff3..c2d2ca9 100644 --- a/src/sqlx_client/addresses.rs +++ b/src/sqlx_client/addresses.rs @@ -1,4 +1,5 @@ use anyhow::Result; +use chrono::NaiveDateTime; use crate::models::*; use crate::sqlx_client::*; @@ -74,4 +75,20 @@ impl SqlxClient { .await .map_err(From::from) } + + pub async fn get_addresses_created_after( + &self, + created_at: NaiveDateTime, + ) -> Result> { + sqlx::query_as!(AddressDb, + r#"SELECT id, service_id as "service_id: _", workchain_id, hex, base64url, public_key, private_key, account_type as "account_type: _", custodians, confirmations, custodians_public_keys, balance, created_at, updated_at + FROM address + WHERE created_at > $1 + "#, + created_at + ) + .fetch_all(&self.pool) + .await + .map_err(From::from) + } } diff --git a/src/sqlx_client/token_transactions.rs b/src/sqlx_client/token_transactions.rs index e20ea1c..5a62183 100644 --- a/src/sqlx_client/token_transactions.rs +++ b/src/sqlx_client/token_transactions.rs @@ -11,8 +11,9 @@ impl SqlxClient { service_id: ServiceId, ) -> Result<(TokenTransactionFromDb, TokenTransactionEventDb)> { let transaction_timestamp = - NaiveDateTime::from_timestamp_opt(payload.transaction_timestamp as i64, 0) - .context("Invalid transaction timestamp")?; + DateTime::from_timestamp(payload.transaction_timestamp as i64, 0) + .context("Invalid transaction timestamp")? + .naive_utc(); let mut tx = self.pool.begin().await?; @@ -268,28 +269,9 @@ impl SqlxClient { } #[cfg(test)] -async fn prepare_test(level_filter: log::LevelFilter) -> SqlxClient { - use env_logger::Builder; - use std::io::Write; - - Builder::new() - .format(|buf, record| { - writeln!( - buf, - "{} {}/{} {} [{}] - {}", - Local::now().format("%Y-%m-%dT%H:%M:%S"), - record.module_path().unwrap_or_default(), - record.file().unwrap_or_default(), - record.line().unwrap_or_default(), - record.level(), - record.args(), - ) - }) - .filter(None, level_filter) - .init(); - +async fn prepare_test() -> SqlxClient { let pg_pool = - PgPool::connect("postgresql://everscale:everscale@localhost:5432/ton_wallet_api_rs") + PgPool::connect("postgresql://everscale:everscale@localhost:5432/tycho_wallet_api_rs") .await .unwrap(); @@ -299,13 +281,12 @@ async fn prepare_test(level_filter: log::LevelFilter) -> SqlxClient { #[cfg(test)] mod test { use super::*; - use log::LevelFilter; use std::str::FromStr; #[tokio::test] #[ignore] async fn test() { - let sqlx_client = prepare_test(LevelFilter::Trace).await; + let sqlx_client = prepare_test().await; let service_id = ServiceId::new(uuid::Uuid::from_str("5b30733f-e1cc-44e2-91f3-0ab7128e4534").unwrap()); diff --git a/src/sqlx_client/transactions.rs b/src/sqlx_client/transactions.rs index 4368dbf..68b75de 100644 --- a/src/sqlx_client/transactions.rs +++ b/src/sqlx_client/transactions.rs @@ -97,10 +97,11 @@ impl SqlxClient { let transaction_timestamp = payload .transaction_timestamp .map(|transaction_timestamp| { - NaiveDateTime::from_timestamp_opt(transaction_timestamp as i64, 0) + DateTime::from_timestamp(transaction_timestamp as i64, 0) .context("Invalid transaction timestamp") }) - .transpose()?; + .transpose()? + .map(|transaction_timestamp| transaction_timestamp.naive_utc()); let (transaction, event) = match sqlx::query_as!(TransactionDb, r#" @@ -294,8 +295,9 @@ impl SqlxClient { let mut tx = self.pool.begin().await?; let transaction_id = Uuid::new_v4(); let transaction_timestamp = - NaiveDateTime::from_timestamp_opt(payload.transaction_timestamp.trust_me() as i64, 0) - .context("Invalid transaction timestamp")?; + DateTime::from_timestamp(payload.transaction_timestamp.trust_me() as i64, 0) + .context("Invalid transaction timestamp")? + .naive_utc(); let transaction = sqlx::query_as!(TransactionDb, r#" @@ -383,8 +385,9 @@ impl SqlxClient { ) -> Result<(TransactionDb, TransactionEventDb)> { let mut tx = self.pool.begin().await?; let transaction_timestamp = - NaiveDateTime::from_timestamp_opt(payload.transaction_timestamp as i64, 0) - .context("Invalid transaction timestamp")?; + DateTime::from_timestamp(payload.transaction_timestamp as i64, 0) + .context("Invalid transaction timestamp")? + .naive_utc(); let transaction = sqlx::query_as!(TransactionDb, r#" @@ -616,7 +619,7 @@ impl SqlxClient { }, }; - let updates = filter_transaction_query(&mut args, &mut args_len, input); + let updates = filter_transaction_query(&mut args, &mut args_len, input)?; let query: String = format!( r#"SELECT id, service_id as "service_id: _", message_hash, transaction_hash, transaction_lt, transaction_timeout, @@ -675,7 +678,7 @@ pub fn filter_transaction_query( args: &mut PgArguments, args_len: &mut i32, input: &TransactionsSearch, -) -> Vec { +) -> Result> { let TransactionsSearch { id, message_hash, @@ -712,7 +715,7 @@ pub fn filter_transaction_query( updates.push(format!(" AND account_workchain_id = ${} ", *args_len + 1,)); *args_len += 1; args.add(account.workchain_id()) - .map_err(sqlx::Error::Encode); + .map_err(sqlx::Error::Encode)?; updates.push(format!(" AND account_hex = ${} ", *args_len + 1,)); *args_len += 1; args.add(account.address().to_hex_string()) @@ -736,29 +739,31 @@ pub fn filter_transaction_query( updates.push(format!(" AND created_at >= ${} ", *args_len + 1,)); *args_len += 1; args.add( - NaiveDateTime::from_timestamp_opt( + DateTime::from_timestamp( created_at_min / 1000, ((created_at_min % 1000) * 1_000_000) as u32, ) - .expect("Shouldn't fail"), + .expect("Shouldn't fail") + .naive_utc(), ) - .map_err(sqlx::Error::Encode); + .map_err(sqlx::Error::Encode)?; } if let Some(created_at_max) = created_at_max { updates.push(format!(" AND created_at <= ${} ", *args_len + 1,)); *args_len += 1; args.add( - NaiveDateTime::from_timestamp_opt( + DateTime::from_timestamp( created_at_max / 1000, ((created_at_max % 1000) * 1_000_000) as u32, ) - .expect("Shouldn't fail"), + .expect("Shouldn't fail") + .naive_utc(), ) - .map_err(sqlx::Error::Encode); + .map_err(sqlx::Error::Encode)?; } - updates + Ok(updates) } #[cfg(test)] diff --git a/src/sqlx_client/transactions_events.rs b/src/sqlx_client/transactions_events.rs index 9c38332..c00265b 100644 --- a/src/sqlx_client/transactions_events.rs +++ b/src/sqlx_client/transactions_events.rs @@ -131,12 +131,13 @@ impl SqlxClient { args.add(event_status).map_err(sqlx::Error::Encode)?; args.add(service_id.inner()).map_err(sqlx::Error::Encode)?; - let old = old_event_status - .map(|old| { - args.add(old).map_err(sqlx::Error::Encode); - "AND te.event_status = $3" - }) - .unwrap_or_default(); + let old = if let Some(old) = old_event_status { + args.add(old).map_err(sqlx::Error::Encode)?; + "AND te.event_status = $3" + } else { + "" + }; + let query = format!( r#"UPDATE transaction_events te SET event_status = $1 FROM transactions t diff --git a/src/ton_core/mod.rs b/src/ton_core/mod.rs index 1db0f69..5685bac 100644 --- a/src/ton_core/mod.rs +++ b/src/ton_core/mod.rs @@ -1,15 +1,24 @@ -use std::fs; use std::str::FromStr; use std::sync::Arc; use anyhow::{Context, Result}; use nekoton::transport::models::*; use nekoton_abi::*; +use nekoton_utils::Clock; +use nekoton_utils::SimpleClock; use parking_lot::Mutex; use tokio::sync::{mpsc, oneshot}; -use ton_block::{GetRepresentationHash, MsgAddressInt, Serializable}; -use ton_indexer::GlobalConfig; +use ton_block::Serializable; use ton_types::UInt256; +use tycho_core::blockchain_rpc::BlockchainRpcClient; +use tycho_core::storage::CoreStorage; +use tycho_executor::ExecutorParams; +use tycho_executor::ParsedConfig; +use tycho_types::boc::Boc; +use tycho_types::cell::HashBytes; +use tycho_types::cell::Lazy; +use tycho_types::cell::Load; +use tycho_types::models::*; use self::monitoring::*; use self::ton_subscriber::*; @@ -21,28 +30,23 @@ mod monitoring; mod settings; mod ton_subscriber; -pub use self::settings::*; - pub struct TonCore { pub context: Arc, - pub full_state: Mutex>, pub ton_transaction: Mutex>, pub token_transaction: Mutex>, } impl TonCore { pub async fn new( - node_config: NodeConfig, - global_config: ton_indexer::GlobalConfig, sqlx_client: SqlxClient, owners_cache: OwnersCache, ton_transaction_producer: TonTransactionTx, token_transaction_producer: TokenTransactionTx, + storage: CoreStorage, + blockchain_rpc_client: BlockchainRpcClient, ) -> Result> { let context = - TonCoreContext::new(node_config, global_config, sqlx_client, owners_cache).await?; - - let full_state = FullState::new(context.clone()).await?; + TonCoreContext::new(sqlx_client, owners_cache, storage, blockchain_rpc_client).await?; let ton_transaction = TonTransaction::new(context.clone(), ton_transaction_producer).await?; @@ -52,15 +56,14 @@ impl TonCore { Ok(Arc::new(Self { context, - full_state: Mutex::new(full_state), ton_transaction: Mutex::new(ton_transaction), token_transaction: Mutex::new(token_transaction), })) } - pub async fn start(&self) -> Result<()> { + pub async fn start(&self, last_block_id: &BlockId) -> Result<()> { // Sync node and subscribers - self.context.start().await?; + self.context.start(last_block_id).await?; // Done Ok(()) @@ -68,7 +71,7 @@ impl TonCore { pub fn add_ton_account_subscription(&self, accounts: I) where - I: IntoIterator, + I: IntoIterator, { self.ton_transaction .lock() @@ -114,83 +117,76 @@ pub struct TonCoreContext { pub owners_cache: OwnersCache, pub messages_queue: Arc, pub ton_subscriber: Arc, - pub ton_engine: Arc, -} - -impl Drop for TonCoreContext { - fn drop(&mut self) { - self.ton_engine.shutdown(); - } + pub storage: CoreStorage, + pub blockchain_rpc_client: BlockchainRpcClient, } impl TonCoreContext { async fn new( - node_config: NodeConfig, - global_config: GlobalConfig, sqlx_client: SqlxClient, owners_cache: OwnersCache, + storage: CoreStorage, + blockchain_rpc_client: BlockchainRpcClient, ) -> Result> { - let recover_indexer = node_config.recover_indexer; - - let node_config = node_config - .build_indexer_config() - .await - .context("Failed to build node config")?; - - if recover_indexer { - if let Err(e) = fs::remove_dir_all(&node_config.rocks_db_path) { - log::error!("Error on remove rocks db - {}", e.to_string()); - } - if let Err(e) = fs::remove_dir_all(&node_config.file_db_path) { - log::error!("Error on remove file db - {}", e.to_string()); - } - } - let messages_queue = PendingMessagesQueue::new(512); let ton_subscriber = TonSubscriber::new(messages_queue.clone()); - let ton_engine = ton_indexer::Engine::new( - node_config, - global_config, - ton_subscriber.clone() as Arc, - ) - .await?; - Ok(Arc::new(Self { sqlx_client, owners_cache, messages_queue, ton_subscriber, - ton_engine, + storage, + blockchain_rpc_client, })) } - async fn start(&self) -> Result<()> { - self.ton_engine.start().await?; - + async fn start(&self, last_block_id: &BlockId) -> Result<()> { // Load last states if exists let block_ids = self.sqlx_client.get_last_key_blocks().await?; for block_id in block_ids { - let block_id = ton_block::BlockIdExt::from_str(&block_id.block_id)?; - if let Ok(state) = self.ton_engine.load_state(&block_id).await { + let block_id = BlockId::from_str(&block_id.block_id)?; + if let Ok(state) = self + .storage + .shard_state_storage() + .load_state(last_block_id.seqno, &block_id) + .await + { self.ton_subscriber - .update_shards_accounts_cache(block_id.shard_id, state)?; + .update_shards_accounts_cache(block_id.shard, state)?; } } - self.ton_subscriber.start(&self.ton_engine).await?; + let mc_state = self + .storage + .shard_state_storage() + .load_state(last_block_id.seqno, last_block_id) + .await?; + + let config = mc_state.config_params()?; + let global_version = config.get_global_version()?; + + self.ton_subscriber + .start( + global_version.capabilities.into_inner(), + mc_state.state().global_id, + ) + .await + .context("Failed to start ton_subscriber")?; + Ok(()) } fn get_contract_state(&self, account: &UInt256) -> Result { + let account = HashBytes::from_slice(account.as_slice()); match self .ton_subscriber - .get_contract_state(account) + .get_contract_state(&account) .and_then(make_existing_contract)? { Some(contract) => Ok(contract), - None => Err(TonCoreError::AccountNotExist(account.to_hex_string()).into()), + None => Err(TonCoreError::AccountNotExist(account.to_string()).into()), } } @@ -200,7 +196,7 @@ impl TonCoreContext { message: &ton_block::Message, expire_at: u32, ) -> Result { - let to = match message.header() { + match message.header() { ton_block::CommonMsgInfo::ExtInMsgInfo(header) => header.dst.workchain_id(), _ => return Err(TonCoreError::ExternalTonMessageExpected.into()), }; @@ -208,25 +204,91 @@ impl TonCoreContext { let cells = message.write_to_new_cell()?.into_cell()?; let serialized = ton_types::serialize_toc(&cells)?; - let rx = self - .messages_queue - .add_message(*account, cells.repr_hash(), expire_at)?; + let rx = self.messages_queue.add_message( + HashBytes::from_slice(account.as_slice()), + HashBytes::from_slice(cells.repr_hash().as_slice()), + expire_at, + )?; - self.ton_engine - .broadcast_external_message(to, &serialized)?; + self.blockchain_rpc_client + .broadcast_external_message(&serialized) + .await; let status = rx.await?; Ok(status) } + #[allow(unused)] + fn send_local( + &self, + account: &UInt256, + message_base64: &str, + expire_at: u32, + ) -> Result> { + let account = HashBytes::from_slice(account.as_slice()); + + let account_state = self.ton_subscriber.get_contract_state(&account)?; + + let account_state = match account_state { + Some(this) => this, + None => return Ok(None), + }; + + let account = + tycho_types::models::OptionalAccount::load_from(&mut account_state.data.as_slice()?)?; + + let LastTransactionId::Exact(last_transaction_id) = account_state.last_transaction_id + else { + return Ok(None); + }; + + let shard_account = tycho_types::models::ShardAccount { + account: Lazy::new(&account).unwrap(), + last_trans_hash: HashBytes::from_slice(last_transaction_id.hash.as_slice()), + last_trans_lt: last_transaction_id.lt, + }; + + let config_cell = Boc::decode_base64("te6ccgECmgEACsoAAUBVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVQECA81AMQICAUgFAwEBtwQASgIAIAAAAAAgAAAAA+gCAAAA//8CAAABAAAD/wAAAAABAAAAAQACAUgWBgEBSAcBKxJoS+teaEzrXgANAA0P/////////8AIAgLMDgkCASALCgCb05x0CTxV7l+jF3+mNnnHZDoEuecqu7xRAsxbuOMWMpRbZzb5snAJ2J2J2J2J3e5foxd/pjZ5x2Q6BLnnKru8UQLMW7jjFjKUW2c2+bJ0AgEgDQwCASAsKAIBICYtAgEgEg8CASAREAIBIC8eAgEgICkCASAVEwIBIBQhAJsc46BJ4r17WnIENFFM8gQdLNpjlI77ARSpBgJSHsneJb9zo4l0QE7E7E7E7E79e1pyBDRRTPIEHSzaY5SO+wEUqQYCUh7J3iW/c6OJdGACASAwHQEBSBcBKxJoR5PsaEiT7AANAA0P/////////8AYAgLMIhkCASAbGgCb05x0CTxXr2tOQIaKKZ5Ag6WbTHKR32AilSDASkPZO8S37nRxLogJ2J2J2J2J369rTkCGiimeQIOlm0xykd9gIpUgwEpD2TvEt+50cS6MAgEgHxwCASAeHQCbHOOgSeKzAJhYyfLOK+UiNHMtUQbVghUHiUdo3IESPOoJDWJERsBOxOxOxOxO8wCYWMnyzivlIjRzLVEG1YIVB4lHaNyBEjzqCQ1iREbgAJsc46BJ4q2WXeTjFMyDixU4Dl1lQ6hVgkTqbl/UKQlIq0VaU9wFgE7E7E7E7E7tll3k4xTMg4sVOA5dZUOoVYJE6m5f1CkJSKtFWlPcBaACASAhIACbHOOgSeKnRC60+yEUGVC3uC1/LuThMyfccvnKsiJVqBNPhA/5j0BOxOxOxOxO50QutPshFBlQt7gtfy7k4TMn3HL5yrIiVagTT4QP+Y9gAJsc46BJ4r6fl3LevgpFdUCqKrEV48/O/CGVrN8lSNmdkNObBSMPgE7E7E7E7E7+n5dy3r4KRXVAqiqxFePPzvwhlazfJUjZnZDTmwUjD6ACASAqIwIBICckAgEgJiUAmxzjoEnir3L9GLv9MbPOOyHQJc85Vd3iiBZi3ccYsZSi2zm3zZOATsTsTsTsTu9y/Ri7/TGzzjsh0CXPOVXd4ogWYt3HGLGUots5t82ToACbHOOgSeKE86G8nxKAnKLK7RXmAwyf8QoD0ScvcgnEddkij6f6KoBOxOxOxOxOxPOhvJ8SgJyiyu0V5gMMn/EKA9EnL3IJxHXZIo+n+iqgAgEgKSgAmxzjoEninFDOqwkNaXu2fW66j9E2npfFJriR2/L54JTrTlgnr3JATsTsTsTsTtxQzqsJDWl7tn1uuo/RNp6XxSa4kdvy+eCU605YJ69yYACbHOOgSeKlm70eCk6/r2biRNkblteeIH7zJlKEhwYZmER2e4tzycBOxOxOxOxO5Zu9HgpOv69m4kTZG5bXniB+8yZShIcGGZhEdnuLc8ngAgEgLisCASAtLACbHOOgSeK4qCHubR7fRLsjbLFoTlnHKefTLJm1u9dBxRpxvJb5/EBOxOxOxOxO+Kgh7m0e30S7I2yxaE5Zxynn0yyZtbvXQcUacbyW+fxgAJsc46BJ4rzmKhZmv1HLpThOfwQ/9l3VXnk2biudntQ6+jw3xRo8QE7E7E7E7E785ioWZr9Ry6U4Tn8EP/Zd1V55Nm4rnZ7UOvo8N8UaPGACASAwLwCbHOOgSeK2A7HR2JdeUC0W0eK2UdGqJvHyOhIzL5qrKmCoDMvtvQBOxOxOxOxO9gOx0diXXlAtFtHitlHRqibx8joSMy+aqypgqAzL7b0gAJsc46BJ4oY4Yb0PrIWTnALn3aTZHgrp+fhC+uDxUmaKvm3GJ4EegE7E7E7E7E7GOGG9D6yFk5wC592k2R4K6fn4Qvrg8VJmir5txieBHqACASBiMgIBIEszAgEgRjQCASA+NQEBWDYBAcA3AgEgOTgAQ7/EREREREREREREREREREREREREREREREREREREREREREACASA7OgBCv7d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3AgEgPTwAQb9mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZwAD37ACASBBPwEBIEAANNgTiAAMAAAAFACMANIDIAAAAJYAGQIBBANIAQEgQgHnpoAABOIAAHUwD4AAAAAjw0YAAIAAE4gAMgAFAB4ABQBMS0AATEtAQAAJxAAAACYloAAAAAAAfQTiAPoASwAAADeqCcQC7gAACcQE4gTiBOIABAABdwLuALuAu4ALcbABdwLuAAtxsAH0Au4AAAAAAAAAACBDAgLPRUQAAwKgAAMUIAIBSElHAQEgSABC6gAAAAABEqiAAAAAAEZQAAAAAAAbd0AAAAABgABVVVVVAQEgSgBC6gAAAAAKupUAAAAAAr8gAAAAAAESqIAAAAABgABVVVVVAgEgV0wCASBSTQIBIFBOAQEgTwBQXcMAAgAAAAgAAAAQAADDAA27oAD0JAAExLQAwwAAA+gAABOIAAAnEAEBIFEAUF3DAAIAAAAIAAAAEAAAwwANu6AA5OHAATEtAMMAAAPoAAATiAAAJxACASBVUwEBIFQAlNEAAAAAAAAD6AAAAAACJVEA3gAAAACMoAAAAAAAAAAPQkAAAAAAAA9CQAAAAAAAACcQAAAAAACYloAAAAAAFXUqAAAAAIuyyXAAAQEgVgCU0QAAAAAAAAPoAAAAABV1KgDeAAAABX5AAAAAAAAAAA9CQAAAAAAF9eEAAAAAAAAAJxAAAAAAAKfYwAAAAAAVdSoAAAAAi7LJcAACASBdWAIBIFtZAQEgWgAIAAGJ/AEBIFwATdBmAAAAAAAAAAAAAAACAAAAAAAAA4QAAAAAAAAHCAAAAAAADbugQAIBIGBeAQEgXwA3cDjX6kxoAAgN4Lazp2QAAHI4byb8EAAAADAACAEBIGEADAPoAGQADQIBII9jAgEgbWQCASBqZQIBIGhmAQEgZwAgAAEAAAAAgAAAACAAAACAAAEBIGkABGsAAQFIawEBwGwAt9BTAAAAAAAAAHAAFUnhoGwobj70KPq+dFxpy+h6i/p4hx7t0qgF6YgOT6VQc2jYXWqj6RRNQfU9u9j0iD1g18QSon0bpgnaZR+psIAAAAAIAAAAAAAAAAAAAAAEAgEgeW4CASBzbwEBIHACApFycQAqNgQHBAIATEtAATEtAAAAAAIAAOpgACo2AgMCAgAPQkAAmJaAAAAAAQAAdTABASB0AgPNQHd1AgFidoACASCJiQIBIIR4AgHOjIwCASCNegEBIHsCA81AfXwAA6igAgEghH4CASCCfwIBIIGAAAHUAgFIjIwCASCDgwIBIIeHAgEgi4UCASCIhgIBIImHAgEgjIwCASCKiQABSAABWAIB1IyMAAEgAQEgjgAaxAAAAGQAAAAACAMWLgIBIJKQAQH0kQABQAIBIJWTAQFIlABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACASCYlgEBIJcAQDMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzAQEgmQBAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVU=").unwrap(); + let config = config_cell.parse::()?; + + let config = ParsedConfig::parse(config, SimpleClock.now_sec_u64() as u32)?; + + let cell = Boc::decode_base64(message_base64)?; + let mut cs = cell.as_slice()?; + let message = OwnedMessage::load_from(&mut cs)?; + + let is_external = !matches!(message.ty(), MsgType::Int); + + let optional = shard_account.load_account()?; + let Some(account) = optional else { + return Err(anyhow::anyhow!("account not found")); + }; + let address = account.address.as_std().unwrap(); + + let executor_params = ExecutorParams { + block_unixtime: expire_at - 10, + ..Default::default() + }; + let executor = tycho_executor::Executor::new(&executor_params, &config); + let uncommited = executor.begin_ordinary(address, is_external, message, &shard_account)?; + + uncommited + .build_uncommitted() + .map(Some) + .map_err(|e| anyhow::anyhow!(e)) + } + fn add_pending_message( &self, account: UInt256, message_hash: UInt256, expire_at: u32, ) -> Result> { - self.messages_queue - .add_message(account, message_hash, expire_at) + self.messages_queue.add_message( + HashBytes::from_slice(account.as_slice()), + HashBytes::from_slice(message_hash.as_slice()), + expire_at, + ) } } diff --git a/src/ton_core/monitoring/full_state.rs b/src/ton_core/monitoring/full_state.rs deleted file mode 100644 index b2121e3..0000000 --- a/src/ton_core/monitoring/full_state.rs +++ /dev/null @@ -1,75 +0,0 @@ -use std::sync::Arc; - -use anyhow::Result; -use tokio::sync::mpsc; - -use crate::ton_core::*; - -pub struct FullState { - context: Arc, - _full_state_observer: Arc>, -} - -impl FullState { - pub async fn new(context: Arc) -> Result> { - let (full_state_events_tx, full_state_events_rx) = mpsc::unbounded_channel(); - - let observer = AccountObserver::new(full_state_events_tx); - context - .ton_subscriber - .add_full_state_subscription(&observer); - - let full_state = Arc::new(Self { - context, - _full_state_observer: observer, - }); - full_state.start_listening_full_state_events(full_state_events_rx); - - Ok(full_state) - } - - fn start_listening_full_state_events(self: &Arc, mut rx: FullStateEventsRx) { - let full_state = Arc::downgrade(self); - - tokio::spawn(async move { - while let Some(event) = rx.recv().await { - let full_state = match full_state.upgrade() { - Some(engine) => engine, - None => { - event.state.send(HandleTransactionStatus::Fail).ok(); - log::error!("Failed to handle full state: Full state handler was dropped"); - break; - } - }; - - let sqlx_client = &full_state.context.sqlx_client; - match sqlx_client - .create_last_key_block(&event.block_id.to_string()) - .await - { - Ok(_) => event.state.send(HandleTransactionStatus::Success).ok(), - Err(_) => event.state.send(HandleTransactionStatus::Fail).ok(), - }; - } - - rx.close(); - while rx.recv().await.is_some() {} - }); - } -} - -pub struct FullStateEvent { - block_id: ton_block::BlockIdExt, - state: HandleTransactionStatusTx, -} - -impl ReadFromState for FullStateEvent { - fn read_from_state(ctx: &StateContext<'_>, state: HandleTransactionStatusTx) -> Self { - FullStateEvent { - block_id: ctx.block_id.clone(), - state, - } - } -} - -type FullStateEventsRx = mpsc::UnboundedReceiver; diff --git a/src/ton_core/monitoring/mod.rs b/src/ton_core/monitoring/mod.rs index 5971f75..c1117b4 100644 --- a/src/ton_core/monitoring/mod.rs +++ b/src/ton_core/monitoring/mod.rs @@ -1,8 +1,6 @@ -pub use self::full_state::*; pub use self::token_transaction::*; pub use self::ton_transaction::*; -mod full_state; mod token_transaction; mod token_transaction_parser; mod ton_transaction; diff --git a/src/ton_core/monitoring/token_transaction.rs b/src/ton_core/monitoring/token_transaction.rs index a315142..6dff406 100644 --- a/src/ton_core/monitoring/token_transaction.rs +++ b/src/ton_core/monitoring/token_transaction.rs @@ -46,7 +46,7 @@ impl TokenTransaction { Some(engine) => engine, None => { event.state.send(HandleTransactionStatus::Fail).ok(); - log::error!("Failed to handle received token transaction: Token transaction handler was dropped"); + tracing::error!("Failed to handle received token transaction: Token transaction handler was dropped"); break; } }; @@ -67,7 +67,7 @@ impl TokenTransaction { } Err(e) => { event.state.send(HandleTransactionStatus::Fail).ok(); - log::error!("Failed to handle received token transaction: {}", e); + tracing::error!("Failed to handle received token transaction: {}", e); } } } @@ -113,7 +113,7 @@ impl ReadFromTransaction for TokenTransactionEvent { ctx: TokenTransactionContext { account: *ctx.account, block_hash: *ctx.block_hash, - block_utime: ctx.block_info.gen_utime().as_u32(), + block_utime: ctx.block_info_gen_utime, transaction_hash: *ctx.transaction_hash, transaction: ctx.transaction.clone(), token_state: token_state.clone(), diff --git a/src/ton_core/monitoring/token_transaction_parser.rs b/src/ton_core/monitoring/token_transaction_parser.rs index 18319d8..c0a5463 100644 --- a/src/ton_core/monitoring/token_transaction_parser.rs +++ b/src/ton_core/monitoring/token_transaction_parser.rs @@ -2,7 +2,7 @@ use anyhow::Result; use bigdecimal::BigDecimal; use nekoton::core::models::{TokenIncomingTransfer, TokenWalletTransaction}; use num_bigint::BigUint; -use ton_block::MsgAddressInt; +use ton_block::{GetRepresentationHash, MsgAddressInt}; use ton_types::{AccountId, BuilderData}; use uuid::Uuid; diff --git a/src/ton_core/monitoring/ton_transaction.rs b/src/ton_core/monitoring/ton_transaction.rs index 1699aa9..87d1c0c 100644 --- a/src/ton_core/monitoring/ton_transaction.rs +++ b/src/ton_core/monitoring/ton_transaction.rs @@ -2,7 +2,6 @@ use std::sync::Arc; use anyhow::Result; use tokio::sync::mpsc; -use ton_types::UInt256; use crate::ton_core::monitoring::*; use crate::ton_core::*; @@ -33,7 +32,7 @@ impl TonTransaction { pub fn add_account_subscription(&self, accounts: I) where - I: IntoIterator, + I: IntoIterator, { self.context .ton_subscriber @@ -49,11 +48,10 @@ impl TonTransaction { Some(engine) => engine, None => { event.state.send(HandleTransactionStatus::Fail).ok(); - log::error!("Failed to handle received ton transaction: Ton transaction handler was dropped"); + tracing::error!("Failed to handle received ton transaction: Ton transaction handler was dropped"); break; } }; - match ton_transaction_parser::parse_ton_transaction( event.account, event.block_utime, @@ -70,7 +68,7 @@ impl TonTransaction { } Err(e) => { event.state.send(HandleTransactionStatus::Fail).ok(); - log::error!( + tracing::error!( "Failed to handle received ton transaction `{}`: {}", event.transaction_hash, e @@ -101,7 +99,7 @@ impl ReadFromTransaction for TonTransactionEvent { ) -> Option { Some(TonTransactionEvent { account: *ctx.account, - block_utime: ctx.block_info.gen_utime().as_u32(), + block_utime: ctx.block_info_gen_utime, transaction_hash: *ctx.transaction_hash, transaction: ctx.transaction.clone(), state, diff --git a/src/ton_core/monitoring/ton_transaction_parser.rs b/src/ton_core/monitoring/ton_transaction_parser.rs index cd7a7c0..a4a35dc 100644 --- a/src/ton_core/monitoring/ton_transaction_parser.rs +++ b/src/ton_core/monitoring/ton_transaction_parser.rs @@ -4,7 +4,7 @@ use nekoton::core::models::{MultisigTransaction, TransactionError}; use nekoton::core::ton_wallet::MultisigType; use num_traits::FromPrimitive; use serde::{Deserialize, Serialize}; -use ton_block::CommonMsgInfo; +use ton_block::{CommonMsgInfo, GetRepresentationHash, MsgAddressInt}; use ton_types::AccountId; use uuid::Uuid; @@ -244,21 +244,6 @@ struct MessageRecipient { pub workchain_id: i32, } -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -struct Outputs { - pub value: BigDecimal, - pub recipient: OutputsRecipient, -} - -#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(rename_all = "camelCase")] -struct OutputsRecipient { - pub hex: String, - pub base64url: String, - pub workchain_id: i64, -} - #[cfg(test)] mod tests { use super::*; diff --git a/src/ton_core/settings.rs b/src/ton_core/settings.rs index c1eb7cf..8b13789 100644 --- a/src/ton_core/settings.rs +++ b/src/ton_core/settings.rs @@ -1,126 +1 @@ -use std::net::{Ipv4Addr, SocketAddrV4}; -use std::path::PathBuf; -use anyhow::{Context, Result}; -use everscale_network::{adnl, dht, overlay, rldp}; -use rand::Rng; -use serde::{Deserialize, Serialize}; -use ton_indexer::OldBlocksPolicy; - -/// TON node settings -#[derive(Clone, Serialize, Deserialize)] -#[serde(default, deny_unknown_fields)] -pub struct NodeConfig { - /// Node public ip. Automatically determines if None - pub adnl_public_ip: Option, - - /// Node port. Default: 30303 - pub adnl_port: u16, - - /// Path to the DB directory. Default: `./db` - pub db_path: PathBuf, - - /// Path to the ADNL keys. Default: `./adnl-keys.json`. - /// NOTE: generates new keys if specified path doesn't exist - pub keys_path: PathBuf, - - /// Internal DB options. - pub db_options: ton_indexer::DbOptions, - - /// Archives map queue. Default: 16 - pub parallel_archive_downloads: usize, - - /// Sync from specific key block - pub start_from: Option, - - /// Whether old shard states will be removed every 10 minutes - pub states_gc_enabled: bool, - - /// Whether old blocks will be removed on each new key block - pub blocks_gc_enabled: bool, - - pub adnl_options: adnl::NodeOptions, - pub rldp_options: rldp::NodeOptions, - pub dht_options: dht::NodeOptions, - pub overlay_shard_options: overlay::OverlayOptions, - pub neighbours_options: ton_indexer::NeighboursOptions, - - /// Recover indexer db - pub recover_indexer: bool, -} - -impl NodeConfig { - pub async fn build_indexer_config(self) -> Result { - // Determine public ip - let ip_address = broxus_util::resolve_public_ip(self.adnl_public_ip).await?; - - log::info!("Using public ip: {}", ip_address); - - // Generate temp keys - let adnl_keys = ton_indexer::NodeKeys::load(self.keys_path, false) - .context("Failed to load temp keys")?; - - let old_blocks_policy = match self.start_from { - None => OldBlocksPolicy::Ignore, - Some(a) => OldBlocksPolicy::Sync { from_seqno: a }, - }; - - // Prepare DB folder - std::fs::create_dir_all(&self.db_path)?; - - // Done - Ok(ton_indexer::NodeConfig { - ip_address: SocketAddrV4::new(ip_address, self.adnl_port), - adnl_keys, - rocks_db_path: self.db_path.join("rocksdb"), - file_db_path: self.db_path.join("files"), - state_gc_options: self.states_gc_enabled.then(|| ton_indexer::StateGcOptions { - offset_sec: rand::thread_rng().gen_range(0..3600), - interval_sec: 3600, - }), - blocks_gc_options: self - .blocks_gc_enabled - .then(|| ton_indexer::BlocksGcOptions { - kind: ton_indexer::BlocksGcKind::BeforePreviousKeyBlock, - enable_for_sync: true, - ..Default::default() - }), - shard_state_cache_options: None, // self.shard_state_cache_options, - db_options: self.db_options, - archive_options: Some(Default::default()), - sync_options: ton_indexer::SyncOptions { - old_blocks_policy, - parallel_archive_downloads: self.parallel_archive_downloads, - ..Default::default() - }, - adnl_options: self.adnl_options, - rldp_options: self.rldp_options, - dht_options: self.dht_options, - neighbours_options: self.neighbours_options, - overlay_shard_options: self.overlay_shard_options, - persistent_state_options: Default::default(), - }) - } -} - -impl Default for NodeConfig { - fn default() -> Self { - Self { - adnl_public_ip: None, - adnl_port: 30303, - db_path: "db".into(), - keys_path: "adnl-keys.json".into(), - db_options: Default::default(), - parallel_archive_downloads: 16, - states_gc_enabled: true, - blocks_gc_enabled: true, - start_from: None, - adnl_options: Default::default(), - rldp_options: Default::default(), - dht_options: Default::default(), - neighbours_options: Default::default(), - overlay_shard_options: Default::default(), - recover_indexer: false, - } - } -} diff --git a/src/ton_core/ton_subscriber/mod.rs b/src/ton_core/ton_subscriber/mod.rs index 4650273..b39f472 100644 --- a/src/ton_core/ton_subscriber/mod.rs +++ b/src/ton_core/ton_subscriber/mod.rs @@ -1,5 +1,5 @@ use std::collections::hash_map; -use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering}; +use std::sync::atomic::{AtomicU32, AtomicU64, Ordering}; use std::sync::{Arc, Weak}; use anyhow::Result; @@ -10,25 +10,24 @@ use nekoton::transport::models::ExistingContract; use nekoton_utils::TrustMe; use parking_lot::{Mutex, RwLock, RwLockReadGuard}; use rustc_hash::FxHashMap; +use tycho_types::boc::Boc; +use tycho_types::cell::{Cell, CellBuilder, HashBytes, Load}; -use tokio::sync::Notify; -use ton_block::{Deserializable, HashmapAugType, ShardIdent}; -use ton_indexer::utils::{BlockIdExtExtension, RefMcStateHandle, ShardStateStuff}; -use ton_indexer::{BriefBlockMeta, EngineStatus, ProcessBlockContext}; -use ton_types::{HashmapType, UInt256}; +use ton_block::Deserializable; +use ton_types::SliceData; +use tycho_block_util::block::BlockStuff; +use tycho_block_util::state::{RefMcStateHandle, ShardStateStuff}; +use tycho_vm::StackValue; use crate::ton_core::*; pub struct TonSubscriber { - ready: AtomicBool, - ready_signal: Notify, // tip block timestamp current_utime: AtomicU32, signature_id: SignatureId, - state_subscriptions: RwLock>, + state_subscriptions: RwLock>, token_subscription: RwLock>, - full_state_subscription: RwLock>, - shards_accounts_cache: RwLock>, + sc_accounts: RwLock>, mc_block_awaiters: Mutex>>, messages_queue: Arc, } @@ -36,8 +35,6 @@ pub struct TonSubscriber { impl TonSubscriber { pub fn new(messages_queue: Arc) -> Arc { Arc::new(Self { - ready: AtomicBool::new(false), - ready_signal: Notify::new(), current_utime: AtomicU32::new(0), signature_id: SignatureId::default(), state_subscriptions: RwLock::new(FxHashMap::with_capacity_and_hasher( @@ -45,11 +42,7 @@ impl TonSubscriber { Default::default(), )), token_subscription: Default::default(), - full_state_subscription: Default::default(), - shards_accounts_cache: RwLock::new(FxHashMap::with_capacity_and_hasher( - 16, - Default::default(), - )), + sc_accounts: RwLock::new(FxHashMap::with_capacity_and_hasher(16, Default::default())), mc_block_awaiters: Mutex::new(FxHashMap::with_capacity_and_hasher( 4, Default::default(), @@ -60,18 +53,15 @@ impl TonSubscriber { pub fn metrics(&self) -> TonSubscriberMetrics { TonSubscriberMetrics { - ready: self.ready.load(Ordering::Acquire), + ready: true, current_utime: self.current_utime(), signature_id: self.signature_id(), pending_message_count: self.messages_queue.len(), } } - pub async fn start(self: &Arc, engine: &ton_indexer::Engine) -> Result<()> { - let last_key_block = engine.load_last_key_block().await?; - self.update_signature_id(last_key_block.block())?; - - self.wait_sync().await; + pub async fn start(self: &Arc, capabilities: u64, global_id: i32) -> Result<()> { + self.update_signature_id(capabilities, global_id)?; Ok(()) } @@ -85,7 +75,7 @@ impl TonSubscriber { pub fn add_transactions_subscription(&self, accounts: I, subscription: &Arc) where - I: IntoIterator, + I: IntoIterator, T: TransactionsSubscription + 'static, { let mut state_subscriptions = self.state_subscriptions.write(); @@ -96,11 +86,11 @@ impl TonSubscriber { match state_subscriptions.entry(account) { hash_map::Entry::Vacant(entry) => { entry.insert(StateSubscription { - transaction_subscriptions: vec![weak.clone()], + transaction_subscription: weak.clone(), }); } hash_map::Entry::Occupied(mut entry) => { - entry.get_mut().transaction_subscriptions.push(weak.clone()); + entry.get_mut().transaction_subscription = weak.clone(); } }; } @@ -119,21 +109,8 @@ impl TonSubscriber { }); } - pub fn add_full_state_subscription(&self, subscription: &Arc) - where - T: FullStatesSubscription + 'static, - { - let mut full_state_subscription = self.full_state_subscription.write(); - - let weak = Arc::downgrade(subscription) as Weak; - - let _ = full_state_subscription.insert(FullStateSubscription { - full_state_subscription: weak.clone(), - }); - } - - pub fn get_contract_state(&self, account: &UInt256) -> Result> { - let cache = self.shards_accounts_cache.read(); + pub fn get_contract_state(&self, account: &HashBytes) -> Result> { + let cache = self.sc_accounts.read(); for (shard_ident, shard_accounts) in cache.iter() { if !contains_account(shard_ident, account) { continue; @@ -146,15 +123,15 @@ impl TonSubscriber { pub fn update_shards_accounts_cache( &self, shard_id: ShardIdent, - shard_state: Arc, + shard_state: ShardStateStuff, ) -> Result<()> { - let shard_accounts = shard_state.state().read_accounts()?; + let shard_accounts = shard_state.state().load_accounts()?; let state_handle = shard_state.ref_mc_state_handle().clone(); - let mut shards_accounts = self.shards_accounts_cache.write(); + let mut shards_accounts = self.sc_accounts.write(); shards_accounts.insert( shard_id, - ShardAccounts { + CachedAccounts { accounts: shard_accounts, state_handle, }, @@ -163,29 +140,18 @@ impl TonSubscriber { Ok(()) } - fn handle_masterchain_block( - &self, - meta: BriefBlockMeta, - block: &ton_block::Block, - ) -> Result<()> { - let gen_utime = meta.gen_utime(); + fn handle_masterchain_block(&self, block_stuff: &BlockStuff) -> Result<()> { + let block = block_stuff.block(); + let block_info = block.load_info()?; + let gen_utime = block_info.gen_utime; self.current_utime.store(gen_utime, Ordering::Release); - let block_info = block.info.read_struct()?; - if block_info.key_block() { - self.update_signature_id(block)?; - } - - if !self.ready.load(Ordering::Acquire) { - return Ok(()); - } - let mut mc_block_awaiters = self.mc_block_awaiters.lock(); mc_block_awaiters.retain( |_, awaiter| match awaiter.handle_block(block, &block_info) { Ok(action) => action == BlockAwaiterAction::Retain, Err(e) => { - log::error!("Failed to handle masterchain block: {:?}", e); + tracing::error!("Failed to handle masterchain block: {:?}", e); true } }, @@ -196,60 +162,83 @@ impl TonSubscriber { fn handle_shard_block( &self, - block: &ton_block::Block, - shard_state: Option<&ShardStateStuff>, - block_hash: &UInt256, + block: &BlockStuff, + block_hash: &HashBytes, + shard_state_stuff: &ShardStateStuff, ) -> Result> { - let block_info = block.info.read_struct()?; - let extra = block.extra.read_struct()?; - let account_blocks = extra.read_account_blocks()?; - - if let Some(shard_state) = shard_state { - let shard_accounts = shard_state.state().read_accounts()?; - let state_handle = shard_state.ref_mc_state_handle().clone(); - - let mut shards_accounts = self.shards_accounts_cache.write(); - shards_accounts.insert( - *block_info.shard(), - ShardAccounts { + let block_info = block.load_info()?; + let extra = block.load_extra()?; + let account_blocks = extra.account_blocks.load()?; + let shard = block.id().shard; + + { + let shard_accounts = shard_state_stuff.state().load_accounts()?; + let state_handle = shard_state_stuff.ref_mc_state_handle().clone(); + + let mut cache = self.sc_accounts.write(); + cache.insert( + block_info.shard, + CachedAccounts { accounts: shard_accounts, state_handle, }, ); - if block_info.after_merge() || block_info.after_split() { - let block_ids = block_info.read_prev_ids()?; - match block_ids.len() { - 1 => { - let (left, right) = block_ids[0].shard_id.split()?; - if shards_accounts.contains_key(&left) - && shards_accounts.contains_key(&right) - { - shards_accounts.remove(&block_ids[0].shard_id); + if block_info.after_merge || block_info.after_split { + tracing::debug!("clearing shard states cache after shards merge/split"); + + match block_info.load_prev_ref()? { + // Block after split + // | + // * - block A + // / \ + // * * - blocks B', B" + PrevBlockRef::Single(..) => { + // Compute parent shard of the B' or B" + let parent = shard + .merge() + .ok_or(tycho_types::error::Error::InvalidData)?; + + let opposite = shard.opposite().expect("after split"); + + // Remove parent shard state + if cache.contains_key(&shard) && cache.contains_key(&opposite) { + cache.remove(&parent); } } - len if len > 1 => { - for block_id in block_info.read_prev_ids()? { - shards_accounts.remove(&block_id.shard_id); - } + + // Block after merge + // * * - blocks A', A" + // \ / + // * - block B + // | + PrevBlockRef::AfterMerge { .. } => { + // Compute parent shard of the B' or B" + let (left, right) = shard + .split() + .ok_or(tycho_types::error::Error::InvalidData)?; + + // Find and remove all parent shards + cache.remove(&left); + cache.remove(&right); } - _ => {} } } - drop(shards_accounts); + drop(cache); } let mut states = FuturesUnordered::new(); let state_subscriptions = self.state_subscriptions.read(); let token_subscription = self.token_subscription.read(); - let shards_accounts_cache = self.shards_accounts_cache.read(); + let shards_accounts_cache = self.sc_accounts.read(); - account_blocks.iterate_with_keys(|account, account_block| { + for account_block in account_blocks.iter() { + let (account, _, account_block) = account_block?; match state_subscriptions.get(&account) { Some(subscription) => { match subscription.handle_block( &self.messages_queue, - &block_info, + block_info, &account_block, &account, block_hash, @@ -260,7 +249,7 @@ impl TonSubscriber { } } Err(e) => { - log::error!("Failed to handle block: {:?}", e); + tracing::error!("Failed to handle block: {:?}", e); } }; } @@ -270,7 +259,7 @@ impl TonSubscriber { match token_subscription.handle_block( &state_subscriptions, &shards_accounts_cache, - &block_info, + block_info, &account_block, &account, block_hash, @@ -281,109 +270,46 @@ impl TonSubscriber { } } Err(e) => { - log::error!("Failed to handle block: {:?}", e); + tracing::error!("Failed to handle block: {:?}", e); } } } - }; - - Ok(true) - })?; + } + } self.messages_queue - .update(block_info.shard(), block_info.gen_utime().as_u32()); + .update(&block_info.shard, block_info.gen_utime); Ok(states) } - fn handle_full_state( - &self, - state: Arc, - ) -> Result> { - let shard_accounts = state.state().read_accounts()?; - let state_handle = state.ref_mc_state_handle().clone(); - - let mut shards_accounts = self.shards_accounts_cache.write(); - shards_accounts.insert( - *state.shard(), - ShardAccounts { - accounts: shard_accounts, - state_handle, - }, - ); - drop(shards_accounts); - - let full_state_subscription = self.full_state_subscription.read(); - full_state_subscription - .as_ref() - .trust_me() - .handle_full_state(state) - } - - fn update_signature_id(&self, key_block: &ton_block::Block) -> Result<()> { - let extra = key_block.read_extra()?; - let custom = extra - .read_custom()? - .context("McBlockExtra not found in the masterchain block")?; - let config = custom - .config() - .context("Config not found in the key block")?; - - self.signature_id - .store(config.capabilities(), key_block.global_id); - + fn update_signature_id(&self, capabilities: u64, global_id: i32) -> Result<()> { + self.signature_id.store(capabilities, global_id); Ok(()) } - - async fn wait_sync(&self) { - if self.ready.load(Ordering::Acquire) { - return; - } - self.ready_signal.notified().await; - } } -#[async_trait::async_trait] -impl ton_indexer::Subscriber for TonSubscriber { - async fn engine_status_changed(&self, status: EngineStatus) { - if status == EngineStatus::Synced { - log::info!("TON subscriber is ready"); - self.ready.store(true, Ordering::Release); - self.ready_signal.notify_waiters(); - } - } +impl TonSubscriber { + pub async fn process_block( + &self, + block_stuff: &BlockStuff, + state: &ShardStateStuff, + ) -> Result<()> { + let block_id = block_stuff.id(); - async fn process_block(&self, ctx: ProcessBlockContext<'_>) -> Result<()> { - if ctx.block_stuff().id().is_masterchain() { - self.handle_masterchain_block(ctx.meta(), ctx.block())?; + if block_id.is_masterchain() { + self.handle_masterchain_block(block_stuff)?; } else { - let mut states = self.handle_shard_block( - ctx.block(), - ctx.shard_state_stuff(), - &ctx.block_stuff().id().root_hash, - )?; + let mut states = self.handle_shard_block(block_stuff, &block_id.root_hash, state)?; while let Some(status) = states.next().await { if let Err(err) = status { - log::error!("Failed to receive transaction status: {}", err); + tracing::error!("Failed to receive transaction status: {}", err); } } } Ok(()) } - - async fn process_full_state(&self, state: Arc) -> Result<()> { - if state.block_id().shard_id.is_masterchain() { - return Ok(()); - } - - let res = self.handle_full_state(state)?; - if let Some(rx) = res { - rx.await?; - } - - Ok(()) - } } #[derive(Debug, Copy, Clone, Eq, PartialEq)] @@ -395,45 +321,42 @@ pub struct TonSubscriberMetrics { } struct StateSubscription { - transaction_subscriptions: Vec>, + transaction_subscription: Weak, } impl StateSubscription { fn handle_block( &self, messages_queue: &PendingMessagesQueue, - block_info: &ton_block::BlockInfo, - account_block: &ton_block::AccountBlock, - account: &UInt256, - block_hash: &UInt256, + block_info: &BlockInfo, + account_block: &AccountBlock, + account: &HashBytes, + block_hash: &HashBytes, ) -> Result> { let states = FuturesUnordered::new(); - if self.transaction_subscriptions.is_empty() { - return Ok(states); - } - - for transaction in account_block.transactions().iter() { - let result = transaction.and_then(|(_, value)| { - let cell = value.into_cell().reference(0)?; - let hash = cell.repr_hash(); - - ton_block::Transaction::construct_from_cell(cell) - .map(|transaction| (hash, transaction)) + for transaction in account_block.transactions.iter() { + let result = transaction.and_then(|(_, _, value)| { + let hash = *value.repr_hash(); + value.load().map(|tx| (tx, hash)) }); - let (hash, transaction) = match result { - Ok(tx) => tx, + let (transaction, hash) = match result { + Ok((tx, transaction_hash)) => (tx, transaction_hash), Err(e) => { - log::error!( + tracing::error!( "Failed to parse transaction in block {} for account {}: {:?}", - block_info.seq_no(), - account.to_hex_string(), + block_info.seqno, + account.to_string(), e ); continue; } }; + let account = UInt256::with_array(account.0); + let transaction_hash = UInt256::with_array(hash.0); + let block_hash = UInt256::with_array(block_hash.0); + let transaction = conver_to_old_transaction(&transaction)?; // Skip non-ordinary transactions let transaction_info = match transaction.description.read_struct() { Ok(ton_block::TransactionDescr::Ordinary(info)) => info, @@ -447,7 +370,10 @@ impl StateSubscription { { Some((message_cell, Ok(message))) => { if matches!(message.header(), ton_block::CommonMsgInfo::ExtInMsgInfo(_)) { - messages_queue.deliver_message(*account, message_cell.hash()); + messages_queue.deliver_message( + HashBytes::from_slice(account.as_slice()), + HashBytes::from_slice(message_cell.hash().as_slice()), + ); } message } @@ -455,10 +381,10 @@ impl StateSubscription { }; let ctx = TxContext { - block_info, - block_hash, - account, - transaction_hash: &hash, + block_info_gen_utime: block_info.gen_utime, + block_hash: &block_hash, + account: &account, + transaction_hash: &transaction_hash, transaction_info: &transaction_info, transaction: &transaction, in_msg: &in_msg, @@ -467,17 +393,17 @@ impl StateSubscription { }; // Handle transaction - for subscription in self.iter_transaction_subscriptions() { - let (tx, rx) = oneshot::channel(); + let (tx, rx) = oneshot::channel(); + if let Some(subscription) = self.transaction_subscription.upgrade() { match subscription.handle_transaction(ctx, tx) { Ok(_) => { states.push(rx); } Err(e) => { - log::error!( + tracing::error!( "Failed to handle transaction {} for account {}: {:?}", - hash.to_hex_string(), - account.to_hex_string(), + hash.to_string(), + account.to_string(), e ); } @@ -487,14 +413,6 @@ impl StateSubscription { Ok(states) } - - fn iter_transaction_subscriptions( - &'_ self, - ) -> impl Iterator> + '_ { - self.transaction_subscriptions - .iter() - .filter_map(Weak::upgrade) - } } struct TokenSubscription { @@ -504,36 +422,37 @@ struct TokenSubscription { impl TokenSubscription { fn handle_block( &self, - state_subscriptions: &RwLockReadGuard>, - shards_accounts_cache: &FxHashMap, - block_info: &ton_block::BlockInfo, - account_block: &ton_block::AccountBlock, - account: &UInt256, - block_hash: &UInt256, + state_subscriptions: &RwLockReadGuard>, + shards_accounts_cache: &FxHashMap, + block_info: &BlockInfo, + account_block: &AccountBlock, + account: &HashBytes, + block_hash: &HashBytes, ) -> Result> { let states = FuturesUnordered::new(); - for transaction in account_block.transactions().iter() { - let result = transaction.and_then(|(_, value)| { - let cell = value.into_cell().reference(0)?; - let hash = cell.repr_hash(); - - ton_block::Transaction::construct_from_cell(cell) - .map(|transaction| (hash, transaction)) + for transaction in account_block.transactions.iter() { + let result = transaction.and_then(|(_, _, value)| { + let hash = *value.repr_hash(); + value.load().map(|tx| (tx, hash)) }); - let (hash, transaction) = match result { - Ok(tx) => tx, + let (transaction, hash) = match result { + Ok((tx, transaction_hash)) => (tx, transaction_hash), Err(e) => { - log::error!( + tracing::error!( "Failed to parse transaction in block {} for account {}: {:?}", - block_info.seq_no(), - account.to_hex_string(), + block_info.seqno, + account.to_string(), e ); continue; } }; + let account = UInt256::with_array(account.0); + let transaction_hash = UInt256::with_array(hash.0); + let block_hash = UInt256::with_array(block_hash.0); + let transaction = conver_to_old_transaction(&transaction)?; // Skip non-ordinary transactions let transaction_info = match transaction.description.read_struct() { Ok(ton_block::TransactionDescr::Ordinary(info)) => info, @@ -555,7 +474,7 @@ impl TokenSubscription { if let Some(parsed) = parsed_token_transaction { let token_contract = shards_accounts_cache - .find_account(account)? + .find_account(&HashBytes::from_slice(account.as_slice()))? .ok_or_else(|| TonCoreError::AccountNotExist(account.to_string()))?; let (token_wallet_details, ..) = get_token_wallet_details(&token_contract)?; @@ -566,7 +485,10 @@ impl TokenSubscription { .get_bytestring(0), ); - if state_subscriptions.get(&owner_account).is_some() { + if state_subscriptions + .get(&HashBytes::from_slice(owner_account.as_slice())) + .is_some() + { let in_msg = match transaction .in_msg .as_ref() @@ -577,10 +499,10 @@ impl TokenSubscription { }; let ctx = TxContext { - block_info, - block_hash, - account, - transaction_hash: &hash, + block_info_gen_utime: block_info.gen_utime, + block_hash: &block_hash, + account: &account, + transaction_hash: &transaction_hash, transaction_info: &transaction_info, transaction: &transaction, in_msg: &in_msg, @@ -597,10 +519,10 @@ impl TokenSubscription { states.push(rx); } Err(e) => { - log::error!( + tracing::error!( "Failed to handle token transaction {} for account {}: {:?}", - hash.to_hex_string(), - account.to_hex_string(), + hash.to_string(), + account.to_string(), e ); } @@ -614,42 +536,9 @@ impl TokenSubscription { } } -struct FullStateSubscription { - full_state_subscription: Weak, -} - -impl FullStateSubscription { - fn handle_full_state( - &self, - shard_state: Arc, - ) -> Result> { - let mut res = None; - - if let Some(full_state_subscription) = self.full_state_subscription.upgrade() { - let (tx, rx) = oneshot::channel(); - - let ctx = StateContext { - block_id: shard_state.block_id(), - }; - - match full_state_subscription.handle_full_state(ctx, tx) { - Ok(_) => res = Some(rx), - Err(e) => { - log::error!("Failed to handle full state: {:?}", e); - } - }; - } - - Ok(res) - } -} - trait BlockAwaiter: Send + Sync { - fn handle_block( - &mut self, - block: &ton_block::Block, - block_info: &ton_block::BlockInfo, - ) -> Result; + fn handle_block(&mut self, block: &Block, block_info: &BlockInfo) + -> Result; } #[derive(Debug, Copy, Clone, Eq, PartialEq)] @@ -665,14 +554,6 @@ pub trait TransactionsSubscription: Send + Sync { ) -> Result<()>; } -pub trait FullStatesSubscription: Send + Sync { - fn handle_full_state( - &self, - ctx: StateContext<'_>, - state: HandleTransactionStatusTx, - ) -> Result<()>; -} - /// Generic listener for transactions pub struct AccountObserver(AccountEventsTx); @@ -696,7 +577,7 @@ where // Send event to event manager if it exist if let Some(event) = event { if self.0.send(event).is_err() { - log::error!("Failed to send event: channel is dropped"); + tracing::error!("Failed to send event: channel is dropped"); } } @@ -705,27 +586,10 @@ where } } -impl FullStatesSubscription for AccountObserver -where - T: ReadFromState + Send + Sync, -{ - fn handle_full_state(&self, ctx: StateContext, state: HandleTransactionStatusTx) -> Result<()> { - let event = T::read_from_state(&ctx, state); - - // Send event to event manager if it exist - if self.0.send(event).is_err() { - log::error!("Failed to send event: channel is dropped"); - } - - // Done - Ok(()) - } -} - pub struct ShardAccount { - data: ton_types::Cell, - last_transaction_id: LastTransactionId, - _state_handle: Arc, + pub(crate) data: Cell, + pub(crate) last_transaction_id: LastTransactionId, + _state_handle: RefMcStateHandle, } pub fn make_existing_contract(state: Option) -> Result> { @@ -734,29 +598,44 @@ pub fn make_existing_contract(state: Option) -> Result return Ok(None), }; - match ton_block::Account::construct_from_cell(state.data)? { - ton_block::Account::AccountNone => Ok(None), - ton_block::Account::Account(account) => Ok(Some(ExistingContract { - account, + let account = tycho_types::models::OptionalAccount::load_from(&mut state.data.as_slice()?)?; + + if let Some(stuff) = convert_to_old_account(account)? { + Ok(Some(ExistingContract { + account: stuff, timings: GenTimings::Unknown, last_transaction_id: state.last_transaction_id, - })), + })) + } else { + Ok(None) } } -pub struct ShardAccounts { - pub accounts: ton_block::ShardAccounts, - pub state_handle: Arc, +pub fn convert_to_old_account( + account: tycho_types::models::OptionalAccount, +) -> Result> { + let cell = CellBuilder::build_from(account)?; + let bytes = Boc::encode(cell); + let cell = ton_types::deserialize_tree_of_cells(&mut &*bytes)?; + match ton_block::Account::construct_from(&mut SliceData::load_cell(cell)?)? { + ton_block::Account::AccountNone => Ok(None), + ton_block::Account::Account(stuff) => Ok(Some(stuff)), + } } -impl ShardAccounts { - fn get(&self, account: &UInt256) -> Result> { +pub struct CachedAccounts { + pub accounts: ShardAccounts, + pub state_handle: RefMcStateHandle, +} + +impl CachedAccounts { + fn get(&self, account: &HashBytes) -> Result> { match self.accounts.get(account)? { - Some(account) => Ok(Some(ShardAccount { - data: account.account_cell(), + Some((_, account)) => Ok(Some(ShardAccount { + data: account.account.as_cell().unwrap().clone(), last_transaction_id: LastTransactionId::Exact(TransactionId { - lt: account.last_trans_lt(), - hash: *account.last_trans_hash(), + lt: account.last_trans_lt, + hash: UInt256::with_array(account.last_trans_hash.0), }), _state_handle: self.state_handle.clone(), })), @@ -765,14 +644,31 @@ impl ShardAccounts { } } -impl ShardAccountsMapExt for FxHashMap { - fn find_account(&self, account: &UInt256) -> Result> { +impl ShardAccountsMapExt for FxHashMap { + fn find_account(&self, account: &HashBytes) -> Result> { let item = self .iter() .find(|(shard_ident, _)| contains_account(shard_ident, account)); match item { - Some((_, shard)) => shard.accounts.find_account(account), + Some((_, shard)) => { + if let Some((_, account)) = shard.accounts.get(account)? { + let last_transaction_id = LastTransactionId::Exact(TransactionId { + lt: account.last_trans_lt, + hash: UInt256::with_array(account.last_trans_hash.0), + }); + + let account = account.account.load()?; + if let Some(stuff) = convert_to_old_account(account)? { + return Ok(Some(ExistingContract { + account: stuff, + timings: GenTimings::Unknown, + last_transaction_id, + })); + } + } + Ok(None) + } None => Err(TonCoreError::InvalidContractAddress).context("No suitable shard found"), } } diff --git a/src/utils/existing_contract.rs b/src/utils/existing_contract.rs index e90c463..68a1807 100644 --- a/src/utils/existing_contract.rs +++ b/src/utils/existing_contract.rs @@ -46,7 +46,12 @@ impl ExistingContractExt for ExistingContract { let ExecutionOutput { tokens, result_code, - } = function.run_local(&nekoton_utils::SimpleClock, self.account.clone(), input)?; + } = function.run_local( + &nekoton_utils::SimpleClock, + self.account.clone(), + input, + &[], + )?; tokens.ok_or_else(|| ExistingContractError::NonZeroResultCode(result_code).into()) } diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 7e5e53a..24f5898 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,6 +1,11 @@ use std::hash::BuildHasherDefault; +use anyhow::Result; use rustc_hash::FxHasher; +use ton_block::Deserializable; +use tycho_types::boc::Boc; +use tycho_types::cell::CellBuilder; +use tycho_types::models::Transaction; pub use self::encoding::*; pub use self::existing_contract::*; @@ -18,3 +23,10 @@ mod tx_context; pub type FxDashMap = dashmap::DashMap>; pub type FxDashSet = dashmap::DashSet>; + +pub fn conver_to_old_transaction(transaction: &Transaction) -> Result { + let cell = CellBuilder::build_from(transaction)?; + let bytes = Boc::encode(cell); + let cell = ton_types::deserialize_tree_of_cells(&mut &*bytes)?; + ton_block::Transaction::construct_from_cell(cell) +} diff --git a/src/utils/pending_messages_queue.rs b/src/utils/pending_messages_queue.rs index 8eb8781..e994ff3 100644 --- a/src/utils/pending_messages_queue.rs +++ b/src/utils/pending_messages_queue.rs @@ -6,7 +6,8 @@ use anyhow::Result; use parking_lot::Mutex; use rustc_hash::FxHashMap; use tokio::sync::oneshot; -use ton_types::UInt256; +use tycho_types::cell::HashBytes; +use tycho_types::models::ShardIdent; use super::shard_utils::*; @@ -38,8 +39,8 @@ impl PendingMessagesQueue { pub fn add_message( &self, - account: UInt256, - message_hash: UInt256, + account: HashBytes, + message_hash: HashBytes, expire_at: u32, ) -> Result { let mut entries = self.entries.lock(); @@ -64,7 +65,7 @@ impl PendingMessagesQueue { } } - pub fn deliver_message(&self, account: UInt256, message_hash: UInt256) { + pub fn deliver_message(&self, account: HashBytes, message_hash: HashBytes) { let mut entries = self.entries.lock(); let mut message = match entries.remove(&PendingMessageId { account, @@ -95,7 +96,7 @@ impl PendingMessagesQueue { self.min_expire_at.store(min_expire_at, Ordering::Release); } - pub fn update(&self, shard: &ton_block::ShardIdent, current_utime: u32) { + pub fn update(&self, shard: &ShardIdent, current_utime: u32) { let current_min_expire_at = self.min_expire_at.load(Ordering::Acquire); if current_utime <= current_min_expire_at { return; @@ -131,8 +132,8 @@ pub enum MessageStatus { #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] struct PendingMessageId { - account: UInt256, - message_hash: UInt256, + account: HashBytes, + message_hash: HashBytes, } struct PendingMessage { @@ -153,10 +154,10 @@ enum PendingMessagesQueueError { mod tests { use super::*; - fn make_hash(id: u8) -> UInt256 { + fn make_hash(id: u8) -> HashBytes { let mut hash = [0; 32]; hash[0] = id; - UInt256::from(hash) + HashBytes::from(hash) } fn make_queue() -> Arc { @@ -191,11 +192,11 @@ mod tests { let rx = queue.add_message(make_hash(0), make_hash(0), 10).unwrap(); // Update before expiration time must not do anything - queue.update(&ton_block::ShardIdent::masterchain(), 5); + queue.update(&ShardIdent::MASTERCHAIN, 5); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 10); // Update after expiration time must remove message - queue.update(&ton_block::ShardIdent::masterchain(), 15); + queue.update(&ShardIdent::MASTERCHAIN, 15); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), u32::MAX); assert_eq!(rx.await.unwrap(), MessageStatus::Expired); } @@ -208,16 +209,16 @@ mod tests { let rx2 = queue.add_message(make_hash(1), make_hash(1), 20).unwrap(); let rx1 = queue.add_message(make_hash(0), make_hash(0), 10).unwrap(); - queue.update(&ton_block::ShardIdent::masterchain(), 5); + queue.update(&ShardIdent::MASTERCHAIN, 5); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 10); - queue.update(&ton_block::ShardIdent::masterchain(), 10); + queue.update(&ShardIdent::MASTERCHAIN, 10); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 10); - queue.update(&ton_block::ShardIdent::masterchain(), 15); + queue.update(&ShardIdent::MASTERCHAIN, 15); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 20); - queue.update(&ton_block::ShardIdent::masterchain(), 25); + queue.update(&ShardIdent::MASTERCHAIN, 25); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), u32::MAX); assert_eq!(rx1.await.unwrap(), MessageStatus::Expired); @@ -232,13 +233,13 @@ mod tests { let rx2 = queue.add_message(make_hash(1), make_hash(1), 20).unwrap(); let rx1 = queue.add_message(make_hash(0), make_hash(0), 10).unwrap(); - queue.update(&ton_block::ShardIdent::masterchain(), 5); + queue.update(&ShardIdent::MASTERCHAIN, 5); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 10); queue.deliver_message(make_hash(1), make_hash(1)); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), 10); - queue.update(&ton_block::ShardIdent::masterchain(), 15); + queue.update(&ShardIdent::MASTERCHAIN, 15); assert_eq!(queue.min_expire_at.load(Ordering::Acquire), u32::MAX); assert_eq!(rx1.await.unwrap(), MessageStatus::Expired); diff --git a/src/utils/shard_utils.rs b/src/utils/shard_utils.rs index 276a510..10741e9 100644 --- a/src/utils/shard_utils.rs +++ b/src/utils/shard_utils.rs @@ -1,12 +1,8 @@ use std::collections::HashMap; -use anyhow::{Context, Result}; +use anyhow::Result; use nekoton::transport::models::ExistingContract; -use rustc_hash::FxHashMap; -use ton_block::HashmapAugType; -use ton_types::UInt256; - -use super::existing_contract::*; +use tycho_types::{cell::HashBytes, models::ShardIdent}; pub type ShardsMap = HashMap; @@ -16,57 +12,24 @@ pub struct LatestShardBlocks { pub block_ids: ShardsMap, } -pub type ShardAccountsMap = FxHashMap; - /// Helper trait to reduce boilerplate for getting accounts from shards state pub trait ShardAccountsMapExt { /// Looks for a suitable shard and tries to extract information about the contract from it - fn find_account(&self, account: &UInt256) -> Result>; + fn find_account(&self, account: &HashBytes) -> Result>; } impl ShardAccountsMapExt for &T where T: ShardAccountsMapExt, { - fn find_account(&self, account: &UInt256) -> Result> { + fn find_account(&self, account: &HashBytes) -> Result> { T::find_account(self, account) } } -impl ShardAccountsMapExt for ShardAccountsMap { - fn find_account(&self, account: &UInt256) -> Result> { - // Search suitable shard for account by prefix. - // NOTE: In **most** cases suitable shard will be found - let item = self - .iter() - .find(|(shard_ident, _)| contains_account(shard_ident, account)); - - match item { - // Search account in shard state - Some((_, shard)) => shard.find_account(account), - // Exceptional situation when no suitable shard was found - None => Err(ShardUtilsError::InvalidContractAddress).context("No suitable shard found"), - } - } -} - -impl ShardAccountsMapExt for ton_block::ShardAccounts { - fn find_account(&self, account: &UInt256) -> Result> { - match self - .get(account) - .and_then(|account| ExistingContract::from_shard_account_opt(&account))? - { - // Account found - Some(contract) => Ok(Some(contract)), - // Account was not found (it never had any transactions) or there is not AccountStuff in it - None => Ok(None), - } - } -} - -pub fn contains_account(shard: &ton_block::ShardIdent, account: &UInt256) -> bool { - let shard_prefix = shard.shard_prefix_with_tag(); - if shard_prefix == ton_block::SHARD_FULL { +pub fn contains_account(shard: &ShardIdent, account: &HashBytes) -> bool { + let shard_prefix = shard.prefix(); + if shard_prefix == ShardIdent::PREFIX_FULL { true } else { let len = shard.prefix_len(); @@ -76,7 +39,7 @@ pub fn contains_account(shard: &ton_block::ShardIdent, account: &UInt256) -> boo } } -pub fn account_prefix(account: &UInt256, len: usize) -> u64 { +pub fn account_prefix(account: &HashBytes, len: usize) -> u64 { debug_assert!(len <= 64); let account = account.as_slice(); @@ -97,12 +60,6 @@ pub fn account_prefix(account: &UInt256, len: usize) -> u64 { value } -#[derive(thiserror::Error, Debug)] -enum ShardUtilsError { - #[error("Invalid contract address")] - InvalidContractAddress, -} - #[cfg(test)] mod tests { use super::*; @@ -114,7 +71,7 @@ mod tests { *byte = 0xff; } - let account_id = UInt256::from(account_id); + let account_id = HashBytes::from(account_id); for i in 0..64 { let prefix = account_prefix(&account_id, i); assert_eq!(64 - prefix.trailing_zeros(), i as u32); @@ -123,13 +80,12 @@ mod tests { #[test] fn test_contains_account() { - let account = ton_types::UInt256::from_be_bytes( + let account = HashBytes::from_slice( &hex::decode("459b6795bf4d4c3b930c83fe7625cfee99a762e1e114c749b62bfa751b781fa5") .unwrap(), ); - let mut shards = - vec![ton_block::ShardIdent::with_tagged_prefix(0, ton_block::SHARD_FULL).unwrap()]; + let mut shards = vec![ShardIdent::new(0, ton_block::SHARD_FULL).unwrap()]; for _ in 0..4 { let mut new_shards = vec![]; for shard in &shards { @@ -153,8 +109,6 @@ mod tests { target_shard = Some(shard); } - assert!( - matches!(target_shard, Some(shard) if shard.shard_prefix_with_tag() == 0x4800000000000000) - ); + assert!(matches!(target_shard, Some(shard) if shard.prefix() == 0x4800000000000000)); } } diff --git a/src/utils/token_wallet.rs b/src/utils/token_wallet.rs index 2af9ae3..8df2a1d 100644 --- a/src/utils/token_wallet.rs +++ b/src/utils/token_wallet.rs @@ -23,7 +23,7 @@ pub fn prepare_token_transfer( tokens: BigUint, send_gas_to: MsgAddressInt, notify_receiver: bool, - attached_amount: u64, + attached_amount: u128, payload: ton_types::Cell, ) -> Result { let (function, input) = match version { @@ -89,7 +89,7 @@ pub fn prepare_token_burn( tokens: BigUint, send_gas_to: MsgAddressInt, callback_to: MsgAddressInt, - attached_amount: u64, + attached_amount: u128, payload: ton_types::Cell, ) -> Result { let (function, input) = match version { @@ -134,7 +134,7 @@ pub fn prepare_token_mint( deploy_wallet_value: BigUint, send_gas_to: MsgAddressInt, notify: bool, - attached_amount: u64, + attached_amount: u128, payload: ton_types::Cell, ) -> Result { let (function, input) = match version { @@ -170,6 +170,7 @@ pub fn get_token_wallet_address( let root_contract_state = RootTokenContractState(ExecutionContext { clock: &SimpleClock, account_stuff: &root_contract.account, + libraries: &[], }); let RootTokenContractDetails { version, .. } = root_contract_state.guess_details()?; @@ -183,6 +184,7 @@ pub fn get_token_wallet_account( let root_contract_state = RootTokenContractState(ExecutionContext { clock: &SimpleClock, account_stuff: &root_contract.account, + libraries: &[], }); let RootTokenContractDetails { version, .. } = root_contract_state.guess_details()?; @@ -199,6 +201,7 @@ pub fn get_token_wallet_basic_info( let token_wallet_state = TokenWalletContractState(ExecutionContext { clock: &SimpleClock, account_stuff: &token_contract.account, + libraries: &[], }); let version = token_wallet_state.get_version()?; @@ -213,6 +216,7 @@ pub fn get_token_wallet_details( let contract_state = TokenWalletContractState(ExecutionContext { clock: &SimpleClock, account_stuff: &token_contract.account, + libraries: &[], }); let hash = *contract_state.get_code_hash()?.as_slice(); @@ -226,6 +230,7 @@ pub fn get_root_token_version(root_contract: &ExistingContract) -> Result, state: HandleTransactionStatusTx) -> Option; } - pub trait ReadFromState: Sized { fn read_from_state(ctx: &StateContext<'_>, state: HandleTransactionStatusTx) -> Self; } #[derive(Copy, Clone)] pub struct StateContext<'a> { - pub block_id: &'a ton_block::BlockIdExt, + pub block_id: &'a BlockId, } #[derive(Copy, Clone)] pub struct TxContext<'a> { - pub block_info: &'a ton_block::BlockInfo, + pub block_info_gen_utime: u32, pub block_hash: &'a UInt256, pub account: &'a UInt256, pub transaction_hash: &'a UInt256, @@ -52,7 +52,6 @@ impl TxContext<'_> { None } } - #[allow(dead_code)] pub fn find_function_output( &self, @@ -126,6 +125,5 @@ pub enum HandleTransactionStatus { Success, Fail, } - pub type HandleTransactionStatusTx = oneshot::Sender; pub type HandleTransactionStatusRx = oneshot::Receiver;