From 6349c100fda5b3614b0da737a9d6d7478248ff1d Mon Sep 17 00:00:00 2001 From: cezary-stroczynski Date: Tue, 27 Jan 2026 15:23:33 +0100 Subject: [PATCH] Extract ow_wallet from owen into separate lib --- Cargo.lock | 409 +++++++++++--------- Cargo.toml | 2 + aws/blobs_batch_sender/Cargo.toml | 1 + aws/blobs_batch_sender/src/event_handler.rs | 12 +- aws/blobs_batch_sender/src/lib.rs | 4 +- ow_wallet/Cargo.toml | 14 + owen/src/wallet.rs => ow_wallet/src/lib.rs | 45 +-- owen/Cargo.toml | 1 + owen/src/contracts.rs | 8 +- owen/src/ipfs.rs | 10 +- owen/src/lib.rs | 26 +- owen/src/output_generator.rs | 14 +- 12 files changed, 301 insertions(+), 245 deletions(-) create mode 100644 ow_wallet/Cargo.toml rename owen/src/wallet.rs => ow_wallet/src/lib.rs (85%) diff --git a/Cargo.lock b/Cargo.lock index db33a9d..2c52abe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -29,13 +29,13 @@ dependencies = [ "actix-rt", "actix-service", "actix-utils", - "base64 0.22.1", + "base64", "bitflags 2.9.1", "bytes", "bytestring", "derive_more 2.0.1", "encoding_rs", - "foldhash", + "foldhash 0.1.5", "futures-core", "http 0.2.12", "httparse", @@ -133,7 +133,7 @@ dependencies = [ "cfg-if", "derive_more 2.0.1", "encoding_rs", - "foldhash", + "foldhash 0.1.5", "futures-core", "futures-util", "impl-more", @@ -253,9 +253,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36f63701831729cb154cf0b6945256af46c426074646c98b9d123148ba1d8bde" +checksum = "2b5033b86af2c64e1b29b8446b7b6c48a0094ccea0b5c408111b6d218c418894" dependencies = [ "alloy-consensus", "alloy-contract", @@ -290,9 +290,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a3bd0305a44fb457cae77de1e82856eadd42ea3cdf0dae29df32eb3b592979" +checksum = "ed1958f0294ecc05ebe7b3c9a8662a3e221c2523b7f2bcd94c7a651efbd510bf" dependencies = [ "alloy-eips", "alloy-primitives", @@ -301,6 +301,7 @@ dependencies = [ "alloy-trie", "alloy-tx-macros", "auto_impl", + "borsh", "c-kzg", "derive_more 2.0.1", "either", @@ -309,15 +310,16 @@ dependencies = [ "rand 0.8.5", "secp256k1", "serde", + "serde_json", "serde_with", "thiserror 2.0.12", ] [[package]] name = "alloy-consensus-any" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a842b4023f571835e62ac39fb8d523d19fcdbacfa70bf796ff96e7e19586f50" +checksum = "f752e99497ddc39e22d547d7dfe516af10c979405a034ed90e69b914b7dddeae" dependencies = [ "alloy-consensus", "alloy-eips", @@ -329,9 +331,9 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "591104333286b52b03ec4e8162983e31122b318d21ae2b0900d1e8b51727ad40" +checksum = "f2140796bc79150b1b7375daeab99750f0ff5e27b1f8b0aa81ccde229c7f02a2" dependencies = [ "alloy-consensus", "alloy-dyn-abi", @@ -352,9 +354,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "1.3.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d47400608fc869727ad81dba058d55f97b29ad8b5c5256d9598523df8f356ab6" +checksum = "9d4087016b0896051dd3d03e0bedda2f4d4d1689af8addc8450288c63a9e5f68" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -365,9 +367,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "1.3.0" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9e8a436f0aad7df8bb47f144095fba61202265d9f5f09a70b0e3227881a668e" +checksum = "369f5707b958927176265e8a58627fc6195e5dfa5c55689396e68b241b3a72e6" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -394,41 +396,57 @@ dependencies = [ [[package]] name = "alloy-eip2930" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd" +checksum = "9441120fa82df73e8959ae0e4ab8ade03de2aaae61be313fbf5746277847ce25" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "serde", ] [[package]] name = "alloy-eip7702" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" +checksum = "2919c5a56a1007492da313e7a3b6d45ef5edc5d33416fdec63c0d7a2702a0d20" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "k256", "serde", "thiserror 2.0.12", ] +[[package]] +name = "alloy-eip7928" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3231de68d5d6e75332b7489cfcc7f4dfabeba94d990a10e4b923af0e6623540" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "borsh", + "serde", +] + [[package]] name = "alloy-eips" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cd749c57f38f8cbf433e651179fc5a676255e6b95044f467d49255d2b81725a" +checksum = "813a67f87e56b38554d18b182616ee5006e8e2bf9df96a0df8bf29dff1d52e3f" dependencies = [ "alloy-eip2124", "alloy-eip2930", "alloy-eip7702", + "alloy-eip7928", "alloy-primitives", "alloy-rlp", "alloy-serde", "auto_impl", + "borsh", "c-kzg", "derive_more 2.0.1", "either", @@ -440,23 +458,24 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d32cbf6c26d7d87e8a4e5925bbce41456e0bbeed95601add3443af277cd604e" +checksum = "05864eef929c4d28895ae4b4d8ac9c6753c4df66e873b9c8fafc8089b59c1502" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-serde", "alloy-trie", + "borsh", "serde", "serde_with", ] [[package]] name = "alloy-json-abi" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125a1c373261b252e53e04d6e92c37d881833afc1315fceab53fd46045695640" +checksum = "84e3cf01219c966f95a460c95f1d4c30e12f6c18150c21a30b768af2a2a29142" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -466,9 +485,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f614019a029c8fec14ae661aa7d4302e6e66bdbfb869dab40e78dcfba935fc97" +checksum = "d2dd146b3de349a6ffaa4e4e319ab3a90371fb159fb0bddeb1c7bbe8b1792eff" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -481,9 +500,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8b6d58e98803017bbfea01dde96c4d270a29e7aed3beb65c8d28b5ab464e0e" +checksum = "8c12278ffbb8872dfba3b2f17d8ea5e8503c2df5155d9bc5ee342794bde505c3" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -507,9 +526,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db489617bffe14847bf89f175b1c183e5dd7563ef84713936e2c34255cfbd845" +checksum = "833037c04917bc2031541a60e8249e4ab5500e24c637c1c62e95e963a655d66f" dependencies = [ "alloy-consensus", "alloy-eips", @@ -520,17 +539,17 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc9485c56de23438127a731a6b4c87803d49faf1a7068dcd1d8768aca3a9edb9" +checksum = "f6a0fb18dd5fb43ec5f0f6a20be1ce0287c79825827de5744afaa6c957737c33" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", "derive_more 2.0.1", - "foldhash", - "hashbrown 0.15.4", + "foldhash 0.2.0", + "hashbrown 0.16.1", "indexmap 2.10.0", "itoa", "k256", @@ -538,6 +557,7 @@ dependencies = [ "paste", "proptest", "rand 0.9.2", + "rapidhash", "ruint", "rustc-hash 2.1.1", "serde", @@ -547,9 +567,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed90278374435e076a04dbddbb6d714bdd518eb274a64dbd70f65701429dd747" +checksum = "eafa840b0afe01c889a3012bb2fde770a544f74eab2e2870303eb0a5fb869c48" dependencies = [ "alloy-chains", "alloy-consensus", @@ -578,7 +598,7 @@ dependencies = [ "either", "futures", "futures-utils-wasm", - "lru 0.13.0", + "lru 0.16.3", "parking_lot", "pin-project", "reqwest", @@ -593,9 +613,9 @@ dependencies = [ [[package]] name = "alloy-pubsub" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f539a4caaa5496ad54af38f5615adb54cc7b3ec1a42e530e706291cce074f4a" +checksum = "57b3a3b3e4efc9f4d30e3326b6bd6811231d16ef94837e18a802b44ca55119e6" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -637,9 +657,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33732242ca63f107f5f8284190244038905fb233280f4b7c41f641d4f584d40d" +checksum = "12768ae6303ec764905a8a7cd472aea9072f9f9c980d18151e26913da8ae0123" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -663,9 +683,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2683049c5f3037d64722902e2c1081f3d45de68696aca0511bbea834905746" +checksum = "0622d8bcac2f16727590aa33f4c3f05ea98130e7e4b4924bce8be85da5ad0dae" dependencies = [ "alloy-primitives", "alloy-rpc-types-anvil", @@ -680,9 +700,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-anvil" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b757081f2a68e683de3731108494fa058036d5651bf10141ec2430bc1315c362" +checksum = "ae8eb0e5d6c48941b61ab76fabab4af66f7d88309a98aa14ad3dec7911c1eba3" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -692,9 +712,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-any" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18f27c0c41a16cd0af4f5dbf791f7be2a60502ca8b0e840e0ad29803fac2d587" +checksum = "a1cf5a093e437dfd62df48e480f24e1a3807632358aad6816d7a52875f1c04aa" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -703,9 +723,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-debug" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d46cb226f1c8071875f4d0d8a0eb3ac571fcc49cd3bcdc20a5818de7b6ef0634" +checksum = "925ff0f48c2169c050f0ae7a82769bdf3f45723d6742ebb6a5efb4ed2f491b26" dependencies = [ "alloy-primitives", "derive_more 2.0.1", @@ -715,9 +735,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-engine" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec35a39206f0e04e8544d763c9fe324cc01f74de8821ef4b61e25ac329682f9" +checksum = "336ef381c7409f23c69f6e79bddc1917b6e832cff23e7a5cf84b9381d53582e6" dependencies = [ "alloy-consensus", "alloy-eips", @@ -732,9 +752,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f5812f81c3131abc2cd8953dc03c41999e180cff7252abbccaba68676e15027" +checksum = "28e97603095020543a019ab133e0e3dc38cd0819f19f19bdd70c642404a54751" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -753,9 +773,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1070e7e92dae6a9c48885980f4f9ca9faa70f945fcd62fbb94472182ca08854f" +checksum = "f1aec4e1c66505d067933ea1a949a4fb60a19c4cfc2f109aa65873ea99e62ea8" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -767,9 +787,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-txpool" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f070754e160f6e34038305f472137eeb04170586d60d69c5d1e06fefe362a1f" +checksum = "25b73c1d6e4f1737a20d246dad5a0abd6c1b76ec4c3d153684ef8c6f1b6bb4f4" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -779,9 +799,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dfe41a47805a34b848c83448946ca96f3d36842e8c074bcf8fa0870e337d12" +checksum = "946a0d413dbb5cd9adba0de5f8a1a34d5b77deda9b69c1d7feed8fc875a1aa26" dependencies = [ "alloy-primitives", "serde", @@ -790,9 +810,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f79237b4c1b0934d5869deea4a54e6f0a7425a8cd943a739d6293afdf893d847" +checksum = "2f7481dc8316768f042495eaf305d450c32defbc9bce09d8bf28afcd956895bb" dependencies = [ "alloy-primitives", "async-trait", @@ -805,9 +825,9 @@ dependencies = [ [[package]] name = "alloy-signer-aws" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5cbc38711b7e5ee7b53a7489e8e718a54c6b138d382cfb86e293a2ad5ac894d" +checksum = "139b98be3eb3176f42f3bffafc4ef997b65b5b4c157ebc3013617054c0ef6964" dependencies = [ "alloy-consensus", "alloy-network", @@ -824,9 +844,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6e90a3858da59d1941f496c17db8d505f643260f7e97cdcdd33823ddca48fc1" +checksum = "1259dac1f534a4c66c1d65237c89915d0010a2a91d6c3b0bada24dc5ee0fb917" dependencies = [ "alloy-consensus", "alloy-network", @@ -840,9 +860,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d20d867dcf42019d4779519a1ceb55eba8d7f3d0e4f0a89bcba82b8f9eb01e48" +checksum = "09eb18ce0df92b4277291bbaa0ed70545d78b02948df756bbd3d6214bf39a218" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -854,9 +874,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74e91b0b553c115d14bd0ed41898309356dc85d0e3d4b9014c4e7715e48c8ad" +checksum = "95d9fa2daf21f59aa546d549943f10b5cce1ae59986774019fbedae834ffe01b" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -873,9 +893,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84194d31220803f5f62d0a00f583fd3a062b36382e2bea446f1af96727754565" +checksum = "9396007fe69c26ee118a19f4dee1f5d1d6be186ea75b3881adf16d87f8444686" dependencies = [ "alloy-json-abi", "const-hex", @@ -891,9 +911,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe8c27b3cf6b2bb8361904732f955bc7c05e00be5f469cec7e2280b6167f3ff0" +checksum = "af67a0b0dcebe14244fc92002cd8d96ecbf65db4639d479f5fcd5805755a4c27" dependencies = [ "serde", "winnow", @@ -901,9 +921,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5383d34ea00079e6dd89c652bcbdb764db160cef84e6250926961a0b2295d04" +checksum = "09aeea64f09a7483bdcd4193634c7e5cf9fd7775ee767585270cd8ce2d69dc95" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -913,14 +933,13 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb43750e137fe3a69a325cd89a8f8e2bbf4f83e70c0f60fbe49f22511ca075e8" +checksum = "78f169b85eb9334871db986e7eaf59c58a03d86a30cc68b846573d47ed0656bb" dependencies = [ "alloy-json-rpc", - "alloy-primitives", "auto_impl", - "base64 0.22.1", + "base64", "derive_more 2.0.1", "futures", "futures-utils-wasm", @@ -937,9 +956,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9b42c7d8b666eed975739201f407afc3320d3cd2e4d807639c2918fc736ea67" +checksum = "019821102e70603e2c141954418255bec539ef64ac4117f8e84fb493769acf73" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -952,9 +971,9 @@ dependencies = [ [[package]] name = "alloy-transport-ipc" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f07b920e2d4ec9b08cb12a32fa8e5e95dfcf706fe1d7f46453e24ee7089e29f0" +checksum = "e574ca2f490fb5961d2cdd78188897392c46615cd88b35c202d34bbc31571a81" dependencies = [ "alloy-json-rpc", "alloy-pubsub", @@ -972,15 +991,14 @@ dependencies = [ [[package]] name = "alloy-transport-ws" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83db1cc29cce5f692844d6cf1b6b270ae308219c5d90a7246a74f3479b9201c2" +checksum = "b92dea6996269769f74ae56475570e3586910661e037b7b52d50c9641f76c68f" dependencies = [ "alloy-pubsub", "alloy-transport", "futures", "http 1.3.1", - "rustls 0.23.31", "serde_json", "tokio", "tokio-tungstenite", @@ -990,9 +1008,9 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.9.0" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bada1fc392a33665de0dc50d401a3701b62583c655e3522a323490a5da016962" +checksum = "428aa0f0e0658ff091f8f667c406e034b431cb10abd39de4f507520968acc499" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -1006,11 +1024,10 @@ dependencies = [ [[package]] name = "alloy-tx-macros" -version = "1.0.32" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e434e0917dce890f755ea774f59d6f12557bc8c7dd9fa06456af80cfe0f0181e" +checksum = "45ceac797eb8a56bdf5ab1fab353072c17d472eab87645ca847afe720db3246d" dependencies = [ - "alloy-primitives", "darling 0.21.3", "proc-macro2", "quote", @@ -1559,9 +1576,9 @@ dependencies = [ [[package]] name = "aws-config" -version = "1.8.6" +version = "1.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc1b40fb26027769f16960d2f4a6bc20c4bb755d403e552c8c1a73af433c246" +checksum = "96571e6996817bf3d58f6b569e4b9fd2e9d2fcf9f7424eed07b2ce9bb87535e5" dependencies = [ "aws-credential-types", "aws-runtime", @@ -1589,9 +1606,9 @@ dependencies = [ [[package]] name = "aws-credential-types" -version = "1.2.10" +version = "1.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b01c9521fa01558f750d183c8c68c81b0155b9d193a4ba7f84c36bd1b6d04a06" +checksum = "3cd362783681b15d136480ad555a099e82ecd8e2d10a841e14dfd0078d67fee3" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -1624,9 +1641,9 @@ dependencies = [ [[package]] name = "aws-runtime" -version = "1.5.16" +version = "1.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ce527fb7e53ba9626fc47824f25e256250556c40d8f81d27dd92aa38239d632" +checksum = "959dab27ce613e6c9658eb3621064d0e2027e5f2acb65bc526a43577facea557" dependencies = [ "aws-credential-types", "aws-sigv4", @@ -1671,15 +1688,16 @@ dependencies = [ [[package]] name = "aws-sdk-kms" -version = "1.79.0" +version = "1.98.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5603bd5e0487e90acdef4a9be019f55c841e8eb72d3cb2e88c1c112c67a59db" +checksum = "50c74fef3d08159467cad98300f33a2e3bd1a985d527ad66ab0ea83c95e3a615" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", "aws-smithy-json", + "aws-smithy-observability", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -1771,15 +1789,16 @@ dependencies = [ [[package]] name = "aws-sdk-sso" -version = "1.83.0" +version = "1.92.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643cd43af212d2a1c4dedff6f044d7e1961e5d9e7cfe773d70f31d9842413886" +checksum = "b7d63bd2bdeeb49aa3f9b00c15e18583503b778b2e792fc06284d54e7d5b6566" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", "aws-smithy-json", + "aws-smithy-observability", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -1793,15 +1812,16 @@ dependencies = [ [[package]] name = "aws-sdk-ssooidc" -version = "1.84.0" +version = "1.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20ec4a95bd48e0db7a424356a161f8d87bd6a4f0af37204775f0da03d9e39fc3" +checksum = "532d93574bf731f311bafb761366f9ece345a0416dbcc273d81d6d1a1205239b" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", "aws-smithy-json", + "aws-smithy-observability", "aws-smithy-runtime", "aws-smithy-runtime-api", "aws-smithy-types", @@ -1815,15 +1835,16 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "1.85.0" +version = "1.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "410309ad0df4606bc721aff0d89c3407682845453247213a0ccc5ff8801ee107" +checksum = "357e9a029c7524db6a0099cd77fbd5da165540339e7296cca603531bc783b56c" dependencies = [ "aws-credential-types", "aws-runtime", "aws-smithy-async", "aws-smithy-http", "aws-smithy-json", + "aws-smithy-observability", "aws-smithy-query", "aws-smithy-runtime", "aws-smithy-runtime-api", @@ -1838,9 +1859,9 @@ dependencies = [ [[package]] name = "aws-sigv4" -version = "1.3.6" +version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35452ec3f001e1f2f6db107b6373f1f48f05ec63ba2c5c9fa91f07dad32af11" +checksum = "69e523e1c4e8e7e8ff219d732988e22bfeae8a1cafdbe6d9eca1546fa080be7c" dependencies = [ "aws-credential-types", "aws-smithy-eventstream", @@ -1866,9 +1887,9 @@ dependencies = [ [[package]] name = "aws-smithy-async" -version = "1.2.6" +version = "1.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "127fcfad33b7dfc531141fda7e1c402ac65f88aca5511a4d31e2e3d2cd01ce9c" +checksum = "9ee19095c7c4dda59f1697d028ce704c24b2d33c6718790c7f1d5a3015b4107c" dependencies = [ "futures-util", "pin-project-lite", @@ -1897,9 +1918,9 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.60.13" +version = "0.60.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e29a304f8319781a39808847efb39561351b1bb76e933da7aa90232673638658" +checksum = "dc12f8b310e38cad85cf3bef45ad236f470717393c613266ce0a89512286b650" dependencies = [ "aws-smithy-types", "bytes", @@ -1908,9 +1929,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.62.5" +version = "0.62.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445d5d720c99eed0b4aa674ed00d835d9b1427dd73e04adaf2f94c6b2d6f9fca" +checksum = "826141069295752372f8203c17f28e30c464d22899a43a0c9fd9c458d469c88b" dependencies = [ "aws-smithy-eventstream", "aws-smithy-runtime-api", @@ -1930,9 +1951,9 @@ dependencies = [ [[package]] name = "aws-smithy-http-client" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623254723e8dfd535f566ee7b2381645f8981da086b5c4aa26c0c41582bb1d2c" +checksum = "59e62db736db19c488966c8d787f52e6270be565727236fd5579eaa301e7bc4a" dependencies = [ "aws-smithy-async", "aws-smithy-runtime-api", @@ -1950,7 +1971,7 @@ dependencies = [ "pin-project-lite", "rustls 0.21.12", "rustls 0.23.31", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls 0.26.2", @@ -1960,27 +1981,27 @@ dependencies = [ [[package]] name = "aws-smithy-json" -version = "0.61.7" +version = "0.61.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2db31f727935fc63c6eeae8b37b438847639ec330a9161ece694efba257e0c54" +checksum = "49fa1213db31ac95288d981476f78d05d9cbb0353d22cdf3472cc05bb02f6551" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-observability" -version = "0.1.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d1881b1ea6d313f9890710d65c158bdab6fb08c91ea825f74c1c8c357baf4cc" +checksum = "ef1fcbefc7ece1d70dcce29e490f269695dfca2d2bacdeaf9e5c3f799e4e6a42" dependencies = [ "aws-smithy-runtime-api", ] [[package]] name = "aws-smithy-query" -version = "0.60.7" +version = "0.60.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2fbd61ceb3fe8a1cb7352e42689cec5335833cd9f94103a61e98f9bb61c64bb" +checksum = "ae5d689cf437eae90460e944a58b5668530d433b4ff85789e69d2f2a556e057d" dependencies = [ "aws-smithy-types", "urlencoding", @@ -1988,9 +2009,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime" -version = "1.9.4" +version = "1.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bbe9d018d646b96c7be063dd07987849862b0e6d07c778aad7d93d1be6c1ef0" +checksum = "bb5b6167fcdf47399024e81ac08e795180c576a20e4d4ce67949f9a88ae37dc1" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -2012,9 +2033,9 @@ dependencies = [ [[package]] name = "aws-smithy-runtime-api" -version = "1.9.2" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec7204f9fd94749a7c53b26da1b961b4ac36bf070ef1e0b94bb09f79d4f6c193" +checksum = "efce7aaaf59ad53c5412f14fc19b2d5c6ab2c3ec688d272fd31f76ec12f44fb0" dependencies = [ "aws-smithy-async", "aws-smithy-types", @@ -2029,9 +2050,9 @@ dependencies = [ [[package]] name = "aws-smithy-types" -version = "1.3.4" +version = "1.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f535879a207fce0db74b679cfc3e91a3159c8144d717d55f5832aea9eef46e" +checksum = "65f172bcb02424eb94425db8aed1b6d583b5104d4d5ddddf22402c661a320048" dependencies = [ "base64-simd", "bytes", @@ -2055,18 +2076,18 @@ dependencies = [ [[package]] name = "aws-smithy-xml" -version = "0.60.10" +version = "0.60.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db87b96cb1b16c024980f133968d52882ca0daaee3a086c6decc500f6c99728" +checksum = "11b2f670422ff42bf7065031e72b45bc52a3508bd089f743ea90731ca2b6ea57" dependencies = [ "xmlparser", ] [[package]] name = "aws-types" -version = "1.3.10" +version = "1.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79fb68e3d7fe5d4833ea34dc87d2e97d26d3086cb3da660bb6b1f76d98680b6" +checksum = "1d980627d2dd7bfc32a3c025685a033eeab8d365cc840c631ef59d1b8f428164" dependencies = [ "aws-credential-types", "aws-smithy-async", @@ -2082,7 +2103,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cd5d79ca6be17e6cdc157fccf22a0190a8c83ea0e04dc8a4429aea65627740" dependencies = [ - "base64 0.22.1", + "base64", "chrono", "serde", "serde_json", @@ -2136,12 +2157,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -2315,6 +2330,7 @@ dependencies = [ "aws-sdk-secretsmanager", "aws_lambda_events", "lambda_runtime", + "ow_wallet", "owen", "serde", "serde_json", @@ -3675,6 +3691,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "foreign-types" version = "0.3.2" @@ -4014,8 +4036,20 @@ checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash 0.2.0", "serde", + "serde_core", ] [[package]] @@ -4260,7 +4294,6 @@ dependencies = [ "hyper 0.14.32", "log", "rustls 0.21.12", - "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", ] @@ -4275,7 +4308,7 @@ dependencies = [ "hyper 1.6.0", "hyper-util", "rustls 0.23.31", - "rustls-native-certs 0.8.1", + "rustls-native-certs", "rustls-pki-types", "tokio", "tokio-rustls 0.26.2", @@ -4305,7 +4338,7 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "futures-channel", "futures-core", @@ -4763,7 +4796,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b155960b864ababcc5ab553c9336e46db8ed0ad1cd38dc3be9e7c37b177aa310" dependencies = [ "async-stream", - "base64 0.22.1", + "base64", "bytes", "futures", "http 1.3.1", @@ -4990,11 +5023,11 @@ dependencies = [ [[package]] name = "lru" -version = "0.13.0" +version = "0.16.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "227748d55f2f0ab4735d87fd623798cb6b664512fe979705f829c9f81c934465" +checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593" dependencies = [ - "hashbrown 0.15.4", + "hashbrown 0.16.1", ] [[package]] @@ -5621,6 +5654,20 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "ow_wallet" +version = "0.1.0" +dependencies = [ + "alloy", + "alloy-signer-aws", + "anyhow", + "aws-config", + "aws-sdk-kms", + "dotenvy", + "log", + "log_macros", +] + [[package]] name = "owen" version = "0.2.35" @@ -5645,6 +5692,7 @@ dependencies = [ "log", "log_macros", "once_cell", + "ow_wallet", "pretty_env_logger", "prover", "ravif 0.12.0", @@ -5845,7 +5893,7 @@ version = "1.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3af6b589e163c5a788fab00ce0c0366f6efbb9959c2f9874b224936af7fce7e1" dependencies = [ - "base64 0.22.1", + "base64", "indexmap 2.10.0", "quick-xml", "serde", @@ -6287,6 +6335,15 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rapidhash" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d8b5b858a440a0bc02625b62dd95131b9201aa9f69f411195dd4a7cfb1de3d7" +dependencies = [ + "rustversion", +] + [[package]] name = "rav1e" version = "0.7.1" @@ -6517,7 +6574,7 @@ version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ - "base64 0.22.1", + "base64", "bytes", "encoding_rs", "futures-channel", @@ -6996,13 +7053,14 @@ dependencies = [ [[package]] name = "ruint" -version = "1.15.0" +version = "1.17.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" dependencies = [ "alloy-rlp", "ark-ff 0.3.0", "ark-ff 0.4.2", + "ark-ff 0.5.0", "bytes", "fastrlp 0.3.1", "fastrlp 0.4.0", @@ -7016,7 +7074,7 @@ dependencies = [ "rand 0.9.2", "rlp", "ruint-macro", - "serde", + "serde_core", "valuable", "zeroize", ] @@ -7136,18 +7194,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-native-certs" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" -dependencies = [ - "openssl-probe", - "rustls-pemfile 1.0.4", - "schannel", - "security-framework 2.11.1", -] - [[package]] name = "rustls-native-certs" version = "0.8.1" @@ -7160,15 +7206,6 @@ dependencies = [ "security-framework 3.2.0", ] -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - [[package]] name = "rustls-pemfile" version = "2.2.0" @@ -7569,9 +7606,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ "serde_core", "serde_derive", @@ -7579,18 +7616,18 @@ dependencies = [ [[package]] name = "serde_core" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.225" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -7703,7 +7740,7 @@ version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" dependencies = [ - "base64 0.22.1", + "base64", "chrono", "hex", "indexmap 1.9.3", @@ -8015,9 +8052,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.3.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0b198d366dbec045acfcd97295eb653a7a2b40e4dc764ef1e79aafcad439d3c" +checksum = "5f92d01b5de07eaf324f7fca61cc6bd3d82bbc1de5b6c963e6fe79e86f36580d" dependencies = [ "paste", "proc-macro2", @@ -8665,12 +8702,12 @@ version = "3.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f0fde9bc91026e381155f8c67cb354bcd35260b2f4a29bcc84639f762760c39" dependencies = [ - "base64 0.22.1", + "base64", "der 0.7.10", "log", "native-tls", "percent-encoding", - "rustls-pemfile 2.2.0", + "rustls-pemfile", "rustls-pki-types", "ureq-proto", "utf-8", @@ -8683,7 +8720,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59db78ad1923f2b1be62b6da81fe80b173605ca0d57f85da2e005382adf693f7" dependencies = [ - "base64 0.22.1", + "base64", "http 1.3.1", "httparse", "log", diff --git a/Cargo.toml b/Cargo.toml index 9df5064..35a63bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "blob_codec", "ddex_parser", "log_macros", + "ow_wallet", "owen", "prover", "validator_node", @@ -16,6 +17,7 @@ log_macros = { path = "./log_macros" } blob_codec = { path = "./blob_codec" } ddex_parser = { path = "./ddex_parser" } owen = { path = "./owen" } +ow_wallet = { path = "./ow_wallet" } prover = { path = "./prover" } log = "0.4.27" thiserror = "2.0.12" diff --git a/aws/blobs_batch_sender/Cargo.toml b/aws/blobs_batch_sender/Cargo.toml index 43d4fa3..8acc093 100644 --- a/aws/blobs_batch_sender/Cargo.toml +++ b/aws/blobs_batch_sender/Cargo.toml @@ -12,6 +12,7 @@ lambda_runtime = "0.14.3" tokio = { workspace = true } owen = { workspace = true, features = ["aws-integration"] } serde = { workspace = true } +ow_wallet = { workspace = true } serde_json = { workspace = true } aws-sdk-s3 = "1.98.0" alloy = { version = "1.0.32", features = ["full"] } diff --git a/aws/blobs_batch_sender/src/event_handler.rs b/aws/blobs_batch_sender/src/event_handler.rs index 577d719..248c381 100644 --- a/aws/blobs_batch_sender/src/event_handler.rs +++ b/aws/blobs_batch_sender/src/event_handler.rs @@ -1,10 +1,8 @@ use aws_lambda_events::event::sqs::SqsEvent; use blobs_batch_sender::BlobsBatchSenderConfig; use lambda_runtime::{Error, LambdaEvent}; -use owen::{ - blobs_queue::BlobsQueueMessageBody, - wallet::{OwenWallet, OwenWalletConfig}, -}; +use ow_wallet::{OwWallet, OwWalletConfig}; +use owen::blobs_queue::BlobsQueueMessageBody; use crate::{contract::SmartEoaManager, s3::BlobsStorage}; @@ -12,9 +10,9 @@ pub(crate) async fn function_handler(event: LambdaEvent) -> Result<(), println!("Building..."); let config = BlobsBatchSenderConfig::build()?; let blobs_storage = BlobsStorage::build(&config).await?; - let owen_wallet_config = OwenWalletConfig::from(&config)?; - let owen_wallet = OwenWallet::build(&owen_wallet_config).await?; - let smart_eoa_manager = SmartEoaManager::build(&config, owen_wallet.wallet)?; + let ow_wallet_config = OwWalletConfig::from(&config)?; + let ow_wallet = OwWallet::build(&ow_wallet_config).await?; + let smart_eoa_manager = SmartEoaManager::build(&config, ow_wallet.wallet)?; println!("Build complate"); let blobhashes = extract_blobhashes(event)?; diff --git a/aws/blobs_batch_sender/src/lib.rs b/aws/blobs_batch_sender/src/lib.rs index d342a4c..7f1490b 100644 --- a/aws/blobs_batch_sender/src/lib.rs +++ b/aws/blobs_batch_sender/src/lib.rs @@ -1,11 +1,11 @@ use alloy::primitives::Address; use lambda_runtime::Error; +use ow_wallet::HasOwWalletFields; use owen::constants; -use owen::wallet::HasOwenWalletFields; use std::env; use std::str::FromStr; -impl HasOwenWalletFields for BlobsBatchSenderConfig { +impl HasOwWalletFields for BlobsBatchSenderConfig { fn use_kms(&self) -> bool { self.use_kms } diff --git a/ow_wallet/Cargo.toml b/ow_wallet/Cargo.toml new file mode 100644 index 0000000..6f02c2f --- /dev/null +++ b/ow_wallet/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "ow_wallet" +version = "0.1.0" +edition = "2024" + +[dependencies] +alloy = "1.5.2" +alloy-signer-aws = "1.5.2" +anyhow.workspace = true +aws-config = "1.8.12" +aws-sdk-kms = "1.98.0" +dotenvy.workspace = true +log = { workspace = true } +log_macros.workspace = true diff --git a/owen/src/wallet.rs b/ow_wallet/src/lib.rs similarity index 85% rename from owen/src/wallet.rs rename to ow_wallet/src/lib.rs index 389e397..0cca52a 100644 --- a/owen/src/wallet.rs +++ b/ow_wallet/src/lib.rs @@ -1,54 +1,39 @@ -use crate::Config; use alloy::network::EthereumWallet; use alloy::primitives::Address; use alloy::providers::{Provider, ProviderBuilder}; -use alloy::signers::local::PrivateKeySigner; use alloy::signers::Signer; +use alloy::signers::local::PrivateKeySigner; use alloy_signer_aws::AwsSigner; use anyhow::Context; -use aws_config::meta::region::RegionProviderChain; use aws_config::BehaviorVersion; +use aws_config::meta::region::RegionProviderChain; use log_macros::{format_error, log_info}; +use std::env; -pub struct OwenWallet { +pub struct OwWallet { pub use_kms: bool, aws_signer: Option, private_key_signer: Option, pub wallet: EthereumWallet, } -pub trait HasOwenWalletFields { +pub trait HasOwWalletFields { fn use_kms(&self) -> bool; fn rpc_url(&self) -> String; fn private_key(&self) -> Option; fn signer_kms_id(&self) -> Option; } -impl HasOwenWalletFields for Config { - fn use_kms(&self) -> bool { - self.use_kms - } - fn rpc_url(&self) -> String { - self.rpc_url.clone() - } - fn private_key(&self) -> Option { - self.private_key.clone() - } - fn signer_kms_id(&self) -> Option { - self.signer_kms_id.clone() - } -} - -pub struct OwenWalletConfig { +pub struct OwWalletConfig { pub use_kms: bool, pub rpc_url: String, pub private_key: Option, pub signer_kms_id: Option, } -impl OwenWalletConfig { +impl OwWalletConfig { pub fn build() -> anyhow::Result { - let rpc_url = Config::get_env_var("RPC_URL"); + let rpc_url = Self::get_env_var("RPC_URL"); let mut signer_kms_id = None; let mut private_key = None; let use_kms = matches!( @@ -59,9 +44,9 @@ impl OwenWalletConfig { ); if use_kms { - signer_kms_id = Some(Config::get_env_var("SIGNER_KMS_ID")); + signer_kms_id = Some(Self::get_env_var("SIGNER_KMS_ID")); } else { - private_key = Some(Config::get_env_var("PRIVATE_KEY")); + private_key = Some(Self::get_env_var("PRIVATE_KEY")); } Ok(Self { @@ -72,7 +57,11 @@ impl OwenWalletConfig { }) } - pub fn from(config_source: &C) -> anyhow::Result { + fn get_env_var(key: &str) -> String { + env::var(key).expect(format!("Missing env variable: {key}").as_str()) + } + + pub fn from(config_source: &C) -> anyhow::Result { Ok(Self { use_kms: config_source.use_kms(), rpc_url: config_source.rpc_url(), @@ -105,8 +94,8 @@ impl OwenWalletConfig { } } -impl OwenWallet { - pub async fn build(config: &OwenWalletConfig) -> anyhow::Result { +impl OwWallet { + pub async fn build(config: &OwWalletConfig) -> anyhow::Result { let wallet: EthereumWallet; let mut aws_signer = None; let mut private_key_signer: Option = None; diff --git a/owen/Cargo.toml b/owen/Cargo.toml index 9efc6f2..083f066 100644 --- a/owen/Cargo.toml +++ b/owen/Cargo.toml @@ -24,6 +24,7 @@ sentry = { workspace = true } sentry-log = { workspace = true } pretty_env_logger = { workspace = true } prover = { workspace = true } +ow_wallet = { workspace = true } ravif = "0.12.0" image = "0.25.6" rgb = "0.8.52" diff --git a/owen/src/contracts.rs b/owen/src/contracts.rs index 430e97f..57a9d61 100644 --- a/owen/src/contracts.rs +++ b/owen/src/contracts.rs @@ -1,6 +1,5 @@ use crate::blob::BlobTransactionData; -use crate::wallet::OwenWallet; -use crate::{is_local, Config}; +use crate::Config; use alloy::primitives::FixedBytes; use alloy::providers::{Provider, ProviderBuilder}; use alloy::sol_types::private::Bytes; @@ -16,6 +15,7 @@ use alloy::{ sol, }; use log_macros::{format_error, log_info, log_warn}; +use ow_wallet::OwWallet; use serde_json::json; use DdexEmitter::getSupportedBlobImageIdsReturn; @@ -51,8 +51,8 @@ pub struct ContractsManager { } impl ContractsManager { - pub async fn build(config: &Config, owen_wallet: &OwenWallet) -> anyhow::Result { - let wallet = owen_wallet.wallet.clone(); + pub async fn build(config: &Config, ow_wallet: &OwWallet) -> anyhow::Result { + let wallet = ow_wallet.wallet.clone(); let provider = ProviderBuilder::new() .wallet(wallet) diff --git a/owen/src/ipfs.rs b/owen/src/ipfs.rs index a4fe972..e449fa3 100644 --- a/owen/src/ipfs.rs +++ b/owen/src/ipfs.rs @@ -1,11 +1,11 @@ use crate::{ constants::{self, IPFS_API_ADD_FILE, REQWEST_CLIENT}, - wallet::OwenWallet, Config, }; use alloy::hex; use anyhow::Context; use log_macros::{format_error, log_info}; +use ow_wallet::OwWallet; use reqwest::{multipart, Body}; use serde::{Deserialize, Serialize}; use tokio_util::codec::{BytesCodec, FramedRead}; @@ -26,16 +26,16 @@ pub struct IpfsManager<'a> { local_ipfs: bool, ipfs_api_base_url: String, storacha_bridge_url: String, - owen_wallet: &'a OwenWallet, + ow_wallet: &'a OwWallet, } impl<'a> IpfsManager<'a> { - pub async fn build(config: &Config, owen_wallet: &'a OwenWallet) -> anyhow::Result { + pub async fn build(config: &Config, ow_wallet: &'a OwWallet) -> anyhow::Result { Ok(Self { local_ipfs: config.local_ipfs.clone(), ipfs_api_base_url: config.ipfs_api_base_url.clone(), storacha_bridge_url: config.storacha_bridge_url.clone(), - owen_wallet, + ow_wallet, }) } @@ -80,7 +80,7 @@ impl<'a> IpfsManager<'a> { } async fn sign_authorization_header(&self) -> anyhow::Result { - let signature = self.owen_wallet.sign_message(constants::CLIENT).await?; + let signature = self.ow_wallet.sign_message(constants::CLIENT).await?; let authorization = format!("{}::0x{}", "OWEN", hex::encode(signature.as_bytes())); Ok(authorization) diff --git a/owen/src/lib.rs b/owen/src/lib.rs index a2f1146..9ecfd0f 100644 --- a/owen/src/lib.rs +++ b/owen/src/lib.rs @@ -8,13 +8,13 @@ mod image_processor; mod ipfs; pub mod logger; pub mod output_generator; -pub mod wallet; use alloy::primitives::Address; use blob::BlobTransactionData; use contracts::ContractsManager; use ddex_parser::ParserError; pub use log; use log_macros::log_error; +use ow_wallet::{HasOwWalletFields, OwWallet, OwWalletConfig}; use sentry::User; use serde_json::json; use std::env; @@ -22,7 +22,6 @@ use std::str::FromStr; use crate::ipfs::IpfsManager; use crate::output_generator::{DdexMessage, OutputFilesGenerator}; -use crate::wallet::{OwenWallet, OwenWalletConfig}; #[cfg(any(feature = "aws-integration", feature = "local-s3"))] pub mod s3_message_storage; @@ -157,12 +156,12 @@ impl Config { } pub async fn run(config: &Config) -> anyhow::Result> { - let owen_wallet_config = OwenWalletConfig::from(config)?; - let owen_wallet = OwenWallet::build(&owen_wallet_config).await?; - let contracts_manager = ContractsManager::build(&config, &owen_wallet).await?; + let ow_wallet_config = OwWalletConfig::from(config)?; + let ow_wallet = OwWallet::build(&ow_wallet_config).await?; + let contracts_manager = ContractsManager::build(&config, &ow_wallet).await?; contracts_manager.check_image_compatibility().await?; - let ipfs_manager = IpfsManager::build(&config, &owen_wallet).await?; + let ipfs_manager = IpfsManager::build(&config, &ow_wallet).await?; let output_files_generator = OutputFilesGenerator::build(&config, &ipfs_manager)?; let ddex_messages = output_files_generator.generate_files().await?; @@ -213,3 +212,18 @@ pub async fn run_with_sentry(config: &Config) -> anyhow::Result anyhow::Ok(ddex_messages) } + +impl HasOwWalletFields for Config { + fn use_kms(&self) -> bool { + self.use_kms + } + fn rpc_url(&self) -> String { + self.rpc_url.clone() + } + fn private_key(&self) -> Option { + self.private_key.clone() + } + fn signer_kms_id(&self) -> Option { + self.signer_kms_id.clone() + } +} diff --git a/owen/src/output_generator.rs b/owen/src/output_generator.rs index 22bb735..937a8f2 100644 --- a/owen/src/output_generator.rs +++ b/owen/src/output_generator.rs @@ -306,8 +306,8 @@ impl<'a, 'b> OutputFilesGenerator<'a, 'b> { #[cfg(test)] mod tests { use super::*; - use crate::wallet::{OwenWallet, OwenWalletConfig}; use alloy::primitives::Address; + use ow_wallet::{OwWallet, OwWalletConfig}; use std::str::FromStr; fn find_cid_in_file(ddex_message: &DdexMessage) -> anyhow::Result { @@ -335,9 +335,9 @@ mod tests { signer_kms_id: None, use_batch_sender: false, }; - let owen_wallet_config = OwenWalletConfig::from(&config)?; - let owen_wallet = OwenWallet::build(&owen_wallet_config).await?; - let ipfs_manager = IpfsManager::build(&config, &owen_wallet).await?; + let ow_wallet_config = OwWalletConfig::from(&config)?; + let ow_wallet = OwWallet::build(&ow_wallet_config).await?; + let ipfs_manager = IpfsManager::build(&config, &ow_wallet).await?; let output_files_generator = OutputFilesGenerator::build(&config, &ipfs_manager)?; let ddex_messages = output_files_generator.generate_files().await?; @@ -375,9 +375,9 @@ mod tests { use_batch_sender: false, }; fs::create_dir_all(&config.input_files_dir).unwrap(); - let owen_wallet_config = OwenWalletConfig::from(&config).unwrap(); - let owen_wallet = OwenWallet::build(&owen_wallet_config).await.unwrap(); - let ipfs_manager = IpfsManager::build(&config, &owen_wallet).await.unwrap(); + let ow_wallet_config = OwWalletConfig::from(&config).unwrap(); + let ow_wallet = OwWallet::build(&ow_wallet_config).await.unwrap(); + let ipfs_manager = IpfsManager::build(&config, &ow_wallet).await.unwrap(); let output_files_generator = OutputFilesGenerator::build(&config, &ipfs_manager).unwrap(); let _ = output_files_generator.generate_files().await.unwrap();