From 1105ff1d69df2707627b1f43939743de2b5640d7 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Wed, 28 May 2025 19:59:34 +0530 Subject: [PATCH 01/65] refactor: use es_entity framework for profile entity (#609) * refactor: refactor profile entity file to use es_entity * fix: impl Debug on Profile for tracing * fix: replaced find fns * fix: use findby where needed * fix: use dp op in place of tx * fix: uses multiple dp ops * fix: added es_entity errors * chore: remove profile migration and fns * fix: check-code warnings * fix: persist=false for accountid in profile * chore: run cargo sqlx * chore: change argument order in findby fns * chore: rename findby fns alphabetically --- ...d4e219fc9a686522cf9659631b9a237d3c5c.json} | 15 +- ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 -- ...4259ebf7e71ecd8ce03c94ba93821fe418769.json | 41 +++++ ...7f377eed78308605fdeea22a492fdb2959f8.json} | 15 +- ...ab1e304568264e004dec9b8b8cc306dfaee66.json | 82 ---------- ...80ef5f6f12e5470ef2e4bcb20ca149efe76a5.json | 42 +++++ ...bb8180291099d89ed63e0e52aaab5fcef870b.json | 43 +++++ ...cbe5d117b54b754c0cc888edf82ed2972f5c1.json | 34 ---- ...8fe1b79f192b99e0cb9332966ac276d996c72.json | 42 +++++ ...67d2d5d99783da25e3f0b812eb9f8140fd2ea.json | 18 +++ ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 ----- ...ca2d990d2c9684cc57fdd495e5b563c338437.json | 15 ++ ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 ------ ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 ------ ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 ----------------- ...7d63d05384431c34951c1070988e4f1ad8c39.json | 42 +++++ ...90f4ff385da85805ceb84ef85f0e217700964.json | 18 +++ ...5f403d6ca6274a0d7816a8a2979943159c062.json | 82 ---------- ...ba25755874dcd529542e64ddf7ff141c38b58.json | 22 --- ...617e00165732c51fc5a80c8c3e7f9efb883f5.json | 17 ++ ...ef17cd064e365de7498416bec1b12659c863.json} | 14 +- ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 -------------- ...e0029f8f09034a5a6b7c79af6764cb271de75.json | 42 +++++ ...2afd3637ae78fa2c69041ac51c3967cb9ceb6.json | 40 +++++ ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 ----------------- ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 ------- ...54d7af96faf5adddceed9e5844c823ddf83c2.json | 20 --- ...f8775140e69530c135335ff2b5e75f2a5bb6c.json | 16 -- ...fa3a4f1df8e71d1459e7889c5cc2450cec803.json | 82 ---------- ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 ----- ...8bf96d4df8f3b2143e2f85e2f9997e07b9680.json | 32 ---- ...485baf1435b1306562058c570ad5acc277d42.json | 22 --- ...96c317d130d42145d64525f0c5b2c59ef79d4.json | 41 +++++ ...e85bf90df3e4bfaf564c808b9efefd5c3e00e.json | 43 +++++ src/admin/app.rs | 26 ++- src/api/server/convert.rs | 9 +- src/app/mod.rs | 23 ++- src/batch_inclusion/mod.rs | 2 +- src/job/process_payout_queue.rs | 2 +- src/payout_queue/repo.rs | 8 +- src/profile/entity.rs | 81 +++++----- src/profile/error.rs | 14 +- src/profile/migration.rs | 34 ---- src/profile/mod.rs | 1 - src/profile/repo.rs | 152 ++++-------------- tests/application_errors.rs | 6 +- 46 files changed, 582 insertions(+), 1320 deletions(-) rename .sqlx/{query-813653d1aaa7ba4d6b4f8ce356f0898f1c086e63fa7a35a0ef16920621a2135a.json => query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json} (54%) delete mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json create mode 100644 .sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json rename .sqlx/{query-040edae73739bda4b4d2ba3c67a90f9dc7a528b9e6dff3d56497d7d6c1db72ad.json => query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json} (54%) delete mode 100644 .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json create mode 100644 .sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json create mode 100644 .sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json delete mode 100644 .sqlx/query-3f96b570e8ced8061e9340b74fecbe5d117b54b754c0cc888edf82ed2972f5c1.json create mode 100644 .sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json create mode 100644 .sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json delete mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json create mode 100644 .sqlx/query-659b0e11d8ed5120ab4151c46b8ca2d990d2c9684cc57fdd495e5b563c338437.json delete mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json delete mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json delete mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json create mode 100644 .sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json create mode 100644 .sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json delete mode 100644 .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json delete mode 100644 .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json create mode 100644 .sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json rename .sqlx/{query-cdf731397d32cea6dbd5a9599580ed820b65a67dc90f91ef92ce9bba2a6d321a.json => query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json} (54%) delete mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json create mode 100644 .sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json create mode 100644 .sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json delete mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json delete mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json delete mode 100644 .sqlx/query-cceef64b1a4d7d1102d916a5c9654d7af96faf5adddceed9e5844c823ddf83c2.json delete mode 100644 .sqlx/query-d423fc9d8f7296e2278cd7f32b5f8775140e69530c135335ff2b5e75f2a5bb6c.json delete mode 100644 .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json delete mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json delete mode 100644 .sqlx/query-e2d3033999e9a08a6be9fa533c48bf96d4df8f3b2143e2f85e2f9997e07b9680.json delete mode 100644 .sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json create mode 100644 .sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json create mode 100644 .sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json delete mode 100644 src/profile/migration.rs diff --git a/.sqlx/query-813653d1aaa7ba4d6b4f8ce356f0898f1c086e63fa7a35a0ef16920621a2135a.json b/.sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json similarity index 54% rename from .sqlx/query-813653d1aaa7ba4d6b4f8ce356f0898f1c086e63fa7a35a0ef16920621a2135a.json rename to .sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json index ebd65abe..bd7f6bcf 100644 --- a/.sqlx/query-813653d1aaa7ba4d6b4f8ce356f0898f1c086e63fa7a35a0ef16920621a2135a.json +++ b/.sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "SELECT p.id, e.sequence, e.event_type, e.event\n FROM bria_profiles p\n JOIN bria_profile_events e ON p.id = e.id\n WHERE p.account_id = $1 AND p.name = $2\n ORDER BY p.id, sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE name = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "id", + "name": "entity_id: ProfileId", "type_info": "Uuid" }, { @@ -15,18 +15,17 @@ }, { "ordinal": 2, - "name": "event_type", - "type_info": "Varchar" + "name": "event", + "type_info": "Jsonb" }, { "ordinal": 3, - "name": "event", - "type_info": "Jsonb" + "name": "recorded_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", "Text" ] }, @@ -37,5 +36,5 @@ false ] }, - "hash": "813653d1aaa7ba4d6b4f8ce356f0898f1c086e63fa7a35a0ef16920621a2135a" + "hash": "137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c" } diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json deleted file mode 100644 index 33a94981..00000000 --- a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Jsonb" - ] - }, - "nullable": [] - }, - "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" -} diff --git a/.sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json b/.sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json new file mode 100644 index 00000000..470d6ba8 --- /dev/null +++ b/.sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769" +} diff --git a/.sqlx/query-040edae73739bda4b4d2ba3c67a90f9dc7a528b9e6dff3d56497d7d6c1db72ad.json b/.sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json similarity index 54% rename from .sqlx/query-040edae73739bda4b4d2ba3c67a90f9dc7a528b9e6dff3d56497d7d6c1db72ad.json rename to .sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json index 4ea2460d..f0e3362e 100644 --- a/.sqlx/query-040edae73739bda4b4d2ba3c67a90f9dc7a528b9e6dff3d56497d7d6c1db72ad.json +++ b/.sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "SELECT p.id, e.sequence, e.event_type, e.event\n FROM bria_profiles p\n JOIN bria_profile_events e ON p.id = e.id\n WHERE p.account_id = $1 AND p.id = $2\n ORDER BY p.id, sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE account_id = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "id", + "name": "entity_id: ProfileId", "type_info": "Uuid" }, { @@ -15,18 +15,17 @@ }, { "ordinal": 2, - "name": "event_type", - "type_info": "Varchar" + "name": "event", + "type_info": "Jsonb" }, { "ordinal": 3, - "name": "event", - "type_info": "Jsonb" + "name": "recorded_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", "Uuid" ] }, @@ -37,5 +36,5 @@ false ] }, - "hash": "040edae73739bda4b4d2ba3c67a90f9dc7a528b9e6dff3d56497d7d6c1db72ad" + "hash": "23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8" } diff --git a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json deleted file mode 100644 index 301c5cc3..00000000 --- a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" -} diff --git a/.sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json b/.sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json new file mode 100644 index 00000000..aa65011c --- /dev/null +++ b/.sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5" +} diff --git a/.sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json b/.sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json new file mode 100644 index 00000000..bad2e242 --- /dev/null +++ b/.sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b" +} diff --git a/.sqlx/query-3f96b570e8ced8061e9340b74fecbe5d117b54b754c0cc888edf82ed2972f5c1.json b/.sqlx/query-3f96b570e8ced8061e9340b74fecbe5d117b54b754c0cc888edf82ed2972f5c1.json deleted file mode 100644 index 871beef8..00000000 --- a/.sqlx/query-3f96b570e8ced8061e9340b74fecbe5d117b54b754c0cc888edf82ed2972f5c1.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT sequence, event_type, event FROM bria_profile_events\n WHERE id = $1\n ORDER BY sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 1, - "name": "event_type", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "3f96b570e8ced8061e9340b74fecbe5d117b54b754c0cc888edf82ed2972f5c1" -} diff --git a/.sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json b/.sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json new file mode 100644 index 00000000..c4f5d5a2 --- /dev/null +++ b/.sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72" +} diff --git a/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json b/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json new file mode 100644 index 00000000..dc2a5afe --- /dev/null +++ b/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_profile_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea" +} diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json deleted file mode 100644 index 105bf98b..00000000 --- a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - "Jsonb", - "Jsonb", - "Jsonb", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" -} diff --git a/.sqlx/query-659b0e11d8ed5120ab4151c46b8ca2d990d2c9684cc57fdd495e5b563c338437.json b/.sqlx/query-659b0e11d8ed5120ab4151c46b8ca2d990d2c9684cc57fdd495e5b563c338437.json new file mode 100644 index 00000000..568723a5 --- /dev/null +++ b/.sqlx/query-659b0e11d8ed5120ab4151c46b8ca2d990d2c9684cc57fdd495e5b563c338437.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_profiles SET name = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "659b0e11d8ed5120ab4151c46b8ca2d990d2c9684cc57fdd495e5b563c338437" +} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json deleted file mode 100644 index 074622c1..00000000 --- a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - } - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" -} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json deleted file mode 100644 index 7857e9f9..00000000 --- a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "code", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "params", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "tx_input", - "type_info": "Jsonb" - }, - { - "ordinal": 4, - "name": "entries", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - true, - false, - false - ] - }, - "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" -} diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json deleted file mode 100644 index 3c7819b4..00000000 --- a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" -} diff --git a/.sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json b/.sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json new file mode 100644 index 00000000..6377c100 --- /dev/null +++ b/.sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39" +} diff --git a/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json b/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json new file mode 100644 index 00000000..f3923a59 --- /dev/null +++ b/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_profile_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964" +} diff --git a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json deleted file mode 100644 index 00d0da2e..00000000 --- a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" -} diff --git a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json deleted file mode 100644 index f856a851..00000000 --- a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false - ] - }, - "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" -} diff --git a/.sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json b/.sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json new file mode 100644 index 00000000..801a421c --- /dev/null +++ b/.sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_profiles (id, name, account_id, created_at) VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5" +} diff --git a/.sqlx/query-cdf731397d32cea6dbd5a9599580ed820b65a67dc90f91ef92ce9bba2a6d321a.json b/.sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json similarity index 54% rename from .sqlx/query-cdf731397d32cea6dbd5a9599580ed820b65a67dc90f91ef92ce9bba2a6d321a.json rename to .sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json index 8664cb69..0a78d4dc 100644 --- a/.sqlx/query-cdf731397d32cea6dbd5a9599580ed820b65a67dc90f91ef92ce9bba2a6d321a.json +++ b/.sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "SELECT p.id, e.sequence, e.event_type, e.event\n FROM bria_profiles p\n JOIN bria_profile_events e ON p.id = e.id\n WHERE p.account_id = $1\n ORDER BY p.id, sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE id = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "id", + "name": "entity_id: ProfileId", "type_info": "Uuid" }, { @@ -15,13 +15,13 @@ }, { "ordinal": 2, - "name": "event_type", - "type_info": "Varchar" + "name": "event", + "type_info": "Jsonb" }, { "ordinal": 3, - "name": "event", - "type_info": "Jsonb" + "name": "recorded_at", + "type_info": "Timestamptz" } ], "parameters": { @@ -36,5 +36,5 @@ false ] }, - "hash": "cdf731397d32cea6dbd5a9599580ed820b65a67dc90f91ef92ce9bba2a6d321a" + "hash": "a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863" } diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json deleted file mode 100644 index b95d0aed..00000000 --- a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "transaction_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "entry_type", - "type_info": "Varchar" - }, - { - "ordinal": 6, - "name": "layer: Layer", - "type_info": { - "Custom": { - "name": "layer", - "kind": { - "Enum": [ - "settled", - "pending", - "encumbered" - ] - } - } - } - }, - { - "ordinal": 7, - "name": "units", - "type_info": "Numeric" - }, - { - "ordinal": 8, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 9, - "name": "direction: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 10, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 11, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 12, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - false, - false - ] - }, - "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" -} diff --git a/.sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json b/.sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json new file mode 100644 index 00000000..d26d08a0 --- /dev/null +++ b/.sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75" +} diff --git a/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json b/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json new file mode 100644 index 00000000..cac331b6 --- /dev/null +++ b/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.id AS \"id: ProfileId\", e.sequence, e.event, e.recorded_at FROM bria_profiles i JOIN bria_profile_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6" +} diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json deleted file mode 100644 index 92db28c8..00000000 --- a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" -} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json deleted file mode 100644 index 90bef3da..00000000 --- a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - }, - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - }, - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" -} diff --git a/.sqlx/query-cceef64b1a4d7d1102d916a5c9654d7af96faf5adddceed9e5844c823ddf83c2.json b/.sqlx/query-cceef64b1a4d7d1102d916a5c9654d7af96faf5adddceed9e5844c823ddf83c2.json deleted file mode 100644 index 02c317d1..00000000 --- a/.sqlx/query-cceef64b1a4d7d1102d916a5c9654d7af96faf5adddceed9e5844c823ddf83c2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT count(*) FROM bria_profile_events", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "count", - "type_info": "Int8" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null - ] - }, - "hash": "cceef64b1a4d7d1102d916a5c9654d7af96faf5adddceed9e5844c823ddf83c2" -} diff --git a/.sqlx/query-d423fc9d8f7296e2278cd7f32b5f8775140e69530c135335ff2b5e75f2a5bb6c.json b/.sqlx/query-d423fc9d8f7296e2278cd7f32b5f8775140e69530c135335ff2b5e75f2a5bb6c.json deleted file mode 100644 index 43382c71..00000000 --- a/.sqlx/query-d423fc9d8f7296e2278cd7f32b5f8775140e69530c135335ff2b5e75f2a5bb6c.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_profiles (id, account_id, name)\n VALUES ($1, $2, $3)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Varchar" - ] - }, - "nullable": [] - }, - "hash": "d423fc9d8f7296e2278cd7f32b5f8775140e69530c135335ff2b5e75f2a5bb6c" -} diff --git a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json deleted file mode 100644 index 18d9c9b6..00000000 --- a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "TextArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" -} diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json deleted file mode 100644 index 8de91f27..00000000 --- a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Uuid", - "Date", - "Uuid", - "Varchar", - "Varchar", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" -} diff --git a/.sqlx/query-e2d3033999e9a08a6be9fa533c48bf96d4df8f3b2143e2f85e2f9997e07b9680.json b/.sqlx/query-e2d3033999e9a08a6be9fa533c48bf96d4df8f3b2143e2f85e2f9997e07b9680.json deleted file mode 100644 index d65aee40..00000000 --- a/.sqlx/query-e2d3033999e9a08a6be9fa533c48bf96d4df8f3b2143e2f85e2f9997e07b9680.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, account_id, name FROM bria_profiles", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "e2d3033999e9a08a6be9fa533c48bf96d4df8f3b2143e2f85e2f9997e07b9680" -} diff --git a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json deleted file mode 100644 index 50c0e05c..00000000 --- a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "payload!", - "type_info": "Json" - } - ], - "parameters": { - "Left": [ - "Int8" - ] - }, - "nullable": [ - null - ] - }, - "hash": "e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42" -} diff --git a/.sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json b/.sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json new file mode 100644 index 00000000..043c781b --- /dev/null +++ b/.sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4" +} diff --git a/.sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json b/.sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json new file mode 100644 index 00000000..fb1ed0cf --- /dev/null +++ b/.sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e" +} diff --git a/src/admin/app.rs b/src/admin/app.rs index 0d9b7fb3..cd37bc3d 100644 --- a/src/admin/app.rs +++ b/src/admin/app.rs @@ -10,7 +10,6 @@ pub struct AdminApp { accounts: Accounts, profiles: Profiles, ledger: Ledger, - pool: sqlx::PgPool, network: bitcoin::Network, } @@ -21,7 +20,6 @@ impl AdminApp { accounts: Accounts::new(&pool), profiles: Profiles::new(&pool), ledger: Ledger::new(&pool), - pool, network, } } @@ -34,26 +32,26 @@ impl AdminApp { return Err(AdminApiError::BadNetworkForDev); } let admin_key = self.bootstrap().await?; + let mut db = self.profiles.begin_op().await?; - let mut tx = self.pool.begin().await?; let account = self .accounts - .create_in_tx(&mut tx, dev_constants::DEV_ACCOUNT_NAME.to_owned()) + .create_in_tx(db.tx(), dev_constants::DEV_ACCOUNT_NAME.to_owned()) .await?; self.ledger - .create_journal_for_account(&mut tx, account.id, account.name.clone()) + .create_journal_for_account(db.tx(), account.id, account.name.clone()) .await?; let new_profile = NewProfile::builder() .account_id(account.id) .name(account.name) .build() .expect("Couldn't build NewProfile"); - let profile = self.profiles.create_in_tx(&mut tx, new_profile).await?; + let profile = self.profiles.create_in_op(&mut db, new_profile).await?; let profile_key = self .profiles - .create_key_for_profile_in_tx(&mut tx, profile, true) + .create_key_for_profile_in_tx(db.tx(), profile, true) .await?; - tx.commit().await?; + db.commit().await?; Ok((admin_key, profile_key)) } @@ -73,25 +71,25 @@ impl AdminApp { &self, account_name: String, ) -> Result { - let mut tx = self.pool.begin().await?; + let mut db = self.profiles.begin_op().await?; let account = self .accounts - .create_in_tx(&mut tx, account_name.clone()) + .create_in_tx(db.tx(), account_name.clone()) .await?; self.ledger - .create_journal_for_account(&mut tx, account.id, account.name.clone()) + .create_journal_for_account(db.tx(), account.id, account.name.clone()) .await?; let new_profile = NewProfile::builder() .account_id(account.id) .name(account.name) .build() .expect("Couldn't build NewProfile"); - let profile = self.profiles.create_in_tx(&mut tx, new_profile).await?; + let profile = self.profiles.create_in_op(&mut db, new_profile).await?; let key = self .profiles - .create_key_for_profile_in_tx(&mut tx, profile, false) + .create_key_for_profile_in_tx(db.tx(), profile, false) .await?; - tx.commit().await?; + db.commit().await?; Ok(key) } diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index e40a8a8c..906a574f 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -679,12 +679,9 @@ impl From for tonic::Status { ApplicationError::PayoutQueueError(PayoutQueueError::EsEntityError( es_entity::EsEntityError::NotFound, )) => tonic::Status::not_found(err.to_string()), - ApplicationError::ProfileError(ProfileError::ProfileNameNotFound(_)) => { - tonic::Status::not_found(err.to_string()) - } - ApplicationError::ProfileError(ProfileError::ProfileIdNotFound(_)) => { - tonic::Status::not_found(err.to_string()) - } + ApplicationError::ProfileError(ProfileError::EsEntityError( + es_entity::EsEntityError::NotFound, + )) => tonic::Status::not_found(err.to_string()), ApplicationError::PayoutError(PayoutError::PayoutIdNotFound(_)) => { tonic::Status::not_found(err.to_string()) } diff --git a/src/app/mod.rs b/src/app/mod.rs index 9f43ab63..86bdd42a 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -116,7 +116,6 @@ impl App { config, _runner: runner, }; - crate::profile::migration::profile_event_migration(&app.pool).await?; if let Some(deprecrated_encryption_key) = app.config.deprecated_encryption_key.as_ref() { app.rotate_encryption_key(deprecrated_encryption_key) .await?; @@ -141,15 +140,13 @@ impl App { name: String, spending_policy: Option, ) -> Result { - let mut tx = self.pool.begin().await?; let new_profile = NewProfile::builder() .account_id(profile.account_id) .name(name) .spending_policy(spending_policy) .build() .expect("Couldn't build NewProfile"); - let new_profile = self.profiles.create_in_tx(&mut tx, new_profile).await?; - tx.commit().await?; + let new_profile = self.profiles.create(new_profile).await?; Ok(new_profile) } @@ -162,12 +159,10 @@ impl App { ) -> Result<(), ApplicationError> { let mut target_profile = self .profiles - .find_by_id(profile.account_id, profile_id) + .find_by_account_id_and_id(profile.account_id, profile_id) .await?; target_profile.update_spending_policy(spending_policy); - let mut tx = self.pool.begin().await?; - self.profiles.update(&mut tx, target_profile).await?; - tx.commit().await?; + self.profiles.update(&mut target_profile).await?; Ok(()) } @@ -185,7 +180,7 @@ impl App { ) -> Result { let found_profile = self .profiles - .find_by_name(profile.account_id, profile_name) + .find_by_account_id_and_name(profile.account_id, profile_name) .await?; let mut tx = self.pool.begin().await?; let key = self @@ -641,7 +636,7 @@ impl App { ) -> Result<(), ApplicationError> { let payout_queue = self .payout_queues - .find_by_name_and_account_id(name, profile.account_id) + .find_by_account_id_and_name(profile.account_id, name) .await?; job::spawn_process_payout_queue(&self.pool, (payout_queue.account_id, payout_queue.id)) .await?; @@ -690,7 +685,7 @@ impl App { .await?; let payout_queue = self .payout_queues - .find_by_name_and_account_id(queue_name, profile.account_id) + .find_by_account_id_and_name(profile.account_id, queue_name) .await?; let mut tx = self.pool.begin().await?; let mut unbatched_payouts = self @@ -761,7 +756,7 @@ impl App { .await?; let payout_queue = self .payout_queues - .find_by_name_and_account_id(queue_name, profile.account_id) + .find_by_account_id_and_name(profile.account_id, queue_name) .await?; let addr = Address::try_from((address, self.config.blockchain.network))?; self.submit_payout( @@ -795,7 +790,7 @@ impl App { .await?; let payout_queue = self .payout_queues - .find_by_name_and_account_id(queue_name, profile.account_id) + .find_by_account_id_and_name(profile.account_id, queue_name) .await?; let payout_id = PayoutId::new(); let (wallet_id, address) = self @@ -983,7 +978,7 @@ impl App { ) -> Result<(), ApplicationError> { let mut payout_queue = self .payout_queues - .find_by_id_and_account_id(id, profile.account_id) + .find_by_account_id_and_id(profile.account_id, id) .await?; if let Some(desc) = new_description { diff --git a/src/batch_inclusion/mod.rs b/src/batch_inclusion/mod.rs index 4bffcee1..6c717c73 100644 --- a/src/batch_inclusion/mod.rs +++ b/src/batch_inclusion/mod.rs @@ -69,7 +69,7 @@ impl BatchInclusion { } let queue = self .payout_queues - .find_by_id_and_account_id(payout.payout_queue_id, account_id) + .find_by_account_id_and_id(account_id, payout.payout_queue_id) .await?; let estimate = self.estimate_next_queue_trigger(queue).await?; Ok(PayoutWithInclusionEstimate { diff --git a/src/job/process_payout_queue.rs b/src/job/process_payout_queue.rs index 82d0dd25..e5433454 100644 --- a/src/job/process_payout_queue.rs +++ b/src/job/process_payout_queue.rs @@ -52,7 +52,7 @@ pub(super) async fn execute<'a>( JobError, > { let payout_queue = payout_queues - .find_by_id_and_account_id(data.payout_queue_id, data.account_id) + .find_by_account_id_and_id(data.account_id, data.payout_queue_id) .await?; let mut tx = pool.begin().await?; let mut unbatched_payouts = payouts diff --git a/src/payout_queue/repo.rs b/src/payout_queue/repo.rs index 0c2ff801..60a12e5c 100644 --- a/src/payout_queue/repo.rs +++ b/src/payout_queue/repo.rs @@ -21,10 +21,10 @@ impl PayoutQueues { Self { pool: pool.clone() } } - pub async fn find_by_id_and_account_id( + pub async fn find_by_account_id_and_id( &self, - id: PayoutQueueId, account_id: AccountId, + id: PayoutQueueId, ) -> Result { let payout_queue = self.find_by_id(id).await?; @@ -34,10 +34,10 @@ impl PayoutQueues { Ok(payout_queue) } - pub async fn find_by_name_and_account_id( + pub async fn find_by_account_id_and_name( &self, - name: String, account_id: AccountId, + name: String, ) -> Result { let payout_queue = self.find_by_name(name).await?; diff --git a/src/profile/entity.rs b/src/profile/entity.rs index 0bc8dbb3..ae861c02 100644 --- a/src/profile/entity.rs +++ b/src/profile/entity.rs @@ -1,10 +1,12 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; -use crate::{entity::*, primitives::*}; +use crate::primitives::*; -#[derive(Debug, Serialize, Deserialize)] +#[derive(EsEvent, Debug, Clone, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "ProfileId")] pub enum ProfileEvent { Initialized { id: ProfileId, @@ -19,18 +21,28 @@ pub enum ProfileEvent { SpendingPolicyRemoved {}, } -#[derive(Debug, Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct Profile { pub id: ProfileId, pub account_id: AccountId, pub name: String, #[builder(default)] pub spending_policy: Option, - pub(super) events: EntityEvents, } +impl std::fmt::Debug for Profile { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Profile") + .field("id", &self.id) + .field("account_id", &self.account_id) + .field("name", &self.name) + .field("spending_policy", &self.spending_policy) + .finish() + } +} + impl Profile { pub fn update_spending_policy(&mut self, policy: Option) { if self.spending_policy != policy { @@ -60,6 +72,26 @@ impl Profile { } } +impl TryFromEvents for Profile { + fn try_from_events(events: EntityEvents) -> Result { + let mut builder = ProfileBuilder::default(); + for event in events.iter_all() { + match event { + ProfileEvent::Initialized { id, account_id } => { + builder = builder.id(*id).account_id(*account_id); + } + ProfileEvent::NameUpdated { name } => { + builder = builder.name(name.clone()); + } + ProfileEvent::SpendingPolicyUpdated { spending_policy } => { + builder = builder.spending_policy(Some(spending_policy.clone())); + } + ProfileEvent::SpendingPolicyRemoved {} => builder = builder.spending_policy(None), + } + } + builder.events(events).build() + } +} #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct SpendingPolicy { pub allowed_payout_addresses: Vec
, @@ -104,44 +136,21 @@ impl NewProfile { builder.id(ProfileId::new()); builder } +} - pub(super) fn initial_events(self) -> EntityEvents { - let mut events = EntityEvents::init([ +impl IntoEvents for NewProfile { + fn into_events(self) -> EntityEvents { + let mut events = vec![ ProfileEvent::Initialized { id: self.id, account_id: self.account_id, }, ProfileEvent::NameUpdated { name: self.name }, - ]); - if self.spending_policy.is_some() { - events.push(ProfileEvent::SpendingPolicyUpdated { - spending_policy: self.spending_policy.unwrap(), - }); + ]; + if let Some(spending_policy) = self.spending_policy { + events.push(ProfileEvent::SpendingPolicyUpdated { spending_policy }); } - events - } -} - -impl TryFrom> for Profile { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { - let mut builder = ProfileBuilder::default(); - for event in events.iter() { - match event { - ProfileEvent::Initialized { id, account_id } => { - builder = builder.id(*id).account_id(*account_id) - } - ProfileEvent::NameUpdated { name } => { - builder = builder.name(name.clone()); - } - ProfileEvent::SpendingPolicyUpdated { spending_policy } => { - builder = builder.spending_policy(Some(spending_policy.clone())); - } - ProfileEvent::SpendingPolicyRemoved {} => builder = builder.spending_policy(None), - } - } - builder.events(events).build() + EntityEvents::init(self.id, events) } } diff --git a/src/profile/error.rs b/src/profile/error.rs index 2642b546..1f5c78d4 100644 --- a/src/profile/error.rs +++ b/src/profile/error.rs @@ -1,17 +1,15 @@ use thiserror::Error; -use crate::primitives::ProfileId; - #[derive(Error, Debug)] pub enum ProfileError { #[error("ProfileError - Api key does not exist")] ProfileKeyNotFound, - #[error("ProfileError - Could not find profile with name: {0}")] - ProfileNameNotFound(String), - #[error("ProfileError - Could not find profile with id: {0}")] - ProfileIdNotFound(ProfileId), #[error("ProfileError - Sqlx: {0}")] Sqlx(#[from] sqlx::Error), - #[error("ProfileError - EntityError: {0}")] - EntityError(#[from] crate::entity::EntityError), + #[error("ProfileError - EsEntityError: {0}")] + EsEntityError(es_entity::EsEntityError), + #[error("ProfileError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), } + +es_entity::from_es_entity_error!(ProfileError); diff --git a/src/profile/migration.rs b/src/profile/migration.rs deleted file mode 100644 index cf59d1b5..00000000 --- a/src/profile/migration.rs +++ /dev/null @@ -1,34 +0,0 @@ -use sqlx::{Pool, Postgres}; - -use super::{entity::*, error::ProfileError}; - -pub async fn profile_event_migration(pool: &Pool) -> Result<(), ProfileError> { - let res = sqlx::query!("SELECT count(*) FROM bria_profile_events") - .fetch_one(pool) - .await?; - - if res.count.unwrap_or(0) == 0 { - let records = sqlx::query!(r#"SELECT id, account_id, name FROM bria_profiles"#,) - .fetch_all(pool) - .await?; - - let mut tx = pool.begin().await?; - for record in records.into_iter() { - let new_profile = NewProfile::builder() - .id(record.id) - .account_id(record.account_id) - .name(record.name) - .build() - .expect("Failed to build profile"); - let id = new_profile.id; - crate::entity::EntityEvents::::persist( - "bria_profile_events", - &mut tx, - new_profile.initial_events().new_serialized_events(id), - ) - .await?; - } - tx.commit().await?; - } - Ok(()) -} diff --git a/src/profile/mod.rs b/src/profile/mod.rs index edd5a0ce..a22a438b 100644 --- a/src/profile/mod.rs +++ b/src/profile/mod.rs @@ -1,6 +1,5 @@ mod entity; pub mod error; -pub mod migration; mod repo; pub use entity::*; diff --git a/src/profile/repo.rs b/src/profile/repo.rs index 8191e788..6c9779d9 100644 --- a/src/profile/repo.rs +++ b/src/profile/repo.rs @@ -1,11 +1,21 @@ +use es_entity::*; use rand::distributions::{Alphanumeric, DistString}; -use sqlx::{Pool, Postgres, Transaction}; -use std::collections::HashMap; +use sqlx::{Pool, Postgres}; use uuid::Uuid; use super::{entity::*, error::ProfileError}; -use crate::{dev_constants, entity::*, primitives::*}; +use crate::{dev_constants, primitives::*}; +#[derive(EsRepo, Clone, Debug)] +#[es_repo( + entity = "Profile", + err = "ProfileError", + columns( + name(ty = "String"), + account_id(ty = "AccountId", list_for, update(persist = false)) + ), + tbl_prefix = "bria" +)] pub struct Profiles { pool: Pool, } @@ -15,115 +25,47 @@ impl Profiles { Self { pool: pool.clone() } } - pub async fn create_in_tx( - &self, - tx: &mut Transaction<'_, Postgres>, - profile: NewProfile, - ) -> Result { - let id = profile.id; - sqlx::query!( - r#"INSERT INTO bria_profiles (id, account_id, name) - VALUES ($1, $2, $3)"#, - profile.id as ProfileId, - profile.account_id as AccountId, - profile.name, - ) - .execute(&mut **tx) - .await?; - let events = profile.initial_events(); - EntityEvents::::persist( - "bria_profile_events", - &mut *tx, - events.new_serialized_events(id), - ) - .await?; - let res = Profile::try_from(events)?; - Ok(res) - } - pub async fn list_for_account( &self, account_id: AccountId, ) -> Result, ProfileError> { - let rows = sqlx::query!( - r#"SELECT p.id, e.sequence, e.event_type, e.event - FROM bria_profiles p - JOIN bria_profile_events e ON p.id = e.id - WHERE p.account_id = $1 - ORDER BY p.id, sequence"#, - account_id as AccountId - ) - .fetch_all(&self.pool) - .await?; - let mut entity_events = HashMap::new(); - for row in rows { - let id = SigningSessionId::from(row.id); - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } let mut profiles = Vec::new(); - for (_, events) in entity_events { - let profile = Profile::try_from(events)?; - profiles.push(profile); + let mut next = Some(PaginatedQueryArgs::default()); + while let Some(query) = next.take() { + let mut res = self + .list_for_account_id_by_id(account_id, query, Default::default()) + .await?; + + profiles.append(&mut res.entities); + next = res.into_next_query(); } Ok(profiles) } - pub async fn find_by_id( + pub async fn find_by_account_id_and_id( &self, account_id: AccountId, id: ProfileId, ) -> Result { - let rows = sqlx::query!( - r#"SELECT p.id, e.sequence, e.event_type, e.event - FROM bria_profiles p - JOIN bria_profile_events e ON p.id = e.id - WHERE p.account_id = $1 AND p.id = $2 - ORDER BY p.id, sequence"#, - account_id as AccountId, - id as ProfileId - ) - .fetch_all(&self.pool) - .await?; + let profile = self.find_by_id(id).await?; - if !rows.is_empty() { - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - Ok(Profile::try_from(events)?) - } else { - Err(ProfileError::ProfileIdNotFound(id)) + if profile.account_id != account_id { + return Err(ProfileError::EsEntityError(EsEntityError::NotFound)); } + Ok(profile) } - pub async fn find_by_name( + pub async fn find_by_account_id_and_name( &self, account_id: AccountId, name: String, ) -> Result { - let rows = sqlx::query!( - r#"SELECT p.id, e.sequence, e.event_type, e.event - FROM bria_profiles p - JOIN bria_profile_events e ON p.id = e.id - WHERE p.account_id = $1 AND p.name = $2 - ORDER BY p.id, sequence"#, - account_id as AccountId, - name - ) - .fetch_all(&self.pool) - .await?; - - if !rows.is_empty() { - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - Ok(Profile::try_from(events)?) - } else { - Err(ProfileError::ProfileNameNotFound(name)) + let profile = self.find_by_name(name).await?; + if profile.account_id != account_id { + return Err(ProfileError::EsEntityError(EsEntityError::NotFound)); } + Ok(profile) } pub async fn create_key_for_profile_in_tx( @@ -168,38 +110,10 @@ impl Profiles { .await?; if let Some(record) = record { - let rows = sqlx::query!( - r#"SELECT sequence, event_type, event FROM bria_profile_events - WHERE id = $1 - ORDER BY sequence"#, - record.id - ) - .fetch_all(&mut *tx) - .await?; - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - Ok(Profile::try_from(events)?) + let profile = self.find_by_id(ProfileId::from(record.id)).await; + profile } else { Err(ProfileError::ProfileKeyNotFound) } } - - pub async fn update( - &self, - tx: &mut Transaction<'_, Postgres>, - profile: Profile, - ) -> Result<(), ProfileError> { - if !profile.events.is_dirty() { - return Ok(()); - } - EntityEvents::::persist( - "bria_profile_events", - tx, - profile.events.new_serialized_events(profile.id), - ) - .await?; - Ok(()) - } } diff --git a/tests/application_errors.rs b/tests/application_errors.rs index d5984fc8..b1d797d1 100644 --- a/tests/application_errors.rs +++ b/tests/application_errors.rs @@ -159,9 +159,9 @@ async fn profile_name_not_found() -> anyhow::Result<()> { .await; assert!(matches!( err, - Err(ApplicationError::ProfileError( - ProfileError::ProfileNameNotFound(_) - )) + Err(ApplicationError::ProfileError(ProfileError::EsEntityError( + EsEntityError::NotFound + ))) )); Ok(()) } From d75a2757611614b24549a5de4f8899d713c09980 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Fri, 30 May 2025 01:45:03 +0530 Subject: [PATCH 02/65] fix: use entity_id macro from es_entity (#611) * fix: use entity_id macro from es_entity * chore: use es_entity directly --- src/primitives/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/primitives/mod.rs b/src/primitives/mod.rs index eec92ad9..3883d10c 100644 --- a/src/primitives/mod.rs +++ b/src/primitives/mod.rs @@ -21,13 +21,12 @@ impl From for LedgerJournalId { Self::from(uuid::Uuid::from(id)) } } -crate::entity_id! { ProfileId } +es_entity::entity_id! { ProfileId, PayoutQueueId } crate::entity_id! { ProfileApiKeyId } crate::entity_id! { SigningSessionId } crate::entity_id! { KeychainId } crate::entity_id! { SignerId } crate::entity_id! { WalletId } -crate::entity_id! { PayoutQueueId } crate::entity_id! { PayoutId } impl From for LedgerTransactionId { From 720e0ea7c3c10ab44e64a5176620af09acbe21bf Mon Sep 17 00:00:00 2001 From: Chetan Reddy Kodidela <141106399+BROCODES2024@users.noreply.github.com> Date: Tue, 10 Jun 2025 00:42:38 +0530 Subject: [PATCH 03/65] refactor: migrate wallet entity to es_entity (#613) * refactor: migrate wallet entity to es_entity * fix: address Vaibhav Dixit's feedback for PR #613 Remove create_in_tx/find_by_ids , use generated create in mod.rs * fix: update repo.rs per feedback, await N+1 fix (#613) * fix: fixed N+1 with find_all * fix: Optimize wallet fetching in process_payout_queue with find_all * fix: update entity.rs per feedback, await app/mod.rs fix * fix: update src/app/mod.rs per feedback * style: handle clippy warnings * refactor: return Vec from wallet_ids to simplify call site * chore: format code to pass make check-code * fix: removed .clone * chore: add from_es_entity_error --------- Co-authored-by: Vaibhav --- ...a346ce4ced6f651af14b35bc470d17144b93f.json | 24 --- ...6b97a27333e204f10b9e68cf825719c5c2498.json | 15 ++ ...e605c057e17ab90599f89785a9a9ec52db9f2.json | 42 +++++ ...cca618f69ae9b16abeeb1dfe37fd8e3408f13.json | 53 ------ ...49fb445d9fc56abfabc02da15a0283fab9d20.json | 18 ++ ...6f43bb7cba3421f387a5257b5bc3a64059f34.json | 43 +++++ ...7e996563625202c246c34e8e2e06aab5d6106.json | 17 ++ ...ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json | 18 ++ ...787d936751e83fff0a3ab061b91c75aa1822e.json | 43 +++++ ...f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json | 40 +++++ ...89a68b26af13f5bf87ee838647e3d887a074d.json | 52 ------ ...7d25904bbc2435dd08740162eea7dde4c2317.json | 41 +++++ ...f6c018df8ee45d6ca22835b4f88466dfa2bc5.json | 42 +++++ ...f1659f31b9c3f573a243947fc109f4320ad73.json | 41 +++++ ...048aa40abdbf41729814ab96a57f41b760b37.json | 40 +++++ ...708decb30f8c3124db79f2444a18754fe77a3.json | 52 ------ ...2ed2eb5b426d159e55362c2a5fb723cc3fbdd.json | 42 +++++ ...8d36d854264c3a256698fe19aba142ad1d356.json | 40 +++++ ...08f22498c85096123e0c345b9767b5a967571.json | 42 +++++ ...7a784dbd155322d1378e7479f28f815ed3090.json | 40 +++++ src/api/server/convert.rs | 9 +- src/app/mod.rs | 34 ++-- src/job/process_payout_queue.rs | 4 +- src/payout/unbatched.rs | 4 +- src/wallet/entity.rs | 114 +++++++------ src/wallet/error.rs | 12 +- src/wallet/repo.rs | 155 +++++------------- tests/application_errors.rs | 6 +- 28 files changed, 706 insertions(+), 377 deletions(-) delete mode 100644 .sqlx/query-07dfe35dc6e9ce9c7435aa03ba6a346ce4ced6f651af14b35bc470d17144b93f.json create mode 100644 .sqlx/query-2249f68f6b116c763f2805afe476b97a27333e204f10b9e68cf825719c5c2498.json create mode 100644 .sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json delete mode 100644 .sqlx/query-2c5e7765d15a8b3893f40a98898cca618f69ae9b16abeeb1dfe37fd8e3408f13.json create mode 100644 .sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json create mode 100644 .sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json create mode 100644 .sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json create mode 100644 .sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json create mode 100644 .sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json create mode 100644 .sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json delete mode 100644 .sqlx/query-8457bdb0419366f289fb8c02d6c89a68b26af13f5bf87ee838647e3d887a074d.json create mode 100644 .sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json create mode 100644 .sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json create mode 100644 .sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json create mode 100644 .sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json delete mode 100644 .sqlx/query-ccbffcf0dc4fec403b76afecafd708decb30f8c3124db79f2444a18754fe77a3.json create mode 100644 .sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json create mode 100644 .sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json create mode 100644 .sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json create mode 100644 .sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json diff --git a/.sqlx/query-07dfe35dc6e9ce9c7435aa03ba6a346ce4ced6f651af14b35bc470d17144b93f.json b/.sqlx/query-07dfe35dc6e9ce9c7435aa03ba6a346ce4ced6f651af14b35bc470d17144b93f.json deleted file mode 100644 index 25e61e24..00000000 --- a/.sqlx/query-07dfe35dc6e9ce9c7435aa03ba6a346ce4ced6f651af14b35bc470d17144b93f.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_wallets (id, account_id, name) VALUES ($1, $2, $3) RETURNING (id)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Varchar" - ] - }, - "nullable": [ - false - ] - }, - "hash": "07dfe35dc6e9ce9c7435aa03ba6a346ce4ced6f651af14b35bc470d17144b93f" -} diff --git a/.sqlx/query-2249f68f6b116c763f2805afe476b97a27333e204f10b9e68cf825719c5c2498.json b/.sqlx/query-2249f68f6b116c763f2805afe476b97a27333e204f10b9e68cf825719c5c2498.json new file mode 100644 index 00000000..1bffefaf --- /dev/null +++ b/.sqlx/query-2249f68f6b116c763f2805afe476b97a27333e204f10b9e68cf825719c5c2498.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_wallets SET name = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "2249f68f6b116c763f2805afe476b97a27333e204f10b9e68cf825719c5c2498" +} diff --git a/.sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json b/.sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json new file mode 100644 index 00000000..1c29115f --- /dev/null +++ b/.sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2" +} diff --git a/.sqlx/query-2c5e7765d15a8b3893f40a98898cca618f69ae9b16abeeb1dfe37fd8e3408f13.json b/.sqlx/query-2c5e7765d15a8b3893f40a98898cca618f69ae9b16abeeb1dfe37fd8e3408f13.json deleted file mode 100644 index eaf19c65..00000000 --- a/.sqlx/query-2c5e7765d15a8b3893f40a98898cca618f69ae9b16abeeb1dfe37fd8e3408f13.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_wallets b\n JOIN bria_wallet_events e ON b.id = e.id\n WHERE account_id = $1 AND name = $2\n ORDER BY e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 4, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 5, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false - ] - }, - "hash": "2c5e7765d15a8b3893f40a98898cca618f69ae9b16abeeb1dfe37fd8e3408f13" -} diff --git a/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json b/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json new file mode 100644 index 00000000..910fc513 --- /dev/null +++ b/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_wallet_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20" +} diff --git a/.sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json b/.sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json new file mode 100644 index 00000000..851361cb --- /dev/null +++ b/.sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34" +} diff --git a/.sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json b/.sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json new file mode 100644 index 00000000..90abc5db --- /dev/null +++ b/.sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_wallets (id, name, account_id, created_at) VALUES ($1, $2, $3, $4)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106" +} diff --git a/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json b/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json new file mode 100644 index 00000000..99cfb716 --- /dev/null +++ b/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_wallet_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c" +} diff --git a/.sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json b/.sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json new file mode 100644 index 00000000..7301662a --- /dev/null +++ b/.sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e" +} diff --git a/.sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json b/.sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json new file mode 100644 index 00000000..ee686166 --- /dev/null +++ b/.sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE account_id = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b" +} diff --git a/.sqlx/query-8457bdb0419366f289fb8c02d6c89a68b26af13f5bf87ee838647e3d887a074d.json b/.sqlx/query-8457bdb0419366f289fb8c02d6c89a68b26af13f5bf87ee838647e3d887a074d.json deleted file mode 100644 index c91c75f6..00000000 --- a/.sqlx/query-8457bdb0419366f289fb8c02d6c89a68b26af13f5bf87ee838647e3d887a074d.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_wallets b\n JOIN bria_wallet_events e ON b.id = e.id\n WHERE b.id = ANY($1)\n ORDER BY b.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 4, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 5, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false - ] - }, - "hash": "8457bdb0419366f289fb8c02d6c89a68b26af13f5bf87ee838647e3d887a074d" -} diff --git a/.sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json b/.sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json new file mode 100644 index 00000000..4e1aff4a --- /dev/null +++ b/.sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317" +} diff --git a/.sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json b/.sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json new file mode 100644 index 00000000..58676f30 --- /dev/null +++ b/.sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5" +} diff --git a/.sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json b/.sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json new file mode 100644 index 00000000..7ea28db2 --- /dev/null +++ b/.sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73" +} diff --git a/.sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json b/.sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json new file mode 100644 index 00000000..546836da --- /dev/null +++ b/.sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE id = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37" +} diff --git a/.sqlx/query-ccbffcf0dc4fec403b76afecafd708decb30f8c3124db79f2444a18754fe77a3.json b/.sqlx/query-ccbffcf0dc4fec403b76afecafd708decb30f8c3124db79f2444a18754fe77a3.json deleted file mode 100644 index 115da513..00000000 --- a/.sqlx/query-ccbffcf0dc4fec403b76afecafd708decb30f8c3124db79f2444a18754fe77a3.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_wallets b\n JOIN bria_wallet_events e ON b.id = e.id\n WHERE account_id = $1\n ORDER BY e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 4, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 5, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false - ] - }, - "hash": "ccbffcf0dc4fec403b76afecafd708decb30f8c3124db79f2444a18754fe77a3" -} diff --git a/.sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json b/.sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json new file mode 100644 index 00000000..7b848fb1 --- /dev/null +++ b/.sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd" +} diff --git a/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json b/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json new file mode 100644 index 00000000..67f165b4 --- /dev/null +++ b/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.id AS \"id: WalletId\", e.sequence, e.event, e.recorded_at FROM bria_wallets i JOIN bria_wallet_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356" +} diff --git a/.sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json b/.sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json new file mode 100644 index 00000000..9eae51f2 --- /dev/null +++ b/.sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571" +} diff --git a/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json b/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json new file mode 100644 index 00000000..740525a0 --- /dev/null +++ b/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE name = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090" +} diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index 906a574f..10f07495 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -661,12 +661,9 @@ impl From for tonic::Status { ApplicationError::ProfileError(ProfileError::ProfileKeyNotFound) => { tonic::Status::unauthenticated(err.to_string()) } - ApplicationError::WalletError(WalletError::WalletNameNotFound(_)) => { - tonic::Status::not_found(err.to_string()) - } - ApplicationError::WalletError(WalletError::WalletIdNotFound(_)) => { - tonic::Status::not_found(err.to_string()) - } + ApplicationError::WalletError(WalletError::EsEntityError( + es_entity::EsEntityError::NotFound, + )) => tonic::Status::not_found(err.to_string()), ApplicationError::AddressError(AddressError::ExternalIdNotFound) => { tonic::Status::not_found(err.to_string()) } diff --git a/src/app/mod.rs b/src/app/mod.rs index 86bdd42a..2534769e 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -381,7 +381,7 @@ impl App { wallet_name: String, keychain: KeychainConfig, ) -> Result<(WalletId, Vec), ApplicationError> { - let mut tx = self.pool.begin().await?; + let mut op = self.wallets.begin_op().await?; let xpubs = keychain.xpubs(); let mut xpub_ids = Vec::new(); for xpub in xpubs { @@ -402,14 +402,14 @@ impl App { .value(xpub) .build() .expect("Couldn't build xpub"); - xpub_ids.push(self.xpubs.persist_in_tx(&mut tx, xpub).await?); + xpub_ids.push(self.xpubs.persist_in_tx(op.tx(), xpub).await?); } } } let wallet_id = WalletId::new(); let wallet_ledger_accounts = self .ledger - .create_ledger_accounts_for_wallet(&mut tx, wallet_id) + .create_ledger_accounts_for_wallet(op.tx(), wallet_id) .await?; let new_wallet = NewWallet::builder() .id(wallet_id) @@ -421,7 +421,7 @@ impl App { .ledger_account_ids(wallet_ledger_accounts) .build() .expect("Couldn't build NewWallet"); - let wallet_id = self.wallets.create_in_tx(&mut tx, new_wallet).await?; + let wallet = self.wallets.create_in_op(&mut op, new_wallet).await?; let descriptors = vec![ NewDescriptor::builder() .account_id(profile.account_id) @@ -439,10 +439,10 @@ impl App { .expect("Could not build descriptor"), ]; self.descriptors - .persist_all_in_tx(&mut tx, descriptors) + .persist_all_in_tx(op.tx(), descriptors) .await?; - tx.commit().await?; - Ok((wallet_id, xpub_ids)) + op.commit().await?; + Ok((wallet.id, xpub_ids)) } #[instrument(name = "app.get_wallet_balance_summary", skip(self), err)] @@ -453,7 +453,7 @@ impl App { ) -> Result { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let wallet_ledger_account_balances = self .ledger @@ -487,7 +487,7 @@ impl App { ) -> Result<(WalletId, Address), ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let keychain_wallet = wallet.current_keychain_wallet(&self.pool); let addr = keychain_wallet.new_external_address().await?; @@ -541,7 +541,7 @@ impl App { ) -> Result<(WalletId, Vec), ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let addresses = self .addresses @@ -594,7 +594,7 @@ impl App { ) -> Result<(WalletId, Vec), ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let mut utxos = self .utxos @@ -654,7 +654,7 @@ impl App { ) -> Result { let destination_wallet = self .wallets - .find_by_name(profile.account_id, destination_wallet_name) + .find_by_account_id_and_name(profile.account_id, destination_wallet_name) .await?; let destination = destination_wallet .current_keychain_wallet(&self.pool) @@ -681,7 +681,7 @@ impl App { ) -> Result { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let payout_queue = self .payout_queues @@ -752,7 +752,7 @@ impl App { ) -> Result<(PayoutId, Option>), ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let payout_queue = self .payout_queues @@ -786,7 +786,7 @@ impl App { ) -> Result<(PayoutId, Option>), ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let payout_queue = self .payout_queues @@ -902,7 +902,7 @@ impl App { #[instrument(name = "app.list_wallets", skip_all, err)] pub async fn list_wallets(&self, profile: &Profile) -> Result, ApplicationError> { - Ok(self.wallets.list_by_account_id(profile.account_id).await?) + Ok(self.wallets.list_for_account(profile.account_id).await?) } #[instrument(name = "app.find_payout_by_external_id", skip_all, err)] @@ -944,7 +944,7 @@ impl App { ) -> Result, ApplicationError> { let wallet = self .wallets - .find_by_name(profile.account_id, wallet_name) + .find_by_account_id_and_name(profile.account_id, wallet_name) .await?; let payouts = self .payouts diff --git a/src/job/process_payout_queue.rs b/src/job/process_payout_queue.rs index e5433454..51a5b117 100644 --- a/src/job/process_payout_queue.rs +++ b/src/job/process_payout_queue.rs @@ -191,9 +191,9 @@ pub async fn construct_psbt( span.record("payout_queue_id", tracing::field::display(queue_id)); span.record("n_unbatched_payouts", unbatched_payouts.n_payouts()); - let wallets = wallets.find_by_ids(unbatched_payouts.wallet_ids()).await?; + let wallets = wallets.find_all(&unbatched_payouts.wallet_ids()).await?; let reserved_utxos = { - let keychain_ids = wallets.values().flat_map(|w| w.keychain_ids()); + let keychain_ids = wallets.values().flat_map(|w: &Wallet| w.keychain_ids()); utxos .outpoints_bdk_should_not_select(tx, keychain_ids) .await? diff --git a/src/payout/unbatched.rs b/src/payout/unbatched.rs index e3aa9e2f..c1d4ea64 100644 --- a/src/payout/unbatched.rs +++ b/src/payout/unbatched.rs @@ -1,6 +1,6 @@ use derive_builder::Builder; -use std::collections::{HashMap, HashSet}; +use std::collections::HashMap; use super::entity::PayoutEvent; use crate::{entity::*, primitives::*}; @@ -24,7 +24,7 @@ impl UnbatchedPayouts { } } - pub fn wallet_ids(&self) -> HashSet { + pub fn wallet_ids(&self) -> Vec { std::iter::once(self.simulated_payout.as_ref()) .filter_map(|p| p.map(|(id, _)| id)) .chain(self.inner.keys()) diff --git a/src/wallet/entity.rs b/src/wallet/entity.rs index 690869c1..4be2ce09 100644 --- a/src/wallet/entity.rs +++ b/src/wallet/entity.rs @@ -1,14 +1,16 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; use sqlx_ledger::{AccountId as LedgerAccountId, JournalId}; use std::collections::HashMap; use super::{config::*, keychain::*}; -use crate::{entity::*, ledger::WalletLedgerAccountIds, primitives::*, xpub::XPub}; +use crate::{ledger::WalletLedgerAccountIds, primitives::*, xpub::XPub}; -#[derive(Serialize, Deserialize)] +#[derive(EsEvent, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "WalletId")] #[allow(clippy::large_enum_variant)] pub enum WalletEvent { Initialized { @@ -41,10 +43,11 @@ pub enum WalletEvent { }, } -#[derive(Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct Wallet { pub id: WalletId, + pub account_id: AccountId, pub ledger_account_ids: WalletLedgerAccountIds, pub journal_id: JournalId, pub config: WalletConfig, @@ -56,14 +59,14 @@ pub struct Wallet { impl Wallet { fn iter_keychains(&self) -> impl Iterator + '_ { - self.events.iter().rev().filter_map(|e| { + self.events.iter_all().rev().filter_map(|e| { if let WalletEvent::KeychainAdded { keychain_id, - keychain_config: config, + keychain_config, .. } = e { - Some((keychain_id, config)) + Some((keychain_id, keychain_config)) } else { None } @@ -126,55 +129,16 @@ pub struct NewWallet { config: WalletConfig, } -impl NewWallet { - pub fn builder() -> NewWalletBuilder { - let mut builder = NewWalletBuilder::default(); - builder.id(WalletId::new()); - builder - } - - pub(super) fn initial_events(self) -> EntityEvents { - let keychain_id = KeychainId::new(); - EntityEvents::init([ - WalletEvent::Initialized { - id: self.id, - network: self.network, - account_id: self.account_id, - journal_id: self.journal_id, - onchain_incoming_ledger_account_id: self.ledger_account_ids.onchain_incoming_id, - onchain_at_rest_ledger_account_id: self.ledger_account_ids.onchain_at_rest_id, - onchain_outgoing_ledger_account_id: self.ledger_account_ids.onchain_outgoing_id, - onchain_fee_ledger_account_id: self.ledger_account_ids.fee_id, - effective_incoming_ledger_account_id: self.ledger_account_ids.effective_incoming_id, - effective_at_rest_ledger_account_id: self.ledger_account_ids.effective_at_rest_id, - effective_outgoing_ledger_account_id: self.ledger_account_ids.effective_outgoing_id, - dust_ledger_account_id: self.ledger_account_ids.dust_id, - }, - WalletEvent::NameUpdated { name: self.name }, - WalletEvent::ConfigUpdated { - wallet_config: self.config, - }, - WalletEvent::KeychainAdded { - keychain_id, - idx: 0, - keychain_config: self.keychain, - }, - WalletEvent::KeychainActivated { keychain_id }, - ]) - } -} - -impl TryFrom> for Wallet { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { +impl TryFromEvents for Wallet { + fn try_from_events(events: EntityEvents) -> Result { let mut builder = WalletBuilder::default(); use WalletEvent::*; - for event in events.iter() { + for event in events.iter_all() { match event { Initialized { id, network, + account_id, journal_id, onchain_incoming_ledger_account_id, onchain_at_rest_ledger_account_id, @@ -188,6 +152,7 @@ impl TryFrom> for Wallet { } => { builder = builder .id(*id) + .account_id(*account_id) .network(*network) .journal_id(*journal_id) .ledger_account_ids(WalletLedgerAccountIds { @@ -215,3 +180,52 @@ impl TryFrom> for Wallet { builder.events(events).build() } } + +impl NewWallet { + pub fn builder() -> NewWalletBuilder { + let mut builder = NewWalletBuilder::default(); + builder.id(WalletId::new()); + builder + } +} + +impl IntoEvents for NewWallet { + fn into_events(self) -> EntityEvents { + let keychain_id = KeychainId::new(); + EntityEvents::init( + self.id, + vec![ + WalletEvent::Initialized { + id: self.id, + network: self.network, + account_id: self.account_id, + journal_id: self.journal_id, + onchain_incoming_ledger_account_id: self.ledger_account_ids.onchain_incoming_id, + onchain_at_rest_ledger_account_id: self.ledger_account_ids.onchain_at_rest_id, + onchain_outgoing_ledger_account_id: self.ledger_account_ids.onchain_outgoing_id, + onchain_fee_ledger_account_id: self.ledger_account_ids.fee_id, + effective_incoming_ledger_account_id: self + .ledger_account_ids + .effective_incoming_id, + effective_at_rest_ledger_account_id: self + .ledger_account_ids + .effective_at_rest_id, + effective_outgoing_ledger_account_id: self + .ledger_account_ids + .effective_outgoing_id, + dust_ledger_account_id: self.ledger_account_ids.dust_id, + }, + WalletEvent::NameUpdated { name: self.name }, + WalletEvent::ConfigUpdated { + wallet_config: self.config, + }, + WalletEvent::KeychainAdded { + keychain_id, + idx: 0, + keychain_config: self.keychain, + }, + WalletEvent::KeychainActivated { keychain_id }, + ], + ) + } +} diff --git a/src/wallet/error.rs b/src/wallet/error.rs index 4b86108a..2c66c2b7 100644 --- a/src/wallet/error.rs +++ b/src/wallet/error.rs @@ -2,14 +2,12 @@ use thiserror::Error; #[derive(Error, Debug)] pub enum WalletError { - #[error("WalletError - Could not find wallet with name: {0}")] - WalletNameNotFound(String), - #[error("WalletError - Could not find wallet with id: {0}")] - WalletIdNotFound(String), #[error("WalletError - Sqlx: {0}")] Sqlx(#[from] sqlx::Error), - #[error("WalletError - EntityError: {0}")] - EntityError(#[from] crate::entity::EntityError), + #[error("WalletError - EsEntityError: {0}")] + EsEntityError(es_entity::EsEntityError), + #[error("WalletError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), #[error("WalletError - UnsupportedPubKeyType")] UnsupportedPubKeyType, #[error("WalletError - BdkMiniscriptError: {0}")] @@ -19,3 +17,5 @@ pub enum WalletError { #[error("WalletError - Unsigned txn in signed and unsigned psbt don't match")] UnsignedTxnMismatch, } + +es_entity::from_es_entity_error!(WalletError); diff --git a/src/wallet/repo.rs b/src/wallet/repo.rs index a02f5169..4031b529 100644 --- a/src/wallet/repo.rs +++ b/src/wallet/repo.rs @@ -1,11 +1,21 @@ -use sqlx::{Pool, Postgres, Transaction}; +use es_entity::*; +use sqlx::{Pool, Postgres}; use std::collections::{HashMap, HashSet}; use uuid::Uuid; -use super::{entity::*, error::*}; -use crate::{entity::*, primitives::*}; +use super::{entity::*, error::WalletError}; +use crate::primitives::*; -#[derive(Debug, Clone)] +#[derive(EsRepo, Clone, Debug)] +#[es_repo( + entity = "Wallet", + err = "WalletError", + columns( + name(ty = "String"), + account_id(ty = "AccountId", list_for, update(persist = false)) + ), + tbl_prefix = "bria" +)] pub struct Wallets { pool: Pool, } @@ -15,53 +25,45 @@ impl Wallets { Self { pool: pool.clone() } } - pub async fn create_in_tx( + pub async fn list_for_account( &self, - tx: &mut Transaction<'_, Postgres>, - new_wallet: NewWallet, - ) -> Result { - let record = sqlx::query!( - r#"INSERT INTO bria_wallets (id, account_id, name) VALUES ($1, $2, $3) RETURNING (id)"#, - Uuid::from(new_wallet.id), - Uuid::from(new_wallet.account_id), - new_wallet.name - ) - .fetch_one(&mut **tx) - .await?; - EntityEvents::::persist( - "bria_wallet_events", - tx, - new_wallet.initial_events().new_serialized_events(record.id), - ) - .await?; - Ok(WalletId::from(record.id)) + account_id: AccountId, + ) -> Result, WalletError> { + let mut wallets = Vec::new(); + let mut next = Some(PaginatedQueryArgs::default()); + + while let Some(query) = next.take() { + let mut res = self + .list_for_account_id_by_id(account_id, query, Default::default()) + .await?; + wallets.append(&mut res.entities); + next = res.into_next_query(); + } + Ok(wallets) } - pub async fn find_by_name( + pub async fn find_by_account_id_and_id( &self, account_id: AccountId, - name: String, + id: WalletId, ) -> Result { - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_wallets b - JOIN bria_wallet_events e ON b.id = e.id - WHERE account_id = $1 AND name = $2 - ORDER BY e.sequence"#, - account_id as AccountId, - name - ) - .fetch_all(&self.pool) - .await?; - if rows.is_empty() { - return Err(WalletError::WalletNameNotFound(name)); + let wallet = self.find_by_id(id).await?; + if wallet.account_id != account_id { + return Err(WalletError::EsEntityError(EsEntityError::NotFound)); } - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; + Ok(wallet) + } + + pub async fn find_by_account_id_and_name( + &self, + account_id: AccountId, + name: String, + ) -> Result { + let wallet = self.find_by_name(name).await?; + if wallet.account_id != account_id { + return Err(WalletError::EsEntityError(EsEntityError::NotFound)); } - Ok(Wallet::try_from(events)?) + Ok(wallet) } pub async fn all_ids( @@ -78,71 +80,4 @@ impl Wallets { ) })) } - - pub async fn find_by_id(&self, id: WalletId) -> Result { - let ids: HashSet = std::iter::once(id).collect(); - if let Some(wallet) = self.find_by_ids(ids).await?.remove(&id) { - Ok(wallet) - } else { - Err(WalletError::WalletIdNotFound(id.to_string())) - } - } - - pub async fn list_by_account_id( - &self, - account_id: AccountId, - ) -> Result, WalletError> { - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_wallets b - JOIN bria_wallet_events e ON b.id = e.id - WHERE account_id = $1 - ORDER BY e.sequence"#, - account_id as AccountId, - ) - .fetch_all(&self.pool) - .await?; - let mut events = HashMap::new(); - for row in rows { - let id = WalletId::from(row.id); - let sequence = row.sequence; - let events = events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(sequence as usize, row.event)?; - } - Ok(events - .into_values() - .map(Wallet::try_from) - .collect::, _>>()?) - } - - pub async fn find_by_ids( - &self, - ids: HashSet, - ) -> Result, WalletError> { - let uuids = ids.into_iter().map(Uuid::from).collect::>(); - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_wallets b - JOIN bria_wallet_events e ON b.id = e.id - WHERE b.id = ANY($1) - ORDER BY b.id, e.sequence"#, - &uuids[..] - ) - .fetch_all(&self.pool) - .await?; - let mut events = HashMap::new(); - for row in rows { - let id = WalletId::from(row.id); - let sequence = row.sequence; - let events = events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(sequence as usize, row.event)?; - } - let mut wallets = HashMap::new(); - for (id, events) in events { - wallets.insert(id, Wallet::try_from(events)?); - } - Ok(wallets) - } } diff --git a/tests/application_errors.rs b/tests/application_errors.rs index b1d797d1..93cf56c5 100644 --- a/tests/application_errors.rs +++ b/tests/application_errors.rs @@ -109,9 +109,9 @@ async fn wallet_name_not_found() -> anyhow::Result<()> { let err = app.new_address(&profile, wallet_name, None, None).await; assert!(matches!( err, - Err(ApplicationError::WalletError( - WalletError::WalletNameNotFound(_) - )) + Err(ApplicationError::WalletError(WalletError::EsEntityError( + EsEntityError::NotFound + ))) )); Ok(()) } From 2b631d5dd3f8be3721d929c9ee355958d8506aba Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Thu, 12 Jun 2025 00:07:19 +0530 Subject: [PATCH 04/65] refactor: move e2e tests to bats directory (#614) * chore: move e2e files to new bats directory * chore: delete out.txt * chore: rename commands for e2e test refactor --- Makefile | 6 +++--- .../bitcoind_multisig2_signer_descriptors.json | 0 .../bitcoind_multisig_signer_descriptors.json | 0 {tests/e2e => bats}/bitcoind_signer_descriptors.json | 0 {tests/e2e => bats}/bitcoind_sync.bats | 0 {tests/e2e => bats}/bria.docker.yml | 0 {tests/e2e => bats}/bria.local.yml | 0 {tests/e2e => bats}/helpers.bash | 8 ++++---- {tests/e2e => bats}/lnd_sync.bats | 0 {tests/e2e => bats}/multisig_payout.bats | 0 {tests/e2e => bats}/outbox.bats | 0 {tests/e2e => bats}/payout.bats | 0 12 files changed, 7 insertions(+), 7 deletions(-) rename {tests/e2e => bats}/bitcoind_multisig2_signer_descriptors.json (100%) rename {tests/e2e => bats}/bitcoind_multisig_signer_descriptors.json (100%) rename {tests/e2e => bats}/bitcoind_signer_descriptors.json (100%) rename {tests/e2e => bats}/bitcoind_sync.bats (100%) rename {tests/e2e => bats}/bria.docker.yml (100%) rename {tests/e2e => bats}/bria.local.yml (100%) rename {tests/e2e => bats}/helpers.bash (95%) rename {tests/e2e => bats}/lnd_sync.bats (100%) rename {tests/e2e => bats}/multisig_payout.bats (100%) rename {tests/e2e => bats}/outbox.bats (100%) rename {tests/e2e => bats}/payout.bats (100%) diff --git a/Makefile b/Makefile index 020ca3fe..f777d765 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ check-code: local-daemon: SIGNER_ENCRYPTION_KEY="0000000000000000000000000000000000000000000000000000000000000000" \ - cargo run --bin bria daemon --config ./tests/e2e/bria.local.yml run + cargo run --bin bria daemon --config ./bats/bria.local.yml run build-x86_64-unknown-linux-musl-release: SQLX_OFFLINE=true cargo build --release --locked --target x86_64-unknown-linux-musl @@ -47,7 +47,7 @@ test-in-ci: start-deps e2e-tests-in-container: git config --global --add safe.directory /repo # otherwise bats complains SQLX_OFFLINE=true cargo build --locked - bats -t tests/e2e + bats -t bats e2e: clean-deps build start-deps - bats -t tests/e2e + bats -t bats diff --git a/tests/e2e/bitcoind_multisig2_signer_descriptors.json b/bats/bitcoind_multisig2_signer_descriptors.json similarity index 100% rename from tests/e2e/bitcoind_multisig2_signer_descriptors.json rename to bats/bitcoind_multisig2_signer_descriptors.json diff --git a/tests/e2e/bitcoind_multisig_signer_descriptors.json b/bats/bitcoind_multisig_signer_descriptors.json similarity index 100% rename from tests/e2e/bitcoind_multisig_signer_descriptors.json rename to bats/bitcoind_multisig_signer_descriptors.json diff --git a/tests/e2e/bitcoind_signer_descriptors.json b/bats/bitcoind_signer_descriptors.json similarity index 100% rename from tests/e2e/bitcoind_signer_descriptors.json rename to bats/bitcoind_signer_descriptors.json diff --git a/tests/e2e/bitcoind_sync.bats b/bats/bitcoind_sync.bats similarity index 100% rename from tests/e2e/bitcoind_sync.bats rename to bats/bitcoind_sync.bats diff --git a/tests/e2e/bria.docker.yml b/bats/bria.docker.yml similarity index 100% rename from tests/e2e/bria.docker.yml rename to bats/bria.docker.yml diff --git a/tests/e2e/bria.local.yml b/bats/bria.local.yml similarity index 100% rename from tests/e2e/bria.local.yml rename to bats/bria.local.yml diff --git a/tests/e2e/helpers.bash b/bats/helpers.bash similarity index 95% rename from tests/e2e/helpers.bash rename to bats/helpers.bash index 7727f4af..5f610f5e 100644 --- a/tests/e2e/helpers.bash +++ b/bats/helpers.bash @@ -104,17 +104,17 @@ bitcoind_init() { if [[ "${wallet}" == "default" ]]; then bitcoin_signer_cli createwallet "default" || true - bitcoin_signer_cli -rpcwallet=default importdescriptors "$(cat ${REPO_ROOT}/tests/e2e/bitcoind_signer_descriptors.json)" + bitcoin_signer_cli -rpcwallet=default importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_signer_descriptors.json)" elif [[ "${wallet}" == "multisig" ]]; then bitcoin_signer_cli createwallet "multisig" || true - bitcoin_signer_cli -rpcwallet=multisig importdescriptors "$(cat ${REPO_ROOT}/tests/e2e/bitcoind_multisig_signer_descriptors.json)" + bitcoin_signer_cli -rpcwallet=multisig importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_multisig_signer_descriptors.json)" bitcoin_signer_cli createwallet "multisig2" || true - bitcoin_signer_cli -rpcwallet=multisig2 importdescriptors "$(cat ${REPO_ROOT}/tests/e2e/bitcoind_multisig2_signer_descriptors.json)" + bitcoin_signer_cli -rpcwallet=multisig2 importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_multisig2_signer_descriptors.json)" fi } start_daemon() { - SIGNER_ENCRYPTION_KEY="${SIGNER_ENCRYPTION_KEY}" background bria_cmd daemon --config ./tests/e2e/bria.${BRIA_CONFIG:-local}.yml run > .e2e-logs + SIGNER_ENCRYPTION_KEY="${SIGNER_ENCRYPTION_KEY}" background bria_cmd daemon --config ./bats/bria.${BRIA_CONFIG:-local}.yml run > .e2e-logs for i in {1..20} do if head .e2e-logs | grep -q 'Starting main server on port'; then diff --git a/tests/e2e/lnd_sync.bats b/bats/lnd_sync.bats similarity index 100% rename from tests/e2e/lnd_sync.bats rename to bats/lnd_sync.bats diff --git a/tests/e2e/multisig_payout.bats b/bats/multisig_payout.bats similarity index 100% rename from tests/e2e/multisig_payout.bats rename to bats/multisig_payout.bats diff --git a/tests/e2e/outbox.bats b/bats/outbox.bats similarity index 100% rename from tests/e2e/outbox.bats rename to bats/outbox.bats diff --git a/tests/e2e/payout.bats b/bats/payout.bats similarity index 100% rename from tests/e2e/payout.bats rename to bats/payout.bats From 1bae21dac6a10578e56faac39fb3a3276adf83d9 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 13 Jun 2025 00:19:41 +0530 Subject: [PATCH 05/65] chore: add test integration makefile target (#615) --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f777d765..80d4abf0 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,9 @@ watch: next-watch: cargo watch -s 'cargo nextest run' +test-integration: reset-deps + cargo nextest run --verbose --locked + check-code: SQLX_OFFLINE=true cargo fmt --check --all SQLX_OFFLINE=true cargo clippy --all-features From 99c6d73a36283c8dfcd1e6567982ab5744e36189 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 18:44:42 +0530 Subject: [PATCH 06/65] ci(shared): bump vendored ci files (#618) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 +-- ci/vendir.yml | 4 +- ci/vendor/pipeline-fragments.lib.yml | 47 +++++++++++++- ci/vendor/tasks/bats-test.sh | 74 +++++++++++++++++++++++ ci/vendor/tasks/chart-test-integration.sh | 52 ---------------- ci/vendor/tasks/integration-test.sh | 56 +++++++++++++++++ ci/vendor/tasks/rust-check-code.sh | 10 --- ci/vendor/tasks/test-on-docker-host.sh | 52 ---------------- 8 files changed, 182 insertions(+), 121 deletions(-) create mode 100644 ci/vendor/tasks/bats-test.sh delete mode 100755 ci/vendor/tasks/chart-test-integration.sh create mode 100644 ci/vendor/tasks/integration-test.sh delete mode 100755 ci/vendor/tasks/rust-check-code.sh delete mode 100755 ci/vendor/tasks/test-on-docker-host.sh diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index c9f597b1..cac74c86 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'Merge pull request #3 from GaloyMoney/ci--refactor-gar-creds...' - sha: 360dcde99986a3af15a1727b3417602a0bbfdde3 + commitTitle: 'Merge pull request #5 from GaloyMoney/feat--nix-test...' + sha: 37bc289ad8cc7509f844541a729efbc5c5e4d252 path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'Merge pull request #3 from GaloyMoney/ci--refactor-gar-creds...' - sha: 360dcde99986a3af15a1727b3417602a0bbfdde3 + commitTitle: 'Merge pull request #5 from GaloyMoney/feat--nix-test...' + sha: 37bc289ad8cc7509f844541a729efbc5c5e4d252 path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index 06c04491..858193bd 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 360dcde99986a3af15a1727b3417602a0bbfdde3 + ref: 37bc289ad8cc7509f844541a729efbc5c5e4d252 includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 360dcde99986a3af15a1727b3417602a0bbfdde3 + ref: 37bc289ad8cc7509f844541a729efbc5c5e4d252 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index 98e84e3f..a1bc0419 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -47,7 +47,7 @@ source: #@ def nix_task_image_config(): type: registry-image source: - repository: nixpkgs/nix-flakes + repository: ghcr.io/nix-community/docker-nixpkgs/cachix-flakes #@ end #@ def check_code(): @@ -232,6 +232,51 @@ plan: path: pipeline-tasks/ci/vendor/tasks/chart-test-integration.sh #@ end +#@ def integration_test(): +name: integration-tests +plan: + - in_parallel: + - get: repo + trigger: true + - { get: pipeline-tasks } + - task: integration-tests + attempts: 2 + privileged: true + config: + platform: linux + image_resource: #@ nix_task_image_config() + inputs: + - name: pipeline-tasks + - name: repo + run: + path: pipeline-tasks/ci/vendor/tasks/integration-tests.sh + params: + CACHIX_AUTH_TOKEN: #@ data.values.cachix_auth_token + CACHIX_CACHE_NAME: #@ data.values.cachix_cache_name +#@ end + +#@ def bats_test(): +name: bats-tests +plan: +- in_parallel: + - get: repo + trigger: true + - get: pipeline-tasks +- task: bats-tests + privileged: true + config: + platform: linux + image_resource: #@ nix_task_image_config() + inputs: + - name: pipeline-tasks + - name: repo + run: + path: pipeline-tasks/ci/vendor/tasks/bats-tests.sh + params: + CACHIX_AUTH_TOKEN: #@ data.values.cachix_auth_token + CACHIX_CACHE_NAME: #@ data.values.cachix_cache_name +#@ end + #@ def nodejs_audit(level = "high"): name: audit serial: true diff --git a/ci/vendor/tasks/bats-test.sh b/ci/vendor/tasks/bats-test.sh new file mode 100644 index 00000000..cf476030 --- /dev/null +++ b/ci/vendor/tasks/bats-test.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Change to repo directory +pushd repo + +echo "--- Setting up Cachix ---" +cachix use "${CACHIX_CACHE_NAME}" + +# cannot call the profile dev as it fails with a symlink error +# perhaps its a reserved keyword +echo "--- Setting up Nix development environment ---" +nix develop --profile dev-profile -c true +cachix push "${CACHIX_CACHE_NAME}" dev-profile + +# --- Source Helpers Early --- +# Get REPO_ROOT early to source helpers +# export REPO_ROOT=$(git rev-parse --show-toplevel) +# if [[ -f "${REPO_ROOT}/bats/helpers.bash" ]]; then +# echo "--- Sourcing helpers ---" +# source "${REPO_ROOT}/bats/helpers.bash" +# else +# echo "Error: helpers.bash not found at ${REPO_ROOT}/bats/helpers.bash" +# exit 1 +# fi + +echo "--- Running bats tests in Nix environment ---" +nix -L develop --command sh -exc ' + +echo "--- Checking for Podman (via nix) ---" +command -v podman +echo "--- Podman check done ---" +command -v podman-compose +echo "--- Podman-compose check done ---" + +echo "--- Testing Podman basic functionality ---" +podman info || echo "Warning: podman info failed." +echo "--- Podman info done ---" + +echo "--- Starting Podman service ---" +# Ensure DOCKER_HOST points to the standard rootful socket location +export DOCKER_HOST=unix:///run/podman/podman.sock +podman system service --time=0 & # Start service in background +sleep 5 # Wait a bit for the socket to become active +echo "--- Podman service started (attempted) ---" + +mkdir -p /etc/containers +echo "{\"default\": [{\"type\": \"insecureAcceptAnything\"}]}" > /etc/containers/policy.json +echo "unqualified-search-registries = [\"docker.io\"]" > /etc/containers/registries.conf + +echo "--- Starting Dependencies with Podman Compose ---" +ENGINE_DEFAULT=podman bin/docker-compose-up.sh integration-deps +echo "--- Podman-compose up done ---" + +make setup-db + +# --- Build Test Artifacts --- +echo "--- Building test artifacts---" +# nix build . -L +make build + + +# --- Run Bats Tests --- +echo "--- Running BATS tests ---" +bats -t bats + +echo "--- e2e Tests done ---" + +echo "--- Cleaning up dependencies ---" +podman compose down +echo "--- Cleanup done ---" + +echo "--- All steps completed ---" +' diff --git a/ci/vendor/tasks/chart-test-integration.sh b/ci/vendor/tasks/chart-test-integration.sh deleted file mode 100755 index 69e20cdb..00000000 --- a/ci/vendor/tasks/chart-test-integration.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -#! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared - -set -eu - -. pipeline-tasks/ci/vendor/tasks/helpers.sh - -CI_ROOT=$(pwd) - -unpack_deps - -cat < ${CI_ROOT}/gcloud-creds.json -${GOOGLE_CREDENTIALS} -EOF -cat < ${CI_ROOT}/login.ssh -${SSH_PRIVATE_KEY} -EOF -chmod 600 ${CI_ROOT}/login.ssh -cat < ${CI_ROOT}/login.ssh.pub -${SSH_PUB_KEY} -EOF -gcloud auth activate-service-account --key-file ${CI_ROOT}/gcloud-creds.json -gcloud compute os-login ssh-keys add --key-file=${CI_ROOT}/login.ssh.pub > /dev/null - -mkdir ~/.ssh -cp ${CI_ROOT}/login.ssh ~/.ssh/id_rsa -cp ${CI_ROOT}/login.ssh.pub ~/.ssh/id_rsa.pub - -export DOCKER_HOST_USER="sa_$(cat ${CI_ROOT}/gcloud-creds.json | jq -r '.client_id')" -export DOCKER_HOST=ssh://${DOCKER_HOST_USER}@${DOCKER_HOST_IP} -export ADDITIONAL_SSH_OPTS="-o StrictHostKeyChecking=no -i ${CI_ROOT}/login.ssh" - -pushd ${REPO_PATH} - -echo "Syncing repo to docker-host... " -rsync --delete --exclude target -avr -e "ssh -l ${DOCKER_HOST_USER} ${ADDITIONAL_SSH_OPTS}" \ - ./ ${DOCKER_HOST_IP}:${REPO_PATH} > /dev/null -echo "Done!" - -docker compose down --remove-orphans --timeout 1 - -ssh ${ADDITIONAL_SSH_OPTS} ${DOCKER_HOST_USER}@${DOCKER_HOST_IP} \ - "cd ${REPO_PATH}; docker compose -f docker-compose.yml up integration-tests" - -container_id=$(docker ps -q -f status=exited -f name="${PWD##*/}-integration-tests-") -test_status=$(docker inspect $container_id --format='{{.State.ExitCode}}') - -docker compose down --remove-orphans --timeout 1 - -exit $test_status diff --git a/ci/vendor/tasks/integration-test.sh b/ci/vendor/tasks/integration-test.sh new file mode 100644 index 00000000..af42043a --- /dev/null +++ b/ci/vendor/tasks/integration-test.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Change to repo directory +pushd repo + +echo "--- Setting up Cachix ---" +cachix use "${CACHIX_CACHE_NAME}" + +# cannot call the profile dev as it fails with a symlink error +# perhaps its a reserved keyword +echo "--- Setting up Nix development environment ---" +nix develop --profile dev-profile -c true +cachix push "${CACHIX_CACHE_NAME}" dev-profile + +echo "--- Running integration tests in Nix environment ---" +nix -L develop --command sh -exc ' +set -euo pipefail + +echo "--- Checking for Podman (via nix) ---" +command -v podman +echo "--- Podman check done ---" +command -v podman-compose +echo "--- Podman-compose check done ---" + +echo "--- Testing Podman basic functionality ---" +podman info || echo "Warning: podman info failed." +echo "--- Podman info done ---" + +echo "--- Starting Podman service ---" +# Ensure DOCKER_HOST points to the standard rootful socket location +export DOCKER_HOST=unix:///run/podman/podman.sock +podman system service --time=0 & # Start service in background +sleep 5 # Wait a bit for the socket to become active +echo "--- Podman service started (attempted) ---" + +mkdir -p /etc/containers +echo "{\"default\": [{\"type\": \"insecureAcceptAnything\"}]}" > /etc/containers/policy.json +echo "unqualified-search-registries = [\"docker.io\"]" > /etc/containers/registries.conf + +echo "--- Starting Dependencies with Podman Compose ---" +ENGINE_DEFAULT=podman bin/docker-compose-up.sh integration-deps +echo "--- Podman-compose up done ---" + +make setup-db + +echo "--- Running Integration Tests ---" +cargo nextest run --verbose --locked +echo "--- Tests done ---" + +echo "--- Cleaning up dependencies ---" +podman compose down +echo "--- Cleanup done ---" + +echo "--- All steps completed ---" +' diff --git a/ci/vendor/tasks/rust-check-code.sh b/ci/vendor/tasks/rust-check-code.sh deleted file mode 100755 index c44b5e0e..00000000 --- a/ci/vendor/tasks/rust-check-code.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -#! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared - -set -eu - -pushd repo - -make check-code diff --git a/ci/vendor/tasks/test-on-docker-host.sh b/ci/vendor/tasks/test-on-docker-host.sh deleted file mode 100755 index 31f127c5..00000000 --- a/ci/vendor/tasks/test-on-docker-host.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -set -eu - -export CI_ROOT=$(pwd) - -host_name=$(cat docker-host/metadata | jq -r '.docker_host_name') -echo "Running on host: ${host_name}" -host_zone=$(cat docker-host/metadata | jq -r '.docker_host_zone') -gcp_project=$(cat docker-host/metadata | jq -r '.docker_host_project') - -gcloud_ssh() { - gcloud compute ssh ${host_name} \ - --zone=${host_zone} \ - --project=${gcp_project} \ - --ssh-key-file=${CI_ROOT}/login.ssh \ - --tunnel-through-iap \ - --command "$@" 2> /dev/null -} - -cat < ${CI_ROOT}/gcloud-creds.json -${GOOGLE_CREDENTIALS} -EOF -cat < ${CI_ROOT}/login.ssh -${SSH_PRIVATE_KEY} -EOF -chmod 600 ${CI_ROOT}/login.ssh -cat < ${CI_ROOT}/login.ssh.pub -${SSH_PUB_KEY} -EOF -gcloud auth activate-service-account --key-file ${CI_ROOT}/gcloud-creds.json 2> /dev/null - -gcloud_ssh "docker ps -qa | xargs docker rm -fv || true; sudo rm -rf ${REPO_PATH} || true; mkdir -p ${REPO_PATH} && cd ${REPO_PATH}/../ && rmdir $(basename ${REPO_PATH})" - -pushd ${REPO_PATH} - -make create-tmp-env-ci || true - -gcloud compute scp --ssh-key-file=${CI_ROOT}/login.ssh \ - --recurse $(pwd) ${host_name}:${REPO_PATH} \ - --tunnel-through-iap \ - --zone=${host_zone} \ - --project=${gcp_project} > /dev/null - -gcloud_ssh "cd ${REPO_PATH}; export TMP_ENV_CI=tmp.env.ci; export COMPOSE_PROJECT_NAME=$(basename ${REPO_PATH}); source .envrc || true; docker compose pull; docker compose -f docker-compose.yml up ${TEST_CONTAINER} --attach ${TEST_CONTAINER} 2>&1" - -container_id=$(gcloud_ssh "docker ps -q -f status=exited -f name=${PWD##*/}-${TEST_CONTAINER}-") -test_status=$(gcloud_ssh "docker inspect $container_id --format='{{.State.ExitCode}}'") - -gcloud_ssh "cd ${REPO_PATH}; export COMPOSE_PROJECT_NAME=$(basename ${REPO_PATH}); docker compose down --remove-orphans --timeout 1" - -exit $test_status From f7dbefd83aa29082a418ace33ad8fba50cc8c28d Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 13 Jun 2025 18:49:01 +0530 Subject: [PATCH 07/65] ci: switch docker registry (#607) --- ci/pipeline.yml | 4 ++-- ci/values.yml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 74883bf1..ef7a28a3 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -298,8 +298,8 @@ resources: type: registry-image source: tag: latest - username: #@ data.values.docker_registry_user - password: #@ data.values.docker_registry_password + username: #@ data.values.gar_registry_user + password: #@ data.values.gar_registry_password repository: #@ public_docker_registry() + "/" + data.values.gh_repository - #@ charts_repo_resource() - #@ charts_repo_bot_branch() diff --git a/ci/values.yml b/ci/values.yml index fe73db94..ce247cfc 100644 --- a/ci/values.yml +++ b/ci/values.yml @@ -11,9 +11,9 @@ git_charts_uri: git@github.com:GaloyMoney/charts.git git_charts_branch: main git_charts_bot_branch: bot-bump-bria-image -docker_registry: us.gcr.io/galoy-org -docker_registry_user: ((docker-creds.username)) -docker_registry_password: ((docker-creds.password)) +docker_registry: us.gcr.io/galoyorg +gar_registry_user: ((gar-creds.username)) +gar_registry_password: ((gar-creds.password)) osxcross_docker_username: ((osxcross-image.username)) osxcross_docker_password: ((osxcross-image.password)) osxcross_repository: ((osxcross-image.repository)) From 3d6e724875f1e350ee6fe29fbaa7eb6c4fe936de Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 19:11:57 +0530 Subject: [PATCH 08/65] ci(shared): bump vendored ci files (#619) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 +-- ci/vendir.yml | 4 +- ci/vendor/pipeline-fragments.lib.yml | 72 ++----------------- .../tasks/{bats-test.sh => test-bats.sh} | 0 ...ntegration-test.sh => test-integration.sh} | 0 5 files changed, 12 insertions(+), 72 deletions(-) rename ci/vendor/tasks/{bats-test.sh => test-bats.sh} (100%) rename ci/vendor/tasks/{integration-test.sh => test-integration.sh} (100%) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index cac74c86..3c7fd7e8 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'Merge pull request #5 from GaloyMoney/feat--nix-test...' - sha: 37bc289ad8cc7509f844541a729efbc5c5e4d252 + commitTitle: 'refactor: script and job naming' + sha: 9b10794e73f3f0c016c63621363ef82af19cf984 path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'Merge pull request #5 from GaloyMoney/feat--nix-test...' - sha: 37bc289ad8cc7509f844541a729efbc5c5e4d252 + commitTitle: 'refactor: script and job naming' + sha: 9b10794e73f3f0c016c63621363ef82af19cf984 path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index 858193bd..c947763f 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 37bc289ad8cc7509f844541a729efbc5c5e4d252 + ref: 9b10794e73f3f0c016c63621363ef82af19cf984 includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 37bc289ad8cc7509f844541a729efbc5c5e4d252 + ref: 9b10794e73f3f0c016c63621363ef82af19cf984 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index a1bc0419..1244ebf0 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -172,74 +172,14 @@ plan: release: docker-host #@ end -#@ def nodejs_integration_test(): -name: test-integration -serial: true -plan: -- in_parallel: - - { get: repo, trigger: true } - - { get: pipeline-tasks } - - { get: bundled-deps, tags: ["galoy-staging"], trigger: true} -- task: test-integration - timeout: 12m - tags: ["galoy-staging"] - config: - platform: linux - image_resource: #@ nodejs_task_image_config() - inputs: - - name: bundled-deps - - name: pipeline-tasks - - name: repo - path: #@ data.values.gh_repository + "-integration" - params: - REPO_PATH: #@ data.values.gh_repository + "-integration" - DOCKER_HOST_IP: ((staging-ssh.docker_host_ip)) - GOOGLE_CREDENTIALS: ((staging-gcp-creds.creds_json)) - SSH_PRIVATE_KEY: ((staging-ssh.ssh_private_key)) - SSH_PUB_KEY: ((staging-ssh.ssh_public_key)) - JEST_TIMEOUT: 90000 - run: - path: pipeline-tasks/ci/vendor/tasks/chart-test-integration.sh -#@ end - -#@ def rust_integration_test(): -name: test-integration -serial: true -plan: -- in_parallel: - - { get: repo, trigger: true } - - { get: pipeline-tasks } -- task: test-integration - timeout: 12m - tags: ["galoy-staging"] - config: - platform: linux - image_resource: #@ rust_task_image_config() - inputs: - - name: pipeline-tasks - - name: repo - path: #@ data.values.gh_repository + "-integration" - caches: - - path: cargo-home - - path: cargo-target-dir - params: - REPO_PATH: #@ data.values.gh_repository + "-integration" - DOCKER_HOST_IP: ((staging-ssh.docker_host_ip)) - GOOGLE_CREDENTIALS: ((staging-gcp-creds.creds_json)) - SSH_PRIVATE_KEY: ((staging-ssh.ssh_private_key)) - SSH_PUB_KEY: ((staging-ssh.ssh_public_key)) - run: - path: pipeline-tasks/ci/vendor/tasks/chart-test-integration.sh -#@ end - #@ def integration_test(): -name: integration-tests +name: integration-test plan: - in_parallel: - get: repo trigger: true - { get: pipeline-tasks } - - task: integration-tests + - task: integration-test attempts: 2 privileged: true config: @@ -249,20 +189,20 @@ plan: - name: pipeline-tasks - name: repo run: - path: pipeline-tasks/ci/vendor/tasks/integration-tests.sh + path: pipeline-tasks/ci/vendor/tasks/test-integration.sh params: CACHIX_AUTH_TOKEN: #@ data.values.cachix_auth_token CACHIX_CACHE_NAME: #@ data.values.cachix_cache_name #@ end #@ def bats_test(): -name: bats-tests +name: bats-test plan: - in_parallel: - get: repo trigger: true - get: pipeline-tasks -- task: bats-tests +- task: bats-test privileged: true config: platform: linux @@ -271,7 +211,7 @@ plan: - name: pipeline-tasks - name: repo run: - path: pipeline-tasks/ci/vendor/tasks/bats-tests.sh + path: pipeline-tasks/ci/vendor/tasks/test-bats.sh params: CACHIX_AUTH_TOKEN: #@ data.values.cachix_auth_token CACHIX_CACHE_NAME: #@ data.values.cachix_cache_name diff --git a/ci/vendor/tasks/bats-test.sh b/ci/vendor/tasks/test-bats.sh similarity index 100% rename from ci/vendor/tasks/bats-test.sh rename to ci/vendor/tasks/test-bats.sh diff --git a/ci/vendor/tasks/integration-test.sh b/ci/vendor/tasks/test-integration.sh similarity index 100% rename from ci/vendor/tasks/integration-test.sh rename to ci/vendor/tasks/test-integration.sh From 01ef07bd03a4b35aad0b24330aa7bd3678d87930 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 13 Jun 2025 19:42:55 +0530 Subject: [PATCH 09/65] ci: fix cachix values (#620) --- ci/pipeline.yml | 17 ++++++++--------- ci/values.yml | 3 +++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index ef7a28a3..16c51ee9 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -5,8 +5,6 @@ #@ "public_docker_registry", #@ "nodejs_task_image_config", #@ "rust_check_code", -#@ "docker_host_pool", -#@ "test_on_docker_host", #@ "repo_resource", #@ "edge_image_resource", #@ "version_resource", @@ -16,14 +14,16 @@ #@ "rust_task_image_config", #@ "charts_repo_resource", #@ "charts_repo_bot_branch", +#@ "integration_test", +#@ "bats_test", #@ ) groups: - name: bria jobs: - check-code - - integration-tests - - e2e-tests + - integration-test + - bats-test - release - release-docker - set-dev-version @@ -32,8 +32,8 @@ groups: jobs: - #@ rust_check_code() -- #@ test_on_docker_host("integration-tests") -- #@ test_on_docker_host("e2e-tests") +- #@ integration_test() +- #@ bats_test() - #@ build_edge_image() @@ -43,8 +43,8 @@ jobs: - in_parallel: - get: repo passed: - - integration-tests - - e2e-tests + - integration-test + - bats-test - check-code - get: pipeline-tasks - get: version @@ -303,4 +303,3 @@ resources: repository: #@ public_docker_registry() + "/" + data.values.gh_repository - #@ charts_repo_resource() - #@ charts_repo_bot_branch() -- #@ docker_host_pool() diff --git a/ci/values.yml b/ci/values.yml index ce247cfc..1d2e8d4f 100644 --- a/ci/values.yml +++ b/ci/values.yml @@ -26,3 +26,6 @@ staging_ssh_pub_key: ((staging-ssh.ssh_public_key)) git_version_branch: version gh_org: GaloyMoney gh_repository: bria + +cachix_auth_token: ((cachix-token.token)) +cachix_cache_name: bria-ci From abc3fbc9108b3df23709313146a1a4c1b1882451 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 19:47:33 +0530 Subject: [PATCH 10/65] ci(shared): bump vendored ci files (#621) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++++---- ci/vendir.yml | 4 ++-- ci/vendor/tasks/test-bats.sh | 0 ci/vendor/tasks/test-integration.sh | 0 4 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 ci/vendor/tasks/test-bats.sh mode change 100644 => 100755 ci/vendor/tasks/test-integration.sh diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 3c7fd7e8..36e6f92d 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'refactor: script and job naming' - sha: 9b10794e73f3f0c016c63621363ef82af19cf984 + commitTitle: 'fix: make integration and bats test scripts executable' + sha: 221be356913c9b3fd2794abf43ab97a200167f0a path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'refactor: script and job naming' - sha: 9b10794e73f3f0c016c63621363ef82af19cf984 + commitTitle: 'fix: make integration and bats test scripts executable' + sha: 221be356913c9b3fd2794abf43ab97a200167f0a path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index c947763f..2edbb801 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 9b10794e73f3f0c016c63621363ef82af19cf984 + ref: 221be356913c9b3fd2794abf43ab97a200167f0a includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 9b10794e73f3f0c016c63621363ef82af19cf984 + ref: 221be356913c9b3fd2794abf43ab97a200167f0a includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/tasks/test-bats.sh b/ci/vendor/tasks/test-bats.sh old mode 100644 new mode 100755 diff --git a/ci/vendor/tasks/test-integration.sh b/ci/vendor/tasks/test-integration.sh old mode 100644 new mode 100755 From 53a8f7f9463b8f069ea8065ebc0f991da49af48d Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 13 Jun 2025 19:49:55 +0530 Subject: [PATCH 11/65] ci: fix check code import --- ci/pipeline.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/pipeline.yml b/ci/pipeline.yml index 16c51ee9..d5bc0a26 100644 --- a/ci/pipeline.yml +++ b/ci/pipeline.yml @@ -4,7 +4,7 @@ #@ "build_edge_image", #@ "public_docker_registry", #@ "nodejs_task_image_config", -#@ "rust_check_code", +#@ "check_code", #@ "repo_resource", #@ "edge_image_resource", #@ "version_resource", @@ -31,7 +31,7 @@ groups: - build-edge-image jobs: -- #@ rust_check_code() +- #@ check_code() - #@ integration_test() - #@ bats_test() From 2fc9975d3b0fcf86054ea44a87f3feb173108058 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Fri, 13 Jun 2025 19:50:52 +0530 Subject: [PATCH 12/65] chore: add podman and compose to flake (#622) --- flake.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index f9748386..7767ec42 100644 --- a/flake.nix +++ b/flake.nix @@ -8,7 +8,6 @@ url = "github:oxalica/rust-overlay"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; }; }; }; @@ -60,6 +59,8 @@ docker-compose bats jq + podman + podman-compose ]; }); From c0b1788bef8b5b2238ceeff0bef1ab2ebdff8607 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 20:45:49 +0530 Subject: [PATCH 13/65] ci(shared): bump vendored ci files (#624) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++++---- ci/vendir.yml | 4 ++-- ci/vendor/tasks/test-bats.sh | 2 +- ci/vendor/tasks/test-integration.sh | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 36e6f92d..900f977f 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'fix: make integration and bats test scripts executable' - sha: 221be356913c9b3fd2794abf43ab97a200167f0a + commitTitle: 'refactor: call podman directly in test scripts' + sha: 42cda64ff87789ee478aceea611fa6252a6fd346 path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'fix: make integration and bats test scripts executable' - sha: 221be356913c9b3fd2794abf43ab97a200167f0a + commitTitle: 'refactor: call podman directly in test scripts' + sha: 42cda64ff87789ee478aceea611fa6252a6fd346 path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index 2edbb801..21ebb724 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 221be356913c9b3fd2794abf43ab97a200167f0a + ref: 42cda64ff87789ee478aceea611fa6252a6fd346 includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 221be356913c9b3fd2794abf43ab97a200167f0a + ref: 42cda64ff87789ee478aceea611fa6252a6fd346 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/tasks/test-bats.sh b/ci/vendor/tasks/test-bats.sh index cf476030..e6752d09 100755 --- a/ci/vendor/tasks/test-bats.sh +++ b/ci/vendor/tasks/test-bats.sh @@ -49,7 +49,7 @@ echo "{\"default\": [{\"type\": \"insecureAcceptAnything\"}]}" > /etc/containers echo "unqualified-search-registries = [\"docker.io\"]" > /etc/containers/registries.conf echo "--- Starting Dependencies with Podman Compose ---" -ENGINE_DEFAULT=podman bin/docker-compose-up.sh integration-deps +podman compose up -d integration-deps echo "--- Podman-compose up done ---" make setup-db diff --git a/ci/vendor/tasks/test-integration.sh b/ci/vendor/tasks/test-integration.sh index af42043a..3583f440 100755 --- a/ci/vendor/tasks/test-integration.sh +++ b/ci/vendor/tasks/test-integration.sh @@ -39,7 +39,7 @@ echo "{\"default\": [{\"type\": \"insecureAcceptAnything\"}]}" > /etc/containers echo "unqualified-search-registries = [\"docker.io\"]" > /etc/containers/registries.conf echo "--- Starting Dependencies with Podman Compose ---" -ENGINE_DEFAULT=podman bin/docker-compose-up.sh integration-deps +podman compose up -d integration-deps echo "--- Podman-compose up done ---" make setup-db From e2471cd6314ff4e839daad38610f04de6d4c2a59 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Tue, 17 Jun 2025 05:13:33 +0530 Subject: [PATCH 14/65] chore: allow settings docker engine in bats helpers (#625) --- bats/helpers.bash | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bats/helpers.bash b/bats/helpers.bash index 5f610f5e..bee1a527 100644 --- a/bats/helpers.bash +++ b/bats/helpers.bash @@ -1,5 +1,6 @@ REPO_ROOT=$(git rev-parse --show-toplevel) COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-${REPO_ROOT##*/}}" +DOCKER_ENGINE="${DOCKER_ENGINE:-docker}" SIGNER_ENCRYPTION_KEY="0000000000000000000000000000000000000000000000000000000000000000" BRIA_HOME="${BRIA_HOME:-.bria}" export PG_CON="${PG_CON:-${DATABASE_URL}}" @@ -52,11 +53,11 @@ cached_encumbered_outgoing() { } bitcoin_cli() { - docker exec "${COMPOSE_PROJECT_NAME}-bitcoind-1" bitcoin-cli $@ + ${DOCKER_ENGINE} exec "${COMPOSE_PROJECT_NAME}-bitcoind-1" bitcoin-cli $@ } bitcoin_signer_cli() { - docker exec "${COMPOSE_PROJECT_NAME}-bitcoind-signer-1" bitcoin-cli $@ + ${DOCKER_ENGINE} exec "${COMPOSE_PROJECT_NAME}-bitcoind-signer-1" bitcoin-cli $@ } convert_btc_to_sats() { @@ -80,19 +81,19 @@ bitcoin_signer_cli_send_all_utxos () { lnd_cli() { - docker exec "${COMPOSE_PROJECT_NAME}-lnd-1" lncli -n regtest $@ + ${DOCKER_ENGINE} exec "${COMPOSE_PROJECT_NAME}-lnd-1" lncli -n regtest $@ } reset_pg() { - docker exec "${COMPOSE_PROJECT_NAME}-postgres-1" psql $PG_CON -c "DROP SCHEMA public CASCADE" - docker exec "${COMPOSE_PROJECT_NAME}-postgres-1" psql $PG_CON -c "CREATE SCHEMA public" + ${DOCKER_ENGINE} exec "${COMPOSE_PROJECT_NAME}-postgres-1" psql $PG_CON -c "DROP SCHEMA public CASCADE" + ${DOCKER_ENGINE} exec "${COMPOSE_PROJECT_NAME}-postgres-1" psql $PG_CON -c "CREATE SCHEMA public" } restart_bitcoin_stack() { - docker compose ${COMPOSE_FILE_ARG} rm -sfv bitcoind bitcoind-signer lnd fulcrum mempool || true + ${DOCKER_ENGINE} compose ${COMPOSE_FILE_ARG} rm -sfv bitcoind bitcoind-signer lnd fulcrum mempool || true # Running this twice has sometimes bitcoind is dangling in CI - docker compose ${COMPOSE_FILE_ARG} rm -sfv bitcoind bitcoind-signer lnd fulcrum mempool || true - docker compose ${COMPOSE_FILE_ARG} up -d bitcoind bitcoind-signer lnd fulcrum mempool + ${DOCKER_ENGINE} compose ${COMPOSE_FILE_ARG} rm -sfv bitcoind bitcoind-signer lnd fulcrum mempool || true + ${DOCKER_ENGINE} compose ${COMPOSE_FILE_ARG} up -d bitcoind bitcoind-signer lnd fulcrum mempool retry 10 1 lnd_cli getinfo } From c8cbc25d1c4ff8e64e1fc26dda39e4eab1ca7109 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Tue, 17 Jun 2025 05:43:17 +0530 Subject: [PATCH 15/65] chore: add bc to flake (#626) --- flake.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/flake.nix b/flake.nix index 7767ec42..f0cb8d62 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,7 @@ jq podman podman-compose + bc ]; }); From c6e3c11d1fcbf376cf3b272b0949b723d1a4ef98 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Tue, 17 Jun 2025 06:56:04 +0530 Subject: [PATCH 16/65] ci(shared): bump vendored ci files (#628) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++-- ci/vendir.yml | 4 +- ci/vendor/pipeline-fragments.lib.yml | 72 +++++----------------------- ci/vendor/tasks/check-code.sh | 12 +++-- ci/vendor/tasks/test-bats.sh | 26 +++++----- ci/vendor/tasks/test-integration.sh | 8 ++++ 6 files changed, 50 insertions(+), 80 deletions(-) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 900f977f..b2380eb8 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'refactor: call podman directly in test scripts' - sha: 42cda64ff87789ee478aceea611fa6252a6fd346 + commitTitle: 'feat: add concourse cargo caching' + sha: 6d3de519642ae3aef696e5c6edd42a49ceb5422c path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'refactor: call podman directly in test scripts' - sha: 42cda64ff87789ee478aceea611fa6252a6fd346 + commitTitle: 'feat: add concourse cargo caching' + sha: 6d3de519642ae3aef696e5c6edd42a49ceb5422c path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index 21ebb724..f972bc18 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 42cda64ff87789ee478aceea611fa6252a6fd346 + ref: 6d3de519642ae3aef696e5c6edd42a49ceb5422c includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 42cda64ff87789ee478aceea611fa6252a6fd346 + ref: 6d3de519642ae3aef696e5c6edd42a49ceb5422c includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index 1244ebf0..45cbc79a 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -64,6 +64,10 @@ plan: inputs: - name: pipeline-tasks - name: repo + caches: + - path: cargo-home/registry/index + - path: cargo-home/registry/cache + - path: cargo-target-dir run: path: pipeline-tasks/ci/vendor/tasks/check-code.sh #@ end @@ -88,27 +92,6 @@ plan: path: pipeline-tasks/ci/vendor/tasks/nodejs-check-code.sh #@ end -#@ def rust_check_code(): -name: check-code -serial: true -plan: -- in_parallel: - - { get: repo, trigger: true } - - { get: pipeline-tasks } -- task: check-code - config: - platform: linux - image_resource: #@ rust_task_image_config() - inputs: - - name: pipeline-tasks - - name: repo - caches: - - path: cargo-home - - path: cargo-target-dir - run: - path: pipeline-tasks/ci/vendor/tasks/rust-check-code.sh -#@ end - #@ def install_yarn_deps(): name: install-deps plan: @@ -133,45 +116,6 @@ plan: file: bundled-deps/bundled-deps-*.tgz #@ end -#@ def test_on_docker_host(container, additional_params={}): -#@ params = dict(additional_params) -#@ params["REPO_PATH"] = data.values.gh_repository + "-" + container -#@ params["GOOGLE_CREDENTIALS"] = "((staging-gcp-creds.creds_json))" -#@ params["SSH_PRIVATE_KEY"] = "((staging-ssh.ssh_private_key))" -#@ params["SSH_PUB_KEY"] = "((staging-ssh.ssh_public_key))" -#@ params["TEST_CONTAINER"] = container -#@ params["JEST_TIMEOUT"] = 90000 -name: #@ container -serial: true -plan: -- { put: docker-host, params: { acquire: true } } -- in_parallel: - - { get: repo, trigger: true } - - { get: pipeline-tasks } -- task: #@ container - attempts: 2 - timeout: 12m - tags: ["galoy-staging"] - config: - platform: linux - image_resource: #@ rust_task_image_config() - inputs: - - name: pipeline-tasks - - name: docker-host - - name: repo - path: #@ data.values.gh_repository + "-" + container - caches: - - path: cargo-home - - path: cargo-target-dir - params: #@ params - run: - path: pipeline-tasks/ci/vendor/tasks/test-on-docker-host.sh - ensure: - put: docker-host - params: - release: docker-host -#@ end - #@ def integration_test(): name: integration-test plan: @@ -188,6 +132,10 @@ plan: inputs: - name: pipeline-tasks - name: repo + caches: + - path: cargo-home/registry/index + - path: cargo-home/registry/cache + - path: cargo-target-dir run: path: pipeline-tasks/ci/vendor/tasks/test-integration.sh params: @@ -210,6 +158,10 @@ plan: inputs: - name: pipeline-tasks - name: repo + caches: + - path: cargo-home/registry/index + - path: cargo-home/registry/cache + - path: cargo-target-dir run: path: pipeline-tasks/ci/vendor/tasks/test-bats.sh params: diff --git a/ci/vendor/tasks/check-code.sh b/ci/vendor/tasks/check-code.sh index 2dcd1948..2c4ae1dc 100755 --- a/ci/vendor/tasks/check-code.sh +++ b/ci/vendor/tasks/check-code.sh @@ -1,10 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash #! Auto synced from Shared CI Resources repository #! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared -set -eu +set -euo pipefail +nix -L develop ./repo -c sh -exc ' +set -euo pipefail + +cd .. +source pipeline-tasks/ci/vendor/tasks/helpers.sh pushd repo -nix develop -c make check-code +make check-code +' diff --git a/ci/vendor/tasks/test-bats.sh b/ci/vendor/tasks/test-bats.sh index e6752d09..e5ba89ee 100755 --- a/ci/vendor/tasks/test-bats.sh +++ b/ci/vendor/tasks/test-bats.sh @@ -13,19 +13,14 @@ echo "--- Setting up Nix development environment ---" nix develop --profile dev-profile -c true cachix push "${CACHIX_CACHE_NAME}" dev-profile -# --- Source Helpers Early --- -# Get REPO_ROOT early to source helpers -# export REPO_ROOT=$(git rev-parse --show-toplevel) -# if [[ -f "${REPO_ROOT}/bats/helpers.bash" ]]; then -# echo "--- Sourcing helpers ---" -# source "${REPO_ROOT}/bats/helpers.bash" -# else -# echo "Error: helpers.bash not found at ${REPO_ROOT}/bats/helpers.bash" -# exit 1 -# fi - echo "--- Running bats tests in Nix environment ---" + nix -L develop --command sh -exc ' +set -euo pipefail + +cd .. +source pipeline-tasks/ci/vendor/tasks/helpers.sh +pushd repo echo "--- Checking for Podman (via nix) ---" command -v podman @@ -59,9 +54,18 @@ echo "--- Building test artifacts---" # nix build . -L make build +# --- Source BatsHelpers --- +if [[ -f "bats/helpers.bash" ]]; then + echo "--- Sourcing helpers ---" + source "bats/helpers.bash" +else + echo "Error: helpers.bash not found at bats/helpers.bash" + exit 1 +fi # --- Run Bats Tests --- echo "--- Running BATS tests ---" +export DOCKER_ENGINE=podman bats -t bats echo "--- e2e Tests done ---" diff --git a/ci/vendor/tasks/test-integration.sh b/ci/vendor/tasks/test-integration.sh index 3583f440..5d2671eb 100755 --- a/ci/vendor/tasks/test-integration.sh +++ b/ci/vendor/tasks/test-integration.sh @@ -1,4 +1,8 @@ #!/usr/bin/env bash + +#! Auto synced from Shared CI Resources repository +#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared + set -euo pipefail # Change to repo directory @@ -17,6 +21,10 @@ echo "--- Running integration tests in Nix environment ---" nix -L develop --command sh -exc ' set -euo pipefail +cd .. +source pipeline-tasks/ci/vendor/tasks/helpers.sh +pushd repo + echo "--- Checking for Podman (via nix) ---" command -v podman echo "--- Podman check done ---" From 4a75a37470026bc74845c5fe76117329f02aaec1 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 17 Jun 2025 13:21:15 +0000 Subject: [PATCH 17/65] ci(release): release version 0.1.113 --- CHANGELOG.md | 22 ++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4fe0ab2..074a5a06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +# [bria release v0.1.113](https://github.com/GaloyMoney/bria/releases/tag/0.1.113) + + +### Bug Fixes + +- Use entity_id macro from es_entity (#611) + +### Miscellaneous Tasks + +- Add bc to flake (#626) +- Allow settings docker engine in bats helpers (#625) +- Add podman and compose to flake (#622) +- Add test integration makefile target (#615) +- Run sqlx-prepare (#608) + +### Refactor + +- Move e2e tests to bats directory (#614) +- Migrate wallet entity to es_entity (#613) +- Use es_entity framework for profile entity (#609) +- Use es_entity framework for payout_queue entity (#606) + # [bria release v0.1.112](https://github.com/GaloyMoney/bria/releases/tag/0.1.112) diff --git a/Cargo.lock b/Cargo.lock index 7d45eb14..bd516e78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "bria" -version = "0.1.113-dev" +version = "0.1.113" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 774d2cf7..dc20a562 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bria" -version = "0.1.113-dev" +version = "0.1.113" edition = "2021" [features] From 750dc8736f76393857a3e382c232eb6ee364ffc1 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Tue, 17 Jun 2025 13:44:19 +0000 Subject: [PATCH 18/65] ci(dev): set version to 0.1.114-dev --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd516e78..8eee714a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -521,7 +521,7 @@ dependencies = [ [[package]] name = "bria" -version = "0.1.113" +version = "0.1.114-dev" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index dc20a562..06a42d73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bria" -version = "0.1.113" +version = "0.1.114-dev" edition = "2021" [features] From eaa2a0f28ce441780df54c61799dc406434ddacd Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Wed, 18 Jun 2025 16:06:04 +0530 Subject: [PATCH 19/65] fix: use WalletId from es_entity for entity migration (#630) --- src/primitives/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/primitives/mod.rs b/src/primitives/mod.rs index 3883d10c..8ebe6992 100644 --- a/src/primitives/mod.rs +++ b/src/primitives/mod.rs @@ -21,12 +21,11 @@ impl From for LedgerJournalId { Self::from(uuid::Uuid::from(id)) } } -es_entity::entity_id! { ProfileId, PayoutQueueId } +es_entity::entity_id! { ProfileId, PayoutQueueId, WalletId } crate::entity_id! { ProfileApiKeyId } crate::entity_id! { SigningSessionId } crate::entity_id! { KeychainId } crate::entity_id! { SignerId } -crate::entity_id! { WalletId } crate::entity_id! { PayoutId } impl From for LedgerTransactionId { From 09e2240d01ab8f1c3ed1218a432189a1f10e4af9 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Fri, 20 Jun 2025 19:21:06 +0530 Subject: [PATCH 20/65] ci(shared): bump vendored ci files (#632) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++++---- ci/vendir.yml | 4 ++-- ci/vendor/tasks/check-code.sh | 1 - 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index b2380eb8..96f08f70 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'feat: add concourse cargo caching' - sha: 6d3de519642ae3aef696e5c6edd42a49ceb5422c + commitTitle: 'fix: check code script' + sha: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'feat: add concourse cargo caching' - sha: 6d3de519642ae3aef696e5c6edd42a49ceb5422c + commitTitle: 'fix: check code script' + sha: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index f972bc18..e8416220 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 6d3de519642ae3aef696e5c6edd42a49ceb5422c + ref: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 6d3de519642ae3aef696e5c6edd42a49ceb5422c + ref: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/tasks/check-code.sh b/ci/vendor/tasks/check-code.sh index 2c4ae1dc..bf4b3ec6 100755 --- a/ci/vendor/tasks/check-code.sh +++ b/ci/vendor/tasks/check-code.sh @@ -8,7 +8,6 @@ set -euo pipefail nix -L develop ./repo -c sh -exc ' set -euo pipefail -cd .. source pipeline-tasks/ci/vendor/tasks/helpers.sh pushd repo From bd870bfd5cb5fbfb1ca430eee8e179c221fe5638 Mon Sep 17 00:00:00 2001 From: Kartik Shah Date: Wed, 25 Jun 2025 16:11:48 +0530 Subject: [PATCH 21/65] ci: fix values --- ci/values.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ci/values.yml b/ci/values.yml index 1d2e8d4f..17e2d186 100644 --- a/ci/values.yml +++ b/ci/values.yml @@ -7,7 +7,7 @@ github_token: ((github.api_token)) github_app_id: ((github.github_app_id)) github_app_private_key: ((github.github_app_private_key)) -git_charts_uri: git@github.com:GaloyMoney/charts.git +git_charts_uri: git@github.com:GaloyMoney/galoy-charts.git git_charts_branch: main git_charts_bot_branch: bot-bump-bria-image @@ -18,7 +18,6 @@ osxcross_docker_username: ((osxcross-image.username)) osxcross_docker_password: ((osxcross-image.password)) osxcross_repository: ((osxcross-image.repository)) -docker_host_ip: ((staging-ssh.docker_host_ip)) artifacts_bucket_name: ((staging-gcp-creds.bucket_name)) staging_inception_creds: ((staging-gcp-creds.creds_json)) staging_ssh_private_key: ((staging-ssh.ssh_private_key)) From bb819d54edeb2a837ba05ee1962fad71b16f1189 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:50:41 +0530 Subject: [PATCH 22/65] ci(shared): bump vendored ci files (#635) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++++---- ci/vendir.yml | 4 ++-- ci/vendor/pipeline-fragments.lib.yml | 10 ---------- ci/vendor/tasks/test-bats.sh | 9 --------- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 96f08f70..1bc7bcc2 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'fix: check code script' - sha: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d + commitTitle: 'chore: remove bats helper sourcing from bats script' + sha: a940bf705505fe507f3a6aded4f3fdcd8138d624 path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'fix: check code script' - sha: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d + commitTitle: 'chore: remove bats helper sourcing from bats script' + sha: a940bf705505fe507f3a6aded4f3fdcd8138d624 path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index e8416220..0949d282 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d + ref: a940bf705505fe507f3a6aded4f3fdcd8138d624 includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: 6c5be6f1ad65a3c9dc2e8ddb330f4a7c33a8450d + ref: a940bf705505fe507f3a6aded4f3fdcd8138d624 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index 45cbc79a..35750a9c 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -448,16 +448,6 @@ source: private_key: #@ data.values.github_private_key #@ end -#@ def docker_host_pool(): -name: docker-host -type: pool -source: - uri: git@github.com:GaloyMoney/galoy-concourse-locks.git - branch: main - pool: docker-hosts - private_key: #@ data.values.github_private_key -#@ end - #@ def gcr_resource_type(): name: gcs-resource type: docker-image diff --git a/ci/vendor/tasks/test-bats.sh b/ci/vendor/tasks/test-bats.sh index e5ba89ee..9318d2c8 100755 --- a/ci/vendor/tasks/test-bats.sh +++ b/ci/vendor/tasks/test-bats.sh @@ -54,15 +54,6 @@ echo "--- Building test artifacts---" # nix build . -L make build -# --- Source BatsHelpers --- -if [[ -f "bats/helpers.bash" ]]; then - echo "--- Sourcing helpers ---" - source "bats/helpers.bash" -else - echo "Error: helpers.bash not found at bats/helpers.bash" - exit 1 -fi - # --- Run Bats Tests --- echo "--- Running BATS tests ---" export DOCKER_ENGINE=podman From 30b3d4c73b913fb80807913610689660b2c10f2f Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Thu, 26 Jun 2025 18:26:49 +0530 Subject: [PATCH 23/65] refactor: use es_entity for xpub (#631) * refactor: update error files * refactor: update repo definitions * refactor: update repo fns from es_entity * refactor: update repo fns and remove comments * refactor: use XpubId for now * fix: use clone and use builder for default value of config * chore: remove comments and redundant code * fix: rename db_id -> db_uuid * fix: use accessor fn and replace persist_in_tx with create * refactor: use create fn directly * refactor: use create_in_op directly * chore: remove unused import * fix: use correct error variants * fix: use correct error variant * fix: use repo options for entity id * chore: use es-entity on main * chore: pin es-entity * refactor: update entity names and use repo configs * fix: use correct entity name * chore: use es-entity main * chore: pin es-entity * refactor: correct format and remove diffs * chore: undo comments for persist * refactor: revert to key_name and use accessor fn * chore: move persistence traits to repo * chore: rename XPubId->XPubFingerprint and xpub_id->xpub_fingerprint * chore: rename id->fingerprint and update error desc * chore: use correct format * refactor: explicitly specify event using es_entity attr --------- Co-authored-by: Vaibhav Co-authored-by: bodymindarts --- .gitignore | 1 + ...803755714cc2718dae0cdc760aeb279039e32.json | 42 ++++ ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 ++ ...aadc31fa57b51b94766af188b7ae448eb994f.json | 34 --- ...29e278d333674b2afc9d6badea3dd9388db34.json | 42 ++++ ...ab1e304568264e004dec9b8b8cc306dfaee66.json | 82 ++++++ ...8d85df4b382e2465eba4808fa0846f5f62848.json | 18 ++ ...45df9df3b86b6790e788f880ac375540df58.json} | 4 +- ...c4459763b932842b96b740cfea8d92e8b70e4.json | 43 ++++ ...e4373a02c02b4759749ed43a8814ce8454bed.json | 18 ++ ...43bfa7ac3c9166ad4ad14de3b5545858ff0c9.json | 41 +++ ...b7f9a83acf7acff84136572416f8026e214cc.json | 41 +++ ...c3ae1351c5e4454c965700ba6b1ac0c19fc58.json | 40 +++ ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 +++ ...4053ce507f6ba50564e05606c4b153cdec4f7.json | 56 ----- ...b3dd649758b5afcf70feb2a6eff7d69925bfc.json | 20 ++ ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 ++++ ...1605b6db979fed390fe3650895272698a4900.json | 42 ++++ ...8c99c74eb0749d4a28125d6cb7d183617ad59.json | 40 +++ ...414d7512598afa131ccfe7c07b3bcebfc0fea.json | 41 +++ ...664d7d63ef81e673db3dfaa7a882c34ba8d25.json | 17 -- ...f30884dcb2e8bf06603f4a96240b364fb4b9f.json | 58 ----- ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 ++++ ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 +++++++++++ ...376425c07246847cfe0c2df1dc8f16a906ed6.json | 40 +++ ...5f403d6ca6274a0d7816a8a2979943159c062.json | 82 ++++++ ...a25755874dcd529542e64ddf7ff141c38b58.json} | 5 +- ...2ac73205efffa8a12e57753d6ae48ad097c41.json | 23 -- ...fbe4236abbb8f10ec2c999aa03b9a63540c62.json | 43 ++++ ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 +++++++++ ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 +++++++++++ ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 +++++ ...2c52daee5c203fe9e8886d4285bc683f3df6d.json | 15 ++ ...c023fe21eced9e7f469e2a841b2fdeb4f71fc.json | 18 ++ ...fa3a4f1df8e71d1459e7889c5cc2450cec803.json | 82 ++++++ ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 +++ ...07e9102a7799cfda835fdbe31c25bcdd3fc83.json | 40 +++ ...485baf1435b1306562058c570ad5acc277d42.json | 22 ++ ...6f8e4bb0b3d2018b504daa2300a11aec4964b.json | 41 +++ ...ce3c53ef82885389267de4bd66a1e3f08d835.json | 40 +++ ...9addc440966b24c3ad19798872ba6c80ce112.json | 42 ++++ Cargo.lock | 86 +++---- Cargo.toml | 2 +- src/api/server/convert.rs | 4 +- src/api/server/mod.rs | 4 +- src/app/error.rs | 4 +- src/app/mod.rs | 56 +++-- src/job/batch_signing.rs | 18 +- src/primitives/mod.rs | 10 +- src/signing_session/entity.rs | 8 +- src/signing_session/repo.rs | 31 +-- src/wallet/keychain/config.rs | 4 +- src/xpub/entity.rs | 57 ++--- src/xpub/error.rs | 6 + src/xpub/reference.rs | 18 +- src/xpub/repo.rs | 234 ++++++++---------- src/xpub/value.rs | 6 +- tests/payout.rs | 10 +- tests/wallet.rs | 12 +- tests/xpub.rs | 2 +- 60 files changed, 1929 insertions(+), 480 deletions(-) create mode 100644 .sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json create mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json delete mode 100644 .sqlx/query-21ea4761928aec144a72c1ced9baadc31fa57b51b94766af188b7ae448eb994f.json create mode 100644 .sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json create mode 100644 .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json create mode 100644 .sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json rename .sqlx/{query-38ee995cafdc4c4cd1319682e059e9b3b96a10251e0c78656353757f6b965a8c.json => query-390469b173205a768d2a955590f645df9df3b86b6790e788f880ac375540df58.json} (68%) create mode 100644 .sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json create mode 100644 .sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json create mode 100644 .sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json create mode 100644 .sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json create mode 100644 .sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json create mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json delete mode 100644 .sqlx/query-65983b64c9a35cb2869757d3d734053ce507f6ba50564e05606c4b153cdec4f7.json create mode 100644 .sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json create mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json create mode 100644 .sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json create mode 100644 .sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json create mode 100644 .sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json delete mode 100644 .sqlx/query-7296151c0d2387a0894ec37e082664d7d63ef81e673db3dfaa7a882c34ba8d25.json delete mode 100644 .sqlx/query-747102dbe477b86627debbdddb9f30884dcb2e8bf06603f4a96240b364fb4b9f.json create mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json create mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json create mode 100644 .sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json create mode 100644 .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json rename .sqlx/{query-2ef3dc26b44ca0f6fb5bd698f7eb963ca41a1c7fb9ca50bef007492dc62d6891.json => query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json} (61%) delete mode 100644 .sqlx/query-a4f80cfdd4472ffc74a315fb9262ac73205efffa8a12e57753d6ae48ad097c41.json create mode 100644 .sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json create mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json create mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json create mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json create mode 100644 .sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json create mode 100644 .sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json create mode 100644 .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json create mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json create mode 100644 .sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json create mode 100644 .sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json create mode 100644 .sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json create mode 100644 .sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json create mode 100644 .sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json diff --git a/.gitignore b/.gitignore index f3af7694..8204e01c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ result tmp .bacon-locations +.claude/settings.local.json diff --git a/.sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json b/.sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json new file mode 100644 index 00000000..b0710c43 --- /dev/null +++ b/.sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32" +} diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json new file mode 100644 index 00000000..33a94981 --- /dev/null +++ b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Jsonb" + ] + }, + "nullable": [] + }, + "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" +} diff --git a/.sqlx/query-21ea4761928aec144a72c1ced9baadc31fa57b51b94766af188b7ae448eb994f.json b/.sqlx/query-21ea4761928aec144a72c1ced9baadc31fa57b51b94766af188b7ae448eb994f.json deleted file mode 100644 index e222d274..00000000 --- a/.sqlx/query-21ea4761928aec144a72c1ced9baadc31fa57b51b94766af188b7ae448eb994f.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT sequence, event_type, event FROM bria_xpub_events\n WHERE id = $1\n ORDER BY sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 1, - "name": "event_type", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "21ea4761928aec144a72c1ced9baadc31fa57b51b94766af188b7ae448eb994f" -} diff --git a/.sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json b/.sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json new file mode 100644 index 00000000..608cffa9 --- /dev/null +++ b/.sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34" +} diff --git a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json new file mode 100644 index 00000000..301c5cc3 --- /dev/null +++ b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" +} diff --git a/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json b/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json new file mode 100644 index 00000000..01170a0b --- /dev/null +++ b/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_xpub_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848" +} diff --git a/.sqlx/query-38ee995cafdc4c4cd1319682e059e9b3b96a10251e0c78656353757f6b965a8c.json b/.sqlx/query-390469b173205a768d2a955590f645df9df3b86b6790e788f880ac375540df58.json similarity index 68% rename from .sqlx/query-38ee995cafdc4c4cd1319682e059e9b3b96a10251e0c78656353757f6b965a8c.json rename to .sqlx/query-390469b173205a768d2a955590f645df9df3b86b6790e788f880ac375540df58.json index 0467c85a..06a3ffec 100644 --- a/.sqlx/query-38ee995cafdc4c4cd1319682e059e9b3b96a10251e0c78656353757f6b965a8c.json +++ b/.sqlx/query-390469b173205a768d2a955590f645df9df3b86b6790e788f880ac375540df58.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO bria_xpub_signer_configs (id, cypher, nonce, created_at, modified_at)\n VALUES ($1, $2, $3, NOW(), NOW())\n ON CONFLICT (id) DO UPDATE \n SET cypher = $2, nonce = $3, modified_at = NOW()\n ", + "query": "\n INSERT INTO bria_xpub_signer_configs (id, cypher, nonce, created_at, modified_at)\n VALUES ($1, $2, $3, NOW(), NOW())\n ON CONFLICT (id) DO UPDATE\n SET cypher = $2, nonce = $3, modified_at = NOW()\n ", "describe": { "columns": [], "parameters": { @@ -12,5 +12,5 @@ }, "nullable": [] }, - "hash": "38ee995cafdc4c4cd1319682e059e9b3b96a10251e0c78656353757f6b965a8c" + "hash": "390469b173205a768d2a955590f645df9df3b86b6790e788f880ac375540df58" } diff --git a/.sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json b/.sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json new file mode 100644 index 00000000..13d546e7 --- /dev/null +++ b/.sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4" +} diff --git a/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json b/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json new file mode 100644 index 00000000..1e9cccbe --- /dev/null +++ b/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_xpub_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed" +} diff --git a/.sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json b/.sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json new file mode 100644 index 00000000..62fc101e --- /dev/null +++ b/.sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND name = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9" +} diff --git a/.sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json b/.sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json new file mode 100644 index 00000000..0c3168dc --- /dev/null +++ b/.sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc" +} diff --git a/.sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json b/.sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json new file mode 100644 index 00000000..2933dffa --- /dev/null +++ b/.sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE account_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58" +} diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json new file mode 100644 index 00000000..105bf98b --- /dev/null +++ b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" +} diff --git a/.sqlx/query-65983b64c9a35cb2869757d3d734053ce507f6ba50564e05606c4b153cdec4f7.json b/.sqlx/query-65983b64c9a35cb2869757d3d734053ce507f6ba50564e05606c4b153cdec4f7.json deleted file mode 100644 index ad0fe4b0..00000000 --- a/.sqlx/query-65983b64c9a35cb2869757d3d734053ce507f6ba50564e05606c4b153cdec4f7.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT b.*, e.sequence, e.event\n FROM bria_xpubs b\n JOIN bria_xpub_events e ON b.id = e.id\n ORDER BY b.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "fingerprint", - "type_info": "Bytea" - }, - { - "ordinal": 4, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 5, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 6, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "65983b64c9a35cb2869757d3d734053ce507f6ba50564e05606c4b153cdec4f7" -} diff --git a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json new file mode 100644 index 00000000..60f58c60 --- /dev/null +++ b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT NOW()", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "now", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc" +} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json new file mode 100644 index 00000000..074622c1 --- /dev/null +++ b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" +} diff --git a/.sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json b/.sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json new file mode 100644 index 00000000..c7dd8491 --- /dev/null +++ b/.sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900" +} diff --git a/.sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json b/.sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json new file mode 100644 index 00000000..2cec7c3c --- /dev/null +++ b/.sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE name = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59" +} diff --git a/.sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json b/.sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json new file mode 100644 index 00000000..9b62c26e --- /dev/null +++ b/.sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND fingerprint = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bytea" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea" +} diff --git a/.sqlx/query-7296151c0d2387a0894ec37e082664d7d63ef81e673db3dfaa7a882c34ba8d25.json b/.sqlx/query-7296151c0d2387a0894ec37e082664d7d63ef81e673db3dfaa7a882c34ba8d25.json deleted file mode 100644 index bb607dc6..00000000 --- a/.sqlx/query-7296151c0d2387a0894ec37e082664d7d63ef81e673db3dfaa7a882c34ba8d25.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_xpubs\n (id, account_id, name, fingerprint)\n VALUES ($1, $2, $3, $4)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Varchar", - "Bytea" - ] - }, - "nullable": [] - }, - "hash": "7296151c0d2387a0894ec37e082664d7d63ef81e673db3dfaa7a882c34ba8d25" -} diff --git a/.sqlx/query-747102dbe477b86627debbdddb9f30884dcb2e8bf06603f4a96240b364fb4b9f.json b/.sqlx/query-747102dbe477b86627debbdddb9f30884dcb2e8bf06603f4a96240b364fb4b9f.json deleted file mode 100644 index 94170bbc..00000000 --- a/.sqlx/query-747102dbe477b86627debbdddb9f30884dcb2e8bf06603f4a96240b364fb4b9f.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT b.*, e.sequence, e.event\n FROM bria_xpubs b\n JOIN bria_xpub_events e ON b.id = e.id\n WHERE account_id = $1\n ORDER BY b.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "name", - "type_info": "Varchar" - }, - { - "ordinal": 3, - "name": "fingerprint", - "type_info": "Bytea" - }, - { - "ordinal": 4, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 5, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 6, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "747102dbe477b86627debbdddb9f30884dcb2e8bf06603f4a96240b364fb4b9f" -} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json new file mode 100644 index 00000000..7857e9f9 --- /dev/null +++ b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "code", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "params", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "tx_input", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "entries", + "type_info": "Jsonb" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + true, + false, + false + ] + }, + "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" +} diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json new file mode 100644 index 00000000..3c7819b4 --- /dev/null +++ b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json @@ -0,0 +1,148 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" +} diff --git a/.sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json b/.sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json new file mode 100644 index 00000000..dafd433c --- /dev/null +++ b/.sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6" +} diff --git a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json new file mode 100644 index 00000000..00d0da2e --- /dev/null +++ b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" +} diff --git a/.sqlx/query-2ef3dc26b44ca0f6fb5bd698f7eb963ca41a1c7fb9ca50bef007492dc62d6891.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json similarity index 61% rename from .sqlx/query-2ef3dc26b44ca0f6fb5bd698f7eb963ca41a1c7fb9ca50bef007492dc62d6891.json rename to .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json index f745f675..f856a851 100644 --- a/.sqlx/query-2ef3dc26b44ca0f6fb5bd698f7eb963ca41a1c7fb9ca50bef007492dc62d6891.json +++ b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT id FROM bria_xpubs WHERE account_id = $1 AND name = $2", + "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", "describe": { "columns": [ { @@ -11,7 +11,6 @@ ], "parameters": { "Left": [ - "Uuid", "Text" ] }, @@ -19,5 +18,5 @@ false ] }, - "hash": "2ef3dc26b44ca0f6fb5bd698f7eb963ca41a1c7fb9ca50bef007492dc62d6891" + "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" } diff --git a/.sqlx/query-a4f80cfdd4472ffc74a315fb9262ac73205efffa8a12e57753d6ae48ad097c41.json b/.sqlx/query-a4f80cfdd4472ffc74a315fb9262ac73205efffa8a12e57753d6ae48ad097c41.json deleted file mode 100644 index 2a92d8c2..00000000 --- a/.sqlx/query-a4f80cfdd4472ffc74a315fb9262ac73205efffa8a12e57753d6ae48ad097c41.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id FROM bria_xpubs WHERE account_id = $1 AND fingerprint = $2", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Bytea" - ] - }, - "nullable": [ - false - ] - }, - "hash": "a4f80cfdd4472ffc74a315fb9262ac73205efffa8a12e57753d6ae48ad097c41" -} diff --git a/.sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json b/.sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json new file mode 100644 index 00000000..44832298 --- /dev/null +++ b/.sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62" +} diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json new file mode 100644 index 00000000..b95d0aed --- /dev/null +++ b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json @@ -0,0 +1,121 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 5, + "name": "entry_type", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "layer: Layer", + "type_info": { + "Custom": { + "name": "layer", + "kind": { + "Enum": [ + "settled", + "pending", + "encumbered" + ] + } + } + } + }, + { + "ordinal": 7, + "name": "units", + "type_info": "Numeric" + }, + { + "ordinal": 8, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "direction: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 10, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" +} diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json new file mode 100644 index 00000000..92db28c8 --- /dev/null +++ b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json @@ -0,0 +1,147 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" +} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json new file mode 100644 index 00000000..90bef3da --- /dev/null +++ b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json @@ -0,0 +1,59 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + }, + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + }, + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" +} diff --git a/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json b/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json new file mode 100644 index 00000000..dde5752d --- /dev/null +++ b/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_xpubs SET account_id = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [] + }, + "hash": "c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d" +} diff --git a/.sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json b/.sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json new file mode 100644 index 00000000..109644a6 --- /dev/null +++ b/.sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_xpubs (id, account_id, name, fingerprint, created_at) VALUES ($1, $2, $3, $4, $5)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Varchar", + "Bytea", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc" +} diff --git a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json new file mode 100644 index 00000000..18d9c9b6 --- /dev/null +++ b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "TextArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" +} diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json new file mode 100644 index 00000000..8de91f27 --- /dev/null +++ b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Date", + "Uuid", + "Varchar", + "Varchar", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" +} diff --git a/.sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json b/.sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json new file mode 100644 index 00000000..e53b7132 --- /dev/null +++ b/.sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE fingerprint = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Bytea" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83" +} diff --git a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json new file mode 100644 index 00000000..50c0e05c --- /dev/null +++ b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "payload!", + "type_info": "Json" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + null + ] + }, + "hash": "e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42" +} diff --git a/.sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json b/.sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json new file mode 100644 index 00000000..c880b13d --- /dev/null +++ b/.sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b" +} diff --git a/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json b/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json new file mode 100644 index 00000000..56428e88 --- /dev/null +++ b/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.id AS \"id: Uuid\", e.sequence, e.event, e.recorded_at FROM bria_xpubs i JOIN bria_xpub_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835" +} diff --git a/.sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json b/.sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json new file mode 100644 index 00000000..fc54a5bc --- /dev/null +++ b/.sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112" +} diff --git a/Cargo.lock b/Cargo.lock index 8eee714a..27985b0e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -175,7 +175,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -186,7 +186,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -516,7 +516,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -641,7 +641,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -752,7 +752,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -886,7 +886,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -897,7 +897,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -939,7 +939,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -949,7 +949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -972,7 +972,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1052,9 +1052,9 @@ dependencies = [ [[package]] name = "es-entity" -version = "0.5.1" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "509c112d61f3f9ff0a1d81ffb36a76a800865fcffd50151e0e6027b961343e76" +checksum = "f162222dfcd78f9a2aff387d98024780d6009deda6cdb719e28aa8e55f023795" dependencies = [ "async-trait", "chrono", @@ -1069,9 +1069,9 @@ dependencies = [ [[package]] name = "es-entity-macros" -version = "0.5.1" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88935765e36f62a52d4070cffd2dd7afb92fe23991d4d7e4e6490f8872fb60bf" +checksum = "568e84b4c66b9932a901e62dec84e28dc5e9903d4e1a4df51142adaeb19cf355" dependencies = [ "convert_case", "darling", @@ -1079,7 +1079,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1251,7 +1251,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -1795,7 +1795,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2394,7 +2394,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2485,7 +2485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2543,7 +2543,7 @@ dependencies = [ "prost 0.12.6", "prost-types", "regex", - "syn 2.0.101", + "syn 2.0.104", "tempfile", ] @@ -2557,7 +2557,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -2570,7 +2570,7 @@ dependencies = [ "itertools 0.13.0", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3217,7 +3217,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3271,7 +3271,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3309,7 +3309,7 @@ checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3563,7 +3563,7 @@ dependencies = [ "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3586,7 +3586,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.101", + "syn 2.0.104", "tempfile", "tokio", "url", @@ -3784,9 +3784,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -3816,7 +3816,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3874,7 +3874,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3885,7 +3885,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -3990,7 +3990,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4153,7 +4153,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4166,7 +4166,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4248,7 +4248,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4360,7 +4360,7 @@ checksum = "70b20a22c42c8f1cd23ce5e34f165d4d37038f5b663ad20fb6adbdf029172483" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4543,7 +4543,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "wasm-bindgen-shared", ] @@ -4577,7 +4577,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4944,7 +4944,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "synstructure", ] @@ -4966,7 +4966,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] [[package]] @@ -4986,7 +4986,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", "synstructure", ] @@ -5015,5 +5015,5 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.104", ] diff --git a/Cargo.toml b/Cargo.toml index 06a42d73..dfebea18 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] # es-entity = { git = "https://github.com/galoymoney/cala.git", branch = "main" } -es-entity = "0.5.1" +es-entity = "0.6.7" sqlx-ledger = { version = "0.11.5", features = ["otel"] } anyhow = "1.0.82" diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index 10f07495..64b07a65 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -132,7 +132,7 @@ impl From for proto::Xpub { fn from(xpub: AccountXPub) -> Self { Self { name: xpub.key_name.to_string(), - id: xpub.id().to_string(), + id: xpub.fingerprint().to_string(), xpub: xpub.original.clone(), derivation_path: xpub .derivation_path() @@ -706,7 +706,7 @@ impl From for tonic::Status { ApplicationError::SigningSessionNotFoundForBatchId(_) => { tonic::Status::not_found(err.to_string()) } - ApplicationError::SigningSessionNotFoundForXPubId(_) => { + ApplicationError::SigningSessionNotFoundForXPubFingerprint(_) => { tonic::Status::not_found(err.to_string()) } ApplicationError::WalletError(WalletError::PsbtDoesNotHaveValidSignatures) => { diff --git a/src/api/server/mod.rs b/src/api/server/mod.rs index cf97269f..0ad29349 100644 --- a/src/api/server/mod.rs +++ b/src/api/server/mod.rs @@ -246,7 +246,7 @@ impl BriaService for Bria { name, keychain_config, } = request.into_inner(); - let (id, xpub_ids) = match keychain_config { + let (id, xpub_fingerprints) = match keychain_config { Some(KeychainConfig { config: Some(keychain_config::Config::Wpkh(keychain_config::Wpkh { @@ -285,7 +285,7 @@ impl BriaService for Bria { }; Ok(Response::new(CreateWalletResponse { id: id.to_string(), - xpub_ids: xpub_ids.into_iter().map(|id| id.to_string()).collect(), + xpub_ids: xpub_fingerprints.into_iter().map(|id| id.to_string()).collect(), })) }) .await diff --git a/src/app/error.rs b/src/app/error.rs index bad3851b..9ba387d7 100644 --- a/src/app/error.rs +++ b/src/app/error.rs @@ -71,8 +71,8 @@ pub enum ApplicationError { PayoutExceedsMaximum(Satoshis), #[error("Signing Session not found for batch id: {0}")] SigningSessionNotFoundForBatchId(crate::primitives::BatchId), - #[error("Signing Session not found for xpub id: {0}")] - SigningSessionNotFoundForXPubId(crate::primitives::XPubId), + #[error("Signing Session not found for xpub fingerprint: {0}")] + SigningSessionNotFoundForXPubFingerprint(crate::primitives::XPubFingerprint), #[error("Could not parse incoming psbt: {0}")] CouldNotParseIncomingPsbt(bitcoin::psbt::PsbtParseError), #[error("Hex decode error: {0}")] diff --git a/src/app/mod.rs b/src/app/mod.rs index 2534769e..ed6ff156 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -198,7 +198,7 @@ impl App { key_name: String, xpub: String, derivation: Option, - ) -> Result { + ) -> Result { let value = XPub::try_from((&xpub, derivation))?; let xpub = NewAccountXPub::builder() .account_id(profile.account_id) @@ -207,8 +207,8 @@ impl App { .value(value) .build() .expect("Couldn't build xpub"); - let id = self.xpubs.persist(xpub).await?; - Ok(id) + let fingerprint = self.xpubs.create(xpub).await?.fingerprint(); + Ok(fingerprint) } #[instrument(name = "app.set_signer_config", skip(self), err)] @@ -218,6 +218,7 @@ impl App { xpub_ref: String, config: SignerConfig, ) -> Result<(), ApplicationError> { + let mut db = self.xpubs.begin_op().await?; let mut xpub = self .xpubs .find_from_ref( @@ -227,16 +228,18 @@ impl App { .expect("ref should always parse"), ) .await?; - let xpub_id = xpub.id(); + let xpub_fingerprint = xpub.fingerprint(); xpub.set_signer_config(config, &self.config.signer_encryption.key)?; - let mut tx = self.pool.begin().await?; - self.xpubs.persist_updated(&mut tx, xpub).await?; + self.xpubs.persist_updated(&mut db, xpub).await?; let batch_ids = self .signing_sessions - .list_batch_ids_for(&mut tx, profile.account_id, xpub_id) - .await?; - job::spawn_all_batch_signings(tx, batch_ids.into_iter().map(|b| (profile.account_id, b))) + .list_batch_ids_for(db.tx(), profile.account_id, xpub_fingerprint) .await?; + job::spawn_all_batch_signings( + db.into_tx(), + batch_ids.into_iter().map(|b| (profile.account_id, b)), + ) + .await?; Ok(()) } @@ -257,14 +260,14 @@ impl App { cipher.decrypt(nonce, deprecated_encrypted_key_bytes.as_slice())?; let deprecated_key = chacha20poly1305::Key::clone_from_slice(deprecated_key_bytes.as_ref()); let xpubs = self.xpubs.list_all_xpubs().await?; - let mut tx = self.pool.begin().await?; + let mut db = self.xpubs.begin_op().await?; for mut xpub in xpubs { if let Some(signing_cfg) = xpub.signing_cfg(deprecated_key) { xpub.set_signer_config(signing_cfg, &self.config.signer_encryption.key)?; - self.xpubs.persist_updated(&mut tx, xpub).await?; + self.xpubs.persist_updated(&mut db, xpub).await?; } } - tx.commit().await?; + db.commit().await?; Ok(()) } @@ -285,7 +288,7 @@ impl App { .expect("ref should always parse"), ) .await?; - let xpub_id = xpub.id(); + let xpub_fingerprint = xpub.fingerprint(); let xpub = xpub.value; let unsigned_psbt = self .batches @@ -299,9 +302,9 @@ impl App { .await? .ok_or(ApplicationError::SigningSessionNotFoundForBatchId(batch_id))? .xpub_sessions; - let session = sessions - .get_mut(&xpub_id) - .ok_or_else(|| ApplicationError::SigningSessionNotFoundForXPubId(xpub_id))?; + let session = sessions.get_mut(&xpub_fingerprint).ok_or_else(|| { + ApplicationError::SigningSessionNotFoundForXPubFingerprint(xpub_fingerprint) + })?; let mut tx = self.pool.begin().await?; session.submit_externally_signed_psbt(signed_psbt); @@ -319,7 +322,7 @@ impl App { wallet_name: String, xpub: String, derivation: Option, - ) -> Result<(WalletId, Vec), ApplicationError> { + ) -> Result<(WalletId, Vec), ApplicationError> { let keychain = if let Ok(xpub) = XPub::try_from((&xpub, derivation)) { KeychainConfig::wpkh(xpub) } else { @@ -344,7 +347,7 @@ impl App { wallet_name: String, external: String, internal: String, - ) -> Result<(WalletId, Vec), ApplicationError> { + ) -> Result<(WalletId, Vec), ApplicationError> { let keychain = KeychainConfig::try_from((external.as_ref(), internal.as_ref()))?; self.create_wallet(profile, wallet_name, keychain).await } @@ -356,7 +359,7 @@ impl App { wallet_name: String, xpubs: Vec, threshold: u32, - ) -> Result<(WalletId, Vec), ApplicationError> { + ) -> Result<(WalletId, Vec), ApplicationError> { let xpub_values: Vec = futures::future::try_join_all( xpubs .iter() @@ -380,29 +383,30 @@ impl App { profile: &Profile, wallet_name: String, keychain: KeychainConfig, - ) -> Result<(WalletId, Vec), ApplicationError> { + ) -> Result<(WalletId, Vec), ApplicationError> { let mut op = self.wallets.begin_op().await?; let xpubs = keychain.xpubs(); - let mut xpub_ids = Vec::new(); + let mut xpub_fingerprints = Vec::new(); for xpub in xpubs { match self .xpubs - .find_from_ref(profile.account_id, xpub.id()) + .find_from_ref(profile.account_id, xpub.fingerprint()) .await { Ok(xpub) => { - xpub_ids.push(xpub.id()); + xpub_fingerprints.push(xpub.fingerprint()); } Err(_) => { let original = xpub.inner().to_string(); let xpub = NewAccountXPub::builder() .account_id(profile.account_id) - .key_name(format!("{wallet_name}-{}", xpub.id())) + .key_name(format!("{wallet_name}-{}", xpub.fingerprint())) .original(original) .value(xpub) .build() .expect("Couldn't build xpub"); - xpub_ids.push(self.xpubs.persist_in_tx(op.tx(), xpub).await?); + xpub_fingerprints + .push(self.xpubs.create_in_op(&mut op, xpub).await?.fingerprint()); } } } @@ -442,7 +446,7 @@ impl App { .persist_all_in_tx(op.tx(), descriptors) .await?; op.commit().await?; - Ok((wallet.id, xpub_ids)) + Ok((wallet.id, xpub_fingerprints)) } #[instrument(name = "app.get_wallet_balance_summary", skip(self), err)] diff --git a/src/job/batch_signing.rs b/src/job/batch_signing.rs index 71043159..fc898e51 100644 --- a/src/job/batch_signing.rs +++ b/src/job/batch_signing.rs @@ -63,16 +63,18 @@ pub async fn execute( let keychain_xpubs = wallet.xpubs_for_keychains(&summary.signing_keychains); for (_, keychain_xpubs) in keychain_xpubs.into_iter() { for xpub in keychain_xpubs.into_iter() { - let account_xpub = xpubs.find_from_ref(data.account_id, xpub.id()).await?; + let account_xpub = xpubs + .find_from_ref(data.account_id, xpub.fingerprint()) + .await?; let new_session = NewSigningSession::builder() .account_id(data.account_id) .batch_id(data.batch_id) - .xpub_id(xpub.id()) + .xpub_id(xpub.fingerprint()) .unsigned_psbt(unsigned_psbt.clone()) .build() .expect("Could not build signing session"); - new_sessions.insert(account_xpub.id(), new_session); - account_xpubs.insert(account_xpub.id(), account_xpub); + new_sessions.insert(account_xpub.fingerprint(), new_session); + account_xpubs.insert(account_xpub.fingerprint(), account_xpub); } } } @@ -87,12 +89,14 @@ pub async fn execute( }; let mut any_updated = false; - for (xpub_id, session) in sessions.iter_mut().filter(|(_, s)| !s.is_completed()) { + for (xpub_fingerprint, session) in sessions.iter_mut().filter(|(_, s)| !s.is_completed()) { any_updated = true; - let account_xpub = if let Some(xpub) = account_xpub_cache.remove(xpub_id) { + let account_xpub = if let Some(xpub) = account_xpub_cache.remove(xpub_fingerprint) { xpub } else { - xpubs.find_from_ref(data.account_id, xpub_id).await? + xpubs + .find_from_ref(data.account_id, xpub_fingerprint) + .await? }; let mut client = match account_xpub .remote_signing_client(signer_encryption_config.key) diff --git a/src/primitives/mod.rs b/src/primitives/mod.rs index 8ebe6992..55b9dbeb 100644 --- a/src/primitives/mod.rs +++ b/src/primitives/mod.rs @@ -44,15 +44,15 @@ crate::entity_id! { OutboxEventId } #[derive(Debug, Clone, Hash, PartialEq, Eq, Copy, Serialize, Deserialize)] #[serde(transparent)] -pub struct XPubId(bitcoin::Fingerprint); +pub struct XPubFingerprint(bitcoin::Fingerprint); -impl From for XPubId { +impl From for XPubFingerprint { fn from(fp: bitcoin::Fingerprint) -> Self { Self(fp) } } -impl std::str::FromStr for XPubId { +impl std::str::FromStr for XPubFingerprint { type Err = ::Err; fn from_str(s: &str) -> Result { @@ -61,13 +61,13 @@ impl std::str::FromStr for XPubId { } } -impl fmt::Display for XPubId { +impl fmt::Display for XPubFingerprint { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } -impl std::ops::Deref for XPubId { +impl std::ops::Deref for XPubFingerprint { type Target = bitcoin::Fingerprint; fn deref(&self) -> &Self::Target { diff --git a/src/signing_session/entity.rs b/src/signing_session/entity.rs index 1add14a8..a946f9f1 100644 --- a/src/signing_session/entity.rs +++ b/src/signing_session/entity.rs @@ -15,7 +15,7 @@ use crate::{ pub enum SigningSessionEvent { Initialized { id: SigningSessionId, - xpub_id: XPubId, + xpub_id: XPubFingerprint, account_id: AccountId, batch_id: BatchId, unsigned_psbt: psbt::PartiallySignedTransaction, @@ -44,7 +44,7 @@ pub struct SigningSession { pub id: SigningSessionId, pub account_id: AccountId, pub batch_id: BatchId, - pub xpub_id: XPubId, + pub xpub_id: XPubFingerprint, pub unsigned_psbt: psbt::PartiallySignedTransaction, pub(super) events: EntityEvents, } @@ -134,7 +134,7 @@ impl From<&SigningClientError> for SigningFailureReason { } pub struct BatchSigningSession { - pub xpub_sessions: HashMap, + pub xpub_sessions: HashMap, } #[derive(Builder, Clone, Debug)] @@ -143,7 +143,7 @@ pub struct NewSigningSession { pub(super) id: SigningSessionId, pub(super) account_id: AccountId, pub(super) batch_id: BatchId, - pub(super) xpub_id: XPubId, + pub(super) xpub_id: XPubFingerprint, unsigned_psbt: psbt::PartiallySignedTransaction, } diff --git a/src/signing_session/repo.rs b/src/signing_session/repo.rs index a3728532..15fee7ee 100644 --- a/src/signing_session/repo.rs +++ b/src/signing_session/repo.rs @@ -18,7 +18,7 @@ impl SigningSessions { pub async fn persist_sessions( &self, - sessions: HashMap, + sessions: HashMap, ) -> Result { let mut tx = self.pool.begin().await?; let mut query_builder: QueryBuilder = QueryBuilder::new( @@ -27,16 +27,19 @@ impl SigningSessions { ); let mut account_id = None; let mut batch_id = None; - query_builder.push_values(sessions.iter(), |mut builder, (xpub_id, session)| { - if account_id.is_none() && batch_id.is_none() { - account_id = Some(session.account_id); - batch_id = Some(session.batch_id); - } - builder.push_bind(Uuid::from(session.id)); - builder.push_bind(Uuid::from(session.account_id)); - builder.push_bind(Uuid::from(session.batch_id)); - builder.push_bind(xpub_id.as_bytes().to_owned()); - }); + query_builder.push_values( + sessions.iter(), + |mut builder, (xpub_fingerprint, session)| { + if account_id.is_none() && batch_id.is_none() { + account_id = Some(session.account_id); + batch_id = Some(session.batch_id); + } + builder.push_bind(Uuid::from(session.id)); + builder.push_bind(Uuid::from(session.account_id)); + builder.push_bind(Uuid::from(session.batch_id)); + builder.push_bind(xpub_fingerprint.as_bytes().to_owned()); + }, + ); let query = query_builder.build(); query.execute(&mut *tx).await?; EntityEvents::::persist( @@ -62,7 +65,7 @@ impl SigningSessions { pub async fn update_sessions( &self, tx: &mut Transaction<'_, Postgres>, - sessions: &HashMap, + sessions: &HashMap, ) -> Result<(), SigningSessionError> { EntityEvents::::persist( "bria_signing_session_events", @@ -117,7 +120,7 @@ impl SigningSessions { &self, tx: &mut Transaction<'_, Postgres>, account_id: AccountId, - xpub_id: XPubId, + xpub_fingerprint: XPubFingerprint, ) -> Result, SigningSessionError> { let rows = sqlx::query!( r#" @@ -125,7 +128,7 @@ impl SigningSessions { FROM bria_signing_sessions WHERE account_id = $1 AND xpub_fingerprint = $2 FOR UPDATE"#, Uuid::from(account_id), - xpub_id.as_bytes() + xpub_fingerprint.as_bytes() ) .fetch_all(&mut **tx) .await?; diff --git a/src/wallet/keychain/config.rs b/src/wallet/keychain/config.rs index b91384e3..8743fcc7 100644 --- a/src/wallet/keychain/config.rs +++ b/src/wallet/keychain/config.rs @@ -37,12 +37,12 @@ impl KeychainConfig { let mut ret = HashMap::new(); internal.for_each_key(|key| { let xpub = XPub::try_from(key).expect("Couldn't convert xpub"); - ret.insert(xpub.id(), xpub); + ret.insert(xpub.fingerprint(), xpub); true }); external.for_each_key(|key| { let xpub = XPub::try_from(key).expect("Couldn't convert xpub"); - ret.insert(xpub.id(), xpub); + ret.insert(xpub.fingerprint(), xpub); true }); ret.into_values().collect() diff --git a/src/xpub/entity.rs b/src/xpub/entity.rs index 5ad57e7f..a834ecd8 100644 --- a/src/xpub/entity.rs +++ b/src/xpub/entity.rs @@ -1,11 +1,13 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; use super::{error::XPubError, signer_config::*, signing_client::*, value::XPub as XPubValue}; -use crate::{entity::*, primitives::*}; +use crate::primitives::*; -#[derive(Debug, Serialize, Deserialize)] +#[derive(EsEvent, Debug, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "uuid::Uuid")] pub enum XPubEvent { Initialized { db_uuid: uuid::Uuid, @@ -21,21 +23,23 @@ pub enum XPubEvent { }, } -#[derive(Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[es_entity(event = XPubEvent)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct AccountXPub { pub account_id: AccountId, pub key_name: String, pub value: XPubValue, pub original: String, + #[builder(default)] pub(super) encrypted_signer_config: Option<(ConfigCyper, Nonce)>, - pub(super) db_uuid: uuid::Uuid, + pub(super) id: uuid::Uuid, pub(super) events: EntityEvents, } impl AccountXPub { - pub fn id(&self) -> XPubId { - self.value.id() + pub fn fingerprint(&self) -> XPubFingerprint { + self.value.fingerprint() } pub fn set_signer_config( @@ -82,7 +86,7 @@ impl AccountXPub { #[derive(Builder, Clone, Debug)] pub struct NewAccountXPub { - pub(super) db_uuid: uuid::Uuid, + pub(super) id: uuid::Uuid, pub(super) account_id: AccountId, #[builder(setter(into))] pub(super) key_name: String, @@ -93,19 +97,24 @@ pub struct NewAccountXPub { impl NewAccountXPub { pub fn builder() -> NewAccountXPubBuilder { let mut builder = NewAccountXPubBuilder::default(); - builder.db_uuid(uuid::Uuid::new_v4()); + builder.id(uuid::Uuid::new_v4()); builder } - pub fn id(&self) -> XPubId { - self.value.id() + pub fn fingerprint(&self) -> XPubFingerprint { + self.value.fingerprint() } - pub(super) fn initial_events(self) -> EntityEvents { + pub fn key_name(&self) -> String { + self.key_name.clone() + } +} +impl IntoEvents for NewAccountXPub { + fn into_events(self) -> EntityEvents { let xpub = self.value.inner; - EntityEvents::init([ + let events = vec![ XPubEvent::Initialized { - db_uuid: self.db_uuid, + db_uuid: self.id, account_id: self.account_id, fingerprint: xpub.fingerprint(), parent_fingerprint: xpub.parent_fingerprint, @@ -116,18 +125,15 @@ impl NewAccountXPub { XPubEvent::NameUpdated { name: self.key_name, }, - ]) + ]; + EntityEvents::init(self.id, events) } } -impl TryFrom<(EntityEvents, Option<(ConfigCyper, Nonce)>)> for AccountXPub { - type Error = EntityError; - - fn try_from( - (events, config): (EntityEvents, Option<(ConfigCyper, Nonce)>), - ) -> Result { +impl TryFromEvents for AccountXPub { + fn try_from_events(events: EntityEvents) -> Result { let mut builder = AccountXPubBuilder::default(); - for event in events.iter() { + for event in events.iter_all() { match event { XPubEvent::Initialized { db_uuid, @@ -138,7 +144,7 @@ impl TryFrom<(EntityEvents, Option<(ConfigCyper, Nonce)>)> for Accoun .. } => { builder = builder - .db_uuid(*db_uuid) + .id(*db_uuid) .account_id(*account_id) .value(XPubValue { inner: *xpub, @@ -151,11 +157,6 @@ impl TryFrom<(EntityEvents, Option<(ConfigCyper, Nonce)>)> for Accoun } } } - if let Some((encrypted_config, nonce)) = config { - builder = builder.encrypted_signer_config(Some((encrypted_config, nonce))); - } else { - builder = builder.encrypted_signer_config(None); - } builder.events(events).build() } } diff --git a/src/xpub/error.rs b/src/xpub/error.rs index b87f7586..e76cac8f 100644 --- a/src/xpub/error.rs +++ b/src/xpub/error.rs @@ -20,4 +20,10 @@ pub enum XPubError { UnsupportedPubKeyType, #[error("Could not decrypt signer config: {0}")] CouldNotDecryptSignerConfig(chacha20poly1305::Error), + #[error("XPubError - EsEntityError: {0}")] + EsEntityError(es_entity::EsEntityError), + #[error("XPubError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), } + +es_entity::from_es_entity_error!(XPubError); diff --git a/src/xpub/reference.rs b/src/xpub/reference.rs index ffea6180..75b1a675 100644 --- a/src/xpub/reference.rs +++ b/src/xpub/reference.rs @@ -1,7 +1,7 @@ use crate::primitives::*; pub enum XPubRef { - Id(XPubId), + Fingerprint(XPubFingerprint), Name(String), } @@ -9,22 +9,22 @@ impl std::str::FromStr for XPubRef { type Err = super::error::XPubError; fn from_str(s: &str) -> Result { - if let Ok(id) = XPubId::from_str(s) { - Ok(XPubRef::Id(id)) + if let Ok(fingerprint) = XPubFingerprint::from_str(s) { + Ok(XPubRef::Fingerprint(fingerprint)) } else { Ok(XPubRef::Name(s.to_string())) } } } -impl From for XPubRef { - fn from(id: XPubId) -> Self { - Self::Id(id) +impl From for XPubRef { + fn from(fingerprint: XPubFingerprint) -> Self { + Self::Fingerprint(fingerprint) } } -impl From<&XPubId> for XPubRef { - fn from(id: &XPubId) -> Self { - Self::Id(*id) +impl From<&XPubFingerprint> for XPubRef { + fn from(fingerprint: &XPubFingerprint) -> Self { + Self::Fingerprint(*fingerprint) } } diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index 70c36947..3be9df67 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -1,87 +1,75 @@ -use sqlx::{Pool, Postgres, Transaction}; -use tracing::instrument; -use uuid::Uuid; +use es_entity::*; +use sqlx::{Database, Encode, Pool, Postgres}; -use super::{entity::*, error::XPubError, reference::*, signer_config::*}; -use crate::{entity::*, primitives::*}; use std::collections::HashMap; +use uuid::Uuid; -#[derive(Clone)] +use super::{entity::*, error::XPubError, reference::*, signer_config::*}; +use crate::primitives::*; + +#[derive(EsRepo, Clone, Debug)] +#[es_repo( + entity = "AccountXPub", + event = "XPubEvent", + err = "XPubError", + id = Uuid, + tbl = "bria_xpubs", + events_tbl = "bria_xpub_events", + columns( + account_id(ty = "AccountId", list_for), + name(ty = "String", update(persist=false), create(accessor=key_name())), + fingerprint(ty = "XPubFingerprint", create(accessor=fingerprint()), update(persist = false)) + ), + tbl_prefix = "bria" +)] pub struct XPubs { pool: Pool, } -impl XPubs { - pub fn new(pool: &Pool) -> Self { - Self { pool: pool.clone() } +impl Encode<'_, Postgres> for XPubFingerprint { + fn encode_by_ref( + &self, + buf: &mut ::ArgumentBuffer<'_>, + ) -> Result> { + let bytes = self.to_bytes(); + bytes.encode_by_ref(buf) } +} - #[instrument(name = "xpubs.persist", skip(self))] - pub async fn persist(&self, xpub: NewAccountXPub) -> Result { - let mut tx = self.pool.begin().await?; - let ret = self.persist_in_tx(&mut tx, xpub).await?; - tx.commit().await?; - Ok(ret) +impl sqlx::Type for XPubFingerprint { + fn type_info() -> ::TypeInfo { + sqlx::postgres::PgTypeInfo::with_name("BYTEA") } +} - #[instrument(name = "xpubs.persist_in_tx", skip(self))] - pub async fn persist_in_tx( - &self, - tx: &mut Transaction<'_, Postgres>, - xpub: NewAccountXPub, - ) -> Result { - let xpub_id = xpub.id(); - sqlx::query!( - r#"INSERT INTO bria_xpubs - (id, account_id, name, fingerprint) - VALUES ($1, $2, $3, $4)"#, - xpub.db_uuid, - Uuid::from(xpub.account_id), - xpub.key_name, - xpub_id.as_bytes() - ) - .execute(&mut **tx) - .await?; - let id = xpub.db_uuid; - EntityEvents::::persist( - "bria_xpub_events", - &mut *tx, - xpub.initial_events().new_serialized_events(id), - ) - .await?; - Ok(xpub_id) +impl XPubs { + pub fn new(pool: &Pool) -> Self { + Self { pool: pool.clone() } } pub async fn persist_updated( &self, - tx: &mut Transaction<'_, Postgres>, - xpub: AccountXPub, + op: &mut DbOp<'_>, + mut xpub: AccountXPub, ) -> Result<(), XPubError> { - if xpub.events.is_dirty() { - EntityEvents::::persist( - "bria_xpub_events", - tx, - xpub.events.new_serialized_events(xpub.db_uuid), - ) - .await?; + if xpub.events.any_new() { + self.persist_events(op, &mut xpub.events).await?; } - if let Some((cypher, nonce)) = xpub.encrypted_signer_config { let cypher_bytes = &cypher.0; let nonce_bytes = &nonce.0; - sqlx::query!( r#" INSERT INTO bria_xpub_signer_configs (id, cypher, nonce, created_at, modified_at) VALUES ($1, $2, $3, NOW(), NOW()) - ON CONFLICT (id) DO UPDATE + ON CONFLICT (id) DO UPDATE SET cypher = $2, nonce = $3, modified_at = NOW() "#, - xpub.db_uuid, + xpub.id as Uuid, cypher_bytes, nonce_bytes, ) - .execute(&mut **tx) + .execute(&mut **op.tx()) .await?; } @@ -94,75 +82,77 @@ impl XPubs { xpub_ref: impl Into, ) -> Result { let xpub_ref = xpub_ref.into(); - let mut tx = self.pool.begin().await?; - let db_uuid = match xpub_ref { - XPubRef::Id(fp) => { - let record = sqlx::query!( - r#"SELECT id FROM bria_xpubs WHERE account_id = $1 AND fingerprint = $2"#, + let mut xpub = match xpub_ref { + XPubRef::Fingerprint(fp) => { + let xpub = es_entity::es_query!( + entity_ty = AccountXPub, + id_ty = Uuid, + "bria", + &self.pool, + r#" + SELECT * + FROM bria_xpubs + WHERE account_id = $1 AND fingerprint = $2"#, Uuid::from(account_id), fp.as_bytes() ) - .fetch_one(&mut *tx) + .fetch_one() .await?; - record.id + xpub } XPubRef::Name(name) => { - let record = sqlx::query!( - r#"SELECT id FROM bria_xpubs WHERE account_id = $1 AND name = $2"#, + let xpub = es_entity::es_query!( + entity_ty = AccountXPub, + id_ty = Uuid, + "bria", + &self.pool, + r#" + SELECT * + FROM bria_xpubs + WHERE account_id = $1 AND name = $2"#, Uuid::from(account_id), name ) - .fetch_one(&mut *tx) + .fetch_one() .await?; - record.id + xpub } }; - let rows = sqlx::query!( - r#"SELECT sequence, event_type, event FROM bria_xpub_events - WHERE id = $1 - ORDER BY sequence"#, - db_uuid - ) - .fetch_all(&mut *tx) - .await?; - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - let config_row = sqlx::query!( r#" SELECT cypher, nonce FROM bria_xpub_signer_configs WHERE id = $1 "#, - db_uuid + xpub.id as Uuid, ) .fetch_optional(&self.pool) .await?; - let config = match config_row { - Some(row) => Some((ConfigCyper(row.cypher), Nonce(row.nonce))), - None => None, + match config_row { + Some(row) => { + xpub.encrypted_signer_config = Some((ConfigCyper(row.cypher), Nonce(row.nonce))) + } + None => xpub.encrypted_signer_config = None, }; - Ok(AccountXPub::try_from((events, config))?) + Ok(xpub) } pub async fn list_xpubs(&self, account_id: AccountId) -> Result, XPubError> { - let rows = sqlx::query!( - r#"SELECT b.*, e.sequence, e.event - FROM bria_xpubs b - JOIN bria_xpub_events e ON b.id = e.id - WHERE account_id = $1 - ORDER BY b.id, e.sequence"#, - account_id as AccountId, - ) - .fetch_all(&self.pool) - .await?; + let mut xpubs = vec![]; + let mut next = Some(PaginatedQueryArgs::default()); + while let Some(query) = next.take() { + let mut paginated_xpub = self + .list_for_account_id_by_id(account_id, query, es_entity::ListDirection::Ascending) + .await?; - let ids: Vec = rows.iter().map(|row| row.id).collect(); + xpubs.append(&mut paginated_xpub.entities); + next = paginated_xpub.into_next_query(); + } + + let ids: Vec = xpubs.iter().map(|row| row.id).collect(); let config_rows = sqlx::query!( r#" @@ -180,32 +170,27 @@ impl XPubs { .map(|row| (row.id, (ConfigCyper(row.cypher), Nonce(row.nonce)))) .collect(); - let mut entity_events = HashMap::new(); - for row in rows { - let id = row.id; - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } - - let mut xpubs = Vec::new(); - for (id, events) in entity_events { - let config = config_map.remove(&id); - let xpub = AccountXPub::try_from((events, config))?; - xpubs.push(xpub); + for xpub in &mut xpubs { + if let Some(config) = config_map.remove(&xpub.id) { + xpub.encrypted_signer_config = Some(config); + } else { + xpub.encrypted_signer_config = None; + } } Ok(xpubs) } pub async fn list_all_xpubs(&self) -> Result, XPubError> { - let rows = sqlx::query!( - r#"SELECT b.*, e.sequence, e.event - FROM bria_xpubs b - JOIN bria_xpub_events e ON b.id = e.id - ORDER BY b.id, e.sequence"#, - ) - .fetch_all(&self.pool) - .await?; + let mut xpubs = vec![]; + let mut next = Some(PaginatedQueryArgs::default()); + while let Some(query) = next.take() { + let mut paginated_xpub = self + .list_by_id(query, es_entity::ListDirection::default()) + .await?; + xpubs.append(&mut paginated_xpub.entities); + next = paginated_xpub.into_next_query(); + } let config_rows = sqlx::query!( r#" SELECT id, cypher, nonce @@ -219,19 +204,12 @@ impl XPubs { .into_iter() .map(|row| (row.id, (ConfigCyper(row.cypher), Nonce(row.nonce)))) .collect(); - - let mut entity_events = HashMap::new(); - for row in rows { - let id = row.id; - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } - - let mut xpubs = Vec::new(); - for (id, events) in entity_events { - let config = config_map.remove(&id); - let xpub = AccountXPub::try_from((events, config))?; - xpubs.push(xpub); + for xpub in &mut xpubs { + if let Some(config) = config_map.remove(&xpub.id) { + xpub.encrypted_signer_config = Some(config); + } else { + xpub.encrypted_signer_config = None; + } } Ok(xpubs) diff --git a/src/xpub/value.rs b/src/xpub/value.rs index ea690169..a1b01c02 100644 --- a/src/xpub/value.rs +++ b/src/xpub/value.rs @@ -5,7 +5,7 @@ use std::fmt; use super::error::XPubError; use crate::primitives::{ bitcoin::{DerivationPath, ExtendedPubKey}, - XPubId, + XPubFingerprint, }; #[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)] @@ -15,8 +15,8 @@ pub struct XPub { } impl XPub { - pub fn id(&self) -> XPubId { - XPubId::from(self.inner.fingerprint()) + pub fn fingerprint(&self) -> XPubFingerprint { + XPubFingerprint::from(self.inner.fingerprint()) } pub fn inner(&self) -> &ExtendedPubKey { diff --git a/tests/payout.rs b/tests/payout.rs index 56e8b922..d635293e 100644 --- a/tests/payout.rs +++ b/tests/payout.rs @@ -20,7 +20,7 @@ async fn payout() -> anyhow::Result<()> { let repo = XPubs::new(&pool); let id = repo - .persist( + .create( NewAccountXPub::builder() .account_id(profile.account_id) .original(original.to_owned()) @@ -29,7 +29,8 @@ async fn payout() -> anyhow::Result<()> { .build() .unwrap(), ) - .await?; + .await? + .fingerprint(); let app = App::run(pool, AppConfig::default()).await?; app.create_wpkh_wallet(&profile, wallet_name.clone(), id.to_string(), None) @@ -67,7 +68,7 @@ async fn spending_policy() -> anyhow::Result<()> { let repo = XPubs::new(&pool); let id = repo - .persist( + .create( NewAccountXPub::builder() .account_id(profile.account_id) .original(original.to_owned()) @@ -76,7 +77,8 @@ async fn spending_policy() -> anyhow::Result<()> { .build() .unwrap(), ) - .await?; + .await? + .fingerprint(); let app = App::run(pool, AppConfig::default()).await?; app.create_wpkh_wallet(&profile, wallet_name.clone(), id.to_string(), None) diff --git a/tests/wallet.rs b/tests/wallet.rs index b7055e42..4f7f277a 100644 --- a/tests/wallet.rs +++ b/tests/wallet.rs @@ -17,7 +17,7 @@ async fn create_wpkh_wallet() -> anyhow::Result<()> { let repo = XPubs::new(&pool); let id = repo - .persist( + .create( NewAccountXPub::builder() .account_id(profile.account_id) .original(original.to_owned()) @@ -26,8 +26,8 @@ async fn create_wpkh_wallet() -> anyhow::Result<()> { .build() .unwrap(), ) - .await?; - + .await? + .fingerprint(); let app = App::run(pool, AppConfig::default()).await?; app.create_wpkh_wallet(&profile, name.clone(), id.to_string(), None) .await?; @@ -58,10 +58,10 @@ async fn create_descriptors_wallet() -> anyhow::Result<()> { let internal = "wpkh([1ff51810/84'/0'/0']tpubDDdzmt7vndmNywiVAeBPuhYLTFa7hmtfaqUxxTv5iLy7bxU93B62M9WKFSmn1BEN2vte8GDD3SUNKbupRajFW4RK8hd3i6W15pvTRQfo1fK/1/*)#3nxmc294".to_owned(); let app = App::run(pool, AppConfig::default()).await?; let wallet_name = "test_import_descriptor".to_owned(); - let (_, xpub_ids) = app + let (_, xpub_fingerprints) = app .create_descriptors_wallet(&profile, wallet_name, external, internal) .await?; - assert_eq!(xpub_ids.len(), 1); - assert_eq!(xpub_ids[0].to_string(), "2f18f2f7"); + assert_eq!(xpub_fingerprints.len(), 1); + assert_eq!(xpub_fingerprints[0].to_string(), "2f18f2f7"); Ok(()) } diff --git a/tests/xpub.rs b/tests/xpub.rs index 548c16bf..d8be64bb 100644 --- a/tests/xpub.rs +++ b/tests/xpub.rs @@ -12,7 +12,7 @@ async fn test_xpub() -> anyhow::Result<()> { let xpub = XPub::try_from((original, Some("m/84'/0'/0'"))).unwrap(); let repo = XPubs::new(&pool); let _ = repo - .persist( + .create( NewAccountXPub::builder() .account_id(profile.account_id) .original(original.to_owned()) From c263c0381d71fe90250f529cbef04e21a13bd18e Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 30 Jun 2025 19:47:26 +0530 Subject: [PATCH 24/65] chore: remove unnecessary derive macros from entities (#637) --- src/payout_queue/entity.rs | 2 +- src/profile/entity.rs | 2 +- src/profile/repo.rs | 2 +- src/xpub/repo.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/payout_queue/entity.rs b/src/payout_queue/entity.rs index 1276cbdd..e29d1107 100644 --- a/src/payout_queue/entity.rs +++ b/src/payout_queue/entity.rs @@ -8,7 +8,7 @@ use crate::primitives::*; use super::config::*; -#[derive(EsEvent, Debug, Clone, Serialize, Deserialize)] +#[derive(EsEvent, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] #[es_event(id = "PayoutQueueId")] pub enum PayoutQueueEvent { diff --git a/src/profile/entity.rs b/src/profile/entity.rs index ae861c02..fc8ffdb5 100644 --- a/src/profile/entity.rs +++ b/src/profile/entity.rs @@ -4,7 +4,7 @@ use serde::{Deserialize, Serialize}; use crate::primitives::*; -#[derive(EsEvent, Debug, Clone, Serialize, Deserialize)] +#[derive(EsEvent, Debug, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] #[es_event(id = "ProfileId")] pub enum ProfileEvent { diff --git a/src/profile/repo.rs b/src/profile/repo.rs index 6c9779d9..c5a40996 100644 --- a/src/profile/repo.rs +++ b/src/profile/repo.rs @@ -6,7 +6,7 @@ use uuid::Uuid; use super::{entity::*, error::ProfileError}; use crate::{dev_constants, primitives::*}; -#[derive(EsRepo, Clone, Debug)] +#[derive(EsRepo)] #[es_repo( entity = "Profile", err = "ProfileError", diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index 3be9df67..4d3489a9 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -7,7 +7,7 @@ use uuid::Uuid; use super::{entity::*, error::XPubError, reference::*, signer_config::*}; use crate::primitives::*; -#[derive(EsRepo, Clone, Debug)] +#[derive(EsRepo, Clone)] #[es_repo( entity = "AccountXPub", event = "XPubEvent", From e56c164c6b634fa0623d36b2e136f29a43d39e7a Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 7 Jul 2025 19:10:07 +0530 Subject: [PATCH 25/65] refactor: use es_entity for signing session entity (#636) * refactor: update repo fns using es_entity * chore: correct format * fix: add created_at col to signing_sessions tbl * fix: add await for async call * chore: run sqlx prepare * chore: clean up formatting in signing session * chore: remove unnecessary check and comment * chore: remove redundant check * chore: remove redundant statements --------- Co-authored-by: Vaibhav --- ...7d9ba61daab26eb542bab02f8be7495de4cb8.json | 41 +++++ ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 -- ...ab1e304568264e004dec9b8b8cc306dfaee66.json | 82 ---------- ...d8073c86dc835144a2f047a00224499f50021.json | 18 +++ ...cc701fb921c90e6ab3fd076cfec19a05dcb2c.json | 40 +++++ ...9b808c5810b493044a8097e20fcd9de0f17d1.json | 59 ------- ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 ----- ...ab55c64b7249309d6f23fba6b2d0c4c8dd278.json | 40 +++++ ...b3dd649758b5afcf70feb2a6eff7d69925bfc.json | 20 --- ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 ------ ...998f24a0dbadfed25d6d036f900b8c08423af.json | 42 +++++ ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 ------ ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 ------------------ ...3e5cc1946454643c6b5c883393ff712bd4824.json | 40 +++++ ...5f403d6ca6274a0d7816a8a2979943159c062.json | 82 ---------- ...ba25755874dcd529542e64ddf7ff141c38b58.json | 22 --- ...68377a5773bcb133f94dbbd173f0f1c09e35f.json | 18 +++ ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 -------------- ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 ----------------- ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 ------- ...7a649a532533b20fce7d6911164fe5409dd77.json | 40 +++++ ...fa3a4f1df8e71d1459e7889c5cc2450cec803.json | 82 ---------- ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 ----- ...fbbde60f9a814beb6a97a38fcd295895f7e1f.json | 43 +++++ ...e194eb21ceb26bba478a92aaa0dcfc36418bf.json | 42 +++++ ...485baf1435b1306562058c570ad5acc277d42.json | 22 --- ...d1e23b087e742f039a1b2b3375ffd537a60f9.json | 18 +++ ...6025d7576b2db0921babc0ba5e9f894c777fc.json | 40 +++++ ...fb66526029dc0651c9058847582d99c66397d.json | 41 +++++ ...dd_created_at_to_signing_sessions.down.sql | 1 + ..._add_created_at_to_signing_sessions.up.sql | 12 ++ src/api/server/convert.rs | 2 +- src/app/mod.rs | 10 +- src/job/batch_signing.rs | 8 +- src/primitives/mod.rs | 3 +- src/signing_session/entity.rs | 49 +++--- src/signing_session/error.rs | 7 +- src/signing_session/repo.rs | 143 +++++++++-------- 38 files changed, 587 insertions(+), 1144 deletions(-) create mode 100644 .sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json delete mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json delete mode 100644 .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json create mode 100644 .sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json create mode 100644 .sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json delete mode 100644 .sqlx/query-5df3e700d6abe2e53d1f282e4e29b808c5810b493044a8097e20fcd9de0f17d1.json delete mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json create mode 100644 .sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json delete mode 100644 .sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json delete mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json create mode 100644 .sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json delete mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json delete mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json create mode 100644 .sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json delete mode 100644 .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json delete mode 100644 .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json create mode 100644 .sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json delete mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json delete mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json delete mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json create mode 100644 .sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json delete mode 100644 .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json delete mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json create mode 100644 .sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json create mode 100644 .sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json delete mode 100644 .sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json create mode 100644 .sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json create mode 100644 .sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json create mode 100644 .sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json create mode 100644 migrations/20250701103237_add_created_at_to_signing_sessions.down.sql create mode 100644 migrations/20250701103237_add_created_at_to_signing_sessions.up.sql diff --git a/.sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json b/.sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json new file mode 100644 index 00000000..35f255e7 --- /dev/null +++ b/.sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8" +} diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json deleted file mode 100644 index 33a94981..00000000 --- a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Jsonb" - ] - }, - "nullable": [] - }, - "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" -} diff --git a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json deleted file mode 100644 index 301c5cc3..00000000 --- a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" -} diff --git a/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json b/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json new file mode 100644 index 00000000..3888952d --- /dev/null +++ b/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_signing_session_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021" +} diff --git a/.sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json b/.sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json new file mode 100644 index 00000000..1efb8c6e --- /dev/null +++ b/.sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE xpub_fingerprint = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Bytea" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c" +} diff --git a/.sqlx/query-5df3e700d6abe2e53d1f282e4e29b808c5810b493044a8097e20fcd9de0f17d1.json b/.sqlx/query-5df3e700d6abe2e53d1f282e4e29b808c5810b493044a8097e20fcd9de0f17d1.json deleted file mode 100644 index e11f8d6d..00000000 --- a/.sqlx/query-5df3e700d6abe2e53d1f282e4e29b808c5810b493044a8097e20fcd9de0f17d1.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event_type, e.event\n FROM bria_signing_sessions b\n JOIN bria_signing_session_events e ON b.id = e.id\n WHERE account_id = $1 AND batch_id = $2\n ORDER BY b.id, sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "batch_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "xpub_fingerprint", - "type_info": "Bytea" - }, - { - "ordinal": 4, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 5, - "name": "event_type", - "type_info": "Varchar" - }, - { - "ordinal": 6, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "5df3e700d6abe2e53d1f282e4e29b808c5810b493044a8097e20fcd9de0f17d1" -} diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json deleted file mode 100644 index 105bf98b..00000000 --- a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - "Jsonb", - "Jsonb", - "Jsonb", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" -} diff --git a/.sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json b/.sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json new file mode 100644 index 00000000..b176020c --- /dev/null +++ b/.sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278" +} diff --git a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json deleted file mode 100644 index 60f58c60..00000000 --- a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT NOW()", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "now", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null - ] - }, - "hash": "6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc" -} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json deleted file mode 100644 index 074622c1..00000000 --- a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - } - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" -} diff --git a/.sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json b/.sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json new file mode 100644 index 00000000..89681696 --- /dev/null +++ b/.sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af" +} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json deleted file mode 100644 index 7857e9f9..00000000 --- a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "code", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "params", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "tx_input", - "type_info": "Jsonb" - }, - { - "ordinal": 4, - "name": "entries", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - true, - false, - false - ] - }, - "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" -} diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json deleted file mode 100644 index 3c7819b4..00000000 --- a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" -} diff --git a/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json b/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json new file mode 100644 index 00000000..ad12e39a --- /dev/null +++ b/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.id AS \"id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM bria_signing_sessions i JOIN bria_signing_session_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824" +} diff --git a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json deleted file mode 100644 index 00d0da2e..00000000 --- a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" -} diff --git a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json deleted file mode 100644 index f856a851..00000000 --- a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false - ] - }, - "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" -} diff --git a/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json b/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json new file mode 100644 index 00000000..c8984803 --- /dev/null +++ b/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_signing_session_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f" +} diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json deleted file mode 100644 index b95d0aed..00000000 --- a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "transaction_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "entry_type", - "type_info": "Varchar" - }, - { - "ordinal": 6, - "name": "layer: Layer", - "type_info": { - "Custom": { - "name": "layer", - "kind": { - "Enum": [ - "settled", - "pending", - "encumbered" - ] - } - } - } - }, - { - "ordinal": 7, - "name": "units", - "type_info": "Numeric" - }, - { - "ordinal": 8, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 9, - "name": "direction: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 10, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 11, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 12, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - false, - false - ] - }, - "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" -} diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json deleted file mode 100644 index 92db28c8..00000000 --- a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" -} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json deleted file mode 100644 index 90bef3da..00000000 --- a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - }, - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - }, - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" -} diff --git a/.sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json b/.sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json new file mode 100644 index 00000000..63608c6c --- /dev/null +++ b/.sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE account_id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77" +} diff --git a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json deleted file mode 100644 index 18d9c9b6..00000000 --- a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "TextArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" -} diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json deleted file mode 100644 index 8de91f27..00000000 --- a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Uuid", - "Date", - "Uuid", - "Varchar", - "Varchar", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" -} diff --git a/.sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json b/.sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json new file mode 100644 index 00000000..eed89201 --- /dev/null +++ b/.sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_signing_sessions\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f" +} diff --git a/.sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json b/.sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json new file mode 100644 index 00000000..f49837a4 --- /dev/null +++ b/.sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf" +} diff --git a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json deleted file mode 100644 index 50c0e05c..00000000 --- a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "payload!", - "type_info": "Json" - } - ], - "parameters": { - "Left": [ - "Int8" - ] - }, - "nullable": [ - null - ] - }, - "hash": "e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42" -} diff --git a/.sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json b/.sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json new file mode 100644 index 00000000..772620b1 --- /dev/null +++ b/.sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_signing_sessions (id, batch_id, account_id, xpub_fingerprint, created_at) VALUES ($1, $2, $3, $4, $5)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Bytea", + "Timestamptz" + ] + }, + "nullable": [] + }, + "hash": "eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9" +} diff --git a/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json b/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json new file mode 100644 index 00000000..9c26aa46 --- /dev/null +++ b/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE batch_id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc" +} diff --git a/.sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json b/.sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json new file mode 100644 index 00000000..dfaf8541 --- /dev/null +++ b/.sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: SigningSessionId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d" +} diff --git a/migrations/20250701103237_add_created_at_to_signing_sessions.down.sql b/migrations/20250701103237_add_created_at_to_signing_sessions.down.sql new file mode 100644 index 00000000..c6619173 --- /dev/null +++ b/migrations/20250701103237_add_created_at_to_signing_sessions.down.sql @@ -0,0 +1 @@ +ALTER TABLE bria_signing_sessions DROP COLUMN created_at; diff --git a/migrations/20250701103237_add_created_at_to_signing_sessions.up.sql b/migrations/20250701103237_add_created_at_to_signing_sessions.up.sql new file mode 100644 index 00000000..a4fa02da --- /dev/null +++ b/migrations/20250701103237_add_created_at_to_signing_sessions.up.sql @@ -0,0 +1,12 @@ +ALTER TABLE bria_signing_sessions ADD COLUMN created_at TIMESTAMPTZ; + +UPDATE bria_signing_sessions +SET created_at =( + SELECT MIN(recorded_at) + FROM bria_signing_session_events + WHERE bria_signing_session_events.id = bria_signing_sessions.id +); + +ALTER TABLE bria_signing_sessions +ALTER COLUMN created_at SET NOT NULL, +ALTER COLUMN created_at SET DEFAULT NOW(); diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index 64b07a65..e2ae2c99 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -275,7 +275,7 @@ impl From for proto::SigningSession { proto::SigningSession { id: session.id.to_string(), batch_id: session.batch_id.to_string(), - xpub_id: session.xpub_id.to_string(), + xpub_id: session.xpub_fingerprint.to_string(), failure_reason: session.failure_reason().map(|r| r.to_string()), state: format!("{:?}", session.state()), } diff --git a/src/app/mod.rs b/src/app/mod.rs index ed6ff156..43c1e3f0 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -306,12 +306,16 @@ impl App { ApplicationError::SigningSessionNotFoundForXPubFingerprint(xpub_fingerprint) })?; - let mut tx = self.pool.begin().await?; + let mut db = self.signing_sessions.begin_op().await?; session.submit_externally_signed_psbt(signed_psbt); self.signing_sessions - .update_sessions(&mut tx, &sessions) + .update_sessions(&mut db, &sessions) .await?; - job::spawn_all_batch_signings(tx, std::iter::once((profile.account_id, batch_id))).await?; + job::spawn_all_batch_signings( + db.into_tx(), + std::iter::once((profile.account_id, batch_id)), + ) + .await?; Ok(()) } diff --git a/src/job/batch_signing.rs b/src/job/batch_signing.rs index fc898e51..031a9181 100644 --- a/src/job/batch_signing.rs +++ b/src/job/batch_signing.rs @@ -69,7 +69,7 @@ pub async fn execute( let new_session = NewSigningSession::builder() .account_id(data.account_id) .batch_id(data.batch_id) - .xpub_id(xpub.fingerprint()) + .xpub_fingerprint(xpub.fingerprint()) .unsigned_psbt(unsigned_psbt.clone()) .build() .expect("Could not build signing session"); @@ -130,9 +130,9 @@ pub async fn execute( } if any_updated { - let mut tx = pool.begin().await?; - signing_sessions.update_sessions(&mut tx, &sessions).await?; - tx.commit().await?; + let mut db = signing_sessions.begin_op().await?; + signing_sessions.update_sessions(&mut db, &sessions).await?; + db.commit().await?; } let mut sessions = sessions.into_values(); diff --git a/src/primitives/mod.rs b/src/primitives/mod.rs index 55b9dbeb..defe8c11 100644 --- a/src/primitives/mod.rs +++ b/src/primitives/mod.rs @@ -21,9 +21,8 @@ impl From for LedgerJournalId { Self::from(uuid::Uuid::from(id)) } } -es_entity::entity_id! { ProfileId, PayoutQueueId, WalletId } +es_entity::entity_id! { ProfileId, PayoutQueueId, WalletId, SigningSessionId } crate::entity_id! { ProfileApiKeyId } -crate::entity_id! { SigningSessionId } crate::entity_id! { KeychainId } crate::entity_id! { SignerId } crate::entity_id! { PayoutId } diff --git a/src/signing_session/entity.rs b/src/signing_session/entity.rs index a946f9f1..94eca968 100644 --- a/src/signing_session/entity.rs +++ b/src/signing_session/entity.rs @@ -1,17 +1,18 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; use thiserror::Error; use std::collections::HashMap; use crate::{ - entity::*, primitives::{bitcoin::psbt, *}, xpub::SigningClientError, }; -#[derive(Debug, Serialize, Deserialize)] +#[derive(EsEvent, Debug, Serialize, Deserialize, Clone)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "SigningSessionId")] pub enum SigningSessionEvent { Initialized { id: SigningSessionId, @@ -38,13 +39,13 @@ pub enum SigningSessionState { Complete, } -#[derive(Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct SigningSession { pub id: SigningSessionId, pub account_id: AccountId, pub batch_id: BatchId, - pub xpub_id: XPubFingerprint, + pub xpub_fingerprint: XPubFingerprint, pub unsigned_psbt: psbt::PartiallySignedTransaction, pub(super) events: EntityEvents, } @@ -72,7 +73,7 @@ impl SigningSession { pub fn signed_psbt(&self) -> Option<&psbt::PartiallySignedTransaction> { let mut ret = None; - for event in self.events.iter() { + for event in self.events.iter_all() { match event { SigningSessionEvent::RemoteSigningCompleted { signed_psbt } | SigningSessionEvent::ExternallySignedPsbtSubmitted { signed_psbt } => { @@ -86,15 +87,10 @@ impl SigningSession { pub fn failure_reason(&self) -> Option<&SigningFailureReason> { let mut ret = None; - for event in self.events.iter() { - if let SigningSessionEvent::SigningAttemptFailed { reason } = event { - ret = Some(reason); - } + for event in self.events.iter_all() { ret = match event { SigningSessionEvent::SigningAttemptFailed { reason } => Some(reason), - SigningSessionEvent::RemoteSigningCompleted { .. } => None, - SigningSessionEvent::ExternallySignedPsbtSubmitted { .. } => None, - _ => ret, + _ => None, }; } ret @@ -102,7 +98,7 @@ impl SigningSession { pub fn state(&self) -> SigningSessionState { let mut ret = SigningSessionState::Initialized; - for event in self.events.iter() { + for event in self.events.iter_all() { ret = match event { SigningSessionEvent::SigningAttemptFailed { .. } => SigningSessionState::Failed, SigningSessionEvent::RemoteSigningCompleted { .. } => SigningSessionState::Complete, @@ -116,7 +112,7 @@ impl SigningSession { } } -#[derive(Error, Debug, Serialize, Deserialize)] +#[derive(Error, Debug, Serialize, Deserialize, Clone)] #[serde(rename_all = "snake_case")] pub enum SigningFailureReason { #[error("SignerConfigMissing")] @@ -143,7 +139,7 @@ pub struct NewSigningSession { pub(super) id: SigningSessionId, pub(super) account_id: AccountId, pub(super) batch_id: BatchId, - pub(super) xpub_id: XPubFingerprint, + pub(super) xpub_fingerprint: XPubFingerprint, unsigned_psbt: psbt::PartiallySignedTransaction, } @@ -153,24 +149,25 @@ impl NewSigningSession { builder.id(SigningSessionId::new()); builder } +} - pub(super) fn initial_events(self) -> EntityEvents { - EntityEvents::init([SigningSessionEvent::Initialized { +impl IntoEvents for NewSigningSession { + fn into_events(self) -> EntityEvents { + let events = vec![SigningSessionEvent::Initialized { id: self.id, account_id: self.account_id, batch_id: self.batch_id, - xpub_id: self.xpub_id, + xpub_id: self.xpub_fingerprint, unsigned_psbt: self.unsigned_psbt, - }]) + }]; + EntityEvents::init(self.id, events) } } -impl TryFrom> for SigningSession { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { +impl TryFromEvents for SigningSession { + fn try_from_events(events: EntityEvents) -> Result { let mut builder = SigningSessionBuilder::default(); - for event in events.iter() { + for event in events.iter_all() { if let SigningSessionEvent::Initialized { id, account_id, @@ -183,7 +180,7 @@ impl TryFrom> for SigningSession { .id(*id) .account_id(*account_id) .batch_id(*batch_id) - .xpub_id(*xpub_id) + .xpub_fingerprint(*xpub_id) .unsigned_psbt(unsigned_psbt.clone()); } } diff --git a/src/signing_session/error.rs b/src/signing_session/error.rs index 8ba9ca44..f130bb96 100644 --- a/src/signing_session/error.rs +++ b/src/signing_session/error.rs @@ -4,6 +4,9 @@ use thiserror::Error; pub enum SigningSessionError { #[error("SigningSessionError - Sqlx: {0}")] Sqlx(#[from] sqlx::Error), - #[error("SigningSessionError - EntityError: {0}")] - EntityError(#[from] crate::entity::EntityError), + #[error("SigningSessionError - EsEntityError: {0})")] + EsEntityError(es_entity::EsEntityError), + #[error("SigningSessionError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), } +es_entity::from_es_entity_error!(SigningSessionError); diff --git a/src/signing_session/repo.rs b/src/signing_session/repo.rs index 15fee7ee..5ea58fd6 100644 --- a/src/signing_session/repo.rs +++ b/src/signing_session/repo.rs @@ -1,12 +1,22 @@ -use sqlx::{Pool, Postgres, QueryBuilder, Transaction}; +use es_entity::*; +use sqlx::{Pool, Postgres, Transaction}; use uuid::Uuid; -use std::collections::HashMap; - use super::{entity::*, error::SigningSessionError}; -use crate::{entity::EntityEvents, primitives::*}; +use crate::primitives::*; +use std::collections::HashMap; -#[derive(Clone)] +#[derive(EsRepo, Clone)] +#[es_repo( + entity = "SigningSession", + err = "SigningSessionError", + columns( + batch_id(ty = "BatchId", update(persist = false)), + account_id(ty = "AccountId", update(persist = false)), + xpub_fingerprint(ty = "XPubFingerprint", update(persist = false)) + ), + tbl_prefix = "bria" +)] pub struct SigningSessions { pool: Pool, } @@ -20,61 +30,26 @@ impl SigningSessions { &self, sessions: HashMap, ) -> Result { - let mut tx = self.pool.begin().await?; - let mut query_builder: QueryBuilder = QueryBuilder::new( - r#"INSERT INTO bria_signing_sessions - (id, account_id, batch_id, xpub_fingerprint)"#, - ); - let mut account_id = None; - let mut batch_id = None; - query_builder.push_values( - sessions.iter(), - |mut builder, (xpub_fingerprint, session)| { - if account_id.is_none() && batch_id.is_none() { - account_id = Some(session.account_id); - batch_id = Some(session.batch_id); - } - builder.push_bind(Uuid::from(session.id)); - builder.push_bind(Uuid::from(session.account_id)); - builder.push_bind(Uuid::from(session.batch_id)); - builder.push_bind(xpub_fingerprint.as_bytes().to_owned()); - }, - ); - let query = query_builder.build(); - query.execute(&mut *tx).await?; - EntityEvents::::persist( - "bria_signing_session_events", - &mut tx, - sessions.into_values().flat_map(|session| { - let id = session.id; - session.initial_events().into_new_serialized_events(id) - }), - ) - .await?; - tx.commit().await?; - if let (Some(account_id), Some(batch_id)) = (account_id, batch_id) { - Ok(self - .list_for_batch(account_id, batch_id) - .await? - .expect("New session not found")) - } else { - unreachable!() + let signing_sessions = self.create_all(sessions.into_values().collect()).await?; + + let mut xpub_sessions = HashMap::new(); + for session in signing_sessions { + xpub_sessions.insert(session.xpub_fingerprint, session); } + + Ok(BatchSigningSession { xpub_sessions }) } pub async fn update_sessions( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut DbOp<'_>, sessions: &HashMap, ) -> Result<(), SigningSessionError> { - EntityEvents::::persist( - "bria_signing_session_events", - tx, - sessions - .values() - .flat_map(|session| session.events.new_serialized_events(session.id)), - ) - .await?; + let mut events: Vec> = sessions + .values() + .map(|session| session.events.clone()) + .collect(); + self.persist_events_batch(op, &mut events).await?; Ok(()) } @@ -83,31 +58,53 @@ impl SigningSessions { account_id: AccountId, batch_id: BatchId, ) -> Result, SigningSessionError> { - let entity_events = { - let rows = sqlx::query!( + let mut signing_sessions = Vec::new(); + let mut query = es_entity::PaginatedQueryArgs::< + signing_session_cursor::SigningSessionsByCreatedAtCursor, + > { + first: Default::default(), + after: None, + }; + + loop { + let es_entity::PaginatedQueryArgs { first, after } = query; + let (id, created_at) = if let Some(after) = after { + (Some(after.id), Some(after.created_at)) + } else { + (None, None) + }; + + let (entities, has_next_page) = es_entity::es_query!( + "bria", + &self.pool, r#" - SELECT b.*, e.sequence, e.event_type, e.event - FROM bria_signing_sessions b - JOIN bria_signing_session_events e ON b.id = e.id - WHERE account_id = $1 AND batch_id = $2 - ORDER BY b.id, sequence"#, - Uuid::from(account_id), - Uuid::from(batch_id) + SELECT * + FROM bria_signing_sessions + WHERE account_id = $1 AND batch_id = $2 + AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL)) + ORDER BY created_at, id"#, + account_id as AccountId, + batch_id as BatchId, + id as Option, + created_at as Option>, ) - .fetch_all(&self.pool) + .fetch_n(first) .await?; - let mut entity_events = HashMap::new(); - for row in rows { - let id = SigningSessionId::from(row.id); - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; + + signing_sessions.extend(entities); + + if !has_next_page { + break; } - entity_events - }; + let end_cursor = signing_sessions + .last() + .map(signing_session_cursor::SigningSessionsByCreatedAtCursor::from); + + query.after = end_cursor; + } let mut xpub_sessions = HashMap::new(); - for (_, events) in entity_events { - let session = SigningSession::try_from(events)?; - xpub_sessions.insert(session.xpub_id, session); + for session in signing_sessions { + xpub_sessions.insert(session.xpub_fingerprint, session); } if xpub_sessions.is_empty() { Ok(None) From d2f402a2b6fa460c24788499f6bd671ab4cadeca Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Wed, 9 Jul 2025 19:54:28 +0530 Subject: [PATCH 26/65] chore: remove empty files, unnecessary check and update repo (#641) * chore: delete empty file * chore: remove unnecessary check and update repo * chore: remove comment and rename persist_updated->update_signer_config --- src/app/mod.rs | 4 ++-- src/xpub/repo.rs | 11 ++++------- src/xpub/signer.rs | 0 3 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 src/xpub/signer.rs diff --git a/src/app/mod.rs b/src/app/mod.rs index 43c1e3f0..ad11f0cc 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -230,7 +230,7 @@ impl App { .await?; let xpub_fingerprint = xpub.fingerprint(); xpub.set_signer_config(config, &self.config.signer_encryption.key)?; - self.xpubs.persist_updated(&mut db, xpub).await?; + self.xpubs.update_signer_config(&mut db, xpub).await?; let batch_ids = self .signing_sessions .list_batch_ids_for(db.tx(), profile.account_id, xpub_fingerprint) @@ -264,7 +264,7 @@ impl App { for mut xpub in xpubs { if let Some(signing_cfg) = xpub.signing_cfg(deprecated_key) { xpub.set_signer_config(signing_cfg, &self.config.signer_encryption.key)?; - self.xpubs.persist_updated(&mut db, xpub).await?; + self.xpubs.update_signer_config(&mut db, xpub).await?; } } db.commit().await?; diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index 4d3489a9..2b789e72 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -16,7 +16,7 @@ use crate::primitives::*; tbl = "bria_xpubs", events_tbl = "bria_xpub_events", columns( - account_id(ty = "AccountId", list_for), + account_id(ty = "AccountId", list_for, update(persist = false)), name(ty = "String", update(persist=false), create(accessor=key_name())), fingerprint(ty = "XPubFingerprint", create(accessor=fingerprint()), update(persist = false)) ), @@ -47,14 +47,11 @@ impl XPubs { Self { pool: pool.clone() } } - pub async fn persist_updated( + pub async fn update_signer_config( &self, op: &mut DbOp<'_>, - mut xpub: AccountXPub, + xpub: AccountXPub, ) -> Result<(), XPubError> { - if xpub.events.any_new() { - self.persist_events(op, &mut xpub.events).await?; - } if let Some((cypher, nonce)) = xpub.encrypted_signer_config { let cypher_bytes = &cypher.0; let nonce_bytes = &nonce.0; @@ -152,7 +149,7 @@ impl XPubs { next = paginated_xpub.into_next_query(); } - let ids: Vec = xpubs.iter().map(|row| row.id).collect(); + let ids: Vec = xpubs.iter().map(|xpub| xpub.id).collect(); let config_rows = sqlx::query!( r#" diff --git a/src/xpub/signer.rs b/src/xpub/signer.rs deleted file mode 100644 index e69de29b..00000000 From 62b41d4a534494092c6f566e6cafa7af5ac64fc7 Mon Sep 17 00:00:00 2001 From: "galoybot-app[bot]" <139244493+galoybot-app[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 16:01:33 +0530 Subject: [PATCH 27/65] ci(shared): bump vendored ci files (#643) Co-authored-by: CI Bot --- ci/vendir.lock.yml | 8 ++++---- ci/vendir.yml | 4 ++-- ci/vendor/pipeline-fragments.lib.yml | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci/vendir.lock.yml b/ci/vendir.lock.yml index 1bc7bcc2..40d94e92 100644 --- a/ci/vendir.lock.yml +++ b/ci/vendir.lock.yml @@ -2,14 +2,14 @@ apiVersion: vendir.k14s.io/v1alpha1 directories: - contents: - git: - commitTitle: 'chore: remove bats helper sourcing from bats script' - sha: a940bf705505fe507f3a6aded4f3fdcd8138d624 + commitTitle: 'Merge pull request #6 from GaloyMoney/chore--update-cachix-flakes-img...' + sha: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 path: . path: ../.github/workflows/vendor - contents: - git: - commitTitle: 'chore: remove bats helper sourcing from bats script' - sha: a940bf705505fe507f3a6aded4f3fdcd8138d624 + commitTitle: 'Merge pull request #6 from GaloyMoney/chore--update-cachix-flakes-img...' + sha: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 path: . path: vendor kind: LockConfig diff --git a/ci/vendir.yml b/ci/vendir.yml index 0949d282..d81f4ea9 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -8,7 +8,7 @@ directories: - path: . # Copy this folder out to .. git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: a940bf705505fe507f3a6aded4f3fdcd8138d624 + ref: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 includePaths: - shared/actions/* excludePaths: @@ -20,7 +20,7 @@ directories: - path: . git: url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: a940bf705505fe507f3a6aded4f3fdcd8138d624 + ref: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/pipeline-fragments.lib.yml b/ci/vendor/pipeline-fragments.lib.yml index 35750a9c..6be5c646 100644 --- a/ci/vendor/pipeline-fragments.lib.yml +++ b/ci/vendor/pipeline-fragments.lib.yml @@ -48,6 +48,7 @@ source: type: registry-image source: repository: ghcr.io/nix-community/docker-nixpkgs/cachix-flakes + tag: latest-x86_64-linux #@ end #@ def check_code(): From 7ea3436d2ea0a23f13f8ab0665252ec6f6bffb43 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Tue, 15 Jul 2025 23:03:27 +0530 Subject: [PATCH 28/65] fix: handle repo fns which return collections using es_query (#638) * refactor: use es_query instead of post-query validation * fix: use es_query for find_by fns which return a collection and undo find_by_id fns * chore: remove unnecessary typecasting --- ...8a24dead88ad04ef08cb447cf736486ad8aea.json | 41 +++++++++++++++++++ ...5c6a2eccd9f75e08fc89e46ad281d0c867b6c.json | 41 +++++++++++++++++++ ...44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json | 41 +++++++++++++++++++ src/payout_queue/repo.rs | 18 +++++--- src/profile/repo.rs | 17 +++++--- src/wallet/repo.rs | 16 ++++++-- 6 files changed, 159 insertions(+), 15 deletions(-) create mode 100644 .sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json create mode 100644 .sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json create mode 100644 .sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json diff --git a/.sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json b/.sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json new file mode 100644 index 00000000..c673141b --- /dev/null +++ b/.sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_wallets\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: WalletId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea" +} diff --git a/.sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json b/.sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json new file mode 100644 index 00000000..263511cd --- /dev/null +++ b/.sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payout_queues\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutQueueId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c" +} diff --git a/.sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json b/.sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json new file mode 100644 index 00000000..52317b90 --- /dev/null +++ b/.sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_profiles\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: ProfileId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4" +} diff --git a/src/payout_queue/repo.rs b/src/payout_queue/repo.rs index 60a12e5c..8b1c9a73 100644 --- a/src/payout_queue/repo.rs +++ b/src/payout_queue/repo.rs @@ -27,7 +27,6 @@ impl PayoutQueues { id: PayoutQueueId, ) -> Result { let payout_queue = self.find_by_id(id).await?; - if payout_queue.account_id != account_id { return Err(PayoutQueueError::EsEntityError(EsEntityError::NotFound)); } @@ -39,11 +38,18 @@ impl PayoutQueues { account_id: AccountId, name: String, ) -> Result { - let payout_queue = self.find_by_name(name).await?; - - if payout_queue.account_id != account_id { - return Err(PayoutQueueError::EsEntityError(EsEntityError::NotFound)); - } + let payout_queue = es_entity::es_query!( + "bria", + &self.pool, + r#" + SELECT * + FROM bria_payout_queues + WHERE account_id = $1 and name = $2"#, + account_id as AccountId, + name + ) + .fetch_one() + .await?; Ok(payout_queue) } diff --git a/src/profile/repo.rs b/src/profile/repo.rs index c5a40996..ef845762 100644 --- a/src/profile/repo.rs +++ b/src/profile/repo.rs @@ -49,7 +49,6 @@ impl Profiles { id: ProfileId, ) -> Result { let profile = self.find_by_id(id).await?; - if profile.account_id != account_id { return Err(ProfileError::EsEntityError(EsEntityError::NotFound)); } @@ -61,10 +60,18 @@ impl Profiles { account_id: AccountId, name: String, ) -> Result { - let profile = self.find_by_name(name).await?; - if profile.account_id != account_id { - return Err(ProfileError::EsEntityError(EsEntityError::NotFound)); - } + let profile = es_entity::es_query!( + "bria", + &self.pool, + r#" + SELECT * + FROM bria_profiles + WHERE account_id = $1 and name = $2"#, + account_id as AccountId, + name + ) + .fetch_one() + .await?; Ok(profile) } diff --git a/src/wallet/repo.rs b/src/wallet/repo.rs index 4031b529..2a9a44e4 100644 --- a/src/wallet/repo.rs +++ b/src/wallet/repo.rs @@ -59,10 +59,18 @@ impl Wallets { account_id: AccountId, name: String, ) -> Result { - let wallet = self.find_by_name(name).await?; - if wallet.account_id != account_id { - return Err(WalletError::EsEntityError(EsEntityError::NotFound)); - } + let wallet = es_entity::es_query!( + "bria", + &self.pool, + r#" + SELECT * + FROM bria_wallets + WHERE account_id = $1 and name = $2"#, + account_id as AccountId, + name + ) + .fetch_one() + .await?; Ok(wallet) } From 28df79c244adb41027c5e0f1f7eb4d0a96e15f2a Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 21 Jul 2025 15:43:11 +0530 Subject: [PATCH 29/65] refactor: use es_entity for payout (#612) * fix: use entity_id macro from es_entity * fix: payout entity uses es_entity * fix: replaced findby fns from repo * fix: change error conversion * refactor: use es_query macro for sqlx queries * refactor: use es_query for findby fns * refactor: use esquery for repo fns and loop for paginated responses * fix: pass check-code * chore: remove unused query * refactor: use query_as macro to use update locks * chore: remove unnecessary diffs * fix: add missing collumns * chore: add update option in repo * fix: add missing column with accessor * chore: use es_query over sqlx query_as * chore(deps): pin es-entity to main * chore: remove redundant macros * refactor: update repo fns * refactor: use correct format and update repo query * chore: update es_entity version, remove unnecessary diffs * refactor: restore es_entity version and update payout test * chore: fix check-code warning * refactor: remove comment, use typecast for list fn * chore: remove default persist from repo * chore: fix check-code warning * chore: remove unnecessary code * refactor: address pr review * refactor: use fold and reduce lines of code * chore: whitespace and local testing * refactor: add migration script to add account_id in payout event, use direct findby fn * chore: run sqlx prepare * chore: remove list_for * refactor: use was_not_found fn for error, update migration script * chore: run sqlx prepare --------- Co-authored-by: Vaibhav --- ...a1d983764bffc7795ac507aec3d5cb0ec5b3c.json | 42 ++ ...26082a0842e4c39610be8935aead91f58f1ee.json | 41 ++ ...188874e40f19b72ddf6a0884c6e2d98c08708.json | 40 ++ ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 + ...0743ca475921b9bae953e55f954d5dc12a19a.json | 41 ++ ...b1e304568264e004dec9b8b8cc306dfaee66.json} | 39 +- ...acd83c69992d7b9b6021c7e6be1a88b60a8bf.json | 40 ++ ...7cfebbd862dd59c592720e1fd340aeac32ec4.json | 18 + ...48b9e7414153ce614d4d5035a0beb66fde836.json | 43 ++ ...6582000d822c85fade65952ab1e0fa30028a8.json | 18 + ...d6929514880fc0849fe3f491fbf3653e3d270.json | 40 ++ ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 ++ ...b3dd649758b5afcf70feb2a6eff7d69925bfc.json | 20 + ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 +++ ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 +++ ...d7c0a741716334f567da9f0bd7252a8a85fff.json | 79 ---- ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 +++++++ ...f651ae0346f631b2393d5f4e45f9f18c5e20c.json | 77 ---- ...116983265d413065de43dbf1d1e00f483ef3e.json | 40 ++ ...f403d6ca6274a0d7816a8a2979943159c062.json} | 41 +- ...78598dedc44402607aebe5afa7026fa4f0d8b.json | 42 ++ ...ba25755874dcd529542e64ddf7ff141c38b58.json | 22 ++ ...5f165f34f1668283990a5b89bae0362ddd7fe.json | 42 ++ ...1c37ab1187398143ae9fdb54b7d9aa30a65a6.json | 41 ++ ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 ++++++ ...997d0a9335b2121e9dd108461a9d39c0e44b2.json | 41 ++ ...4571ae7f9a953aba799e1ca60ed5285273358.json | 15 + ...e6aa95532db9cf1714814e6f15bfb56ae791f.json | 77 ---- ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 +++++++ ...f4265b599b50f9d269997f76301653dd54ba6.json | 40 ++ ...17f58e2c94c16a48a5483f7496cd13c2a010d.json | 40 ++ ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 +++ ...a3a4f1df8e71d1459e7889c5cc2450cec803.json} | 41 +- ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 ++ ...485baf1435b1306562058c570ad5acc277d42.json | 22 ++ ...e835b4616603051412b695f9c5f88e652598f.json | 40 ++ ...c21894e41766195d55bb018f93d5180d51db4.json | 40 ++ ...4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json | 43 ++ ...25c5faefcdf646db5a4a183df9bc7b901bc0.json} | 7 +- ...id_to_initialized_event_in_payout.down.sql | 3 + ...t_id_to_initialized_event_in_payout.up.sql | 9 + src/api/server/convert.rs | 5 +- src/app/mod.rs | 21 +- src/job/process_payout_queue.rs | 14 +- src/outbox/augmentation.rs | 5 +- src/payout/entity.rs | 152 ++++---- src/payout/error.rs | 12 +- src/payout/repo.rs | 366 ++++++++---------- src/payout/unbatched.rs | 18 +- src/primitives/mod.rs | 4 +- 50 files changed, 1840 insertions(+), 605 deletions(-) create mode 100644 .sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json create mode 100644 .sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json create mode 100644 .sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json create mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json create mode 100644 .sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json rename .sqlx/{query-55ca43169585550b32c40d2136f479bc62922fc3d77e2473ba7232fad46f491a.json => query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json} (58%) create mode 100644 .sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json create mode 100644 .sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json create mode 100644 .sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json create mode 100644 .sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json create mode 100644 .sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json create mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json create mode 100644 .sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json create mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json create mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json delete mode 100644 .sqlx/query-82ba0a25e509214930d78806f91d7c0a741716334f567da9f0bd7252a8a85fff.json create mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json delete mode 100644 .sqlx/query-8ddc2ea9bc99f7b4b1c004147c0f651ae0346f631b2393d5f4e45f9f18c5e20c.json create mode 100644 .sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json rename .sqlx/{query-64e1397e479b21af86d7c24f14bd3004685915c5f1f2f166a78ffd437d1808f8.json => query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json} (58%) create mode 100644 .sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json create mode 100644 .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json create mode 100644 .sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json create mode 100644 .sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json create mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json create mode 100644 .sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json create mode 100644 .sqlx/query-bb41a1baad3437ccece94bba7774571ae7f9a953aba799e1ca60ed5285273358.json delete mode 100644 .sqlx/query-be18ca32819fdda44a36323ced8e6aa95532db9cf1714814e6f15bfb56ae791f.json create mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json create mode 100644 .sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json create mode 100644 .sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json create mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json rename .sqlx/{query-bac453e06ae1ceebef3012cf0119ec13fcc982c544b3fde38f557b264dea6e9a.json => query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json} (57%) create mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json create mode 100644 .sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json create mode 100644 .sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json create mode 100644 .sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json create mode 100644 .sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json rename .sqlx/{query-f7df099ce3c2628910cef4b4d5445610313be8ece43f5f530d8e0e2322a62cf4.json => query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json} (57%) create mode 100644 migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql create mode 100644 migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql diff --git a/.sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json b/.sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json new file mode 100644 index 00000000..7644a17e --- /dev/null +++ b/.sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c" +} diff --git a/.sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json b/.sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json new file mode 100644 index 00000000..22b710a7 --- /dev/null +++ b/.sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee" +} diff --git a/.sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json b/.sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json new file mode 100644 index 00000000..a167297e --- /dev/null +++ b/.sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE batch_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708" +} diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json new file mode 100644 index 00000000..33a94981 --- /dev/null +++ b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Jsonb" + ] + }, + "nullable": [] + }, + "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" +} diff --git a/.sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json b/.sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json new file mode 100644 index 00000000..7e294b80 --- /dev/null +++ b/.sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts \n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a" +} diff --git a/.sqlx/query-55ca43169585550b32c40d2136f479bc62922fc3d77e2473ba7232fad46f491a.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json similarity index 58% rename from .sqlx/query-55ca43169585550b32c40d2136f479bc62922fc3d77e2473ba7232fad46f491a.json rename to .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json index 93a65b44..301c5cc3 100644 --- a/.sqlx/query-55ca43169585550b32c40d2136f479bc62922fc3d77e2473ba7232fad46f491a.json +++ b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_payouts b\n JOIN bria_payout_events e ON b.id = e.id\n WHERE b.batch_id IS NULL AND b.account_id = $1 AND b.payout_queue_id = $2\n ORDER BY b.created_at, b.id, e.sequence FOR UPDATE", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", "describe": { "columns": [ { @@ -10,27 +10,27 @@ }, { "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" + "name": "version", + "type_info": "Int4" }, { "ordinal": 2, - "name": "wallet_id", + "name": "journal_id", "type_info": "Uuid" }, { "ordinal": 3, - "name": "payout_queue_id", + "name": "tx_template_id", "type_info": "Uuid" }, { "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" + "name": "effective", + "type_info": "Date" }, { "ordinal": 5, - "name": "profile_id", + "name": "correlation_id", "type_info": "Uuid" }, { @@ -40,23 +40,27 @@ }, { "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" + "name": "description", + "type_info": "Varchar" }, { "ordinal": 8, - "name": "sequence", - "type_info": "Int4" + "name": "metadata", + "type_info": "Jsonb" }, { "ordinal": 9, - "name": "event", - "type_info": "Jsonb" + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", "Uuid" ] }, @@ -65,13 +69,14 @@ false, false, false, - true, false, false, false, + true, + true, false, false ] }, - "hash": "55ca43169585550b32c40d2136f479bc62922fc3d77e2473ba7232fad46f491a" + "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" } diff --git a/.sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json b/.sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json new file mode 100644 index 00000000..1a669db2 --- /dev/null +++ b/.sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE profile_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf" +} diff --git a/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json b/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json new file mode 100644 index 00000000..a2d971e4 --- /dev/null +++ b/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_payout_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4" +} diff --git a/.sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json b/.sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json new file mode 100644 index 00000000..29ec4a8e --- /dev/null +++ b/.sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE batch_id is NULL AND account_id = $1 AND payout_queue_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id\n FOR UPDATE) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836" +} diff --git a/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json b/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json new file mode 100644 index 00000000..93d3a896 --- /dev/null +++ b/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_payout_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8" +} diff --git a/.sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json b/.sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json new file mode 100644 index 00000000..9cc23fda --- /dev/null +++ b/.sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE account_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270" +} diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json new file mode 100644 index 00000000..105bf98b --- /dev/null +++ b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" +} diff --git a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json new file mode 100644 index 00000000..60f58c60 --- /dev/null +++ b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT NOW()", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "now", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc" +} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json new file mode 100644 index 00000000..074622c1 --- /dev/null +++ b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" +} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json new file mode 100644 index 00000000..7857e9f9 --- /dev/null +++ b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "code", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "params", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "tx_input", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "entries", + "type_info": "Jsonb" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + true, + false, + false + ] + }, + "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" +} diff --git a/.sqlx/query-82ba0a25e509214930d78806f91d7c0a741716334f567da9f0bd7252a8a85fff.json b/.sqlx/query-82ba0a25e509214930d78806f91d7c0a741716334f567da9f0bd7252a8a85fff.json deleted file mode 100644 index dd1737c3..00000000 --- a/.sqlx/query-82ba0a25e509214930d78806f91d7c0a741716334f567da9f0bd7252a8a85fff.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n WITH payouts AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND wallet_id = $2\n ORDER BY created_at DESC, id\n LIMIT $3 OFFSET $4\n )\n SELECT p.*, e.sequence, e.event\n FROM payouts p\n JOIN bria_payout_events e ON p.id = e.id\n ORDER BY p.created_at DESC, p.id, e.sequence\n ", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "wallet_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "payout_queue_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "profile_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 9, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Int8", - "Int8" - ] - }, - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - false, - false - ] - }, - "hash": "82ba0a25e509214930d78806f91d7c0a741716334f567da9f0bd7252a8a85fff" -} diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json new file mode 100644 index 00000000..3c7819b4 --- /dev/null +++ b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json @@ -0,0 +1,148 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" +} diff --git a/.sqlx/query-8ddc2ea9bc99f7b4b1c004147c0f651ae0346f631b2393d5f4e45f9f18c5e20c.json b/.sqlx/query-8ddc2ea9bc99f7b4b1c004147c0f651ae0346f631b2393d5f4e45f9f18c5e20c.json deleted file mode 100644 index b0803609..00000000 --- a/.sqlx/query-8ddc2ea9bc99f7b4b1c004147c0f651ae0346f631b2393d5f4e45f9f18c5e20c.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_payouts b\n JOIN bria_payout_events e ON b.id = e.id\n WHERE account_id = $1 AND b.external_id = $2\n ORDER BY b.created_at, b.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "wallet_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "payout_queue_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "profile_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 9, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - false, - false - ] - }, - "hash": "8ddc2ea9bc99f7b4b1c004147c0f651ae0346f631b2393d5f4e45f9f18c5e20c" -} diff --git a/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json b/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json new file mode 100644 index 00000000..2e903050 --- /dev/null +++ b/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE external_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e" +} diff --git a/.sqlx/query-64e1397e479b21af86d7c24f14bd3004685915c5f1f2f166a78ffd437d1808f8.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json similarity index 58% rename from .sqlx/query-64e1397e479b21af86d7c24f14bd3004685915c5f1f2f166a78ffd437d1808f8.json rename to .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json index 8482ddf9..00d0da2e 100644 --- a/.sqlx/query-64e1397e479b21af86d7c24f14bd3004685915c5f1f2f166a78ffd437d1808f8.json +++ b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_payouts b\n JOIN bria_payout_events e ON b.id = e.id\n WHERE b.account_id = $1 AND b.batch_id = $2\n ORDER BY b.created_at, b.id, e.sequence", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", "describe": { "columns": [ { @@ -10,27 +10,27 @@ }, { "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" + "name": "version", + "type_info": "Int4" }, { "ordinal": 2, - "name": "wallet_id", + "name": "journal_id", "type_info": "Uuid" }, { "ordinal": 3, - "name": "payout_queue_id", + "name": "tx_template_id", "type_info": "Uuid" }, { "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" + "name": "effective", + "type_info": "Date" }, { "ordinal": 5, - "name": "profile_id", + "name": "correlation_id", "type_info": "Uuid" }, { @@ -40,24 +40,28 @@ }, { "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" + "name": "description", + "type_info": "Varchar" }, { "ordinal": 8, - "name": "sequence", - "type_info": "Int4" + "name": "metadata", + "type_info": "Jsonb" }, { "ordinal": 9, - "name": "event", - "type_info": "Jsonb" + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", - "Uuid" + "UuidArray" ] }, "nullable": [ @@ -65,13 +69,14 @@ false, false, false, - true, false, false, false, + true, + true, false, false ] }, - "hash": "64e1397e479b21af86d7c24f14bd3004685915c5f1f2f166a78ffd437d1808f8" + "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" } diff --git a/.sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json b/.sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json new file mode 100644 index 00000000..ffa4e58e --- /dev/null +++ b/.sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND wallet_id = $2\n ORDER BY created_at DESC \n OFFSET $3) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Int8" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b" +} diff --git a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json new file mode 100644 index 00000000..f856a851 --- /dev/null +++ b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" +} diff --git a/.sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json b/.sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json new file mode 100644 index 00000000..2cbf350d --- /dev/null +++ b/.sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe" +} diff --git a/.sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json b/.sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json new file mode 100644 index 00000000..08c4d9e1 --- /dev/null +++ b/.sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND id = $2\n FOR UPDATE) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6" +} diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json new file mode 100644 index 00000000..b95d0aed --- /dev/null +++ b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json @@ -0,0 +1,121 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 5, + "name": "entry_type", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "layer: Layer", + "type_info": { + "Custom": { + "name": "layer", + "kind": { + "Enum": [ + "settled", + "pending", + "encumbered" + ] + } + } + } + }, + { + "ordinal": 7, + "name": "units", + "type_info": "Numeric" + }, + { + "ordinal": 8, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "direction: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 10, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" +} diff --git a/.sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json b/.sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json new file mode 100644 index 00000000..b9fb0f8b --- /dev/null +++ b/.sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2" +} diff --git a/.sqlx/query-bb41a1baad3437ccece94bba7774571ae7f9a953aba799e1ca60ed5285273358.json b/.sqlx/query-bb41a1baad3437ccece94bba7774571ae7f9a953aba799e1ca60ed5285273358.json new file mode 100644 index 00000000..7b8d6df7 --- /dev/null +++ b/.sqlx/query-bb41a1baad3437ccece94bba7774571ae7f9a953aba799e1ca60ed5285273358.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_payouts SET batch_id = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [] + }, + "hash": "bb41a1baad3437ccece94bba7774571ae7f9a953aba799e1ca60ed5285273358" +} diff --git a/.sqlx/query-be18ca32819fdda44a36323ced8e6aa95532db9cf1714814e6f15bfb56ae791f.json b/.sqlx/query-be18ca32819fdda44a36323ced8e6aa95532db9cf1714814e6f15bfb56ae791f.json deleted file mode 100644 index 35f4a141..00000000 --- a/.sqlx/query-be18ca32819fdda44a36323ced8e6aa95532db9cf1714814e6f15bfb56ae791f.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_payouts b\n JOIN bria_payout_events e ON b.id = e.id\n WHERE account_id = $1 AND b.id = $2\n ORDER BY b.created_at, b.id, e.sequence\n FOR UPDATE", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "wallet_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "payout_queue_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "profile_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 8, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 9, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - true, - false, - false, - false, - false, - false - ] - }, - "hash": "be18ca32819fdda44a36323ced8e6aa95532db9cf1714814e6f15bfb56ae791f" -} diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json new file mode 100644 index 00000000..92db28c8 --- /dev/null +++ b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json @@ -0,0 +1,147 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" +} diff --git a/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json b/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json new file mode 100644 index 00000000..ce8ffbfd --- /dev/null +++ b/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE wallet_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6" +} diff --git a/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json b/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json new file mode 100644 index 00000000..e10db39a --- /dev/null +++ b/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d" +} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json new file mode 100644 index 00000000..90bef3da --- /dev/null +++ b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json @@ -0,0 +1,59 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + }, + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + }, + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" +} diff --git a/.sqlx/query-bac453e06ae1ceebef3012cf0119ec13fcc982c544b3fde38f557b264dea6e9a.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json similarity index 57% rename from .sqlx/query-bac453e06ae1ceebef3012cf0119ec13fcc982c544b3fde38f557b264dea6e9a.json rename to .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json index 6926cdfe..18d9c9b6 100644 --- a/.sqlx/query-bac453e06ae1ceebef3012cf0119ec13fcc982c544b3fde38f557b264dea6e9a.json +++ b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT b.*, e.sequence, e.event\n FROM bria_payouts b\n JOIN bria_payout_events e ON b.id = e.id\n WHERE account_id = $1 AND b.id = $2\n ORDER BY b.created_at, b.id, e.sequence", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", "describe": { "columns": [ { @@ -10,27 +10,27 @@ }, { "ordinal": 1, - "name": "account_id", - "type_info": "Uuid" + "name": "version", + "type_info": "Int4" }, { "ordinal": 2, - "name": "wallet_id", + "name": "journal_id", "type_info": "Uuid" }, { "ordinal": 3, - "name": "payout_queue_id", + "name": "tx_template_id", "type_info": "Uuid" }, { "ordinal": 4, - "name": "batch_id", - "type_info": "Uuid" + "name": "effective", + "type_info": "Date" }, { "ordinal": 5, - "name": "profile_id", + "name": "correlation_id", "type_info": "Uuid" }, { @@ -40,24 +40,28 @@ }, { "ordinal": 7, - "name": "created_at", - "type_info": "Timestamptz" + "name": "description", + "type_info": "Varchar" }, { "ordinal": 8, - "name": "sequence", - "type_info": "Int4" + "name": "metadata", + "type_info": "Jsonb" }, { "ordinal": 9, - "name": "event", - "type_info": "Jsonb" + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", - "Uuid" + "TextArray" ] }, "nullable": [ @@ -65,13 +69,14 @@ false, false, false, - true, false, false, false, + true, + true, false, false ] }, - "hash": "bac453e06ae1ceebef3012cf0119ec13fcc982c544b3fde38f557b264dea6e9a" + "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" } diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json new file mode 100644 index 00000000..8de91f27 --- /dev/null +++ b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Date", + "Uuid", + "Varchar", + "Varchar", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" +} diff --git a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json new file mode 100644 index 00000000..50c0e05c --- /dev/null +++ b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "payload!", + "type_info": "Json" + } + ], + "parameters": { + "Left": [ + "Int8" + ] + }, + "nullable": [ + null + ] + }, + "hash": "e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42" +} diff --git a/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json b/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json new file mode 100644 index 00000000..169a320d --- /dev/null +++ b/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT i.id AS \"id: PayoutId\", e.sequence, e.event, e.recorded_at FROM bria_payouts i JOIN bria_payout_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f" +} diff --git a/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json b/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json new file mode 100644 index 00000000..bc2ca9ca --- /dev/null +++ b/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE payout_queue_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4" +} diff --git a/.sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json b/.sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json new file mode 100644 index 00000000..8dc90a6d --- /dev/null +++ b/.sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: PayoutId", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5" +} diff --git a/.sqlx/query-f7df099ce3c2628910cef4b4d5445610313be8ece43f5f530d8e0e2322a62cf4.json b/.sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json similarity index 57% rename from .sqlx/query-f7df099ce3c2628910cef4b4d5445610313be8ece43f5f530d8e0e2322a62cf4.json rename to .sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json index b1acca9e..a9b41ec0 100644 --- a/.sqlx/query-f7df099ce3c2628910cef4b4d5445610313be8ece43f5f530d8e0e2322a62cf4.json +++ b/.sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payouts (id, account_id, wallet_id, payout_queue_id, profile_id, external_id)\n VALUES ($1, $2, $3, $4, $5, $6)", + "query": "INSERT INTO bria_payouts (id, account_id, wallet_id, payout_queue_id, profile_id, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7)", "describe": { "columns": [], "parameters": { @@ -10,10 +10,11 @@ "Uuid", "Uuid", "Uuid", - "Varchar" + "Varchar", + "Timestamptz" ] }, "nullable": [] }, - "hash": "f7df099ce3c2628910cef4b4d5445610313be8ece43f5f530d8e0e2322a62cf4" + "hash": "fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0" } diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql new file mode 100644 index 00000000..92680a16 --- /dev/null +++ b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql @@ -0,0 +1,3 @@ +UPDATE bria_payout_events +SET event = event - 'account_id' +WHERE event ? 'account_id' AND event_type = 'initialized'; \ No newline at end of file diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql new file mode 100644 index 00000000..294592b4 --- /dev/null +++ b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql @@ -0,0 +1,9 @@ +UPDATE bria_payout_events +SET event = jsonb_set( + event, + '{account_id}', + to_jsonb(p.account_id::text) +) +FROM bria_payouts p +WHERE bria_payout_events.id = p.id +AND event_type = 'initialized'; diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index e2ae2c99..b4bc5a75 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -679,7 +679,7 @@ impl From for tonic::Status { ApplicationError::ProfileError(ProfileError::EsEntityError( es_entity::EsEntityError::NotFound, )) => tonic::Status::not_found(err.to_string()), - ApplicationError::PayoutError(PayoutError::PayoutIdNotFound(_)) => { + ApplicationError::PayoutError(err) if err.was_not_found() => { tonic::Status::not_found(err.to_string()) } ApplicationError::PayoutError(PayoutError::ExternalIdAlreadyExists) => { @@ -691,9 +691,6 @@ impl From for tonic::Status { ApplicationError::CouldNotParseIncomingUuid(_) => { tonic::Status::invalid_argument(err.to_string()) } - ApplicationError::PayoutError(PayoutError::ExternalIdNotFound) => { - tonic::Status::not_found(err.to_string()) - } ApplicationError::DestinationBlocked(_) => { tonic::Status::permission_denied(err.to_string()) } diff --git a/src/app/mod.rs b/src/app/mod.rs index ad11f0cc..8d9967d0 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -860,11 +860,11 @@ impl App { builder.external_id(external_id); } let new_payout = builder.build().expect("Couldn't build NewPayout"); - let mut tx = self.pool.begin().await?; - let id = self.payouts.create_in_tx(&mut tx, new_payout).await?; + let mut db = self.payouts.begin_op().await?; + let id = self.payouts.create_in_op(&mut db, new_payout).await?.id; self.ledger .payout_submitted( - tx, + db.into_tx(), id, PayoutSubmittedParams { journal_id: wallet.journal_id, @@ -895,15 +895,15 @@ impl App { profile: &Profile, id: PayoutId, ) -> Result<(), ApplicationError> { - let mut tx = self.pool.begin().await?; + let mut db = self.payouts.begin_op().await?; let mut payout = self .payouts - .find_by_id_for_cancellation(&mut tx, profile.account_id, id) + .find_by_id_for_cancellation(db.tx(), profile.account_id, id) .await?; payout.cancel_payout(profile.id)?; - self.payouts.update(&mut tx, payout).await?; + self.payouts.update_in_op(&mut db, &mut payout).await?; self.ledger - .payout_cancelled(tx, LedgerTransactionId::new(), id) + .payout_cancelled(db.into_tx(), LedgerTransactionId::new(), id) .await?; Ok(()) } @@ -921,7 +921,7 @@ impl App { ) -> Result { let payout = self .payouts - .find_by_external_id(profile.account_id, external_id) + .find_by_account_id_and_external_id(profile.account_id, external_id) .await?; Ok(self .batch_inclusion @@ -935,7 +935,10 @@ impl App { profile: &Profile, id: PayoutId, ) -> Result { - let payout = self.payouts.find_by_id(profile.account_id, id).await?; + let payout = self + .payouts + .find_by_account_id_and_id(profile.account_id, id) + .await?; Ok(self .batch_inclusion .include_estimate(profile.account_id, payout) diff --git a/src/job/process_payout_queue.rs b/src/job/process_payout_queue.rs index 51a5b117..8cf703ba 100644 --- a/src/job/process_payout_queue.rs +++ b/src/job/process_payout_queue.rs @@ -54,9 +54,9 @@ pub(super) async fn execute<'a>( let payout_queue = payout_queues .find_by_account_id_and_id(data.account_id, data.payout_queue_id) .await?; - let mut tx = pool.begin().await?; + let mut db = payouts.begin_op().await?; let mut unbatched_payouts = payouts - .list_unbatched(&mut tx, data.account_id, data.payout_queue_id) + .list_unbatched(db.tx(), data.account_id, data.payout_queue_id) .await?; let fee_rate = fees_client .fee_rate(payout_queue.config.tx_priority) @@ -71,7 +71,7 @@ pub(super) async fn execute<'a>( .. } = construct_psbt( &pool, - &mut tx, + db.tx(), &unbatched_payouts, &utxos, &wallets, @@ -134,10 +134,10 @@ pub(super) async fn execute<'a>( })); let batch_id = batch.id; - batches.create_in_tx(&mut tx, batch).await?; + batches.create_in_tx(db.tx(), batch).await?; utxos .reserve_utxos_in_batch( - &mut tx, + db.tx(), data.account_id, batch_id, data.payout_queue_id, @@ -158,9 +158,9 @@ pub(super) async fn execute<'a>( queue_drain_error(unbatched_payouts.n_not_batched()); } - payouts.update_unbatched(&mut tx, unbatched_payouts).await?; + payouts.update_unbatched(&mut db, unbatched_payouts).await?; - Ok((data, Some((tx, wallet_ids)))) + Ok((data, Some((db.into_tx(), wallet_ids)))) } else { if unbatched_payouts.n_not_batched() > 0 { queue_drain_error(unbatched_payouts.n_not_batched()); diff --git a/src/outbox/augmentation.rs b/src/outbox/augmentation.rs index c8906f5c..7e2daa66 100644 --- a/src/outbox/augmentation.rs +++ b/src/outbox/augmentation.rs @@ -63,7 +63,10 @@ impl Augmenter { | OutboxEventPayload::PayoutCommitted { id, .. } | OutboxEventPayload::PayoutBroadcast { id, .. } | OutboxEventPayload::PayoutSettled { id, .. } => { - let payout = self.payouts.find_by_id(account_id, id).await?; + let payout = self + .payouts + .find_by_account_id_and_id(account_id, id) + .await?; let payout = self .batch_inclusion .include_estimate(account_id, payout) diff --git a/src/payout/entity.rs b/src/payout/entity.rs index 213b8d5b..bc4125a4 100644 --- a/src/payout/entity.rs +++ b/src/payout/entity.rs @@ -1,15 +1,18 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; -use crate::{entity::*, primitives::*}; +use crate::primitives::*; use super::error::PayoutError; -#[derive(Serialize, Deserialize)] +#[derive(EsEvent, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "PayoutId")] pub enum PayoutEvent { Initialized { id: PayoutId, + account_id: AccountId, wallet_id: WalletId, payout_queue_id: PayoutQueueId, profile_id: ProfileId, @@ -31,10 +34,11 @@ pub enum PayoutEvent { }, } -#[derive(Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct Payout { pub id: PayoutId, + pub account_id: AccountId, pub wallet_id: WalletId, pub profile_id: ProfileId, pub payout_queue_id: PayoutQueueId, @@ -66,7 +70,7 @@ impl Payout { } pub fn is_cancelled(&self) -> bool { - for event in self.events.iter() { + for event in self.events.iter_all() { if let PayoutEvent::Cancelled { .. } = event { return true; } @@ -79,6 +83,47 @@ impl Payout { } } +impl TryFromEvents for Payout { + fn try_from_events(events: EntityEvents) -> Result { + let mut builder = PayoutBuilder::default(); + for event in events.iter_all() { + match event { + PayoutEvent::Initialized { + id, + account_id, + wallet_id, + profile_id, + payout_queue_id, + destination, + satoshis, + .. + } => { + builder = builder + .id(*id) + .account_id(*account_id) + .wallet_id(*wallet_id) + .profile_id(*profile_id) + .payout_queue_id(*payout_queue_id) + .destination(destination.clone()) + .satoshis(*satoshis); + } + + PayoutEvent::ExternalIdUpdated { external_id } => { + builder = builder.external_id(external_id.clone()); + } + PayoutEvent::MetadataUpdated { metadata } => { + builder = builder.metadata(metadata.clone()); + } + PayoutEvent::CommittedToBatch { batch_id, outpoint } => { + builder = builder.batch_id(*batch_id).outpoint(*outpoint); + } + _ => (), + } + } + builder.events(events).build() + } +} + #[derive(Debug, Builder, Clone)] pub struct NewPayout { #[builder(setter(into))] @@ -104,11 +149,14 @@ impl NewPayout { builder.external_id(id.to_string()).id(id); builder } +} - pub(super) fn initial_events(self) -> EntityEvents { - let mut events = EntityEvents::init([ +impl IntoEvents for NewPayout { + fn into_events(self) -> EntityEvents { + let mut events = vec![ PayoutEvent::Initialized { id: self.id, + account_id: self.account_id, wallet_id: self.wallet_id, payout_queue_id: self.payout_queue_id, profile_id: self.profile_id, @@ -118,52 +166,11 @@ impl NewPayout { PayoutEvent::ExternalIdUpdated { external_id: self.external_id, }, - ]); + ]; if let Some(metadata) = self.metadata { events.push(PayoutEvent::MetadataUpdated { metadata }); } - events - } -} - -impl TryFrom> for Payout { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { - let mut builder = PayoutBuilder::default(); - for event in events.iter() { - match event { - PayoutEvent::Initialized { - id, - wallet_id, - profile_id, - payout_queue_id, - destination, - satoshis, - .. - } => { - builder = builder - .id(*id) - .wallet_id(*wallet_id) - .profile_id(*profile_id) - .payout_queue_id(*payout_queue_id) - .destination(destination.clone()) - .satoshis(*satoshis); - } - - PayoutEvent::ExternalIdUpdated { external_id } => { - builder = builder.external_id(external_id.clone()); - } - PayoutEvent::MetadataUpdated { metadata } => { - builder = builder.metadata(metadata.clone()); - } - PayoutEvent::CommittedToBatch { batch_id, outpoint } => { - builder = builder.batch_id(*batch_id).outpoint(*outpoint); - } - _ => (), - } - } - builder.events(events).build() + EntityEvents::init(self.id, events) } } @@ -174,31 +181,36 @@ mod tests { use super::*; fn init_events() -> EntityEvents { - EntityEvents::init([ - PayoutEvent::Initialized { - id: PayoutId::new(), - wallet_id: WalletId::new(), - profile_id: ProfileId::new(), - payout_queue_id: PayoutQueueId::new(), - destination: PayoutDestination::OnchainAddress { - value: "bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej" - .parse::
() - .unwrap(), + let id = PayoutId::new(); + EntityEvents::init( + id, + [ + PayoutEvent::Initialized { + id: id, + account_id: AccountId::new(), + wallet_id: WalletId::new(), + profile_id: ProfileId::new(), + payout_queue_id: PayoutQueueId::new(), + destination: PayoutDestination::OnchainAddress { + value: "bc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej" + .parse::
() + .unwrap(), + }, + satoshis: Satoshis::from(Decimal::from(21)), }, - satoshis: Satoshis::from(Decimal::from(21)), - }, - PayoutEvent::ExternalIdUpdated { - external_id: "external_id".to_string(), - }, - ]) + PayoutEvent::ExternalIdUpdated { + external_id: "external_id".to_string(), + }, + ], + ) } #[test] fn cancel_payout() { - let mut payout = Payout::try_from(init_events()).unwrap(); + let mut payout = Payout::try_from_events(init_events()).unwrap(); assert!(payout.cancel_payout(payout.profile_id).is_ok()); assert!(matches!( - payout.events.last(1)[0], + payout.events.iter_all().last().unwrap(), PayoutEvent::Cancelled { .. } )); } @@ -209,7 +221,7 @@ mod tests { events.push(PayoutEvent::Cancelled { executed_by: ProfileId::new(), }); - let mut payout = Payout::try_from(events).unwrap(); + let mut payout = Payout::try_from_events(events).unwrap(); let result = payout.cancel_payout(payout.profile_id); assert!(matches!(result, Err(PayoutError::PayoutAlreadyCancelled))); } @@ -227,7 +239,7 @@ mod tests { }, }); - let mut payout = Payout::try_from(events).unwrap(); + let mut payout = Payout::try_from_events(events).unwrap(); let result = payout.cancel_payout(payout.profile_id); assert!(matches!(result, Err(PayoutError::PayoutAlreadyCommitted))); diff --git a/src/payout/error.rs b/src/payout/error.rs index 875d9aa3..f62e0564 100644 --- a/src/payout/error.rs +++ b/src/payout/error.rs @@ -4,20 +4,20 @@ use thiserror::Error; pub enum PayoutError { #[error("PayoutError - Sqlx: {0}")] Sqlx(sqlx::Error), - #[error("PayoutError - EntityError: {0}")] - EntityError(#[from] crate::entity::EntityError), - #[error("PayoutError - Could not find payout with id: {0}")] - PayoutIdNotFound(String), - #[error("PayoutError - External Id does not exists")] - ExternalIdNotFound, #[error("PayoutError - Payout is already committed to batch")] PayoutAlreadyCommitted, #[error("PayoutError - Payout is already cancelled")] PayoutAlreadyCancelled, #[error("PayoutError - external_id already exists")] ExternalIdAlreadyExists, + #[error("PayoutError - EsEntityError: {0}")] + EsEntityError(es_entity::EsEntityError), + #[error("PayoutError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), } +es_entity::from_es_entity_error!(PayoutError); + impl From for PayoutError { fn from(error: sqlx::Error) -> Self { if let Some(err) = error.as_database_error() { diff --git a/src/payout/repo.rs b/src/payout/repo.rs index e6b5aaac..a1e41f64 100644 --- a/src/payout/repo.rs +++ b/src/payout/repo.rs @@ -1,12 +1,26 @@ +use es_entity::*; use sqlx::{Pool, Postgres, Transaction}; use tracing::instrument; use std::collections::HashMap; use super::{entity::*, error::*, unbatched::*}; -use crate::{entity::*, primitives::*}; +use crate::primitives::*; -#[derive(Debug, Clone)] +#[derive(EsRepo, Clone, Debug)] +#[es_repo( + entity = "Payout", + err = "PayoutError", + columns( + account_id(ty = "AccountId", update(persist = false)), + wallet_id(ty = "WalletId", update(persist = false)), + payout_queue_id(ty = "PayoutQueueId", update(persist = false)), + profile_id(ty = "ProfileId", update(persist = false)), + external_id(ty = "String", update(persist = false)), + batch_id(ty = "Option", create(persist = false),) + ), + tbl_prefix = "bria" +)] pub struct Payouts { pool: Pool, } @@ -16,90 +30,37 @@ impl Payouts { Self { pool: pool.clone() } } - #[instrument(name = "payouts.create", skip(self, tx))] - pub async fn create_in_tx( - &self, - tx: &mut Transaction<'_, Postgres>, - new_payout: NewPayout, - ) -> Result { - sqlx::query!( - r#"INSERT INTO bria_payouts (id, account_id, wallet_id, payout_queue_id, profile_id, external_id) - VALUES ($1, $2, $3, $4, $5, $6)"#, - new_payout.id as PayoutId, - new_payout.account_id as AccountId, - new_payout.wallet_id as WalletId, - new_payout.payout_queue_id as PayoutQueueId, - new_payout.profile_id as ProfileId, - new_payout.external_id, - ).execute(&mut **tx).await?; - let id = new_payout.id; - EntityEvents::::persist( - "bria_payout_events", - tx, - new_payout.initial_events().new_serialized_events(id), - ) - .await?; - Ok(id) - } - - #[instrument(name = "payouts.find_by_id", skip(self))] - pub async fn find_by_id( + pub async fn find_by_account_id_and_id( &self, account_id: AccountId, payout_id: PayoutId, ) -> Result { - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_payouts b - JOIN bria_payout_events e ON b.id = e.id - WHERE account_id = $1 AND b.id = $2 - ORDER BY b.created_at, b.id, e.sequence"#, - account_id as AccountId, - payout_id as PayoutId, - ) - .fetch_all(&self.pool) - .await?; - - if rows.is_empty() { - return Err(PayoutError::PayoutIdNotFound(payout_id.to_string())); - } - - let mut entity_events = EntityEvents::new(); - for row in rows { - entity_events.load_event(row.sequence as usize, row.event)?; + let payout = self.find_by_id(payout_id).await?; + if payout.account_id != account_id { + return Err(PayoutError::EsEntityError(EsEntityError::NotFound)); } - Ok(Payout::try_from(entity_events)?) + Ok(payout) } #[instrument(name = "payouts.find_by_external_id", skip(self))] - pub async fn find_by_external_id( + pub async fn find_by_account_id_and_external_id( &self, account_id: AccountId, external_id: String, ) -> Result { - let rows = sqlx::query!( + let payout = es_entity::es_query!( + "bria", + &self.pool, r#" - SELECT b.*, e.sequence, e.event - FROM bria_payouts b - JOIN bria_payout_events e ON b.id = e.id - WHERE account_id = $1 AND b.external_id = $2 - ORDER BY b.created_at, b.id, e.sequence"#, + SELECT * + FROM bria_payouts + WHERE account_id = $1 AND external_id = $2"#, account_id as AccountId, external_id ) - .fetch_all(&self.pool) + .fetch_one() .await?; - - if rows.is_empty() { - return Err(PayoutError::ExternalIdNotFound); - } - - let mut entity_events = EntityEvents::new(); - for row in rows { - entity_events.load_event(row.sequence as usize, row.event)?; - } - Ok(Payout::try_from(entity_events)?) + Ok(payout) } #[instrument(name = "payouts.list_unbatched", skip(self))] @@ -109,51 +70,61 @@ impl Payouts { account_id: AccountId, payout_queue_id: PayoutQueueId, ) -> Result { - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_payouts b - JOIN bria_payout_events e ON b.id = e.id - WHERE b.batch_id IS NULL AND b.account_id = $1 AND b.payout_queue_id = $2 - ORDER BY b.created_at, b.id, e.sequence FOR UPDATE"#, - account_id as AccountId, - payout_queue_id as PayoutQueueId, - ) - .fetch_all(&mut **tx) - .await?; - let mut wallet_payouts = Vec::new(); - let mut entity_events = HashMap::new(); - for row in rows { - let wallet_id = WalletId::from(row.wallet_id); - let id = WalletId::from(row.id); - wallet_payouts.push((id, wallet_id)); - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } - let mut payouts: HashMap> = HashMap::new(); - for (id, wallet_id) in wallet_payouts { - if let Some(events) = entity_events.remove(&id) { - payouts - .entry(wallet_id) - .or_default() - .push(UnbatchedPayout::try_from(events)?); + let mut unbatched_payouts = Vec::new(); + let mut query = es_entity::PaginatedQueryArgs:: { + first: Default::default(), + after: None, + }; + + loop { + let (id, created_at) = query + .after + .map(|c| (Some(c.id), Some(c.created_at))) + .unwrap_or((None, None)); + + let (entities, has_next_page) = es_entity::es_query!( + "bria", + &mut **tx, + r#" + SELECT * + FROM bria_payouts + WHERE batch_id is NULL AND account_id = $1 AND payout_queue_id = $2 + AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL)) + ORDER BY created_at, id + FOR UPDATE"#, + account_id as AccountId, + payout_queue_id as PayoutQueueId, + id as Option, + created_at + ) + .fetch_n(query.first) + .await?; + + unbatched_payouts.extend(entities); + + if !has_next_page { + break; } + let end_cursor = unbatched_payouts + .last() + .map(payout_cursor::PayoutsByCreatedAtCursor::from); + + query.after = end_cursor; } - let filtered_payouts: HashMap> = payouts + + let filtered_payouts: HashMap> = unbatched_payouts .into_iter() - .map(|(wallet_id, unbatched_payouts)| { - let filtered_unbatched_payouts = unbatched_payouts - .into_iter() - .filter(|payout| { - !payout - .events - .iter() - .any(|event| matches!(event, PayoutEvent::Cancelled { .. })) - }) - .collect(); - (wallet_id, filtered_unbatched_payouts) + .filter(|payout| { + !payout + .events + .iter_all() + .any(|event| matches!(event, PayoutEvent::Cancelled { .. })) }) - .collect(); + .filter_map(|unbatched_payout| UnbatchedPayout::try_from(unbatched_payout).ok()) + .fold(HashMap::new(), |mut map, payout| { + map.entry(payout.wallet_id).or_default().push(payout); + map + }); Ok(UnbatchedPayouts::new(filtered_payouts)) } @@ -166,43 +137,22 @@ impl Payouts { page_size: u64, ) -> Result, PayoutError> { let offset = (page - 1) * page_size; - - let rows = sqlx::query!( + let payouts = es_entity::es_query!( + "bria", + &self.pool, r#" - WITH payouts AS ( SELECT * FROM bria_payouts WHERE account_id = $1 AND wallet_id = $2 - ORDER BY created_at DESC, id - LIMIT $3 OFFSET $4 - ) - SELECT p.*, e.sequence, e.event - FROM payouts p - JOIN bria_payout_events e ON p.id = e.id - ORDER BY p.created_at DESC, p.id, e.sequence - "#, + ORDER BY created_at DESC + OFFSET $3"#, account_id as AccountId, wallet_id as WalletId, - page_size as i64, offset as i64, ) - .fetch_all(&self.pool) + .fetch_n(page_size as usize) .await?; - let mut wallet_payouts = Vec::new(); - let mut entity_events = HashMap::new(); - for row in rows { - let id = WalletId::from(row.id); - wallet_payouts.push(id); - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } - let mut payouts = Vec::new(); - for id in wallet_payouts { - if let Some(events) = entity_events.remove(&id) { - payouts.push(Payout::try_from(events)?); - } - } - Ok(payouts) + Ok(payouts.0) } #[instrument(name = "payouts.list_for_batch", skip(self))] @@ -211,60 +161,86 @@ impl Payouts { account_id: AccountId, batch_id: BatchId, ) -> Result>, PayoutError> { - let rows = sqlx::query!( - r#" - SELECT b.*, e.sequence, e.event - FROM bria_payouts b - JOIN bria_payout_events e ON b.id = e.id - WHERE b.account_id = $1 AND b.batch_id = $2 - ORDER BY b.created_at, b.id, e.sequence"#, - account_id as AccountId, - batch_id as BatchId, - ) - .fetch_all(&self.pool) - .await?; - let mut payout_ids = Vec::new(); - let mut entity_events = HashMap::new(); - for row in rows { - let id = PayoutId::from(row.id); - payout_ids.push(id); - let events = entity_events.entry(id).or_insert_with(EntityEvents::new); - events.load_event(row.sequence as usize, row.event)?; - } - let mut payouts: HashMap> = HashMap::new(); - for id in payout_ids { - if let Some(events) = entity_events.remove(&id) { - let payout = Payout::try_from(events)?; - payouts.entry(payout.wallet_id).or_default().push(payout); + let mut batched_payouts = Vec::new(); + let mut query = es_entity::PaginatedQueryArgs:: { + first: Default::default(), + after: None, + }; + + loop { + let (id, created_at) = query + .after + .map(|c| (Some(c.id), Some(c.created_at))) + .unwrap_or((None, None)); + + let (entities, has_next_page) = es_entity::es_query!( + "bria", + &self.pool, + r#" + SELECT * + FROM bria_payouts + WHERE account_id = $1 AND batch_id = $2 + AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL)) + ORDER BY created_at, id"#, + account_id as AccountId, + batch_id as BatchId, + id as Option, + created_at + ) + .fetch_n(query.first) + .await?; + + batched_payouts.extend(entities); + + if !has_next_page { + break; } + + let end_cursor = batched_payouts + .last() + .map(payout_cursor::PayoutsByCreatedAtCursor::from); + + query.after = end_cursor; } + + let payouts: HashMap> = + batched_payouts + .into_iter() + .fold(HashMap::new(), |mut map, batched_payout| { + map.entry(batched_payout.wallet_id) + .or_default() + .push(batched_payout); + map + }); Ok(payouts) } pub async fn update_unbatched( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut DbOp<'_>, payouts: UnbatchedPayouts, ) -> Result<(), PayoutError> { if payouts.batch_id.is_none() || payouts.batched.is_empty() { return Ok(()); } let mut ids = Vec::new(); - EntityEvents::::persist( - "bria_payout_events", - tx, - payouts.batched.into_iter().flat_map(|p| { + let mut all_events: Vec> = payouts + .batched + .into_iter() + .map(|p| { ids.push(uuid::Uuid::from(p.id)); - p.events.into_new_serialized_events(p.id) - }), - ) - .await?; + p.events + }) + .collect(); + + self.persist_events_batch(op, &mut all_events).await?; + sqlx::query!( r#"UPDATE bria_payouts SET batch_id = $1 WHERE id = ANY($2)"#, payouts.batch_id.unwrap() as BatchId, &ids[..], ) - .execute(&mut **tx) + .execute(&mut **op.tx()) .await?; Ok(()) } @@ -310,45 +286,19 @@ impl Payouts { account_id: AccountId, payout_id: PayoutId, ) -> Result { - let rows = sqlx::query!( + let payout = es_entity::es_query!( + "bria", + &mut **tx, r#" - SELECT b.*, e.sequence, e.event - FROM bria_payouts b - JOIN bria_payout_events e ON b.id = e.id - WHERE account_id = $1 AND b.id = $2 - ORDER BY b.created_at, b.id, e.sequence - FOR UPDATE"#, + SELECT * + FROM bria_payouts + WHERE account_id = $1 AND id = $2 + FOR UPDATE"#, account_id as AccountId, payout_id as PayoutId, ) - .fetch_all(&mut **tx) + .fetch_one() .await?; - - if rows.is_empty() { - return Err(PayoutError::PayoutIdNotFound(payout_id.to_string())); - } - - let mut entity_events = EntityEvents::new(); - for row in rows { - entity_events.load_event(row.sequence as usize, row.event)?; - } - Ok(Payout::try_from(entity_events)?) - } - - pub async fn update( - &self, - tx: &mut Transaction<'_, Postgres>, - payout: Payout, - ) -> Result<(), PayoutError> { - if !payout.events.is_dirty() { - return Ok(()); - } - EntityEvents::::persist( - "bria_payout_events", - tx, - payout.events.new_serialized_events(payout.id), - ) - .await?; - Ok(()) + Ok(payout) } } diff --git a/src/payout/unbatched.rs b/src/payout/unbatched.rs index c1d4ea64..db4284a0 100644 --- a/src/payout/unbatched.rs +++ b/src/payout/unbatched.rs @@ -1,9 +1,10 @@ use derive_builder::Builder; +use es_entity::*; use std::collections::HashMap; -use super::entity::PayoutEvent; -use crate::{entity::*, primitives::*}; +use super::entity::{Payout, PayoutEvent}; +use crate::primitives::*; pub struct UnbatchedPayouts { inner: HashMap>, @@ -90,7 +91,7 @@ impl UnbatchedPayouts { } #[derive(Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct UnbatchedPayout { pub id: PayoutId, pub wallet_id: WalletId, @@ -107,12 +108,11 @@ impl UnbatchedPayout { } } -impl TryFrom> for UnbatchedPayout { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { +impl TryFrom for UnbatchedPayout { + type Error = EsEntityError; + fn try_from(payout: Payout) -> Result { let mut builder = UnbatchedPayoutBuilder::default(); - for event in events.iter() { + for event in payout.events.iter_all() { if let PayoutEvent::Initialized { id, wallet_id, @@ -128,7 +128,7 @@ impl TryFrom> for UnbatchedPayout { .satoshis(*satoshis); } } - builder.events(events).build() + builder.events(payout.events).build() } } diff --git a/src/primitives/mod.rs b/src/primitives/mod.rs index defe8c11..eb85c657 100644 --- a/src/primitives/mod.rs +++ b/src/primitives/mod.rs @@ -21,11 +21,11 @@ impl From for LedgerJournalId { Self::from(uuid::Uuid::from(id)) } } -es_entity::entity_id! { ProfileId, PayoutQueueId, WalletId, SigningSessionId } + +es_entity::entity_id! { ProfileId, PayoutQueueId, WalletId, SigningSessionId, PayoutId } crate::entity_id! { ProfileApiKeyId } crate::entity_id! { KeychainId } crate::entity_id! { SignerId } -crate::entity_id! { PayoutId } impl From for LedgerTransactionId { fn from(id: PayoutId) -> Self { From fa37fe8161ba6ecb74d147f06ece60d9dbb5888c Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 21 Jul 2025 17:21:03 +0530 Subject: [PATCH 30/65] chore: rename tests/e2e -> bats (#645) --- docs/demo.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/demo.md b/docs/demo.md index 71bca7d9..fa495fd2 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -27,9 +27,9 @@ ``` export PATH="${PATH}:$(pwd)/target/debug" ``` -* start the bria daemon with the [default configuration](../tests/e2e/bria.local.yml) and bootstrap +* start the bria daemon with the [default configuration](../bats/bria.local.yml) and bootstrap ``` - bria daemon --config ./tests/e2e/bria.local.yml postgres://user:password@127.0.0.1:5432/pg dev + bria daemon --config ./bats/bria.local.yml postgres://user:password@127.0.0.1:5432/pg dev ``` * open a new terminal and run direnv allow @@ -43,10 +43,10 @@ bitcoin_cli createwallet "default" bitcoin_cli generatetoaddress 200 "$(bitcoin_cli getnewaddress)" ``` -* create a bitcoind wallet using a [sample private descriptor](../tests/e2e/bitcoind_signer_descriptors.json) +* create a bitcoind wallet using a [sample private descriptor](../bats/bitcoind_signer_descriptors.json) ``` bitcoin_signer_cli createwallet "default" - bitcoin_signer_cli -rpcwallet=default importdescriptors "$(cat tests/e2e/bitcoind_signer_descriptors.json)" + bitcoin_signer_cli -rpcwallet=default importdescriptors "$(cat bats/bitcoind_signer_descriptors.json)" ``` * create a Bria account ``` From ccbf0b7250f04951d794b687a8cbaa5ba8af69d1 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 21 Jul 2025 18:45:34 +0530 Subject: [PATCH 31/65] refactor: update migration script to avoid redundant update (#646) * refactor: only update null account_ids * chore: add line at eof in migration --- ...29262c52daee5c203fe9e8886d4285bc683f3df6d.json | 15 --------------- ...unt_id_to_initialized_event_in_payout.down.sql | 2 +- ...count_id_to_initialized_event_in_payout.up.sql | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 .sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json diff --git a/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json b/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json deleted file mode 100644 index dde5752d..00000000 --- a/.sqlx/query-c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "UPDATE bria_xpubs SET account_id = $2 WHERE id = $1", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Uuid" - ] - }, - "nullable": [] - }, - "hash": "c82c51cebe981187eac5ed929262c52daee5c203fe9e8886d4285bc683f3df6d" -} diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql index 92680a16..fae7254f 100644 --- a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql +++ b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql @@ -1,3 +1,3 @@ UPDATE bria_payout_events SET event = event - 'account_id' -WHERE event ? 'account_id' AND event_type = 'initialized'; \ No newline at end of file +WHERE event ? 'account_id' AND event_type = 'initialized'; diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql index 294592b4..c1f1decc 100644 --- a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql +++ b/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql @@ -6,4 +6,4 @@ SET event = jsonb_set( ) FROM bria_payouts p WHERE bria_payout_events.id = p.id -AND event_type = 'initialized'; +AND event_type = 'initialized' AND event->>'account_id' IS NULL; From e397b9fb6654b80764f041f78b4a252b1dc76323 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Thu, 24 Jul 2025 14:12:47 +0530 Subject: [PATCH 32/65] refactor: use was_not_found for entity errors (#647) --- src/api/server/convert.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index b4bc5a75..398daf99 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -652,18 +652,15 @@ impl From for proto::WalletAddress { impl From for tonic::Status { fn from(err: ApplicationError) -> Self { - use crate::{ - address::error::*, payout::error::*, payout_queue::error::*, profile::error::*, - wallet::error::*, - }; + use crate::{address::error::*, payout::error::*, profile::error::*, wallet::error::*}; match err { ApplicationError::ProfileError(ProfileError::ProfileKeyNotFound) => { tonic::Status::unauthenticated(err.to_string()) } - ApplicationError::WalletError(WalletError::EsEntityError( - es_entity::EsEntityError::NotFound, - )) => tonic::Status::not_found(err.to_string()), + ApplicationError::WalletError(err) if err.was_not_found() => { + tonic::Status::not_found(err.to_string()) + } ApplicationError::AddressError(AddressError::ExternalIdNotFound) => { tonic::Status::not_found(err.to_string()) } @@ -673,12 +670,12 @@ impl From for tonic::Status { ApplicationError::AddressError(AddressError::ExternalIdAlreadyExists) => { tonic::Status::already_exists(err.to_string()) } - ApplicationError::PayoutQueueError(PayoutQueueError::EsEntityError( - es_entity::EsEntityError::NotFound, - )) => tonic::Status::not_found(err.to_string()), - ApplicationError::ProfileError(ProfileError::EsEntityError( - es_entity::EsEntityError::NotFound, - )) => tonic::Status::not_found(err.to_string()), + ApplicationError::PayoutQueueError(err) if err.was_not_found() => { + tonic::Status::not_found(err.to_string()) + } + ApplicationError::ProfileError(err) if err.was_not_found() => { + tonic::Status::not_found(err.to_string()) + } ApplicationError::PayoutError(err) if err.was_not_found() => { tonic::Status::not_found(err.to_string()) } From b6420015cf031554218f0457dd8376b7cdd757cd Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Mon, 28 Jul 2025 13:26:32 +0530 Subject: [PATCH 33/65] refactor: use es_entity for address entity (#644) * refactor: migrate address entity to use es_entity framework * chore: pass check-code * chore: add comments and review * chore: use correct order of use declarations * refactor: use dbop where needed and reduce diffs * chore: remove diffs * refactor: use was_not_found fn * refactor: use accessor to transform into PgKeychainKind * refactor: address pr review * chore: remove unused event traits, now using es-entity * refactor: use the builder name attribute * refactor: use es_entity attribute for factory name * refactor: move tx->dbop conversion to appropriate files * chore: remove pub modifier from 'kind' field --------- Co-authored-by: bodymindarts --- ...fb66c58bb9b15d48c2e46fd4a050c5e20ff76.json | 16 -- ...0f008830de25f22bb878582e359d146f6a622.json | 41 ++++ ...0b3e4e88ad5366c3786521de9a9abe20f59d.json} | 7 +- ...c753a4c8adf0388952209234146921d065fad.json | 18 ++ ...e7a3ca464d37c95cf18857ec06208b1947ce4.json | 41 ++++ ...725da08b9cf49592d34d4cacd1e858455b293.json | 42 ++++ ...14af5f1023374eb6265bc22bceeb1d4f7c7fb.json | 40 +++ ...fc25b669d3f054b4b312d9b00f768d8487964.json | 40 +++ ...00b9a2d9a2bce05e1d770a28a659eb56e527c.json | 50 ++++ ...3999766253a1586805ad303d08353283d4916.json | 40 +++ ...8d5c3231904ff40f8074cb16403066a8d39a.json} | 15 +- ...d76bf3ac9e8264d2b8dbc9abe7799fea73623.json | 40 +++ ...54d10632d96210d4dd59e4eeba1fd71117348.json | 35 --- ...dbdb061baed03dcd7c233ac0be500725ec965.json | 41 ++++ ...ff8625492bbe3ce21e7aa12c1c4bbd43cc5e3.json | 35 --- ...13c70b47f006b9fb5b06bd9edb1c525f1da9c.json | 43 ++++ ...5435267dd848fa62582977b5c29ee44f809e2.json | 40 +++ ...ae57e42c74ddf44aa7cf4189919e1768737eb.json | 40 +++ ...a960bdd536ba5ca43d630252abb09506e7b46.json | 40 +++ ...0cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json | 41 ++++ ...ae7a62917c4232087f03654204f9f99ec31a0.json | 42 ++++ ...600e687e5a4a83963fc03f9057ad7922dcd4b.json | 18 ++ ...27018785b3968859146cdf0352ee2f4c3efea.json | 15 ++ src/address/entity.rs | 46 ++-- src/address/error.rs | 12 +- src/address/repo.rs | 232 ++++++++---------- src/api/server/convert.rs | 5 +- src/app/mod.rs | 10 +- src/batch/repo.rs | 6 +- src/entity/event.rs | 117 --------- src/entity/mod.rs | 2 - src/job/sync_wallet.rs | 26 +- src/outbox/augmentation.rs | 2 +- src/utxo/mod.rs | 8 +- tests/application_errors.rs | 6 +- 35 files changed, 843 insertions(+), 409 deletions(-) delete mode 100644 .sqlx/query-03a7f3a2c86a0415f054e409f30fb66c58bb9b15d48c2e46fd4a050c5e20ff76.json create mode 100644 .sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json rename .sqlx/{query-52f5cc540e8fc84b86957397d59684b8049ed1342f4050e7d9a7a9f2553ba4cf.json => query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json} (60%) create mode 100644 .sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json create mode 100644 .sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json create mode 100644 .sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json create mode 100644 .sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json create mode 100644 .sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json create mode 100644 .sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json create mode 100644 .sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json rename .sqlx/{query-f4c6df4bfca4287add9b9f19df9d2555cc6a3917021892dd7a32652d0fa3637d.json => query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json} (50%) create mode 100644 .sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json delete mode 100644 .sqlx/query-7c0ecd129f976df38b788e7e89b54d10632d96210d4dd59e4eeba1fd71117348.json create mode 100644 .sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json delete mode 100644 .sqlx/query-8dba7efce7de6cbe27b17bae89eff8625492bbe3ce21e7aa12c1c4bbd43cc5e3.json create mode 100644 .sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json create mode 100644 .sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json create mode 100644 .sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json create mode 100644 .sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json create mode 100644 .sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json create mode 100644 .sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json create mode 100644 .sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json create mode 100644 .sqlx/query-f52220882898fd73d3aa6448a4927018785b3968859146cdf0352ee2f4c3efea.json delete mode 100644 src/entity/event.rs diff --git a/.sqlx/query-03a7f3a2c86a0415f054e409f30fb66c58bb9b15d48c2e46fd4a050c5e20ff76.json b/.sqlx/query-03a7f3a2c86a0415f054e409f30fb66c58bb9b15d48c2e46fd4a050c5e20ff76.json deleted file mode 100644 index 55abcf08..00000000 --- a/.sqlx/query-03a7f3a2c86a0415f054e409f30fb66c58bb9b15d48c2e46fd4a050c5e20ff76.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "UPDATE bria_addresses\n SET external_id = $1\n WHERE account_id = $2 AND address = $3", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Varchar", - "Uuid", - "Text" - ] - }, - "nullable": [] - }, - "hash": "03a7f3a2c86a0415f054e409f30fb66c58bb9b15d48c2e46fd4a050c5e20ff76" -} diff --git a/.sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json b/.sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json new file mode 100644 index 00000000..6161c38b --- /dev/null +++ b/.sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622" +} diff --git a/.sqlx/query-52f5cc540e8fc84b86957397d59684b8049ed1342f4050e7d9a7a9f2553ba4cf.json b/.sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json similarity index 60% rename from .sqlx/query-52f5cc540e8fc84b86957397d59684b8049ed1342f4050e7d9a7a9f2553ba4cf.json rename to .sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json index 556f2f2a..d6d4dd9c 100644 --- a/.sqlx/query-52f5cc540e8fc84b86957397d59684b8049ed1342f4050e7d9a7a9f2553ba4cf.json +++ b/.sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_addresses\n (id, account_id, wallet_id, keychain_id, profile_id, address, kind, external_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8)", + "query": "INSERT INTO bria_addresses (id, wallet_id, account_id, keychain_id, profile_id, address, kind, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", "describe": { "columns": [], "parameters": { @@ -22,10 +22,11 @@ } } }, - "Varchar" + "Varchar", + "Timestamptz" ] }, "nullable": [] }, - "hash": "52f5cc540e8fc84b86957397d59684b8049ed1342f4050e7d9a7a9f2553ba4cf" + "hash": "0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d" } diff --git a/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json b/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json new file mode 100644 index 00000000..2e4324aa --- /dev/null +++ b/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_address_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Timestamptz", + "UuidArray", + "Int4Array", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad" +} diff --git a/.sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json b/.sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json new file mode 100644 index 00000000..e008fa19 --- /dev/null +++ b/.sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4" +} diff --git a/.sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json b/.sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json new file mode 100644 index 00000000..cf14e966 --- /dev/null +++ b/.sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293" +} diff --git a/.sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json b/.sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json new file mode 100644 index 00000000..9aeca857 --- /dev/null +++ b/.sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE wallet_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb" +} diff --git a/.sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json b/.sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json new file mode 100644 index 00000000..b2323303 --- /dev/null +++ b/.sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE account_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964" +} diff --git a/.sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json b/.sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json new file mode 100644 index 00000000..8100824d --- /dev/null +++ b/.sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json @@ -0,0 +1,50 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE kind = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + { + "Custom": { + "name": "keychainkind", + "kind": { + "Enum": [ + "external", + "internal" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c" +} diff --git a/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json b/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json new file mode 100644 index 00000000..a0d78a89 --- /dev/null +++ b/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE address = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916" +} diff --git a/.sqlx/query-f4c6df4bfca4287add9b9f19df9d2555cc6a3917021892dd7a32652d0fa3637d.json b/.sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json similarity index 50% rename from .sqlx/query-f4c6df4bfca4287add9b9f19df9d2555cc6a3917021892dd7a32652d0fa3637d.json rename to .sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json index 76fc3e00..ef5cda1d 100644 --- a/.sqlx/query-f4c6df4bfca4287add9b9f19df9d2555cc6a3917021892dd7a32652d0fa3637d.json +++ b/.sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT b.id, e.sequence, e.event\n FROM bria_addresses b\n JOIN bria_address_events e ON b.id = e.id\n WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external'\n ORDER BY b.created_at, b.id, sequence", + "query": "SELECT i.id AS \"id: Uuid\", e.sequence, e.event, e.recorded_at FROM bria_addresses i JOIN bria_address_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "id", + "name": "id: Uuid", "type_info": "Uuid" }, { @@ -17,19 +17,24 @@ "ordinal": 2, "name": "event", "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid", - "Uuid" + "UuidArray" ] }, "nullable": [ + false, false, false, false ] }, - "hash": "f4c6df4bfca4287add9b9f19df9d2555cc6a3917021892dd7a32652d0fa3637d" + "hash": "6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a" } diff --git a/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json b/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json new file mode 100644 index 00000000..12beaea3 --- /dev/null +++ b/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623" +} diff --git a/.sqlx/query-7c0ecd129f976df38b788e7e89b54d10632d96210d4dd59e4eeba1fd71117348.json b/.sqlx/query-7c0ecd129f976df38b788e7e89b54d10632d96210d4dd59e4eeba1fd71117348.json deleted file mode 100644 index 76d096ba..00000000 --- a/.sqlx/query-7c0ecd129f976df38b788e7e89b54d10632d96210d4dd59e4eeba1fd71117348.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.id, e.sequence, e.event\n FROM bria_addresses b\n JOIN bria_address_events e ON b.id = e.id\n WHERE account_id = $1 AND external_id = $2\n ORDER BY b.created_at, b.id, sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "7c0ecd129f976df38b788e7e89b54d10632d96210d4dd59e4eeba1fd71117348" -} diff --git a/.sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json b/.sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json new file mode 100644 index 00000000..ca7f3c58 --- /dev/null +++ b/.sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965" +} diff --git a/.sqlx/query-8dba7efce7de6cbe27b17bae89eff8625492bbe3ce21e7aa12c1c4bbd43cc5e3.json b/.sqlx/query-8dba7efce7de6cbe27b17bae89eff8625492bbe3ce21e7aa12c1c4bbd43cc5e3.json deleted file mode 100644 index d7d3532a..00000000 --- a/.sqlx/query-8dba7efce7de6cbe27b17bae89eff8625492bbe3ce21e7aa12c1c4bbd43cc5e3.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT b.id, e.sequence, e.event\n FROM bria_addresses b\n JOIN bria_address_events e ON b.id = e.id\n WHERE account_id = $1 AND address = $2\n ORDER BY b.created_at, b.id, sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "8dba7efce7de6cbe27b17bae89eff8625492bbe3ce21e7aa12c1c4bbd43cc5e3" -} diff --git a/.sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json b/.sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json new file mode 100644 index 00000000..a859710b --- /dev/null +++ b/.sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json @@ -0,0 +1,43 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external'\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c" +} diff --git a/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json b/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json new file mode 100644 index 00000000..e0482d3a --- /dev/null +++ b/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE keychain_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2" +} diff --git a/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json b/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json new file mode 100644 index 00000000..3f3aa786 --- /dev/null +++ b/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE external_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb" +} diff --git a/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json b/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json new file mode 100644 index 00000000..6d6da14f --- /dev/null +++ b/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE profile_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46" +} diff --git a/.sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json b/.sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json new file mode 100644 index 00000000..18255d9f --- /dev/null +++ b/.sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND address = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed" +} diff --git a/.sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json b/.sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json new file mode 100644 index 00000000..18212412 --- /dev/null +++ b/.sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json @@ -0,0 +1,42 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Uuid", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Int8", + "Uuid", + "Timestamptz" + ] + }, + "nullable": [ + false, + false, + false, + false + ] + }, + "hash": "d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0" +} diff --git a/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json b/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json new file mode 100644 index 00000000..950841b1 --- /dev/null +++ b/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json @@ -0,0 +1,18 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_address_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [] + }, + "hash": "ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b" +} diff --git a/.sqlx/query-f52220882898fd73d3aa6448a4927018785b3968859146cdf0352ee2f4c3efea.json b/.sqlx/query-f52220882898fd73d3aa6448a4927018785b3968859146cdf0352ee2f4c3efea.json new file mode 100644 index 00000000..ea6c35b5 --- /dev/null +++ b/.sqlx/query-f52220882898fd73d3aa6448a4927018785b3968859146cdf0352ee2f4c3efea.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_addresses SET external_id = $2 WHERE id = $1", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar" + ] + }, + "nullable": [] + }, + "hash": "f52220882898fd73d3aa6448a4927018785b3968859146cdf0352ee2f4c3efea" +} diff --git a/src/address/entity.rs b/src/address/entity.rs index a3378c61..c37188ec 100644 --- a/src/address/entity.rs +++ b/src/address/entity.rs @@ -1,13 +1,12 @@ use derive_builder::Builder; +use es_entity::*; use serde::{Deserialize, Serialize}; -use crate::{ - entity::*, - primitives::{bitcoin::*, *}, -}; +use crate::primitives::{bitcoin::*, *}; -#[derive(Debug, Serialize, Deserialize)] +#[derive(EsEvent, Debug, Serialize, Deserialize)] #[serde(tag = "type", rename_all = "snake_case")] +#[es_event(id = "uuid::Uuid")] pub enum AddressEvent { Initialized { db_uuid: uuid::Uuid, @@ -27,22 +26,23 @@ pub enum AddressEvent { }, } -#[derive(Debug, Builder)] -#[builder(pattern = "owned", build_fn(error = "EntityError"))] +#[derive(EsEntity, Builder)] +#[es_entity(event = AddressEvent, new = NewAddress)] +#[builder(pattern = "owned", build_fn(error = "EsEntityError"))] pub struct WalletAddress { pub account_id: AccountId, pub address: Address, pub wallet_id: WalletId, pub external_id: String, kind: KeychainKind, - pub(super) db_uuid: uuid::Uuid, + pub(super) id: uuid::Uuid, pub(super) events: EntityEvents, } impl WalletAddress { pub fn metadata(&self) -> Option<&serde_json::Value> { let mut ret = None; - for event in self.events.iter() { + for event in self.events.iter_all() { if let AddressEvent::MetadataUpdated { metadata } = event { ret = Some(metadata) } @@ -65,13 +65,13 @@ impl WalletAddress { } pub fn is_external(&self) -> bool { - self.kind == KeychainKind::External + matches!(self.kind, KeychainKind::External) } } #[derive(Builder, Clone, Debug)] pub struct NewAddress { - pub(super) db_uuid: uuid::Uuid, + pub(super) id: uuid::Uuid, #[builder(setter(custom))] pub(super) address: Address, #[builder(setter(into))] @@ -90,14 +90,16 @@ pub struct NewAddress { impl NewAddress { pub fn builder() -> NewAddressBuilder { let mut builder = NewAddressBuilder::default(); - builder.db_uuid(uuid::Uuid::new_v4()); + builder.id(uuid::Uuid::new_v4()); builder } +} - pub fn initial_events(self) -> EntityEvents { - let mut events = EntityEvents::init([ +impl IntoEvents for NewAddress { + fn into_events(self) -> EntityEvents { + let mut events = vec![ AddressEvent::Initialized { - db_uuid: self.db_uuid, + db_uuid: self.id, account_id: self.account_id, wallet_id: self.wallet_id, keychain_id: self.keychain_id, @@ -109,11 +111,11 @@ impl NewAddress { AddressEvent::ExternalIdUpdated { external_id: self.external_id, }, - ]); + ]; if let Some(metadata) = self.metadata { events.push(AddressEvent::MetadataUpdated { metadata }) } - events + EntityEvents::init(self.id, events) } } @@ -127,12 +129,10 @@ impl NewAddressBuilder { } } -impl TryFrom> for WalletAddress { - type Error = EntityError; - - fn try_from(events: EntityEvents) -> Result { +impl TryFromEvents for WalletAddress { + fn try_from_events(events: EntityEvents) -> Result { let mut builder = WalletAddressBuilder::default(); - for event in events.iter() { + for event in events.iter_all() { match event { AddressEvent::Initialized { db_uuid, @@ -143,7 +143,7 @@ impl TryFrom> for WalletAddress { .. } => { builder = builder - .db_uuid(*db_uuid) + .id(*db_uuid) .account_id(*account_id) .address(address.clone()) .wallet_id(*wallet_id) diff --git a/src/address/error.rs b/src/address/error.rs index 7caf0b2c..144f8fb3 100644 --- a/src/address/error.rs +++ b/src/address/error.rs @@ -4,16 +4,16 @@ use thiserror::Error; pub enum AddressError { #[error("AddressError - external_id already exists")] ExternalIdAlreadyExists, - #[error("AddressError - external_id does not exist")] - ExternalIdNotFound, - #[error("AddressError - Could not find address: {0}")] - AddressNotFound(String), #[error("AddressError - Sqlx: {0}")] Sqlx(sqlx::Error), - #[error("AddressError - EntityError: {0}")] - EntityError(#[from] crate::entity::EntityError), + #[error("ProfileError - EsEntityError: {0}")] + EsEntityError(es_entity::EsEntityError), + #[error("ProfileError - CursorDestructureError: {0}")] + CursorDestructureError(#[from] es_entity::CursorDestructureError), } +es_entity::from_es_entity_error!(AddressError); + impl From for AddressError { fn from(error: sqlx::Error) -> Self { if let Some(err) = error.as_database_error() { diff --git a/src/address/repo.rs b/src/address/repo.rs index fb23fabd..056cdb22 100644 --- a/src/address/repo.rs +++ b/src/address/repo.rs @@ -1,14 +1,34 @@ -use sqlx::{Pool, Postgres, Transaction}; - -use std::collections::HashMap; +use es_entity::*; +use sqlx::{Pool, Postgres}; +use uuid::Uuid; use super::{entity::*, error::AddressError}; -use crate::{ - entity::*, - primitives::{bitcoin::*, *}, -}; -#[derive(Clone)] +use crate::primitives::{bitcoin::*, *}; + +#[derive(EsRepo, Clone)] +#[es_repo( + entity = "WalletAddress", + event = "AddressEvent", + err = "AddressError", + tbl = "bria_addresses", + id = Uuid, + events_tbl = "bria_address_events", + columns( + wallet_id(ty = "WalletId", update(persist = false)), + account_id(ty = "AccountId", update(persist = false)), + keychain_id(ty = "KeychainId", update(persist = false)), + profile_id(ty = "Option", update(persist = false)), + address(ty = "String", create(accessor = "address.to_string()"), update(persist = false)), + kind( + ty = "pg::PgKeychainKind", + create(accessor = "kind.into()"), + update(persist = false) + ), + external_id(ty = "String") + ), + tbl_prefix = "bria" +)] pub struct Addresses { pool: Pool, } @@ -18,39 +38,16 @@ impl Addresses { Self { pool: pool.clone() } } - pub async fn persist_new_address(&self, address: NewAddress) -> Result<(), AddressError> { - let mut tx = self.pool.begin().await?; - sqlx::query!( - r#"INSERT INTO bria_addresses - (id, account_id, wallet_id, keychain_id, profile_id, address, kind, external_id) - VALUES ($1, $2, $3, $4, $5, $6, $7, $8)"#, - address.db_uuid, - address.account_id as AccountId, - address.wallet_id as WalletId, - address.keychain_id as KeychainId, - address.profile_id as Option, - address.address.to_string(), - pg::PgKeychainKind::from(address.kind) as pg::PgKeychainKind, - address.external_id, - ) - .execute(&mut *tx) - .await?; - - Self::persist_events(&mut tx, address).await?; - tx.commit().await?; - Ok(()) - } - pub async fn persist_if_not_present( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut DbOp<'_>, address: NewAddress, ) -> Result<(), AddressError> { let res = sqlx::query!( r#"INSERT INTO bria_addresses (id, account_id, wallet_id, keychain_id, profile_id, address, kind, external_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) ON CONFLICT DO NOTHING"#, - address.db_uuid, + address.id, address.account_id as AccountId, address.wallet_id as WalletId, address.keychain_id as KeychainId, @@ -59,52 +56,13 @@ impl Addresses { pg::PgKeychainKind::from(address.kind) as pg::PgKeychainKind, address.external_id, ) - .execute(&mut **tx) + .execute(&mut **op.tx()) .await?; if res.rows_affected() == 0 { return Ok(()); } - Self::persist_events(tx, address).await - } - - pub async fn update(&self, address: WalletAddress) -> Result<(), AddressError> { - if !address.events.is_dirty() { - return Ok(()); - } - - let mut tx = self.pool.begin().await?; - sqlx::query!( - r#"UPDATE bria_addresses - SET external_id = $1 - WHERE account_id = $2 AND address = $3"#, - address.external_id, - address.account_id as AccountId, - address.address.to_string() - ) - .execute(&mut *tx) - .await?; - EntityEvents::::persist( - "bria_address_events", - &mut tx, - address.events.new_serialized_events(address.db_uuid), - ) - .await?; - tx.commit().await?; - Ok(()) - } - - async fn persist_events( - tx: &mut Transaction<'_, Postgres>, - address: NewAddress, - ) -> Result<(), AddressError> { - let id = address.db_uuid; - EntityEvents::::persist( - "bria_address_events", - tx, - address.initial_events().new_serialized_events(id), - ) - .await?; + self.persist_events(op, &mut address.into_events()).await?; Ok(()) } @@ -113,90 +71,92 @@ impl Addresses { account_id: AccountId, wallet_id: WalletId, ) -> Result, AddressError> { - let rows = sqlx::query!( - r#" - SELECT b.id, e.sequence, e.event - FROM bria_addresses b - JOIN bria_address_events e ON b.id = e.id - WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external' - ORDER BY b.created_at, b.id, sequence"#, - account_id as AccountId, - wallet_id as WalletId - ) - .fetch_all(&self.pool) - .await?; - let mut entity_events = HashMap::new(); - let mut ids = Vec::new(); - for row in rows { - let id = row.id; - ids.push(id); - let events = entity_events - .entry(id) - .or_insert_with(EntityEvents::::new); - events.load_event(row.sequence as usize, row.event)?; - } - let mut ret = Vec::new(); - for id in ids { - if let Some(events) = entity_events.remove(&id) { - ret.push(WalletAddress::try_from(events)?); + let mut wallet_addresses = Vec::new(); + let mut query = es_entity::PaginatedQueryArgs::< + wallet_address_cursor::WalletAddressesByCreatedAtCursor, + > { + first: Default::default(), + after: None, + }; + loop { + let (id, created_at) = if let Some(after) = query.after { + (Some(after.id), Some(after.created_at)) + } else { + (None, None) + }; + + let (entities, has_next_page) = es_entity::es_query!( + entity_ty = WalletAddress, + id_ty = Uuid, + "bria", + &self.pool, + r#" + SELECT * + FROM bria_addresses + WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external' + AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL)) + ORDER BY created_at, id"#, + account_id as AccountId, + wallet_id as WalletId, + id, + created_at + ) + .fetch_n(query.first) + .await?; + + wallet_addresses.extend(entities); + + if !has_next_page { + break; } + query.after = wallet_addresses + .last() + .map(wallet_address_cursor::WalletAddressesByCreatedAtCursor::from); } - Ok(ret) + Ok(wallet_addresses) } - pub async fn find_by_address( + pub async fn find_by_account_id_and_address( &self, account_id: AccountId, address: String, ) -> Result { - let rows = sqlx::query!( + let wallet_address = es_entity::es_query!( + entity_ty = WalletAddress, + id_ty = Uuid, + "bria", + &self.pool, r#" - SELECT b.id, e.sequence, e.event - FROM bria_addresses b - JOIN bria_address_events e ON b.id = e.id - WHERE account_id = $1 AND address = $2 - ORDER BY b.created_at, b.id, sequence"#, + SELECT * + FROM bria_addresses + WHERE account_id = $1 AND address = $2"#, account_id as AccountId, - address + address.to_string() ) - .fetch_all(&self.pool) + .fetch_one() .await?; - - if rows.is_empty() { - return Err(AddressError::AddressNotFound(address)); - } - - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - Ok(WalletAddress::try_from(events)?) + Ok(wallet_address) } - pub async fn find_by_external_id( + pub async fn find_by_account_id_and_external_id( &self, account_id: AccountId, external_id: String, ) -> Result { - let rows = sqlx::query!( + let wallet_address = es_entity::es_query!( + entity_ty = WalletAddress, + id_ty = Uuid, + "bria", + &self.pool, r#" - SELECT b.id, e.sequence, e.event - FROM bria_addresses b - JOIN bria_address_events e ON b.id = e.id - WHERE account_id = $1 AND external_id = $2 - ORDER BY b.created_at, b.id, sequence"#, + SELECT * + FROM bria_addresses + WHERE account_id = $1 AND external_id = $2"#, account_id as AccountId, external_id ) - .fetch_all(&self.pool) + .fetch_one() .await?; - if rows.is_empty() { - return Err(AddressError::ExternalIdNotFound); - } - let mut events = EntityEvents::new(); - for row in rows { - events.load_event(row.sequence as usize, row.event)?; - } - Ok(WalletAddress::try_from(events)?) + Ok(wallet_address) } } diff --git a/src/api/server/convert.rs b/src/api/server/convert.rs index 398daf99..7bc1a32e 100644 --- a/src/api/server/convert.rs +++ b/src/api/server/convert.rs @@ -661,10 +661,7 @@ impl From for tonic::Status { ApplicationError::WalletError(err) if err.was_not_found() => { tonic::Status::not_found(err.to_string()) } - ApplicationError::AddressError(AddressError::ExternalIdNotFound) => { - tonic::Status::not_found(err.to_string()) - } - ApplicationError::AddressError(AddressError::AddressNotFound(_)) => { + ApplicationError::AddressError(err) if err.was_not_found() => { tonic::Status::not_found(err.to_string()) } ApplicationError::AddressError(AddressError::ExternalIdAlreadyExists) => { diff --git a/src/app/mod.rs b/src/app/mod.rs index 8d9967d0..b0a24191 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -514,7 +514,7 @@ impl App { builder.external_id(external_id); } let new_address = builder.build().expect("Couldn't build NewAddress"); - self.addresses.persist_new_address(new_address).await?; + self.addresses.create(new_address).await?; Ok((wallet.id, address)) } @@ -529,7 +529,7 @@ impl App { ) -> Result<(), ApplicationError> { let mut address = self .addresses - .find_by_address(profile.account_id, address) + .find_by_account_id_and_address(profile.account_id, address) .await?; if let Some(id) = new_external_id { address.update_external_id(id); @@ -537,7 +537,7 @@ impl App { if let Some(metadata) = new_metadata { address.update_metadata(metadata); } - self.addresses.update(address).await?; + self.addresses.update(&mut address).await?; Ok(()) } @@ -567,7 +567,7 @@ impl App { ) -> Result { let address = self .addresses - .find_by_external_id(profile.account_id, external_id) + .find_by_account_id_and_external_id(profile.account_id, external_id) .await?; Ok(address) } @@ -580,7 +580,7 @@ impl App { ) -> Result { let address = self .addresses - .find_by_address(profile.account_id, address) + .find_by_account_id_and_address(profile.account_id, address) .await?; Ok(address) } diff --git a/src/batch/repo.rs b/src/batch/repo.rs index 9c6b6d34..3c0bd5ba 100644 --- a/src/batch/repo.rs +++ b/src/batch/repo.rs @@ -212,7 +212,7 @@ impl Batches { &self, bitcoin_tx_id: bitcoin::Txid, wallet_id: WalletId, - ) -> Result, BatchInfo, LedgerTxId)>, BatchError> { + ) -> Result, BatchInfo, LedgerTxId)>, BatchError> { let mut tx = self.pool.begin().await?; let row = sqlx::query!( r#"WITH b AS ( @@ -242,7 +242,7 @@ impl Batches { let payout_queue_id = PayoutQueueId::from(row.payout_queue_id); if row.ledger_id.is_some() { return Ok(Some(( - tx, + es_entity::DbOp::new(tx, chrono::Utc::now()), BatchInfo { id: batch_id, payout_queue_id, @@ -265,7 +265,7 @@ impl Batches { .await?; Ok(Some(( - tx, + es_entity::DbOp::new(tx, chrono::Utc::now()), BatchInfo { id: batch_id, payout_queue_id, diff --git a/src/entity/event.rs b/src/entity/event.rs deleted file mode 100644 index f9e9f78c..00000000 --- a/src/entity/event.rs +++ /dev/null @@ -1,117 +0,0 @@ -use serde::{de::DeserializeOwned, Serialize}; - -use super::error::EntityError; - -#[derive(Debug)] -pub struct EntityEvents { - last_persisted_sequence: usize, - events: Vec, -} - -impl EntityEvents { - #[allow(clippy::new_without_default)] - pub fn new() -> Self { - Self { - last_persisted_sequence: 0, - events: Vec::new(), - } - } - - pub fn init(initial_events: impl IntoIterator) -> Self { - Self { - last_persisted_sequence: 0, - events: initial_events.into_iter().collect(), - } - } - - pub fn push(&mut self, event: T) { - self.events.push(event); - } - - pub fn iter(&self) -> impl DoubleEndedIterator { - self.events.iter() - } - - pub fn into_iter(self) -> impl DoubleEndedIterator { - self.events.into_iter() - } - - pub fn load_event( - &mut self, - sequence: usize, - json: serde_json::Value, - ) -> Result<(), EntityError> { - let event = serde_json::from_value(json)?; - self.last_persisted_sequence = sequence; - self.events.push(event); - Ok(()) - } - - pub fn new_serialized_events( - &self, - id: impl Into, - ) -> impl Iterator + '_ { - let id = id.into(); - self.events - .iter() - .enumerate() - .skip(self.last_persisted_sequence) - .map(move |(i, e)| { - let event_json = serde_json::to_value(e).expect("Could not serialize event"); - let event_type = event_json - .get("type") - .and_then(serde_json::Value::as_str) - .expect("Could not get type") - .to_owned(); - (id, (i + 1) as i32, event_type, event_json) - }) - } - - pub fn into_new_serialized_events( - self, - id: impl Into, - ) -> impl Iterator { - let id = id.into(); - self.events - .into_iter() - .enumerate() - .skip(self.last_persisted_sequence) - .map(move |(i, e)| { - let event_json = serde_json::to_value(e).expect("Could not serialize event"); - let event_type = event_json - .get("type") - .and_then(serde_json::Value::as_str) - .expect("Could not get type") - .to_owned(); - (id, (i + 1) as i32, event_type, event_json) - }) - } - - pub fn is_dirty(&self) -> bool { - self.last_persisted_sequence != self.events.len() - } - - pub async fn persist( - table_name: &str, - tx: &mut sqlx::Transaction<'_, sqlx::Postgres>, - events: impl Iterator + '_, - ) -> Result<(), sqlx::Error> { - let mut query_builder = sqlx::QueryBuilder::new(format!( - "INSERT INTO {table_name} (id, sequence, event_type, event)" - )); - query_builder.push_values(events, |mut builder, (id, sequence, event_type, event)| { - builder.push_bind(id); - builder.push_bind(sequence); - builder.push_bind(event_type); - builder.push_bind(event); - }); - let query = query_builder.build(); - query.execute(&mut **tx).await?; - Ok(()) - } - - #[cfg(test)] - pub fn last(&self, n: usize) -> &[T] { - &self.events[self.events.len() - n..] - } -} diff --git a/src/entity/mod.rs b/src/entity/mod.rs index 3641b5ad..2d1ca886 100644 --- a/src/entity/mod.rs +++ b/src/entity/mod.rs @@ -1,8 +1,6 @@ mod error; -mod event; pub use error::*; -pub use event::*; #[macro_export] macro_rules! entity_id { diff --git a/src/job/sync_wallet.rs b/src/job/sync_wallet.rs index ec14e931..8141bc32 100644 --- a/src/job/sync_wallet.rs +++ b/src/job/sync_wallet.rs @@ -158,7 +158,7 @@ pub async fn execute( .metadata(Some(address_metadata(&unsynced_tx.tx_id))) .build() .expect("Could not build new address in sync wallet"); - if let Some((pending_id, mut tx)) = deps + if let Some((pending_id, mut op)) = deps .bria_utxos .new_utxo_detected( data.account_id, @@ -175,12 +175,12 @@ pub async fn execute( { trackers.n_pending_utxos += 1; deps.bria_addresses - .persist_if_not_present(&mut tx, found_addr) + .persist_if_not_present(&mut op, found_addr) .await?; - bdk_utxos.mark_as_synced(&mut tx, &local_utxo).await?; + bdk_utxos.mark_as_synced(op.tx(), &local_utxo).await?; deps.ledger .utxo_detected( - tx, + op.into_tx(), pending_id, UtxoDetectedParams { journal_id: wallet.journal_id, @@ -257,13 +257,17 @@ pub async fn execute( } } if spend_tx { - let (mut tx, batch_info, tx_id) = if let Some((tx, create_batch, tx_id)) = batches + let (mut op, batch_info, tx_id) = if let Some((op, create_batch, tx_id)) = batches .set_batch_broadcast_ledger_tx_id(unsynced_tx.tx_id, wallet.id) .await? { - (tx, Some(create_batch), tx_id) + (op, Some(create_batch), tx_id) } else { - (pool.begin().await?, None, LedgerTransactionId::new()) + ( + es_entity::DbOp::new(pool.begin().await?, chrono::Utc::now()), + None, + LedgerTransactionId::new(), + ) }; let mut change_utxos = Vec::new(); @@ -282,7 +286,7 @@ pub async fn execute( .build() .expect("Could not build new address in sync wallet"); deps.bria_addresses - .persist_if_not_present(&mut tx, found_addr) + .persist_if_not_present(&mut op, found_addr) .await?; change_utxos.push((utxo, address_info)); } @@ -290,7 +294,7 @@ pub async fn execute( if let Some((settled_sats, allocations)) = deps .bria_utxos .spend_detected( - &mut tx, + op.tx(), data.account_id, wallet.id, keychain_id, @@ -315,7 +319,7 @@ pub async fn execute( { deps.ledger .batch_broadcast( - tx, + op.into_tx(), created_ledger_tx_id, tx_id, fees_to_encumber, @@ -337,7 +341,7 @@ pub async fn execute( .await?; deps.ledger .spend_detected( - tx, + op.into_tx(), tx_id, SpendDetectedParams { journal_id: wallet.journal_id, diff --git a/src/outbox/augmentation.rs b/src/outbox/augmentation.rs index 7e2daa66..a8867959 100644 --- a/src/outbox/augmentation.rs +++ b/src/outbox/augmentation.rs @@ -46,7 +46,7 @@ impl Augmenter { } => { let address_info = self .addresses - .find_by_address(account_id, address.to_string()) + .find_by_account_id_and_address(account_id, address.to_string()) .await?; Ok(Augmentation { address: Some(AddressAugmentation { diff --git a/src/utxo/mod.rs b/src/utxo/mod.rs index 21d2ece6..ff3a2621 100644 --- a/src/utxo/mod.rs +++ b/src/utxo/mod.rs @@ -43,7 +43,7 @@ impl Utxos { origin_tx_vbytes: u64, self_pay: bool, current_block_height: u32, - ) -> Result)>, UtxoError> { + ) -> Result)>, UtxoError> { let new_utxo = NewUtxo::builder() .account_id(account_id) .wallet_id(wallet_id) @@ -61,9 +61,9 @@ impl Utxos { .self_pay(self_pay) .build() .expect("Could not build NewUtxo"); - let mut tx = self.pool.begin().await?; - let tx_id = self.utxos.persist_utxo(&mut tx, new_utxo).await?; - Ok(tx_id.map(|id| (id, tx))) + let mut op = es_entity::DbOp::new(self.pool.begin().await?, chrono::Utc::now()); + let tx_id = self.utxos.persist_utxo(op.tx(), new_utxo).await?; + Ok(tx_id.map(|id| (id, op))) } #[instrument(name = "utxos.settle_utxo", skip(self, tx), err)] diff --git a/tests/application_errors.rs b/tests/application_errors.rs index 93cf56c5..e9344974 100644 --- a/tests/application_errors.rs +++ b/tests/application_errors.rs @@ -24,9 +24,9 @@ async fn external_id_does_not_exist() -> anyhow::Result<()> { assert!(matches!( err, - Err(ApplicationError::AddressError( - AddressError::ExternalIdNotFound - )) + Err(ApplicationError::AddressError(AddressError::EsEntityError( + EsEntityError::NotFound + ))) )); Ok(()) From f9b3ba30ccbccaa89e3ca413cfff29387ea409b5 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Fri, 8 Aug 2025 14:00:02 +0530 Subject: [PATCH 34/65] refactor: use accessor to convert to compatible types (#649) --- src/signing_session/repo.rs | 2 +- src/xpub/repo.rs | 22 +++------------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/signing_session/repo.rs b/src/signing_session/repo.rs index 5ea58fd6..4c2341cf 100644 --- a/src/signing_session/repo.rs +++ b/src/signing_session/repo.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; columns( batch_id(ty = "BatchId", update(persist = false)), account_id(ty = "AccountId", update(persist = false)), - xpub_fingerprint(ty = "XPubFingerprint", update(persist = false)) + xpub_fingerprint(ty = "[u8;4]", create(accessor = xpub_fingerprint.to_bytes()), update(persist = false)) ), tbl_prefix = "bria" )] diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index 2b789e72..deddcc45 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -1,5 +1,5 @@ use es_entity::*; -use sqlx::{Database, Encode, Pool, Postgres}; +use sqlx::{Pool, Postgres}; use std::collections::HashMap; use uuid::Uuid; @@ -17,8 +17,8 @@ use crate::primitives::*; events_tbl = "bria_xpub_events", columns( account_id(ty = "AccountId", list_for, update(persist = false)), - name(ty = "String", update(persist=false), create(accessor=key_name())), - fingerprint(ty = "XPubFingerprint", create(accessor=fingerprint()), update(persist = false)) + name(ty = "String", update(persist = false), create(accessor = key_name())), + fingerprint(ty = "[u8;4]", create(accessor = value.fingerprint().to_bytes()), update(persist = false)) ), tbl_prefix = "bria" )] @@ -26,22 +26,6 @@ pub struct XPubs { pool: Pool, } -impl Encode<'_, Postgres> for XPubFingerprint { - fn encode_by_ref( - &self, - buf: &mut ::ArgumentBuffer<'_>, - ) -> Result> { - let bytes = self.to_bytes(); - bytes.encode_by_ref(buf) - } -} - -impl sqlx::Type for XPubFingerprint { - fn type_info() -> ::TypeInfo { - sqlx::postgres::PgTypeInfo::with_name("BYTEA") - } -} - impl XPubs { pub fn new(pool: &Pool) -> Self { Self { pool: pool.clone() } From 413b75b8839f20acd1fc8e8a9226b2136f74a283 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Fri, 8 Aug 2025 10:36:27 +0200 Subject: [PATCH 35/65] Revert "refactor: use accessor to convert to compatible types (#649)" (#650) This reverts commit f9b3ba30ccbccaa89e3ca413cfff29387ea409b5. --- src/signing_session/repo.rs | 2 +- src/xpub/repo.rs | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/signing_session/repo.rs b/src/signing_session/repo.rs index 4c2341cf..5ea58fd6 100644 --- a/src/signing_session/repo.rs +++ b/src/signing_session/repo.rs @@ -13,7 +13,7 @@ use std::collections::HashMap; columns( batch_id(ty = "BatchId", update(persist = false)), account_id(ty = "AccountId", update(persist = false)), - xpub_fingerprint(ty = "[u8;4]", create(accessor = xpub_fingerprint.to_bytes()), update(persist = false)) + xpub_fingerprint(ty = "XPubFingerprint", update(persist = false)) ), tbl_prefix = "bria" )] diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index deddcc45..2b789e72 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -1,5 +1,5 @@ use es_entity::*; -use sqlx::{Pool, Postgres}; +use sqlx::{Database, Encode, Pool, Postgres}; use std::collections::HashMap; use uuid::Uuid; @@ -17,8 +17,8 @@ use crate::primitives::*; events_tbl = "bria_xpub_events", columns( account_id(ty = "AccountId", list_for, update(persist = false)), - name(ty = "String", update(persist = false), create(accessor = key_name())), - fingerprint(ty = "[u8;4]", create(accessor = value.fingerprint().to_bytes()), update(persist = false)) + name(ty = "String", update(persist=false), create(accessor=key_name())), + fingerprint(ty = "XPubFingerprint", create(accessor=fingerprint()), update(persist = false)) ), tbl_prefix = "bria" )] @@ -26,6 +26,22 @@ pub struct XPubs { pool: Pool, } +impl Encode<'_, Postgres> for XPubFingerprint { + fn encode_by_ref( + &self, + buf: &mut ::ArgumentBuffer<'_>, + ) -> Result> { + let bytes = self.to_bytes(); + bytes.encode_by_ref(buf) + } +} + +impl sqlx::Type for XPubFingerprint { + fn type_info() -> ::TypeInfo { + sqlx::postgres::PgTypeInfo::with_name("BYTEA") + } +} + impl XPubs { pub fn new(pool: &Pool) -> Self { Self { pool: pool.clone() } From 9662210ca72ddbeda2c59a6ae13a0c4973dfdf08 Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Wed, 13 Aug 2025 14:58:37 +0530 Subject: [PATCH 36/65] chore: bump flake (#652) --- flake.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/flake.lock b/flake.lock index 01ea5c28..955154df 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1747179050, - "narHash": "sha256-qhFMmDkeJX9KJwr5H32f1r7Prs7XbQWtO0h3V0a0rFY=", + "lastModified": 1754725699, + "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "adaa24fbf46737f3f1b5497bf64bae750f82942e", + "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", "type": "github" }, "original": { @@ -48,11 +48,11 @@ ] }, "locked": { - "lastModified": 1747332411, - "narHash": "sha256-2LOxMLddhMoJphMU/72Ls6Rvp38aJUrp7OhWwyvslek=", + "lastModified": 1754966322, + "narHash": "sha256-7f/LH60DnjjQVKbXAsHIniGaU7ixVM7eWU3hyjT24YI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "10d4529b7ead35863caa77993915104345524bed", + "rev": "7c13cec2e3828d964b9980d0ffd680bd8d4dce90", "type": "github" }, "original": { From 3a94577aebf11b323b6561d4e054a700a72519f0 Mon Sep 17 00:00:00 2001 From: Jojo Sutton Date: Mon, 15 Sep 2025 10:44:28 -0500 Subject: [PATCH 37/65] chore(deps): bump tracing-subscriber from 0.3.18 to 0.3.20 (#655) * chore(deps): bump tracing-subscriber from 0.3.18 to 0.3.20 * chore: remove unused code --- Cargo.lock | 62 ++++++++++++------------------------ Cargo.toml | 2 +- src/bdk/pg/script_pubkeys.rs | 21 ------------ src/bdk/pg/transactions.rs | 14 -------- 4 files changed, 21 insertions(+), 78 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 27985b0e..29ede46f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1953,7 +1953,7 @@ dependencies = [ "petgraph", "pico-args", "regex", - "regex-syntax 0.8.5", + "regex-syntax", "sha3", "string_cache", "term", @@ -1967,7 +1967,7 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "feee752d43abd0f4807a921958ab4131f692a44d4d599733d4419c5d586176ce" dependencies = [ - "regex-automata 0.4.9", + "regex-automata", "rustversion", ] @@ -2032,11 +2032,11 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -2113,12 +2113,11 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" dependencies = [ - "overload", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -2277,12 +2276,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - [[package]] name = "parking" version = "2.2.1" @@ -2787,17 +2780,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -2808,15 +2792,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -4230,9 +4208,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -4242,9 +4220,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", @@ -4292,9 +4270,9 @@ dependencies = [ [[package]] name = "tracing-serde" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +checksum = "704b1aeb7be0d0a84fc9828cae51dab5970fee5088f83d1dd7ee6f6246fc6ff1" dependencies = [ "serde", "tracing-core", @@ -4302,14 +4280,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "serde", "serde_json", "sharded-slab", diff --git a/Cargo.toml b/Cargo.toml index dfebea18..7c0413b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ opentelemetry-otlp = { version = "0.27.0", features = [ ] } tracing = "0.1.40" tracing-opentelemetry = "0.28.0" -tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] } +tracing-subscriber = { version = "0.3.20", features = ["env-filter", "json"] } serde_with = "3.8.1" electrum-client = "0.18.0" reqwest = { version = "0.12.5", default-features = false, features = [ diff --git a/src/bdk/pg/script_pubkeys.rs b/src/bdk/pg/script_pubkeys.rs index c47fa956..b7dcc6b0 100644 --- a/src/bdk/pg/script_pubkeys.rs +++ b/src/bdk/pg/script_pubkeys.rs @@ -93,27 +93,6 @@ impl ScriptPubkeys { Ok(ret) } - #[instrument(name = "bdk.script_pubkeys.find_path", skip_all)] - pub async fn find_path( - &self, - script: &ScriptBuf, - ) -> Result, bdk::Error> { - let rows = sqlx::query!( - r#"SELECT keychain_kind as "keychain_kind: BdkKeychainKind", path FROM bdk_script_pubkeys - WHERE keychain_id = $1 AND script_hex = ENCODE($2, 'hex')"#, - Uuid::from(self.keychain_id), - script.as_bytes(), - ) - .fetch_all(&self.pool) - .await - .map_err(|e| bdk::Error::Generic(e.to_string()))?; - if let Some(row) = rows.into_iter().next() { - Ok(Some((row.keychain_kind, row.path as u32))) - } else { - Ok(None) - } - } - #[instrument(name = "bdk.script_pubkeys.list_scripts", skip_all)] pub async fn list_scripts( &self, diff --git a/src/bdk/pg/transactions.rs b/src/bdk/pg/transactions.rs index cc873ae2..d771bc2c 100644 --- a/src/bdk/pg/transactions.rs +++ b/src/bdk/pg/transactions.rs @@ -86,20 +86,6 @@ impl Transactions { })) } - #[instrument(name = "bdk.transactions.find_by_id", skip_all)] - pub async fn find_by_id(&self, tx_id: &Txid) -> Result, bdk::Error> { - let tx = sqlx::query!( - r#" - SELECT details_json FROM bdk_transactions WHERE keychain_id = $1 AND tx_id = $2 AND deleted_at IS NULL"#, - self.keychain_id as KeychainId, - tx_id.to_string(), - ) - .fetch_optional(&self.pool) - .await - .map_err(|e| bdk::Error::Generic(e.to_string()))?; - Ok(tx.map(|tx| serde_json::from_value(tx.details_json).unwrap())) - } - #[instrument(name = "bdk.transactions.load_all", skip(self), fields(n_rows))] pub async fn load_all(&self) -> Result, bdk::Error> { let txs = sqlx::query!( From 118048f46c6ae1b4f9bdc485156b70a8bb3ddb35 Mon Sep 17 00:00:00 2001 From: Jojo Sutton Date: Thu, 18 Sep 2025 13:25:44 -0500 Subject: [PATCH 38/65] fix(postgres): addressed trailing junk error introduced in 15.x (#654) * fix(utxo): psql syntax used in querybuilder in reserve_utxos_in_batch for postgres 15.x * chore: update postgres to 15.x * fix: ensure uuid_nil() exists * fix: various postgres 15.x syntax issues * chore(deps): bump tracing-subscriber to pass cargo audit * refactor: slim down changes per offline review of @bodymindarts * test(e2e): get mempool image running for fees * chore: don't set a strict timeout on mempool waiting for db * chore: move retries to flaky test only --- .gitignore | 1 + bats/bitcoind_sync.bats | 2 ++ docker-compose.yml | 23 +++++++++++++++++++++-- src/utxo/repo.rs | 4 ++-- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 8204e01c..3a93029e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ - .direnv .env +.mempool_data result tmp .bacon-locations diff --git a/bats/bitcoind_sync.bats b/bats/bitcoind_sync.bats index 2799c971..15ee5767 100644 --- a/bats/bitcoind_sync.bats +++ b/bats/bitcoind_sync.bats @@ -14,6 +14,8 @@ teardown_file() { stop_daemon } +BATS_TEST_RETRIES=5 + @test "bitcoind_signer_sync: Generates the same address" { bitcoind_signer_address=$(bitcoin_signer_cli getnewaddress) bria_address=$(bria_cmd new-address -w default | jq -r '.address') diff --git a/docker-compose.yml b/docker-compose.yml index 04e70d5f..3f6cdeeb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -117,14 +117,33 @@ services: command: [ "Fulcrum", "/fulcrum.conf" ] mempool: image: mempool/backend - depends_on: [ bitcoind ] + depends_on: [ bitcoind, mempool_db ] environment: MEMPOOL_BACKEND: "none" CORE_RPC_HOST: bitcoind CORE_RPC_PORT: "18443" CORE_RPC_USERNAME: "rpcuser" CORE_RPC_PASSWORD: "rpcpassword" - DATABASE_ENABLED: "false" + DATABASE_ENABLED: "true" + DATABASE_HOST: "mempool_db" + DATABASE_USERNAME: "mempool" + DATABASE_PASSWORD: "mempool" + DATABASE_DATABASE: "mempool" + user: "1000:1000" + command: "./wait-for-it.sh mempool_db:3306 -- ./start.sh" + volumes: + - ${HOST_PROJECT_PATH:-.}/.mempool_data/backend:/backend/cache + mempool_db: + environment: + MYSQL_DATABASE: "mempool" + MYSQL_USER: "mempool" + MYSQL_PASSWORD: "mempool" + MYSQL_ROOT_PASSWORD: "admin" + image: mariadb:10.5.21 + user: "1000:1000" + restart: on-failure + volumes: + - ${HOST_PROJECT_PATH:-.}/.mempool_data/mysql:/var/lib/mysql volumes: cargo-cache: cargo-target: diff --git a/src/utxo/repo.rs b/src/utxo/repo.rs index 3246a6e3..4a10baa1 100644 --- a/src/utxo/repo.rs +++ b/src/utxo/repo.rs @@ -126,7 +126,7 @@ impl UtxoRepo { ); query_builder.push_bind(tx_id); query_builder - .push("WHERE spend_detected_ledger_tx_id IS NULL AND (keychain_id, tx_id, vout) IN"); + .push(" WHERE spend_detected_ledger_tx_id IS NULL AND (keychain_id, tx_id, vout) IN"); let mut n_inputs = 0; query_builder.push_tuples(utxos, |mut builder, out| { n_inputs += 1; @@ -311,7 +311,7 @@ impl UtxoRepo { query_builder.push_bind(payout_queue_id); query_builder.push(", spending_sats_per_vbyte = "); query_builder.push_bind(fee_rate.as_sat_per_vb()); - query_builder.push("WHERE account_id = "); + query_builder.push(" WHERE account_id = "); query_builder.push_bind(account_id); query_builder.push(" AND (keychain_id, tx_id, vout) IN"); query_builder.push_tuples( From 9beac1de81c9830df878e7a7fe99fa5bcc4b61c8 Mon Sep 17 00:00:00 2001 From: Lakshyyaa <99789174+Lakshyyaa@users.noreply.github.com> Date: Fri, 19 Sep 2025 12:20:52 +0530 Subject: [PATCH 39/65] refactor: use updated es-entity (#653) * refactor: update es_query, use impl in repo fn arguments * chore: bump flake * chore: update all repo fns use impl AtomicOperation * chore: get jobs back in old state * chore: remove entity module * chore: migration to add context to events * chore: fix typo * Revert "chore: remove entity module" This reverts commit 64f57ffa94704b342ffb704ee2dcee3fa141d7ff. * use existing entity module * chore: update ledger tests * chore: use pinned es-entity from github * chore: run sqlx prepare * chore: discard forked es-entity * chore: use tx_mut for ledger operations * chore: revert changes in ledger tests * chore: use query_as macro as hack * chore: remove lifetime * chore: use explicit reborrow * chore: run sqlx prepare * chore: remove wrong file --------- Co-authored-by: Vaibhav --- ...0bc1654a32b3bcd4948c49de4e56589e5d94.json} | 15 +- ...7ed7778c2a3fd2f7ff5e03849bc83e6a2574.json} | 15 +- ...cb54a97c0ce3dd889d31227af99fdbb8fb98.json} | 15 +- ...d45a852ca8a493a874d770ae8d4b0e4ad573.json} | 15 +- ...aa658670564a94034f84b0cc631ef1aa819f.json} | 15 +- ...8eb89949deb050faf4150d1aa031f109304f.json} | 15 +- ...7b22e4e7f5cb1b997e5df1e13995e82b5a0c.json} | 15 +- ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 -- ...691d40d037f6130a9d54e519c794fd8b048f.json} | 15 +- ...64893ce2bc37f4be3304bcfe2c461bd807bbc.json | 47 ++++++ ...82dc927d9bb9266bec606fb3954beedd74842.json | 47 ++++++ ...f9bd084e7239808f5f5797f9e290e9d604bb.json} | 15 +- ...e5dcdbba978e08423a33b075231a8832363a2.json | 47 ++++++ ...c01074f983bb9eb93018e618dea27e943334.json} | 15 +- ...8ec5221d958eacb931c0054d70fbec66c7c3.json} | 15 +- ...698186ec14fd4e857e3d32317967ac69ad2a.json} | 15 +- ...c753a4c8adf0388952209234146921d065fad.json | 18 --- ...0abc54fa407a5a5665e44639f99f8ab61455.json} | 15 +- ...7417409ba0aaedb5ebe5213decee968e79fe.json} | 15 +- ...ab1e304568264e004dec9b8b8cc306dfaee66.json | 82 ---------- ...98f6c850d40d8ce3ad64e7d7bbe53334e338.json} | 4 +- ...ce62142370967be1d42aeee59fd2952106fb.json} | 15 +- ...c5996b6bd136149b13e5df4babdd6c5be8a4.json} | 15 +- ...d8073c86dc835144a2f047a00224499f50021.json | 18 --- ...7cfebbd862dd59c592720e1fd340aeac32ec4.json | 18 --- ...cf633b0e7ffed5fcb0eb5b28dc5eb0a65b16.json} | 15 +- ...da40d51cd9a60fd7a255fd7ea209ed5a89357.json | 26 +++ ...f3e4456b4c9bda04f8c7b542d4e782054a51.json} | 15 +- ...df25de6db7fc79ea5277b1a672ebd44d0f19f.json | 18 --- ...ab7d7c8417180ae7c16440ba24fb80804509f.json | 39 ----- ...a5739c538023fac61baa64bf9da1b0d69a46.json} | 15 +- ...8d85df4b382e2465eba4808fa0846f5f62848.json | 18 --- ...49fb445d9fc56abfabc02da15a0283fab9d20.json | 18 --- ...9063f762d4efb4174d3eaf3795da7785f9c5.json} | 4 +- ...923a8619eb450a7c8e121324952d1c32950b.json} | 15 +- ...b3d3c9586e78ae50a78322a79124516af1cd.json} | 15 +- ...cc8e4c07dcafee002b768a02e2a82b414507.json} | 15 +- ...73f239f1b4c71b58b475e5c6bc1b66783d877.json | 47 ++++++ ...ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json | 18 --- ...6582000d822c85fade65952ab1e0fa30028a8.json | 18 --- ...e4373a02c02b4759749ed43a8814ce8454bed.json | 18 --- ...979ca28a59910bd5c8b7f09106a0f55247d9.json} | 15 +- ...f20dfef2d1cc2d2b680a173255dd17b36290.json} | 15 +- ...3373bdc25ad32843725868a5218678cdfff0.json} | 15 +- ...9948483fbf370cf28fc0d5736fc15da01acc3.json | 26 +++ ...b1940a601adcf8bcab6dbacd0d2befa1fc4c.json} | 15 +- ...b005975efe12df569e823b49bbd7b2688d52b.json | 23 --- ...aae5f9df159a10a96ea039ce50e7d0574bcc.json} | 15 +- ...1a943aacf384d483a205195fd54362179348.json} | 15 +- ...af625c162539dc7460bb9a99202e245192cb.json} | 15 +- ...8f145d4005a8b1de856a8664f00bab143e8ae.json | 47 ++++++ ...e8a14f63396dbce8ad30e9fe53211f08037b.json} | 4 +- ...3999766253a1586805ad303d08353283d4916.json | 40 ----- ...67d2d5d99783da25e3f0b812eb9f8140fd2ea.json | 18 --- ...c846b671d492594c4648a744923a9c698285d.json | 47 ++++++ ...e2ba0be98637ff24d795ecda1a2986dde453.json} | 15 +- ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 ----- ...5fb36c6e4a98a93b2b6d493b1ba70aa09ad2.json} | 15 +- ...fdec18f377bd0fc9d1d33c31f3f0b79d459d.json} | 15 +- ...e33e910a69ab164432e6cf4cbad42aabb6c8.json} | 15 +- ...5a4dcbcc639b64db76868f18c282496fd9d8.json} | 15 +- ...96ddaf5431985cacecc4ded972cbdd76c0ea0.json | 47 ++++++ ...73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f.json | 47 ++++++ ...d8d5c3231904ff40f8074cb16403066a8d39a.json | 40 ----- ...b3dd649758b5afcf70feb2a6eff7d69925bfc.json | 20 --- ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 ------ ...9d8087435b01729b10c9bf03d9fece190620.json} | 15 +- ...842a5247b8f632258c8344c78cf9eb63aadb7.json | 47 ++++++ ...944a11182e90c444f05d7590b2f8cf6388d4.json} | 15 +- ...6056af57b2963edfc3ca8d75bfc7927b8a28.json} | 15 +- ...d76bf3ac9e8264d2b8dbc9abe7799fea73623.json | 40 ----- ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 ------ ...34f1d2f3bc009f86e3f5c4f948392f077555.json} | 15 +- ...c67ca55a129d5c98b1a9bf0080d3ee0188fee.json | 26 +++ ...25ac25b90d86ae8cf2a0757c9b5fbc277559.json} | 15 +- ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 ------------------ ...559bf4f8df385640d94522c32af78c1d9f86.json} | 4 +- ...d98c7e2d5918b4c35509875a8c0f484868d1.json} | 15 +- ...59c634703516e9ea01223db85d95b4744870.json} | 15 +- ...99107e86eeb4e9c1c0884dbed1b39af235de3.json | 47 ++++++ ...b33bd35105facfcdea1a16bcb5cc8edb82b8.json} | 4 +- ...2a9e30acca15fdcf381dd6a89853f95960fef.json | 47 ++++++ ...2981e6f4172ce7b7b8d4d66ea8021cd6c88d4.json | 47 ++++++ ...3e5cc1946454643c6b5c883393ff712bd4824.json | 40 ----- ...a717e83e70970404850f745d94ed3e26b012.json} | 15 +- ...3e524b6fb53e4e52d80c90aeb6d27b59472b.json} | 15 +- ...540aedf3a772ffcf06983e57b85849a6920d.json} | 15 +- ...a615467540ce6400d8a1a0f281ebcfcb0914.json} | 15 +- ...035d1fbb1cb58570d3ffce6fdcd2ee98d7754.json | 47 ++++++ ...45f2216292d36205ea145014c06a4d795939.json} | 15 +- ...116983265d413065de43dbf1d1e00f483ef3e.json | 40 ----- ...7deabf19d4205592b96fd6e11594cc8ef027b.json | 47 ++++++ ...90f4ff385da85805ceb84ef85f0e217700964.json | 18 --- ...5f403d6ca6274a0d7816a8a2979943159c062.json | 82 ---------- ...e0bdfdc49d66dd759985b95a1779aeee93ae.json} | 15 +- ...7bc61d0784a24b3850ad29654d4682cc6ff2.json} | 15 +- ...ba25755874dcd529542e64ddf7ff141c38b58.json | 22 --- ...2ae2bceb907599767b008e62da99b3eda013.json} | 15 +- ...db794ebe87976c216efef7014d21ce8c4a35.json} | 15 +- ...68377a5773bcb133f94dbbd173f0f1c09e35f.json | 18 --- ...2c40bf51598dd23600aae6d9c0821d2299a8.json} | 15 +- ...4f667e58934943e5505f5835147fb062bb1d.json} | 15 +- ...55f425b4cfd6459e38c47a2d06c24ac95b19.json} | 15 +- ...95ccf865219ca3384909081a7003495d7ac7.json} | 15 +- ...7c34a4524341b8590da66bae227f628f1dc4.json} | 15 +- ...5435267dd848fa62582977b5c29ee44f809e2.json | 40 ----- ...5b59f2693c65024f5dc70323c5f7b3a84ecd.json} | 15 +- ...44561b6045c05d49299717b6f6421319d8da.json} | 4 +- ...1f602fc3983147a6121e7bd857b6f4b3196b.json} | 15 +- ...77389f5a2c1c9fe867561f81a6b2577cb9cd.json} | 15 +- ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 -------------- ...ae57e42c74ddf44aa7cf4189919e1768737eb.json | 40 ----- ...639208a9a3a4befb53d63dbbed098cf7f2b22.json | 47 ++++++ ...e1151b1738fa6a0f8566a6509081ace0f83f.json} | 15 +- ...97b8d33f3a020c7e6088d218a7094c8bc0b1.json} | 15 +- ...2afd3637ae78fa2c69041ac51c3967cb9ceb6.json | 40 ----- ...70fb7f1f8427ecd7ae3919c90ff031129a5c.json} | 15 +- ...860e548b73560822008f3de7f85d22c610cea.json | 47 ++++++ ...41b00f5f4500ffe5cb8aa5c60e6319cb93dad.json | 26 +++ ...ca4ca8db761aea38aa34397767a4533e80e2.json} | 15 +- ...a960bdd536ba5ca43d630252abb09506e7b46.json | 40 ----- ...7d5bdab8edf29399f48895ceb66f15cb1992.json} | 15 +- ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 ----------------- ...f4265b599b50f9d269997f76301653dd54ba6.json | 40 ----- ...17f58e2c94c16a48a5483f7496cd13c2a010d.json | 40 ----- ...1f9efd4a735ea07c8c8188304fddded337f0.json} | 15 +- ...18e2252327a5bfb302e719c426c95805b185.json} | 15 +- ...6827f7769e081d0f37a44a14aba4efff518ca.json | 47 ++++++ ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 ------- ...de6cb6592b242509fc929146e38497658e4b9.json | 40 ----- ...2db4c14c5ba76fba31b88c6816f212173b568.json | 26 +++ ...f108c86636b29d82e6dd378a8a3943d27c00.json} | 15 +- ...0c1e80629cae9b09138a36e773fbab222af9.json} | 15 +- ...e4147862a381e5a4a665d89ff939ed3202e8.json} | 15 +- ...fa3a4f1df8e71d1459e7889c5cc2450cec803.json | 82 ---------- ...dba8a541d306a675c9229ebb32878f574d01d.json | 40 ----- ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 ----- ...d44c94324abb4c1855ab9a55a68c4bc7183cb.json | 18 --- ...8d36d854264c3a256698fe19aba142ad1d356.json | 40 ----- ...65f98e396df5c8784ec265f14f39ecdbf8878.json | 26 +++ ...2e3c63f1ac297e60827a133507ab83a3d864f.json | 47 ++++++ ...485baf1435b1306562058c570ad5acc277d42.json | 22 --- ...7a784dbd155322d1378e7479f28f815ed3090.json | 40 ----- ...e835b4616603051412b695f9c5f88e652598f.json | 40 ----- ...440e35ceeac30413886efd8cba47dbf73bf3.json} | 15 +- ...d3b4d4ac0fe166f303ea904a1ae4167ecc26.json} | 15 +- ...500caacf0b694f71c5748702668d76ec0e6e.json} | 15 +- ...bf7c16227b5ad43c60ebc90c1d84d47d8218.json} | 15 +- ...ce3c53ef82885389267de4bd66a1e3f08d835.json | 40 ----- ...600e687e5a4a83963fc03f9057ad7922dcd4b.json | 18 --- ...c21894e41766195d55bb018f93d5180d51db4.json | 40 ----- ...243ea4eabbc9ec72f57c9b312f93864f9f6e.json} | 15 +- ...6025d7576b2db0921babc0ba5e9f894c777fc.json | 40 ----- ...1e21daf1b9f0057be6f197a2654b90bb6b5e.json} | 15 +- ...6c36acff3c8b20d9ef193e3c6d882d9cdf8e0.json | 47 ++++++ ...867f5f0b7da9571bd124597311d8d58e09cc.json} | 15 +- ...683989c95c6c87d45762aca3515e2961f954.json} | 15 +- ...816dda6607c8d306f9dfddcda69756561a3c.json} | 15 +- ...6ea59f9ad7dfb7daefe8c9ee3c57616f8e411.json | 26 +++ ...71921ebe2149abb550bf8b00d2018c02c820.json} | 15 +- ...00932f5b281df15f6984a9773061a967cb29.json} | 4 +- Cargo.lock | 147 +++++++++++++---- Cargo.toml | 3 +- ...50909142749_add_context_to_events.down.sql | 7 + ...0250909142749_add_context_to_events.up.sql | 7 + src/account/repo.rs | 8 +- src/address/repo.rs | 26 +-- src/admin/app.rs | 24 +-- src/app/mod.rs | 45 +++--- src/batch/repo.rs | 16 +- src/descriptor/repo.rs | 14 +- src/job/batch_signing.rs | 6 +- src/job/process_payout_queue.rs | 14 +- src/job/sync_wallet.rs | 26 ++- src/payout/repo.rs | 39 ++--- src/payout_queue/repo.rs | 5 +- src/profile/repo.rs | 11 +- src/signing_session/repo.rs | 13 +- src/utxo/mod.rs | 8 +- src/wallet/repo.rs | 5 +- src/xpub/repo.rs | 30 ++-- 181 files changed, 2211 insertions(+), 2564 deletions(-) rename .sqlx/{query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json => query-01266b0e2f33d1b1612b14e8b2270bc1654a32b3bcd4948c49de4e56589e5d94.json} (53%) rename .sqlx/{query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json => query-044e1fb61853894f16ac0e91b68d7ed7778c2a3fd2f7ff5e03849bc83e6a2574.json} (60%) rename .sqlx/{query-5943390333d30a4c8ce0555f2f302428f128207d75ace7eacada6db6354a75e0.json => query-05399525ae25b49630b203a708fdcb54a97c0ce3dd889d31227af99fdbb8fb98.json} (56%) rename .sqlx/{query-9cdd3b52d58a0f8d9952c2c70ad0b94f479a4b274921b1c34c20628fe19c1634.json => query-0e5fddf54f196b42026c713274e7d45a852ca8a493a874d770ae8d4b0e4ad573.json} (57%) rename .sqlx/{query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json => query-0ec68ead66afd6750ba3e7cb5d87aa658670564a94034f84b0cc631ef1aa819f.json} (57%) rename .sqlx/{query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json => query-118e50dac9417b77bb821bf64ef38eb89949deb050faf4150d1aa031f109304f.json} (58%) rename .sqlx/{query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json => query-11d100c94adcd4e0dbb1acb827437b22e4e7f5cb1b997e5df1e13995e82b5a0c.json} (57%) delete mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json rename .sqlx/{query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json => query-1a9d54b35bd2d6cc759478127e25691d40d037f6130a9d54e519c794fd8b048f.json} (59%) create mode 100644 .sqlx/query-1ac621a8ce19e3bd37d80e8c47564893ce2bc37f4be3304bcfe2c461bd807bbc.json create mode 100644 .sqlx/query-1bd933fc3fa4865e08bc0c3275e82dc927d9bb9266bec606fb3954beedd74842.json rename .sqlx/{query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json => query-1e4260ff3d905155725d101e4c99f9bd084e7239808f5f5797f9e290e9d604bb.json} (53%) create mode 100644 .sqlx/query-21cab8d30e477cd1e67fa8f383fe5dcdbba978e08423a33b075231a8832363a2.json rename .sqlx/{query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json => query-24126c8a99b07e414f6a01bd5134c01074f983bb9eb93018e618dea27e943334.json} (59%) rename .sqlx/{query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json => query-24335a859b72745eb385891c6d5d8ec5221d958eacb931c0054d70fbec66c7c3.json} (57%) rename .sqlx/{query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json => query-24db1c5fa667f489cfbcda3ab832698186ec14fd4e857e3d32317967ac69ad2a.json} (59%) delete mode 100644 .sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json rename .sqlx/{query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json => query-259c8d203542581ea7f2dced50c10abc54fa407a5a5665e44639f99f8ab61455.json} (58%) rename .sqlx/{query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json => query-279d5f7d7d21b641b5c6352f62d37417409ba0aaedb5ebe5213decee968e79fe.json} (63%) delete mode 100644 .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json rename .sqlx/{query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json => query-290697d21826c0cf91ed115e04aa98f6c850d40d8ce3ad64e7d7bbe53334e338.json} (68%) rename .sqlx/{query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json => query-2a3a40f8b01cb161ca8ad94b3441ce62142370967be1d42aeee59fd2952106fb.json} (59%) rename .sqlx/{query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json => query-2c9a8151247c14fd011897d7f753c5996b6bd136149b13e5df4babdd6c5be8a4.json} (58%) delete mode 100644 .sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json delete mode 100644 .sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json rename .sqlx/{query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json => query-32472ea9a6598dbd856420172ddbcf633b0e7ffed5fcb0eb5b28dc5eb0a65b16.json} (56%) create mode 100644 .sqlx/query-32ff4078f342d5337ba35916aedda40d51cd9a60fd7a255fd7ea209ed5a89357.json rename .sqlx/{query-49f7f209d2720a06c3efe0a0b3e7fdf770f9c2aee224b2f3a3789efb53599f8d.json => query-3380cc0e4ce5ce20579249dc342cf3e4456b4c9bda04f8c7b542d4e782054a51.json} (56%) delete mode 100644 .sqlx/query-34da8604f234696305d59a19fe7df25de6db7fc79ea5277b1a672ebd44d0f19f.json delete mode 100644 .sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json rename .sqlx/{query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json => query-3620bdf48b7cbbc099eadf41b701a5739c538023fac61baa64bf9da1b0d69a46.json} (57%) delete mode 100644 .sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json delete mode 100644 .sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json rename .sqlx/{query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json => query-3f32b12dd86d1cfb133e7e2434b79063f762d4efb4174d3eaf3795da7785f9c5.json} (76%) rename .sqlx/{query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json => query-3f76551e5ac8d57c43c39b276f9c923a8619eb450a7c8e121324952d1c32950b.json} (56%) rename .sqlx/{query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json => query-3ffc7db9c71b9933f13aebc6a4a7b3d3c9586e78ae50a78322a79124516af1cd.json} (52%) rename .sqlx/{query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json => query-42f8b84317c23636033b640c676acc8e4c07dcafee002b768a02e2a82b414507.json} (56%) create mode 100644 .sqlx/query-459e6f5ecb870b4762324c2d19173f239f1b4c71b58b475e5c6bc1b66783d877.json delete mode 100644 .sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json delete mode 100644 .sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json delete mode 100644 .sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json rename .sqlx/{query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json => query-4bd1b6db31988bbc58bc01e75ba3979ca28a59910bd5c8b7f09106a0f55247d9.json} (58%) rename .sqlx/{query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json => query-4d18acca29015f43bba9b8432af0f20dfef2d1cc2d2b680a173255dd17b36290.json} (57%) rename .sqlx/{query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json => query-4e20d7faf0a2ba905ad5bbc8c8f23373bdc25ad32843725868a5218678cdfff0.json} (57%) create mode 100644 .sqlx/query-4e35dd7dff49406af0e56f17e8b9948483fbf370cf28fc0d5736fc15da01acc3.json rename .sqlx/{query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json => query-51ff446a8164f54bc059968fa858b1940a601adcf8bcab6dbacd0d2befa1fc4c.json} (57%) delete mode 100644 .sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json rename .sqlx/{query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json => query-54e30a8dd82a2bc27930bcea9795aae5f9df159a10a96ea039ce50e7d0574bcc.json} (54%) rename .sqlx/{query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json => query-56245d97b2e9a48700f079f567191a943aacf384d483a205195fd54362179348.json} (60%) rename .sqlx/{query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json => query-56d5a9bb547f49305d360044132faf625c162539dc7460bb9a99202e245192cb.json} (59%) create mode 100644 .sqlx/query-593323e63055f2d9bd582985fd48f145d4005a8b1de856a8664f00bab143e8ae.json rename .sqlx/{query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json => query-5a520520a9bd611ae87e57bdb5b6e8a14f63396dbce8ad30e9fe53211f08037b.json} (67%) delete mode 100644 .sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json delete mode 100644 .sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json create mode 100644 .sqlx/query-619d3dbbf8890d02af8ec73faf9c846b671d492594c4648a744923a9c698285d.json rename .sqlx/{query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json => query-6342025cec28f3494d84abd198aee2ba0be98637ff24d795ecda1a2986dde453.json} (53%) delete mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json rename .sqlx/{query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json => query-640cb941e8bc937e7c03ade967c55fb36c6e4a98a93b2b6d493b1ba70aa09ad2.json} (56%) rename .sqlx/{query-5fd0b1e82a6c273fd0359f895a829d21aa1580f41291f812cae3d77cc5bfa172.json => query-6410d6d28f9f27588505ca95ac67fdec18f377bd0fc9d1d33c31f3f0b79d459d.json} (58%) rename .sqlx/{query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json => query-651c7f85cde2b21940a6d78ac5b2e33e910a69ab164432e6cf4cbad42aabb6c8.json} (58%) rename .sqlx/{query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json => query-67a94493771ad889e590e34119af5a4dcbcc639b64db76868f18c282496fd9d8.json} (53%) create mode 100644 .sqlx/query-68b14c073e8cf6ba8e9ab0eec3196ddaf5431985cacecc4ded972cbdd76c0ea0.json create mode 100644 .sqlx/query-69bd5e490e0e0a1eff1fda2616f73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f.json delete mode 100644 .sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json delete mode 100644 .sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json delete mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json rename .sqlx/{query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json => query-6fa7a9326c5d6e6c6df0ca32ccc19d8087435b01729b10c9bf03d9fece190620.json} (52%) create mode 100644 .sqlx/query-73e923f09d1669e337752eff676842a5247b8f632258c8344c78cf9eb63aadb7.json rename .sqlx/{query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json => query-74e5556f4ce33703b1f885b77025944a11182e90c444f05d7590b2f8cf6388d4.json} (59%) rename .sqlx/{query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json => query-754a9e381f4f1380f333aa10d4736056af57b2963edfc3ca8d75bfc7927b8a28.json} (58%) delete mode 100644 .sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json delete mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json rename .sqlx/{query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json => query-79e09f688287c0e77c5d52fd4f3834f1d2f3bc009f86e3f5c4f948392f077555.json} (57%) create mode 100644 .sqlx/query-7bc59c8ce644a8ee34259fcb48cc67ca55a129d5c98b1a9bf0080d3ee0188fee.json rename .sqlx/{query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json => query-8088ec5ad2424a142a976b47a26625ac25b90d86ae8cf2a0757c9b5fbc277559.json} (56%) delete mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json rename .sqlx/{query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json => query-839e3df591c13563d89a06f0b31a559bf4f8df385640d94522c32af78c1d9f86.json} (68%) rename .sqlx/{query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json => query-8420a910396dae3967aac75e1ca9d98c7e2d5918b4c35509875a8c0f484868d1.json} (55%) rename .sqlx/{query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json => query-84d91e20f5d28bbab272e4d481b359c634703516e9ea01223db85d95b4744870.json} (53%) create mode 100644 .sqlx/query-89eb48e57e3bd851f7be9e177da99107e86eeb4e9c1c0884dbed1b39af235de3.json rename .sqlx/{query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json => query-8bed18f3ad626ecf4f87a4f40f9bb33bd35105facfcdea1a16bcb5cc8edb82b8.json} (64%) create mode 100644 .sqlx/query-8cce80df3c9d7536556247bf40d2a9e30acca15fdcf381dd6a89853f95960fef.json create mode 100644 .sqlx/query-8d382d165e54a659f3afeaf155e2981e6f4172ce7b7b8d4d66ea8021cd6c88d4.json delete mode 100644 .sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json rename .sqlx/{query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json => query-8d68beea7322d53f605613244f5ea717e83e70970404850f745d94ed3e26b012.json} (58%) rename .sqlx/{query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json => query-8da2c300e2c276f0838877f4ac213e524b6fb53e4e52d80c90aeb6d27b59472b.json} (56%) rename .sqlx/{query-23f65a29469fd45c85a7397f24d4334b68d7b2882b7dc4ffb647d1a52f72a1f9.json => query-8e3974b17ab74e96b834e82593e5540aedf3a772ffcf06983e57b85849a6920d.json} (53%) rename .sqlx/{query-9d256f3a0b0b53e5a22e1a4aac6b12fc8e509bd0e46e74af00165d1a6967fb43.json => query-8e4f7e84cfe51ef1d96cca775484a615467540ce6400d8a1a0f281ebcfcb0914.json} (53%) create mode 100644 .sqlx/query-914a4e691e66ffebf6a3826358b035d1fbb1cb58570d3ffce6fdcd2ee98d7754.json rename .sqlx/{query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json => query-918f542fb54a94b1b44d84064afc45f2216292d36205ea145014c06a4d795939.json} (58%) delete mode 100644 .sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json create mode 100644 .sqlx/query-933623d4358ba31ba8d7190fdee7deabf19d4205592b96fd6e11594cc8ef027b.json delete mode 100644 .sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json delete mode 100644 .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json rename .sqlx/{query-8c4b17e1bba1c218315a0c7f6607772f58e417b6fdf35d8574f60a463d65845c.json => query-9a2b2debb16baddba43e014451b6e0bdfdc49d66dd759985b95a1779aeee93ae.json} (55%) rename .sqlx/{query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json => query-9d7db85c1b9a773f7605b9afc8487bc61d0784a24b3850ad29654d4682cc6ff2.json} (53%) delete mode 100644 .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json rename .sqlx/{query-f99ff7aa299fc02d49329c7b7558fa9a67b1b9e00dc1fe2ac7ea94a378d56a50.json => query-a058cbc5f52a218ed02f0e163a0b2ae2bceb907599767b008e62da99b3eda013.json} (55%) rename .sqlx/{query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json => query-a2d860909e1587d9841dde47da88db794ebe87976c216efef7014d21ce8c4a35.json} (53%) delete mode 100644 .sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json rename .sqlx/{query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json => query-a6c7c05a71de4e77ab7e798d784b2c40bf51598dd23600aae6d9c0821d2299a8.json} (53%) rename .sqlx/{query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json => query-a7dea8e751999c43bffaf46c89454f667e58934943e5505f5835147fb062bb1d.json} (59%) rename .sqlx/{query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json => query-a961ea487a0ede93f4848288efa855f425b4cfd6459e38c47a2d06c24ac95b19.json} (53%) rename .sqlx/{query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json => query-aa048e4d6c645163c3276040283095ccf865219ca3384909081a7003495d7ac7.json} (56%) rename .sqlx/{query-6f7f25169f95d9a7cdf0e3e24adadc2b6970ff87da1c03aa878efac164a36cf9.json => query-ad2bb2e98d01a3d21efe5ae284787c34a4524341b8590da66bae227f628f1dc4.json} (58%) delete mode 100644 .sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json rename .sqlx/{query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json => query-adb7610f5ac193ef0c70d0a8d3eb5b59f2693c65024f5dc70323c5f7b3a84ecd.json} (55%) rename .sqlx/{query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json => query-ae852494e0d316dc752573af56c244561b6045c05d49299717b6f6421319d8da.json} (81%) rename .sqlx/{query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json => query-af3afa78e97f2421e8ac08f644a21f602fc3983147a6121e7bd857b6f4b3196b.json} (59%) rename .sqlx/{query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json => query-b096f4dfed5c2f2f95450e60d53c77389f5a2c1c9fe867561f81a6b2577cb9cd.json} (57%) delete mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json delete mode 100644 .sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json create mode 100644 .sqlx/query-b2456b87a130d720dc00e7d102f639208a9a3a4befb53d63dbbed098cf7f2b22.json rename .sqlx/{query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json => query-b2acd44a7a822541f637c19587ffe1151b1738fa6a0f8566a6509081ace0f83f.json} (57%) rename .sqlx/{query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json => query-b3e0a7791167b3a74ea4ba95f05597b8d33f3a020c7e6088d218a7094c8bc0b1.json} (57%) delete mode 100644 .sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json rename .sqlx/{query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json => query-b76793d1c0e83bf77ea8502b825970fb7f1f8427ecd7ae3919c90ff031129a5c.json} (59%) create mode 100644 .sqlx/query-b76859ee4c1ac6aecb03e51acd0860e548b73560822008f3de7f85d22c610cea.json create mode 100644 .sqlx/query-b84f3323f9b4dcebc263f0970fc41b00f5f4500ffe5cb8aa5c60e6319cb93dad.json rename .sqlx/{query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json => query-bc0d7ecc4cdf9c97692f98022eb4ca4ca8db761aea38aa34397767a4533e80e2.json} (56%) delete mode 100644 .sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json rename .sqlx/{query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json => query-be83933711f722bcea5bfe413a247d5bdab8edf29399f48895ceb66f15cb1992.json} (56%) delete mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json delete mode 100644 .sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json delete mode 100644 .sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json rename .sqlx/{query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json => query-c5e396c1f3318661f0118b1c822a1f9efd4a735ea07c8c8188304fddded337f0.json} (53%) rename .sqlx/{query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json => query-c6f45dda03e5c4528b258803197918e2252327a5bfb302e719c426c95805b185.json} (53%) create mode 100644 .sqlx/query-c7a51ac39c0f5d65b360ed9400f6827f7769e081d0f37a44a14aba4efff518ca.json delete mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json delete mode 100644 .sqlx/query-c99339f15b2ba2220c53514a87ede6cb6592b242509fc929146e38497658e4b9.json create mode 100644 .sqlx/query-c9d627366eb3cef8fab5cf514472db4c14c5ba76fba31b88c6816f212173b568.json rename .sqlx/{query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json => query-ce970302baac6e8c40bc86cb76f6f108c86636b29d82e6dd378a8a3943d27c00.json} (57%) rename .sqlx/{query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json => query-d3e778df5c710e4a574d4370e9220c1e80629cae9b09138a36e773fbab222af9.json} (56%) rename .sqlx/{query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json => query-d496cf25d1cda0b828a38d5cadb5e4147862a381e5a4a665d89ff939ed3202e8.json} (56%) delete mode 100644 .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json delete mode 100644 .sqlx/query-d6784f313ea771f1d714d4a2f48dba8a541d306a675c9229ebb32878f574d01d.json delete mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json delete mode 100644 .sqlx/query-db850ba27363078399686515615d44c94324abb4c1855ab9a55a68c4bc7183cb.json delete mode 100644 .sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json create mode 100644 .sqlx/query-df78a011d9504ba44689ab1b5a065f98e396df5c8784ec265f14f39ecdbf8878.json create mode 100644 .sqlx/query-e242e2e88ddc0e8ed38a845bb5e2e3c63f1ac297e60827a133507ab83a3d864f.json delete mode 100644 .sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json delete mode 100644 .sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json delete mode 100644 .sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json rename .sqlx/{query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json => query-e6123fc759e994b430db0a55d0e4440e35ceeac30413886efd8cba47dbf73bf3.json} (56%) rename .sqlx/{query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json => query-e798350f5e65e7d3bc35bcaf2bf2d3b4d4ac0fe166f303ea904a1ae4167ecc26.json} (53%) rename .sqlx/{query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json => query-e79c15d7aa0bedfa0d09031c882c500caacf0b694f71c5748702668d76ec0e6e.json} (53%) rename .sqlx/{query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json => query-e8b1a7a0220a8539bcdcc790f092bf7c16227b5ad43c60ebc90c1d84d47d8218.json} (56%) delete mode 100644 .sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json delete mode 100644 .sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json delete mode 100644 .sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json rename .sqlx/{query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json => query-ed1bcc219902cc44f65aca4faa73243ea4eabbc9ec72f57c9b312f93864f9f6e.json} (56%) delete mode 100644 .sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json rename .sqlx/{query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json => query-f17ac54fd1f2c48007492d8b12471e21daf1b9f0057be6f197a2654b90bb6b5e.json} (59%) create mode 100644 .sqlx/query-f5faad8826ac896171feab735386c36acff3c8b20d9ef193e3c6d882d9cdf8e0.json rename .sqlx/{query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json => query-f8335c1c83acfb90bdcafe951727867f5f0b7da9571bd124597311d8d58e09cc.json} (53%) rename .sqlx/{query-b38f317489602f61c079b83f558e5c7cd28464dc7367585cd0bfddb935b13dfc.json => query-f969a21220e0d0a16b91b9b8038a683989c95c6c87d45762aca3515e2961f954.json} (57%) rename .sqlx/{query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json => query-fc287215a78fd84cd9c251d99c34816dda6607c8d306f9dfddcda69756561a3c.json} (58%) create mode 100644 .sqlx/query-fc739d082a692121896a3df20aa6ea59f9ad7dfb7daefe8c9ee3c57616f8e411.json rename .sqlx/{query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json => query-fdda9164b8cebcca5c74f339d8ba71921ebe2149abb550bf8b00d2018c02c820.json} (56%) rename .sqlx/{query-a9705321568f5a820aede5aa20506ff38dbf759e9c399b1effe2ce65f0ec5414.json => query-fe3f391ef20bab7af3fd3c5559d500932f5b281df15f6984a9773061a967cb29.json} (67%) create mode 100644 migrations/20250909142749_add_context_to_events.down.sql create mode 100644 migrations/20250909142749_add_context_to_events.up.sql diff --git a/.sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json b/.sqlx/query-01266b0e2f33d1b1612b14e8b2270bc1654a32b3bcd4948c49de4e56589e5d94.json similarity index 53% rename from .sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json rename to .sqlx/query-01266b0e2f33d1b1612b14e8b2270bc1654a32b3bcd4948c49de4e56589e5d94.json index 0a78d4dc..538b59f0 100644 --- a/.sqlx/query-a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863.json +++ b/.sqlx/query-01266b0e2f33d1b1612b14e8b2270bc1654a32b3bcd4948c49de4e56589e5d94.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE id = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "a98c9a2bb14966bfe565eebef715ef17cd064e365de7498416bec1b12659c863" + "hash": "01266b0e2f33d1b1612b14e8b2270bc1654a32b3bcd4948c49de4e56589e5d94" } diff --git a/.sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json b/.sqlx/query-044e1fb61853894f16ac0e91b68d7ed7778c2a3fd2f7ff5e03849bc83e6a2574.json similarity index 60% rename from .sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json rename to .sqlx/query-044e1fb61853894f16ac0e91b68d7ed7778c2a3fd2f7ff5e03849bc83e6a2574.json index 8dc90a6d..25ba8749 100644 --- a/.sqlx/query-f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5.json +++ b/.sqlx/query-044e1fb61853894f16ac0e91b68d7ed7778c2a3fd2f7ff5e03849bc83e6a2574.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Uuid", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "f87cc9cf9860faf3d0e1460068e4bd9c4db595d5b70dab7f4fd4aa013166d1c5" + "hash": "044e1fb61853894f16ac0e91b68d7ed7778c2a3fd2f7ff5e03849bc83e6a2574" } diff --git a/.sqlx/query-5943390333d30a4c8ce0555f2f302428f128207d75ace7eacada6db6354a75e0.json b/.sqlx/query-05399525ae25b49630b203a708fdcb54a97c0ce3dd889d31227af99fdbb8fb98.json similarity index 56% rename from .sqlx/query-5943390333d30a4c8ce0555f2f302428f128207d75ace7eacada6db6354a75e0.json rename to .sqlx/query-05399525ae25b49630b203a708fdcb54a97c0ce3dd889d31227af99fdbb8fb98.json index a06007b0..c9909cc3 100644 --- a/.sqlx/query-5943390333d30a4c8ce0555f2f302428f128207d75ace7eacada6db6354a75e0.json +++ b/.sqlx/query-05399525ae25b49630b203a708fdcb54a97c0ce3dd889d31227af99fdbb8fb98.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "5943390333d30a4c8ce0555f2f302428f128207d75ace7eacada6db6354a75e0" + "hash": "05399525ae25b49630b203a708fdcb54a97c0ce3dd889d31227af99fdbb8fb98" } diff --git a/.sqlx/query-9cdd3b52d58a0f8d9952c2c70ad0b94f479a4b274921b1c34c20628fe19c1634.json b/.sqlx/query-0e5fddf54f196b42026c713274e7d45a852ca8a493a874d770ae8d4b0e4ad573.json similarity index 57% rename from .sqlx/query-9cdd3b52d58a0f8d9952c2c70ad0b94f479a4b274921b1c34c20628fe19c1634.json rename to .sqlx/query-0e5fddf54f196b42026c713274e7d45a852ca8a493a874d770ae8d4b0e4ad573.json index 09280c9d..a119f48d 100644 --- a/.sqlx/query-9cdd3b52d58a0f8d9952c2c70ad0b94f479a4b274921b1c34c20628fe19c1634.json +++ b/.sqlx/query-0e5fddf54f196b42026c713274e7d45a852ca8a493a874d770ae8d4b0e4ad573.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "9cdd3b52d58a0f8d9952c2c70ad0b94f479a4b274921b1c34c20628fe19c1634" + "hash": "0e5fddf54f196b42026c713274e7d45a852ca8a493a874d770ae8d4b0e4ad573" } diff --git a/.sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json b/.sqlx/query-0ec68ead66afd6750ba3e7cb5d87aa658670564a94034f84b0cc631ef1aa819f.json similarity index 57% rename from .sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json rename to .sqlx/query-0ec68ead66afd6750ba3e7cb5d87aa658670564a94034f84b0cc631ef1aa819f.json index 4e1aff4a..d3fb66a6 100644 --- a/.sqlx/query-93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317.json +++ b/.sqlx/query-0ec68ead66afd6750ba3e7cb5d87aa658670564a94034f84b0cc631ef1aa819f.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "93a01c8beef2d13f3986ef1467a7d25904bbc2435dd08740162eea7dde4c2317" + "hash": "0ec68ead66afd6750ba3e7cb5d87aa658670564a94034f84b0cc631ef1aa819f" } diff --git a/.sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json b/.sqlx/query-118e50dac9417b77bb821bf64ef38eb89949deb050faf4150d1aa031f109304f.json similarity index 58% rename from .sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json rename to .sqlx/query-118e50dac9417b77bb821bf64ef38eb89949deb050faf4150d1aa031f109304f.json index f49837a4..d41a4e8a 100644 --- a/.sqlx/query-deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf.json +++ b/.sqlx/query-118e50dac9417b77bb821bf64ef38eb89949deb050faf4150d1aa031f109304f.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "deb853986dd06ec24b316bf3f33e194eb21ceb26bba478a92aaa0dcfc36418bf" + "hash": "118e50dac9417b77bb821bf64ef38eb89949deb050faf4150d1aa031f109304f" } diff --git a/.sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json b/.sqlx/query-11d100c94adcd4e0dbb1acb827437b22e4e7f5cb1b997e5df1e13995e82b5a0c.json similarity index 57% rename from .sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json rename to .sqlx/query-11d100c94adcd4e0dbb1acb827437b22e4e7f5cb1b997e5df1e13995e82b5a0c.json index ffa4e58e..bdabc191 100644 --- a/.sqlx/query-9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b.json +++ b/.sqlx/query-11d100c94adcd4e0dbb1acb827437b22e4e7f5cb1b997e5df1e13995e82b5a0c.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND wallet_id = $2\n ORDER BY created_at DESC \n OFFSET $3) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND wallet_id = $2\n ORDER BY created_at DESC \n OFFSET $3) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Uuid", - "Int8" + "Int8", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "9a6e21a86ec51ccbb9b4452e89578598dedc44402607aebe5afa7026fa4f0d8b" + "hash": "11d100c94adcd4e0dbb1acb827437b22e4e7f5cb1b997e5df1e13995e82b5a0c" } diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json deleted file mode 100644 index 33a94981..00000000 --- a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Jsonb" - ] - }, - "nullable": [] - }, - "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" -} diff --git a/.sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json b/.sqlx/query-1a9d54b35bd2d6cc759478127e25691d40d037f6130a9d54e519c794fd8b048f.json similarity index 59% rename from .sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json rename to .sqlx/query-1a9d54b35bd2d6cc759478127e25691d40d037f6130a9d54e519c794fd8b048f.json index 7644a17e..ed3569b7 100644 --- a/.sqlx/query-026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c.json +++ b/.sqlx/query-1a9d54b35bd2d6cc759478127e25691d40d037f6130a9d54e519c794fd8b048f.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "026443dd6e23e09b2ed2367e78fa1d983764bffc7795ac507aec3d5cb0ec5b3c" + "hash": "1a9d54b35bd2d6cc759478127e25691d40d037f6130a9d54e519c794fd8b048f" } diff --git a/.sqlx/query-1ac621a8ce19e3bd37d80e8c47564893ce2bc37f4be3304bcfe2c461bd807bbc.json b/.sqlx/query-1ac621a8ce19e3bd37d80e8c47564893ce2bc37f4be3304bcfe2c461bd807bbc.json new file mode 100644 index 00000000..7aaeef4c --- /dev/null +++ b/.sqlx/query-1ac621a8ce19e3bd37d80e8c47564893ce2bc37f4be3304bcfe2c461bd807bbc.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "1ac621a8ce19e3bd37d80e8c47564893ce2bc37f4be3304bcfe2c461bd807bbc" +} diff --git a/.sqlx/query-1bd933fc3fa4865e08bc0c3275e82dc927d9bb9266bec606fb3954beedd74842.json b/.sqlx/query-1bd933fc3fa4865e08bc0c3275e82dc927d9bb9266bec606fb3954beedd74842.json new file mode 100644 index 00000000..aac643a7 --- /dev/null +++ b/.sqlx/query-1bd933fc3fa4865e08bc0c3275e82dc927d9bb9266bec606fb3954beedd74842.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "1bd933fc3fa4865e08bc0c3275e82dc927d9bb9266bec606fb3954beedd74842" +} diff --git a/.sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json b/.sqlx/query-1e4260ff3d905155725d101e4c99f9bd084e7239808f5f5797f9e290e9d604bb.json similarity index 53% rename from .sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json rename to .sqlx/query-1e4260ff3d905155725d101e4c99f9bd084e7239808f5f5797f9e290e9d604bb.json index 1a669db2..f4710182 100644 --- a/.sqlx/query-313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf.json +++ b/.sqlx/query-1e4260ff3d905155725d101e4c99f9bd084e7239808f5f5797f9e290e9d604bb.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE profile_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "313000b84a233356f226431ff7bacd83c69992d7b9b6021c7e6be1a88b60a8bf" + "hash": "1e4260ff3d905155725d101e4c99f9bd084e7239808f5f5797f9e290e9d604bb" } diff --git a/.sqlx/query-21cab8d30e477cd1e67fa8f383fe5dcdbba978e08423a33b075231a8832363a2.json b/.sqlx/query-21cab8d30e477cd1e67fa8f383fe5dcdbba978e08423a33b075231a8832363a2.json new file mode 100644 index 00000000..6859dde3 --- /dev/null +++ b/.sqlx/query-21cab8d30e477cd1e67fa8f383fe5dcdbba978e08423a33b075231a8832363a2.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "21cab8d30e477cd1e67fa8f383fe5dcdbba978e08423a33b075231a8832363a2" +} diff --git a/.sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json b/.sqlx/query-24126c8a99b07e414f6a01bd5134c01074f983bb9eb93018e618dea27e943334.json similarity index 59% rename from .sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json rename to .sqlx/query-24126c8a99b07e414f6a01bd5134c01074f983bb9eb93018e618dea27e943334.json index c7dd8491..6621c96a 100644 --- a/.sqlx/query-6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900.json +++ b/.sqlx/query-24126c8a99b07e414f6a01bd5134c01074f983bb9eb93018e618dea27e943334.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "6ebfb9fc3e8fbf9d5de84011ca71605b6db979fed390fe3650895272698a4900" + "hash": "24126c8a99b07e414f6a01bd5134c01074f983bb9eb93018e618dea27e943334" } diff --git a/.sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json b/.sqlx/query-24335a859b72745eb385891c6d5d8ec5221d958eacb931c0054d70fbec66c7c3.json similarity index 57% rename from .sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json rename to .sqlx/query-24335a859b72745eb385891c6d5d8ec5221d958eacb931c0054d70fbec66c7c3.json index b9fb0f8b..5f1159b7 100644 --- a/.sqlx/query-bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2.json +++ b/.sqlx/query-24335a859b72745eb385891c6d5d8ec5221d958eacb931c0054d70fbec66c7c3.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "bb3b0a25090810cfff32a809164997d0a9335b2121e9dd108461a9d39c0e44b2" + "hash": "24335a859b72745eb385891c6d5d8ec5221d958eacb931c0054d70fbec66c7c3" } diff --git a/.sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json b/.sqlx/query-24db1c5fa667f489cfbcda3ab832698186ec14fd4e857e3d32317967ac69ad2a.json similarity index 59% rename from .sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json rename to .sqlx/query-24db1c5fa667f489cfbcda3ab832698186ec14fd4e857e3d32317967ac69ad2a.json index 58676f30..d68b3419 100644 --- a/.sqlx/query-9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5.json +++ b/.sqlx/query-24db1c5fa667f489cfbcda3ab832698186ec14fd4e857e3d32317967ac69ad2a.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "9e95c77ed6422e5a8561edd7b87f6c018df8ee45d6ca22835b4f88466dfa2bc5" + "hash": "24db1c5fa667f489cfbcda3ab832698186ec14fd4e857e3d32317967ac69ad2a" } diff --git a/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json b/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json deleted file mode 100644 index 2e4324aa..00000000 --- a/.sqlx/query-25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_address_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "25126bba8ab575472a294f6b380c753a4c8adf0388952209234146921d065fad" -} diff --git a/.sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json b/.sqlx/query-259c8d203542581ea7f2dced50c10abc54fa407a5a5665e44639f99f8ab61455.json similarity index 58% rename from .sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json rename to .sqlx/query-259c8d203542581ea7f2dced50c10abc54fa407a5a5665e44639f99f8ab61455.json index 89681696..9777732c 100644 --- a/.sqlx/query-758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af.json +++ b/.sqlx/query-259c8d203542581ea7f2dced50c10abc54fa407a5a5665e44639f99f8ab61455.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_signing_sessions WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "758fb0eb80e12bb2b3a56e9ef1b998f24a0dbadfed25d6d036f900b8c08423af" + "hash": "259c8d203542581ea7f2dced50c10abc54fa407a5a5665e44639f99f8ab61455" } diff --git a/.sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json b/.sqlx/query-279d5f7d7d21b641b5c6352f62d37417409ba0aaedb5ebe5213decee968e79fe.json similarity index 63% rename from .sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json rename to .sqlx/query-279d5f7d7d21b641b5c6352f62d37417409ba0aaedb5ebe5213decee968e79fe.json index 29ec4a8e..13a72fad 100644 --- a/.sqlx/query-4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836.json +++ b/.sqlx/query-279d5f7d7d21b641b5c6352f62d37417409ba0aaedb5ebe5213decee968e79fe.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE batch_id is NULL AND account_id = $1 AND payout_queue_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id\n FOR UPDATE) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE batch_id is NULL AND account_id = $1 AND payout_queue_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id\n FOR UPDATE) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Uuid", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "4318cc6bac1b20a8c9c663620c248b9e7414153ce614d4d5035a0beb66fde836" + "hash": "279d5f7d7d21b641b5c6352f62d37417409ba0aaedb5ebe5213decee968e79fe" } diff --git a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json deleted file mode 100644 index 301c5cc3..00000000 --- a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" -} diff --git a/.sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json b/.sqlx/query-290697d21826c0cf91ed115e04aa98f6c850d40d8ce3ad64e7d7bbe53334e338.json similarity index 68% rename from .sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json rename to .sqlx/query-290697d21826c0cf91ed115e04aa98f6c850d40d8ce3ad64e7d7bbe53334e338.json index 801a421c..7a625583 100644 --- a/.sqlx/query-a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5.json +++ b/.sqlx/query-290697d21826c0cf91ed115e04aa98f6c850d40d8ce3ad64e7d7bbe53334e338.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_profiles (id, name, account_id, created_at) VALUES ($1, $2, $3, $4)", + "query": "INSERT INTO bria_profiles (id, name, account_id, created_at) VALUES ($1, $2, $3, COALESCE($4, NOW()))", "describe": { "columns": [], "parameters": { @@ -13,5 +13,5 @@ }, "nullable": [] }, - "hash": "a81546ece7c991b6890513f833f617e00165732c51fc5a80c8c3e7f9efb883f5" + "hash": "290697d21826c0cf91ed115e04aa98f6c850d40d8ce3ad64e7d7bbe53334e338" } diff --git a/.sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json b/.sqlx/query-2a3a40f8b01cb161ca8ad94b3441ce62142370967be1d42aeee59fd2952106fb.json similarity index 59% rename from .sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json rename to .sqlx/query-2a3a40f8b01cb161ca8ad94b3441ce62142370967be1d42aeee59fd2952106fb.json index 18212412..9737afaf 100644 --- a/.sqlx/query-d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0.json +++ b/.sqlx/query-2a3a40f8b01cb161ca8ad94b3441ce62142370967be1d42aeee59fd2952106fb.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "d7e5ea3403c3948629f2da951aeae7a62917c4232087f03654204f9f99ec31a0" + "hash": "2a3a40f8b01cb161ca8ad94b3441ce62142370967be1d42aeee59fd2952106fb" } diff --git a/.sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json b/.sqlx/query-2c9a8151247c14fd011897d7f753c5996b6bd136149b13e5df4babdd6c5be8a4.json similarity index 58% rename from .sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json rename to .sqlx/query-2c9a8151247c14fd011897d7f753c5996b6bd136149b13e5df4babdd6c5be8a4.json index 13d546e7..433f013e 100644 --- a/.sqlx/query-3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4.json +++ b/.sqlx/query-2c9a8151247c14fd011897d7f753c5996b6bd136149b13e5df4babdd6c5be8a4.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "3e38e5e6601d76b6a904de14e68c4459763b932842b96b740cfea8d92e8b70e4" + "hash": "2c9a8151247c14fd011897d7f753c5996b6bd136149b13e5df4babdd6c5be8a4" } diff --git a/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json b/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json deleted file mode 100644 index 3888952d..00000000 --- a/.sqlx/query-2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_signing_session_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "2d98032c834a6c39b100c709a64d8073c86dc835144a2f047a00224499f50021" -} diff --git a/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json b/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json deleted file mode 100644 index a2d971e4..00000000 --- a/.sqlx/query-3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payout_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "3193b72b162aad1db0772b5ccbf7cfebbd862dd59c592720e1fd340aeac32ec4" -} diff --git a/.sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json b/.sqlx/query-32472ea9a6598dbd856420172ddbcf633b0e7ffed5fcb0eb5b28dc5eb0a65b16.json similarity index 56% rename from .sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json rename to .sqlx/query-32472ea9a6598dbd856420172ddbcf633b0e7ffed5fcb0eb5b28dc5eb0a65b16.json index c4f5d5a2..89d81b2e 100644 --- a/.sqlx/query-54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72.json +++ b/.sqlx/query-32472ea9a6598dbd856420172ddbcf633b0e7ffed5fcb0eb5b28dc5eb0a65b16.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "54262ae35d9df823dfc4d4d0bda8fe1b79f192b99e0cb9332966ac276d996c72" + "hash": "32472ea9a6598dbd856420172ddbcf633b0e7ffed5fcb0eb5b28dc5eb0a65b16" } diff --git a/.sqlx/query-32ff4078f342d5337ba35916aedda40d51cd9a60fd7a255fd7ea209ed5a89357.json b/.sqlx/query-32ff4078f342d5337ba35916aedda40d51cd9a60fd7a255fd7ea209ed5a89357.json new file mode 100644 index 00000000..10c3950e --- /dev/null +++ b/.sqlx/query-32ff4078f342d5337ba35916aedda40d51cd9a60fd7a255fd7ea209ed5a89357.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_payout_queue_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "32ff4078f342d5337ba35916aedda40d51cd9a60fd7a255fd7ea209ed5a89357" +} diff --git a/.sqlx/query-49f7f209d2720a06c3efe0a0b3e7fdf770f9c2aee224b2f3a3789efb53599f8d.json b/.sqlx/query-3380cc0e4ce5ce20579249dc342cf3e4456b4c9bda04f8c7b542d4e782054a51.json similarity index 56% rename from .sqlx/query-49f7f209d2720a06c3efe0a0b3e7fdf770f9c2aee224b2f3a3789efb53599f8d.json rename to .sqlx/query-3380cc0e4ce5ce20579249dc342cf3e4456b4c9bda04f8c7b542d4e782054a51.json index 2f99ff0e..417bf779 100644 --- a/.sqlx/query-49f7f209d2720a06c3efe0a0b3e7fdf770f9c2aee224b2f3a3789efb53599f8d.json +++ b/.sqlx/query-3380cc0e4ce5ce20579249dc342cf3e4456b4c9bda04f8c7b542d4e782054a51.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "49f7f209d2720a06c3efe0a0b3e7fdf770f9c2aee224b2f3a3789efb53599f8d" + "hash": "3380cc0e4ce5ce20579249dc342cf3e4456b4c9bda04f8c7b542d4e782054a51" } diff --git a/.sqlx/query-34da8604f234696305d59a19fe7df25de6db7fc79ea5277b1a672ebd44d0f19f.json b/.sqlx/query-34da8604f234696305d59a19fe7df25de6db7fc79ea5277b1a672ebd44d0f19f.json deleted file mode 100644 index b4e57897..00000000 --- a/.sqlx/query-34da8604f234696305d59a19fe7df25de6db7fc79ea5277b1a672ebd44d0f19f.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payout_queue_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "34da8604f234696305d59a19fe7df25de6db7fc79ea5277b1a672ebd44d0f19f" -} diff --git a/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json b/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json deleted file mode 100644 index e5af9ce7..00000000 --- a/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT keychain_kind as \"keychain_kind: BdkKeychainKind\", path FROM bdk_script_pubkeys\n WHERE keychain_id = $1 AND script_hex = ENCODE($2, 'hex')", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "keychain_kind: BdkKeychainKind", - "type_info": { - "Custom": { - "name": "bdkkeychainkind", - "kind": { - "Enum": [ - "external", - "internal" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "path", - "type_info": "Int4" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Bytea" - ] - }, - "nullable": [ - false, - false - ] - }, - "hash": "34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f" -} diff --git a/.sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json b/.sqlx/query-3620bdf48b7cbbc099eadf41b701a5739c538023fac61baa64bf9da1b0d69a46.json similarity index 57% rename from .sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json rename to .sqlx/query-3620bdf48b7cbbc099eadf41b701a5739c538023fac61baa64bf9da1b0d69a46.json index ca7f3c58..ff0d65a3 100644 --- a/.sqlx/query-7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965.json +++ b/.sqlx/query-3620bdf48b7cbbc099eadf41b701a5739c538023fac61baa64bf9da1b0d69a46.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "7fece314e1448cea27292b7e09cdbdb061baed03dcd7c233ac0be500725ec965" + "hash": "3620bdf48b7cbbc099eadf41b701a5739c538023fac61baa64bf9da1b0d69a46" } diff --git a/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json b/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json deleted file mode 100644 index 01170a0b..00000000 --- a/.sqlx/query-38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_xpub_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "38d17770f5f6905eb335c9613e58d85df4b382e2465eba4808fa0846f5f62848" -} diff --git a/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json b/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json deleted file mode 100644 index 910fc513..00000000 --- a/.sqlx/query-39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_wallet_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "39ad088305882e728617af31e6549fb445d9fc56abfabc02da15a0283fab9d20" -} diff --git a/.sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json b/.sqlx/query-3f32b12dd86d1cfb133e7e2434b79063f762d4efb4174d3eaf3795da7785f9c5.json similarity index 76% rename from .sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json rename to .sqlx/query-3f32b12dd86d1cfb133e7e2434b79063f762d4efb4174d3eaf3795da7785f9c5.json index a9b41ec0..7c6a1883 100644 --- a/.sqlx/query-fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0.json +++ b/.sqlx/query-3f32b12dd86d1cfb133e7e2434b79063f762d4efb4174d3eaf3795da7785f9c5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payouts (id, account_id, wallet_id, payout_queue_id, profile_id, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7)", + "query": "INSERT INTO bria_payouts (id, account_id, wallet_id, payout_queue_id, profile_id, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, COALESCE($7, NOW()))", "describe": { "columns": [], "parameters": { @@ -16,5 +16,5 @@ }, "nullable": [] }, - "hash": "fdc2b412460c575b2d9a713c200625c5faefcdf646db5a4a183df9bc7b901bc0" + "hash": "3f32b12dd86d1cfb133e7e2434b79063f762d4efb4174d3eaf3795da7785f9c5" } diff --git a/.sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json b/.sqlx/query-3f76551e5ac8d57c43c39b276f9c923a8619eb450a7c8e121324952d1c32950b.json similarity index 56% rename from .sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json rename to .sqlx/query-3f76551e5ac8d57c43c39b276f9c923a8619eb450a7c8e121324952d1c32950b.json index dfaf8541..94ebaa37 100644 --- a/.sqlx/query-febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d.json +++ b/.sqlx/query-3f76551e5ac8d57c43c39b276f9c923a8619eb450a7c8e121324952d1c32950b.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "febb2e5340bd4941d45d2f21714fb66526029dc0651c9058847582d99c66397d" + "hash": "3f76551e5ac8d57c43c39b276f9c923a8619eb450a7c8e121324952d1c32950b" } diff --git a/.sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json b/.sqlx/query-3ffc7db9c71b9933f13aebc6a4a7b3d3c9586e78ae50a78322a79124516af1cd.json similarity index 52% rename from .sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json rename to .sqlx/query-3ffc7db9c71b9933f13aebc6a4a7b3d3c9586e78ae50a78322a79124516af1cd.json index b176020c..5042b83b 100644 --- a/.sqlx/query-68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278.json +++ b/.sqlx/query-3ffc7db9c71b9933f13aebc6a4a7b3d3c9586e78ae50a78322a79124516af1cd.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE batch_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "68ab81fc79caf9b85553413cbd7ab55c64b7249309d6f23fba6b2d0c4c8dd278" + "hash": "3ffc7db9c71b9933f13aebc6a4a7b3d3c9586e78ae50a78322a79124516af1cd" } diff --git a/.sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json b/.sqlx/query-42f8b84317c23636033b640c676acc8e4c07dcafee002b768a02e2a82b414507.json similarity index 56% rename from .sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json rename to .sqlx/query-42f8b84317c23636033b640c676acc8e4c07dcafee002b768a02e2a82b414507.json index b0710c43..177791ed 100644 --- a/.sqlx/query-171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32.json +++ b/.sqlx/query-42f8b84317c23636033b640c676acc8e4c07dcafee002b768a02e2a82b414507.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "171d103c537d328fdd4a20d4f9c803755714cc2718dae0cdc760aeb279039e32" + "hash": "42f8b84317c23636033b640c676acc8e4c07dcafee002b768a02e2a82b414507" } diff --git a/.sqlx/query-459e6f5ecb870b4762324c2d19173f239f1b4c71b58b475e5c6bc1b66783d877.json b/.sqlx/query-459e6f5ecb870b4762324c2d19173f239f1b4c71b58b475e5c6bc1b66783d877.json new file mode 100644 index 00000000..64b28631 --- /dev/null +++ b/.sqlx/query-459e6f5ecb870b4762324c2d19173f239f1b4c71b58b475e5c6bc1b66783d877.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE payout_queue_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "459e6f5ecb870b4762324c2d19173f239f1b4c71b58b475e5c6bc1b66783d877" +} diff --git a/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json b/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json deleted file mode 100644 index 99cfb716..00000000 --- a/.sqlx/query-45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_wallet_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "45b7e3d8b6bc5398f315f53cb98ec2dc0cad55a1d45e0808ba34c5f0337aaa3c" -} diff --git a/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json b/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json deleted file mode 100644 index 93d3a896..00000000 --- a/.sqlx/query-46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payout_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "46165e61eae874adb15c1736e276582000d822c85fade65952ab1e0fa30028a8" -} diff --git a/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json b/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json deleted file mode 100644 index 1e9cccbe..00000000 --- a/.sqlx/query-4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_xpub_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "4b6bb146a75c3d72bb7bc3d6a27e4373a02c02b4759749ed43a8814ce8454bed" -} diff --git a/.sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json b/.sqlx/query-4bd1b6db31988bbc58bc01e75ba3979ca28a59910bd5c8b7f09106a0f55247d9.json similarity index 58% rename from .sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json rename to .sqlx/query-4bd1b6db31988bbc58bc01e75ba3979ca28a59910bd5c8b7f09106a0f55247d9.json index 44832298..8e99d7ef 100644 --- a/.sqlx/query-a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62.json +++ b/.sqlx/query-4bd1b6db31988bbc58bc01e75ba3979ca28a59910bd5c8b7f09106a0f55247d9.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "a5dcac14e803fc748bd12f5724efbe4236abbb8f10ec2c999aa03b9a63540c62" + "hash": "4bd1b6db31988bbc58bc01e75ba3979ca28a59910bd5c8b7f09106a0f55247d9" } diff --git a/.sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json b/.sqlx/query-4d18acca29015f43bba9b8432af0f20dfef2d1cc2d2b680a173255dd17b36290.json similarity index 57% rename from .sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json rename to .sqlx/query-4d18acca29015f43bba9b8432af0f20dfef2d1cc2d2b680a173255dd17b36290.json index 6161c38b..387a4a11 100644 --- a/.sqlx/query-075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622.json +++ b/.sqlx/query-4d18acca29015f43bba9b8432af0f20dfef2d1cc2d2b680a173255dd17b36290.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "075d803dd441917812829c53a140f008830de25f22bb878582e359d146f6a622" + "hash": "4d18acca29015f43bba9b8432af0f20dfef2d1cc2d2b680a173255dd17b36290" } diff --git a/.sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json b/.sqlx/query-4e20d7faf0a2ba905ad5bbc8c8f23373bdc25ad32843725868a5218678cdfff0.json similarity index 57% rename from .sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json rename to .sqlx/query-4e20d7faf0a2ba905ad5bbc8c8f23373bdc25ad32843725868a5218678cdfff0.json index 043c781b..767e5405 100644 --- a/.sqlx/query-fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4.json +++ b/.sqlx/query-4e20d7faf0a2ba905ad5bbc8c8f23373bdc25ad32843725868a5218678cdfff0.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "fb5ba6a4059104487a780de12ee96c317d130d42145d64525f0c5b2c59ef79d4" + "hash": "4e20d7faf0a2ba905ad5bbc8c8f23373bdc25ad32843725868a5218678cdfff0" } diff --git a/.sqlx/query-4e35dd7dff49406af0e56f17e8b9948483fbf370cf28fc0d5736fc15da01acc3.json b/.sqlx/query-4e35dd7dff49406af0e56f17e8b9948483fbf370cf28fc0d5736fc15da01acc3.json new file mode 100644 index 00000000..4af9551f --- /dev/null +++ b/.sqlx/query-4e35dd7dff49406af0e56f17e8b9948483fbf370cf28fc0d5736fc15da01acc3.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_profile_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "4e35dd7dff49406af0e56f17e8b9948483fbf370cf28fc0d5736fc15da01acc3" +} diff --git a/.sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json b/.sqlx/query-51ff446a8164f54bc059968fa858b1940a601adcf8bcab6dbacd0d2befa1fc4c.json similarity index 57% rename from .sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json rename to .sqlx/query-51ff446a8164f54bc059968fa858b1940a601adcf8bcab6dbacd0d2befa1fc4c.json index 7ea28db2..98bd766e 100644 --- a/.sqlx/query-c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73.json +++ b/.sqlx/query-51ff446a8164f54bc059968fa858b1940a601adcf8bcab6dbacd0d2befa1fc4c.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "c0ff69fdf12d59cee2bb8be46e5f1659f31b9c3f573a243947fc109f4320ad73" + "hash": "51ff446a8164f54bc059968fa858b1940a601adcf8bcab6dbacd0d2befa1fc4c" } diff --git a/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json b/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json deleted file mode 100644 index 62675cca..00000000 --- a/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n SELECT details_json FROM bdk_transactions WHERE keychain_id = $1 AND tx_id = $2 AND deleted_at IS NULL", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "details_json", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Text" - ] - }, - "nullable": [ - false - ] - }, - "hash": "5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b" -} diff --git a/.sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json b/.sqlx/query-54e30a8dd82a2bc27930bcea9795aae5f9df159a10a96ea039ce50e7d0574bcc.json similarity index 54% rename from .sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json rename to .sqlx/query-54e30a8dd82a2bc27930bcea9795aae5f9df159a10a96ea039ce50e7d0574bcc.json index dafd433c..d3800284 100644 --- a/.sqlx/query-9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6.json +++ b/.sqlx/query-54e30a8dd82a2bc27930bcea9795aae5f9df159a10a96ea039ce50e7d0574bcc.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "9683b8463e76d48965081d9349c376425c07246847cfe0c2df1dc8f16a906ed6" + "hash": "54e30a8dd82a2bc27930bcea9795aae5f9df159a10a96ea039ce50e7d0574bcc" } diff --git a/.sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json b/.sqlx/query-56245d97b2e9a48700f079f567191a943aacf384d483a205195fd54362179348.json similarity index 60% rename from .sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json rename to .sqlx/query-56245d97b2e9a48700f079f567191a943aacf384d483a205195fd54362179348.json index 8100824d..6d7e117c 100644 --- a/.sqlx/query-4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c.json +++ b/.sqlx/query-56245d97b2e9a48700f079f567191a943aacf384d483a205195fd54362179348.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE kind = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE kind = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -36,15 +41,17 @@ ] } } - } + }, + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "4c26678e5824141658f51e0fe0f00b9a2d9a2bce05e1d770a28a659eb56e527c" + "hash": "56245d97b2e9a48700f079f567191a943aacf384d483a205195fd54362179348" } diff --git a/.sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json b/.sqlx/query-56d5a9bb547f49305d360044132faf625c162539dc7460bb9a99202e245192cb.json similarity index 59% rename from .sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json rename to .sqlx/query-56d5a9bb547f49305d360044132faf625c162539dc7460bb9a99202e245192cb.json index a859710b..82f9db44 100644 --- a/.sqlx/query-a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c.json +++ b/.sqlx/query-56d5a9bb547f49305d360044132faf625c162539dc7460bb9a99202e245192cb.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external'\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND wallet_id = $2 AND kind = 'external'\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Uuid", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "a775c40fb8a51fd48784c8c1e1013c70b47f006b9fb5b06bd9edb1c525f1da9c" + "hash": "56d5a9bb547f49305d360044132faf625c162539dc7460bb9a99202e245192cb" } diff --git a/.sqlx/query-593323e63055f2d9bd582985fd48f145d4005a8b1de856a8664f00bab143e8ae.json b/.sqlx/query-593323e63055f2d9bd582985fd48f145d4005a8b1de856a8664f00bab143e8ae.json new file mode 100644 index 00000000..7d28b1ff --- /dev/null +++ b/.sqlx/query-593323e63055f2d9bd582985fd48f145d4005a8b1de856a8664f00bab143e8ae.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE wallet_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "593323e63055f2d9bd582985fd48f145d4005a8b1de856a8664f00bab143e8ae" +} diff --git a/.sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json b/.sqlx/query-5a520520a9bd611ae87e57bdb5b6e8a14f63396dbce8ad30e9fe53211f08037b.json similarity index 67% rename from .sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json rename to .sqlx/query-5a520520a9bd611ae87e57bdb5b6e8a14f63396dbce8ad30e9fe53211f08037b.json index 109644a6..83aca234 100644 --- a/.sqlx/query-d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc.json +++ b/.sqlx/query-5a520520a9bd611ae87e57bdb5b6e8a14f63396dbce8ad30e9fe53211f08037b.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_xpubs (id, account_id, name, fingerprint, created_at) VALUES ($1, $2, $3, $4, $5)", + "query": "INSERT INTO bria_xpubs (id, account_id, name, fingerprint, created_at) VALUES ($1, $2, $3, $4, COALESCE($5, NOW()))", "describe": { "columns": [], "parameters": { @@ -14,5 +14,5 @@ }, "nullable": [] }, - "hash": "d3172808c82cb7cf61f33efb7c3c023fe21eced9e7f469e2a841b2fdeb4f71fc" + "hash": "5a520520a9bd611ae87e57bdb5b6e8a14f63396dbce8ad30e9fe53211f08037b" } diff --git a/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json b/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json deleted file mode 100644 index a0d78a89..00000000 --- a/.sqlx/query-5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE address = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "5acb95d3b6bc496f1be6b64879e3999766253a1586805ad303d08353283d4916" -} diff --git a/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json b/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json deleted file mode 100644 index dc2a5afe..00000000 --- a/.sqlx/query-5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_profile_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "5f5f7776bceeec55b375f47ceec67d2d5d99783da25e3f0b812eb9f8140fd2ea" -} diff --git a/.sqlx/query-619d3dbbf8890d02af8ec73faf9c846b671d492594c4648a744923a9c698285d.json b/.sqlx/query-619d3dbbf8890d02af8ec73faf9c846b671d492594c4648a744923a9c698285d.json new file mode 100644 index 00000000..025bbe46 --- /dev/null +++ b/.sqlx/query-619d3dbbf8890d02af8ec73faf9c846b671d492594c4648a744923a9c698285d.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "619d3dbbf8890d02af8ec73faf9c846b671d492594c4648a744923a9c698285d" +} diff --git a/.sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json b/.sqlx/query-6342025cec28f3494d84abd198aee2ba0be98637ff24d795ecda1a2986dde453.json similarity index 53% rename from .sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json rename to .sqlx/query-6342025cec28f3494d84abd198aee2ba0be98637ff24d795ecda1a2986dde453.json index b2323303..5ee10968 100644 --- a/.sqlx/query-45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964.json +++ b/.sqlx/query-6342025cec28f3494d84abd198aee2ba0be98637ff24d795ecda1a2986dde453.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE account_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE address = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "45cbabfb19613341c95ca14ff06fc25b669d3f054b4b312d9b00f768d8487964" + "hash": "6342025cec28f3494d84abd198aee2ba0be98637ff24d795ecda1a2986dde453" } diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json deleted file mode 100644 index 105bf98b..00000000 --- a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - "Jsonb", - "Jsonb", - "Jsonb", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" -} diff --git a/.sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json b/.sqlx/query-640cb941e8bc937e7c03ade967c55fb36c6e4a98a93b2b6d493b1ba70aa09ad2.json similarity index 56% rename from .sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json rename to .sqlx/query-640cb941e8bc937e7c03ade967c55fb36c6e4a98a93b2b6d493b1ba70aa09ad2.json index 18255d9f..f0b2f650 100644 --- a/.sqlx/query-d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed.json +++ b/.sqlx/query-640cb941e8bc937e7c03ade967c55fb36c6e4a98a93b2b6d493b1ba70aa09ad2.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND address = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND address = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "d354c0be1712533bfc1a1632f790cbbc0b6cb1aa2b95b5cce0e07ab19d1f32ed" + "hash": "640cb941e8bc937e7c03ade967c55fb36c6e4a98a93b2b6d493b1ba70aa09ad2" } diff --git a/.sqlx/query-5fd0b1e82a6c273fd0359f895a829d21aa1580f41291f812cae3d77cc5bfa172.json b/.sqlx/query-6410d6d28f9f27588505ca95ac67fdec18f377bd0fc9d1d33c31f3f0b79d459d.json similarity index 58% rename from .sqlx/query-5fd0b1e82a6c273fd0359f895a829d21aa1580f41291f812cae3d77cc5bfa172.json rename to .sqlx/query-6410d6d28f9f27588505ca95ac67fdec18f377bd0fc9d1d33c31f3f0b79d459d.json index 7dfa2e92..7f768a4d 100644 --- a/.sqlx/query-5fd0b1e82a6c273fd0359f895a829d21aa1580f41291f812cae3d77cc5bfa172.json +++ b/.sqlx/query-6410d6d28f9f27588505ca95ac67fdec18f377bd0fc9d1d33c31f3f0b79d459d.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_payout_queues WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payout_queues WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "5fd0b1e82a6c273fd0359f895a829d21aa1580f41291f812cae3d77cc5bfa172" + "hash": "6410d6d28f9f27588505ca95ac67fdec18f377bd0fc9d1d33c31f3f0b79d459d" } diff --git a/.sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json b/.sqlx/query-651c7f85cde2b21940a6d78ac5b2e33e910a69ab164432e6cf4cbad42aabb6c8.json similarity index 58% rename from .sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json rename to .sqlx/query-651c7f85cde2b21940a6d78ac5b2e33e910a69ab164432e6cf4cbad42aabb6c8.json index d26d08a0..6900eb83 100644 --- a/.sqlx/query-b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75.json +++ b/.sqlx/query-651c7f85cde2b21940a6d78ac5b2e33e910a69ab164432e6cf4cbad42aabb6c8.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "b1287f6ecc702a96f4836b30b71e0029f8f09034a5a6b7c79af6764cb271de75" + "hash": "651c7f85cde2b21940a6d78ac5b2e33e910a69ab164432e6cf4cbad42aabb6c8" } diff --git a/.sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json b/.sqlx/query-67a94493771ad889e590e34119af5a4dcbcc639b64db76868f18c282496fd9d8.json similarity index 53% rename from .sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json rename to .sqlx/query-67a94493771ad889e590e34119af5a4dcbcc639b64db76868f18c282496fd9d8.json index 9cc23fda..e0ccd24a 100644 --- a/.sqlx/query-4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270.json +++ b/.sqlx/query-67a94493771ad889e590e34119af5a4dcbcc639b64db76868f18c282496fd9d8.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE account_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE batch_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "4bfc832f84f24272d57725f6eabd6929514880fc0849fe3f491fbf3653e3d270" + "hash": "67a94493771ad889e590e34119af5a4dcbcc639b64db76868f18c282496fd9d8" } diff --git a/.sqlx/query-68b14c073e8cf6ba8e9ab0eec3196ddaf5431985cacecc4ded972cbdd76c0ea0.json b/.sqlx/query-68b14c073e8cf6ba8e9ab0eec3196ddaf5431985cacecc4ded972cbdd76c0ea0.json new file mode 100644 index 00000000..a82b0b52 --- /dev/null +++ b/.sqlx/query-68b14c073e8cf6ba8e9ab0eec3196ddaf5431985cacecc4ded972cbdd76c0ea0.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE profile_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "68b14c073e8cf6ba8e9ab0eec3196ddaf5431985cacecc4ded972cbdd76c0ea0" +} diff --git a/.sqlx/query-69bd5e490e0e0a1eff1fda2616f73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f.json b/.sqlx/query-69bd5e490e0e0a1eff1fda2616f73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f.json new file mode 100644 index 00000000..0c5722f4 --- /dev/null +++ b/.sqlx/query-69bd5e490e0e0a1eff1fda2616f73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE external_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "69bd5e490e0e0a1eff1fda2616f73e89a70fb1b35fe55b36fe4ba7a6b72d0c7f" +} diff --git a/.sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json b/.sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json deleted file mode 100644 index ef5cda1d..00000000 --- a/.sqlx/query-6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: Uuid\", e.sequence, e.event, e.recorded_at FROM bria_addresses i JOIN bria_address_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "6ab35dea93deca0daf3bce610cad8d5c3231904ff40f8074cb16403066a8d39a" -} diff --git a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json deleted file mode 100644 index 60f58c60..00000000 --- a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT NOW()", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "now", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [] - }, - "nullable": [ - null - ] - }, - "hash": "6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc" -} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json deleted file mode 100644 index 074622c1..00000000 --- a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - } - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" -} diff --git a/.sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json b/.sqlx/query-6fa7a9326c5d6e6c6df0ca32ccc19d8087435b01729b10c9bf03d9fece190620.json similarity index 52% rename from .sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json rename to .sqlx/query-6fa7a9326c5d6e6c6df0ca32ccc19d8087435b01729b10c9bf03d9fece190620.json index 63608c6c..cb6fb9f5 100644 --- a/.sqlx/query-c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77.json +++ b/.sqlx/query-6fa7a9326c5d6e6c6df0ca32ccc19d8087435b01729b10c9bf03d9fece190620.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE account_id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "c9b6486e0c115841de1899359897a649a532533b20fce7d6911164fe5409dd77" + "hash": "6fa7a9326c5d6e6c6df0ca32ccc19d8087435b01729b10c9bf03d9fece190620" } diff --git a/.sqlx/query-73e923f09d1669e337752eff676842a5247b8f632258c8344c78cf9eb63aadb7.json b/.sqlx/query-73e923f09d1669e337752eff676842a5247b8f632258c8344c78cf9eb63aadb7.json new file mode 100644 index 00000000..bef53f0b --- /dev/null +++ b/.sqlx/query-73e923f09d1669e337752eff676842a5247b8f632258c8344c78cf9eb63aadb7.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "73e923f09d1669e337752eff676842a5247b8f632258c8344c78cf9eb63aadb7" +} diff --git a/.sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json b/.sqlx/query-74e5556f4ce33703b1f885b77025944a11182e90c444f05d7590b2f8cf6388d4.json similarity index 59% rename from .sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json rename to .sqlx/query-74e5556f4ce33703b1f885b77025944a11182e90c444f05d7590b2f8cf6388d4.json index 1c29115f..5cecc3e3 100644 --- a/.sqlx/query-245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2.json +++ b/.sqlx/query-74e5556f4ce33703b1f885b77025944a11182e90c444f05d7590b2f8cf6388d4.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_wallets WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "245f85dc4e83e58c265eb9f8946e605c057e17ab90599f89785a9a9ec52db9f2" + "hash": "74e5556f4ce33703b1f885b77025944a11182e90c444f05d7590b2f8cf6388d4" } diff --git a/.sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json b/.sqlx/query-754a9e381f4f1380f333aa10d4736056af57b2963edfc3ca8d75bfc7927b8a28.json similarity index 58% rename from .sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json rename to .sqlx/query-754a9e381f4f1380f333aa10d4736056af57b2963edfc3ca8d75bfc7927b8a28.json index 7301662a..e801fef2 100644 --- a/.sqlx/query-540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e.json +++ b/.sqlx/query-754a9e381f4f1380f333aa10d4736056af57b2963edfc3ca8d75bfc7927b8a28.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "540ba444e8a5ee009e0765cb729787d936751e83fff0a3ab061b91c75aa1822e" + "hash": "754a9e381f4f1380f333aa10d4736056af57b2963edfc3ca8d75bfc7927b8a28" } diff --git a/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json b/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json deleted file mode 100644 index 12beaea3..00000000 --- a/.sqlx/query-7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "7641ed4f9eb23d6f2bd14108650d76bf3ac9e8264d2b8dbc9abe7799fea73623" -} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json deleted file mode 100644 index 7857e9f9..00000000 --- a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "code", - "type_info": "Varchar" - }, - { - "ordinal": 2, - "name": "params", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "tx_input", - "type_info": "Jsonb" - }, - { - "ordinal": 4, - "name": "entries", - "type_info": "Jsonb" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - true, - false, - false - ] - }, - "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" -} diff --git a/.sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json b/.sqlx/query-79e09f688287c0e77c5d52fd4f3834f1d2f3bc009f86e3f5c4f948392f077555.json similarity index 57% rename from .sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json rename to .sqlx/query-79e09f688287c0e77c5d52fd4f3834f1d2f3bc009f86e3f5c4f948392f077555.json index bad2e242..f3d3bce1 100644 --- a/.sqlx/query-3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b.json +++ b/.sqlx/query-79e09f688287c0e77c5d52fd4f3834f1d2f3bc009f86e3f5c4f948392f077555.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "3c680e2eada9c96444764f367efbb8180291099d89ed63e0e52aaab5fcef870b" + "hash": "79e09f688287c0e77c5d52fd4f3834f1d2f3bc009f86e3f5c4f948392f077555" } diff --git a/.sqlx/query-7bc59c8ce644a8ee34259fcb48cc67ca55a129d5c98b1a9bf0080d3ee0188fee.json b/.sqlx/query-7bc59c8ce644a8ee34259fcb48cc67ca55a129d5c98b1a9bf0080d3ee0188fee.json new file mode 100644 index 00000000..0593e255 --- /dev/null +++ b/.sqlx/query-7bc59c8ce644a8ee34259fcb48cc67ca55a129d5c98b1a9bf0080d3ee0188fee.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_address_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "7bc59c8ce644a8ee34259fcb48cc67ca55a129d5c98b1a9bf0080d3ee0188fee" +} diff --git a/.sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json b/.sqlx/query-8088ec5ad2424a142a976b47a26625ac25b90d86ae8cf2a0757c9b5fbc277559.json similarity index 56% rename from .sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json rename to .sqlx/query-8088ec5ad2424a142a976b47a26625ac25b90d86ae8cf2a0757c9b5fbc277559.json index 62fc101e..7e000f78 100644 --- a/.sqlx/query-4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9.json +++ b/.sqlx/query-8088ec5ad2424a142a976b47a26625ac25b90d86ae8cf2a0757c9b5fbc277559.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND name = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND name = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "4e292c52d045715856a8b4338a043bfa7ac3c9166ad4ad14de3b5545858ff0c9" + "hash": "8088ec5ad2424a142a976b47a26625ac25b90d86ae8cf2a0757c9b5fbc277559" } diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json deleted file mode 100644 index 3c7819b4..00000000 --- a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json +++ /dev/null @@ -1,148 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" -} diff --git a/.sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json b/.sqlx/query-839e3df591c13563d89a06f0b31a559bf4f8df385640d94522c32af78c1d9f86.json similarity index 68% rename from .sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json rename to .sqlx/query-839e3df591c13563d89a06f0b31a559bf4f8df385640d94522c32af78c1d9f86.json index 90abc5db..2f5b29ab 100644 --- a/.sqlx/query-3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106.json +++ b/.sqlx/query-839e3df591c13563d89a06f0b31a559bf4f8df385640d94522c32af78c1d9f86.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_wallets (id, name, account_id, created_at) VALUES ($1, $2, $3, $4)", + "query": "INSERT INTO bria_wallets (id, name, account_id, created_at) VALUES ($1, $2, $3, COALESCE($4, NOW()))", "describe": { "columns": [], "parameters": { @@ -13,5 +13,5 @@ }, "nullable": [] }, - "hash": "3e6fe643027b5ba13c8a1d1cbe47e996563625202c246c34e8e2e06aab5d6106" + "hash": "839e3df591c13563d89a06f0b31a559bf4f8df385640d94522c32af78c1d9f86" } diff --git a/.sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json b/.sqlx/query-8420a910396dae3967aac75e1ca9d98c7e2d5918b4c35509875a8c0f484868d1.json similarity index 55% rename from .sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json rename to .sqlx/query-8420a910396dae3967aac75e1ca9d98c7e2d5918b4c35509875a8c0f484868d1.json index 08c4d9e1..733722e2 100644 --- a/.sqlx/query-aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6.json +++ b/.sqlx/query-8420a910396dae3967aac75e1ca9d98c7e2d5918b4c35509875a8c0f484868d1.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND id = $2\n FOR UPDATE) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts\n WHERE account_id = $1 AND id = $2\n FOR UPDATE) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "aee82e45809292e4a3a2920955b1c37ab1187398143ae9fdb54b7d9aa30a65a6" + "hash": "8420a910396dae3967aac75e1ca9d98c7e2d5918b4c35509875a8c0f484868d1" } diff --git a/.sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json b/.sqlx/query-84d91e20f5d28bbab272e4d481b359c634703516e9ea01223db85d95b4744870.json similarity index 53% rename from .sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json rename to .sqlx/query-84d91e20f5d28bbab272e4d481b359c634703516e9ea01223db85d95b4744870.json index ee686166..f1b654c7 100644 --- a/.sqlx/query-69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b.json +++ b/.sqlx/query-84d91e20f5d28bbab272e4d481b359c634703516e9ea01223db85d95b4744870.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE account_id = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE name = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "69b7e0c47b72c12a2e63633fff3f71ff58ab8ac188f073ff4d2c7877f64ffc5b" + "hash": "84d91e20f5d28bbab272e4d481b359c634703516e9ea01223db85d95b4744870" } diff --git a/.sqlx/query-89eb48e57e3bd851f7be9e177da99107e86eeb4e9c1c0884dbed1b39af235de3.json b/.sqlx/query-89eb48e57e3bd851f7be9e177da99107e86eeb4e9c1c0884dbed1b39af235de3.json new file mode 100644 index 00000000..a0c4d2ef --- /dev/null +++ b/.sqlx/query-89eb48e57e3bd851f7be9e177da99107e86eeb4e9c1c0884dbed1b39af235de3.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE profile_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "89eb48e57e3bd851f7be9e177da99107e86eeb4e9c1c0884dbed1b39af235de3" +} diff --git a/.sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json b/.sqlx/query-8bed18f3ad626ecf4f87a4f40f9bb33bd35105facfcdea1a16bcb5cc8edb82b8.json similarity index 64% rename from .sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json rename to .sqlx/query-8bed18f3ad626ecf4f87a4f40f9bb33bd35105facfcdea1a16bcb5cc8edb82b8.json index 772620b1..b5a4d9f6 100644 --- a/.sqlx/query-eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9.json +++ b/.sqlx/query-8bed18f3ad626ecf4f87a4f40f9bb33bd35105facfcdea1a16bcb5cc8edb82b8.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_signing_sessions (id, batch_id, account_id, xpub_fingerprint, created_at) VALUES ($1, $2, $3, $4, $5)", + "query": "INSERT INTO bria_signing_sessions (id, batch_id, account_id, xpub_fingerprint, created_at) VALUES ($1, $2, $3, $4, COALESCE($5, NOW()))", "describe": { "columns": [], "parameters": { @@ -14,5 +14,5 @@ }, "nullable": [] }, - "hash": "eb64c29bd8eae180d412153b630d1e23b087e742f039a1b2b3375ffd537a60f9" + "hash": "8bed18f3ad626ecf4f87a4f40f9bb33bd35105facfcdea1a16bcb5cc8edb82b8" } diff --git a/.sqlx/query-8cce80df3c9d7536556247bf40d2a9e30acca15fdcf381dd6a89853f95960fef.json b/.sqlx/query-8cce80df3c9d7536556247bf40d2a9e30acca15fdcf381dd6a89853f95960fef.json new file mode 100644 index 00000000..04ada43a --- /dev/null +++ b/.sqlx/query-8cce80df3c9d7536556247bf40d2a9e30acca15fdcf381dd6a89853f95960fef.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE xpub_fingerprint = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Bytea", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "8cce80df3c9d7536556247bf40d2a9e30acca15fdcf381dd6a89853f95960fef" +} diff --git a/.sqlx/query-8d382d165e54a659f3afeaf155e2981e6f4172ce7b7b8d4d66ea8021cd6c88d4.json b/.sqlx/query-8d382d165e54a659f3afeaf155e2981e6f4172ce7b7b8d4d66ea8021cd6c88d4.json new file mode 100644 index 00000000..6cba081b --- /dev/null +++ b/.sqlx/query-8d382d165e54a659f3afeaf155e2981e6f4172ce7b7b8d4d66ea8021cd6c88d4.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "8d382d165e54a659f3afeaf155e2981e6f4172ce7b7b8d4d66ea8021cd6c88d4" +} diff --git a/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json b/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json deleted file mode 100644 index ad12e39a..00000000 --- a/.sqlx/query-8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM bria_signing_sessions i JOIN bria_signing_session_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: SigningSessionId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "8d6247a9e4b8038058ec9ead6563e5cc1946454643c6b5c883393ff712bd4824" -} diff --git a/.sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json b/.sqlx/query-8d68beea7322d53f605613244f5ea717e83e70970404850f745d94ed3e26b012.json similarity index 58% rename from .sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json rename to .sqlx/query-8d68beea7322d53f605613244f5ea717e83e70970404850f745d94ed3e26b012.json index cf14e966..942e2e63 100644 --- a/.sqlx/query-3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293.json +++ b/.sqlx/query-8d68beea7322d53f605613244f5ea717e83e70970404850f745d94ed3e26b012.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_addresses WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "3d6dafc78f9239c955080e2df93725da08b9cf49592d34d4cacd1e858455b293" + "hash": "8d68beea7322d53f605613244f5ea717e83e70970404850f745d94ed3e26b012" } diff --git a/.sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json b/.sqlx/query-8da2c300e2c276f0838877f4ac213e524b6fb53e4e52d80c90aeb6d27b59472b.json similarity index 56% rename from .sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json rename to .sqlx/query-8da2c300e2c276f0838877f4ac213e524b6fb53e4e52d80c90aeb6d27b59472b.json index 7b848fb1..a9c35aa9 100644 --- a/.sqlx/query-d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd.json +++ b/.sqlx/query-8da2c300e2c276f0838877f4ac213e524b6fb53e4e52d80c90aeb6d27b59472b.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "d7e3c2680274b3817322d6755452ed2eb5b426d159e55362c2a5fb723cc3fbdd" + "hash": "8da2c300e2c276f0838877f4ac213e524b6fb53e4e52d80c90aeb6d27b59472b" } diff --git a/.sqlx/query-23f65a29469fd45c85a7397f24d4334b68d7b2882b7dc4ffb647d1a52f72a1f9.json b/.sqlx/query-8e3974b17ab74e96b834e82593e5540aedf3a772ffcf06983e57b85849a6920d.json similarity index 53% rename from .sqlx/query-23f65a29469fd45c85a7397f24d4334b68d7b2882b7dc4ffb647d1a52f72a1f9.json rename to .sqlx/query-8e3974b17ab74e96b834e82593e5540aedf3a772ffcf06983e57b85849a6920d.json index 959f153e..3d87e42f 100644 --- a/.sqlx/query-23f65a29469fd45c85a7397f24d4334b68d7b2882b7dc4ffb647d1a52f72a1f9.json +++ b/.sqlx/query-8e3974b17ab74e96b834e82593e5540aedf3a772ffcf06983e57b85849a6920d.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE id = $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE name = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "23f65a29469fd45c85a7397f24d4334b68d7b2882b7dc4ffb647d1a52f72a1f9" + "hash": "8e3974b17ab74e96b834e82593e5540aedf3a772ffcf06983e57b85849a6920d" } diff --git a/.sqlx/query-9d256f3a0b0b53e5a22e1a4aac6b12fc8e509bd0e46e74af00165d1a6967fb43.json b/.sqlx/query-8e4f7e84cfe51ef1d96cca775484a615467540ce6400d8a1a0f281ebcfcb0914.json similarity index 53% rename from .sqlx/query-9d256f3a0b0b53e5a22e1a4aac6b12fc8e509bd0e46e74af00165d1a6967fb43.json rename to .sqlx/query-8e4f7e84cfe51ef1d96cca775484a615467540ce6400d8a1a0f281ebcfcb0914.json index 8b8c20ff..dd192f1c 100644 --- a/.sqlx/query-9d256f3a0b0b53e5a22e1a4aac6b12fc8e509bd0e46e74af00165d1a6967fb43.json +++ b/.sqlx/query-8e4f7e84cfe51ef1d96cca775484a615467540ce6400d8a1a0f281ebcfcb0914.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE account_id = $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "9d256f3a0b0b53e5a22e1a4aac6b12fc8e509bd0e46e74af00165d1a6967fb43" + "hash": "8e4f7e84cfe51ef1d96cca775484a615467540ce6400d8a1a0f281ebcfcb0914" } diff --git a/.sqlx/query-914a4e691e66ffebf6a3826358b035d1fbb1cb58570d3ffce6fdcd2ee98d7754.json b/.sqlx/query-914a4e691e66ffebf6a3826358b035d1fbb1cb58570d3ffce6fdcd2ee98d7754.json new file mode 100644 index 00000000..411ee866 --- /dev/null +++ b/.sqlx/query-914a4e691e66ffebf6a3826358b035d1fbb1cb58570d3ffce6fdcd2ee98d7754.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "914a4e691e66ffebf6a3826358b035d1fbb1cb58570d3ffce6fdcd2ee98d7754" +} diff --git a/.sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json b/.sqlx/query-918f542fb54a94b1b44d84064afc45f2216292d36205ea145014c06a4d795939.json similarity index 58% rename from .sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json rename to .sqlx/query-918f542fb54a94b1b44d84064afc45f2216292d36205ea145014c06a4d795939.json index fb1ed0cf..ba1cde0a 100644 --- a/.sqlx/query-fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e.json +++ b/.sqlx/query-918f542fb54a94b1b44d84064afc45f2216292d36205ea145014c06a4d795939.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "fdbc65d34af6e00c394dee6026de85bf90df3e4bfaf564c808b9efefd5c3e00e" + "hash": "918f542fb54a94b1b44d84064afc45f2216292d36205ea145014c06a4d795939" } diff --git a/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json b/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json deleted file mode 100644 index 2e903050..00000000 --- a/.sqlx/query-92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE external_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: PayoutId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "92ec7d37678c03a86e73612028c116983265d413065de43dbf1d1e00f483ef3e" -} diff --git a/.sqlx/query-933623d4358ba31ba8d7190fdee7deabf19d4205592b96fd6e11594cc8ef027b.json b/.sqlx/query-933623d4358ba31ba8d7190fdee7deabf19d4205592b96fd6e11594cc8ef027b.json new file mode 100644 index 00000000..7d77b50e --- /dev/null +++ b/.sqlx/query-933623d4358ba31ba8d7190fdee7deabf19d4205592b96fd6e11594cc8ef027b.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "933623d4358ba31ba8d7190fdee7deabf19d4205592b96fd6e11594cc8ef027b" +} diff --git a/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json b/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json deleted file mode 100644 index f3923a59..00000000 --- a/.sqlx/query-93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_profile_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "93f7f856eb714af5a922f1dbb9290f4ff385da85805ceb84ef85f0e217700964" -} diff --git a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json deleted file mode 100644 index 00d0da2e..00000000 --- a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" -} diff --git a/.sqlx/query-8c4b17e1bba1c218315a0c7f6607772f58e417b6fdf35d8574f60a463d65845c.json b/.sqlx/query-9a2b2debb16baddba43e014451b6e0bdfdc49d66dd759985b95a1779aeee93ae.json similarity index 55% rename from .sqlx/query-8c4b17e1bba1c218315a0c7f6607772f58e417b6fdf35d8574f60a463d65845c.json rename to .sqlx/query-9a2b2debb16baddba43e014451b6e0bdfdc49d66dd759985b95a1779aeee93ae.json index 4ae5a85d..5656af5c 100644 --- a/.sqlx/query-8c4b17e1bba1c218315a0c7f6607772f58e417b6fdf35d8574f60a463d65845c.json +++ b/.sqlx/query-9a2b2debb16baddba43e014451b6e0bdfdc49d66dd759985b95a1779aeee93ae.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "8c4b17e1bba1c218315a0c7f6607772f58e417b6fdf35d8574f60a463d65845c" + "hash": "9a2b2debb16baddba43e014451b6e0bdfdc49d66dd759985b95a1779aeee93ae" } diff --git a/.sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json b/.sqlx/query-9d7db85c1b9a773f7605b9afc8487bc61d0784a24b3850ad29654d4682cc6ff2.json similarity index 53% rename from .sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json rename to .sqlx/query-9d7db85c1b9a773f7605b9afc8487bc61d0784a24b3850ad29654d4682cc6ff2.json index 546836da..ea090b45 100644 --- a/.sqlx/query-ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37.json +++ b/.sqlx/query-9d7db85c1b9a773f7605b9afc8487bc61d0784a24b3850ad29654d4682cc6ff2.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE id = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "ca5a60eee663d29bfb92e3f2573048aa40abdbf41729814ab96a57f41b760b37" + "hash": "9d7db85c1b9a773f7605b9afc8487bc61d0784a24b3850ad29654d4682cc6ff2" } diff --git a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json deleted file mode 100644 index f856a851..00000000 --- a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false - ] - }, - "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" -} diff --git a/.sqlx/query-f99ff7aa299fc02d49329c7b7558fa9a67b1b9e00dc1fe2ac7ea94a378d56a50.json b/.sqlx/query-a058cbc5f52a218ed02f0e163a0b2ae2bceb907599767b008e62da99b3eda013.json similarity index 55% rename from .sqlx/query-f99ff7aa299fc02d49329c7b7558fa9a67b1b9e00dc1fe2ac7ea94a378d56a50.json rename to .sqlx/query-a058cbc5f52a218ed02f0e163a0b2ae2bceb907599767b008e62da99b3eda013.json index f891416c..b710c899 100644 --- a/.sqlx/query-f99ff7aa299fc02d49329c7b7558fa9a67b1b9e00dc1fe2ac7ea94a378d56a50.json +++ b/.sqlx/query-a058cbc5f52a218ed02f0e163a0b2ae2bceb907599767b008e62da99b3eda013.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "f99ff7aa299fc02d49329c7b7558fa9a67b1b9e00dc1fe2ac7ea94a378d56a50" + "hash": "a058cbc5f52a218ed02f0e163a0b2ae2bceb907599767b008e62da99b3eda013" } diff --git a/.sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json b/.sqlx/query-a2d860909e1587d9841dde47da88db794ebe87976c216efef7014d21ce8c4a35.json similarity index 53% rename from .sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json rename to .sqlx/query-a2d860909e1587d9841dde47da88db794ebe87976c216efef7014d21ce8c4a35.json index a167297e..d110c4c8 100644 --- a/.sqlx/query-0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708.json +++ b/.sqlx/query-a2d860909e1587d9841dde47da88db794ebe87976c216efef7014d21ce8c4a35.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE batch_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE wallet_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "0e8ba731cc3587fcb5ca7218e92188874e40f19b72ddf6a0884c6e2d98c08708" + "hash": "a2d860909e1587d9841dde47da88db794ebe87976c216efef7014d21ce8c4a35" } diff --git a/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json b/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json deleted file mode 100644 index c8984803..00000000 --- a/.sqlx/query-a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_signing_session_events (id, recorded_at, sequence, event_type, event) SELECT unnested.id, $1, unnested.sequence, unnested.event_type, unnested.event FROM UNNEST($2::UUID[], $3::INT[], $4::TEXT[], $5::JSONB[]) AS unnested(id, sequence, event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Timestamptz", - "UuidArray", - "Int4Array", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "a67198781ee44057bdc2d5d185368377a5773bcb133f94dbbd173f0f1c09e35f" -} diff --git a/.sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json b/.sqlx/query-a6c7c05a71de4e77ab7e798d784b2c40bf51598dd23600aae6d9c0821d2299a8.json similarity index 53% rename from .sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json rename to .sqlx/query-a6c7c05a71de4e77ab7e798d784b2c40bf51598dd23600aae6d9c0821d2299a8.json index bd7f6bcf..b1c8b9df 100644 --- a/.sqlx/query-137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c.json +++ b/.sqlx/query-a6c7c05a71de4e77ab7e798d784b2c40bf51598dd23600aae6d9c0821d2299a8.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE name = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE name = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "137ae584981e73bd3428d210d985d4e219fc9a686522cf9659631b9a237d3c5c" + "hash": "a6c7c05a71de4e77ab7e798d784b2c40bf51598dd23600aae6d9c0821d2299a8" } diff --git a/.sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json b/.sqlx/query-a7dea8e751999c43bffaf46c89454f667e58934943e5505f5835147fb062bb1d.json similarity index 59% rename from .sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json rename to .sqlx/query-a7dea8e751999c43bffaf46c89454f667e58934943e5505f5835147fb062bb1d.json index 2cbf350d..e3b9c55f 100644 --- a/.sqlx/query-a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe.json +++ b/.sqlx/query-a7dea8e751999c43bffaf46c89454f667e58934943e5505f5835147fb062bb1d.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payouts WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "a731798d488c3b533cad8296ef15f165f34f1668283990a5b89bae0362ddd7fe" + "hash": "a7dea8e751999c43bffaf46c89454f667e58934943e5505f5835147fb062bb1d" } diff --git a/.sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json b/.sqlx/query-a961ea487a0ede93f4848288efa855f425b4cfd6459e38c47a2d06c24ac95b19.json similarity index 53% rename from .sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json rename to .sqlx/query-a961ea487a0ede93f4848288efa855f425b4cfd6459e38c47a2d06c24ac95b19.json index e53b7132..7dfe96e9 100644 --- a/.sqlx/query-db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83.json +++ b/.sqlx/query-a961ea487a0ede93f4848288efa855f425b4cfd6459e38c47a2d06c24ac95b19.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE fingerprint = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE fingerprint = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Bytea" + "Bytea", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "db3bdcab02da522428e4c31666c07e9102a7799cfda835fdbe31c25bcdd3fc83" + "hash": "a961ea487a0ede93f4848288efa855f425b4cfd6459e38c47a2d06c24ac95b19" } diff --git a/.sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json b/.sqlx/query-aa048e4d6c645163c3276040283095ccf865219ca3384909081a7003495d7ac7.json similarity index 56% rename from .sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json rename to .sqlx/query-aa048e4d6c645163c3276040283095ccf865219ca3384909081a7003495d7ac7.json index e008fa19..06ee01e7 100644 --- a/.sqlx/query-268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4.json +++ b/.sqlx/query-aa048e4d6c645163c3276040283095ccf865219ca3384909081a7003495d7ac7.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_addresses\n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "268b1beddaa32d57a9d41d2f3f9e7a3ca464d37c95cf18857ec06208b1947ce4" + "hash": "aa048e4d6c645163c3276040283095ccf865219ca3384909081a7003495d7ac7" } diff --git a/.sqlx/query-6f7f25169f95d9a7cdf0e3e24adadc2b6970ff87da1c03aa878efac164a36cf9.json b/.sqlx/query-ad2bb2e98d01a3d21efe5ae284787c34a4524341b8590da66bae227f628f1dc4.json similarity index 58% rename from .sqlx/query-6f7f25169f95d9a7cdf0e3e24adadc2b6970ff87da1c03aa878efac164a36cf9.json rename to .sqlx/query-ad2bb2e98d01a3d21efe5ae284787c34a4524341b8590da66bae227f628f1dc4.json index 272018ca..3770ec8a 100644 --- a/.sqlx/query-6f7f25169f95d9a7cdf0e3e24adadc2b6970ff87da1c03aa878efac164a36cf9.json +++ b/.sqlx/query-ad2bb2e98d01a3d21efe5ae284787c34a4524341b8590da66bae227f628f1dc4.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_payout_queues WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_payout_queues WHERE (COALESCE((created_at, id) < ($3, $2), $2 IS NULL)) ORDER BY created_at DESC, id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "6f7f25169f95d9a7cdf0e3e24adadc2b6970ff87da1c03aa878efac164a36cf9" + "hash": "ad2bb2e98d01a3d21efe5ae284787c34a4524341b8590da66bae227f628f1dc4" } diff --git a/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json b/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json deleted file mode 100644 index e0482d3a..00000000 --- a/.sqlx/query-ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE keychain_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "ad8f30a78be290a27a455ec112f5435267dd848fa62582977b5c29ee44f809e2" -} diff --git a/.sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json b/.sqlx/query-adb7610f5ac193ef0c70d0a8d3eb5b59f2693c65024f5dc70323c5f7b3a84ecd.json similarity index 55% rename from .sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json rename to .sqlx/query-adb7610f5ac193ef0c70d0a8d3eb5b59f2693c65024f5dc70323c5f7b3a84ecd.json index 9b62c26e..bccaeca3 100644 --- a/.sqlx/query-71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea.json +++ b/.sqlx/query-adb7610f5ac193ef0c70d0a8d3eb5b59f2693c65024f5dc70323c5f7b3a84ecd.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND fingerprint = $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_xpubs\n WHERE account_id = $1 AND fingerprint = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Bytea" + "Bytea", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "71827c411664782f80d251bea45414d7512598afa131ccfe7c07b3bcebfc0fea" + "hash": "adb7610f5ac193ef0c70d0a8d3eb5b59f2693c65024f5dc70323c5f7b3a84ecd" } diff --git a/.sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json b/.sqlx/query-ae852494e0d316dc752573af56c244561b6045c05d49299717b6f6421319d8da.json similarity index 81% rename from .sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json rename to .sqlx/query-ae852494e0d316dc752573af56c244561b6045c05d49299717b6f6421319d8da.json index d6d4dd9c..ea914b74 100644 --- a/.sqlx/query-0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d.json +++ b/.sqlx/query-ae852494e0d316dc752573af56c244561b6045c05d49299717b6f6421319d8da.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_addresses (id, wallet_id, account_id, keychain_id, profile_id, address, kind, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)", + "query": "INSERT INTO bria_addresses (id, wallet_id, account_id, keychain_id, profile_id, address, kind, external_id, created_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, COALESCE($9, NOW()))", "describe": { "columns": [], "parameters": { @@ -28,5 +28,5 @@ }, "nullable": [] }, - "hash": "0fbf3546c6b44fc57b54757d43cc0b3e4e88ad5366c3786521de9a9abe20f59d" + "hash": "ae852494e0d316dc752573af56c244561b6045c05d49299717b6f6421319d8da" } diff --git a/.sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json b/.sqlx/query-af3afa78e97f2421e8ac08f644a21f602fc3983147a6121e7bd857b6f4b3196b.json similarity index 59% rename from .sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json rename to .sqlx/query-af3afa78e97f2421e8ac08f644a21f602fc3983147a6121e7bd857b6f4b3196b.json index aa65011c..afd6dd39 100644 --- a/.sqlx/query-2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5.json +++ b/.sqlx/query-af3afa78e97f2421e8ac08f644a21f602fc3983147a6121e7bd857b6f4b3196b.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_profiles WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "2b16510124df133641765ab557980ef5f6f12e5470ef2e4bcb20ca149efe76a5" + "hash": "af3afa78e97f2421e8ac08f644a21f602fc3983147a6121e7bd857b6f4b3196b" } diff --git a/.sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json b/.sqlx/query-b096f4dfed5c2f2f95450e60d53c77389f5a2c1c9fe867561f81a6b2577cb9cd.json similarity index 57% rename from .sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json rename to .sqlx/query-b096f4dfed5c2f2f95450e60d53c77389f5a2c1c9fe867561f81a6b2577cb9cd.json index c880b13d..295df9ff 100644 --- a/.sqlx/query-e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b.json +++ b/.sqlx/query-b096f4dfed5c2f2f95450e60d53c77389f5a2c1c9fe867561f81a6b2577cb9cd.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "e7db340a79a1f9f3cdb378199e66f8e4bb0b3d2018b504daa2300a11aec4964b" + "hash": "b096f4dfed5c2f2f95450e60d53c77389f5a2c1c9fe867561f81a6b2577cb9cd" } diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json deleted file mode 100644 index b95d0aed..00000000 --- a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "transaction_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 5, - "name": "entry_type", - "type_info": "Varchar" - }, - { - "ordinal": 6, - "name": "layer: Layer", - "type_info": { - "Custom": { - "name": "layer", - "kind": { - "Enum": [ - "settled", - "pending", - "encumbered" - ] - } - } - } - }, - { - "ordinal": 7, - "name": "units", - "type_info": "Numeric" - }, - { - "ordinal": 8, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 9, - "name": "direction: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 10, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 11, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 12, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - true, - false, - false - ] - }, - "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" -} diff --git a/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json b/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json deleted file mode 100644 index 3f3aa786..00000000 --- a/.sqlx/query-b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE external_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "b22df77e97702654dc61b29b76fae57e42c74ddf44aa7cf4189919e1768737eb" -} diff --git a/.sqlx/query-b2456b87a130d720dc00e7d102f639208a9a3a4befb53d63dbbed098cf7f2b22.json b/.sqlx/query-b2456b87a130d720dc00e7d102f639208a9a3a4befb53d63dbbed098cf7f2b22.json new file mode 100644 index 00000000..c973d214 --- /dev/null +++ b/.sqlx/query-b2456b87a130d720dc00e7d102f639208a9a3a4befb53d63dbbed098cf7f2b22.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "b2456b87a130d720dc00e7d102f639208a9a3a4befb53d63dbbed098cf7f2b22" +} diff --git a/.sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json b/.sqlx/query-b2acd44a7a822541f637c19587ffe1151b1738fa6a0f8566a6509081ace0f83f.json similarity index 57% rename from .sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json rename to .sqlx/query-b2acd44a7a822541f637c19587ffe1151b1738fa6a0f8566a6509081ace0f83f.json index 470d6ba8..c7ab1249 100644 --- a/.sqlx/query-1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769.json +++ b/.sqlx/query-b2acd44a7a822541f637c19587ffe1151b1738fa6a0f8566a6509081ace0f83f.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "1dd24d134e6e6fb1feaace43f1b4259ebf7e71ecd8ce03c94ba93821fe418769" + "hash": "b2acd44a7a822541f637c19587ffe1151b1738fa6a0f8566a6509081ace0f83f" } diff --git a/.sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json b/.sqlx/query-b3e0a7791167b3a74ea4ba95f05597b8d33f3a020c7e6088d218a7094c8bc0b1.json similarity index 57% rename from .sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json rename to .sqlx/query-b3e0a7791167b3a74ea4ba95f05597b8d33f3a020c7e6088d218a7094c8bc0b1.json index 0c3168dc..732378b1 100644 --- a/.sqlx/query-5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc.json +++ b/.sqlx/query-b3e0a7791167b3a74ea4ba95f05597b8d33f3a020c7e6088d218a7094c8bc0b1.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "5d8cd5d4beb423e4b2e3ee7e42bb7f9a83acf7acff84136572416f8026e214cc" + "hash": "b3e0a7791167b3a74ea4ba95f05597b8d33f3a020c7e6088d218a7094c8bc0b1" } diff --git a/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json b/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json deleted file mode 100644 index cac331b6..00000000 --- a/.sqlx/query-b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: ProfileId\", e.sequence, e.event, e.recorded_at FROM bria_profiles i JOIN bria_profile_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: ProfileId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "b5070dd7eb5f3ecef8f4069ddd32afd3637ae78fa2c69041ac51c3967cb9ceb6" -} diff --git a/.sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json b/.sqlx/query-b76793d1c0e83bf77ea8502b825970fb7f1f8427ecd7ae3919c90ff031129a5c.json similarity index 59% rename from .sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json rename to .sqlx/query-b76793d1c0e83bf77ea8502b825970fb7f1f8427ecd7ae3919c90ff031129a5c.json index eed89201..b64f5da7 100644 --- a/.sqlx/query-d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f.json +++ b/.sqlx/query-b76793d1c0e83bf77ea8502b825970fb7f1f8427ecd7ae3919c90ff031129a5c.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_signing_sessions\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_signing_sessions\n WHERE account_id = $1 AND batch_id = $2\n AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))\n ORDER BY created_at, id) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.created_at, i.id, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Uuid", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "d874d804d40cc45b7eee2c5ddabfbbde60f9a814beb6a97a38fcd295895f7e1f" + "hash": "b76793d1c0e83bf77ea8502b825970fb7f1f8427ecd7ae3919c90ff031129a5c" } diff --git a/.sqlx/query-b76859ee4c1ac6aecb03e51acd0860e548b73560822008f3de7f85d22c610cea.json b/.sqlx/query-b76859ee4c1ac6aecb03e51acd0860e548b73560822008f3de7f85d22c610cea.json new file mode 100644 index 00000000..b2f0ce09 --- /dev/null +++ b/.sqlx/query-b76859ee4c1ac6aecb03e51acd0860e548b73560822008f3de7f85d22c610cea.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE keychain_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "b76859ee4c1ac6aecb03e51acd0860e548b73560822008f3de7f85d22c610cea" +} diff --git a/.sqlx/query-b84f3323f9b4dcebc263f0970fc41b00f5f4500ffe5cb8aa5c60e6319cb93dad.json b/.sqlx/query-b84f3323f9b4dcebc263f0970fc41b00f5f4500ffe5cb8aa5c60e6319cb93dad.json new file mode 100644 index 00000000..0451d056 --- /dev/null +++ b/.sqlx/query-b84f3323f9b4dcebc263f0970fc41b00f5f4500ffe5cb8aa5c60e6319cb93dad.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_wallet_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "b84f3323f9b4dcebc263f0970fc41b00f5f4500ffe5cb8aa5c60e6319cb93dad" +} diff --git a/.sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json b/.sqlx/query-bc0d7ecc4cdf9c97692f98022eb4ca4ca8db761aea38aa34397767a4533e80e2.json similarity index 56% rename from .sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json rename to .sqlx/query-bc0d7ecc4cdf9c97692f98022eb4ca4ca8db761aea38aa34397767a4533e80e2.json index 6377c100..e5d62e07 100644 --- a/.sqlx/query-91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39.json +++ b/.sqlx/query-bc0d7ecc4cdf9c97692f98022eb4ca4ca8db761aea38aa34397767a4533e80e2.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_profiles WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "91c6e611103d99e1d312ba702c47d63d05384431c34951c1070988e4f1ad8c39" + "hash": "bc0d7ecc4cdf9c97692f98022eb4ca4ca8db761aea38aa34397767a4533e80e2" } diff --git a/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json b/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json deleted file mode 100644 index 6d6da14f..00000000 --- a/.sqlx/query-bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE profile_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "bcbd218e68072d2c73a143873dea960bdd536ba5ca43d630252abb09506e7b46" -} diff --git a/.sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json b/.sqlx/query-be83933711f722bcea5bfe413a247d5bdab8edf29399f48895ceb66f15cb1992.json similarity index 56% rename from .sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json rename to .sqlx/query-be83933711f722bcea5bfe413a247d5bdab8edf29399f48895ceb66f15cb1992.json index 35f255e7..3a5c9429 100644 --- a/.sqlx/query-1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8.json +++ b/.sqlx/query-be83933711f722bcea5bfe413a247d5bdab8edf29399f48895ceb66f15cb1992.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE (COALESCE(id > $2, true)) ORDER BY id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "1890b95051a3d77d388f621a7ee7d9ba61daab26eb542bab02f8be7495de4cb8" + "hash": "be83933711f722bcea5bfe413a247d5bdab8edf29399f48895ceb66f15cb1992" } diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json deleted file mode 100644 index 92db28c8..00000000 --- a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json +++ /dev/null @@ -1,147 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "normal_balance_type: DebitOrCredit", - "type_info": { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - } - }, - { - "ordinal": 1, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 2, - "name": "account_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "currency", - "type_info": "Varchar" - }, - { - "ordinal": 5, - "name": "settled_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 6, - "name": "settled_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 7, - "name": "settled_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 8, - "name": "settled_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 9, - "name": "pending_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 10, - "name": "pending_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 11, - "name": "pending_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 12, - "name": "pending_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 13, - "name": "encumbered_dr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 14, - "name": "encumbered_cr_balance", - "type_info": "Numeric" - }, - { - "ordinal": 15, - "name": "encumbered_entry_id", - "type_info": "Uuid" - }, - { - "ordinal": 16, - "name": "encumbered_modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 17, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 18, - "name": "modified_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 19, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - ] - }, - "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" -} diff --git a/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json b/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json deleted file mode 100644 index ce8ffbfd..00000000 --- a/.sqlx/query-c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE wallet_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: PayoutId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "c3489cdf3224a62a7afd17c1cb5f4265b599b50f9d269997f76301653dd54ba6" -} diff --git a/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json b/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json deleted file mode 100644 index e10db39a..00000000 --- a/.sqlx/query-c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: PayoutId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "c3f626aa1599129aefd01df579817f58e2c94c16a48a5483f7496cd13c2a010d" -} diff --git a/.sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json b/.sqlx/query-c5e396c1f3318661f0118b1c822a1f9efd4a735ea07c8c8188304fddded337f0.json similarity index 53% rename from .sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json rename to .sqlx/query-c5e396c1f3318661f0118b1c822a1f9efd4a735ea07c8c8188304fddded337f0.json index 9aeca857..4ff45593 100644 --- a/.sqlx/query-3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb.json +++ b/.sqlx/query-c5e396c1f3318661f0118b1c822a1f9efd4a735ea07c8c8188304fddded337f0.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE wallet_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_addresses WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_address_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "3e8735ee80b623a83ecaf5753c514af5f1023374eb6265bc22bceeb1d4f7c7fb" + "hash": "c5e396c1f3318661f0118b1c822a1f9efd4a735ea07c8c8188304fddded337f0" } diff --git a/.sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json b/.sqlx/query-c6f45dda03e5c4528b258803197918e2252327a5bfb302e719c426c95805b185.json similarity index 53% rename from .sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json rename to .sqlx/query-c6f45dda03e5c4528b258803197918e2252327a5bfb302e719c426c95805b185.json index 2933dffa..6891f0c0 100644 --- a/.sqlx/query-610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58.json +++ b/.sqlx/query-c6f45dda03e5c4528b258803197918e2252327a5bfb302e719c426c95805b185.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE account_id = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE account_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "610015fa03f33fd7b038b8f5c5cc3ae1351c5e4454c965700ba6b1ac0c19fc58" + "hash": "c6f45dda03e5c4528b258803197918e2252327a5bfb302e719c426c95805b185" } diff --git a/.sqlx/query-c7a51ac39c0f5d65b360ed9400f6827f7769e081d0f37a44a14aba4efff518ca.json b/.sqlx/query-c7a51ac39c0f5d65b360ed9400f6827f7769e081d0f37a44a14aba4efff518ca.json new file mode 100644 index 00000000..9308435b --- /dev/null +++ b/.sqlx/query-c7a51ac39c0f5d65b360ed9400f6827f7769e081d0f37a44a14aba4efff518ca.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "c7a51ac39c0f5d65b360ed9400f6827f7769e081d0f37a44a14aba4efff518ca" +} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json deleted file mode 100644 index 90bef3da..00000000 --- a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Varchar", - "Varchar", - { - "Custom": { - "name": "debitorcredit", - "kind": { - "Enum": [ - "debit", - "credit" - ] - } - } - }, - "Varchar", - { - "Custom": { - "name": "status", - "kind": { - "Enum": [ - "active" - ] - } - } - }, - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" -} diff --git a/.sqlx/query-c99339f15b2ba2220c53514a87ede6cb6592b242509fc929146e38497658e4b9.json b/.sqlx/query-c99339f15b2ba2220c53514a87ede6cb6592b242509fc929146e38497658e4b9.json deleted file mode 100644 index 4e5383b0..00000000 --- a/.sqlx/query-c99339f15b2ba2220c53514a87ede6cb6592b242509fc929146e38497658e4b9.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payout_queues WHERE name = $1) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: PayoutQueueId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "c99339f15b2ba2220c53514a87ede6cb6592b242509fc929146e38497658e4b9" -} diff --git a/.sqlx/query-c9d627366eb3cef8fab5cf514472db4c14c5ba76fba31b88c6816f212173b568.json b/.sqlx/query-c9d627366eb3cef8fab5cf514472db4c14c5ba76fba31b88c6816f212173b568.json new file mode 100644 index 00000000..05acb427 --- /dev/null +++ b/.sqlx/query-c9d627366eb3cef8fab5cf514472db4c14c5ba76fba31b88c6816f212173b568.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_signing_session_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "c9d627366eb3cef8fab5cf514472db4c14c5ba76fba31b88c6816f212173b568" +} diff --git a/.sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json b/.sqlx/query-ce970302baac6e8c40bc86cb76f6f108c86636b29d82e6dd378a8a3943d27c00.json similarity index 57% rename from .sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json rename to .sqlx/query-ce970302baac6e8c40bc86cb76f6f108c86636b29d82e6dd378a8a3943d27c00.json index 22b710a7..3d48342b 100644 --- a/.sqlx/query-0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee.json +++ b/.sqlx/query-ce970302baac6e8c40bc86cb76f6f108c86636b29d82e6dd378a8a3943d27c00.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE (COALESCE(id < $2, true)) ORDER BY id DESC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "0e3ec4f6ab85c56dbc634f8b0e326082a0842e4c39610be8935aead91f58f1ee" + "hash": "ce970302baac6e8c40bc86cb76f6f108c86636b29d82e6dd378a8a3943d27c00" } diff --git a/.sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json b/.sqlx/query-d3e778df5c710e4a574d4370e9220c1e80629cae9b09138a36e773fbab222af9.json similarity index 56% rename from .sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json rename to .sqlx/query-d3e778df5c710e4a574d4370e9220c1e80629cae9b09138a36e773fbab222af9.json index c673141b..a9754aba 100644 --- a/.sqlx/query-4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea.json +++ b/.sqlx/query-d3e778df5c710e4a574d4370e9220c1e80629cae9b09138a36e773fbab222af9.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_wallets\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_wallets\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "4ff7b69f08107c8475c412d86428a24dead88ad04ef08cb447cf736486ad8aea" + "hash": "d3e778df5c710e4a574d4370e9220c1e80629cae9b09138a36e773fbab222af9" } diff --git a/.sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json b/.sqlx/query-d496cf25d1cda0b828a38d5cadb5e4147862a381e5a4a665d89ff939ed3202e8.json similarity index 56% rename from .sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json rename to .sqlx/query-d496cf25d1cda0b828a38d5cadb5e4147862a381e5a4a665d89ff939ed3202e8.json index 9eae51f2..c4a3d23b 100644 --- a/.sqlx/query-dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571.json +++ b/.sqlx/query-d496cf25d1cda0b828a38d5cadb5e4147862a381e5a4a665d89ff939ed3202e8.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE(id < $3, true))) ORDER BY id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "dfcb3770d8afced10768547362108f22498c85096123e0c345b9767b5a967571" + "hash": "d496cf25d1cda0b828a38d5cadb5e4147862a381e5a4a665d89ff939ed3202e8" } diff --git a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json deleted file mode 100644 index 18d9c9b6..00000000 --- a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "journal_id", - "type_info": "Uuid" - }, - { - "ordinal": 3, - "name": "tx_template_id", - "type_info": "Uuid" - }, - { - "ordinal": 4, - "name": "effective", - "type_info": "Date" - }, - { - "ordinal": 5, - "name": "correlation_id", - "type_info": "Uuid" - }, - { - "ordinal": 6, - "name": "external_id", - "type_info": "Varchar" - }, - { - "ordinal": 7, - "name": "description", - "type_info": "Varchar" - }, - { - "ordinal": 8, - "name": "metadata", - "type_info": "Jsonb" - }, - { - "ordinal": 9, - "name": "created_at", - "type_info": "Timestamptz" - }, - { - "ordinal": 10, - "name": "modified_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "TextArray" - ] - }, - "nullable": [ - false, - false, - false, - false, - false, - false, - false, - true, - true, - false, - false - ] - }, - "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" -} diff --git a/.sqlx/query-d6784f313ea771f1d714d4a2f48dba8a541d306a675c9229ebb32878f574d01d.json b/.sqlx/query-d6784f313ea771f1d714d4a2f48dba8a541d306a675c9229ebb32878f574d01d.json deleted file mode 100644 index 940ef422..00000000 --- a/.sqlx/query-d6784f313ea771f1d714d4a2f48dba8a541d306a675c9229ebb32878f574d01d.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM bria_payout_queues i JOIN bria_payout_queue_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: PayoutQueueId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "d6784f313ea771f1d714d4a2f48dba8a541d306a675c9229ebb32878f574d01d" -} diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json deleted file mode 100644 index 8de91f27..00000000 --- a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "version", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "created_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid", - "Uuid", - "Uuid", - "Date", - "Uuid", - "Varchar", - "Varchar", - "Jsonb" - ] - }, - "nullable": [ - false, - false, - false - ] - }, - "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" -} diff --git a/.sqlx/query-db850ba27363078399686515615d44c94324abb4c1855ab9a55a68c4bc7183cb.json b/.sqlx/query-db850ba27363078399686515615d44c94324abb4c1855ab9a55a68c4bc7183cb.json deleted file mode 100644 index 205202ee..00000000 --- a/.sqlx/query-db850ba27363078399686515615d44c94324abb4c1855ab9a55a68c4bc7183cb.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payout_queue_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "db850ba27363078399686515615d44c94324abb4c1855ab9a55a68c4bc7183cb" -} diff --git a/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json b/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json deleted file mode 100644 index 67f165b4..00000000 --- a/.sqlx/query-de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: WalletId\", e.sequence, e.event, e.recorded_at FROM bria_wallets i JOIN bria_wallet_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: WalletId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "de6cec4e49e2537cf0d0af6cb288d36d854264c3a256698fe19aba142ad1d356" -} diff --git a/.sqlx/query-df78a011d9504ba44689ab1b5a065f98e396df5c8784ec265f14f39ecdbf8878.json b/.sqlx/query-df78a011d9504ba44689ab1b5a065f98e396df5c8784ec265f14f39ecdbf8878.json new file mode 100644 index 00000000..bc07a869 --- /dev/null +++ b/.sqlx/query-df78a011d9504ba44689ab1b5a065f98e396df5c8784ec265f14f39ecdbf8878.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_payout_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "df78a011d9504ba44689ab1b5a065f98e396df5c8784ec265f14f39ecdbf8878" +} diff --git a/.sqlx/query-e242e2e88ddc0e8ed38a845bb5e2e3c63f1ac297e60827a133507ab83a3d864f.json b/.sqlx/query-e242e2e88ddc0e8ed38a845bb5e2e3c63f1ac297e60827a133507ab83a3d864f.json new file mode 100644 index 00000000..272288b5 --- /dev/null +++ b/.sqlx/query-e242e2e88ddc0e8ed38a845bb5e2e3c63f1ac297e60827a133507ab83a3d864f.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE external_id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Text", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "e242e2e88ddc0e8ed38a845bb5e2e3c63f1ac297e60827a133507ab83a3d864f" +} diff --git a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json b/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json deleted file mode 100644 index 50c0e05c..00000000 --- a/.sqlx/query-e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "payload!", - "type_info": "Json" - } - ], - "parameters": { - "Left": [ - "Int8" - ] - }, - "nullable": [ - null - ] - }, - "hash": "e30944a079312588707e4c6c3df485baf1435b1306562058c570ad5acc277d42" -} diff --git a/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json b/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json deleted file mode 100644 index 740525a0..00000000 --- a/.sqlx/query-e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE name = $1) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: WalletId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Text" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "e33f2d5d2bbe19903897ff748e47a784dbd155322d1378e7479f28f815ed3090" -} diff --git a/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json b/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json deleted file mode 100644 index 169a320d..00000000 --- a/.sqlx/query-e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: PayoutId\", e.sequence, e.event, e.recorded_at FROM bria_payouts i JOIN bria_payout_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: PayoutId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "e4ff1649167ab495641dda88f34e835b4616603051412b695f9c5f88e652598f" -} diff --git a/.sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json b/.sqlx/query-e6123fc759e994b430db0a55d0e4440e35ceeac30413886efd8cba47dbf73bf3.json similarity index 56% rename from .sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json rename to .sqlx/query-e6123fc759e994b430db0a55d0e4440e35ceeac30413886efd8cba47dbf73bf3.json index 52317b90..353acc96 100644 --- a/.sqlx/query-e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4.json +++ b/.sqlx/query-e6123fc759e994b430db0a55d0e4440e35ceeac30413886efd8cba47dbf73bf3.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_profiles\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_profiles\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "e4f496eb8c8a23dda195c5292fd44e3d42cbeef50c7cf2e6a7eec8f103bad6a4" + "hash": "e6123fc759e994b430db0a55d0e4440e35ceeac30413886efd8cba47dbf73bf3" } diff --git a/.sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json b/.sqlx/query-e798350f5e65e7d3bc35bcaf2bf2d3b4d4ac0fe166f303ea904a1ae4167ecc26.json similarity index 53% rename from .sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json rename to .sqlx/query-e798350f5e65e7d3bc35bcaf2bf2d3b4d4ac0fe166f303ea904a1ae4167ecc26.json index f0e3362e..60f6a34b 100644 --- a/.sqlx/query-23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8.json +++ b/.sqlx/query-e798350f5e65e7d3bc35bcaf2bf2d3b4d4ac0fe166f303ea904a1ae4167ecc26.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE account_id = $1) SELECT i.id AS \"entity_id: ProfileId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_profiles WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_profile_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: ProfileId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "23c651897a6553b2dd9f21328a517f377eed78308605fdeea22a492fdb2959f8" + "hash": "e798350f5e65e7d3bc35bcaf2bf2d3b4d4ac0fe166f303ea904a1ae4167ecc26" } diff --git a/.sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json b/.sqlx/query-e79c15d7aa0bedfa0d09031c882c500caacf0b694f71c5748702668d76ec0e6e.json similarity index 53% rename from .sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json rename to .sqlx/query-e79c15d7aa0bedfa0d09031c882c500caacf0b694f71c5748702668d76ec0e6e.json index 1efb8c6e..c686ff05 100644 --- a/.sqlx/query-584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c.json +++ b/.sqlx/query-e79c15d7aa0bedfa0d09031c882c500caacf0b694f71c5748702668d76ec0e6e.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE xpub_fingerprint = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE id = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: SigningSessionId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Bytea" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "584a58d787a650b19e9c1753bdfcc701fb921c90e6ab3fd076cfec19a05dcb2c" + "hash": "e79c15d7aa0bedfa0d09031c882c500caacf0b694f71c5748702668d76ec0e6e" } diff --git a/.sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json b/.sqlx/query-e8b1a7a0220a8539bcdcc790f092bf7c16227b5ad43c60ebc90c1d84d47d8218.json similarity index 56% rename from .sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json rename to .sqlx/query-e8b1a7a0220a8539bcdcc790f092bf7c16227b5ad43c60ebc90c1d84d47d8218.json index fc54a5bc..38ec6ce9 100644 --- a/.sqlx/query-f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112.json +++ b/.sqlx/query-e8b1a7a0220a8539bcdcc790f092bf7c16227b5ad43c60ebc90c1d84d47d8218.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, id FROM bria_xpubs WHERE ((account_id = $1) AND (COALESCE(id > $3, true))) ORDER BY id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Uuid", "Int8", - "Uuid" + "Uuid", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "f8b10627d9328f50c64175e29769addc440966b24c3ad19798872ba6c80ce112" + "hash": "e8b1a7a0220a8539bcdcc790f092bf7c16227b5ad43c60ebc90c1d84d47d8218" } diff --git a/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json b/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json deleted file mode 100644 index 56428e88..00000000 --- a/.sqlx/query-e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "SELECT i.id AS \"id: Uuid\", e.sequence, e.event, e.recorded_at FROM bria_xpubs i JOIN bria_xpub_events e ON i.id = e.id WHERE i.id = ANY($1) ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "id: Uuid", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "UuidArray" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "e992d4510b1dad127e0028138f5ce3c53ef82885389267de4bd66a1e3f08d835" -} diff --git a/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json b/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json deleted file mode 100644 index 950841b1..00000000 --- a/.sqlx/query-ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "INSERT INTO bria_address_events (id, recorded_at, sequence, event_type, event) SELECT $1, $2, ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::text[], $5::jsonb[]) AS unnested(event_type, event)", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Uuid", - "Timestamptz", - "Int8", - "TextArray", - "JsonbArray" - ] - }, - "nullable": [] - }, - "hash": "ea0f38341afed052baa254a870e600e687e5a4a83963fc03f9057ad7922dcd4b" -} diff --git a/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json b/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json deleted file mode 100644 index bc2ca9ca..00000000 --- a/.sqlx/query-ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_payouts WHERE payout_queue_id = $1) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: PayoutId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "ecb98e1956c1432f46e39782d78c21894e41766195d55bb018f93d5180d51db4" -} diff --git a/.sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json b/.sqlx/query-ed1bcc219902cc44f65aca4faa73243ea4eabbc9ec72f57c9b312f93864f9f6e.json similarity index 56% rename from .sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json rename to .sqlx/query-ed1bcc219902cc44f65aca4faa73243ea4eabbc9ec72f57c9b312f93864f9f6e.json index 263511cd..a26dbbb9 100644 --- a/.sqlx/query-cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c.json +++ b/.sqlx/query-ed1bcc219902cc44f65aca4faa73243ea4eabbc9ec72f57c9b312f93864f9f6e.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payout_queues\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payout_queues\n WHERE account_id = $1 and name = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "cb35bc242181ee60354bc9cec405c6a2eccd9f75e08fc89e46ad281d0c867b6c" + "hash": "ed1bcc219902cc44f65aca4faa73243ea4eabbc9ec72f57c9b312f93864f9f6e" } diff --git a/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json b/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json deleted file mode 100644 index 9c26aa46..00000000 --- a/.sqlx/query-f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_signing_sessions WHERE batch_id = $1) SELECT i.id AS \"entity_id: SigningSessionId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_signing_session_events e ON i.id = e.id ORDER BY i.id, e.sequence", - "describe": { - "columns": [ - { - "ordinal": 0, - "name": "entity_id: SigningSessionId", - "type_info": "Uuid" - }, - { - "ordinal": 1, - "name": "sequence", - "type_info": "Int4" - }, - { - "ordinal": 2, - "name": "event", - "type_info": "Jsonb" - }, - { - "ordinal": 3, - "name": "recorded_at", - "type_info": "Timestamptz" - } - ], - "parameters": { - "Left": [ - "Uuid" - ] - }, - "nullable": [ - false, - false, - false, - false - ] - }, - "hash": "f03b01f772f29689afc4c5534f66025d7576b2db0921babc0ba5e9f894c777fc" -} diff --git a/.sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json b/.sqlx/query-f17ac54fd1f2c48007492d8b12471e21daf1b9f0057be6f197a2654b90bb6b5e.json similarity index 59% rename from .sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json rename to .sqlx/query-f17ac54fd1f2c48007492d8b12471e21daf1b9f0057be6f197a2654b90bb6b5e.json index 608cffa9..5de1dc5a 100644 --- a/.sqlx/query-2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34.json +++ b/.sqlx/query-f17ac54fd1f2c48007492d8b12471e21daf1b9f0057be6f197a2654b90bb6b5e.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT created_at, id FROM bria_xpubs WHERE (COALESCE((created_at, id) > ($3, $2), $2 IS NULL)) ORDER BY created_at ASC, id ASC LIMIT $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $4 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -28,15 +33,17 @@ "Left": [ "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "2373b4fb32bedb8d83cf6fe3ac929e278d333674b2afc9d6badea3dd9388db34" + "hash": "f17ac54fd1f2c48007492d8b12471e21daf1b9f0057be6f197a2654b90bb6b5e" } diff --git a/.sqlx/query-f5faad8826ac896171feab735386c36acff3c8b20d9ef193e3c6d882d9cdf8e0.json b/.sqlx/query-f5faad8826ac896171feab735386c36acff3c8b20d9ef193e3c6d882d9cdf8e0.json new file mode 100644 index 00000000..0e1c140d --- /dev/null +++ b/.sqlx/query-f5faad8826ac896171feab735386c36acff3c8b20d9ef193e3c6d882d9cdf8e0.json @@ -0,0 +1,47 @@ +{ + "db_name": "PostgreSQL", + "query": "WITH entities AS (SELECT id FROM bria_wallets WHERE id = ANY($1)) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "entity_id: Repo__Id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "event", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray", + "Bool" + ] + }, + "nullable": [ + false, + false, + false, + null, + false + ] + }, + "hash": "f5faad8826ac896171feab735386c36acff3c8b20d9ef193e3c6d882d9cdf8e0" +} diff --git a/.sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json b/.sqlx/query-f8335c1c83acfb90bdcafe951727867f5f0b7da9571bd124597311d8d58e09cc.json similarity index 53% rename from .sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json rename to .sqlx/query-f8335c1c83acfb90bdcafe951727867f5f0b7da9571bd124597311d8d58e09cc.json index 2cec7c3c..ebb6b883 100644 --- a/.sqlx/query-6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59.json +++ b/.sqlx/query-f8335c1c83acfb90bdcafe951727867f5f0b7da9571bd124597311d8d58e09cc.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE name = $1) SELECT i.id AS \"entity_id: Uuid\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (SELECT id FROM bria_xpubs WHERE name = $1) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $2 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_xpub_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: Uuid", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,21 +20,28 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } ], "parameters": { "Left": [ - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "6f341349cf8b6014e2c637fe75d8c99c74eb0749d4a28125d6cb7d183617ad59" + "hash": "f8335c1c83acfb90bdcafe951727867f5f0b7da9571bd124597311d8d58e09cc" } diff --git a/.sqlx/query-b38f317489602f61c079b83f558e5c7cd28464dc7367585cd0bfddb935b13dfc.json b/.sqlx/query-f969a21220e0d0a16b91b9b8038a683989c95c6c87d45762aca3515e2961f954.json similarity index 57% rename from .sqlx/query-b38f317489602f61c079b83f558e5c7cd28464dc7367585cd0bfddb935b13dfc.json rename to .sqlx/query-f969a21220e0d0a16b91b9b8038a683989c95c6c87d45762aca3515e2961f954.json index f9a003dc..5fcb647d 100644 --- a/.sqlx/query-b38f317489602f61c079b83f558e5c7cd28464dc7367585cd0bfddb935b13dfc.json +++ b/.sqlx/query-f969a21220e0d0a16b91b9b8038a683989c95c6c87d45762aca3515e2961f954.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: PayoutQueueId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_payout_queues WHERE ((account_id = $1) AND (COALESCE((created_at, id) > ($4, $3), $3 IS NULL))) ORDER BY created_at ASC, id ASC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_queue_events e ON i.id = e.id ORDER BY i.created_at asc, i.id asc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutQueueId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "b38f317489602f61c079b83f558e5c7cd28464dc7367585cd0bfddb935b13dfc" + "hash": "f969a21220e0d0a16b91b9b8038a683989c95c6c87d45762aca3515e2961f954" } diff --git a/.sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json b/.sqlx/query-fc287215a78fd84cd9c251d99c34816dda6607c8d306f9dfddcda69756561a3c.json similarity index 58% rename from .sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json rename to .sqlx/query-fc287215a78fd84cd9c251d99c34816dda6607c8d306f9dfddcda69756561a3c.json index 851361cb..fbf5abed 100644 --- a/.sqlx/query-3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34.json +++ b/.sqlx/query-fc287215a78fd84cd9c251d99c34816dda6607c8d306f9dfddcda69756561a3c.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: WalletId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", + "query": "WITH entities AS (SELECT account_id, created_at, id FROM bria_wallets WHERE ((account_id = $1) AND (COALESCE((created_at, id) < ($4, $3), $3 IS NULL))) ORDER BY created_at DESC, id DESC LIMIT $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $5 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_wallet_events e ON i.id = e.id ORDER BY i.created_at desc, i.id desc, i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: WalletId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -29,15 +34,17 @@ "Uuid", "Int8", "Uuid", - "Timestamptz" + "Timestamptz", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "3de6a69889182907ea6078ebb756f43bb7cba3421f387a5257b5bc3a64059f34" + "hash": "fc287215a78fd84cd9c251d99c34816dda6607c8d306f9dfddcda69756561a3c" } diff --git a/.sqlx/query-fc739d082a692121896a3df20aa6ea59f9ad7dfb7daefe8c9ee3c57616f8e411.json b/.sqlx/query-fc739d082a692121896a3df20aa6ea59f9ad7dfb7daefe8c9ee3c57616f8e411.json new file mode 100644 index 00000000..a88670e9 --- /dev/null +++ b/.sqlx/query-fc739d082a692121896a3df20aa6ea59f9ad7dfb7daefe8c9ee3c57616f8e411.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO bria_xpub_events (id, recorded_at, sequence, event_type, event) SELECT $1, COALESCE($2, NOW()), ROW_NUMBER() OVER () + $3, unnested.event_type, unnested.event FROM UNNEST($4::TEXT[], $5::JSONB[]) AS unnested(event_type, event) RETURNING recorded_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "recorded_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Timestamptz", + "Int8", + "TextArray", + "JsonbArray" + ] + }, + "nullable": [ + false + ] + }, + "hash": "fc739d082a692121896a3df20aa6ea59f9ad7dfb7daefe8c9ee3c57616f8e411" +} diff --git a/.sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json b/.sqlx/query-fdda9164b8cebcca5c74f339d8ba71921ebe2149abb550bf8b00d2018c02c820.json similarity index 56% rename from .sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json rename to .sqlx/query-fdda9164b8cebcca5c74f339d8ba71921ebe2149abb550bf8b00d2018c02c820.json index 7e294b80..e545f14a 100644 --- a/.sqlx/query-258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a.json +++ b/.sqlx/query-fdda9164b8cebcca5c74f339d8ba71921ebe2149abb550bf8b00d2018c02c820.json @@ -1,11 +1,11 @@ { "db_name": "PostgreSQL", - "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts \n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: PayoutId\", e.sequence, e.event, e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", + "query": "WITH entities AS (\n SELECT *\n FROM bria_payouts \n WHERE account_id = $1 AND external_id = $2) SELECT i.id AS \"entity_id: Repo__Id\", e.sequence, e.event, CASE WHEN $3 THEN e.context ELSE NULL::jsonb END as \"context: es_entity::ContextData\", e.recorded_at FROM entities i JOIN bria_payout_events e ON i.id = e.id ORDER BY i.id, e.sequence", "describe": { "columns": [ { "ordinal": 0, - "name": "entity_id: PayoutId", + "name": "entity_id: Repo__Id", "type_info": "Uuid" }, { @@ -20,6 +20,11 @@ }, { "ordinal": 3, + "name": "context: es_entity::ContextData", + "type_info": "Jsonb" + }, + { + "ordinal": 4, "name": "recorded_at", "type_info": "Timestamptz" } @@ -27,15 +32,17 @@ "parameters": { "Left": [ "Uuid", - "Text" + "Text", + "Bool" ] }, "nullable": [ false, false, false, + null, false ] }, - "hash": "258d3f02f2db66f05605b66452f0743ca475921b9bae953e55f954d5dc12a19a" + "hash": "fdda9164b8cebcca5c74f339d8ba71921ebe2149abb550bf8b00d2018c02c820" } diff --git a/.sqlx/query-a9705321568f5a820aede5aa20506ff38dbf759e9c399b1effe2ce65f0ec5414.json b/.sqlx/query-fe3f391ef20bab7af3fd3c5559d500932f5b281df15f6984a9773061a967cb29.json similarity index 67% rename from .sqlx/query-a9705321568f5a820aede5aa20506ff38dbf759e9c399b1effe2ce65f0ec5414.json rename to .sqlx/query-fe3f391ef20bab7af3fd3c5559d500932f5b281df15f6984a9773061a967cb29.json index 68953ab4..9775111e 100644 --- a/.sqlx/query-a9705321568f5a820aede5aa20506ff38dbf759e9c399b1effe2ce65f0ec5414.json +++ b/.sqlx/query-fe3f391ef20bab7af3fd3c5559d500932f5b281df15f6984a9773061a967cb29.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "INSERT INTO bria_payout_queues (id, name, account_id, created_at) VALUES ($1, $2, $3, $4)", + "query": "INSERT INTO bria_payout_queues (id, name, account_id, created_at) VALUES ($1, $2, $3, COALESCE($4, NOW()))", "describe": { "columns": [], "parameters": { @@ -13,5 +13,5 @@ }, "nullable": [] }, - "hash": "a9705321568f5a820aede5aa20506ff38dbf759e9c399b1effe2ce65f0ec5414" + "hash": "fe3f391ef20bab7af3fd3c5559d500932f5b281df15f6984a9773061a967cb29" } diff --git a/Cargo.lock b/Cargo.lock index 29ede46f..8c769726 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -475,6 +475,15 @@ dependencies = [ "serde", ] +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -638,7 +647,7 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f42a145ed2d10dce2191e1dcf30cfccfea9026660e143662ba5eec4017d5daa" dependencies = [ - "darling", + "darling 0.20.11", "proc-macro2", "quote", "syn 2.0.104", @@ -871,8 +880,18 @@ version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core", - "darling_macro", + "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 = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", ] [[package]] @@ -889,13 +908,38 @@ dependencies = [ "syn 2.0.104", ] +[[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.104", +] + [[package]] name = "darling_macro" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core", + "darling_core 0.20.11", + "quote", + "syn 2.0.104", +] + +[[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.104", ] @@ -936,7 +980,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ - "darling", + "darling 0.20.11", "proc-macro2", "quote", "syn 2.0.104", @@ -1052,14 +1096,15 @@ dependencies = [ [[package]] name = "es-entity" -version = "0.6.7" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162222dfcd78f9a2aff387d98024780d6009deda6cdb719e28aa8e55f023795" +checksum = "51574a2e447ca840cf2d80b610b8c3e88088dc8477c5d3ba24e20c8f6f0d05af" dependencies = [ - "async-trait", "chrono", "derive_builder", "es-entity-macros", + "im", + "pin-project", "serde", "serde_json", "sqlx", @@ -1069,12 +1114,12 @@ dependencies = [ [[package]] name = "es-entity-macros" -version = "0.6.7" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568e84b4c66b9932a901e62dec84e28dc5e9903d4e1a4df51142adaeb19cf355" +checksum = "9beed351da1b6a67b0e82a815aee153bcf2187bf5f4702e6d7e6a48d38aa6f45" dependencies = [ "convert_case", - "darling", + "darling 0.21.3", "pluralizer", "proc-macro2", "quote", @@ -1825,6 +1870,21 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -1912,10 +1972,11 @@ checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2372,18 +2433,18 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", @@ -2754,6 +2815,15 @@ dependencies = [ "getrandom 0.2.15", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -3246,7 +3316,7 @@ version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ - "darling", + "darling 0.20.11", "proc-macro2", "quote", "syn 2.0.104", @@ -3368,6 +3438,16 @@ version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.9" @@ -4433,12 +4513,14 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" +checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be" dependencies = [ "getrandom 0.3.3", + "js-sys", "serde", + "wasm-bindgen", ] [[package]] @@ -4501,24 +4583,24 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.104", @@ -4539,9 +4621,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4549,9 +4631,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -4562,9 +4644,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-timer" diff --git a/Cargo.toml b/Cargo.toml index 7c0413b5..3ad8ccfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,7 @@ edition = "2021" fail-on-warnings = [] [dependencies] -# es-entity = { git = "https://github.com/galoymoney/cala.git", branch = "main" } -es-entity = "0.6.7" +es-entity = "0.9.0" sqlx-ledger = { version = "0.11.5", features = ["otel"] } anyhow = "1.0.82" diff --git a/migrations/20250909142749_add_context_to_events.down.sql b/migrations/20250909142749_add_context_to_events.down.sql new file mode 100644 index 00000000..2805b90a --- /dev/null +++ b/migrations/20250909142749_add_context_to_events.down.sql @@ -0,0 +1,7 @@ +ALTER TABLE bria_xpub_events DROP COLUMN context; +ALTER TABLE bria_wallet_events DROP COLUMN context; +ALTER TABLE bria_address_events DROP COLUMN context; +ALTER TABLE bria_payout_queue_events DROP COLUMN context; +ALTER TABLE bria_payout_events DROP COLUMN context; +ALTER TABLE bria_signing_session_events DROP COLUMN context; +ALTER TABLE bria_profile_events DROP COLUMN context; diff --git a/migrations/20250909142749_add_context_to_events.up.sql b/migrations/20250909142749_add_context_to_events.up.sql new file mode 100644 index 00000000..246747a1 --- /dev/null +++ b/migrations/20250909142749_add_context_to_events.up.sql @@ -0,0 +1,7 @@ +ALTER TABLE bria_xpub_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_wallet_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_address_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_payout_queue_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_payout_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_signing_session_events ADD COLUMN context JSONB DEFAULT NULL; +ALTER TABLE bria_profile_events ADD COLUMN context JSONB DEFAULT NULL; diff --git a/src/account/repo.rs b/src/account/repo.rs index b5d12076..aa3070f5 100644 --- a/src/account/repo.rs +++ b/src/account/repo.rs @@ -1,4 +1,4 @@ -use sqlx::{Pool, Postgres, Transaction}; +use sqlx::{Pool, Postgres}; use uuid::Uuid; use super::{entity::*, error::AccountError}; @@ -13,9 +13,9 @@ impl Accounts { Self { pool: pool.clone() } } - pub async fn create_in_tx( + pub async fn create_in_op( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, account_name: String, ) -> Result { let id = Uuid::new_v4(); @@ -26,7 +26,7 @@ impl Accounts { id, account_name, ) - .fetch_one(&mut **tx) + .fetch_one(op.as_executor()) .await?; Ok(Account { name: account_name, diff --git a/src/address/repo.rs b/src/address/repo.rs index 056cdb22..6aa1be22 100644 --- a/src/address/repo.rs +++ b/src/address/repo.rs @@ -27,7 +27,6 @@ use crate::primitives::{bitcoin::*, *}; ), external_id(ty = "String") ), - tbl_prefix = "bria" )] pub struct Addresses { pool: Pool, @@ -40,7 +39,7 @@ impl Addresses { pub async fn persist_if_not_present( &self, - op: &mut DbOp<'_>, + op: &mut impl es_entity::AtomicOperation, address: NewAddress, ) -> Result<(), AddressError> { let res = sqlx::query!( @@ -56,7 +55,7 @@ impl Addresses { pg::PgKeychainKind::from(address.kind) as pg::PgKeychainKind, address.external_id, ) - .execute(&mut **op.tx()) + .execute(op.as_executor()) .await?; if res.rows_affected() == 0 { @@ -86,10 +85,7 @@ impl Addresses { }; let (entities, has_next_page) = es_entity::es_query!( - entity_ty = WalletAddress, - id_ty = Uuid, - "bria", - &self.pool, + entity = WalletAddress, r#" SELECT * FROM bria_addresses @@ -101,7 +97,7 @@ impl Addresses { id, created_at ) - .fetch_n(query.first) + .fetch_n(self.pool(), query.first) .await?; wallet_addresses.extend(entities); @@ -122,10 +118,7 @@ impl Addresses { address: String, ) -> Result { let wallet_address = es_entity::es_query!( - entity_ty = WalletAddress, - id_ty = Uuid, - "bria", - &self.pool, + entity = WalletAddress, r#" SELECT * FROM bria_addresses @@ -133,7 +126,7 @@ impl Addresses { account_id as AccountId, address.to_string() ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(wallet_address) } @@ -144,10 +137,7 @@ impl Addresses { external_id: String, ) -> Result { let wallet_address = es_entity::es_query!( - entity_ty = WalletAddress, - id_ty = Uuid, - "bria", - &self.pool, + entity = WalletAddress, r#" SELECT * FROM bria_addresses @@ -155,7 +145,7 @@ impl Addresses { account_id as AccountId, external_id ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(wallet_address) } diff --git a/src/admin/app.rs b/src/admin/app.rs index cd37bc3d..ec3d7f42 100644 --- a/src/admin/app.rs +++ b/src/admin/app.rs @@ -32,26 +32,26 @@ impl AdminApp { return Err(AdminApiError::BadNetworkForDev); } let admin_key = self.bootstrap().await?; - let mut db = self.profiles.begin_op().await?; + let mut op = self.profiles.begin_op().await?; let account = self .accounts - .create_in_tx(db.tx(), dev_constants::DEV_ACCOUNT_NAME.to_owned()) + .create_in_op(&mut op, dev_constants::DEV_ACCOUNT_NAME.to_owned()) .await?; self.ledger - .create_journal_for_account(db.tx(), account.id, account.name.clone()) + .create_journal_for_account(op.tx_mut(), account.id, account.name.clone()) .await?; let new_profile = NewProfile::builder() .account_id(account.id) .name(account.name) .build() .expect("Couldn't build NewProfile"); - let profile = self.profiles.create_in_op(&mut db, new_profile).await?; + let profile = self.profiles.create_in_op(&mut op, new_profile).await?; let profile_key = self .profiles - .create_key_for_profile_in_tx(db.tx(), profile, true) + .create_key_for_profile_in_op(&mut op, profile, true) .await?; - db.commit().await?; + op.commit().await?; Ok((admin_key, profile_key)) } @@ -71,25 +71,25 @@ impl AdminApp { &self, account_name: String, ) -> Result { - let mut db = self.profiles.begin_op().await?; + let mut op = self.profiles.begin_op().await?; let account = self .accounts - .create_in_tx(db.tx(), account_name.clone()) + .create_in_op(&mut op, account_name.clone()) .await?; self.ledger - .create_journal_for_account(db.tx(), account.id, account.name.clone()) + .create_journal_for_account(op.tx_mut(), account.id, account.name.clone()) .await?; let new_profile = NewProfile::builder() .account_id(account.id) .name(account.name) .build() .expect("Couldn't build NewProfile"); - let profile = self.profiles.create_in_op(&mut db, new_profile).await?; + let profile = self.profiles.create_in_op(&mut op, new_profile).await?; let key = self .profiles - .create_key_for_profile_in_tx(db.tx(), profile, false) + .create_key_for_profile_in_op(&mut op, profile, false) .await?; - db.commit().await?; + op.commit().await?; Ok(key) } diff --git a/src/app/mod.rs b/src/app/mod.rs index b0a24191..1b4cc206 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -185,7 +185,7 @@ impl App { let mut tx = self.pool.begin().await?; let key = self .profiles - .create_key_for_profile_in_tx(&mut tx, found_profile, false) + .create_key_for_profile_in_op(&mut tx, found_profile, false) .await?; tx.commit().await?; Ok(key) @@ -218,7 +218,7 @@ impl App { xpub_ref: String, config: SignerConfig, ) -> Result<(), ApplicationError> { - let mut db = self.xpubs.begin_op().await?; + let mut op = self.xpubs.begin_op().await?; let mut xpub = self .xpubs .find_from_ref( @@ -230,13 +230,13 @@ impl App { .await?; let xpub_fingerprint = xpub.fingerprint(); xpub.set_signer_config(config, &self.config.signer_encryption.key)?; - self.xpubs.update_signer_config(&mut db, xpub).await?; + self.xpubs.update_signer_config(&mut op, xpub).await?; let batch_ids = self .signing_sessions - .list_batch_ids_for(db.tx(), profile.account_id, xpub_fingerprint) + .list_batch_ids_for(&mut op, profile.account_id, xpub_fingerprint) .await?; job::spawn_all_batch_signings( - db.into_tx(), + op.into(), batch_ids.into_iter().map(|b| (profile.account_id, b)), ) .await?; @@ -260,14 +260,14 @@ impl App { cipher.decrypt(nonce, deprecated_encrypted_key_bytes.as_slice())?; let deprecated_key = chacha20poly1305::Key::clone_from_slice(deprecated_key_bytes.as_ref()); let xpubs = self.xpubs.list_all_xpubs().await?; - let mut db = self.xpubs.begin_op().await?; + let mut op = self.xpubs.begin_op().await?; for mut xpub in xpubs { if let Some(signing_cfg) = xpub.signing_cfg(deprecated_key) { xpub.set_signer_config(signing_cfg, &self.config.signer_encryption.key)?; - self.xpubs.update_signer_config(&mut db, xpub).await?; + self.xpubs.update_signer_config(&mut op, xpub).await?; } } - db.commit().await?; + op.commit().await?; Ok(()) } @@ -306,16 +306,13 @@ impl App { ApplicationError::SigningSessionNotFoundForXPubFingerprint(xpub_fingerprint) })?; - let mut db = self.signing_sessions.begin_op().await?; + let mut op = self.signing_sessions.begin_op().await?; session.submit_externally_signed_psbt(signed_psbt); self.signing_sessions - .update_sessions(&mut db, &sessions) + .update_sessions(&mut op, &sessions) + .await?; + job::spawn_all_batch_signings(op.into(), std::iter::once((profile.account_id, batch_id))) .await?; - job::spawn_all_batch_signings( - db.into_tx(), - std::iter::once((profile.account_id, batch_id)), - ) - .await?; Ok(()) } @@ -417,7 +414,7 @@ impl App { let wallet_id = WalletId::new(); let wallet_ledger_accounts = self .ledger - .create_ledger_accounts_for_wallet(op.tx(), wallet_id) + .create_ledger_accounts_for_wallet(op.tx_mut(), wallet_id) .await?; let new_wallet = NewWallet::builder() .id(wallet_id) @@ -447,7 +444,7 @@ impl App { .expect("Could not build descriptor"), ]; self.descriptors - .persist_all_in_tx(op.tx(), descriptors) + .persist_all_in_op(&mut op, descriptors) .await?; op.commit().await?; Ok((wallet.id, xpub_fingerprints)) @@ -860,11 +857,11 @@ impl App { builder.external_id(external_id); } let new_payout = builder.build().expect("Couldn't build NewPayout"); - let mut db = self.payouts.begin_op().await?; - let id = self.payouts.create_in_op(&mut db, new_payout).await?.id; + let mut op = self.payouts.begin_op().await?; + let id = self.payouts.create_in_op(&mut op, new_payout).await?.id; self.ledger .payout_submitted( - db.into_tx(), + op.into(), id, PayoutSubmittedParams { journal_id: wallet.journal_id, @@ -895,15 +892,15 @@ impl App { profile: &Profile, id: PayoutId, ) -> Result<(), ApplicationError> { - let mut db = self.payouts.begin_op().await?; + let mut op = self.payouts.begin_op().await?; let mut payout = self .payouts - .find_by_id_for_cancellation(db.tx(), profile.account_id, id) + .find_by_id_for_cancellation(&mut op, profile.account_id, id) .await?; payout.cancel_payout(profile.id)?; - self.payouts.update_in_op(&mut db, &mut payout).await?; + self.payouts.update_in_op(&mut op, &mut payout).await?; self.ledger - .payout_cancelled(db.into_tx(), LedgerTransactionId::new(), id) + .payout_cancelled(op.into(), LedgerTransactionId::new(), id) .await?; Ok(()) } diff --git a/src/batch/repo.rs b/src/batch/repo.rs index 3c0bd5ba..86ad4f6f 100644 --- a/src/batch/repo.rs +++ b/src/batch/repo.rs @@ -23,10 +23,10 @@ impl Batches { Self { pool: pool.clone() } } - #[instrument(name = "batches.create_in_tx", skip_all)] - pub async fn create_in_tx<'a>( + #[instrument(name = "batches.create_in_op", skip_all)] + pub async fn create_in_op( &self, - tx: &mut Transaction<'a, Postgres>, + op: &mut impl es_entity::AtomicOperation, batch: NewBatch, ) -> Result { let serializied_psbt = batch.unsigned_psbt.serialize(); @@ -39,7 +39,7 @@ impl Batches { i64::from(batch.total_fee_sats), batch.tx_id.as_ref() as &[u8], serializied_psbt.as_slice() as &[u8], - ).execute(&mut **tx).await?; + ).execute(op.as_executor()).await?; let mut query_builder: QueryBuilder = QueryBuilder::new( r#"INSERT INTO bria_batch_wallet_summaries ( @@ -74,7 +74,7 @@ impl Batches { }, ); let query = query_builder.build(); - query.execute(&mut **tx).await?; + query.execute(op.as_executor()).await?; Ok(batch.id) } @@ -212,7 +212,7 @@ impl Batches { &self, bitcoin_tx_id: bitcoin::Txid, wallet_id: WalletId, - ) -> Result, BatchInfo, LedgerTxId)>, BatchError> { + ) -> Result, BatchInfo, LedgerTxId)>, BatchError> { let mut tx = self.pool.begin().await?; let row = sqlx::query!( r#"WITH b AS ( @@ -242,7 +242,7 @@ impl Batches { let payout_queue_id = PayoutQueueId::from(row.payout_queue_id); if row.ledger_id.is_some() { return Ok(Some(( - es_entity::DbOp::new(tx, chrono::Utc::now()), + tx, BatchInfo { id: batch_id, payout_queue_id, @@ -265,7 +265,7 @@ impl Batches { .await?; Ok(Some(( - es_entity::DbOp::new(tx, chrono::Utc::now()), + tx, BatchInfo { id: batch_id, payout_queue_id, diff --git a/src/descriptor/repo.rs b/src/descriptor/repo.rs index bf20cd6d..e1f42f49 100644 --- a/src/descriptor/repo.rs +++ b/src/descriptor/repo.rs @@ -1,4 +1,4 @@ -use sqlx::{Pool, Postgres, Transaction}; +use sqlx::{Pool, Postgres}; use super::{entity::*, error::DescriptorError}; use crate::primitives::*; @@ -15,20 +15,20 @@ impl Descriptors { } } - pub async fn persist_all_in_tx( + pub async fn persist_all_in_op( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, descriptors: Vec, ) -> Result<(), DescriptorError> { for descriptor in descriptors { - self.persist_in_tx(tx, descriptor).await?; + self.persist_in_op(op, descriptor).await?; } Ok(()) } - async fn persist_in_tx( + async fn persist_in_op( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, descriptor: NewDescriptor, ) -> Result<(), DescriptorError> { let (descriptor_str, checksum) = descriptor.descriptor_and_checksum(); @@ -53,7 +53,7 @@ impl Descriptors { bitcoin::pg::PgKeychainKind::from(descriptor.keychain_kind) as bitcoin::pg::PgKeychainKind, ) - .fetch_one(&mut **tx) + .fetch_one(op.as_executor()) .await?; if res.wallet_id != Some(descriptor.wallet_id) { diff --git a/src/job/batch_signing.rs b/src/job/batch_signing.rs index 031a9181..fb9ecc76 100644 --- a/src/job/batch_signing.rs +++ b/src/job/batch_signing.rs @@ -130,9 +130,9 @@ pub async fn execute( } if any_updated { - let mut db = signing_sessions.begin_op().await?; - signing_sessions.update_sessions(&mut db, &sessions).await?; - db.commit().await?; + let mut tx = pool.begin().await?; + signing_sessions.update_sessions(&mut tx, &sessions).await?; + tx.commit().await?; } let mut sessions = sessions.into_values(); diff --git a/src/job/process_payout_queue.rs b/src/job/process_payout_queue.rs index 8cf703ba..a6e6a0ff 100644 --- a/src/job/process_payout_queue.rs +++ b/src/job/process_payout_queue.rs @@ -54,9 +54,9 @@ pub(super) async fn execute<'a>( let payout_queue = payout_queues .find_by_account_id_and_id(data.account_id, data.payout_queue_id) .await?; - let mut db = payouts.begin_op().await?; + let mut tx = pool.begin().await?; let mut unbatched_payouts = payouts - .list_unbatched(db.tx(), data.account_id, data.payout_queue_id) + .list_unbatched(&mut tx, data.account_id, data.payout_queue_id) .await?; let fee_rate = fees_client .fee_rate(payout_queue.config.tx_priority) @@ -71,7 +71,7 @@ pub(super) async fn execute<'a>( .. } = construct_psbt( &pool, - db.tx(), + &mut tx, &unbatched_payouts, &utxos, &wallets, @@ -134,10 +134,10 @@ pub(super) async fn execute<'a>( })); let batch_id = batch.id; - batches.create_in_tx(db.tx(), batch).await?; + batches.create_in_op(&mut tx, batch).await?; utxos .reserve_utxos_in_batch( - db.tx(), + &mut tx, data.account_id, batch_id, data.payout_queue_id, @@ -158,9 +158,9 @@ pub(super) async fn execute<'a>( queue_drain_error(unbatched_payouts.n_not_batched()); } - payouts.update_unbatched(&mut db, unbatched_payouts).await?; + payouts.update_unbatched(&mut tx, unbatched_payouts).await?; - Ok((data, Some((db.into_tx(), wallet_ids)))) + Ok((data, Some((tx, wallet_ids)))) } else { if unbatched_payouts.n_not_batched() > 0 { queue_drain_error(unbatched_payouts.n_not_batched()); diff --git a/src/job/sync_wallet.rs b/src/job/sync_wallet.rs index 8141bc32..ec14e931 100644 --- a/src/job/sync_wallet.rs +++ b/src/job/sync_wallet.rs @@ -158,7 +158,7 @@ pub async fn execute( .metadata(Some(address_metadata(&unsynced_tx.tx_id))) .build() .expect("Could not build new address in sync wallet"); - if let Some((pending_id, mut op)) = deps + if let Some((pending_id, mut tx)) = deps .bria_utxos .new_utxo_detected( data.account_id, @@ -175,12 +175,12 @@ pub async fn execute( { trackers.n_pending_utxos += 1; deps.bria_addresses - .persist_if_not_present(&mut op, found_addr) + .persist_if_not_present(&mut tx, found_addr) .await?; - bdk_utxos.mark_as_synced(op.tx(), &local_utxo).await?; + bdk_utxos.mark_as_synced(&mut tx, &local_utxo).await?; deps.ledger .utxo_detected( - op.into_tx(), + tx, pending_id, UtxoDetectedParams { journal_id: wallet.journal_id, @@ -257,17 +257,13 @@ pub async fn execute( } } if spend_tx { - let (mut op, batch_info, tx_id) = if let Some((op, create_batch, tx_id)) = batches + let (mut tx, batch_info, tx_id) = if let Some((tx, create_batch, tx_id)) = batches .set_batch_broadcast_ledger_tx_id(unsynced_tx.tx_id, wallet.id) .await? { - (op, Some(create_batch), tx_id) + (tx, Some(create_batch), tx_id) } else { - ( - es_entity::DbOp::new(pool.begin().await?, chrono::Utc::now()), - None, - LedgerTransactionId::new(), - ) + (pool.begin().await?, None, LedgerTransactionId::new()) }; let mut change_utxos = Vec::new(); @@ -286,7 +282,7 @@ pub async fn execute( .build() .expect("Could not build new address in sync wallet"); deps.bria_addresses - .persist_if_not_present(&mut op, found_addr) + .persist_if_not_present(&mut tx, found_addr) .await?; change_utxos.push((utxo, address_info)); } @@ -294,7 +290,7 @@ pub async fn execute( if let Some((settled_sats, allocations)) = deps .bria_utxos .spend_detected( - op.tx(), + &mut tx, data.account_id, wallet.id, keychain_id, @@ -319,7 +315,7 @@ pub async fn execute( { deps.ledger .batch_broadcast( - op.into_tx(), + tx, created_ledger_tx_id, tx_id, fees_to_encumber, @@ -341,7 +337,7 @@ pub async fn execute( .await?; deps.ledger .spend_detected( - op.into_tx(), + tx, tx_id, SpendDetectedParams { journal_id: wallet.journal_id, diff --git a/src/payout/repo.rs b/src/payout/repo.rs index a1e41f64..7937db1b 100644 --- a/src/payout/repo.rs +++ b/src/payout/repo.rs @@ -1,5 +1,5 @@ use es_entity::*; -use sqlx::{Pool, Postgres, Transaction}; +use sqlx::{Pool, Postgres}; use tracing::instrument; use std::collections::HashMap; @@ -49,8 +49,7 @@ impl Payouts { external_id: String, ) -> Result { let payout = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_payouts @@ -58,15 +57,15 @@ impl Payouts { account_id as AccountId, external_id ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(payout) } - #[instrument(name = "payouts.list_unbatched", skip(self))] + #[instrument(name = "payouts.list_unbatched", skip(self, op))] pub async fn list_unbatched( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, account_id: AccountId, payout_queue_id: PayoutQueueId, ) -> Result { @@ -83,8 +82,7 @@ impl Payouts { .unwrap_or((None, None)); let (entities, has_next_page) = es_entity::es_query!( - "bria", - &mut **tx, + tbl_prefix = "bria", r#" SELECT * FROM bria_payouts @@ -97,7 +95,7 @@ impl Payouts { id as Option, created_at ) - .fetch_n(query.first) + .fetch_n(&mut *op, query.first) .await?; unbatched_payouts.extend(entities); @@ -138,8 +136,7 @@ impl Payouts { ) -> Result, PayoutError> { let offset = (page - 1) * page_size; let payouts = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_payouts @@ -150,7 +147,7 @@ impl Payouts { wallet_id as WalletId, offset as i64, ) - .fetch_n(page_size as usize) + .fetch_n(self.pool(), page_size as usize) .await?; Ok(payouts.0) } @@ -174,8 +171,7 @@ impl Payouts { .unwrap_or((None, None)); let (entities, has_next_page) = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_payouts @@ -187,7 +183,7 @@ impl Payouts { id as Option, created_at ) - .fetch_n(query.first) + .fetch_n(self.pool(), query.first) .await?; batched_payouts.extend(entities); @@ -217,7 +213,7 @@ impl Payouts { pub async fn update_unbatched( &self, - op: &mut DbOp<'_>, + op: &mut impl es_entity::AtomicOperation, payouts: UnbatchedPayouts, ) -> Result<(), PayoutError> { if payouts.batch_id.is_none() || payouts.batched.is_empty() { @@ -240,7 +236,7 @@ impl Payouts { payouts.batch_id.unwrap() as BatchId, &ids[..], ) - .execute(&mut **op.tx()) + .execute(op.as_executor()) .await?; Ok(()) } @@ -279,16 +275,15 @@ impl Payouts { )) } - #[instrument(name = "payouts.find_by_id_for_cancellation", skip(self))] + #[instrument(name = "payouts.find_by_id_for_cancellation", skip(self, op))] pub async fn find_by_id_for_cancellation( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, account_id: AccountId, payout_id: PayoutId, ) -> Result { let payout = es_entity::es_query!( - "bria", - &mut **tx, + tbl_prefix = "bria", r#" SELECT * FROM bria_payouts @@ -297,7 +292,7 @@ impl Payouts { account_id as AccountId, payout_id as PayoutId, ) - .fetch_one() + .fetch_one(op) .await?; Ok(payout) } diff --git a/src/payout_queue/repo.rs b/src/payout_queue/repo.rs index 8b1c9a73..11595b29 100644 --- a/src/payout_queue/repo.rs +++ b/src/payout_queue/repo.rs @@ -39,8 +39,7 @@ impl PayoutQueues { name: String, ) -> Result { let payout_queue = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_payout_queues @@ -48,7 +47,7 @@ impl PayoutQueues { account_id as AccountId, name ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(payout_queue) } diff --git a/src/profile/repo.rs b/src/profile/repo.rs index ef845762..7abf89de 100644 --- a/src/profile/repo.rs +++ b/src/profile/repo.rs @@ -61,8 +61,7 @@ impl Profiles { name: String, ) -> Result { let profile = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_profiles @@ -70,14 +69,14 @@ impl Profiles { account_id as AccountId, name ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(profile) } - pub async fn create_key_for_profile_in_tx( + pub async fn create_key_for_profile_in_op( &self, - tx: &mut sqlx::Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, profile: Profile, dev: bool, ) -> Result { @@ -93,7 +92,7 @@ impl Profiles { key, Uuid::from(profile.id), ) - .fetch_one(&mut **tx) + .fetch_one(op.as_executor()) .await?; Ok(ProfileApiKey { key, diff --git a/src/signing_session/repo.rs b/src/signing_session/repo.rs index 5ea58fd6..6e2c752f 100644 --- a/src/signing_session/repo.rs +++ b/src/signing_session/repo.rs @@ -1,5 +1,5 @@ use es_entity::*; -use sqlx::{Pool, Postgres, Transaction}; +use sqlx::{Pool, Postgres}; use uuid::Uuid; use super::{entity::*, error::SigningSessionError}; @@ -42,7 +42,7 @@ impl SigningSessions { pub async fn update_sessions( &self, - op: &mut DbOp<'_>, + op: &mut impl es_entity::AtomicOperation, sessions: &HashMap, ) -> Result<(), SigningSessionError> { let mut events: Vec> = sessions @@ -75,8 +75,7 @@ impl SigningSessions { }; let (entities, has_next_page) = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_signing_sessions @@ -88,7 +87,7 @@ impl SigningSessions { id as Option, created_at as Option>, ) - .fetch_n(first) + .fetch_n(self.pool(), first) .await?; signing_sessions.extend(entities); @@ -115,7 +114,7 @@ impl SigningSessions { pub async fn list_batch_ids_for( &self, - tx: &mut Transaction<'_, Postgres>, + op: &mut impl es_entity::AtomicOperation, account_id: AccountId, xpub_fingerprint: XPubFingerprint, ) -> Result, SigningSessionError> { @@ -127,7 +126,7 @@ impl SigningSessions { Uuid::from(account_id), xpub_fingerprint.as_bytes() ) - .fetch_all(&mut **tx) + .fetch_all(op.as_executor()) .await?; Ok(rows diff --git a/src/utxo/mod.rs b/src/utxo/mod.rs index ff3a2621..21d2ece6 100644 --- a/src/utxo/mod.rs +++ b/src/utxo/mod.rs @@ -43,7 +43,7 @@ impl Utxos { origin_tx_vbytes: u64, self_pay: bool, current_block_height: u32, - ) -> Result)>, UtxoError> { + ) -> Result)>, UtxoError> { let new_utxo = NewUtxo::builder() .account_id(account_id) .wallet_id(wallet_id) @@ -61,9 +61,9 @@ impl Utxos { .self_pay(self_pay) .build() .expect("Could not build NewUtxo"); - let mut op = es_entity::DbOp::new(self.pool.begin().await?, chrono::Utc::now()); - let tx_id = self.utxos.persist_utxo(op.tx(), new_utxo).await?; - Ok(tx_id.map(|id| (id, op))) + let mut tx = self.pool.begin().await?; + let tx_id = self.utxos.persist_utxo(&mut tx, new_utxo).await?; + Ok(tx_id.map(|id| (id, tx))) } #[instrument(name = "utxos.settle_utxo", skip(self, tx), err)] diff --git a/src/wallet/repo.rs b/src/wallet/repo.rs index 2a9a44e4..70877635 100644 --- a/src/wallet/repo.rs +++ b/src/wallet/repo.rs @@ -60,8 +60,7 @@ impl Wallets { name: String, ) -> Result { let wallet = es_entity::es_query!( - "bria", - &self.pool, + tbl_prefix = "bria", r#" SELECT * FROM bria_wallets @@ -69,7 +68,7 @@ impl Wallets { account_id as AccountId, name ) - .fetch_one() + .fetch_one(self.pool()) .await?; Ok(wallet) } diff --git a/src/xpub/repo.rs b/src/xpub/repo.rs index 2b789e72..0e67894d 100644 --- a/src/xpub/repo.rs +++ b/src/xpub/repo.rs @@ -1,5 +1,8 @@ use es_entity::*; -use sqlx::{Database, Encode, Pool, Postgres}; +use sqlx::{ + postgres::{PgHasArrayType, PgTypeInfo}, + Database, Encode, Pool, Postgres, +}; use std::collections::HashMap; use uuid::Uuid; @@ -20,7 +23,6 @@ use crate::primitives::*; name(ty = "String", update(persist=false), create(accessor=key_name())), fingerprint(ty = "XPubFingerprint", create(accessor=fingerprint()), update(persist = false)) ), - tbl_prefix = "bria" )] pub struct XPubs { pool: Pool, @@ -42,6 +44,12 @@ impl sqlx::Type for XPubFingerprint { } } +impl PgHasArrayType for XPubFingerprint { + fn array_type_info() -> PgTypeInfo { + PgTypeInfo::with_name("_bytea") + } +} + impl XPubs { pub fn new(pool: &Pool) -> Self { Self { pool: pool.clone() } @@ -49,7 +57,7 @@ impl XPubs { pub async fn update_signer_config( &self, - op: &mut DbOp<'_>, + op: &mut impl es_entity::AtomicOperation, xpub: AccountXPub, ) -> Result<(), XPubError> { if let Some((cypher, nonce)) = xpub.encrypted_signer_config { @@ -66,7 +74,7 @@ impl XPubs { cypher_bytes, nonce_bytes, ) - .execute(&mut **op.tx()) + .execute(op.as_executor()) .await?; } @@ -82,10 +90,7 @@ impl XPubs { let mut xpub = match xpub_ref { XPubRef::Fingerprint(fp) => { let xpub = es_entity::es_query!( - entity_ty = AccountXPub, - id_ty = Uuid, - "bria", - &self.pool, + entity = AccountXPub, r#" SELECT * FROM bria_xpubs @@ -93,16 +98,13 @@ impl XPubs { Uuid::from(account_id), fp.as_bytes() ) - .fetch_one() + .fetch_one(self.pool()) .await?; xpub } XPubRef::Name(name) => { let xpub = es_entity::es_query!( - entity_ty = AccountXPub, - id_ty = Uuid, - "bria", - &self.pool, + entity = AccountXPub, r#" SELECT * FROM bria_xpubs @@ -110,7 +112,7 @@ impl XPubs { Uuid::from(account_id), name ) - .fetch_one() + .fetch_one(self.pool()) .await?; xpub } From ce71de376de041a26656954242e7ba5bfdf2ed54 Mon Sep 17 00:00:00 2001 From: CI Bot Date: Fri, 19 Sep 2025 19:30:40 +0000 Subject: [PATCH 40/65] ci(release): release version 0.1.114 --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ Cargo.lock | 2 +- Cargo.toml | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 074a5a06..dae749bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +# [bria release v0.1.114](https://github.com/GaloyMoney/bria/releases/tag/0.1.114) + + +### Bug Fixes + +- Addressed trailing junk error introduced in 15.x (#654) +- Handle repo fns which return collections using es_query (#638) +- Use WalletId from es_entity for entity migration (#630) + +### Miscellaneous Tasks + +- Bump tracing-subscriber from 0.3.18 to 0.3.20 (#655) +- Bump flake (#652) +- Rename tests/e2e -> bats (#645) +- Remove empty files, unnecessary check and update repo (#641) +- Remove unnecessary derive macros from entities (#637) + +### Refactor + +- Use updated es-entity (#653) +- Use accessor to convert to compatible types (#649) +- Use es_entity for address entity (#644) +- Use was_not_found for entity errors (#647) +- Update migration script to avoid redundant update (#646) +- Use es_entity for payout (#612) +- Use es_entity for signing session entity (#636) +- Use es_entity for xpub (#631) + # [bria release v0.1.113](https://github.com/GaloyMoney/bria/releases/tag/0.1.113) diff --git a/Cargo.lock b/Cargo.lock index 8c769726..d2523526 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -530,7 +530,7 @@ dependencies = [ [[package]] name = "bria" -version = "0.1.114-dev" +version = "0.1.114" dependencies = [ "anyhow", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 3ad8ccfe..ef78f03e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bria" -version = "0.1.114-dev" +version = "0.1.114" edition = "2021" [features] From d733eefad928cd76aa6ea686511ad9235da8e251 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 27 May 2025 17:54:10 -0500 Subject: [PATCH 41/65] ci: update gh values (#2) --- ci/values.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ci/values.yml b/ci/values.yml index 17e2d186..7ce62b25 100644 --- a/ci/values.yml +++ b/ci/values.yml @@ -1,13 +1,13 @@ #@data/values --- -git_uri: git@github.com:GaloyMoney/bria.git +git_uri: git@github.com:blinkbitcoin/bria.git git_branch: main -github_private_key: ((github.private_key)) -github_token: ((github.api_token)) -github_app_id: ((github.github_app_id)) -github_app_private_key: ((github.github_app_private_key)) +github_private_key: ((github-blinkbitcoin.private_key)) +github_token: ((github-blinkbitcoin.api_token)) +github_app_id: ((github-blinkbitcoin.github_app_id)) +github_app_private_key: ((github-blinkbitcoin.github_app_private_key)) -git_charts_uri: git@github.com:GaloyMoney/galoy-charts.git +git_charts_uri: git@github.com:blinkbitcoin/charts.git git_charts_branch: main git_charts_bot_branch: bot-bump-bria-image @@ -23,7 +23,7 @@ staging_inception_creds: ((staging-gcp-creds.creds_json)) staging_ssh_private_key: ((staging-ssh.ssh_private_key)) staging_ssh_pub_key: ((staging-ssh.ssh_public_key)) git_version_branch: version -gh_org: GaloyMoney +gh_org: blinkbitcoin gh_repository: bria cachix_auth_token: ((cachix-token.token)) From 8f0d1df0a09563e1293ece0582c8d36e8809924f Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 27 May 2025 18:23:04 -0500 Subject: [PATCH 42/65] ci: update galoymoney repo references (#4) --- .github/dependabot.yml | 10 ++++----- .github/workflows/audit.yml | 4 ++-- .github/workflows/check-code.yml | 2 +- .github/workflows/spelling.yml | 4 ++-- .github/workflows/vendor/rust-audit.yml | 4 ++-- .github/workflows/vendor/rust-check-code.yml | 2 +- .github/workflows/vendor/spelling.yml | 4 ++-- Dockerfile.release | 2 +- ci/tasks/bump-image-digest.sh | 2 +- ci/tasks/open-charts-pr.sh | 2 +- ci/tasks/update-repo.sh | 2 +- ci/vendir.yml | 8 +++---- ci/vendor/config/git-cliff.toml | 22 +++++++++---------- ci/vendor/tasks/chart-open-charts-pr.sh | 4 ++-- ci/vendor/tasks/check-code.sh | 2 +- ci/vendor/tasks/docker-bump-image-digest.sh | 4 ++-- .../tasks/docker-prep-docker-build-env.sh | 2 +- ci/vendor/tasks/helpers.sh | 2 +- ci/vendor/tasks/prep-release-src.sh | 2 +- docs/demo.md | 2 +- proto/admin/api.proto | 2 +- proto/api/bria.proto | 2 +- 22 files changed, 45 insertions(+), 45 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b5b90bd9..8be8fb3c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,5 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. @@ -8,7 +8,7 @@ version: 2 updates: -- package-ecosystem: "cargo" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "daily" + - package-ecosystem: "cargo" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 5a9a4273..8a000a33 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -1,11 +1,11 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Audit on: pull_request: - branches: [ main ] + branches: [main] jobs: security_audit: diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index 207b3c6c..d9a5dd06 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -1,5 +1,5 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Check Code diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml index b6802699..48a1fc2c 100644 --- a/.github/workflows/spelling.yml +++ b/.github/workflows/spelling.yml @@ -1,11 +1,11 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Spelling on: pull_request: - branches: [ main ] + branches: [main] jobs: spelling: diff --git a/.github/workflows/vendor/rust-audit.yml b/.github/workflows/vendor/rust-audit.yml index 5a9a4273..8a000a33 100644 --- a/.github/workflows/vendor/rust-audit.yml +++ b/.github/workflows/vendor/rust-audit.yml @@ -1,11 +1,11 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Audit on: pull_request: - branches: [ main ] + branches: [main] jobs: security_audit: diff --git a/.github/workflows/vendor/rust-check-code.yml b/.github/workflows/vendor/rust-check-code.yml index 207b3c6c..d9a5dd06 100644 --- a/.github/workflows/vendor/rust-check-code.yml +++ b/.github/workflows/vendor/rust-check-code.yml @@ -1,5 +1,5 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Check Code diff --git a/.github/workflows/vendor/spelling.yml b/.github/workflows/vendor/spelling.yml index b6802699..48a1fc2c 100644 --- a/.github/workflows/vendor/spelling.yml +++ b/.github/workflows/vendor/spelling.yml @@ -1,11 +1,11 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared name: Spelling on: pull_request: - branches: [ main ] + branches: [main] jobs: spelling: diff --git a/Dockerfile.release b/Dockerfile.release index 6471cd4e..002a5137 100644 --- a/Dockerfile.release +++ b/Dockerfile.release @@ -3,7 +3,7 @@ FROM alpine:latest as load ARG VERSION ENV VERSION ${VERSION} RUN mkdir bria-home && mkdir bria && cd bria \ - && wget https://github.com/GaloyMoney/bria/releases/download/${VERSION}/bria-x86_64-unknown-linux-musl-${VERSION}.tar.gz -O bria.tar.gz \ + && wget https://github.com/blinkbitcoin/bria/releases/download/${VERSION}/bria-x86_64-unknown-linux-musl-${VERSION}.tar.gz -O bria.tar.gz \ && tar --strip-components=1 -xf bria.tar.gz \ && mv bria /usr/local/bin && cd ../ && rm -rf ./bria diff --git a/ci/tasks/bump-image-digest.sh b/ci/tasks/bump-image-digest.sh index c7bb79ea..f758485a 100755 --- a/ci/tasks/bump-image-digest.sh +++ b/ci/tasks/bump-image-digest.sh @@ -9,7 +9,7 @@ export app_version=$(cat version/version) pushd charts-repo yq -i e '.bria.image.digest = strenv(digest)' ./charts/${CHARTS_SUBDIR}/values.yaml -sed -i "s|\(digest: \"${digest}\"\).*$|\1 # METADATA:: repository=https://github.com/GaloyMoney/${CHARTS_SUBDIR};commit_ref=${ref};app=${CHARTS_SUBDIR};|g" "./charts/${CHARTS_SUBDIR}/values.yaml" +sed -i "s|\(digest: \"${digest}\"\).*$|\1 # METADATA:: repository=https://github.com/blinkbitcoin/${CHARTS_SUBDIR};commit_ref=${ref};app=${CHARTS_SUBDIR};|g" "./charts/${CHARTS_SUBDIR}/values.yaml" yq -i e '.appVersion = strenv(app_version)' ./charts/${CHARTS_SUBDIR}/Chart.yaml diff --git a/ci/tasks/open-charts-pr.sh b/ci/tasks/open-charts-pr.sh index c1535fa6..789c36f8 100755 --- a/ci/tasks/open-charts-pr.sh +++ b/ci/tasks/open-charts-pr.sh @@ -23,7 +23,7 @@ ${digest} Code diff contained in this image: -https://github.com/GaloyMoney/${CHARTS_SUBDIR}/compare/${old_ref}...${ref} +https://github.com/blinkbitcoin/${CHARTS_SUBDIR}/compare/${old_ref}...${ref} EOF export GH_TOKEN="$(ghtoken generate -b "${GH_APP_PRIVATE_KEY}" -i "${GH_APP_ID}" | jq -r '.token')" diff --git a/ci/tasks/update-repo.sh b/ci/tasks/update-repo.sh index b2d02665..dac02754 100755 --- a/ci/tasks/update-repo.sh +++ b/ci/tasks/update-repo.sh @@ -11,7 +11,7 @@ pushd repo VERSION="$(cat ../version/version)" cat <new_change_log.md -# [bria release v${VERSION}](https://github.com/GaloyMoney/bria/releases/tag/${VERSION}) +# [bria release v${VERSION}](https://github.com/blinkbitcoin/bria/releases/tag/${VERSION}) $(cat ../artifacts/gh-release-notes.md) diff --git a/ci/vendir.yml b/ci/vendir.yml index d81f4ea9..ef5872d7 100644 --- a/ci/vendir.yml +++ b/ci/vendir.yml @@ -7,8 +7,8 @@ directories: contents: - path: . # Copy this folder out to .. git: - url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 + url: https://github.com/blinkbitcoin/concourse-shared.git + ref: cfd07211efb7ef9c986020d1d24069c820fd1717 includePaths: - shared/actions/* excludePaths: @@ -19,8 +19,8 @@ directories: contents: - path: . git: - url: https://github.com/GaloyMoney/galoy-concourse-shared.git - ref: f9f82f114aa5b9c50b999309e09c5eb2fcf54281 + url: https://github.com/blinkbitcoin/concourse-shared.git + ref: cfd07211efb7ef9c986020d1d24069c820fd1717 includePaths: - shared/ci/**/* excludePaths: diff --git a/ci/vendor/config/git-cliff.toml b/ci/vendor/config/git-cliff.toml index 3404a4f0..7a5fa0e3 100644 --- a/ci/vendor/config/git-cliff.toml +++ b/ci/vendor/config/git-cliff.toml @@ -1,5 +1,5 @@ #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared # configuration file for git-cliff (0.1.0) @@ -32,16 +32,16 @@ conventional_commits = true filter_unconventional = true # regex for parsing and grouping commits commit_parsers = [ - { message = "^feat", group = "Features"}, - { message = "^fix", group = "Bug Fixes"}, - { message = "^doc", group = "Documentation"}, - { message = "^perf", group = "Performance"}, - { message = "^refactor", group = "Refactor"}, - { message = "^style", group = "Styling"}, - { message = "^test", group = "Testing"}, - { message = "^chore\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, + { message = "^feat", group = "Features" }, + { message = "^fix", group = "Bug Fixes" }, + { message = "^doc", group = "Documentation" }, + { message = "^perf", group = "Performance" }, + { message = "^refactor", group = "Refactor" }, + { message = "^style", group = "Styling" }, + { message = "^test", group = "Testing" }, + { message = "^chore\\(release\\): prepare for", skip = true }, + { message = "^chore", group = "Miscellaneous Tasks" }, + { body = ".*security", group = "Security" }, ] # filter out the commits that are not matched by commit parsers filter_commits = true diff --git a/ci/vendor/tasks/chart-open-charts-pr.sh b/ci/vendor/tasks/chart-open-charts-pr.sh index 4803ce42..240cde1d 100755 --- a/ci/vendor/tasks/chart-open-charts-pr.sh +++ b/ci/vendor/tasks/chart-open-charts-pr.sh @@ -1,7 +1,7 @@ #!/bin/bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared set -eu @@ -26,7 +26,7 @@ ${digest} Code diff contained in this image: -https://github.com/GaloyMoney/${CHARTS_SUBDIR}/compare/${old_ref}...${ref} +https://github.com/blinkbitcoin/${CHARTS_SUBDIR}/compare/${old_ref}...${ref} EOF gh pr close ${BOT_BRANCH} || true diff --git a/ci/vendor/tasks/check-code.sh b/ci/vendor/tasks/check-code.sh index bf4b3ec6..620f2190 100755 --- a/ci/vendor/tasks/check-code.sh +++ b/ci/vendor/tasks/check-code.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared set -euo pipefail diff --git a/ci/vendor/tasks/docker-bump-image-digest.sh b/ci/vendor/tasks/docker-bump-image-digest.sh index 2616b7bc..c62d70aa 100755 --- a/ci/vendor/tasks/docker-bump-image-digest.sh +++ b/ci/vendor/tasks/docker-bump-image-digest.sh @@ -1,7 +1,7 @@ #!/bin/bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared set -eu @@ -13,7 +13,7 @@ pushd charts-repo yq -i e '.image.digest = strenv(digest)' ./charts/${CHARTS_SUBDIR}/values.yaml -sed -i "s|\(digest: \"${digest}\"\).*$|\1 # METADATA:: repository=https://github.com/GaloyMoney/${CHARTS_SUBDIR};commit_ref=${ref};app=${CHARTS_SUBDIR};|g" "./charts/${CHARTS_SUBDIR}/values.yaml" +sed -i "s|\(digest: \"${digest}\"\).*$|\1 # METADATA:: repository=https://github.com/blinkbitcoin/${CHARTS_SUBDIR};commit_ref=${ref};app=${CHARTS_SUBDIR};|g" "./charts/${CHARTS_SUBDIR}/values.yaml" yq -i e '.appVersion = strenv(app_version)' ./charts/${CHARTS_SUBDIR}/Chart.yaml diff --git a/ci/vendor/tasks/docker-prep-docker-build-env.sh b/ci/vendor/tasks/docker-prep-docker-build-env.sh index 9c0826bf..451bc7f4 100755 --- a/ci/vendor/tasks/docker-prep-docker-build-env.sh +++ b/ci/vendor/tasks/docker-prep-docker-build-env.sh @@ -1,7 +1,7 @@ #!/bin/bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared if [[ -f version/version ]]; then echo "VERSION=$(cat version/version)" >> repo/.env diff --git a/ci/vendor/tasks/helpers.sh b/ci/vendor/tasks/helpers.sh index 8aca1684..ebfd99d5 100755 --- a/ci/vendor/tasks/helpers.sh +++ b/ci/vendor/tasks/helpers.sh @@ -1,7 +1,7 @@ #!/bin/bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared if [[ -z $(git config --global user.email) ]]; then git config --global user.email "bot@galoy.io" diff --git a/ci/vendor/tasks/prep-release-src.sh b/ci/vendor/tasks/prep-release-src.sh index 1de00402..c26c99c4 100755 --- a/ci/vendor/tasks/prep-release-src.sh +++ b/ci/vendor/tasks/prep-release-src.sh @@ -1,7 +1,7 @@ #!/bin/bash #! Auto synced from Shared CI Resources repository -#! Don't change this file, instead change it in github.com/GaloyMoney/concourse-shared +#! Don't change this file, instead change it in github.com/blinkbitcoin/concourse-shared set -eu diff --git a/docs/demo.md b/docs/demo.md index fa495fd2..9eeb172f 100644 --- a/docs/demo.md +++ b/docs/demo.md @@ -3,7 +3,7 @@ ### Build from source * clone the bria repository ``` - git clone https://github.com/GaloyMoney/bria + git clone https://github.com/blinkbitcoin/bria ``` * go to the bria directory and run direnv ``` diff --git a/proto/admin/api.proto b/proto/admin/api.proto index e01584b8..df12b92f 100644 --- a/proto/admin/api.proto +++ b/proto/admin/api.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package services.bria_admin.v1; -option go_package = "github.com/GaloyMoney/terraform-provider-briaadmin/client/proto/adminv1"; +option go_package = "github.com/blinkbitcoin/terraform-provider-briaadmin/client/proto/adminv1"; service AdminService { rpc Bootstrap(BootstrapRequest) returns (BootstrapResponse) {} diff --git a/proto/api/bria.proto b/proto/api/bria.proto index 80aed62c..785a3a66 100644 --- a/proto/api/bria.proto +++ b/proto/api/bria.proto @@ -4,7 +4,7 @@ import "google/protobuf/struct.proto"; package services.bria.v1; -option go_package = "github.com/GaloyMoney/terraform-provider-bria/client/proto/briav1"; +option go_package = "github.com/blinkbitcoin/terraform-provider-bria/client/proto/briav1"; service BriaService { rpc CreateProfile (CreateProfileRequest) returns (CreateProfileResponse) {} From e8c06ce1d4b1beebc1737395ba258cd20f55947e Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 4 Jun 2025 13:12:45 -0500 Subject: [PATCH 43/65] feat: add batch drop (#5) * feat: add batch drop * feat: add cancel batch cmd * fix: sqlx prepare * test: update payout tests * fix: add cancelled to batch response --- ...0aeb37e86cbc426ab54ac79977b0d568ee3e5.json | 40 ++ ...c5a6228dba61752561ea8668bfedae5aef26.json} | 10 +- ...50add3fc72a83aacda6f61b254b2bdba8125e.json | 15 + bats/payout.bats | 120 +++++- ...r_tx_id_to_batch_wallet_summaries.down.sql | 1 + ...ger_tx_id_to_batch_wallet_summaries.up.sql | 2 + proto/api/bria.proto | 8 + src/api/server/mod.rs | 26 ++ src/app/mod.rs | 49 ++- src/batch/entity.rs | 33 ++ src/batch/error.rs | 4 + src/batch/repo.rs | 66 +++- src/cli/api_client.rs | 10 + src/cli/mod.rs | 22 ++ src/job/batch_broadcasting.rs | 8 +- src/job/process_payout_queue.rs | 1 + src/ledger/constants.rs | 3 + src/ledger/mod.rs | 72 ++++ src/ledger/templates/batch_dropped.rs | 350 ++++++++++++++++++ src/ledger/templates/mod.rs | 2 + src/ledger/wallet_accounts.rs | 15 + src/payout/entity.rs | 35 +- tests/ledger.rs | 132 +++++++ 23 files changed, 1006 insertions(+), 18 deletions(-) create mode 100644 .sqlx/query-13a4239e40ffeea6922e29af9e80aeb37e86cbc426ab54ac79977b0d568ee3e5.json rename .sqlx/{query-40d91f489356af51ae859a2237fa85cc8f96a63c1dbc237d44a2d18a8a5b365a.json => query-1b498f21504b103acc70f14c6e08c5a6228dba61752561ea8668bfedae5aef26.json} (86%) create mode 100644 .sqlx/query-3628fa336a11cba36600fa3369a50add3fc72a83aacda6f61b254b2bdba8125e.json create mode 100644 migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.down.sql create mode 100644 migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.up.sql create mode 100644 src/ledger/templates/batch_dropped.rs diff --git a/.sqlx/query-13a4239e40ffeea6922e29af9e80aeb37e86cbc426ab54ac79977b0d568ee3e5.json b/.sqlx/query-13a4239e40ffeea6922e29af9e80aeb37e86cbc426ab54ac79977b0d568ee3e5.json new file mode 100644 index 00000000..1fdf8798 --- /dev/null +++ b/.sqlx/query-13a4239e40ffeea6922e29af9e80aeb37e86cbc426ab54ac79977b0d568ee3e5.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n bb.id,\n bb.payout_queue_id,\n bbws.batch_cancel_ledger_tx_id as \"ledger_id?\",\n bbws.batch_created_ledger_tx_id\n FROM bria_batches bb\n INNER JOIN bria_batch_wallet_summaries bbws ON bb.id = bbws.batch_id\n WHERE bb.id = $1\n FOR UPDATE", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "payout_queue_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "ledger_id?", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "batch_created_ledger_tx_id", + "type_info": "Uuid" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + true, + true + ] + }, + "hash": "13a4239e40ffeea6922e29af9e80aeb37e86cbc426ab54ac79977b0d568ee3e5" +} diff --git a/.sqlx/query-40d91f489356af51ae859a2237fa85cc8f96a63c1dbc237d44a2d18a8a5b365a.json b/.sqlx/query-1b498f21504b103acc70f14c6e08c5a6228dba61752561ea8668bfedae5aef26.json similarity index 86% rename from .sqlx/query-40d91f489356af51ae859a2237fa85cc8f96a63c1dbc237d44a2d18a8a5b365a.json rename to .sqlx/query-1b498f21504b103acc70f14c6e08c5a6228dba61752561ea8668bfedae5aef26.json index 0c07dcd2..2a932e0f 100644 --- a/.sqlx/query-40d91f489356af51ae859a2237fa85cc8f96a63c1dbc237d44a2d18a8a5b365a.json +++ b/.sqlx/query-1b498f21504b103acc70f14c6e08c5a6228dba61752561ea8668bfedae5aef26.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT\n payout_queue_id, unsigned_psbt, signed_tx, bitcoin_tx_id, s.batch_id,\n s.wallet_id, s.current_keychain_id, s.signing_keychains, total_in_sats,\n total_spent_sats, change_sats, change_address, change_vout, s.total_fee_sats,\n cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id\n FROM bria_batch_wallet_summaries s\n LEFT JOIN bria_batches b ON b.id = s.batch_id\n WHERE s.batch_id = $1 AND b.account_id = $2", + "query": "SELECT\n payout_queue_id, unsigned_psbt, signed_tx, bitcoin_tx_id, s.batch_id,\n s.wallet_id, s.current_keychain_id, s.signing_keychains, total_in_sats,\n total_spent_sats, change_sats, change_address, change_vout, s.total_fee_sats,\n cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id, batch_cancel_ledger_tx_id\n FROM bria_batch_wallet_summaries s\n LEFT JOIN bria_batches b ON b.id = s.batch_id\n WHERE s.batch_id = $1 AND b.account_id = $2", "describe": { "columns": [ { @@ -92,6 +92,11 @@ "ordinal": 17, "name": "batch_broadcast_ledger_tx_id", "type_info": "Uuid" + }, + { + "ordinal": 18, + "name": "batch_cancel_ledger_tx_id", + "type_info": "Uuid" } ], "parameters": { @@ -118,8 +123,9 @@ false, false, true, + true, true ] }, - "hash": "40d91f489356af51ae859a2237fa85cc8f96a63c1dbc237d44a2d18a8a5b365a" + "hash": "1b498f21504b103acc70f14c6e08c5a6228dba61752561ea8668bfedae5aef26" } diff --git a/.sqlx/query-3628fa336a11cba36600fa3369a50add3fc72a83aacda6f61b254b2bdba8125e.json b/.sqlx/query-3628fa336a11cba36600fa3369a50add3fc72a83aacda6f61b254b2bdba8125e.json new file mode 100644 index 00000000..70a1f8f3 --- /dev/null +++ b/.sqlx/query-3628fa336a11cba36600fa3369a50add3fc72a83aacda6f61b254b2bdba8125e.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE bria_batch_wallet_summaries\n SET batch_cancel_ledger_tx_id = $1\n WHERE bria_batch_wallet_summaries.batch_id = $2", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Uuid" + ] + }, + "nullable": [] + }, + "hash": "3628fa336a11cba36600fa3369a50add3fc72a83aacda6f61b254b2bdba8125e" +} diff --git a/bats/payout.bats b/bats/payout.bats index 533e28a6..5bb4d930 100644 --- a/bats/payout.bats +++ b/bats/payout.bats @@ -14,8 +14,7 @@ teardown_file() { stop_daemon } - -@test "payout: Batch inclusion and cancellation" { +@test "payout: Batch inclusion and payout cancellation" { bria_cmd create-payout-queue --name high --interval-trigger 5 payout_id=$(bria_cmd submit-payout -w default --queue-name high --destination bcrt1q208tuy5rd3kvy8xdpv6yrczg7f3mnlk3lql7ej --amount 75000000 | jq -r '.id') for i in {1..20}; do @@ -268,3 +267,120 @@ teardown_file() { cache_wallet_balance [[ $(cached_encumbered_outgoing) == 0 ]] && break; } + +@test "payout: Create and cancel an unsigned batch" { + # invalidates signer to allow cancel the batch + bria_cmd set-signer-config \ + --xpub "68bfb290" bitcoind \ + --endpoint "${BITCOIND_SIGNER_ENDPOINT}" \ + --rpc-user "rpcuser" \ + --rpc-password "invalidpassword" + + bria_address=$(bria_cmd new-address -w default | jq -r '.address') + bitcoin_cli -regtest sendtoaddress ${bria_address} 1 + bitcoin_cli -generate 10 + + bria_cmd create-payout-queue -n cancel_queue -m true + payout_id=$(bria_cmd submit-payout -w default --queue-name cancel_queue --destination bcrt1q208tuy5rd3kvy8xdpv6yrczg7f3mnlk3lql7ej --amount 1300000 | jq -r '.id') + + # Wait for payout to be encumbered + for i in {1..20}; do + cache_wallet_balance + [[ $(cached_encumbered_outgoing) == 1300000 && $(cached_effective_settled) -ge 100000000 ]] && break + sleep 2 + done + [[ $(cached_encumbered_outgoing) == 1300000 && $(cached_effective_settled) -ge 100000000 ]] || exit 1 + effective_settled=$(cached_effective_settled) + + # Wait for the batch to be created + for i in {1..20}; do + bria_cmd trigger-payout-queue --name cancel_queue + batch_id=$(bria_cmd get-payout -i "${payout_id}" | jq -r '.payout.batchId') + [[ "${batch_id}" != "null" ]] && break + sleep 2 + done + [[ "${batch_id}" != "null" ]] || exit 1 + + # Verify the batch exists + batch=$(bria_cmd get-batch -b "${batch_id}") + [[ $(echo ${batch} | jq -r '.id') == "${batch_id}" && $(echo ${batch} | jq -r '.cancelled') == "false" ]] || exit 1 + + # Cancel the batch + bria_cmd cancel-batch --batch-id "${batch_id}" + + # Verify the payout is marked as cancelled + for i in {1..20}; do + payout=$(bria_cmd get-payout -i ${payout_id} | jq -r '.payout') + batch_id_after=$(echo ${payout} | jq -r '.batchId') + cancelled=$(echo ${payout} | jq -r '.cancelled') + [[ "${batch_id_after}" == "${batch_id}" && "${cancelled}" == "true" ]] && break + sleep 1 + done + [[ "${batch_id_after}" == "${batch_id}" && "${cancelled}" == "true" ]] || exit 1 + + # Verify the batch is marked as cancelled + batch=$(bria_cmd get-batch -b "${batch_id}") + [[ $(echo ${batch} | jq -r '.id') == "${batch_id}" && $(echo ${batch} | jq -r '.cancelled') == "true" ]] || exit 1 + + # Check that the funds are no longer encumbered + for i in {1..20}; do + cache_wallet_balance + [[ $(cached_encumbered_outgoing) == 0 && $(cached_effective_settled) == ${effective_settled} ]] && break + sleep 1 + done + [[ $(cached_encumbered_outgoing) == 0 ]] || exit 1 + [[ $(cached_effective_settled) == ${effective_settled} ]] || exit 1 +} + +@test "payout: Error when try to create and cancel a signed batch" { + bria_cmd set-signer-config \ + --xpub "68bfb290" bitcoind \ + --endpoint "${BITCOIND_SIGNER_ENDPOINT}" \ + --rpc-user "rpcuser" \ + --rpc-password "rpcpassword" + + bria_address=$(bria_cmd new-address -w default | jq -r '.address') + bitcoin_cli -regtest sendtoaddress ${bria_address} 1 + bitcoin_cli -generate 10 + + bria_cmd create-payout-queue -n cancel_queue -m true || true + payout_id=$(bria_cmd submit-payout -w default --queue-name cancel_queue --destination bcrt1q208tuy5rd3kvy8xdpv6yrczg7f3mnlk3lql7ej --amount 1300000 | jq -r '.id') + + # Wait for payout to be encumbered + for i in {1..20}; do + cache_wallet_balance + [[ $(cached_encumbered_outgoing) == 1300000 && $(cached_effective_settled) -ge 100000000 ]] && break + sleep 2 + done + [[ $(cached_encumbered_outgoing) == 1300000 && $(cached_effective_settled) -ge 100000000 ]] || exit 1 + + # Wait for the batch to be created + for i in {1..20}; do + bria_cmd trigger-payout-queue --name cancel_queue + batch_id=$(bria_cmd get-payout -i "${payout_id}" | jq -r '.payout.batchId') + [[ "${batch_id}" != "null" ]] && break + sleep 2 + done + [[ "${batch_id}" != "null" ]] || exit 1 + + # Verify the batch exists + batch=$(bria_cmd get-batch -b "${batch_id}") + [[ $(echo ${batch} | jq -r '.id') == "${batch_id}" ]] || exit 1 + + # Try to cancel the batch + run bria_cmd cancel-batch --batch-id "${batch_id}" + [[ "$status" -ne 0 ]] + [[ "$output" == *"BatchError - Batch is already signed and can't be cancelled"* ]] + + # Check that the funds are no longer encumbered + for i in {1..20}; do + cache_wallet_balance + [[ $(cached_encumbered_outgoing) == 0 ]] && break + sleep 1 + done + [[ $(cached_encumbered_outgoing) == 0 ]] || exit 1 + + # Verify the batch is not marked as cancelled + batch=$(bria_cmd get-batch -b "${batch_id}") + [[ $(echo ${batch} | jq -r '.id') == "${batch_id}" && $(echo ${batch} | jq -r '.cancelled') == "false" ]] || exit 1 +} diff --git a/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.down.sql b/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.down.sql new file mode 100644 index 00000000..d2f607c5 --- /dev/null +++ b/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.down.sql @@ -0,0 +1 @@ +-- Add down migration script here diff --git a/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.up.sql b/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.up.sql new file mode 100644 index 00000000..f1b07bd5 --- /dev/null +++ b/migrations/20250209015007_add_batch_cancel_ledger_tx_id_to_batch_wallet_summaries.up.sql @@ -0,0 +1,2 @@ +ALTER TABLE bria_batch_wallet_summaries +ADD COLUMN batch_cancel_ledger_tx_id UUID; diff --git a/proto/api/bria.proto b/proto/api/bria.proto index 785a3a66..8091bb10 100644 --- a/proto/api/bria.proto +++ b/proto/api/bria.proto @@ -41,6 +41,7 @@ service BriaService { rpc CancelPayout(CancelPayoutRequest) returns (CancelPayoutResponse) {} rpc GetBatch (GetBatchRequest) returns (GetBatchResponse) {} + rpc CancelBatch (CancelBatchRequest) returns (CancelBatchResponse) {} rpc GetAccountBalanceSummary (GetAccountBalanceSummaryRequest) returns (GetAccountBalanceSummaryResponse) {} @@ -432,8 +433,15 @@ message GetBatchResponse { string unsigned_psbt = 4; repeated BatchWalletSummary wallet_summaries = 5; repeated SigningSession signing_sessions = 6; + bool cancelled = 7; } +message CancelBatchRequest { + string id = 1; +} + +message CancelBatchResponse {} + message BatchWalletSummary { string wallet_id = 1; uint64 total_spent_sats = 2; diff --git a/src/api/server/mod.rs b/src/api/server/mod.rs index 0ad29349..6b6b62a5 100644 --- a/src/api/server/mod.rs +++ b/src/api/server/mod.rs @@ -744,6 +744,7 @@ impl BriaService for Bria { &profile, id.parse() .map_err(ApplicationError::CouldNotParseIncomingUuid)?, + false, ) .await?; Ok(Response::new(CancelPayoutResponse {})) @@ -847,6 +848,7 @@ impl BriaService for Bria { .map_err(ApplicationError::CouldNotParseIncomingUuid)?, ) .await?; + let is_cancelled = batch.is_cancelled(); let wallet_summaries = batch .wallet_summaries .into_iter() @@ -862,6 +864,7 @@ impl BriaService for Bria { payout_queue_id: batch.payout_queue_id.to_string(), tx_id: batch.bitcoin_tx_id.to_string(), unsigned_psbt: batch.unsigned_psbt.to_string(), + cancelled: is_cancelled, wallet_summaries, signing_sessions: sessions .map(|sessions| { @@ -877,6 +880,29 @@ impl BriaService for Bria { .await } + #[instrument(name = "bria.cancel_batch", skip_all, fields(error, error.level, error.message), err)] + async fn cancel_batch( + &self, + request: Request, + ) -> Result, Status> { + crate::tracing::record_error(|| async move { + extract_tracing(&request); + let key = extract_api_token(&request)?; + let profile = self.app.authenticate(key).await?; + let request = request.into_inner(); + let CancelBatchRequest { id } = request; + self.app + .cancel_batch( + &profile, + id.parse() + .map_err(ApplicationError::CouldNotParseIncomingUuid)?, + ) + .await?; + Ok(Response::new(CancelBatchResponse {})) + }) + .await + } + type SubscribeAllStream = std::pin::Pin< Box> + Send + Sync + 'static>, >; diff --git a/src/app/mod.rs b/src/app/mod.rs index 1b4cc206..6c7a9c6f 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -12,7 +12,7 @@ use error::*; use crate::{ account::balance::AccountBalanceSummary, address::*, - batch::*, + batch::{error::BatchError, *}, batch_inclusion::*, descriptor::*, fees::{self, *}, @@ -891,13 +891,14 @@ impl App { &self, profile: &Profile, id: PayoutId, + skip_committed_check: bool, ) -> Result<(), ApplicationError> { let mut op = self.payouts.begin_op().await?; let mut payout = self .payouts .find_by_id_for_cancellation(&mut op, profile.account_id, id) .await?; - payout.cancel_payout(profile.id)?; + payout.cancel_payout(profile.id, skip_committed_check)?; self.payouts.update_in_op(&mut op, &mut payout).await?; self.ledger .payout_cancelled(op.into(), LedgerTransactionId::new(), id) @@ -1028,6 +1029,50 @@ impl App { Ok((batch, payouts, signing_sessions)) } + #[allow(clippy::type_complexity)] + #[instrument(name = "app.cancel_batch", skip_all, err)] + pub async fn cancel_batch( + &self, + profile: &Profile, + batch_id: BatchId, + ) -> Result<(), ApplicationError> { + let batch = self + .batches + .find_by_id(profile.account_id, batch_id) + .await?; + + batch + .validate_cancellation() + .map_err(ApplicationError::BatchError)?; + + let (tx, batch_info, tx_id) = self + .batches + .set_batch_cancel_ledger_tx_id(batch.id) + .await? + .ok_or_else(|| { + ApplicationError::BatchError(BatchError::BatchIdNotFound(batch_id.to_string())) + })?; + + self.ledger + .batch_dropped(tx, tx_id, batch_info.created_ledger_tx_id) + .await?; + + let payouts = self + .payouts + .list_for_batch(profile.account_id, batch_id) + .await?; + + for (_wallet_id, wallet_payouts) in payouts.iter() { + for payout in wallet_payouts { + // Skip committed check since we're cancelling the whole batch + // and we've already verified the batch isn't signed + self.cancel_payout(profile, payout.id, true).await.ok(); + } + } + + Ok(()) + } + #[instrument(name = "app.subscribe_all", skip(self), err)] pub async fn subscribe_all( &self, diff --git a/src/batch/entity.rs b/src/batch/entity.rs index 358b377e..a4db7a80 100644 --- a/src/batch/entity.rs +++ b/src/batch/entity.rs @@ -4,6 +4,8 @@ use std::collections::HashMap; use crate::primitives::*; +use super::error::BatchError; + pub struct Batch { pub id: BatchId, pub account_id: AccountId, @@ -15,11 +17,41 @@ pub struct Batch { } impl Batch { + pub fn get_tx_to_broadcast(&self) -> Option { + if self.accounting_complete() && self.is_signed() && !self.is_cancelled() { + self.signed_tx.clone() + } else { + None + } + } + pub fn accounting_complete(&self) -> bool { self.wallet_summaries .values() .all(|s| s.batch_created_ledger_tx_id.is_some()) } + + pub fn validate_cancellation(&self) -> Result<(), BatchError> { + if self.is_cancelled() { + return Err(BatchError::BatchAlreadyCancelled); + } + + if self.is_signed() { + return Err(BatchError::BatchAlreadySigned); + } + + Ok(()) + } + + pub fn is_cancelled(&self) -> bool { + self.wallet_summaries + .values() + .all(|s| s.batch_cancel_ledger_tx_id.is_some()) + } + + pub fn is_signed(&self) -> bool { + self.signed_tx.is_some() + } } #[derive(Builder, Clone)] @@ -61,4 +93,5 @@ pub struct WalletSummary { pub change_outpoint: Option, pub batch_created_ledger_tx_id: Option, pub batch_broadcast_ledger_tx_id: Option, + pub batch_cancel_ledger_tx_id: Option, } diff --git a/src/batch/error.rs b/src/batch/error.rs index 10eb6b18..47fa1388 100644 --- a/src/batch/error.rs +++ b/src/batch/error.rs @@ -12,4 +12,8 @@ pub enum BatchError { BitcoinConsensusEncodeError(#[from] crate::primitives::bitcoin::consensus::encode::Error), #[error("BatchError - Could not deserialize PSBT: {0}")] PsbtDeserializationError(#[from] crate::primitives::bitcoin::psbt::Error), + #[error("BatchError - Batch is already cancelled")] + BatchAlreadyCancelled, + #[error("BatchError - Batch is already signed and can't be cancelled")] + BatchAlreadySigned, } diff --git a/src/batch/repo.rs b/src/batch/repo.rs index 86ad4f6f..dcaf667d 100644 --- a/src/batch/repo.rs +++ b/src/batch/repo.rs @@ -45,7 +45,7 @@ impl Batches { r#"INSERT INTO bria_batch_wallet_summaries ( batch_id, wallet_id, current_keychain_id, signing_keychains, total_in_sats, total_spent_sats, change_sats, change_address, change_vout, total_fee_sats, - cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id + cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id, batch_cancel_ledger_tx_id )"#, ); query_builder.push_values( @@ -71,6 +71,7 @@ impl Batches { builder.push_bind(serde_json::to_value(summary.cpfp_details).unwrap()); builder.push_bind(summary.batch_created_ledger_tx_id); builder.push_bind(summary.batch_broadcast_ledger_tx_id); + builder.push_bind(summary.batch_cancel_ledger_tx_id); }, ); let query = query_builder.build(); @@ -90,7 +91,7 @@ impl Batches { payout_queue_id, unsigned_psbt, signed_tx, bitcoin_tx_id, s.batch_id, s.wallet_id, s.current_keychain_id, s.signing_keychains, total_in_sats, total_spent_sats, change_sats, change_address, change_vout, s.total_fee_sats, - cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id + cpfp_fee_sats, cpfp_details, batch_created_ledger_tx_id, batch_broadcast_ledger_tx_id, batch_cancel_ledger_tx_id FROM bria_batch_wallet_summaries s LEFT JOIN bria_batches b ON b.id = s.batch_id WHERE s.batch_id = $1 AND b.account_id = $2"#, @@ -148,6 +149,7 @@ impl Batches { batch_broadcast_ledger_tx_id: row .batch_broadcast_ledger_tx_id .map(LedgerTxId::from), + batch_cancel_ledger_tx_id: row.batch_cancel_ledger_tx_id.map(LedgerTxId::from), }, ); } @@ -274,4 +276,64 @@ impl Batches { ledger_transaction_id, ))) } + + #[instrument(name = "batches.set_batch_cancel_ledger_tx_id", skip(self))] + pub async fn set_batch_cancel_ledger_tx_id( + &self, + batch_id: BatchId, + ) -> Result, BatchInfo, LedgerTxId)>, BatchError> { + let mut tx = self.pool.begin().await?; + let row = sqlx::query!( + r#"SELECT + bb.id, + bb.payout_queue_id, + bbws.batch_cancel_ledger_tx_id as "ledger_id?", + bbws.batch_created_ledger_tx_id + FROM bria_batches bb + INNER JOIN bria_batch_wallet_summaries bbws ON bb.id = bbws.batch_id + WHERE bb.id = $1 + FOR UPDATE"#, + batch_id as BatchId, + ) + .fetch_optional(&mut *tx) + .await?; + if row.is_none() || row.as_ref().unwrap().batch_created_ledger_tx_id.is_none() { + return Ok(None); + } + let row = row.unwrap(); + let created_ledger_tx_id = LedgerTxId::from(row.batch_created_ledger_tx_id.unwrap()); + let batch_id = BatchId::from(row.id); + let payout_queue_id = PayoutQueueId::from(row.payout_queue_id); + if row.ledger_id.is_some() { + return Ok(Some(( + tx, + BatchInfo { + id: batch_id, + payout_queue_id, + created_ledger_tx_id, + }, + LedgerTxId::from(row.ledger_id.unwrap()), + ))); + } + let ledger_transaction_id = LedgerTxId::new(); + sqlx::query!( + r#"UPDATE bria_batch_wallet_summaries + SET batch_cancel_ledger_tx_id = $1 + WHERE bria_batch_wallet_summaries.batch_id = $2"#, + ledger_transaction_id as LedgerTxId, + batch_id as BatchId, + ) + .execute(&mut *tx) + .await?; + + Ok(Some(( + tx, + BatchInfo { + id: batch_id, + payout_queue_id, + created_ledger_tx_id, + }, + ledger_transaction_id, + ))) + } } diff --git a/src/cli/api_client.rs b/src/cli/api_client.rs index 80c70a89..b4c67f07 100644 --- a/src/cli/api_client.rs +++ b/src/cli/api_client.rs @@ -626,6 +626,16 @@ impl ApiClient { output_json(response) } + pub async fn cancel_batch(&self, id: String) -> anyhow::Result<()> { + let request = tonic::Request::new(proto::CancelBatchRequest { id }); + let response = self + .connect() + .await? + .cancel_batch(self.inject_auth_token(request)?) + .await?; + output_json(response) + } + pub async fn watch_events( &self, one_shot: bool, diff --git a/src/cli/mod.rs b/src/cli/mod.rs index 6d926acb..3eab6dae 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -552,6 +552,20 @@ enum Command { #[clap(short, long)] batch_id: String, }, + CancelBatch { + #[clap( + short, + long, + value_parser, + default_value = "http://localhost:2742", + env = "BRIA_API_URL" + )] + url: Option, + #[clap(env = "BRIA_API_KEY", default_value = "")] + api_key: String, + #[clap(short, long)] + batch_id: String, + }, /// Watch or fetch events WatchEvents { #[clap( @@ -1028,6 +1042,14 @@ pub async fn run() -> anyhow::Result<()> { let client = api_client(cli.bria_home, url, api_key); client.get_batch(batch_id).await?; } + Command::CancelBatch { + url, + api_key, + batch_id, + } => { + let client = api_client(cli.bria_home, url, api_key); + client.cancel_batch(batch_id).await?; + } Command::WatchEvents { url, api_key, diff --git a/src/job/batch_broadcasting.rs b/src/job/batch_broadcasting.rs index c7bd57b7..5ff02e69 100644 --- a/src/job/batch_broadcasting.rs +++ b/src/job/batch_broadcasting.rs @@ -31,11 +31,9 @@ pub async fn execute( let batch = batches.find_by_id(data.account_id, data.batch_id).await?; let span = tracing::Span::current(); span.record("txid", tracing::field::display(batch.bitcoin_tx_id)); - if batch.accounting_complete() { - if let Some(tx) = batch.signed_tx { - blockchain.broadcast(&tx).map_err(BdkError::BdkLibError)?; - span.record("broadcast", true); - } + if let Some(tx) = batch.get_tx_to_broadcast() { + blockchain.broadcast(&tx).map_err(BdkError::BdkLibError)?; + span.record("broadcast", true); } Ok(data) } diff --git a/src/job/process_payout_queue.rs b/src/job/process_payout_queue.rs index a6e6a0ff..593d80a5 100644 --- a/src/job/process_payout_queue.rs +++ b/src/job/process_payout_queue.rs @@ -291,6 +291,7 @@ impl From for WalletSummary { current_keychain_id: wt.change_keychain_id, batch_created_ledger_tx_id: None, batch_broadcast_ledger_tx_id: None, + batch_cancel_ledger_tx_id: None, } } } diff --git a/src/ledger/constants.rs b/src/ledger/constants.rs index 6b0e976a..91d52389 100644 --- a/src/ledger/constants.rs +++ b/src/ledger/constants.rs @@ -37,6 +37,9 @@ pub(super) const BATCH_CREATED_ID: Uuid = uuid!("10000000-0000-0000-0000-0000000 pub(super) const BATCH_BROADCAST_CODE: &str = "BATCH_BROADCAST"; pub(super) const BATCH_BROADCAST_ID: Uuid = uuid!("00000000-0000-0000-0000-000000000008"); +pub(super) const BATCH_DROPPED_CODE: &str = "BATCH_DROPPED"; +pub(super) const BATCH_DROPPED_ID: Uuid = uuid!("00000000-0000-0000-0000-000000000011"); + // Onchain/Omnibus Ledger Accounts pub(super) const ONCHAIN_UTXO_INCOMING_CODE: &str = "ONCHAIN_UTXO_INCOMING"; pub(super) const ONCHAIN_UTXO_INCOMING_ID: Uuid = uuid!("00000000-1910-0000-1000-000000000000"); diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index a90049e9..5d114158 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -12,6 +12,7 @@ use sqlx_ledger::{ use tokio_stream::{wrappers::BroadcastStream, Stream, StreamExt}; use tracing::instrument; +use rust_decimal::Decimal; use std::collections::HashMap; use crate::{account::balance::*, primitives::*}; @@ -58,6 +59,7 @@ impl Ledger { if templates::BatchCreated::init(&inner).await? { templates::fix::legacy_batch_created(&inner).await?; } + templates::BatchDropped::init(&inner).await?; templates::BatchBroadcast::init(&inner).await?; Ok(Self { @@ -322,6 +324,76 @@ impl Ledger { Ok(()) } + #[instrument(name = "ledger.batch_dropped", skip(self, tx))] + pub async fn batch_dropped( + &self, + tx: Transaction<'_, Postgres>, + tx_id: LedgerTransactionId, + created_batch_tx_id: LedgerTransactionId, + ) -> Result<(), LedgerError> { + let txs = self + .inner + .transactions() + .list_by_ids(std::iter::once(created_batch_tx_id)) + .await?; + let txn = txs.first().ok_or(LedgerError::TransactionNotFound)?; + + let BatchCreatedMeta { + batch_info, + tx_summary, + } = txn.metadata()?.ok_or(LedgerError::MissingTxMetadata)?; + + let entries = self + .inner + .entries() + .list_by_transaction_ids(std::iter::once(created_batch_tx_id)) + .await?; + + let mut ledger_account_ids = WalletLedgerAccountIds::default(); + let mut encumbered_fees: Satoshis = Satoshis::from_btc(Decimal::ZERO); + for entry in entries.into_values().flatten() { + match entry.entry_type.as_str() { + "BATCH_CREATED_LOG_OUT_ENC_DR" => { + ledger_account_ids.effective_outgoing_id = entry.account_id; + } + "BATCH_CREATED_LOG_SET_DR" => { + ledger_account_ids.effective_at_rest_id = entry.account_id; + } + "BATCH_CREATED_FR_ENC_CR" => { + ledger_account_ids.fee_id = entry.account_id; + encumbered_fees = Satoshis::from_btc(entry.units); + } + "BATCH_CREATED_UTX_OUT_PEN_CR" => { + ledger_account_ids.onchain_outgoing_id = entry.account_id; + } + "BATCH_CREATED_CHG_ENC_CR" => { + ledger_account_ids.onchain_incoming_id = entry.account_id; + } + "BATCH_CREATED_UTX_SET_DR" => { + ledger_account_ids.onchain_at_rest_id = entry.account_id; + } + _ => {} + } + } + + let params = BatchDroppedParams { + journal_id: txn.journal_id, + ledger_account_ids, + encumbered_fees, + meta: BatchDroppedMeta { + batch_info, + tx_summary, + created_txn_id: created_batch_tx_id, + }, + }; + + self.inner + .post_transaction_in_tx(tx, tx_id, BATCH_DROPPED_CODE, Some(params)) + .await?; + + Ok(()) + } + #[instrument(name = "ledger.batch_broadcast", skip(self, tx))] pub async fn batch_broadcast( &self, diff --git a/src/ledger/templates/batch_dropped.rs b/src/ledger/templates/batch_dropped.rs new file mode 100644 index 00000000..6475bed8 --- /dev/null +++ b/src/ledger/templates/batch_dropped.rs @@ -0,0 +1,350 @@ +use chrono::Utc; +use serde::{Deserialize, Serialize}; +use sqlx_ledger::{tx_template::*, JournalId, SqlxLedger, SqlxLedgerError}; +use tracing::instrument; + +use super::shared_meta::*; +use crate::{ + ledger::{constants::*, error::LedgerError, WalletLedgerAccountIds}, + primitives::*, +}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct BatchDroppedMeta { + pub batch_info: BatchWalletInfo, + pub tx_summary: WalletTransactionSummary, + pub created_txn_id: LedgerTransactionId, +} + +#[derive(Debug)] +pub struct BatchDroppedParams { + pub journal_id: JournalId, + pub ledger_account_ids: WalletLedgerAccountIds, + pub encumbered_fees: Satoshis, + pub meta: BatchDroppedMeta, +} + +impl BatchDroppedParams { + pub fn defs() -> Vec { + vec![ + ParamDefinition::builder() + .name("journal_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("effective_outgoing_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("effective_at_rest_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("onchain_fee_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("onchain_at_rest_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("onchain_income_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("onchain_outgoing_account_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("total_utxo_in") + .r#type(ParamDataType::DECIMAL) + .build() + .unwrap(), + ParamDefinition::builder() + .name("total_utxo_settled_in") + .r#type(ParamDataType::DECIMAL) + .build() + .unwrap(), + ParamDefinition::builder() + .name("fees") + .r#type(ParamDataType::DECIMAL) + .build() + .unwrap(), + ParamDefinition::builder() + .name("change") + .r#type(ParamDataType::DECIMAL) + .build() + .unwrap(), + ParamDefinition::builder() + .name("encumbered_fees") + .r#type(ParamDataType::DECIMAL) + .build() + .unwrap(), + ParamDefinition::builder() + .name("correlation_id") + .r#type(ParamDataType::UUID) + .build() + .unwrap(), + ParamDefinition::builder() + .name("meta") + .r#type(ParamDataType::JSON) + .build() + .unwrap(), + ParamDefinition::builder() + .name("effective") + .r#type(ParamDataType::DATE) + .build() + .unwrap(), + ] + } +} + +impl From for TxParams { + fn from( + BatchDroppedParams { + journal_id, + ledger_account_ids, + encumbered_fees, + meta, + }: BatchDroppedParams, + ) -> Self { + let WalletTransactionSummary { + fee_sats, + ref change_utxos, + total_utxo_in_sats, + total_utxo_settled_in_sats, + .. + } = meta.tx_summary; + let total_utxo_in = total_utxo_in_sats.to_btc(); + let change = change_utxos + .iter() + .fold(Satoshis::ZERO, |s, u| s + u.satoshis) + .to_btc(); + let fee_sats = fee_sats.to_btc(); + let encumbered_fees = encumbered_fees.to_btc(); + let effective = Utc::now().date_naive(); + let correlation_id = meta.created_txn_id; + let meta = serde_json::to_value(meta).expect("Couldn't serialize meta"); + let mut params = Self::default(); + params.insert("journal_id", journal_id); + params.insert( + "effective_outgoing_account_id", + ledger_account_ids.effective_outgoing_id, + ); + params.insert( + "effective_at_rest_account_id", + ledger_account_ids.effective_at_rest_id, + ); + params.insert("onchain_fee_account_id", ledger_account_ids.fee_id); + params.insert( + "onchain_outgoing_account_id", + ledger_account_ids.onchain_outgoing_id, + ); + params.insert( + "onchain_income_account_id", + ledger_account_ids.onchain_incoming_id, + ); + params.insert( + "onchain_at_rest_account_id", + ledger_account_ids.onchain_at_rest_id, + ); + params.insert("total_utxo_in", total_utxo_in); + params.insert("total_utxo_settled_in", total_utxo_settled_in_sats.to_btc()); + params.insert("change", change); + params.insert("fees", fee_sats); + params.insert("encumbered_fees", encumbered_fees); + params.insert("correlation_id", correlation_id); + params.insert("meta", meta); + params.insert("effective", effective); + params + } +} + +pub struct BatchDropped {} + +impl BatchDropped { + #[instrument(name = "ledger.batch_dropped.init", skip_all)] + pub async fn init(ledger: &SqlxLedger) -> Result { + let tx_input = TxInput::builder() + .journal_id("params.journal_id") + .effective("params.effective") + .correlation_id("params.correlation_id") + .metadata("params.meta") + .description("'Drop Batch'") + .build() + .expect("Couldn't build TxInput"); + let entries = vec![ + // Reverse EFFECTIVE LOG_OUT_ENC entries + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_OUT_ENC_CR'") + .currency("'BTC'") + .account_id("params.effective_outgoing_account_id") + .direction("CREDIT") + .layer("ENCUMBERED") + .units("params.total_utxo_in - params.change - params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_OUT_ENC_DR'") + .currency("'BTC'") + .account_id(format!("uuid('{EFFECTIVE_OUTGOING_ID}')")) + .direction("DEBIT") + .layer("ENCUMBERED") + .units("params.total_utxo_in - params.change - params.fees") + .build() + .expect("Couldn't build entry"), + // Reverse EFFECTIVE LOG_OUT_PEN entries + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_OUT_PEN_DR'") + .currency("'BTC'") + .account_id("params.effective_outgoing_account_id") + .direction("DEBIT") + .layer("PENDING") + .units("params.total_utxo_in - params.change - params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_OUT_PEN_CR'") + .currency("'BTC'") + .account_id(format!("uuid('{EFFECTIVE_OUTGOING_ID}')")) + .direction("CREDIT") + .layer("PENDING") + .units("params.total_utxo_in - params.change - params.fees") + .build() + .expect("Couldn't build entry"), + // Reverse EFFECTIVE LOG_SET entries + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_SET_CR'") + .currency("'BTC'") + .account_id("params.effective_at_rest_account_id") + .direction("CREDIT") + .layer("SETTLED") + .units("params.total_utxo_in - params.change") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_LOG_SET_DR'") + .currency("'BTC'") + .account_id(format!("uuid('{EFFECTIVE_AT_REST_ID}')")) + .direction("DEBIT") + .layer("SETTLED") + .units("params.total_utxo_in - params.change") + .build() + .expect("Couldn't build entry"), + // Reverse FEES entries + EntryInput::builder() + .entry_type("'BATCH_DROPPED_FEE_PEN_CR'") + .currency("'BTC'") + .account_id("params.onchain_fee_account_id") + .direction("CREDIT") + .layer("PENDING") + .units("params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_FEE_PEN_DR'") + .currency("'BTC'") + .account_id(format!("uuid('{ONCHAIN_FEE_ID}')")) + .direction("DEBIT") + .layer("PENDING") + .units("params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_FR_ENC_DR'") + .currency("'BTC'") + .account_id("params.onchain_fee_account_id") + .direction("DEBIT") + .layer("ENCUMBERED") + .units("params.encumbered_fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_FR_ENC_CR'") + .currency("'BTC'") + .account_id(format!("uuid('{ONCHAIN_FEE_ID}')")) + .direction("CREDIT") + .layer("ENCUMBERED") + .units("params.encumbered_fees") + .build() + .expect("Couldn't build entry"), + // Reverse UTXO entries + EntryInput::builder() + .entry_type("'BATCH_DROPPED_UTX_OUT_PEN_CR'") + .currency("'BTC'") + .account_id(format!("uuid('{ONCHAIN_UTXO_OUTGOING_ID}')")) + .direction("CREDIT") + .layer("PENDING") + .units("params.total_utxo_in - params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_UTX_OUT_PEN_DR'") + .currency("'BTC'") + .account_id("params.onchain_outgoing_account_id") + .direction("DEBIT") + .layer("PENDING") + .units("params.total_utxo_in - params.fees") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_UTX_SET_CR'") + .currency("'BTC'") + .account_id("params.onchain_at_rest_account_id") + .direction("CREDIT") + .layer("SETTLED") + .units("params.total_utxo_settled_in") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_UTX_SET_DR'") + .currency("'BTC'") + .account_id(format!("uuid('{ONCHAIN_UTXO_AT_REST_ID}')")) + .direction("DEBIT") + .layer("SETTLED") + .units("params.total_utxo_settled_in") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_CHG_ENC_CR'") + .currency("'BTC'") + .account_id(format!("uuid('{ONCHAIN_UTXO_INCOMING_ID}')")) + .direction("CREDIT") + .layer("ENCUMBERED") + .units("params.change") + .build() + .expect("Couldn't build entry"), + EntryInput::builder() + .entry_type("'BATCH_DROPPED_CHG_ENC_DR'") + .currency("'BTC'") + .account_id("params.onchain_income_account_id") + .direction("DEBIT") + .layer("ENCUMBERED") + .units("params.change") + .build() + .expect("Couldn't build entry"), + ]; + + let params = BatchDroppedParams::defs(); + let template = NewTxTemplate::builder() + .id(BATCH_DROPPED_ID) + .code(BATCH_DROPPED_CODE) + .tx_input(tx_input) + .entries(entries) + .params(params) + .build() + .expect("Couldn't build BATCH_DROPPED_CODE"); + match ledger.tx_templates().create(template).await { + Err(SqlxLedgerError::DuplicateKey(_)) => Ok(false), + Err(e) => Err(e.into()), + Ok(_) => Ok(true), + } + } +} diff --git a/src/ledger/templates/mod.rs b/src/ledger/templates/mod.rs index 38c5ff22..3c7a5230 100644 --- a/src/ledger/templates/mod.rs +++ b/src/ledger/templates/mod.rs @@ -1,5 +1,6 @@ mod batch_broadcast; mod batch_created; +mod batch_dropped; mod payout_cancelled; mod payout_submitted; mod shared_meta; @@ -12,6 +13,7 @@ mod utxo_settled; pub use batch_broadcast::*; pub use batch_created::*; +pub use batch_dropped::*; pub use payout_cancelled::*; pub use payout_submitted::*; pub use shared_meta::*; diff --git a/src/ledger/wallet_accounts.rs b/src/ledger/wallet_accounts.rs index 2e691429..2c412137 100644 --- a/src/ledger/wallet_accounts.rs +++ b/src/ledger/wallet_accounts.rs @@ -36,6 +36,21 @@ impl WalletLedgerAccountIds { } } +impl Default for WalletLedgerAccountIds { + fn default() -> Self { + Self { + onchain_incoming_id: LedgerAccountId::from(ONCHAIN_UTXO_INCOMING_ID), + onchain_at_rest_id: LedgerAccountId::from(ONCHAIN_UTXO_AT_REST_ID), + onchain_outgoing_id: LedgerAccountId::from(ONCHAIN_UTXO_OUTGOING_ID), + effective_incoming_id: LedgerAccountId::from(EFFECTIVE_INCOMING_ID), + effective_at_rest_id: LedgerAccountId::from(EFFECTIVE_AT_REST_ID), + effective_outgoing_id: LedgerAccountId::from(EFFECTIVE_OUTGOING_ID), + fee_id: LedgerAccountId::from(ONCHAIN_FEE_ID), + dust_id: LedgerAccountId::from(Uuid::nil()), + } + } +} + fn derive_wallet_ledger_account_code( element: Element, sub_group: SubGroup, diff --git a/src/payout/entity.rs b/src/payout/entity.rs index bc4125a4..6e4c1e48 100644 --- a/src/payout/entity.rs +++ b/src/payout/entity.rs @@ -56,11 +56,15 @@ pub struct Payout { } impl Payout { - pub fn cancel_payout(&mut self, profile_id: ProfileId) -> Result<(), PayoutError> { + pub fn cancel_payout( + &mut self, + profile_id: ProfileId, + skip_committed_check: bool, + ) -> Result<(), PayoutError> { if self.is_cancelled() { return Err(PayoutError::PayoutAlreadyCancelled); } - if self.is_already_committed() { + if !skip_committed_check && self.is_already_committed() { return Err(PayoutError::PayoutAlreadyCommitted); } self.events.push(PayoutEvent::Cancelled { @@ -208,7 +212,7 @@ mod tests { #[test] fn cancel_payout() { let mut payout = Payout::try_from_events(init_events()).unwrap(); - assert!(payout.cancel_payout(payout.profile_id).is_ok()); + assert!(payout.cancel_payout(payout.profile_id, false).is_ok()); assert!(matches!( payout.events.iter_all().last().unwrap(), PayoutEvent::Cancelled { .. } @@ -222,7 +226,7 @@ mod tests { executed_by: ProfileId::new(), }); let mut payout = Payout::try_from_events(events).unwrap(); - let result = payout.cancel_payout(payout.profile_id); + let result = payout.cancel_payout(payout.profile_id, false); assert!(matches!(result, Err(PayoutError::PayoutAlreadyCancelled))); } @@ -241,7 +245,28 @@ mod tests { let mut payout = Payout::try_from_events(events).unwrap(); - let result = payout.cancel_payout(payout.profile_id); + let result = payout.cancel_payout(payout.profile_id, false); assert!(matches!(result, Err(PayoutError::PayoutAlreadyCommitted))); } + + #[test] + fn can_cancel_when_payout_already_committed_and_skip_true() { + let mut events = init_events(); + events.push(PayoutEvent::CommittedToBatch { + batch_id: BatchId::new(), + outpoint: bitcoin::OutPoint { + txid: "4010e27ff7dc6d9c66a5657e6b3d94b4c4e394d968398d16fefe4637463d194d" + .parse() + .unwrap(), + vout: 0, + }, + }); + + let mut payout = Payout::try_from_events(events).unwrap(); + assert!(payout.cancel_payout(payout.profile_id, true).is_ok()); + assert!(matches!( + payout.events.iter_all().last().unwrap(), + PayoutEvent::Cancelled { .. } + )); + } } diff --git a/tests/ledger.rs b/tests/ledger.rs index d389706b..2dbabffd 100644 --- a/tests/ledger.rs +++ b/tests/ledger.rs @@ -431,6 +431,138 @@ async fn create_batch() -> anyhow::Result<()> { Ok(()) } +#[tokio::test] +async fn batch_dropped() -> anyhow::Result<()> { + let pool = helpers::init_pool().await?; + let ledger = Ledger::init(&pool).await?; + + let account_id = AccountId::new(); + let name = Alphanumeric.sample_string(&mut rand::thread_rng(), 32); + let mut tx = pool.begin().await?; + let journal_id = ledger + .create_journal_for_account(&mut tx, account_id, name.clone()) + .await?; + let wallet_id = WalletId::new(); + let wallet_ledger_accounts = ledger + .create_ledger_accounts_for_wallet(&mut tx, wallet_id) + .await?; + + tx.commit().await?; + + let batch_id = BatchId::new(); + let fee_sats = Satoshis::from(2_346); + let total_spent_sats = Satoshis::from(100_000_000); + let total_utxo_in_sats = Satoshis::from(200_000_000); + let total_utxo_settled_in_sats = Satoshis::from(100_000_000); + let change_sats = total_utxo_in_sats - total_spent_sats - fee_sats; + let address = Address::parse_from_trusted_source("1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"); + let outpoint = OutPoint { + txid: "4010e27ff7dc6d9c66a5657e6b3d94b4c4e394d968398d16fefe4637463d194d" + .parse() + .unwrap(), + vout: 0, + }; + let encumbered_fees = Satoshis::from(12_346); + + // Create a batch + let created_tx_id = LedgerTransactionId::new(); + let tx = pool.begin().await?; + ledger + .batch_created( + tx, + created_tx_id, + BatchCreatedParams { + journal_id, + ledger_account_ids: wallet_ledger_accounts, + encumbered_fees, + meta: BatchCreatedMeta { + batch_info: BatchWalletInfo { + account_id, + wallet_id, + batch_id, + payout_queue_id: PayoutQueueId::new(), + included_payouts: Vec::new(), + }, + tx_summary: WalletTransactionSummary { + account_id, + wallet_id, + bitcoin_tx_id: + "4010e27ff7dc6d9c66a5657e6b3d94b4c4e394d968398d16fefe4637463d194d" + .parse() + .unwrap(), + total_utxo_settled_in_sats, + total_utxo_in_sats, + fee_sats, + change_utxos: std::iter::once(ChangeOutput { + outpoint, + satoshis: change_sats, + address, + }) + .collect(), + current_keychain_id: KeychainId::new(), + cpfp_details: None, + cpfp_fee_sats: None, + }, + }, + }, + ) + .await?; + + // Verify initial state + let balances = ledger + .get_wallet_ledger_account_balances(journal_id, wallet_ledger_accounts) + .await?; + let summary = WalletBalanceSummary::from(balances); + + assert_eq!(summary.effective_pending_outgoing, total_spent_sats); + assert_eq!( + summary.effective_settled.flip_sign(), + total_spent_sats + fee_sats + ); + assert_eq!( + summary.effective_encumbered_outgoing.flip_sign(), + total_spent_sats + ); + assert_eq!(summary.fees_encumbered.flip_sign(), encumbered_fees); + assert_eq!(summary.fees_pending, fee_sats); + assert_eq!( + summary.utxo_encumbered_incoming, + total_utxo_in_sats - fee_sats - total_spent_sats + ); + assert_eq!(summary.utxo_settled.flip_sign(), total_utxo_settled_in_sats); + assert_eq!(summary.utxo_pending_outgoing, total_utxo_in_sats - fee_sats); + + // Drop the batch + let tx = pool.begin().await?; + ledger + .batch_dropped(tx, LedgerTransactionId::new(), created_tx_id) + .await?; + + // Verify state after dropping + let balances = ledger + .get_wallet_ledger_account_balances(journal_id, wallet_ledger_accounts) + .await?; + let summary = WalletBalanceSummary::from(balances); + + assert_eq!(summary.effective_pending_outgoing, Satoshis::ZERO); + assert_eq!(summary.effective_settled, Satoshis::ZERO); + assert_eq!(summary.effective_encumbered_outgoing, Satoshis::ZERO); + assert_eq!(summary.fees_encumbered, Satoshis::ZERO); + assert_eq!(summary.fees_pending, Satoshis::ZERO); + assert_eq!(summary.utxo_encumbered_incoming, Satoshis::ZERO); + assert_eq!(summary.utxo_settled, Satoshis::ZERO); + assert_eq!(summary.utxo_pending_outgoing, Satoshis::ZERO); + + let account_summary = AccountBalanceSummary::from( + ledger + .get_account_ledger_account_balances(journal_id) + .await?, + ); + assert_summaries_match(summary, account_summary); + + Ok(()) +} + #[tokio::test] async fn spend_detected() -> anyhow::Result<()> { let pool = helpers::init_pool().await?; From 64f714e15d0053466baa19b79fd128238225f136 Mon Sep 17 00:00:00 2001 From: tiankii Technology Date: Thu, 24 Jul 2025 12:18:41 -0600 Subject: [PATCH 44/65] feat: add fee rate to estimate-payout-fee (#7) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: add fee_rate field to estimate_payout_fee response * test(e2e): evaluate fee_rate and estimate_fee into estimate-payout-fee * fix: fmt error solved * fix(e2e): estimate payout fee expected .satoshis * feat: change fee_rate to float in EstimatePayoutFeeResponse --------- Co-authored-by: Esaú Gómez --- bats/payout.bats | 20 ++++++++++++++++++++ proto/api/bria.proto | 1 + src/api/server/mod.rs | 3 ++- src/app/mod.rs | 12 +++++++----- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/bats/payout.bats b/bats/payout.bats index 5bb4d930..fa5a8cc5 100644 --- a/bats/payout.bats +++ b/bats/payout.bats @@ -384,3 +384,23 @@ teardown_file() { batch=$(bria_cmd get-batch -b "${batch_id}") [[ $(echo ${batch} | jq -r '.id') == "${batch_id}" && $(echo ${batch} | jq -r '.cancelled') == "false" ]] || exit 1 } + +@test "payout: Estimate payout fee returns positive fee and fee_rate" { + bria_address=$(bria_cmd new-address -w default | jq -r '.address') + [[ -n "${bria_address}" ]] || exit 1 + + response=$(bria_cmd estimate-payout-fee \ + --wallet default \ + --queue-name high \ + --destination "${bria_address}" \ + --amount 10000) + + estimated_fee=$(echo "${response}" | jq -r '.satoshis') + fee_rate=$(echo "${response}" | jq -r '.feeRate') + + [[ "${estimated_fee}" =~ ^[0-9]+$ ]] || exit 1 + [[ "${estimated_fee}" -gt 0 ]] || exit 1 + + [[ "${fee_rate}" =~ ^[0-9]+(\.[0-9]+)?$ ]] || exit 1 + [[ "$(echo "${fee_rate} > 0" | bc -l)" -eq 1 ]] || exit 1 +} diff --git a/proto/api/bria.proto b/proto/api/bria.proto index 8091bb10..3ea49250 100644 --- a/proto/api/bria.proto +++ b/proto/api/bria.proto @@ -353,6 +353,7 @@ message EstimatePayoutFeeRequest { message EstimatePayoutFeeResponse { uint64 satoshis = 1; + float fee_rate = 2; } message SubmitPayoutRequest { diff --git a/src/api/server/mod.rs b/src/api/server/mod.rs index 6b6b62a5..0c607be1 100644 --- a/src/api/server/mod.rs +++ b/src/api/server/mod.rs @@ -549,7 +549,7 @@ impl BriaService for Bria { satoshis, } = request; - let sats = match destination { + let (sats, fee_rate) = match destination { Some(proto::estimate_payout_fee_request::Destination::OnchainAddress(address)) => { self.app .estimate_payout_fee_to_address( @@ -583,6 +583,7 @@ impl BriaService for Bria { }; Ok(Response::new(EstimatePayoutFeeResponse { satoshis: u64::from(sats), + fee_rate: fee_rate.as_sat_per_vb(), })) }) .await diff --git a/src/app/mod.rs b/src/app/mod.rs index 6c7a9c6f..25379bc9 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -1,6 +1,7 @@ mod config; pub mod error; +use bdk::FeeRate; use sqlxmq::JobRunnerHandle; use tracing::instrument; @@ -656,7 +657,7 @@ impl App { queue_name: String, destination_wallet_name: String, sats: Satoshis, - ) -> Result { + ) -> Result<(Satoshis, FeeRate), ApplicationError> { let destination_wallet = self .wallets .find_by_account_id_and_name(profile.account_id, destination_wallet_name) @@ -683,7 +684,7 @@ impl App { queue_name: String, destination: String, sats: Satoshis, - ) -> Result { + ) -> Result<(Satoshis, FeeRate), ApplicationError> { let wallet = self .wallets .find_by_account_id_and_name(profile.account_id, wallet_name) @@ -721,7 +722,7 @@ impl App { }; if let Some(fee) = psbt.proportional_fee(&wallet.id, sats) { - return Ok(fee); + return Ok((fee, fee_rate)); } // No utxos were available to simulate the batch @@ -730,7 +731,7 @@ impl App { .payouts .average_payout_per_batch(wallet.id, queue_id) .await?; - Ok(fees::estimate_proportional_fee( + let fee = fees::estimate_proportional_fee( avg_utxo_size, wallet .current_keychain_wallet(&self.pool) @@ -740,7 +741,8 @@ impl App { payout_size, destination, sats, - )) + ); + Ok((fee, fee_rate)) } #[instrument(name = "app.submit_payout_to_address", skip(self), err)] From 645efd99a2b836fc55dd4ca511d2183e2120d70c Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Thu, 24 Jul 2025 14:14:40 -0500 Subject: [PATCH 45/65] chore: flake update (#8) * chore: flake update * fix: format issues --- flake.lock | 12 ++++++------ src/bdk/pg/script_pubkeys.rs | 4 ++-- src/cli/address_extractor.rs | 2 +- src/cli/gen.rs | 10 +++++----- src/fees/client.rs | 6 ++---- src/fees/mod.rs | 2 +- src/ledger/mod.rs | 2 +- src/wallet/keychain/config.rs | 14 +++++++------- 8 files changed, 25 insertions(+), 27 deletions(-) diff --git a/flake.lock b/flake.lock index 955154df..528c5a61 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1754725699, - "narHash": "sha256-iAcj9T/Y+3DBy2J0N+yF9XQQQ8IEb5swLFzs23CdP88=", + "lastModified": 1753250450, + "narHash": "sha256-i+CQV2rPmP8wHxj0aq4siYyohHwVlsh40kV89f3nw1s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "85dbfc7aaf52ecb755f87e577ddbe6dbbdbc1054", + "rev": "fc02ee70efb805d3b2865908a13ddd4474557ecf", "type": "github" }, "original": { @@ -48,11 +48,11 @@ ] }, "locked": { - "lastModified": 1754966322, - "narHash": "sha256-7f/LH60DnjjQVKbXAsHIniGaU7ixVM7eWU3hyjT24YI=", + "lastModified": 1753325142, + "narHash": "sha256-7A8epLZ/LW9tek4OJY4IHesH7BgfBKr3aEm9JjUwqQo=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "7c13cec2e3828d964b9980d0ffd680bd8d4dce90", + "rev": "cf608fb54d8854f31d7f7c499e2d2c928af48036", "type": "github" }, "original": { diff --git a/src/bdk/pg/script_pubkeys.rs b/src/bdk/pg/script_pubkeys.rs index b7dcc6b0..75c9ec69 100644 --- a/src/bdk/pg/script_pubkeys.rs +++ b/src/bdk/pg/script_pubkeys.rs @@ -34,8 +34,8 @@ impl ScriptPubkeys { builder.push_bind(keychain); builder.push_bind(*path as i32); builder.push_bind(script.as_bytes()); - builder.push_bind(format!("{:02x}", script)); - builder.push_bind(format!("{:?}", script)); + builder.push_bind(format!("{script:02x}")); + builder.push_bind(format!("{script:?}")); }); query_builder.push("ON CONFLICT DO NOTHING"); diff --git a/src/cli/address_extractor.rs b/src/cli/address_extractor.rs index 37c15a28..fff105da 100644 --- a/src/cli/address_extractor.rs +++ b/src/cli/address_extractor.rs @@ -45,6 +45,6 @@ pub fn read_and_parse_addresses(file_path: impl AsRef) -> anyhow::Result<( }; let yaml = serde_yaml::to_string(&app_output).unwrap(); - println!("{}", yaml); + println!("{yaml}"); Ok(()) } diff --git a/src/cli/gen.rs b/src/cli/gen.rs index 7489a6a7..6652265c 100644 --- a/src/cli/gen.rs +++ b/src/cli/gen.rs @@ -16,7 +16,7 @@ pub fn gen_descriptor_keys(network: Network) -> anyhow::Result<()> { let root_key: GeneratedKey = bip32::ExtendedPrivKey::generate(())?; let root_key = root_key.into_extended_key()?.into_xprv(network).unwrap(); - println!("ROOT KEY\n{}", root_key); + println!("ROOT KEY\n{root_key}"); let path = bip32::DerivationPath::from_str("m/84'/0'/0'")?; let secp = Secp256k1::new(); let external_key: DescriptorKey = root_key @@ -47,7 +47,7 @@ pub fn gen_descriptor_keys(network: Network) -> anyhow::Result<()> { "timestamp": "now", } ]); - println!("BITCOIND\n{}", bitcoind_json); + println!("BITCOIND\n{bitcoind_json}"); println!("EXTERNAL\n{}", external_descriptor.0); println!("INTERNAL\n{}", internal_descriptor.0); let wallet = bdk::Wallet::new( @@ -67,7 +67,7 @@ pub fn gen_signer_encryption_key() -> anyhow::Result<()> { let key = ChaCha20Poly1305::generate_key(&mut OsRng); let key_bytes = key.as_slice(); let hex_string = hex::encode(key_bytes); - println!("{}", hex_string); + println!("{hex_string}"); Ok(()) } @@ -104,7 +104,7 @@ pub fn rotate_signer_encryption_key(old_key: String) -> anyhow::Result<()> { .expect("should always encrypt"); let hex_encrypted_old_key = hex::encode(encrypted_old_key); let hex_nonce = hex::encode(nonce.as_slice()); - println!("New encryption key: {}", hex_new_encryption_key); + println!("New encryption key: {hex_new_encryption_key}"); let app_output = AppOutput { app: App { @@ -115,6 +115,6 @@ pub fn rotate_signer_encryption_key(old_key: String) -> anyhow::Result<()> { }, }; let yaml = serde_yaml::to_string(&app_output)?; - println!("{}", yaml); + println!("{yaml}"); Ok(()) } diff --git a/src/fees/client.rs b/src/fees/client.rs index cc2c9769..ec91ec8d 100644 --- a/src/fees/client.rs +++ b/src/fees/client.rs @@ -25,10 +25,8 @@ impl FeesClient { } else { self.blockstream.fee_rate(priority).await? }; - tracing::Span::current().record( - "fee_rate", - tracing::field::display(format!("{:?}", fee_rate)), - ); + tracing::Span::current() + .record("fee_rate", tracing::field::display(format!("{fee_rate:?}"))); Ok(fee_rate) } } diff --git a/src/fees/mod.rs b/src/fees/mod.rs index 8bf212f4..5738af57 100644 --- a/src/fees/mod.rs +++ b/src/fees/mod.rs @@ -132,7 +132,7 @@ mod tests { // has 1 input and 2 outputs let bytes = hex::decode("01000000000101e4b803c2d1bbc799050ef212b6749b925e35e9530839c833aca4964c4278a3e4010000000080e3ffff02b738010000000000160014c3dc650ba285d0b7bcb0486ec7454e434146f6e093f6c20000000000160014c789c7a2800fdad9a330373a3b58319f4b7b0f8802483045022100a9dbe84dd0ce75aeac6bc9151e3ecea0d9be70ce93645d179bc61ca96bfd6eaa02200fa8facea14e00d207b830a0b0b3bb106a6735a4a8e0702232aa22c8ffa6a4e101210226f3fc10d64822765964345fd6bc71d48782d2c44bcef826089d0e4d709532ac00000000").unwrap(); let tx: Transaction = bitcoin::consensus::encode::deserialize(&bytes).unwrap(); - assert_eq!(tx.weight(), Weight::from_wu(562 as u64)); + assert_eq!(tx.weight(), Weight::from_wu(562_u64)); let fee_rate = bitcoin::FeeRate::from_sat_per_vb(1000.); diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index 5d114158..66864cce 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -750,7 +750,7 @@ impl Ledger { .id(account_id) .name(&wallet_name) .code(wallet_code) - .description(format!("Account for wallet '{}'", wallet_id_prefix)) + .description(format!("Account for wallet '{wallet_id_prefix}'")) .normal_balance_type(balance_type) .build() .expect("Couldn't build NewLedgerAccount"); diff --git a/src/wallet/keychain/config.rs b/src/wallet/keychain/config.rs index 8743fcc7..39512729 100644 --- a/src/wallet/keychain/config.rs +++ b/src/wallet/keychain/config.rs @@ -53,18 +53,18 @@ impl KeychainConfig { pub fn external_descriptor(&self) -> ExtendedDescriptor { match self { - Self::Wpkh { xpub } => format!("wpkh({}/0/*)", xpub) + Self::Wpkh { xpub } => format!("wpkh({xpub}/0/*)") .parse() .expect("Couldn't create internal wpkh descriptor"), Self::Descriptors { external, .. } => external.clone(), Self::SortedMultisig { xpub, threshold } => { let keys = xpub .iter() - .map(|xpub| format!("{}/0/*", xpub)) + .map(|xpub| format!("{xpub}/0/*")) .collect::>(); let keys = keys.join(","); - println!("{}", keys); - format!("wsh(sortedmulti({},{}))", threshold, keys) + println!("{keys}"); + format!("wsh(sortedmulti({threshold},{keys}))") .parse() .expect("Couldn't create external sorted multisig descriptor") } @@ -73,17 +73,17 @@ impl KeychainConfig { pub fn internal_descriptor(&self) -> ExtendedDescriptor { match self { - Self::Wpkh { xpub } => format!("wpkh({}/1/*)", xpub) + Self::Wpkh { xpub } => format!("wpkh({xpub}/1/*)") .parse() .expect("Couldn't create internal wpkh descriptor"), Self::Descriptors { internal, .. } => internal.clone(), Self::SortedMultisig { xpub, threshold } => { let keys = xpub .iter() - .map(|xpub| format!("{}/1/*", xpub)) + .map(|xpub| format!("{xpub}/1/*")) .collect::>(); let keys = keys.join(","); - format!("wsh(sortedmulti({},{}))", threshold, keys) + format!("wsh(sortedmulti({threshold},{keys}))") .parse() .expect("Couldn't create internal sorted multisig descriptor") } From 8e7027c63fea083bef421a0c15be2c9c1309ac94 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 17 Nov 2025 08:43:59 -0500 Subject: [PATCH 46/65] fix: handle pg_notify payload overflow for high-input transactions (#10) --- Cargo.lock | 1829 +++++++++-------- Cargo.toml | 4 +- bats/payout.bats | 167 ++ ...09_fix_ledger_notify_payload_size.down.sql | 12 + ...4609_fix_ledger_notify_payload_size.up.sql | 22 + src/bdk/pg/script_pubkeys.rs | 22 + src/bdk/pg/transactions.rs | 15 + src/tracing.rs | 11 +- 8 files changed, 1192 insertions(+), 890 deletions(-) create mode 100644 migrations/20251116204609_fix_ledger_notify_payload_size.down.sql create mode 100644 migrations/20251116204609_fix_ledger_notify_payload_size.up.sql diff --git a/Cargo.lock b/Cargo.lock index d2523526..5bab23a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[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" @@ -33,16 +18,16 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.15", + "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", "once_cell", @@ -52,24 +37,18 @@ 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.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" - -[[package]] -name = "android-tzdata" -version = "0.1.1" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android_system_properties" @@ -82,9 +61,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" dependencies = [ "anstyle", "anstyle-parse", @@ -97,43 +76,44 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "once_cell_polyfill", + "windows-sys 0.61.2", ] [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" [[package]] name = "anymap2" @@ -175,18 +155,18 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "async-trait" -version = "0.1.88" +version = "0.1.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -206,9 +186,9 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "autotools" @@ -232,7 +212,7 @@ dependencies = [ "futures-util", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "itoa", "matchit", "memchr", @@ -257,7 +237,7 @@ dependencies = [ "axum-core 0.4.5", "bytes", "futures-util", - "http 1.1.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", "itoa", @@ -269,7 +249,7 @@ dependencies = [ "rustversion", "serde", "sync_wrapper 1.0.2", - "tower 0.5.1", + "tower 0.5.2", "tower-layer", "tower-service", ] @@ -300,7 +280,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.1.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", "mime", @@ -311,21 +291,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - [[package]] name = "base64" version = "0.13.1" @@ -346,9 +311,9 @@ 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 = "bdk" @@ -360,11 +325,11 @@ dependencies = [ "bdk-macros", "bitcoin", "electrum-client", - "getrandom 0.2.15", + "getrandom 0.2.16", "js-sys", "log", "miniscript", - "rand", + "rand 0.8.5", "serde", "serde_json", "sled", @@ -468,20 +433,11 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" -dependencies = [ - "serde", -] - -[[package]] -name = "bitmaps" -version = "2.1.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" dependencies = [ - "typenum", + "serde_core", ] [[package]] @@ -507,9 +463,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2506947f73ad44e344215ccd6403ac2ae18cd8e046e581a441bf8d199f257f03" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ "borsh-derive", "cfg_aliases", @@ -517,20 +473,20 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2593a3b8b938bd68373196c9832f516be11fa487ef4ae745eb282e6a56a7244" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "bria" -version = "0.1.114" +version = "0.1.116-dev" dependencies = [ "anyhow", "async-trait", @@ -542,7 +498,6 @@ dependencies = [ "clap", "derive_builder", "electrum-client", - "es-entity", "fedimint-tonic-lnd", "futures", "hex", @@ -553,7 +508,7 @@ dependencies = [ "prost 0.12.6", "prost-wkt-types", "protobuf-src", - "rand", + "rand 0.8.5", "regex", "reqwest", "reqwest-middleware", @@ -585,9 +540,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.16.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "bytecheck" @@ -619,9 +574,9 @@ 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" [[package]] name = "cached" @@ -629,7 +584,7 @@ version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9718806c4a2fe9e8a56fd736f97b340dd10ed1be8ed733ed50449f351dc33cae" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", "async-trait", "cached_proc_macro", "cached_proc_macro_types", @@ -650,7 +605,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -661,18 +616,19 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] name = "cc" -version = "1.2.16" +version = "1.2.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] name = "cfg_aliases" @@ -706,11 +662,10 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "js-sys", "num-traits", @@ -732,9 +687,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.21" +version = "4.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3b4b9e5a7c7514dfa52869339ee98b3156b0bfb4e8a77c4ff4babb64b1604f" +checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" dependencies = [ "clap_builder", "clap_derive", @@ -742,9 +697,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.21" +version = "4.5.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b17a95aa67cc7b5ebd32aa5370189aa0d79069ef1c64ce893bd30fb24bff20ec" +checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" dependencies = [ "anstream", "anstyle", @@ -754,27 +709,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "clap_lex" -version = "0.7.3" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afb84c814227b90d6895e01398aee0d8033c00e7466aca416fb6a8e0eb19d8a7" +checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "concurrent-queue" @@ -791,15 +746,6 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" -[[package]] -name = "convert_case" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -808,18 +754,18 @@ checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b80225097f2e5ae4e7179dd2266824648f3e2f49d9134d584b76389d31c4c3" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.2.1" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" dependencies = [ "crc-catalog", ] @@ -832,9 +778,9 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.2" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" dependencies = [ "cfg-if", ] @@ -850,27 +796,27 @@ 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 = "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", ] @@ -905,7 +851,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -919,7 +865,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -930,7 +876,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -941,14 +887,14 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[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", @@ -957,12 +903,12 @@ 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", - "serde", + "serde_core", ] [[package]] @@ -983,7 +929,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -993,7 +939,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -1016,7 +962,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -1031,11 +977,17 @@ version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[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", ] @@ -1070,61 +1022,29 @@ dependencies = [ [[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" -version = "0.4.5" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24e2389d65ab4fab27dc2a5de7b191e1f6617d1f1c8855c0dc569c94a4cbb18d" +checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" dependencies = [ "serde", + "serde_core", "typeid", ] [[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", -] - -[[package]] -name = "es-entity" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51574a2e447ca840cf2d80b610b8c3e88088dc8477c5d3ba24e20c8f6f0d05af" -dependencies = [ - "chrono", - "derive_builder", - "es-entity-macros", - "im", - "pin-project", - "serde", - "serde_json", - "sqlx", - "thiserror 2.0.12", - "uuid", -] - -[[package]] -name = "es-entity-macros" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9beed351da1b6a67b0e82a815aee153bcf2187bf5f4702e6d7e6a48d38aa6f45" -dependencies = [ - "convert_case", - "darling 0.21.3", - "pluralizer", - "proc-macro2", - "quote", - "regex", - "syn 2.0.104", + "windows-sys 0.61.2", ] [[package]] @@ -1140,9 +1060,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", @@ -1151,9 +1071,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486f806e73c5707928240ddc295403b1b93c96a02038563881c4a2fd84b81ac4" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fedimint-tonic-lnd" @@ -1163,11 +1083,11 @@ checksum = "df03ca33b5116de3051c1e233fe341e23b04c4913c7b16042497924559bc2a2e" dependencies = [ "hex", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-rustls 0.24.2", "prost 0.12.6", "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls-pemfile", "tokio", "tokio-stream", "tonic 0.10.2", @@ -1175,12 +1095,24 @@ dependencies = [ "tower 0.4.13", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + [[package]] name = "fixedbitset" version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + [[package]] name = "flume" version = "0.11.1" @@ -1206,9 +1138,9 @@ checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[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", ] @@ -1279,7 +1211,7 @@ checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.12.3", + "parking_lot 0.12.5", ] [[package]] @@ -1296,7 +1228,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -1350,46 +1282,42 @@ dependencies = [ [[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 0.11.0+wasi-snapshot-preview1", + "wasi", "wasm-bindgen", ] [[package]] name = "getrandom" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", - "wasi 0.14.2+wasi-0.2.4", + "wasip2", + "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" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" [[package]] name = "h2" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +checksum = "0beca50380b1fc32983fc1cb4587bfa4bb9e78fc259aad4a0032d2080309222d" dependencies = [ "bytes", "fnv", @@ -1397,7 +1325,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.6.0", + "indexmap 2.12.0", "slab", "tokio", "tokio-util", @@ -1406,17 +1334,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.7" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccae279728d634d083c00f6099cb58f01cc99c145b84b8be2f6c74618d79922e" +checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", + "http 1.3.1", + "indexmap 2.12.0", "slab", "tokio", "tokio-util", @@ -1438,28 +1366,34 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.11", + "ahash 0.8.12", "allocator-api2", ] [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" dependencies = [ "allocator-api2", "equivalent", "foldhash", ] +[[package]] +name = "hashbrown" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" + [[package]] name = "hashlink" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.15.2", + "hashbrown 0.15.5", ] [[package]] @@ -1468,12 +1402,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - [[package]] name = "hex" version = "0.4.3" @@ -1506,11 +1434,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -1526,9 +1454,9 @@ dependencies = [ [[package]] name = "http" -version = "1.1.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -1553,27 +1481,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.1.0", + "http 1.3.1", ] [[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.3.1", "http-body 1.0.1", "pin-project-lite", ] [[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" @@ -1583,22 +1511,22 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[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", + "h2 0.3.27", "http 0.2.12", "http-body 0.4.6", "httparse", "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -1607,20 +1535,22 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97818827ef4f364230e16705d4706e2897df2bb60617d6ca15d598025a3c481f" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" dependencies = [ + "atomic-waker", "bytes", "futures-channel", - "futures-util", - "h2 0.4.7", - "http 1.1.0", + "futures-core", + "h2 0.4.12", + "http 1.3.1", "http-body 1.0.1", "httparse", "httpdate", "itoa", "pin-project-lite", + "pin-utils", "smallvec", "tokio", "want", @@ -1634,7 +1564,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.12", - "hyper 0.14.31", + "hyper 0.14.32", "rustls 0.21.12", "tokio", "tokio-rustls 0.24.1", @@ -1642,20 +1572,19 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "futures-util", - "http 1.1.0", - "hyper 1.5.1", + "http 1.3.1", + "hyper 1.8.1", "hyper-util", - "rustls 0.23.18", + "rustls 0.23.35", "rustls-pki-types", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.4", "tower-service", - "webpki-roots 0.26.7", + "webpki-roots 1.0.4", ] [[package]] @@ -1664,7 +1593,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.31", + "hyper 0.14.32", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -1676,7 +1605,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b90d566bffbce6a75bd8b09a05aa8c2cb1fabb6cb348f8840c9e4c90a0d83b0" dependencies = [ - "hyper 1.5.1", + "hyper 1.8.1", "hyper-util", "pin-project-lite", "tokio", @@ -1685,18 +1614,23 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" dependencies = [ + "base64 0.22.1", "bytes", "futures-channel", + "futures-core", "futures-util", - "http 1.1.0", + "http 1.3.1", "http-body 1.0.1", - "hyper 1.5.1", + "hyper 1.8.1", + "ipnet", + "libc", + "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.1", "tokio", "tower-service", "tracing", @@ -1704,14 +1638,15 @@ dependencies = [ [[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", ] @@ -1727,21 +1662,22 @@ dependencies = [ [[package]] name = "icu_collections" -version = "1.5.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" dependencies = [ "displaydoc", + "potential_utf", "yoke", "zerofrom", "zerovec", ] [[package]] -name = "icu_locid" -version = "1.5.0" +name = "icu_locale_core" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" dependencies = [ "displaydoc", "litemap", @@ -1750,99 +1686,61 @@ dependencies = [ "zerovec", ] -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - [[package]] name = "icu_normalizer" -version = "1.5.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" dependencies = [ - "displaydoc", "icu_collections", "icu_normalizer_data", "icu_properties", "icu_provider", "smallvec", - "utf16_iter", - "utf8_iter", - "write16", "zerovec", ] [[package]] name = "icu_normalizer_data" -version = "1.5.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "1.5.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" dependencies = [ - "displaydoc", "icu_collections", - "icu_locid_transform", + "icu_locale_core", "icu_properties_data", "icu_provider", - "tinystr", + "zerotrie", "zerovec", ] [[package]] name = "icu_properties_data" -version = "1.5.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" [[package]] name = "icu_provider" -version = "1.5.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" dependencies = [ "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", + "icu_locale_core", "writeable", "yoke", "zerofrom", + "zerotrie", "zerovec", ] -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "ident_case" version = "1.0.1" @@ -1851,9 +1749,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" dependencies = [ "idna_adapter", "smallvec", @@ -1862,29 +1760,14 @@ dependencies = [ [[package]] name = "idna_adapter" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" dependencies = [ "icu_normalizer", "icu_properties", ] -[[package]] -name = "im" -version = "15.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" -dependencies = [ - "bitmaps", - "rand_core", - "rand_xoshiro", - "serde", - "sized-chunks", - "typenum", - "version_check", -] - [[package]] name = "indexmap" version = "1.9.3" @@ -1898,20 +1781,21 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.6.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", - "hashbrown 0.15.2", + "hashbrown 0.16.0", "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", ] @@ -1930,21 +1814,34 @@ dependencies = [ [[package]] name = "inventory" -version = "0.3.15" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f958d3d68f4167080a18141e10381e7634563984a537f2a49a30fd8e53ac5767" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] [[package]] name = "ipnet" -version = "2.10.1" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" +checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +dependencies = [ + "memchr", + "serde", +] [[package]] name = "is_terminal_polyfill" -version = "1.70.1" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" [[package]] name = "itertools" @@ -1957,24 +1854,24 @@ dependencies = [ [[package]] name = "itertools" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.77" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" dependencies = [ "once_cell", "wasm-bindgen", @@ -2002,16 +1899,16 @@ dependencies = [ [[package]] name = "lalrpop" -version = "0.22.0" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06093b57658c723a21da679530e061a8c25340fa5a6f98e313b542268c7e2a1f" +checksum = "ba4ebbd48ce411c1d10fb35185f5a51a7bfa3d8b24b4e330d30c9e3a34129501" dependencies = [ "ascii-canvas", "bit-set", "ena", - "itertools 0.13.0", + "itertools 0.14.0", "lalrpop-util", - "petgraph", + "petgraph 0.7.1", "pico-args", "regex", "regex-syntax", @@ -2024,9 +1921,9 @@ dependencies = [ [[package]] name = "lalrpop-util" -version = "0.22.0" +version = "0.22.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feee752d43abd0f4807a921958ab4131f692a44d4d599733d4419c5d586176ce" +checksum = "b5baa5e9ff84f1aefd264e6869907646538a52147a755d494517a8007fb48733" dependencies = [ "regex-automata", "rustversion", @@ -2043,15 +1940,26 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.165" +version = "0.2.177" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb4d3d38eab6c5239a362fa8bae48c03baf980a6e7079f063942d563ef3533e" +checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" [[package]] name = "libm" -version = "0.2.11" +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 = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +dependencies = [ + "bitflags 2.10.0", + "libc", + "redox_syscall 0.5.18", +] [[package]] name = "libsqlite3-sys" @@ -2065,31 +1973,36 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" [[package]] name = "litemap" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" +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" +version = "0.4.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" + +[[package]] +name = "lru-slab" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" [[package]] name = "matchers" @@ -2118,9 +2031,9 @@ 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 = "mime" @@ -2130,41 +2043,31 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniscript" -version = "10.2.0" +version = "10.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d371924f9eb7aa860ab395baaaa0bcdfa81a32f330b538c4e2c04617b2722fe3" +checksum = "2e88ef03cc0ce21bcf584da157890b292fc4b69bfeaa4e9d41bbf492da59b22f" dependencies = [ "bitcoin", "bitcoin-private", "serde", ] -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - [[package]] name = "mio" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ - "hermit-abi", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.52.0", + "wasi", + "windows-sys 0.61.2", ] [[package]] name = "multimap" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" [[package]] name = "new_debug_unreachable" @@ -2174,26 +2077,25 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nu-ansi-term" -version = "0.50.1" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4a28e057d01f97e61255210fcff094d74ed0466038633e95017f5beb68e4399" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[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", ] @@ -2235,19 +2137,16 @@ dependencies = [ ] [[package]] -name = "object" -version = "0.36.5" +name = "once_cell" +version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" -dependencies = [ - "memchr", -] +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] -name = "once_cell" -version = "1.20.2" +name = "once_cell_polyfill" +version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" [[package]] name = "opaque-debug" @@ -2257,16 +2156,16 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "opentelemetry" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3cebff57f7dbd1255b44d8bddc2cebeb0ea677dbaa2e25a3070a91b318f660" +checksum = "ab70038c28ed37b97d8ed414b6429d343a8bbf44c9f79ec854f3a643029ba6d7" dependencies = [ "futures-core", "futures-sink", "js-sys", - "once_cell", "pin-project-lite", "thiserror 1.0.69", + "tracing", ] [[package]] @@ -2277,7 +2176,7 @@ checksum = "10a8a7f5f6ba7c1b286c2fbca0454eaba116f63bbe69ed250b642d36fbb04d80" dependencies = [ "async-trait", "bytes", - "http 1.1.0", + "http 1.3.1", "opentelemetry", "reqwest", ] @@ -2290,12 +2189,12 @@ checksum = "91cf61a1868dacc576bf2b2a1c3e9ab150af7272909e80085c3173384fe11f76" dependencies = [ "async-trait", "futures-core", - "http 1.1.0", + "http 1.3.1", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", "opentelemetry_sdk", - "prost 0.13.3", + "prost 0.13.5", "reqwest", "thiserror 1.0.69", "tokio", @@ -2311,25 +2210,24 @@ checksum = "a6e05acbfada5ec79023c85368af14abd0b307c015e9064d249b2a950ef459a6" dependencies = [ "opentelemetry", "opentelemetry_sdk", - "prost 0.13.3", + "prost 0.13.5", "tonic 0.12.3", ] [[package]] name = "opentelemetry_sdk" -version = "0.27.0" +version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b742c1cae4693792cc564e58d75a2a0ba29421a34a85b50da92efa89ecb2bc" +checksum = "231e9d6ceef9b0b2546ddf52335785ce41252bc7474ee8ba05bfad277be13ab8" dependencies = [ "async-trait", "futures-channel", "futures-executor", "futures-util", "glob", - "once_cell", "opentelemetry", "percent-encoding", - "rand", + "rand 0.8.5", "serde_json", "thiserror 1.0.69", "tokio", @@ -2356,12 +2254,12 @@ dependencies = [ [[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 0.9.10", + "parking_lot_core 0.9.12", ] [[package]] @@ -2380,15 +2278,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 0.5.7", + "redox_syscall 0.5.18", "smallvec", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -2402,9 +2300,9 @@ 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 = "petgraph" @@ -2412,15 +2310,25 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ - "fixedbitset", - "indexmap 2.6.0", + "fixedbitset 0.4.2", + "indexmap 2.12.0", +] + +[[package]] +name = "petgraph" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +dependencies = [ + "fixedbitset 0.5.7", + "indexmap 2.12.0", ] [[package]] name = "phf_shared" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ "siphasher", ] @@ -2448,14 +2356,14 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -2486,19 +2394,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" - -[[package]] -name = "pluralizer" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b3eba432a00a1f6c16f39147847a870e94e2e9b992759b503e330efec778cbe" -dependencies = [ - "once_cell", - "regex", -] +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "poly1305" @@ -2511,6 +2409,15 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -2519,9 +2426,9 @@ 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", ] @@ -2534,28 +2441,28 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.25" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "proc-macro-crate" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" dependencies = [ "unicode-ident", ] @@ -2572,12 +2479,12 @@ dependencies = [ [[package]] name = "prost" -version = "0.13.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" dependencies = [ "bytes", - "prost-derive 0.13.3", + "prost-derive 0.13.5", ] [[package]] @@ -2592,12 +2499,12 @@ dependencies = [ "log", "multimap", "once_cell", - "petgraph", + "petgraph 0.6.5", "prettyplease", "prost 0.12.6", "prost-types", "regex", - "syn 2.0.104", + "syn 2.0.110", "tempfile", ] @@ -2611,20 +2518,20 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "prost-derive" -version = "0.13.3" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.13.0", + "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -2714,37 +2621,40 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.6" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" dependencies = [ "bytes", + "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.18", - "socket2", - "thiserror 2.0.12", + "rustls 0.23.35", + "socket2 0.6.1", + "thiserror 2.0.17", "tokio", "tracing", + "web-time", ] [[package]] name = "quinn-proto" -version = "0.11.9" +version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" dependencies = [ "bytes", - "getrandom 0.2.15", - "rand", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", "ring", "rustc-hash", - "rustls 0.23.18", + "rustls 0.23.35", "rustls-pki-types", "slab", - "thiserror 2.0.12", + "thiserror 2.0.17", "tinyvec", "tracing", "web-time", @@ -2752,32 +2662,32 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.7" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a626c6807713b15cac82a6acaccd6043c9a5408c24baae07611fec3f243da" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.6.1", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] name = "quote" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" dependencies = [ "proc-macro2", ] [[package]] name = "r-efi" -version = "5.2.0" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "radium" @@ -2792,8 +2702,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]] @@ -2803,7 +2723,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]] @@ -2812,16 +2742,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.15", + "getrandom 0.2.16", ] [[package]] -name = "rand_xoshiro" -version = "0.6.0" +name = "rand_core" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ - "rand_core", + "getrandom 0.3.4", ] [[package]] @@ -2835,18 +2765,38 @@ 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 2.10.0", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", ] [[package]] name = "regex" -version = "1.11.1" +version = "1.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" dependencies = [ "aho-corasick", "memchr", @@ -2856,9 +2806,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.9" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" dependencies = [ "aho-corasick", "memchr", @@ -2867,9 +2817,9 @@ 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 = "rend" @@ -2882,45 +2832,42 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.9" +version = "0.12.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a77c62af46e79de0a562e1a9849205ffcb7fc1238876e9bd743357570e04046f" +checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" dependencies = [ "base64 0.22.1", "bytes", "futures-channel", "futures-core", "futures-util", - "http 1.1.0", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", - "hyper-rustls 0.27.3", + "hyper 1.8.1", + "hyper-rustls 0.27.7", "hyper-util", - "ipnet", "js-sys", "log", - "mime", - "once_cell", "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.18", - "rustls-pemfile 2.2.0", + "rustls 0.23.35", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper 1.0.2", "tokio", - "tokio-rustls 0.26.0", + "tokio-rustls 0.26.4", + "tower 0.5.2", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.7", - "windows-registry", + "webpki-roots 1.0.4", ] [[package]] @@ -2931,7 +2878,7 @@ checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 1.1.0", + "http 1.3.1", "reqwest", "serde", "thiserror 1.0.69", @@ -2948,9 +2895,9 @@ dependencies = [ "async-trait", "chrono", "futures", - "getrandom 0.2.15", - "http 1.1.0", - "hyper 1.5.1", + "getrandom 0.2.16", + "http 1.3.1", + "hyper 1.8.1", "parking_lot 0.11.2", "reqwest", "reqwest-middleware", @@ -2968,7 +2915,7 @@ checksum = "493b4243e32d6eedd29f9a398896e35c6943a123b55eec97dcaee98310d25810" dependencies = [ "anyhow", "chrono", - "rand", + "rand 0.8.5", ] [[package]] @@ -2979,7 +2926,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.15", + "getrandom 0.2.16", "libc", "untrusted", "windows-sys 0.52.0", @@ -3016,9 +2963,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.7" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" +checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" dependencies = [ "const-oid", "digest", @@ -3027,7 +2974,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -3036,15 +2983,15 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.36.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +checksum = "35affe401787a9bd846712274d97654355d21b2a2c092a3139aabe31e9022282" dependencies = [ "arrayvec", "borsh", "bytes", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -3052,37 +2999,31 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.36.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da991f231869f34268415a49724c6578e740ad697ba0999199d6f22b3949332c" +checksum = "ae8c0cb48f413ebe24dc2d148788e0efbe09ba3e011d9277162f2eaf8e1069a3" dependencies = [ "quote", - "rust_decimal", + "syn 2.0.110", ] -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "0.38.41" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f649912bc1495e167a6edee79151c84b1bad49748cb4f1f1167f459f6224f6" +checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.10.0", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3099,14 +3040,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.18" +version = "0.23.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9cc1d47e243d655ace55ed38201c19ae02c148ae56412ab8750e8f0166ab7f" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.102.8", + "rustls-webpki 0.103.8", "subtle", "zeroize", ] @@ -3120,22 +3061,14 @@ dependencies = [ "base64 0.21.7", ] -[[package]] -name = "rustls-pemfile" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" -dependencies = [ - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" dependencies = [ "web-time", + "zeroize", ] [[package]] @@ -3150,9 +3083,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.103.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" dependencies = [ "ring", "rustls-pki-types", @@ -3161,9 +3094,9 @@ dependencies = [ [[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 = "rusty-money" @@ -3177,9 +3110,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.18" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "same-file" @@ -3192,13 +3125,37 @@ dependencies = [ [[package]] name = "scc" -version = "2.2.5" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66b202022bb57c049555430e11fc22fea12909276a80a4c3d368da36ac1d88ed" +checksum = "46e6f046b7fef48e2660c57ed794263155d713de679057f2d0c169bfc6e756cc" dependencies = [ "sdd", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -3217,9 +3174,9 @@ dependencies = [ [[package]] name = "sdd" -version = "3.0.4" +version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49c1eeaf4b6a87c7479688c6d52b9f1153cedd3c489300564f932b065c6eab95" +checksum = "490dcfcbfef26be6800d11870ff2df8774fa6e86d047e3e8c8a76b25655e41ca" [[package]] name = "seahash" @@ -3234,50 +3191,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" dependencies = [ "bitcoin_hashes", - "rand", + "rand 0.8.5", "secp256k1-sys", "serde", ] [[package]] name = "secp256k1-sys" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +checksum = "4473013577ec77b4ee3668179ef1186df3146e2cf2d927bd200974c6fe60fd99" dependencies = [ "cc", ] [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ "itoa", "memchr", "ryu", "serde", + "serde_core", ] [[package]] @@ -3294,17 +3262,18 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.11.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" +checksum = "10574371d41b0d9b2cff89418eda27da52bcaff2cc8741db26382a77c29131f1" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.6.0", - "serde", - "serde_derive", + "indexmap 2.12.0", + "schemars 0.9.0", + "schemars 1.1.0", + "serde_core", "serde_json", "serde_with_macros", "time", @@ -3312,14 +3281,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.11.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" +checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b" dependencies = [ - "darling 0.20.11", + "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -3328,7 +3297,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.12.0", "itoa", "ryu", "serde", @@ -3344,7 +3313,7 @@ dependencies = [ "futures", "log", "once_cell", - "parking_lot 0.12.3", + "parking_lot 0.12.5", "scc", "serial_test_derive", ] @@ -3357,7 +3326,7 @@ checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -3373,9 +3342,9 @@ 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", @@ -3409,9 +3378,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.2" +version = "1.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" dependencies = [ "libc", ] @@ -3423,7 +3392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -3434,28 +3403,15 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "sized-chunks" -version = "0.6.5" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" -dependencies = [ - "bitmaps", - "typenum", -] +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "sled" @@ -3475,23 +3431,33 @@ dependencies = [ [[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.5.7" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" dependencies = [ "libc", "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "spin" version = "0.9.8" @@ -3513,9 +3479,9 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f" +checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3526,10 +3492,11 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0" +checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" dependencies = [ + "base64 0.22.1", "bytes", "chrono", "crc", @@ -3540,34 +3507,33 @@ dependencies = [ "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.15.2", + "hashbrown 0.15.5", "hashlink", - "indexmap 2.6.0", + "indexmap 2.12.0", "log", "memchr", "once_cell", "percent-encoding", "rust_decimal", - "rustls 0.23.18", - "rustls-pemfile 2.2.0", + "rustls 0.23.35", "serde", "serde_json", "sha2", "smallvec", - "thiserror 2.0.12", + "thiserror 2.0.17", "tokio", "tokio-stream", "tracing", "url", "uuid", - "webpki-roots 0.26.7", + "webpki-roots 0.26.11", ] [[package]] name = "sqlx-ledger" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9369e218d700d6dd64173d9c39e9ef1ae9113d509a48d1966f4cf800f656697" +checksum = "110d199a8c6a0d58ea4635505ec31733990d3534d9602fdfddf48288cfbbecc9" dependencies = [ "cached", "chrono", @@ -3588,9 +3554,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-interpreter" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fddd96dc84b0ae274d2bad03f5bc1be47c0270c91ba4a52c5b8bf8402363bce" +checksum = "c716b8648ded88e00f67be157cf0dc5e1deb45b29ae212845fcc40dda1d744fd" dependencies = [ "chrono", "rust_decimal", @@ -3603,9 +3569,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-parser" -version = "0.11.5" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a325bbfe2b3a3371580a3c1a38eaf817b8cfa07006b0f37bc34556e51944885b" +checksum = "a500391deb97fe82076b33d3bbbf5579c1bbdea67c63703afbdf55d41d24e015" dependencies = [ "lalrpop", "lalrpop-util", @@ -3613,22 +3579,22 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310" +checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "sqlx-macros-core" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad" +checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" dependencies = [ "dotenvy", "either", @@ -3644,21 +3610,20 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.104", - "tempfile", + "syn 2.0.110", "tokio", "url", ] [[package]] name = "sqlx-mysql" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" +checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.6.0", + "bitflags 2.10.0", "byteorder", "bytes", "chrono", @@ -3680,7 +3645,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "rust_decimal", "serde", @@ -3689,7 +3654,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.12", + "thiserror 2.0.17", "tracing", "uuid", "whoami", @@ -3697,13 +3662,13 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" +checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.6.0", + "bitflags 2.10.0", "byteorder", "chrono", "crc", @@ -3721,7 +3686,7 @@ dependencies = [ "md-5", "memchr", "once_cell", - "rand", + "rand 0.8.5", "rust_decimal", "serde", "serde_json", @@ -3729,7 +3694,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.12", + "thiserror 2.0.17", "tracing", "uuid", "whoami", @@ -3737,9 +3702,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.8.3" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540" +checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" dependencies = [ "atoi", "chrono", @@ -3755,6 +3720,7 @@ dependencies = [ "serde", "serde_urlencoded", "sqlx-core", + "thiserror 2.0.17", "tracing", "url", "uuid", @@ -3789,19 +3755,18 @@ 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 = "string_cache" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" +checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" dependencies = [ "new_debug_unreachable", - "once_cell", - "parking_lot 0.12.3", + "parking_lot 0.12.5", "phf_shared", "precomputed-hash", ] @@ -3842,9 +3807,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.110" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" dependencies = [ "proc-macro2", "quote", @@ -3868,13 +3833,13 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -3885,25 +3850,24 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.14.0" +version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28cce251fcbc87fac86a866eeb0d6c2d536fc16d06f184bb61aeae11aa4cee0c" +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 = "term" -version = "1.0.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4175de05129f31b80458c6df371a15e7fc3fd367272e6bf938e5c351c7ea0" +checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" dependencies = [ - "home", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] @@ -3917,11 +3881,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ - "thiserror-impl 2.0.12", + "thiserror-impl 2.0.17", ] [[package]] @@ -3932,35 +3896,34 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "thread_local" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" dependencies = [ "cfg-if", - "once_cell", ] [[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", @@ -3973,15 +3936,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", @@ -3989,9 +3952,9 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" dependencies = [ "displaydoc", "zerovec", @@ -3999,9 +3962,9 @@ dependencies = [ [[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", ] @@ -4014,27 +3977,26 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cfb5bee7a6a52939ca9224d6ac897bb669134078daa8735560897f69de4d33" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", - "parking_lot 0.12.3", + "parking_lot 0.12.5", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.6.1", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-io-timeout" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +checksum = "0bd86198d9ee903fedd2f9a2e72014287c0d9167e4ae43b5853007205dda1b76" dependencies = [ "pin-project-lite", "tokio", @@ -4042,13 +4004,13 @@ dependencies = [ [[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.104", + "syn 2.0.110", ] [[package]] @@ -4063,20 +4025,19 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.18", - "rustls-pki-types", + "rustls 0.23.35", "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", @@ -4086,9 +4047,9 @@ 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", @@ -4099,18 +4060,31 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.8" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +dependencies = [ + "serde_core", +] [[package]] name = "toml_edit" -version = "0.22.22" +version = "0.23.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" dependencies = [ - "indexmap 2.6.0", + "indexmap 2.12.0", "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +dependencies = [ "winnow", ] @@ -4125,16 +4099,16 @@ dependencies = [ "axum 0.6.20", "base64 0.21.7", "bytes", - "h2 0.3.26", + "h2 0.3.27", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout 0.4.1", "percent-encoding", "pin-project", "prost 0.12.6", "rustls 0.21.12", - "rustls-pemfile 1.0.4", + "rustls-pemfile", "tokio", "tokio-rustls 0.24.1", "tokio-stream", @@ -4155,10 +4129,10 @@ dependencies = [ "axum 0.6.20", "base64 0.21.7", "bytes", - "h2 0.3.26", + "h2 0.3.27", "http 0.2.12", "http-body 0.4.6", - "hyper 0.14.31", + "hyper 0.14.32", "hyper-timeout 0.4.1", "percent-encoding", "pin-project", @@ -4182,17 +4156,17 @@ dependencies = [ "axum 0.7.9", "base64 0.22.1", "bytes", - "h2 0.4.7", - "http 1.1.0", + "h2 0.4.12", + "http 1.3.1", "http-body 1.0.1", "http-body-util", - "hyper 1.5.1", + "hyper 1.8.1", "hyper-timeout 0.5.2", "hyper-util", "percent-encoding", "pin-project", - "prost 0.13.3", - "socket2", + "prost 0.13.5", + "socket2 0.5.10", "tokio", "tokio-stream", "tower 0.4.13", @@ -4211,7 +4185,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -4224,7 +4198,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] @@ -4251,7 +4225,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", + "rand 0.8.5", "slab", "tokio", "tokio-util", @@ -4262,14 +4236,33 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", "pin-project-lite", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.2", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-util", + "http 1.3.1", + "http-body 1.0.1", + "iri-string", + "pin-project-lite", + "tower 0.5.2", "tower-layer", "tower-service", ] @@ -4306,14 +4299,14 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "tracing-core" -version = "0.1.33" +version = "0.1.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", "valuable", @@ -4387,21 +4380,21 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typeid" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e13db2e0ccd5e14a544e8a246ba2312cd25223f616442d7f2cb0e3db614236e" +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 = "typetag" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ba3b6e86ffe0054b2c44f2d86407388b933b16cb0a70eea3929420db1d9bbe" +checksum = "be2212c8a9b9bcfca32024de14998494cf9a5dfa59ea1b829de98bac374b86bf" dependencies = [ "erased-serde", "inventory", @@ -4412,47 +4405,41 @@ dependencies = [ [[package]] name = "typetag-impl" -version = "0.2.18" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70b20a22c42c8f1cd23ce5e34f165d4d37038f5b663ad20fb6adbdf029172483" +checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[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.14" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" +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" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" - -[[package]] -name = "unicode-segmentation" -version = "1.12.0" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" [[package]] name = "unicode-xid" @@ -4484,21 +4471,16 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.4" +version = "2.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - [[package]] name = "utf8_iter" version = "1.0.4" @@ -4513,11 +4495,11 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.0" +version = "1.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f33196643e165781c20a5ead5582283a7dacbb87855d867fbc2df3f81eddc1be" +checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" dependencies = [ - "getrandom 0.3.3", + "getrandom 0.3.4", "js-sys", "serde", "wasm-bindgen", @@ -4525,9 +4507,9 @@ dependencies = [ [[package]] name = "valuable" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" [[package]] name = "vcpkg" @@ -4562,17 +4544,17 @@ 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 = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" +name = "wasip2" +version = "1.0.1+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" dependencies = [ - "wit-bindgen-rt", + "wit-bindgen", ] [[package]] @@ -4583,47 +4565,35 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn 2.0.104", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4631,22 +4601,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.104", - "wasm-bindgen-backend", + "syn 2.0.110", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.100" +version = "0.2.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" dependencies = [ "unicode-ident", ] @@ -4668,9 +4638,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -4707,20 +4677,29 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.26.7" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.4", +] + +[[package]] +name = "webpki-roots" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d642ff16b7e79272ae451b7322067cdc17cadf68c23264be9d94a32319efe7e" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" dependencies = [ "rustls-pki-types", ] [[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 0.5.7", + "libredox", "wasite", ] @@ -4742,11 +4721,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]] @@ -4757,47 +4736,61 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.52.0" +version = "0.62.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "windows-targets 0.52.6", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] -name = "windows-link" -version = "0.1.1" +name = "windows-implement" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.110", +] [[package]] -name = "windows-registry" -version = "0.2.0" +name = "windows-interface" +version = "0.59.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ - "windows-result", - "windows-strings", - "windows-targets 0.52.6", + "proc-macro2", + "quote", + "syn 2.0.110", ] +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-result" -version = "0.2.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.1.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "windows-result", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -4820,11 +4813,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", ] [[package]] @@ -4851,13 +4853,30 @@ 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", + "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_aarch64_gnullvm" version = "0.48.5" @@ -4870,6 +4889,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" @@ -4882,6 +4907,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" @@ -4894,12 +4925,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" @@ -4912,6 +4955,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" @@ -4924,6 +4973,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" @@ -4936,6 +4991,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" @@ -4949,34 +5010,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] -name = "winnow" -version = "0.6.20" +name = "windows_x86_64_msvc" +version = "0.53.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" -dependencies = [ - "memchr", -] +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] -name = "wit-bindgen-rt" -version = "0.39.0" +name = "winnow" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ - "bitflags 2.6.0", + "memchr", ] [[package]] -name = "write16" -version = "1.0.0" +name = "wit-bindgen" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" +checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" [[package]] name = "writeable" -version = "0.5.5" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" [[package]] name = "wyz" @@ -4989,11 +5047,10 @@ dependencies = [ [[package]] name = "yoke" -version = "0.7.5" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" dependencies = [ - "serde", "stable_deref_trait", "yoke-derive", "zerofrom", @@ -5001,69 +5058,79 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.7.5" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", "synstructure", ] [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] [[package]] name = "zerofrom" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" dependencies = [ "zerofrom-derive", ] [[package]] name = "zerofrom-derive" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", "synstructure", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] [[package]] name = "zerovec" -version = "0.10.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" dependencies = [ "yoke", "zerofrom", @@ -5072,11 +5139,11 @@ dependencies = [ [[package]] name = "zerovec-derive" -version = "0.10.3" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn 2.0.110", ] diff --git a/Cargo.toml b/Cargo.toml index ef78f03e..1023e2ee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "0.11.5", features = ["otel"] } +sqlx-ledger = { version = "0.11.8", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" @@ -76,7 +76,7 @@ tonic_lnd = { version = "0.2.0", package = "fedimint-tonic-lnd", features = [ ] } [dev-dependencies] -serial_test = "*" +serial_test = "3.2.0" [build-dependencies] protobuf-src = { version = "1.1.0" } diff --git a/bats/payout.bats b/bats/payout.bats index fa5a8cc5..b0e60fd0 100644 --- a/bats/payout.bats +++ b/bats/payout.bats @@ -404,3 +404,170 @@ teardown_file() { [[ "${fee_rate}" =~ ^[0-9]+(\.[0-9]+)?$ ]] || exit 1 [[ "$(echo "${fee_rate} > 0" | bc -l)" -eq 1 ]] || exit 1 } + +@test "payout: Can sync transaction with 120+ inputs without payload error" { + bitcoin_cli -generate 6 + + bitcoind_signer_address=$(bitcoin_signer_cli getnewaddress) + if [ -z "$bitcoind_signer_address" ]; then + echo "Failed to get a new address" + exit 1 + fi + + echo "Creating 130 UTXOs..." + for i in {1..130}; do + bitcoin_cli -regtest sendtoaddress ${bitcoind_signer_address} 0.01 + done + + for i in {1..60}; do + n_utxos=$(bria_cmd list-utxos -w default | jq '.keychains[0].utxos | length') + echo "Detected UTXOs: ${n_utxos}" + [[ "${n_utxos}" -ge "130" ]] && break + sleep 1 + done + n_utxos=$(bria_cmd list-utxos -w default | jq '.keychains[0].utxos | length') + [[ "${n_utxos}" -ge "130" ]] || exit 1 + + bitcoin_cli -generate 6 + + for i in {1..60}; do + cache_wallet_balance + settled=$(cached_current_settled) + echo "Settled balance: ${settled}" + [[ "${settled}" -ge "130000000" ]] && break + sleep 1 + done + [[ $(cached_current_settled) -ge "130000000" ]] || exit 1 + + echo "Creating transaction with 130+ inputs..." + bitcoind_address=$(bitcoin_cli -regtest getnewaddress) + bitcoin_signer_cli -named sendall recipients="[\"${bitcoind_address}\"]" fee_rate=1 + + echo "Waiting for spend to be detected..." + for i in {1..60}; do + cache_wallet_balance + pending=$(cached_pending_outgoing) + echo "Pending outgoing: ${pending}" + [[ "${pending}" != "0" ]] && break + sleep 1 + done + + cache_wallet_balance + echo "Pending outgoing after detection: $(cached_pending_outgoing)" + [[ $(cached_pending_outgoing) != "0" ]] || exit 1 + [[ $(cached_current_settled) == "0" ]] || exit 1 + + echo "Confirming the spending transaction..." + bitcoin_cli -generate 6 + + echo "Waiting for spend to be settled..." + for i in {1..60}; do + cache_wallet_balance + pending=$(cached_pending_outgoing) + echo "Pending outgoing: ${pending}" + [[ "${pending}" == "0" ]] && break + sleep 1 + done + [[ $(cached_pending_outgoing) == "0" ]] || exit 1 + + cache_wallet_balance + settled=$(cached_current_settled) + echo "Final settled balance: ${settled}" + [[ "${settled}" == "0" ]] || exit 1 +} + +@test "payout: Can create payout batch with 120+ inputs without payload error" { + bria_cmd set-signer-config \ + --xpub "68bfb290" bitcoind \ + --endpoint "${BITCOIND_SIGNER_ENDPOINT}" \ + --rpc-user "rpcuser" \ + --rpc-password "rpcpassword" + + bria_cmd create-payout-queue --name large-tx-queue --interval-trigger 5 + + bria_address=$(bria_cmd new-address -w default | jq -r '.address') + if [ -z "$bria_address" ]; then + echo "Failed to get a new address" + exit 1 + fi + + echo "Creating 130 UTXOs for payout test..." + for i in {1..130}; do + bitcoin_cli -regtest sendtoaddress ${bria_address} 0.01 + done + + for i in {1..60}; do + n_utxos=$(bria_cmd list-utxos -w default | jq '.keychains[0].utxos | length') + echo "Detected UTXOs: ${n_utxos}" + [[ "${n_utxos}" == "130" ]] && break + sleep 1 + done + n_utxos=$(bria_cmd list-utxos -w default | jq '.keychains[0].utxos | length') + [[ "${n_utxos}" == "130" ]] || exit 1 + + bitcoin_cli -generate 6 + + for i in {1..60}; do + cache_wallet_balance + settled=$(cached_current_settled) + echo "Settled balance: ${settled}" + [[ "${settled}" == "130000000" ]] && break + sleep 1 + done + [[ $(cached_current_settled) == "130000000" ]] || exit 1 + + echo "Submitting payout that will use 130 inputs..." + destination="bcrt1q208tuy5rd3kvy8xdpv6yrczg7f3mnlk3lql7ej" + payout_id=$(bria_cmd submit-payout -w default --queue-name large-tx-queue --destination ${destination} --amount 125000000 | jq -r '.id') + + for i in {1..30}; do + cache_wallet_balance + encumbered=$(cached_encumbered_outgoing) + echo "Encumbered outgoing: ${encumbered}" + [[ "${encumbered}" == "125000000" ]] && break + sleep 1 + done + [[ $(cached_encumbered_outgoing) == "125000000" ]] || exit 1 + + echo "Waiting for batch creation and broadcast..." + for i in {1..60}; do + batch_id=$(bria_cmd get-payout --id ${payout_id} | jq -r '.payout.batchId') + echo "Batch ID: ${batch_id}" + [[ "${batch_id}" != "null" ]] && break + sleep 1 + done + batch_id=$(bria_cmd get-payout --id ${payout_id} | jq -r '.payout.batchId') + [[ "${batch_id}" != "null" ]] || exit 1 + + echo "Waiting for spend to be detected..." + for i in {1..60}; do + cache_wallet_balance + pending=$(cached_pending_outgoing) + echo "Pending outgoing: ${pending}" + [[ "${pending}" != "0" ]] && break + sleep 1 + done + + cache_wallet_balance + echo "Pending outgoing after batch broadcast: $(cached_pending_outgoing)" + [[ $(cached_pending_outgoing) == "125000000" ]] || exit 1 + [[ $(cached_encumbered_outgoing) == "0" ]] || exit 1 + + echo "Confirming the batch transaction..." + bitcoin_cli -generate 6 + + echo "Waiting for batch to be settled..." + for i in {1..60}; do + cache_wallet_balance + pending=$(cached_pending_outgoing) + echo "Pending outgoing: ${pending}" + [[ "${pending}" == "0" ]] && break + sleep 1 + done + [[ $(cached_pending_outgoing) == "0" ]] || exit 1 + + cache_wallet_balance + settled=$(cached_current_settled) + echo "Final settled balance: ${settled}" + [[ "${settled}" -gt "0" && "${settled}" -le "5000000" ]] || exit 1 +} diff --git a/migrations/20251116204609_fix_ledger_notify_payload_size.down.sql b/migrations/20251116204609_fix_ledger_notify_payload_size.down.sql new file mode 100644 index 00000000..61ddd0e0 --- /dev/null +++ b/migrations/20251116204609_fix_ledger_notify_payload_size.down.sql @@ -0,0 +1,12 @@ +-- Restore original notify function that sends full row +-- Note: This will reintroduce the payload size issue for large transactions + +CREATE OR REPLACE FUNCTION notify_sqlx_ledger_events() RETURNS TRIGGER AS $$ +DECLARE + payload TEXT; +BEGIN + payload := row_to_json(NEW); + PERFORM pg_notify('sqlx_ledger_events', payload); + RETURN NULL; +END; +$$ LANGUAGE plpgsql; diff --git a/migrations/20251116204609_fix_ledger_notify_payload_size.up.sql b/migrations/20251116204609_fix_ledger_notify_payload_size.up.sql new file mode 100644 index 00000000..d6d4495a --- /dev/null +++ b/migrations/20251116204609_fix_ledger_notify_payload_size.up.sql @@ -0,0 +1,22 @@ +-- Fix pg_notify payload size issue by sending only essential data +-- instead of the full row, which can exceed 8KB limit with large transactions + +CREATE OR REPLACE FUNCTION notify_sqlx_ledger_events() RETURNS TRIGGER AS $$ +DECLARE + payload TEXT; +BEGIN + payload := row_to_json(NEW)::text; + + -- If payload exceeds pg_notify's 8KB limit send minimal payload + IF octet_length(payload) > 8000 THEN + payload := json_build_object( + 'id', NEW.id, + 'type', NEW.type, + 'recorded_at', NEW.recorded_at + )::text; + END IF; + + PERFORM pg_notify('sqlx_ledger_events', payload); + RETURN NULL; +END; +$$ LANGUAGE plpgsql; diff --git a/src/bdk/pg/script_pubkeys.rs b/src/bdk/pg/script_pubkeys.rs index 75c9ec69..18f11085 100644 --- a/src/bdk/pg/script_pubkeys.rs +++ b/src/bdk/pg/script_pubkeys.rs @@ -93,6 +93,28 @@ impl ScriptPubkeys { Ok(ret) } + #[allow(dead_code)] + #[instrument(name = "bdk.script_pubkeys.find_path", skip_all)] + pub async fn find_path( + &self, + script: &ScriptBuf, + ) -> Result, bdk::Error> { + let rows = sqlx::query!( + r#"SELECT keychain_kind as "keychain_kind: BdkKeychainKind", path FROM bdk_script_pubkeys + WHERE keychain_id = $1 AND script_hex = ENCODE($2, 'hex')"#, + Uuid::from(self.keychain_id), + script.as_bytes(), + ) + .fetch_all(&self.pool) + .await + .map_err(|e| bdk::Error::Generic(e.to_string()))?; + if let Some(row) = rows.into_iter().next() { + Ok(Some((row.keychain_kind, row.path as u32))) + } else { + Ok(None) + } + } + #[instrument(name = "bdk.script_pubkeys.list_scripts", skip_all)] pub async fn list_scripts( &self, diff --git a/src/bdk/pg/transactions.rs b/src/bdk/pg/transactions.rs index d771bc2c..8c8af205 100644 --- a/src/bdk/pg/transactions.rs +++ b/src/bdk/pg/transactions.rs @@ -86,6 +86,21 @@ impl Transactions { })) } + #[allow(dead_code)] + #[instrument(name = "bdk.transactions.find_by_id", skip_all)] + pub async fn find_by_id(&self, tx_id: &Txid) -> Result, bdk::Error> { + let tx = sqlx::query!( + r#" + SELECT details_json FROM bdk_transactions WHERE keychain_id = $1 AND tx_id = $2 AND deleted_at IS NULL"#, + self.keychain_id as KeychainId, + tx_id.to_string(), + ) + .fetch_optional(&self.pool) + .await + .map_err(|e| bdk::Error::Generic(e.to_string()))?; + Ok(tx.map(|tx| serde_json::from_value(tx.details_json).unwrap())) + } + #[instrument(name = "bdk.transactions.load_all", skip(self), fields(n_rows))] pub async fn load_all(&self) -> Result, bdk::Error> { let txs = sqlx::query!( diff --git a/src/tracing.rs b/src/tracing.rs index e207fa8d..146c54c7 100644 --- a/src/tracing.rs +++ b/src/tracing.rs @@ -1,7 +1,7 @@ use opentelemetry::trace::TracerProvider as _; use opentelemetry::{propagation::TextMapPropagator, KeyValue}; use opentelemetry_otlp::WithExportConfig; -use opentelemetry_sdk::trace::{Config, Sampler, TracerProvider}; +use opentelemetry_sdk::trace::{Sampler, TracerProvider}; use opentelemetry_sdk::{propagation::TraceContextPropagator, Resource}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -40,16 +40,13 @@ pub fn init_tracer(config: TracingConfig) -> anyhow::Result<()> { .with_endpoint(tracing_endpoint) .build()?; - let provider_config = Config::default() + let provider = TracerProvider::builder() + .with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio) .with_sampler(Sampler::AlwaysOn) .with_resource(Resource::new(vec![KeyValue::new( "service.name", service_name.clone(), - )])); - - let provider = TracerProvider::builder() - .with_batch_exporter(exporter, opentelemetry_sdk::runtime::Tokio) - .with_config(provider_config) + )])) .build(); let tracer = provider.tracer(service_name); From a562ddcb14ac03326e1e172267db80a5d41ad89d Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 17 Nov 2025 11:52:28 -0500 Subject: [PATCH 47/65] chore: bump sqlx-ledger (#11) --- Cargo.lock | 12 ++++++------ Cargo.toml | 2 +- flake.lock | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5bab23a2..81007481 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3531,9 +3531,9 @@ dependencies = [ [[package]] name = "sqlx-ledger" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "110d199a8c6a0d58ea4635505ec31733990d3534d9602fdfddf48288cfbbecc9" +checksum = "8055e5304734dd410911c945466c51eaaa1709a1776a88c41ed94aa700714b83" dependencies = [ "cached", "chrono", @@ -3554,9 +3554,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-interpreter" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c716b8648ded88e00f67be157cf0dc5e1deb45b29ae212845fcc40dda1d744fd" +checksum = "464479a4cb7ea75ac597de6fb2b6e3c61d4088c143af72c5fc7938d47758c783" dependencies = [ "chrono", "rust_decimal", @@ -3569,9 +3569,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-parser" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a500391deb97fe82076b33d3bbbf5579c1bbdea67c63703afbdf55d41d24e015" +checksum = "fd2f41ea7a1126442153a4b516ff7cf5a1b5788f416c687fe4930c39efd78d5a" dependencies = [ "lalrpop", "lalrpop-util", diff --git a/Cargo.toml b/Cargo.toml index 1023e2ee..0ca51cdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "0.11.8", features = ["otel"] } +sqlx-ledger = { version = "0.11.9", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" diff --git a/flake.lock b/flake.lock index 528c5a61..3de9f99f 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1753250450, - "narHash": "sha256-i+CQV2rPmP8wHxj0aq4siYyohHwVlsh40kV89f3nw1s=", + "lastModified": 1763283776, + "narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fc02ee70efb805d3b2865908a13ddd4474557ecf", + "rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a", "type": "github" }, "original": { @@ -48,11 +48,11 @@ ] }, "locked": { - "lastModified": 1753325142, - "narHash": "sha256-7A8epLZ/LW9tek4OJY4IHesH7BgfBKr3aEm9JjUwqQo=", + "lastModified": 1763347184, + "narHash": "sha256-6QH8hpCYJxifvyHEYg+Da0BotUn03BwLIvYo3JAxuqQ=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "cf608fb54d8854f31d7f7c499e2d2c928af48036", + "rev": "08895cce80433978d5bfd668efa41c5e24578cbd", "type": "github" }, "original": { From 253b2dbd112d20ed0d90e544aadb6d76e6aa7cca Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 17 Nov 2025 19:20:34 -0500 Subject: [PATCH 48/65] fix: close db connection on loop exit (#13) --- src/outbox/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/outbox/mod.rs b/src/outbox/mod.rs index e0a37f48..fbb08f85 100644 --- a/src/outbox/mod.rs +++ b/src/outbox/mod.rs @@ -180,6 +180,7 @@ impl Outbox { } } } + let _ = listener.unlisten("bria_outbox_events").await; }); Ok(()) } From bfd8aed39bd63de7e4c007daf55f6806c40acbba Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 17 Nov 2025 19:20:45 -0500 Subject: [PATCH 49/65] chore: rollback sqlx-ledger to 0.11.7 (#12) --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 81007481..ae0e9fd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -687,9 +687,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c26d721170e0295f191a69bd9a1f93efcdb0aff38684b61ab5750468972e5f5" +checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8" dependencies = [ "clap_builder", "clap_derive", @@ -697,9 +697,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.51" +version = "4.5.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75835f0c7bf681bfd05abe44e965760fea999a5286c6eb2d59883634fd02011a" +checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1" dependencies = [ "anstream", "anstyle", diff --git a/Cargo.toml b/Cargo.toml index 0ca51cdd..587a7add 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "0.11.9", features = ["otel"] } +sqlx-ledger = { version = "0.11.7", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" From 82494d25e98172e8fb67f581dbfef2a75109e99a Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 18 Nov 2025 00:02:36 -0500 Subject: [PATCH 50/65] chore: set fixed version of sqlx ledger (#15) --- Cargo.lock | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 2 +- 2 files changed, 106 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae0e9fd2..d2084ee9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -440,6 +440,15 @@ dependencies = [ "serde_core", ] +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "bitvec" version = "1.0.1" @@ -486,7 +495,7 @@ dependencies = [ [[package]] name = "bria" -version = "0.1.116-dev" +version = "0.1.114" dependencies = [ "anyhow", "async-trait", @@ -498,6 +507,7 @@ dependencies = [ "clap", "derive_builder", "electrum-client", + "es-entity", "fedimint-tonic-lnd", "futures", "hex", @@ -746,6 +756,15 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "convert_case" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baaaa0ecca5b51987b9423ccdc971514dd8b0bb7b4060b983d3664dad3f1f89f" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -1047,6 +1066,39 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "es-entity" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9b69f9008c88168f4200e4b53a5a24030ca263cc26e1b035e0002b5002e971" +dependencies = [ + "chrono", + "derive_builder", + "es-entity-macros", + "im", + "pin-project", + "serde", + "serde_json", + "sqlx", + "thiserror 2.0.17", + "uuid", +] + +[[package]] +name = "es-entity-macros" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e360d04783bba4161e1d11040bdad40f4cfd4c3caf7129b50a2b5b5faa0afbf" +dependencies = [ + "convert_case", + "darling 0.21.3", + "pluralizer", + "proc-macro2", + "quote", + "regex", + "syn 2.0.110", +] + [[package]] name = "etcetera" version = "0.8.0" @@ -1768,6 +1820,21 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "im" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0acd33ff0285af998aaf9b57342af478078f53492322fafc47450e09397e0e9" +dependencies = [ + "bitmaps", + "rand_core 0.6.4", + "rand_xoshiro", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -2398,6 +2465,16 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +[[package]] +name = "pluralizer" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b3eba432a00a1f6c16f39147847a870e94e2e9b992759b503e330efec778cbe" +dependencies = [ + "once_cell", + "regex", +] + [[package]] name = "poly1305" version = "0.8.0" @@ -2754,6 +2831,15 @@ dependencies = [ "getrandom 0.3.4", ] +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core 0.6.4", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -3407,6 +3493,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.11" @@ -3531,9 +3627,9 @@ dependencies = [ [[package]] name = "sqlx-ledger" -version = "0.11.9" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8055e5304734dd410911c945466c51eaaa1709a1776a88c41ed94aa700714b83" +checksum = "4b55749bfcf4a9619c3edda9530a431b43295494e0fb2a4bf2a37e628630ba0a" dependencies = [ "cached", "chrono", @@ -4441,6 +4537,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/Cargo.toml b/Cargo.toml index 587a7add..9d90c225 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "0.11.7", features = ["otel"] } +sqlx-ledger = { version = "=0.11.7", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" From 687bda0c0f298ab69ded4e9ce4738eff11f0408d Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 18 Nov 2025 02:42:32 -0500 Subject: [PATCH 51/65] fix: update journal_events to handle stream close properly (#16) --- src/ledger/mod.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index 66864cce..5657f38c 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -73,18 +73,21 @@ impl Ledger { journal_id: JournalId, last_ledger_id: Option, ) -> Result>, LedgerError> { - let stream = BroadcastStream::new( - self.inner - .events(EventSubscriberOpts { - buffer: 100, - close_on_lag: true, - after_id: Some(last_ledger_id.unwrap_or(SqlxLedgerEventId::BEGIN)), - }) - .await? - .journal(journal_id) - .await?, - ); - Ok(stream.filter_map(|event| { + let subscriber = self + .inner + .events(EventSubscriberOpts { + buffer: 100, + close_on_lag: true, + after_id: Some(last_ledger_id.unwrap_or(SqlxLedgerEventId::BEGIN)), + }) + .await?; + + let journal_stream = subscriber.journal(journal_id).await?; + let stream = BroadcastStream::new(journal_stream); + + let stream = stream.filter_map(move |event| { + // Keep subscriber alive by moving it into the closure + let _subscriber = &subscriber; match event .map_err(LedgerError::from) .and_then(MaybeIgnored::try_from) @@ -93,7 +96,9 @@ impl Ledger { Ok(MaybeIgnored::Event(e)) => Some(Ok(e)), Err(e) => Some(Err(e)), } - })) + }); + + Ok(stream) } #[instrument(name = "ledger.utxo_detected", skip(self, tx))] From 83103393006bf11275edbed087d0ed52031d90d0 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Tue, 18 Nov 2025 14:08:41 +0100 Subject: [PATCH 52/65] chore: update sqlx-ledger to 0.11.9 (#19) --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d2084ee9..e3a6981d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3627,9 +3627,9 @@ dependencies = [ [[package]] name = "sqlx-ledger" -version = "0.11.7" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55749bfcf4a9619c3edda9530a431b43295494e0fb2a4bf2a37e628630ba0a" +checksum = "8055e5304734dd410911c945466c51eaaa1709a1776a88c41ed94aa700714b83" dependencies = [ "cached", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 9d90c225..f62668c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "=0.11.7", features = ["otel"] } +sqlx-ledger = { version = "=0.11.9", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" From cf7b68ec81ea74c11c06ce0681cdbaf162a193ff Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Tue, 18 Nov 2025 17:37:37 -0500 Subject: [PATCH 53/65] chore: bump sqlx-ledger 0.11.11 (#20) * chore: bump sqlx-ledger 0.11.10 * fix: lint issues * fix: sqlx lint issues * chore: bump sqlx-ledger to 0.11.11 --- Cargo.lock | 13 +++++++------ Cargo.toml | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3a6981d..a400c880 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3627,13 +3627,14 @@ dependencies = [ [[package]] name = "sqlx-ledger" -version = "0.11.9" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8055e5304734dd410911c945466c51eaaa1709a1776a88c41ed94aa700714b83" +checksum = "b014aabf8db12aebb6f4a8eefefc02a3b5f07d6c9ce0fa5bcef6aa6d13ca15c9" dependencies = [ "cached", "chrono", "derive_builder", + "futures", "opentelemetry", "rust_decimal", "rusty-money", @@ -3650,9 +3651,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-interpreter" -version = "0.11.9" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "464479a4cb7ea75ac597de6fb2b6e3c61d4088c143af72c5fc7938d47758c783" +checksum = "e6df27e549d73e8e291ec3abafd7e0dcc1b10e00b9a56ab9b395482a8551c909" dependencies = [ "chrono", "rust_decimal", @@ -3665,9 +3666,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-parser" -version = "0.11.9" +version = "0.11.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd2f41ea7a1126442153a4b516ff7cf5a1b5788f416c687fe4930c39efd78d5a" +checksum = "4f7a4c2f9eb8b8bd3b789cc67a764116438c53a4d91993faeb64b674cf62e69f" dependencies = [ "lalrpop", "lalrpop-util", diff --git a/Cargo.toml b/Cargo.toml index f62668c6..719cc698 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "=0.11.9", features = ["otel"] } +sqlx-ledger = { version = "=0.11.11", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" From 127df012af3ca4402ffb86262ca2c26592f38353 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Thu, 20 Nov 2025 16:38:55 +0100 Subject: [PATCH 54/65] fix: pin sqlx version to =0.8.2 (#21) --- Cargo.lock | 122 +++++++++++++++++++++++++++++++++++------------------ Cargo.toml | 2 +- 2 files changed, 81 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a400c880..f2b6391a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1139,7 +1139,7 @@ dependencies = [ "hyper-rustls 0.24.2", "prost 0.12.6", "rustls 0.21.12", - "rustls-pemfile", + "rustls-pemfile 1.0.4", "tokio", "tokio-stream", "tonic 0.10.2", @@ -1182,12 +1182,6 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foldhash" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" - [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1422,17 +1416,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hashbrown" -version = "0.15.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" -dependencies = [ - "allocator-api2", - "equivalent", - "foldhash", -] - [[package]] name = "hashbrown" version = "0.16.0" @@ -1441,11 +1424,11 @@ checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "hashlink" -version = "0.10.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" dependencies = [ - "hashbrown 0.15.5", + "hashbrown 0.14.5", ] [[package]] @@ -2034,6 +2017,7 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ + "cc", "pkg-config", "vcpkg", ] @@ -2108,6 +2092,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniscript" version = "10.2.3" @@ -2142,6 +2132,16 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "nu-ansi-term" version = "0.50.3" @@ -2356,6 +2356,12 @@ dependencies = [ "windows-link", ] +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + [[package]] name = "pem-rfc7468" version = "0.7.0" @@ -3147,6 +3153,15 @@ dependencies = [ "base64 0.21.7", ] +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "rustls-pki-types" version = "1.13.0" @@ -3573,11 +3588,21 @@ 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.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fefb893899429669dcdd979aff487bd78f4064e5e7907e4269081e0ef7d97dc" +checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" dependencies = [ "sqlx-core", "sqlx-macros", @@ -3588,35 +3613,41 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee6798b1838b6a0f69c007c133b8df5866302197e404e8b6ee8ed3e3a5e68dc6" +checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" dependencies = [ - "base64 0.22.1", + "atoi", + "byteorder", "bytes", "chrono", "crc", "crossbeam-queue", "either", "event-listener", + "futures-channel", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.15.5", + "hashbrown 0.14.5", "hashlink", + "hex", "indexmap 2.12.0", "log", "memchr", "once_cell", + "paste", "percent-encoding", "rust_decimal", "rustls 0.23.35", + "rustls-pemfile 2.2.0", "serde", "serde_json", "sha2", "smallvec", - "thiserror 2.0.17", + "sqlformat", + "thiserror 1.0.69", "tokio", "tokio-stream", "tracing", @@ -3676,9 +3707,9 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d452988ccaacfbf5e0bdbc348fb91d7c8af5bee192173ac3636b5fb6e6715d" +checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" dependencies = [ "proc-macro2", "quote", @@ -3689,9 +3720,9 @@ dependencies = [ [[package]] name = "sqlx-macros-core" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a9c1841124ac5a61741f96e1d9e2ec77424bf323962dd894bdb93f37d5219b" +checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" dependencies = [ "dotenvy", "either", @@ -3708,15 +3739,16 @@ dependencies = [ "sqlx-postgres", "sqlx-sqlite", "syn 2.0.110", + "tempfile", "tokio", "url", ] [[package]] name = "sqlx-mysql" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa003f0038df784eb8fecbbac13affe3da23b45194bd57dba231c8f48199c526" +checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" dependencies = [ "atoi", "base64 0.22.1", @@ -3751,7 +3783,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.17", + "thiserror 1.0.69", "tracing", "uuid", "whoami", @@ -3759,9 +3791,9 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db58fcd5a53cf07c184b154801ff91347e4c30d17a3562a635ff028ad5deda46" +checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" dependencies = [ "atoi", "base64 0.22.1", @@ -3773,6 +3805,7 @@ dependencies = [ "etcetera", "futures-channel", "futures-core", + "futures-io", "futures-util", "hex", "hkdf", @@ -3791,7 +3824,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 2.0.17", + "thiserror 1.0.69", "tracing", "uuid", "whoami", @@ -3799,9 +3832,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.8.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2d12fe70b2c1b4401038055f90f151b78208de1f9f89a7dbfd41587a10c3eea" +checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" dependencies = [ "atoi", "chrono", @@ -3817,7 +3850,6 @@ dependencies = [ "serde", "serde_urlencoded", "sqlx-core", - "thiserror 2.0.17", "tracing", "url", "uuid", @@ -4205,7 +4237,7 @@ dependencies = [ "pin-project", "prost 0.12.6", "rustls 0.21.12", - "rustls-pemfile", + "rustls-pemfile 1.0.4", "tokio", "tokio-rustls 0.24.1", "tokio-stream", @@ -4550,6 +4582,12 @@ 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" diff --git a/Cargo.toml b/Cargo.toml index 719cc698..6f6bca8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ derive_builder = "0.20.0" serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.117" serde_yaml = "0.9.32" -sqlx = { version = "0.8.3", features = [ +sqlx = { version = "=0.8.2", features = [ "runtime-tokio-rustls", "postgres", "rust_decimal", From 23ca5eb22e067ee577b594644be87eda0cd47c74 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Tue, 25 Nov 2025 17:34:23 +0100 Subject: [PATCH 55/65] fix: nix config on darwin (#18) * fix: nix config on darwin * fix: suppress warning * docs: better link --------- Co-authored-by: k9ert <117085+k9ert@users.noreply.github.com> --- flake.lock | 8 ++++---- flake.nix | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/flake.lock b/flake.lock index 3de9f99f..237ae911 100644 --- a/flake.lock +++ b/flake.lock @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1763283776, - "narHash": "sha256-Y7TDFPK4GlqrKrivOcsHG8xSGqQx3A6c+i7novT85Uk=", + "lastModified": 1763375004, + "narHash": "sha256-e81Xfa7xhRZfqGB4s3xEvrg4p1v+fToM6CIQlXUyaX0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "50a96edd8d0db6cc8db57dab6bb6d6ee1f3dc49a", + "rev": "8b6600824693a9c706ef09bd86711ca393703466", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixpkgs-unstable", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index f0cb8d62..7135843b 100644 --- a/flake.nix +++ b/flake.nix @@ -2,7 +2,7 @@ description = "Bria"; inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-utils.url = "github:numtide/flake-utils"; rust-overlay = { url = "github:oxalica/rust-overlay"; @@ -31,9 +31,6 @@ [ rustToolchain protobuf - ] - ++ lib.optionals pkgs.stdenv.isDarwin [ - darwin.apple_sdk.frameworks.SystemConfiguration ]; devEnvVars = rec { PGDATABASE = "pg"; @@ -63,6 +60,11 @@ podman-compose bc ]; + shellHook = '' + # Workaround for nixpkgs xcrun warnings on Darwin + # See: https://github.com/NixOS/nixpkgs/issues/376958 + unset DEVELOPER_DIR + ''; }); formatter = alejandra; From c8f18349fd99f10919524c2748d4670c94cc7c26 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Sun, 15 Feb 2026 23:03:55 -0500 Subject: [PATCH 56/65] revert: "fix: update journal_events to handle stream close properly" (#24) * Revert "fix: update journal_events to handle stream close properly (#16)" This reverts commit 073595c1fa45c73172bfb48d5717517347595beb. * fix: check-code issues --- Cargo.lock | 30 +++++++++++++++--------------- flake.lock | 12 ++++++------ src/batch/repo.rs | 8 ++++---- src/ledger/mod.rs | 31 +++++++++++++------------------ 4 files changed, 38 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f2b6391a..8ecf581b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -584,9 +584,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cached" @@ -2169,9 +2169,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" [[package]] name = "num-integer" @@ -3026,9 +3026,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.45" +version = "0.7.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" +checksum = "2297bf9c81a3f0dc96bc9521370b88f054168c29826a75e89c55ff196e7ed6a1" dependencies = [ "bitvec", "bytecheck", @@ -3044,9 +3044,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.45" +version = "0.7.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" +checksum = "84d7b42d4b8d06048d3ac8db0eb31bcb942cbeb709f0b5f2b2ebde398d3038f5" dependencies = [ "proc-macro2", "quote", @@ -4050,30 +4050,30 @@ dependencies = [ [[package]] name = "time" -version = "0.3.44" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "itoa", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", "time-macros", ] [[package]] name = "time-core" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "time-macros" -version = "0.2.24" +version = "0.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" dependencies = [ "num-conv", "time-core", diff --git a/flake.lock b/flake.lock index 237ae911..07a70e5d 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1763375004, - "narHash": "sha256-e81Xfa7xhRZfqGB4s3xEvrg4p1v+fToM6CIQlXUyaX0=", + "lastModified": 1771147098, + "narHash": "sha256-jpfPdBjKO232s5NueoNEvvVzpndiUzPLNYcH4/Ov0gY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8b6600824693a9c706ef09bd86711ca393703466", + "rev": "e3cb16bccd9facebae3ba29c6a76a4cc1b73462a", "type": "github" }, "original": { @@ -48,11 +48,11 @@ ] }, "locked": { - "lastModified": 1763347184, - "narHash": "sha256-6QH8hpCYJxifvyHEYg+Da0BotUn03BwLIvYo3JAxuqQ=", + "lastModified": 1771211437, + "narHash": "sha256-lcNK438i4DGtyA+bPXXyVLHVmJjYpVKmpux9WASa3ro=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "08895cce80433978d5bfd668efa41c5e24578cbd", + "rev": "c62195b3d6e1bb11e0c2fb2a494117d3b55d410f", "type": "github" }, "original": { diff --git a/src/batch/repo.rs b/src/batch/repo.rs index dcaf667d..16d735d7 100644 --- a/src/batch/repo.rs +++ b/src/batch/repo.rs @@ -242,7 +242,7 @@ impl Batches { let created_ledger_tx_id = LedgerTxId::from(row.batch_created_ledger_tx_id.unwrap()); let batch_id = BatchId::from(row.id); let payout_queue_id = PayoutQueueId::from(row.payout_queue_id); - if row.ledger_id.is_some() { + if let Some(ledger_id) = row.ledger_id { return Ok(Some(( tx, BatchInfo { @@ -250,7 +250,7 @@ impl Batches { payout_queue_id, created_ledger_tx_id, }, - LedgerTxId::from(row.ledger_id.unwrap()), + LedgerTxId::from(ledger_id), ))); } let ledger_transaction_id = LedgerTxId::new(); @@ -304,7 +304,7 @@ impl Batches { let created_ledger_tx_id = LedgerTxId::from(row.batch_created_ledger_tx_id.unwrap()); let batch_id = BatchId::from(row.id); let payout_queue_id = PayoutQueueId::from(row.payout_queue_id); - if row.ledger_id.is_some() { + if let Some(ledger_id) = row.ledger_id { return Ok(Some(( tx, BatchInfo { @@ -312,7 +312,7 @@ impl Batches { payout_queue_id, created_ledger_tx_id, }, - LedgerTxId::from(row.ledger_id.unwrap()), + LedgerTxId::from(ledger_id), ))); } let ledger_transaction_id = LedgerTxId::new(); diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index 5657f38c..66864cce 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -73,21 +73,18 @@ impl Ledger { journal_id: JournalId, last_ledger_id: Option, ) -> Result>, LedgerError> { - let subscriber = self - .inner - .events(EventSubscriberOpts { - buffer: 100, - close_on_lag: true, - after_id: Some(last_ledger_id.unwrap_or(SqlxLedgerEventId::BEGIN)), - }) - .await?; - - let journal_stream = subscriber.journal(journal_id).await?; - let stream = BroadcastStream::new(journal_stream); - - let stream = stream.filter_map(move |event| { - // Keep subscriber alive by moving it into the closure - let _subscriber = &subscriber; + let stream = BroadcastStream::new( + self.inner + .events(EventSubscriberOpts { + buffer: 100, + close_on_lag: true, + after_id: Some(last_ledger_id.unwrap_or(SqlxLedgerEventId::BEGIN)), + }) + .await? + .journal(journal_id) + .await?, + ); + Ok(stream.filter_map(|event| { match event .map_err(LedgerError::from) .and_then(MaybeIgnored::try_from) @@ -96,9 +93,7 @@ impl Ledger { Ok(MaybeIgnored::Event(e)) => Some(Ok(e)), Err(e) => Some(Err(e)), } - }); - - Ok(stream) + })) } #[instrument(name = "ledger.utxo_detected", skip(self, tx))] From 510ac280e24611d8345e466847a6db38a59e0f01 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Sun, 15 Feb 2026 23:49:31 -0500 Subject: [PATCH 57/65] chore: bump sqlx-ledger to 0.11.14 (#25) --- Cargo.lock | 21 ++++++++++----------- Cargo.toml | 2 +- src/ledger/mod.rs | 1 + 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8ecf581b..5c14bb3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1665,7 +1665,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.1", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -2611,7 +2611,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.14.0", + "itertools 0.12.1", "proc-macro2", "quote", "syn 2.0.110", @@ -2715,7 +2715,7 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls 0.23.35", - "socket2 0.6.1", + "socket2 0.5.10", "thiserror 2.0.17", "tokio", "tracing", @@ -2752,7 +2752,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.6.1", + "socket2 0.5.10", "tracing", "windows-sys 0.60.2", ] @@ -3658,14 +3658,13 @@ dependencies = [ [[package]] name = "sqlx-ledger" -version = "0.11.11" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b014aabf8db12aebb6f4a8eefefc02a3b5f07d6c9ce0fa5bcef6aa6d13ca15c9" +checksum = "487239d0478466d91b85d2d2dd42b3dd58cbd0e571d1437df1c04040aa5acbef" dependencies = [ "cached", "chrono", "derive_builder", - "futures", "opentelemetry", "rust_decimal", "rusty-money", @@ -3682,9 +3681,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-interpreter" -version = "0.11.11" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6df27e549d73e8e291ec3abafd7e0dcc1b10e00b9a56ab9b395482a8551c909" +checksum = "a141aebaba242351918ab74660774f1925282fbcfc802412cdab2048f7926d24" dependencies = [ "chrono", "rust_decimal", @@ -3697,9 +3696,9 @@ dependencies = [ [[package]] name = "sqlx-ledger-cel-parser" -version = "0.11.11" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f7a4c2f9eb8b8bd3b789cc67a764116438c53a4d91993faeb64b674cf62e69f" +checksum = "a0f97118e65e6cf4b559714d5b8ea987c434e01dcd076a97662d3d7546eecce2" dependencies = [ "lalrpop", "lalrpop-util", diff --git a/Cargo.toml b/Cargo.toml index 6f6bca8b..b53b72e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ fail-on-warnings = [] [dependencies] es-entity = "0.9.0" -sqlx-ledger = { version = "=0.11.11", features = ["otel"] } +sqlx-ledger = { version = "=0.11.14", features = ["otel"] } anyhow = "1.0.82" bitcoincore-rpc = "0.17.0" diff --git a/src/ledger/mod.rs b/src/ledger/mod.rs index 66864cce..2aa934c7 100644 --- a/src/ledger/mod.rs +++ b/src/ledger/mod.rs @@ -79,6 +79,7 @@ impl Ledger { buffer: 100, close_on_lag: true, after_id: Some(last_ledger_id.unwrap_or(SqlxLedgerEventId::BEGIN)), + batch_size: 500, }) .await? .journal(journal_id) From 2aa1484c385a013727860d0d338cd966006b0788 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 18 Feb 2026 08:23:44 -0500 Subject: [PATCH 58/65] chore: update bitcoind and lnd images (#26) * chore: update bitcoind and lnd images * fix(e2e): support LND v0.19+ taproot change addresses in lnd_sync tests --- bats/helpers.bash | 27 ++++++++++++++++++--------- docker-compose.yml | 28 ++++++++++++++-------------- 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/bats/helpers.bash b/bats/helpers.bash index bee1a527..740ab1c8 100644 --- a/bats/helpers.bash +++ b/bats/helpers.bash @@ -103,13 +103,13 @@ bitcoind_init() { bitcoin_cli createwallet "default" || true bitcoin_cli generatetoaddress 200 "$(bitcoin_cli getnewaddress)" - if [[ "${wallet}" == "default" ]]; then + if [[ "${wallet}" == "default" ]]; then bitcoin_signer_cli createwallet "default" || true bitcoin_signer_cli -rpcwallet=default importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_signer_descriptors.json)" elif [[ "${wallet}" == "multisig" ]]; then - bitcoin_signer_cli createwallet "multisig" || true + bitcoin_signer_cli createwallet "multisig" || true bitcoin_signer_cli -rpcwallet=multisig importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_multisig_signer_descriptors.json)" - bitcoin_signer_cli createwallet "multisig2" || true + bitcoin_signer_cli createwallet "multisig2" || true bitcoin_signer_cli -rpcwallet=multisig2 importdescriptors "$(cat ${REPO_ROOT}/bats/bitcoind_multisig2_signer_descriptors.json)" fi } @@ -134,7 +134,7 @@ stop_daemon() { bria_init() { local wallet_type="${1:-default}" - + if [[ "${BRIA_CONFIG}" == "docker" ]]; then retry_cmd="retry 10 1" else @@ -144,14 +144,14 @@ bria_init() { $retry_cmd bria_cmd admin bootstrap bria_cmd admin create-account -n default - + if [[ "${wallet_type}" == "default" ]]; then $retry_cmd bria_cmd create-wallet -n default descriptors -d "wpkh([6f2fa1b2/84'/0'/0']tpubDDDDGYiFda8HfJRc2AHFJDxVzzEtBPrKsbh35EaW2UGd5qfzrF2G87ewAgeeRyHEz4iB3kvhAYW1sH6dpLepTkFUzAktumBN8AXeXWE9nd1/0/*)#l6n08zmr" \ -c "wpkh([6f2fa1b2/84'/0'/0']tpubDDDDGYiFda8HfJRc2AHFJDxVzzEtBPrKsbh35EaW2UGd5qfzrF2G87ewAgeeRyHEz4iB3kvhAYW1sH6dpLepTkFUzAktumBN8AXeXWE9nd1/1/*)#wwkw6htm" elif [[ "${wallet_type}" == "multisig" ]]; then local key1="tpubDEaDfeS1EXpqLVASNCW7qAHW1TFPBpk2Z39gUXjFnsfctomZ7N8iDpy6RuGwqdXAAZ5sr5kQZrxyuEn15tqPJjM4mcPSuXzV27AWRD3p9Q4" local key2="tpubDEPCxBfMFRNdfJaUeoTmepLJ6ZQmeTiU1Sko2sdx1R3tmPpZemRUjdAHqtmLfaVrBg1NBx2Yx3cVrsZ2FTyBuhiH9mPSL5ozkaTh1iZUTZx" - + $retry_cmd bria_cmd import-xpub -x "${key1}" -n key1 -d m/48h/1h/0h/2h bria_cmd import-xpub -x "${key2}" -n key2 -d m/48h/1h/0h/2h bria_cmd create-wallet -n multisig sorted-multisig -x key1 key2 -t 2 @@ -163,13 +163,22 @@ bria_init() { bria_lnd_init() { retry 10 1 bria_cmd admin bootstrap bria_cmd admin create-account -n default - retry 10 1 bria_cmd import-xpub -x tpubDD4vFnWuTMEcZiaaZPgvzeGyMzWe6qHW8gALk5Md9kutDvtdDjYFwzauEFFRHgov8pAwup5jX88j5YFyiACsPf3pqn5hBjvuTLRAseaJ6b4 -n lnd_key -d m/84h/0h/0h - bria_cmd create-wallet -n default wpkh -x lnd_key + + # Create wallet using descriptors to track both external (wpkh) and change (taproot) addresses. + # + # LND v0.19+ uses taproot (BIP86, m/86'/0'/0') for change addresses by default, + # Using descriptors allows bria to track both address types correctly without changing the tests. + # + # For LND versions < v0.19 (which use wpkh for both external and change), use: + # retry 10 1 bria_cmd import-xpub -x -n lnd_key -d m/84h/0h/0h + # bria_cmd create-wallet -n default wpkh -x lnd_key + bria_cmd create-wallet -n default descriptors \ + -d "wpkh([6f2fa1b2/84'/0'/0']tpubDD4vFnWuTMEcZiaaZPgvzeGyMzWe6qHW8gALk5Md9kutDvtdDjYFwzauEFFRHgov8pAwup5jX88j5YFyiACsPf3pqn5hBjvuTLRAseaJ6b4/0/*)#wlmk9vyk" \ + -c "tr([6f2fa1b2/86'/0'/0']tpubDD6sGNgWVAeKaMGF5XkfBhMAuSqjoiqUoSM7Dmf11auxu41PDg1AL4LDwTkuVEMUS2zY51zPESy1xr26cLj7BZHfwZQHd4Xf1Ym5WbvAMru/1/*)#ggr04sk2" echo "Bria Initialization Complete" } - # Run the given command in the background. Useful for starting a # node and then moving on with commands that exercise it for the # test. diff --git a/docker-compose.yml b/docker-compose.yml index 3f6cdeeb..4bedd452 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,7 +17,7 @@ services: - POSTGRES_PASSWORD=password - POSTGRES_DB=pg healthcheck: - test: [ "CMD-SHELL", "pg_isready" ] + test: ["CMD-SHELL", "pg_isready"] interval: 5s timeout: 5s retries: 5 @@ -25,7 +25,7 @@ services: image: us.gcr.io/galoy-org/rust-concourse depends_on: - postgres - command: [ "make", "e2e-tests-in-container" ] + command: ["make", "e2e-tests-in-container"] working_dir: /repo volumes: - ./:/repo @@ -50,7 +50,7 @@ services: image: us.gcr.io/galoy-org/rust-concourse depends_on: - integration-deps - command: [ "make", "integration-tests-in-container" ] + command: ["make", "integration-tests-in-container"] environment: - DATABASE_URL=postgres://user:password@postgres:5432/pg - PG_HOST=postgres @@ -66,27 +66,27 @@ services: - cargo-target:/usr/local/cargo-target otel-agent: image: otel/opentelemetry-collector-contrib:0.57.2 - command: [ "--config=/etc/otel-agent-config.yaml" ] + command: ["--config=/etc/otel-agent-config.yaml"] environment: - HONEYCOMB_DATASET=${HONEYCOMB_DATASET} - HONEYCOMB_API_KEY=${HONEYCOMB_API_KEY} volumes: - ./dev/otel-agent-config.yaml:/etc/otel-agent-config.yaml bitcoind: - image: lncm/bitcoind:v24.0.1 + image: lncm/bitcoind:v27.0 volumes: - ${HOST_PROJECT_PATH:-.}/dev/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf bitcoind-signer: - image: lncm/bitcoind:v24.0.1 + image: lncm/bitcoind:v27.0 volumes: - ${HOST_PROJECT_PATH:-.}/dev/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf - depends_on: [ bitcoind ] - entrypoint: [ "/bin/sh", "-c" ] + depends_on: [bitcoind] + entrypoint: ["/bin/sh", "-c"] command: - | bitcoind -connect=bitcoind:18444 lnd: - image: lightninglabs/lnd:v0.15.4-beta + image: lightninglabs/lnd:v0.19.3-beta volumes: - ${HOST_PROJECT_PATH:-.}/dev/lnd/lnd.conf:/root/.lnd/lnd.conf - ${HOST_PROJECT_PATH:-.}/dev/lnd/tls.key:/root/.lnd/tls.key @@ -94,8 +94,8 @@ services: - ${HOST_PROJECT_PATH:-.}/dev/lnd/regtest/lnd.wallet.db:/root/.lnd/wallet.db - ${HOST_PROJECT_PATH:-.}/dev/lnd/regtest/lnd.macaroons.db:/root/.lnd/macaroons.db - ${HOST_PROJECT_PATH:-.}/dev/lnd/regtest/lnd.admin.macaroon:/root/.lnd/admin.macaroon - depends_on: [ bitcoind ] - entrypoint: [ "/bin/sh", "-c" ] + depends_on: [bitcoind] + entrypoint: ["/bin/sh", "-c"] command: - | mkdir -p /root/.lnd/data/chain/bitcoin/regtest/ @@ -105,7 +105,7 @@ services: /bin/lnd fulcrum: image: cculianu/fulcrum:latest - depends_on: [ bitcoind ] + depends_on: [bitcoind] volumes: - ${HOST_PROJECT_PATH:-.}/dev/fulcrum/fulcrum.conf:/fulcrum.conf - ${HOST_PROJECT_PATH:-.}/dev/fulcrum/tls.key:/tls.key @@ -114,10 +114,10 @@ services: - DATA_DIR=/db - SSL_CERTFILE=/tls.cert - SSL_KEYFILE=/tls.key - command: [ "Fulcrum", "/fulcrum.conf" ] + command: ["Fulcrum", "/fulcrum.conf"] mempool: image: mempool/backend - depends_on: [ bitcoind, mempool_db ] + depends_on: [bitcoind, mempool_db] environment: MEMPOOL_BACKEND: "none" CORE_RPC_HOST: bitcoind From 85f741af8e00990eb06efb42108d2d2c97817c3c Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Wed, 18 Feb 2026 22:43:14 +0100 Subject: [PATCH 59/65] ci: set default docker api version for host compatibility (#27) --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 4bedd452..da9fcf1d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -46,6 +46,7 @@ services: - LND_HOST=lnd - ELECTRUM_HOST=fulcrum - CARGO_TARGET_DIR=/usr/local/cargo-target + - DOCKER_API_VERSION=${DOCKER_API_VERSION:-1.43} integration-tests: image: us.gcr.io/galoy-org/rust-concourse depends_on: From 0eeeec18b59f8c23119d36e840a217f4c0e0b327 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Mon, 9 Mar 2026 10:24:54 +0100 Subject: [PATCH 60/65] test: bitcoin update to 28.3 (#23) --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index da9fcf1d..d2a37882 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -74,11 +74,11 @@ services: volumes: - ./dev/otel-agent-config.yaml:/etc/otel-agent-config.yaml bitcoind: - image: lncm/bitcoind:v27.0 + image: lnliz/bitcoind:v28.3 volumes: - ${HOST_PROJECT_PATH:-.}/dev/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf bitcoind-signer: - image: lncm/bitcoind:v27.0 + image: lnliz/bitcoind:v28.3 volumes: - ${HOST_PROJECT_PATH:-.}/dev/bitcoind/bitcoin.conf:/data/.bitcoin/bitcoin.conf depends_on: [bitcoind] From 5ec137efcdf1b49d31f8ae4191b32e8654c94bc6 Mon Sep 17 00:00:00 2001 From: openoms <43343391+openoms@users.noreply.github.com> Date: Mon, 9 Mar 2026 13:34:44 +0100 Subject: [PATCH 61/65] fix: allow clippy::result_large_err in gRPC server module (#31) Rust 1.94 Clippy flags tonic::Status (176 bytes) as too large for Result Err variants. This is a false positive for gRPC handlers where tonic::Status is the idiomatic error type. Allow the lint at the module level, consistent with the existing blocks_in_conditions allow. --- src/api/server/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/api/server/mod.rs b/src/api/server/mod.rs index 0c607be1..949dc913 100644 --- a/src/api/server/mod.rs +++ b/src/api/server/mod.rs @@ -1,4 +1,5 @@ #![allow(clippy::blocks_in_conditions)] +#![allow(clippy::result_large_err)] mod convert; #[allow(clippy::all)] From e54180697f3e756012a198021172b2c5c51b5cde Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 9 Mar 2026 08:25:34 -0500 Subject: [PATCH 62/65] fix: isolate job runners by channel and add concurrency config (#30) * fix: isolate job channels with dedicated runners Split job execution into account_main, critical, and maintenance runners with independent concurrency controls to prevent sync_wallet backlog from starving payout and broadcast flows. Keep process_all_payout_queues in maintenance as a scheduler/fan-out path while preserving critical bandwidth for signing and broadcasting. * chore: align runner config defaults and validation logs Deduplicate runner default helpers, align bria.yml example values with compiled defaults, and emit warnings when runner concurrency is normalized. Also clarify why JobRunners keeps handles alive for app lifetime. * test(e2e): restore default job runner config Remove e2e runner concurrency overrides so sync-related BATS scenarios run with the default daemon scheduling behavior. This avoids timing drift introduced by the lower test-only runner limits. * perf: prioritize newer wallets in sync scheduling Order wallet ids by created_at descending when scheduling sync_all_wallets so recently added wallets are synced first under backlog pressure. Refresh sqlx prepare metadata for the updated query. * test: add normalize_concurrency unit tests --- ...73fff1e4d66895a441508f9fdb72d7468fb5.json} | 4 +- bria.yml | 14 ++ src/app/mod.rs | 7 +- src/job/config.rs | 62 ++++++ src/job/mod.rs | 189 +++++++++++++++++- src/wallet/repo.rs | 11 +- 6 files changed, 274 insertions(+), 13 deletions(-) rename .sqlx/{query-1e4d8b2841a5854fb6c8d01b0c7826a0b7c7348bf6141a736eeac25bf563c82b.json => query-bae130455cc8134568da54c49db073fff1e4d66895a441508f9fdb72d7468fb5.json} (63%) diff --git a/.sqlx/query-1e4d8b2841a5854fb6c8d01b0c7826a0b7c7348bf6141a736eeac25bf563c82b.json b/.sqlx/query-bae130455cc8134568da54c49db073fff1e4d66895a441508f9fdb72d7468fb5.json similarity index 63% rename from .sqlx/query-1e4d8b2841a5854fb6c8d01b0c7826a0b7c7348bf6141a736eeac25bf563c82b.json rename to .sqlx/query-bae130455cc8134568da54c49db073fff1e4d66895a441508f9fdb72d7468fb5.json index 0a65b2df..6732d6ba 100644 --- a/.sqlx/query-1e4d8b2841a5854fb6c8d01b0c7826a0b7c7348bf6141a736eeac25bf563c82b.json +++ b/.sqlx/query-bae130455cc8134568da54c49db073fff1e4d66895a441508f9fdb72d7468fb5.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "SELECT DISTINCT account_id, id as wallet_id FROM bria_wallets", + "query": "SELECT account_id, id as wallet_id\n FROM bria_wallets\n ORDER BY created_at DESC, id DESC", "describe": { "columns": [ { @@ -22,5 +22,5 @@ false ] }, - "hash": "1e4d8b2841a5854fb6c8d01b0c7826a0b7c7348bf6141a736eeac25bf563c82b" + "hash": "bae130455cc8134568da54c49db073fff1e4d66895a441508f9fdb72d7468fb5" } diff --git a/bria.yml b/bria.yml index 15eb8d74..8cf0a1f2 100644 --- a/bria.yml +++ b/bria.yml @@ -1,5 +1,19 @@ # blockchain: # network: regtest +# jobs: +# sync_all_wallets_delay: 5 +# process_all_payout_queues_delay: 2 +# respawn_all_outbox_handlers_delay: 5 +# runners: +# account_main: +# min_concurrency: 6 +# max_concurrency: 10 +# critical: +# min_concurrency: 6 +# max_concurrency: 10 +# maintenance: +# min_concurrency: 2 +# max_concurrency: 4 # wallets: # sync_all_delay: 10s # admin: diff --git a/src/app/mod.rs b/src/app/mod.rs index 25379bc9..5bf36809 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -2,7 +2,6 @@ mod config; pub mod error; use bdk::FeeRate; -use sqlxmq::JobRunnerHandle; use tracing::instrument; use std::collections::HashMap; @@ -32,7 +31,7 @@ use crate::{ #[allow(dead_code)] pub struct App { - _runner: JobRunnerHandle, + _runners: job::JobRunners, outbox: Outbox, profiles: Profiles, xpubs: XPubs, @@ -69,7 +68,7 @@ impl App { ) .await?; let fees_client = FeesClient::new(config.fees.clone()); - let runner = job::start_job_runner( + let runners = job::start_job_runners( &pool, outbox.clone(), wallets.clone(), @@ -115,7 +114,7 @@ impl App { fees_client, batch_inclusion, config, - _runner: runner, + _runners: runners, }; if let Some(deprecrated_encryption_key) = app.config.deprecated_encryption_key.as_ref() { app.rotate_encryption_key(deprecrated_encryption_key) diff --git a/src/job/config.rs b/src/job/config.rs index f51b7a30..afe538a8 100644 --- a/src/job/config.rs +++ b/src/job/config.rs @@ -15,6 +15,26 @@ pub struct JobsConfig { pub respawn_all_outbox_handlers_delay: Duration, #[serde(default)] pub signing: SigningJobConfig, + #[serde(default)] + pub runners: JobRunnersConfig, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct JobRunnersConfig { + #[serde(default = "default_runner_concurrency")] + pub account_main: JobRunnerConcurrencyConfig, + #[serde(default = "default_runner_concurrency")] + pub critical: JobRunnerConcurrencyConfig, + #[serde(default = "default_maintenance_runner")] + pub maintenance: JobRunnerConcurrencyConfig, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct JobRunnerConcurrencyConfig { + #[serde(default = "default_runner_min_concurrency")] + pub min_concurrency: usize, + #[serde(default = "default_runner_max_concurrency")] + pub max_concurrency: usize, } #[serde_with::serde_as] @@ -36,6 +56,26 @@ impl Default for JobsConfig { process_all_payout_queues_delay: default_process_all_payout_queues_delay(), respawn_all_outbox_handlers_delay: default_respawn_all_outbox_handlers_delay(), signing: SigningJobConfig::default(), + runners: JobRunnersConfig::default(), + } + } +} + +impl Default for JobRunnersConfig { + fn default() -> Self { + Self { + account_main: default_runner_concurrency(), + critical: default_runner_concurrency(), + maintenance: default_maintenance_runner(), + } + } +} + +impl Default for JobRunnerConcurrencyConfig { + fn default() -> Self { + Self { + min_concurrency: default_runner_min_concurrency(), + max_concurrency: default_runner_max_concurrency(), } } } @@ -73,3 +113,25 @@ fn default_signing_max_attempts() -> u32 { fn default_signing_max_retry_delay() -> Duration { Duration::from_secs(300) } + +fn default_runner_min_concurrency() -> usize { + 6 +} + +fn default_runner_max_concurrency() -> usize { + 10 +} + +fn default_runner_concurrency() -> JobRunnerConcurrencyConfig { + JobRunnerConcurrencyConfig { + min_concurrency: default_runner_min_concurrency(), + max_concurrency: default_runner_max_concurrency(), + } +} + +fn default_maintenance_runner() -> JobRunnerConcurrencyConfig { + JobRunnerConcurrencyConfig { + min_concurrency: 2, + max_concurrency: 4, + } +} diff --git a/src/job/mod.rs b/src/job/mod.rs index a7072ef0..91d6bcbc 100644 --- a/src/job/mod.rs +++ b/src/job/mod.rs @@ -34,8 +34,17 @@ const SYNC_ALL_WALLETS_ID: Uuid = uuid!("00000000-0000-0000-0000-000000000001"); const PROCESS_ALL_PAYOUT_QUEUES_ID: Uuid = uuid!("00000000-0000-0000-0000-000000000002"); const RESPAWN_ALL_OUTBOX_ID: Uuid = uuid!("00000000-0000-0000-0000-000000000003"); +#[allow(dead_code)] +pub struct JobRunners { + // These handles are intentionally retained for process lifetime so each + // runner task keeps running until the app shuts down. + pub account_main: JobRunnerHandle, + pub critical: JobRunnerHandle, + pub maintenance: JobRunnerHandle, +} + #[allow(clippy::too_many_arguments)] -pub async fn start_job_runner( +pub async fn start_job_runners( pool: &sqlx::PgPool, outbox: Outbox, wallets: Wallets, @@ -51,7 +60,127 @@ pub async fn start_job_runner( blockchain_cfg: BlockchainConfig, signer_encryption_config: SignerEncryptionConfig, fees_client: FeesClient, -) -> Result { +) -> Result { + let runner_config = config.runners.clone(); + + let account_main_registry = build_job_registry( + config.clone(), + blockchain_cfg.clone(), + outbox.clone(), + wallets.clone(), + xpubs.clone(), + payout_queues.clone(), + batches.clone(), + signing_sessions.clone(), + payouts.clone(), + ledger.clone(), + utxos.clone(), + addresses.clone(), + signer_encryption_config.clone(), + fees_client.clone(), + ); + + let account_main_concurrency = + normalize_concurrency("account_main", runner_config.account_main); + let account_main = account_main_registry + .runner(pool) + .set_channel_names(&["account_main"]) + .set_concurrency( + account_main_concurrency.min_concurrency, + account_main_concurrency.max_concurrency, + ) + .set_keep_alive(false) + .run() + .await?; + + let critical_registry = build_job_registry( + config.clone(), + blockchain_cfg.clone(), + outbox.clone(), + wallets.clone(), + xpubs.clone(), + payout_queues.clone(), + batches.clone(), + signing_sessions.clone(), + payouts.clone(), + ledger.clone(), + utxos.clone(), + addresses.clone(), + signer_encryption_config.clone(), + fees_client.clone(), + ); + + let critical_concurrency = normalize_concurrency("critical", runner_config.critical); + let critical = critical_registry + .runner(pool) + .set_channel_names(&["wallet_accounting", "batch_signing", "batch_broadcasting"]) + .set_concurrency( + critical_concurrency.min_concurrency, + critical_concurrency.max_concurrency, + ) + .set_keep_alive(false) + .run() + .await?; + + let maintenance_registry = build_job_registry( + config, + blockchain_cfg, + outbox, + wallets, + xpubs, + payout_queues, + batches, + signing_sessions, + payouts, + ledger, + utxos, + addresses, + signer_encryption_config, + fees_client, + ); + + let maintenance_concurrency = normalize_concurrency("maintenance", runner_config.maintenance); + let maintenance = maintenance_registry + .runner(pool) + .set_channel_names(&[ + "sync_all_wallets", + "process_all_payout_queues", + "schedule_payout_queue", + "respawn_all_outbox_handlers", + "populate_outbox", + ]) + .set_concurrency( + maintenance_concurrency.min_concurrency, + maintenance_concurrency.max_concurrency, + ) + .set_keep_alive(false) + .run() + .await?; + + Ok(JobRunners { + account_main, + critical, + maintenance, + }) +} + +#[allow(clippy::too_many_arguments)] +fn build_job_registry( + config: JobsConfig, + blockchain_cfg: BlockchainConfig, + outbox: Outbox, + wallets: Wallets, + xpubs: XPubs, + payout_queues: PayoutQueues, + batches: Batches, + signing_sessions: SigningSessions, + payouts: Payouts, + ledger: Ledger, + utxos: Utxos, + addresses: Addresses, + signer_encryption_config: SignerEncryptionConfig, + fees_client: FeesClient, +) -> JobRegistry { let mut registry = JobRegistry::new(&[ sync_all_wallets, sync_wallet, @@ -78,8 +207,29 @@ pub async fn start_job_runner( registry.set_context(addresses); registry.set_context(signer_encryption_config); registry.set_context(fees_client); + registry +} - Ok(registry.runner(pool).set_keep_alive(false).run().await?) +fn normalize_concurrency( + runner_name: &str, + config: JobRunnerConcurrencyConfig, +) -> JobRunnerConcurrencyConfig { + let min = config.min_concurrency.max(1); + let max = config.max_concurrency.max(min); + if min != config.min_concurrency || max != config.max_concurrency { + tracing::warn!( + runner_name, + requested_min_concurrency = config.min_concurrency, + requested_max_concurrency = config.max_concurrency, + normalized_min_concurrency = min, + normalized_max_concurrency = max, + "normalized invalid job runner concurrency" + ); + } + JobRunnerConcurrencyConfig { + min_concurrency: min, + max_concurrency: max, + } } #[job(name = "sync_all_wallets")] @@ -654,6 +804,39 @@ fn account_main_channel_arg(account_id: AccountId) -> String { format!("account_id:{account_id}") } +#[cfg(test)] +mod tests { + use super::{normalize_concurrency, JobRunnerConcurrencyConfig}; + + #[test] + fn normalize_concurrency_clamps_invalid_values() { + let normalized = normalize_concurrency( + "test", + JobRunnerConcurrencyConfig { + min_concurrency: 0, + max_concurrency: 0, + }, + ); + + assert_eq!(normalized.min_concurrency, 1); + assert_eq!(normalized.max_concurrency, 1); + } + + #[test] + fn normalize_concurrency_raises_max_to_min() { + let normalized = normalize_concurrency( + "test", + JobRunnerConcurrencyConfig { + min_concurrency: 7, + max_concurrency: 3, + }, + ); + + assert_eq!(normalized.min_concurrency, 7); + assert_eq!(normalized.max_concurrency, 7); + } +} + impl From<(AccountId, PayoutQueueId)> for ProcessPayoutQueueData { fn from((account_id, payout_queue_id): (AccountId, PayoutQueueId)) -> Self { Self { diff --git a/src/wallet/repo.rs b/src/wallet/repo.rs index 70877635..fc4ec207 100644 --- a/src/wallet/repo.rs +++ b/src/wallet/repo.rs @@ -76,10 +76,13 @@ impl Wallets { pub async fn all_ids( &self, ) -> Result, WalletError> { - let rows = - sqlx::query!(r#"SELECT DISTINCT account_id, id as wallet_id FROM bria_wallets"#,) - .fetch_all(&self.pool) - .await?; + let rows = sqlx::query!( + r#"SELECT account_id, id as wallet_id + FROM bria_wallets + ORDER BY created_at DESC, id DESC"#, + ) + .fetch_all(&self.pool) + .await?; Ok(rows.into_iter().map(|row| { ( AccountId::from(row.account_id), From 4f5efe2cc2703b9b6ab896b261103587eb74c746 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Mon, 9 Mar 2026 14:53:20 -0500 Subject: [PATCH 63/65] perf: reduce bdk sync write churn and optimize sync query paths (#32) * perf: reduce bdk sync write churn and add indexes * perf: lower bdk persistence batch size to 2000 * fix: lint issues * chore: update index creation --- ...309133000_optimize_bdk_sync_paths.down.sql | 4 ++++ ...60309133000_optimize_bdk_sync_paths.up.sql | 21 +++++++++++++++++++ src/bdk/pg/transactions.rs | 15 +++++++++++-- src/bdk/pg/utxos.rs | 13 ++++++++++-- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 migrations/20260309133000_optimize_bdk_sync_paths.down.sql create mode 100644 migrations/20260309133000_optimize_bdk_sync_paths.up.sql diff --git a/migrations/20260309133000_optimize_bdk_sync_paths.down.sql b/migrations/20260309133000_optimize_bdk_sync_paths.down.sql new file mode 100644 index 00000000..0c71fdad --- /dev/null +++ b/migrations/20260309133000_optimize_bdk_sync_paths.down.sql @@ -0,0 +1,4 @@ +DROP INDEX IF EXISTS bdk_utxos_soft_deleted_idx; +DROP INDEX IF EXISTS bdk_utxos_pending_confirmation_sync_idx; +DROP INDEX IF EXISTS bdk_transactions_confirmed_spend_sync_idx; +DROP INDEX IF EXISTS bdk_transactions_unsynced_by_height_idx; diff --git a/migrations/20260309133000_optimize_bdk_sync_paths.up.sql b/migrations/20260309133000_optimize_bdk_sync_paths.up.sql new file mode 100644 index 00000000..5b3a3dec --- /dev/null +++ b/migrations/20260309133000_optimize_bdk_sync_paths.up.sql @@ -0,0 +1,21 @@ +CREATE INDEX IF NOT EXISTS bdk_transactions_unsynced_by_height_idx +ON bdk_transactions (keychain_id, height ASC NULLS LAST, tx_id) +WHERE synced_to_bria = false AND deleted_at IS NULL; + +CREATE INDEX IF NOT EXISTS bdk_transactions_confirmed_spend_sync_idx +ON bdk_transactions (keychain_id, height, tx_id) +WHERE deleted_at IS NULL + AND sent > 0 + AND height IS NOT NULL + AND synced_to_bria = true + AND confirmation_synced_to_bria = false; + +CREATE INDEX IF NOT EXISTS bdk_utxos_pending_confirmation_sync_idx +ON bdk_utxos (keychain_id, tx_id, vout) +WHERE deleted_at IS NULL + AND synced_to_bria = true + AND confirmation_synced_to_bria = false; + +CREATE INDEX IF NOT EXISTS bdk_utxos_soft_deleted_idx +ON bdk_utxos (keychain_id, deleted_at) +WHERE deleted_at IS NOT NULL; diff --git a/src/bdk/pg/transactions.rs b/src/bdk/pg/transactions.rs index 8c8af205..796f46df 100644 --- a/src/bdk/pg/transactions.rs +++ b/src/bdk/pg/transactions.rs @@ -37,7 +37,7 @@ impl Transactions { #[instrument(name = "bdk.transactions.persist", skip_all)] pub async fn persist_all(&self, txs: Vec) -> Result<(), bdk::Error> { - const BATCH_SIZE: usize = 5000; + const BATCH_SIZE: usize = 2000; let batches = txs.chunks(BATCH_SIZE); for batch in batches { @@ -55,7 +55,18 @@ impl Transactions { builder.push_bind(tx.confirmation_time.as_ref().map(|t| t.height as i32)); }); - query_builder.push("ON CONFLICT (keychain_id, tx_id) DO UPDATE SET details_json = EXCLUDED.details_json, height = EXCLUDED.height, modified_at = NOW(), deleted_at = NULL"); + query_builder.push( + "ON CONFLICT (keychain_id, tx_id) DO UPDATE \ + SET details_json = EXCLUDED.details_json,\ + sent = EXCLUDED.sent,\ + height = EXCLUDED.height,\ + modified_at = NOW(),\ + deleted_at = NULL \ + WHERE bdk_transactions.details_json IS DISTINCT FROM EXCLUDED.details_json \ + OR bdk_transactions.sent IS DISTINCT FROM EXCLUDED.sent \ + OR bdk_transactions.height IS DISTINCT FROM EXCLUDED.height \ + OR bdk_transactions.deleted_at IS NOT NULL", + ); let query = query_builder.build(); query diff --git a/src/bdk/pg/utxos.rs b/src/bdk/pg/utxos.rs index d9d6c01c..60628a19 100644 --- a/src/bdk/pg/utxos.rs +++ b/src/bdk/pg/utxos.rs @@ -23,7 +23,7 @@ impl Utxos { #[instrument(name = "bdk.utxos.persist_all", skip_all)] pub async fn persist_all(&self, utxos: Vec) -> Result<(), bdk::Error> { - const BATCH_SIZE: usize = 5000; + const BATCH_SIZE: usize = 2000; let batches = utxos.chunks(BATCH_SIZE); for batch in batches { @@ -40,7 +40,16 @@ impl Utxos { builder.push_bind(utxo.is_spent); }); - query_builder.push("ON CONFLICT (keychain_id, tx_id, vout) DO UPDATE SET utxo_json = EXCLUDED.utxo_json, is_spent = EXCLUDED.is_spent, modified_at = NOW(), deleted_at = NULL"); + query_builder.push( + "ON CONFLICT (keychain_id, tx_id, vout) DO UPDATE \ + SET utxo_json = EXCLUDED.utxo_json,\ + is_spent = EXCLUDED.is_spent,\ + modified_at = NOW(),\ + deleted_at = NULL \ + WHERE bdk_utxos.utxo_json IS DISTINCT FROM EXCLUDED.utxo_json \ + OR bdk_utxos.is_spent IS DISTINCT FROM EXCLUDED.is_spent \ + OR bdk_utxos.deleted_at IS NOT NULL", + ); let query = query_builder.build(); query From dec0bce91f4f6ac5758647380b35048a6c2be405 Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Mar 2026 09:46:45 -0500 Subject: [PATCH 64/65] chore: update nix and cargo locks --- ...577bfbf3ffecec63080e12a42a2cc506d1b9f.json | 23 + ...70ca6d41602ead734b4a65e11de95b9ab7c7f.json | 16 + ...ab1e304568264e004dec9b8b8cc306dfaee66.json | 82 ++ ...ab7d7c8417180ae7c16440ba24fb80804509f.json | 39 + ...b005975efe12df569e823b49bbd7b2688d52b.json | 23 + ...3c01adc9b097941da3f02d0ba077c8401658b.json | 40 + ...b3dd649758b5afcf70feb2a6eff7d69925bfc.json | 20 + ...a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json | 46 + ...0c89fbb9a5aa3109b6fd0d326d685aecad587.json | 46 + ...42e5653f3ddd3e98222a878b1dda2d3dd12a6.json | 148 +++ ...5f403d6ca6274a0d7816a8a2979943159c062.json | 82 ++ ...ba25755874dcd529542e64ddf7ff141c38b58.json | 22 + ...3a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json | 121 +++ ...849a381c14f64e2e8fc7ce6396933f99ed980.json | 147 +++ ...f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json | 59 ++ ...fa3a4f1df8e71d1459e7889c5cc2450cec803.json | 82 ++ ...bdfbe9083e1cf4a69d2ebe8636c92b882176a.json | 41 + Cargo.lock | 878 +++++++++++------- Cargo.toml | 2 +- flake.lock | 12 +- 20 files changed, 1582 insertions(+), 347 deletions(-) create mode 100644 .sqlx/query-14eaa04f9e8760c8f56fa9f95f5577bfbf3ffecec63080e12a42a2cc506d1b9f.json create mode 100644 .sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json create mode 100644 .sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json create mode 100644 .sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json create mode 100644 .sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json create mode 100644 .sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json create mode 100644 .sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json create mode 100644 .sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json create mode 100644 .sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json create mode 100644 .sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json create mode 100644 .sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json create mode 100644 .sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json create mode 100644 .sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json create mode 100644 .sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json create mode 100644 .sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json create mode 100644 .sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json create mode 100644 .sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json diff --git a/.sqlx/query-14eaa04f9e8760c8f56fa9f95f5577bfbf3ffecec63080e12a42a2cc506d1b9f.json b/.sqlx/query-14eaa04f9e8760c8f56fa9f95f5577bfbf3ffecec63080e12a42a2cc506d1b9f.json new file mode 100644 index 00000000..2a7e37ba --- /dev/null +++ b/.sqlx/query-14eaa04f9e8760c8f56fa9f95f5577bfbf3ffecec63080e12a42a2cc506d1b9f.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT json_build_object(\n 'id', id,\n 'type', type,\n 'data', data,\n 'recorded_at', recorded_at\n ) AS \"payload!\" FROM sqlx_ledger_events WHERE id > $1 ORDER BY id LIMIT $2", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "payload!", + "type_info": "Json" + } + ], + "parameters": { + "Left": [ + "Int8", + "Int8" + ] + }, + "nullable": [ + null + ] + }, + "hash": "14eaa04f9e8760c8f56fa9f95f5577bfbf3ffecec63080e12a42a2cc506d1b9f" +} diff --git a/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json new file mode 100644 index 00000000..33a94981 --- /dev/null +++ b/.sqlx/query-19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f.json @@ -0,0 +1,16 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts\n (id, version, code, name, normal_balance_type, description, status, metadata, created_at)\n(\n SELECT id, version + 1, code, name, normal_balance_type, COALESCE($2, description), status, COALESCE($3, metadata), created_at\n FROM sqlx_ledger_accounts WHERE id = $1 ORDER BY version DESC LIMIT 1\n)\n", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Jsonb" + ] + }, + "nullable": [] + }, + "hash": "19ff1c916c204f57f6bfcf0f72570ca6d41602ead734b4a65e11de95b9ab7c7f" +} diff --git a/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json new file mode 100644 index 00000000..301c5cc3 --- /dev/null +++ b/.sqlx/query-28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE tx_template_id = $1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "28b2079d3422953e6dc7cf7c3a1ab1e304568264e004dec9b8b8cc306dfaee66" +} diff --git a/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json b/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json new file mode 100644 index 00000000..e5af9ce7 --- /dev/null +++ b/.sqlx/query-34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f.json @@ -0,0 +1,39 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT keychain_kind as \"keychain_kind: BdkKeychainKind\", path FROM bdk_script_pubkeys\n WHERE keychain_id = $1 AND script_hex = ENCODE($2, 'hex')", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "keychain_kind: BdkKeychainKind", + "type_info": { + "Custom": { + "name": "bdkkeychainkind", + "kind": { + "Enum": [ + "external", + "internal" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "path", + "type_info": "Int4" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Bytea" + ] + }, + "nullable": [ + false, + false + ] + }, + "hash": "34dec721ee5f61bc0dc86a71d6fab7d7c8417180ae7c16440ba24fb80804509f" +} diff --git a/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json b/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json new file mode 100644 index 00000000..62675cca --- /dev/null +++ b/.sqlx/query-5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b.json @@ -0,0 +1,23 @@ +{ + "db_name": "PostgreSQL", + "query": "\n SELECT details_json FROM bdk_transactions WHERE keychain_id = $1 AND tx_id = $2 AND deleted_at IS NULL", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "details_json", + "type_info": "Jsonb" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "5256bb536a5c8b3421a642b8e4eb005975efe12df569e823b49bbd7b2688d52b" +} diff --git a/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json new file mode 100644 index 00000000..105bf98b --- /dev/null +++ b/.sqlx/query-63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b.json @@ -0,0 +1,40 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_tx_templates (id, code, description, params, tx_input, entries, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + "Jsonb", + "Jsonb", + "Jsonb", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "63b1b637705d0ab703a902f275e3c01adc9b097941da3f02d0ba077c8401658b" +} diff --git a/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json new file mode 100644 index 00000000..60f58c60 --- /dev/null +++ b/.sqlx/query-6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc.json @@ -0,0 +1,20 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT NOW()", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "now", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + null + ] + }, + "hash": "6bae2f6ec3f8d5295b935cef18cb3dd649758b5afcf70feb2a6eff7d69925bfc" +} diff --git a/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json new file mode 100644 index 00000000..074622c1 --- /dev/null +++ b/.sqlx/query-6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_journals (id, name, description, status)\n VALUES ($1, $2, $3, $4)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + } + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "6e82fe7ca0798715e4316b5acf6a3ccfbe0326ce3f5f3cd238ccad0f641cbe4e" +} diff --git a/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json new file mode 100644 index 00000000..7857e9f9 --- /dev/null +++ b/.sqlx/query-77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587.json @@ -0,0 +1,46 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, code, params, tx_input, entries FROM sqlx_ledger_tx_templates WHERE code = $1 LIMIT 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "code", + "type_info": "Varchar" + }, + { + "ordinal": 2, + "name": "params", + "type_info": "Jsonb" + }, + { + "ordinal": 3, + "name": "tx_input", + "type_info": "Jsonb" + }, + { + "ordinal": 4, + "name": "entries", + "type_info": "Jsonb" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false, + false, + true, + false, + false + ] + }, + "hash": "77599d77a146babd748cd8ebbd10c89fbb9a5aa3109b6fd0d326d685aecad587" +} diff --git a/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json new file mode 100644 index 00000000..3c7819b4 --- /dev/null +++ b/.sqlx/query-8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6.json @@ -0,0 +1,148 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = $2 AND currency = $3 ) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT id, normal_balance_type FROM sqlx_ledger_accounts WHERE id = $2 LIMIT 1 ) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Text" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "8362c8aebe79065e4f4559e8a8142e5653f3ddd3e98222a878b1dda2d3dd12a6" +} diff --git a/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json new file mode 100644 index 00000000..00d0da2e --- /dev/null +++ b/.sqlx/query-97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE id = ANY($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "97e0b4c922ce1927e58ed4836ee5f403d6ca6274a0d7816a8a2979943159c062" +} diff --git a/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json new file mode 100644 index 00000000..f856a851 --- /dev/null +++ b/.sqlx/query-9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58.json @@ -0,0 +1,22 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id FROM sqlx_ledger_accounts WHERE code = $1 LIMIT 1", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + } + ], + "parameters": { + "Left": [ + "Text" + ] + }, + "nullable": [ + false + ] + }, + "hash": "9e79709362bef4af7392f7cd241ba25755874dcd529542e64ddf7ff141c38b58" +} diff --git a/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json new file mode 100644 index 00000000..b95d0aed --- /dev/null +++ b/.sqlx/query-b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab.json @@ -0,0 +1,121 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, transaction_id, account_id, journal_id, entry_type, layer as \"layer: Layer\", units, currency, direction as \"direction: DebitOrCredit\", sequence, description, created_at, modified_at\n FROM sqlx_ledger_entries\n WHERE transaction_id = ANY($1) ORDER BY transaction_id ASC, sequence ASC, version DESC", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "transaction_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 5, + "name": "entry_type", + "type_info": "Varchar" + }, + { + "ordinal": 6, + "name": "layer: Layer", + "type_info": { + "Custom": { + "name": "layer", + "kind": { + "Enum": [ + "settled", + "pending", + "encumbered" + ] + } + } + } + }, + { + "ordinal": 7, + "name": "units", + "type_info": "Numeric" + }, + { + "ordinal": 8, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 9, + "name": "direction: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 10, + "name": "sequence", + "type_info": "Int4" + }, + { + "ordinal": 11, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 12, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + true, + false, + false + ] + }, + "hash": "b0c8cdc4866bee576bd760d04693a3e4cc83ddc151aab9f2eb1952bfa5e29cab" +} diff --git a/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json new file mode 100644 index 00000000..92db28c8 --- /dev/null +++ b/.sqlx/query-bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980.json @@ -0,0 +1,147 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT\n a.normal_balance_type as \"normal_balance_type: DebitOrCredit\", b.journal_id, b.account_id, entry_id, b.currency,\n settled_dr_balance, settled_cr_balance, settled_entry_id, settled_modified_at,\n pending_dr_balance, pending_cr_balance, pending_entry_id, pending_modified_at,\n encumbered_dr_balance, encumbered_cr_balance, encumbered_entry_id, encumbered_modified_at,\n c.version, modified_at, created_at\n FROM sqlx_ledger_balances b JOIN (\n SELECT * FROM sqlx_ledger_current_balances WHERE journal_id = $1 AND account_id = ANY($2)) c\n ON b.journal_id = c.journal_id AND b.account_id = c.account_id AND b.currency = c.currency AND b.version = c.version\n JOIN ( SELECT DISTINCT(id), normal_balance_type FROM sqlx_ledger_accounts WHERE id = ANY($2)) a\n ON a.id = b.account_id", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "normal_balance_type: DebitOrCredit", + "type_info": { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + } + }, + { + "ordinal": 1, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 2, + "name": "account_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "currency", + "type_info": "Varchar" + }, + { + "ordinal": 5, + "name": "settled_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 6, + "name": "settled_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 7, + "name": "settled_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 8, + "name": "settled_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 9, + "name": "pending_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 10, + "name": "pending_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 11, + "name": "pending_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 12, + "name": "pending_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 13, + "name": "encumbered_dr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 14, + "name": "encumbered_cr_balance", + "type_info": "Numeric" + }, + { + "ordinal": 15, + "name": "encumbered_entry_id", + "type_info": "Uuid" + }, + { + "ordinal": 16, + "name": "encumbered_modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 17, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 18, + "name": "modified_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 19, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "UuidArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false, + false + ] + }, + "hash": "bf2e1148f97897ad3ec3ffc607d849a381c14f64e2e8fc7ce6396933f99ed980" +} diff --git a/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json new file mode 100644 index 00000000..90bef3da --- /dev/null +++ b/.sqlx/query-c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73.json @@ -0,0 +1,59 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_accounts (id, code, name, normal_balance_type, description, status, metadata)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Varchar", + "Varchar", + { + "Custom": { + "name": "debitorcredit", + "kind": { + "Enum": [ + "debit", + "credit" + ] + } + } + }, + "Varchar", + { + "Custom": { + "name": "status", + "kind": { + "Enum": [ + "active" + ] + } + } + }, + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "c7f4751f63df559566362c0d251f9833a1ce2fd44bad7e61ba04f8e4526e1e73" +} diff --git a/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json new file mode 100644 index 00000000..18d9c9b6 --- /dev/null +++ b/.sqlx/query-d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803.json @@ -0,0 +1,82 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata, created_at, modified_at\n FROM sqlx_ledger_transactions\n WHERE external_id = ANY($1)", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "journal_id", + "type_info": "Uuid" + }, + { + "ordinal": 3, + "name": "tx_template_id", + "type_info": "Uuid" + }, + { + "ordinal": 4, + "name": "effective", + "type_info": "Date" + }, + { + "ordinal": 5, + "name": "correlation_id", + "type_info": "Uuid" + }, + { + "ordinal": 6, + "name": "external_id", + "type_info": "Varchar" + }, + { + "ordinal": 7, + "name": "description", + "type_info": "Varchar" + }, + { + "ordinal": 8, + "name": "metadata", + "type_info": "Jsonb" + }, + { + "ordinal": 9, + "name": "created_at", + "type_info": "Timestamptz" + }, + { + "ordinal": 10, + "name": "modified_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "TextArray" + ] + }, + "nullable": [ + false, + false, + false, + false, + false, + false, + false, + true, + true, + false, + false + ] + }, + "hash": "d55823be440da6ca9e60d94299dfa3a4f1df8e71d1459e7889c5cc2450cec803" +} diff --git a/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json new file mode 100644 index 00000000..8de91f27 --- /dev/null +++ b/.sqlx/query-d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a.json @@ -0,0 +1,41 @@ +{ + "db_name": "PostgreSQL", + "query": "INSERT INTO sqlx_ledger_transactions (id, version, journal_id, tx_template_id, effective, correlation_id, external_id, description, metadata)\n VALUES ($1, 1, (SELECT id FROM sqlx_ledger_journals WHERE id = $2 LIMIT 1), (SELECT id FROM sqlx_ledger_tx_templates WHERE id = $3 LIMIT 1), $4, $5, $6, $7, $8)\n RETURNING id, version, created_at", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "id", + "type_info": "Uuid" + }, + { + "ordinal": 1, + "name": "version", + "type_info": "Int4" + }, + { + "ordinal": 2, + "name": "created_at", + "type_info": "Timestamptz" + } + ], + "parameters": { + "Left": [ + "Uuid", + "Uuid", + "Uuid", + "Date", + "Uuid", + "Varchar", + "Varchar", + "Jsonb" + ] + }, + "nullable": [ + false, + false, + false + ] + }, + "hash": "d7e7415d2c9b59e503b1ac93de8bdfbe9083e1cf4a69d2ebe8636c92b882176a" +} diff --git a/Cargo.lock b/Cargo.lock index 5c14bb3c..6f16b1c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,7 @@ version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", "once_cell", "version_check", ] @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.100" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "anymap2" @@ -155,7 +155,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -166,7 +166,7 @@ checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -237,7 +237,7 @@ dependencies = [ "axum-core 0.4.5", "bytes", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "http-body-util", "itoa", @@ -249,7 +249,7 @@ dependencies = [ "rustversion", "serde", "sync_wrapper 1.0.2", - "tower 0.5.2", + "tower 0.5.3", "tower-layer", "tower-service", ] @@ -280,7 +280,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "http-body-util", "mime", @@ -311,9 +311,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.8.0" +version = "1.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" [[package]] name = "bdk" @@ -325,7 +325,7 @@ dependencies = [ "bdk-macros", "bitcoin", "electrum-client", - "getrandom 0.2.16", + "getrandom 0.2.17", "js-sys", "log", "miniscript", @@ -433,9 +433,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.10.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" dependencies = [ "serde_core", ] @@ -472,9 +472,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" dependencies = [ "borsh-derive", "cfg_aliases", @@ -482,20 +482,20 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.7" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "bria" -version = "0.1.114" +version = "0.1.127-dev" dependencies = [ "anyhow", "async-trait", @@ -550,9 +550,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.19.0" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] name = "bytecheck" @@ -615,7 +615,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -626,9 +626,9 @@ checksum = "ade8366b8bd5ba243f0a58f036cc0ca8a2f069cff1a2351ef1cac6b083e16fc0" [[package]] name = "cc" -version = "1.2.46" +version = "1.2.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97463e1064cb1b1c1384ad0a0b9c8abd0988e2a91f52606c80ef14aadb63e36" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" dependencies = [ "find-msvc-tools", "shlex", @@ -672,9 +672,9 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.42" +version = "0.4.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" dependencies = [ "iana-time-zone", "js-sys", @@ -697,9 +697,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.52" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa8120877db0e5c011242f96806ce3c94e0737ab8108532a76a3300a01db2ab8" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" dependencies = [ "clap_builder", "clap_derive", @@ -707,9 +707,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.52" +version = "4.5.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02576b399397b659c26064fbc92a75fede9d18ffd5f80ca1cd74ddab167016e1" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" dependencies = [ "anstream", "anstyle", @@ -719,21 +719,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.49" +version = "4.5.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0b5487afeab2deb2ff4e03a807ad1a03ac532ff5a2cee5d86884440c7f7671" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "clap_lex" -version = "0.7.6" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" [[package]] name = "colorchoice" @@ -782,9 +782,9 @@ dependencies = [ [[package]] name = "crc" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" dependencies = [ "crc-catalog", ] @@ -870,7 +870,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -884,7 +884,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -895,7 +895,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core 0.20.11", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -906,7 +906,7 @@ checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" dependencies = [ "darling_core 0.21.3", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -922,9 +922,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", "serde_core", @@ -948,7 +948,7 @@ dependencies = [ "darling 0.20.11", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -958,7 +958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -981,7 +981,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -1032,9 +1032,9 @@ dependencies = [ [[package]] name = "ena" -version = "0.14.3" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" +checksum = "eabffdaee24bd1bf95c5ef7cec31260444317e72ea56c4c91750e8b7ee58d5f1" dependencies = [ "log", ] @@ -1047,9 +1047,9 @@ checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "erased-serde" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" +checksum = "d2add8a07dd6a8d93ff627029c51de145e12686fbc36ecb298ac22e74cf02dec" dependencies = [ "serde", "serde_core", @@ -1080,7 +1080,7 @@ dependencies = [ "serde", "serde_json", "sqlx", - "thiserror 2.0.17", + "thiserror 2.0.18", "uuid", ] @@ -1096,7 +1096,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -1149,9 +1149,9 @@ dependencies = [ [[package]] name = "find-msvc-tools" -version = "0.1.5" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" [[package]] name = "fixedbitset" @@ -1182,6 +1182,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + [[package]] name = "form_urlencoded" version = "1.2.2" @@ -1209,9 +1215,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" dependencies = [ "futures-channel", "futures-core", @@ -1224,9 +1230,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" dependencies = [ "futures-core", "futures-sink", @@ -1234,15 +1240,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "baf29c38818342a3b26b5b923639e7b1f4a61fc5e76102d4b1981c6dc7a7579d" dependencies = [ "futures-core", "futures-task", @@ -1262,38 +1268,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718" [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "e835b70203e41293343137df5c0664546da5745f82ec9b84d40be8336958447b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ "futures-channel", "futures-core", @@ -1303,7 +1309,6 @@ dependencies = [ "futures-task", "memchr", "pin-project-lite", - "pin-utils", "slab", ] @@ -1328,9 +1333,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" dependencies = [ "cfg-if", "js-sys", @@ -1348,11 +1353,24 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi", + "r-efi 5.3.0", "wasip2", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "wasip2", + "wasip3", +] + [[package]] name = "glob" version = "0.3.3" @@ -1371,7 +1389,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.12", - "indexmap 2.12.0", + "indexmap 2.13.0", "slab", "tokio", "tokio-util", @@ -1380,17 +1398,17 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c0b69cfcb4e1b9f1bf2f53f95f766e4661169728ec61cd3fe5a0166f2d1386" +checksum = "2f44da3a8150a6703ed5d34e164b875fd14c2cdab9af1252a9a1020bde2bdc54" dependencies = [ "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "http 1.3.1", - "indexmap 2.12.0", + "http 1.4.0", + "indexmap 2.13.0", "slab", "tokio", "tokio-util", @@ -1418,9 +1436,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.16.0" +version = "0.15.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" [[package]] name = "hashlink" @@ -1489,12 +1516,11 @@ dependencies = [ [[package]] name = "http" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" dependencies = [ "bytes", - "fnv", "itoa", ] @@ -1516,7 +1542,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http 1.3.1", + "http 1.4.0", ] [[package]] @@ -1527,7 +1553,7 @@ checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", "futures-core", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "pin-project-lite", ] @@ -1578,8 +1604,8 @@ dependencies = [ "bytes", "futures-channel", "futures-core", - "h2 0.4.12", - "http 1.3.1", + "h2 0.4.13", + "http 1.4.0", "http-body 1.0.1", "httparse", "httpdate", @@ -1611,15 +1637,15 @@ version = "0.27.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" dependencies = [ - "http 1.3.1", + "http 1.4.0", "hyper 1.8.1", "hyper-util", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-pki-types", "tokio", "tokio-rustls 0.26.4", "tower-service", - "webpki-roots 1.0.4", + "webpki-roots 1.0.6", ] [[package]] @@ -1649,23 +1675,22 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52e9a2a24dc5c6821e71a7030e1e14b7b632acac55c40e9d2e082c621261bb56" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" dependencies = [ "base64 0.22.1", "bytes", "futures-channel", - "futures-core", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "hyper 1.8.1", "ipnet", "libc", "percent-encoding", "pin-project-lite", - "socket2 0.5.10", + "socket2 0.6.3", "tokio", "tower-service", "tracing", @@ -1673,9 +1698,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.64" +version = "0.1.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1743,9 +1768,9 @@ checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" [[package]] name = "icu_properties" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e93fcd3157766c0c8da2f8cff6ce651a31f0810eaa1c51ec363ef790bbb5fb99" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" dependencies = [ "icu_collections", "icu_locale_core", @@ -1757,9 +1782,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "2.1.1" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02845b3647bb045f1100ecd6480ff52f34c35f82d9880e029d329c21d1054899" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" [[package]] name = "icu_provider" @@ -1776,6 +1801,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + [[package]] name = "ident_case" version = "1.0.1" @@ -1831,12 +1862,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.12.0" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" dependencies = [ "equivalent", - "hashbrown 0.16.0", + "hashbrown 0.16.1", "serde", "serde_core", ] @@ -1864,24 +1895,24 @@ dependencies = [ [[package]] name = "inventory" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +checksum = "009ae045c87e7082cb72dab0ccd01ae075dd00141ddc108f43a0ea150a9e7227" dependencies = [ "rustversion", ] [[package]] name = "ipnet" -version = "2.11.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" [[package]] name = "iri-string" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f867b9d1d896b67beb18518eda36fdb77a32ea590de864f1325b294a6d14397" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" dependencies = [ "memchr", "serde", @@ -1913,15 +1944,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" [[package]] name = "js-sys" -version = "0.3.82" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" dependencies = [ "once_cell", "wasm-bindgen", @@ -1940,9 +1971,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" dependencies = [ "cpufeatures", ] @@ -1988,27 +2019,34 @@ dependencies = [ "spin", ] +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + [[package]] name = "libc" -version = "0.2.177" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2874a2af47a2325c2001a6e6fad9b16a53b802102b528163885171cf92b15976" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libm" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "libredox" -version = "0.1.10" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "416f7e718bdb06000964960ffa43b4335ad4012ae8b99060261aa4a8088d5ccb" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "libc", - "redox_syscall 0.5.18", + "plain", + "redox_syscall 0.7.3", ] [[package]] @@ -2024,9 +2062,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" [[package]] name = "litemap" @@ -2045,9 +2083,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.28" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34080505efa8e45a4b816c349525ebe327ceaa8559756f0356cba97ef3bf7432" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lru-slab" @@ -2082,9 +2120,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.6" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" [[package]] name = "mime" @@ -2111,9 +2149,9 @@ dependencies = [ [[package]] name = "mio" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" dependencies = [ "libc", "wasi", @@ -2243,7 +2281,7 @@ checksum = "10a8a7f5f6ba7c1b286c2fbca0454eaba116f63bbe69ed250b642d36fbb04d80" dependencies = [ "async-trait", "bytes", - "http 1.3.1", + "http 1.4.0", "opentelemetry", "reqwest", ] @@ -2256,7 +2294,7 @@ checksum = "91cf61a1868dacc576bf2b2a1c3e9ab150af7272909e80085c3173384fe11f76" dependencies = [ "async-trait", "futures-core", - "http 1.3.1", + "http 1.4.0", "opentelemetry", "opentelemetry-http", "opentelemetry-proto", @@ -2384,7 +2422,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset 0.4.2", - "indexmap 2.12.0", + "indexmap 2.13.0", ] [[package]] @@ -2394,7 +2432,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" dependencies = [ "fixedbitset 0.5.7", - "indexmap 2.12.0", + "indexmap 2.13.0", ] [[package]] @@ -2414,29 +2452,29 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +checksum = "f1749c7ed4bcaf4c3d0a3efc28538844fb29bcdd7d2b67b2be7e20ba861ff517" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.10" +version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +checksum = "d9b20ed30f105399776b9c883e68e536ef602a16ae6f596d2c473591d6ad64c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "pin-project-lite" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pin-utils" @@ -2471,6 +2509,12 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + [[package]] name = "pluralizer" version = "0.5.0" @@ -2529,23 +2573,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" dependencies = [ "proc-macro2", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "proc-macro-crate" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" dependencies = [ "toml_edit", ] [[package]] name = "proc-macro2" -version = "1.0.103" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ "unicode-ident", ] @@ -2587,7 +2631,7 @@ dependencies = [ "prost 0.12.6", "prost-types", "regex", - "syn 2.0.110", + "syn 2.0.117", "tempfile", ] @@ -2601,7 +2645,7 @@ dependencies = [ "itertools 0.12.1", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -2611,10 +2655,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.14.0", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -2714,9 +2758,9 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.35", - "socket2 0.5.10", - "thiserror 2.0.17", + "rustls 0.23.37", + "socket2 0.6.3", + "thiserror 2.0.18", "tokio", "tracing", "web-time", @@ -2724,9 +2768,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" dependencies = [ "bytes", "getrandom 0.3.4", @@ -2734,10 +2778,10 @@ dependencies = [ "rand 0.9.2", "ring", "rustc-hash", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-pki-types", "slab", - "thiserror 2.0.17", + "thiserror 2.0.18", "tinyvec", "tracing", "web-time", @@ -2752,16 +2796,16 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.10", + "socket2 0.6.3", "tracing", "windows-sys 0.60.2", ] [[package]] name = "quote" -version = "1.0.42" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -2772,6 +2816,12 @@ version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + [[package]] name = "radium" version = "0.7.0" @@ -2796,7 +2846,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha 0.9.0", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -2816,7 +2866,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core 0.9.3", + "rand_core 0.9.5", ] [[package]] @@ -2825,14 +2875,14 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.16", + "getrandom 0.2.17", ] [[package]] name = "rand_core" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" dependencies = [ "getrandom 0.3.4", ] @@ -2861,7 +2911,16 @@ version = "0.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", +] + +[[package]] +name = "redox_syscall" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce70a74e890531977d37e532c34d45e9055d2409ed08ddba14529471ed0be16" +dependencies = [ + "bitflags 2.11.0", ] [[package]] @@ -2881,14 +2940,14 @@ checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "regex" -version = "1.12.2" +version = "1.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" dependencies = [ "aho-corasick", "memchr", @@ -2898,9 +2957,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" dependencies = [ "aho-corasick", "memchr", @@ -2909,9 +2968,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" [[package]] name = "rend" @@ -2924,16 +2983,16 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.24" +version = "0.12.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0946410b9f7b082a427e4ef5c8ff541a88b357bc6c637c40db3a68ac70a36f" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" dependencies = [ "base64 0.22.1", "bytes", "futures-channel", "futures-core", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "http-body-util", "hyper 1.8.1", @@ -2944,7 +3003,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-pki-types", "serde", "serde_json", @@ -2952,14 +3011,14 @@ dependencies = [ "sync_wrapper 1.0.2", "tokio", "tokio-rustls 0.26.4", - "tower 0.5.2", + "tower 0.5.3", "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 1.0.4", + "webpki-roots 1.0.6", ] [[package]] @@ -2970,7 +3029,7 @@ checksum = "562ceb5a604d3f7c885a792d42c199fd8af239d0a51b2fa6a78aafa092452b04" dependencies = [ "anyhow", "async-trait", - "http 1.3.1", + "http 1.4.0", "reqwest", "serde", "thiserror 1.0.69", @@ -2987,8 +3046,8 @@ dependencies = [ "async-trait", "chrono", "futures", - "getrandom 0.2.16", - "http 1.3.1", + "getrandom 0.2.17", + "http 1.4.0", "hyper 1.8.1", "parking_lot 0.11.2", "reqwest", @@ -3018,7 +3077,7 @@ checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", "cfg-if", - "getrandom 0.2.16", + "getrandom 0.2.17", "libc", "untrusted", "windows-sys 0.52.0", @@ -3055,9 +3114,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a0376c50d0358279d9d643e4bf7b7be212f1f4ff1da9070a7b54d22ef75c88" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" dependencies = [ "const-oid", "digest", @@ -3075,9 +3134,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.39.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35affe401787a9bd846712274d97654355d21b2a2c092a3139aabe31e9022282" +checksum = "61f703d19852dbf87cbc513643fa81428361eb6940f1ac14fd58155d295a3eb0" dependencies = [ "arrayvec", "borsh", @@ -3091,12 +3150,12 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.39.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8c0cb48f413ebe24dc2d148788e0efbe09ba3e011d9277162f2eaf8e1069a3" +checksum = "74a5a6f027e892c7a035c6fddb50435a1fbf5a734ffc0c2a9fed4d0221440519" dependencies = [ "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -3107,11 +3166,11 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "1.1.2" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd15f8a2c5551a84d56efdc1cd049089e409ac19a3072d5037a17fd70719ff3e" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "errno", "libc", "linux-raw-sys", @@ -3132,14 +3191,14 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.8", + "rustls-webpki 0.103.9", "subtle", "zeroize", ] @@ -3164,9 +3223,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.13.0" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94182ad936a0c91c324cd46c6511b9510ed16af436d7b5bab34beab0afd55f7a" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" dependencies = [ "web-time", "zeroize", @@ -3184,9 +3243,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.8" +version = "0.103.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" dependencies = [ "ring", "rustls-pki-types", @@ -3201,19 +3260,18 @@ checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "rusty-money" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b28f881005eac7ad8d46b6f075da5f322bd7f4f83a38720fc069694ddadd683" +checksum = "08cda49b2c0126c2672b3886d66552ce3bfa47a9bd4473a5c53acd061270bc17" dependencies = [ "rust_decimal", - "rust_decimal_macros", ] [[package]] name = "ryu" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" [[package]] name = "same-file" @@ -3247,9 +3305,9 @@ dependencies = [ [[package]] name = "schemars" -version = "1.1.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc" dependencies = [ "dyn-clone", "ref-cast", @@ -3306,6 +3364,12 @@ dependencies = [ "cc", ] +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + [[package]] name = "serde" version = "1.0.228" @@ -3333,20 +3397,20 @@ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "serde_json" -version = "1.0.145" +version = "1.0.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" dependencies = [ "itoa", "memchr", - "ryu", "serde", "serde_core", + "zmij", ] [[package]] @@ -3363,17 +3427,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10574371d41b0d9b2cff89418eda27da52bcaff2cc8741db26382a77c29131f1" +checksum = "381b283ce7bc6b476d903296fb59d0d36633652b633b27f64db4fb46dcbfc3b9" dependencies = [ "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.12.0", + "indexmap 2.13.0", "schemars 0.9.0", - "schemars 1.1.0", + "schemars 1.2.1", "serde_core", "serde_json", "serde_with_macros", @@ -3382,14 +3446,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.16.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a72d8216842fdd57820dc78d840bef99248e35fb2554ff923319e60f2d686b" +checksum = "a6d4e30573c8cb306ed6ab1dca8423eec9a463ea0e155f45399455e0368b27e0" dependencies = [ "darling 0.21.3", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -3398,7 +3462,7 @@ version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ - "indexmap 2.12.0", + "indexmap 2.13.0", "itoa", "ryu", "serde", @@ -3407,11 +3471,12 @@ dependencies = [ [[package]] name = "serial_test" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b258109f244e1d6891bf1053a55d63a5cd4f8f4c30cf9a1280989f80e7a1fa9" +checksum = "911bd979bf1070a3f3aa7b691a3b3e9968f339ceeec89e08c280a8a22207a32f" dependencies = [ - "futures", + "futures-executor", + "futures-util", "log", "once_cell", "parking_lot 0.12.5", @@ -3421,13 +3486,13 @@ dependencies = [ [[package]] name = "serial_test_derive" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d69265a08751de7844521fd15003ae0a888e035773ba05695c5c759a6f89eef" +checksum = "0a7d91949b85b0d2fb687445e448b40d322b6b3e4af6b44a29b21d9a5f33e6d9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -3479,10 +3544,11 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.6" +version = "1.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2a4719bff48cee6b39d12c020eeb490953ad2443b7055bd0b21fca26bd8c28b" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" dependencies = [ + "errno", "libc", ] @@ -3504,9 +3570,9 @@ checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "siphasher" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" [[package]] name = "sized-chunks" @@ -3520,9 +3586,9 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "sled" @@ -3561,12 +3627,12 @@ dependencies = [ [[package]] name = "socket2" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -3633,14 +3699,14 @@ dependencies = [ "hashbrown 0.14.5", "hashlink", "hex", - "indexmap 2.12.0", + "indexmap 2.13.0", "log", "memchr", "once_cell", "paste", "percent-encoding", "rust_decimal", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-pemfile 2.2.0", "serde", "serde_json", @@ -3714,7 +3780,7 @@ dependencies = [ "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -3737,7 +3803,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.110", + "syn 2.0.117", "tempfile", "tokio", "url", @@ -3751,7 +3817,7 @@ checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.10.0", + "bitflags 2.11.0", "byteorder", "bytes", "chrono", @@ -3796,7 +3862,7 @@ checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" dependencies = [ "atoi", "base64 0.22.1", - "bitflags 2.10.0", + "bitflags 2.11.0", "byteorder", "chrono", "crc", @@ -3935,9 +4001,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.110" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a99801b5bd34ede4cf3fc688c5919368fea4e4814a4664359503e6015b280aea" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -3967,7 +4033,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -3978,12 +4044,12 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.23.0" +version = "3.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.2", "once_cell", "rustix", "windows-sys 0.61.2", @@ -3991,9 +4057,9 @@ dependencies = [ [[package]] name = "term" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2111ef44dae28680ae9752bb89409e7310ca33a8c621ebe7b106cf5c928b3ac0" +checksum = "d8c27177b12a6399ffc08b98f76f7c9a1f4fe9fc967c784c5a071fa8d93cf7e1" dependencies = [ "windows-sys 0.61.2", ] @@ -4009,11 +4075,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl 2.0.17", + "thiserror-impl 2.0.18", ] [[package]] @@ -4024,18 +4090,18 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4105,9 +4171,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.48.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" dependencies = [ "bytes", "libc", @@ -4115,7 +4181,7 @@ dependencies = [ "parking_lot 0.12.5", "pin-project-lite", "signal-hook-registry", - "socket2 0.6.1", + "socket2 0.6.3", "tokio-macros", "windows-sys 0.61.2", ] @@ -4132,13 +4198,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4157,15 +4223,15 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.35", + "rustls 0.23.37", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +checksum = "32da49809aab5c3bc678af03902d4ccddea2a87d028d86392a4b1560c6906c70" dependencies = [ "futures-core", "pin-project-lite", @@ -4175,9 +4241,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.17" +version = "0.7.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2efa149fe76073d6e8fd97ef4f4eca7b67f599660115591483572e406e165594" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" dependencies = [ "bytes", "futures-core", @@ -4188,20 +4254,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.7.3" +version = "1.0.0+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cdb639ebbc97961c51720f858597f7f24c4fc295327923af55b74c3c724533" +checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" dependencies = [ "serde_core", ] [[package]] name = "toml_edit" -version = "0.23.7" +version = "0.25.4+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6485ef6d0d9b5d0ec17244ff7eb05310113c3f316f2d14200d4de56b3cb98f8d" +checksum = "7193cbd0ce53dc966037f54351dbbcf0d5a642c7f0038c382ef9e677ce8c13f2" dependencies = [ - "indexmap 2.12.0", + "indexmap 2.13.0", "toml_datetime", "toml_parser", "winnow", @@ -4209,9 +4275,9 @@ dependencies = [ [[package]] name = "toml_parser" -version = "1.0.4" +version = "1.0.9+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0cbe268d35bdb4bb5a56a2de88d0ad0eb70af5384a99d648cd4b3d04039800e" +checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" dependencies = [ "winnow", ] @@ -4284,8 +4350,8 @@ dependencies = [ "axum 0.7.9", "base64 0.22.1", "bytes", - "h2 0.4.12", - "http 1.3.1", + "h2 0.4.13", + "http 1.4.0", "http-body 1.0.1", "http-body-util", "hyper 1.8.1", @@ -4313,7 +4379,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4326,7 +4392,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4364,9 +4430,9 @@ dependencies = [ [[package]] name = "tower" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" dependencies = [ "futures-core", "futures-util", @@ -4379,18 +4445,18 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" dependencies = [ - "bitflags 2.10.0", + "bitflags 2.11.0", "bytes", "futures-util", - "http 1.3.1", + "http 1.4.0", "http-body 1.0.1", "iri-string", "pin-project-lite", - "tower 0.5.2", + "tower 0.5.3", "tower-layer", "tower-service", ] @@ -4409,9 +4475,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.41" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" dependencies = [ "log", "pin-project-lite", @@ -4421,20 +4487,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] name = "tracing-core" -version = "0.1.34" +version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" dependencies = [ "once_cell", "valuable", @@ -4481,9 +4547,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.20" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" +checksum = "2f30143827ddab0d256fd843b7a66d164e9f271cfa0dde49142c5ca0ca291f1e" dependencies = [ "matchers", "nu-ansi-term", @@ -4539,7 +4605,7 @@ checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4550,9 +4616,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.22" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-normalization" @@ -4611,9 +4677,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.7" +version = "2.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08bc136a29a3d1758e07a9cca267be308aeebf5cfd5a10f3f67ab2097683ef5b" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" dependencies = [ "form_urlencoded", "idna", @@ -4635,13 +4701,13 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.18.1" +version = "1.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f87b8aa10b915a06587d0dec516c282ff295b475d94abf425d62b57710070a2" +checksum = "a68d3c8f01c0cfa54a75291d83601161799e4a89a39e0929f4b0354d88757a37" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.2", "js-sys", - "serde", + "serde_core", "wasm-bindgen", ] @@ -4690,9 +4756,18 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasip2" -version = "1.0.1+wasi-0.2.4" +version = "1.0.2+wasi-0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0562428422c63773dad2c345a1882263bbf4d65cf3f42e90921f787ef5ad58e7" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" dependencies = [ "wit-bindgen", ] @@ -4705,9 +4780,9 @@ checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" [[package]] name = "wasm-bindgen" -version = "0.2.105" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" dependencies = [ "cfg-if", "once_cell", @@ -4718,11 +4793,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.55" +version = "0.4.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551f88106c6d5e7ccc7cd9a16f312dd3b5d36ea8b4954304657d5dfba115d4a0" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" dependencies = [ "cfg-if", + "futures-util", "js-sys", "once_cell", "wasm-bindgen", @@ -4731,9 +4807,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.105" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4741,26 +4817,48 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.105" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.105" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" dependencies = [ "unicode-ident", ] +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap 2.13.0", + "wasm-encoder", + "wasmparser", +] + [[package]] name = "wasm-timer" version = "0.2.5" @@ -4776,11 +4874,23 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags 2.11.0", + "hashbrown 0.15.5", + "indexmap 2.13.0", + "semver", +] + [[package]] name = "web-sys" -version = "0.3.82" +version = "0.3.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" dependencies = [ "js-sys", "wasm-bindgen", @@ -4821,14 +4931,14 @@ version = "0.26.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" dependencies = [ - "webpki-roots 1.0.4", + "webpki-roots 1.0.6", ] [[package]] name = "webpki-roots" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" dependencies = [ "rustls-pki-types", ] @@ -4895,7 +5005,7 @@ checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -4906,7 +5016,7 @@ checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -5157,18 +5267,100 @@ checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" [[package]] name = "winnow" -version = "0.7.13" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" dependencies = [ "memchr", ] [[package]] name = "wit-bindgen" -version = "0.46.0" +version = "0.51.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f17a85883d4e6d00e8a97c586de764dabcc06133f7f1d55dce5cdc070ad7fe59" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap 2.13.0", + "prettyplease", + "syn 2.0.117", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn 2.0.117", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags 2.11.0", + "indexmap 2.13.0", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.13.0", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] [[package]] name = "writeable" @@ -5204,28 +5396,28 @@ checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", "synstructure", ] [[package]] name = "zerocopy" -version = "0.8.27" +version = "0.8.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" +checksum = "f2578b716f8a7a858b7f02d5bd870c14bf4ddbbcf3a4c05414ba6503640505e3" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.27" +version = "0.8.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" +checksum = "7e6cc098ea4d3bd6246687de65af3f920c430e236bee1e3bf2e441463f08a02f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] [[package]] @@ -5245,7 +5437,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", "synstructure", ] @@ -5285,5 +5477,11 @@ checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.110", + "syn 2.0.117", ] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml index b53b72e1..08f574ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bria" -version = "0.1.114" +version = "0.1.127-dev" edition = "2021" [features] diff --git a/flake.lock b/flake.lock index 07a70e5d..d9f789e0 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1771147098, - "narHash": "sha256-jpfPdBjKO232s5NueoNEvvVzpndiUzPLNYcH4/Ov0gY=", + "lastModified": 1773110118, + "narHash": "sha256-mPAG8phMbCReKSiKAijjjd3v7uVcJOQ75gSjGJjt/Rk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "e3cb16bccd9facebae3ba29c6a76a4cc1b73462a", + "rev": "e607cb5360ff1234862ac9f8839522becb853bb9", "type": "github" }, "original": { @@ -48,11 +48,11 @@ ] }, "locked": { - "lastModified": 1771211437, - "narHash": "sha256-lcNK438i4DGtyA+bPXXyVLHVmJjYpVKmpux9WASa3ro=", + "lastModified": 1773216618, + "narHash": "sha256-iZlowevS+xKLGOXtZwpIrz3SWe7PtoGUfEeVZNib+WE=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c62195b3d6e1bb11e0c2fb2a494117d3b55d410f", + "rev": "07d7dc6fcc5eae76b4fb0e19d4afd939437bec97", "type": "github" }, "original": { From 899b798c3df5aa66188dfc231ce6b223a5c7b02c Mon Sep 17 00:00:00 2001 From: Juan P Lopez Date: Wed, 11 Mar 2026 10:37:39 -0500 Subject: [PATCH 65/65] fix(migrations): reorder post-rebase migrations after 20260309133000 --- ...260310100000_add_created_at_to_signing_sessions.down.sql} | 0 ...20260310100000_add_created_at_to_signing_sessions.up.sql} | 0 ...0_add_account_id_to_initialized_event_in_payout.down.sql} | 0 ...100_add_account_id_to_initialized_event_in_payout.up.sql} | 0 ...own.sql => 20260310100200_add_context_to_events.down.sql} | 0 ...ts.up.sql => 20260310100200_add_context_to_events.up.sql} | 0 tests/application_errors.rs | 5 +++-- 7 files changed, 3 insertions(+), 2 deletions(-) rename migrations/{20250701103237_add_created_at_to_signing_sessions.down.sql => 20260310100000_add_created_at_to_signing_sessions.down.sql} (100%) rename migrations/{20250701103237_add_created_at_to_signing_sessions.up.sql => 20260310100000_add_created_at_to_signing_sessions.up.sql} (100%) rename migrations/{20250717092604_add_account_id_to_initialized_event_in_payout.down.sql => 20260310100100_add_account_id_to_initialized_event_in_payout.down.sql} (100%) rename migrations/{20250717092604_add_account_id_to_initialized_event_in_payout.up.sql => 20260310100100_add_account_id_to_initialized_event_in_payout.up.sql} (100%) rename migrations/{20250909142749_add_context_to_events.down.sql => 20260310100200_add_context_to_events.down.sql} (100%) rename migrations/{20250909142749_add_context_to_events.up.sql => 20260310100200_add_context_to_events.up.sql} (100%) diff --git a/migrations/20250701103237_add_created_at_to_signing_sessions.down.sql b/migrations/20260310100000_add_created_at_to_signing_sessions.down.sql similarity index 100% rename from migrations/20250701103237_add_created_at_to_signing_sessions.down.sql rename to migrations/20260310100000_add_created_at_to_signing_sessions.down.sql diff --git a/migrations/20250701103237_add_created_at_to_signing_sessions.up.sql b/migrations/20260310100000_add_created_at_to_signing_sessions.up.sql similarity index 100% rename from migrations/20250701103237_add_created_at_to_signing_sessions.up.sql rename to migrations/20260310100000_add_created_at_to_signing_sessions.up.sql diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql b/migrations/20260310100100_add_account_id_to_initialized_event_in_payout.down.sql similarity index 100% rename from migrations/20250717092604_add_account_id_to_initialized_event_in_payout.down.sql rename to migrations/20260310100100_add_account_id_to_initialized_event_in_payout.down.sql diff --git a/migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql b/migrations/20260310100100_add_account_id_to_initialized_event_in_payout.up.sql similarity index 100% rename from migrations/20250717092604_add_account_id_to_initialized_event_in_payout.up.sql rename to migrations/20260310100100_add_account_id_to_initialized_event_in_payout.up.sql diff --git a/migrations/20250909142749_add_context_to_events.down.sql b/migrations/20260310100200_add_context_to_events.down.sql similarity index 100% rename from migrations/20250909142749_add_context_to_events.down.sql rename to migrations/20260310100200_add_context_to_events.down.sql diff --git a/migrations/20250909142749_add_context_to_events.up.sql b/migrations/20260310100200_add_context_to_events.up.sql similarity index 100% rename from migrations/20250909142749_add_context_to_events.up.sql rename to migrations/20260310100200_add_context_to_events.up.sql diff --git a/tests/application_errors.rs b/tests/application_errors.rs index 6bc9d9d5..e9344974 100644 --- a/tests/application_errors.rs +++ b/tests/application_errors.rs @@ -1,5 +1,6 @@ mod helpers; +use es_entity::EsEntityError; use rand::distributions::{Alphanumeric, DistString}; use bria::{ @@ -93,7 +94,7 @@ async fn payout_queue_id_not_found() -> anyhow::Result<()> { assert!(matches!( err, Err(ApplicationError::PayoutQueueError( - PayoutQueueError::PayoutQueueIdNotFound(_) + PayoutQueueError::EsEntityError(EsEntityError::NotFound) )) )); Ok(()) @@ -141,7 +142,7 @@ async fn payout_queue_name_not_found() -> anyhow::Result<()> { assert!(matches!( err, Err(ApplicationError::PayoutQueueError( - PayoutQueueError::PayoutQueueNameNotFound(_) + PayoutQueueError::EsEntityError(EsEntityError::NotFound) )) ));