From bcffbf108554ae6ad7ff11d7acf80e0231eb6816 Mon Sep 17 00:00:00 2001 From: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com> Date: Wed, 16 Oct 2024 21:10:26 +0300 Subject: [PATCH] chore: release preparations (#3) --- .github/workflows/release-plz.yml | 29 ++ Cargo.lock | 284 ++++++++++-------- Cargo.toml | 12 +- LICENSE-APACHE | 176 +++++++++++ LICENSE-MIT | 19 ++ examples/account_key_pooling.rs | 2 +- examples/create_account_and_send_near.rs | 12 +- examples/deploy_and_call_method.rs | 2 +- examples/ft.rs | 2 +- examples/nft.rs | 2 +- examples/sign_options.rs | 2 +- src/common/query.rs | 2 +- src/common/secret.rs | 2 +- src/common/send.rs | 4 +- src/signer/access_keyfile_signer.rs | 2 +- src/signer/keystore.rs | 2 +- src/signer/ledger.rs | 2 +- src/signer/mod.rs | 2 +- src/signer/secret_key.rs | 2 +- tests/account.rs | 26 +- tests/contract.rs | 2 +- ...ultiple_tx_at_same_time_from_same-_user.rs | 2 +- 22 files changed, 423 insertions(+), 167 deletions(-) create mode 100644 .github/workflows/release-plz.yml create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT diff --git a/.github/workflows/release-plz.yml b/.github/workflows/release-plz.yml new file mode 100644 index 0000000..5b3e8b3 --- /dev/null +++ b/.github/workflows/release-plz.yml @@ -0,0 +1,29 @@ +name: Release-plz + +permissions: + pull-requests: write + contents: write + +on: + push: + branches: + - main + +jobs: + release-plz: + name: Release-plz + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + token: ${{ secrets.RELEASE_PLZ_GITHUB_TOKEN }} + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - name: Run release-plz + uses: MarcoIeni/release-plz-action@v0.5 + env: + # https://marcoieni.github.io/release-plz/github-action.html#triggering-further-workflow-runs + GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_GITHUB_TOKEN }} + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/Cargo.lock b/Cargo.lock index 5b74c05..50d7ac7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,11 +14,11 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ - "gimli 0.31.0", + "gimli 0.31.1", ] [[package]] @@ -165,9 +165,9 @@ dependencies = [ [[package]] name = "bip39" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f2635620bf0b9d4576eb7bb9a38a55df78bd1205d26fa994b25911a69f212f" +checksum = "33415e24172c1b7d6066f6d999545375ab8e1d95421d6784bdfff9496f292387" dependencies = [ "bitcoin_hashes", "rand", @@ -176,11 +176,21 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + [[package]] name = "bitcoin_hashes" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90064b8dee6815a6470d60bad07bbbaee885c0e12d04177138fa3291a01b7bc4" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] [[package]] name = "bitflags" @@ -387,9 +397,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.24" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -477,6 +487,16 @@ dependencies = [ "libc", ] +[[package]] +name = "core-foundation" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b55271e5c8c478ad3f38ad24ef34923091e0548492a266d19b3c0b4d82574c63" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "core-foundation-sys" version = "0.8.7" @@ -608,9 +628,9 @@ dependencies = [ [[package]] name = "dbus-secret-service" -version = "4.0.2" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1caa0c241c01ad8d99a78d553567d38f873dd3ac16eca33a5370d650ab25584e" +checksum = "b42a16374481d92aed73ae45b1f120207d8e71d24fb89f357fadbd8f946fd84b" dependencies = [ "dbus", "futures-util", @@ -927,9 +947,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -942,9 +962,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -952,15 +972,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -969,15 +989,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -986,21 +1006,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -1047,9 +1067,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "goblin" @@ -1120,6 +1140,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "hidapi" version = "2.6.3" @@ -1203,9 +1229,9 @@ checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -1357,9 +1383,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is_executable" @@ -1402,9 +1428,9 @@ checksum = "72167d68f5fce3b8655487b8038691a3c9984ee769590f93f2a631f4ad64e4f5" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] @@ -1449,14 +1475,14 @@ dependencies = [ [[package]] name = "keyring" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fa83d1ca02db069b5fbe94b23b584d588e989218310c9c15015bb5571ef1a94" +checksum = "bd3d701d3de5b9c4b0d9d077f8c2c66f0388d75e96932ebbb7cdff8713d7f7c6" dependencies = [ "byteorder", "dbus-secret-service", "openssl", - "security-framework", + "security-framework 3.0.0", "windows-sys 0.59.0", ] @@ -1634,46 +1660,11 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "security-framework", + "security-framework 2.11.1", "security-framework-sys", "tempfile", ] -[[package]] -name = "near" -version = "0.1.0" -dependencies = [ - "async-trait", - "bip39", - "borsh", - "ed25519-dalek", - "futures", - "keyring", - "near", - "near-abi", - "near-account-id", - "near-contract-standards", - "near-crypto", - "near-gas", - "near-jsonrpc-client", - "near-jsonrpc-primitives", - "near-ledger", - "near-primitives", - "near-sdk", - "near-token", - "near-workspaces", - "openssl", - "reqwest", - "serde", - "serde_json", - "slipped10", - "thiserror", - "tokio", - "tracing", - "url", - "zstd 0.13.2", -] - [[package]] name = "near-abi" version = "0.4.3" @@ -1736,6 +1727,41 @@ dependencies = [ "serde", ] +[[package]] +name = "near-api" +version = "0.2.0" +dependencies = [ + "async-trait", + "bip39", + "borsh", + "ed25519-dalek", + "futures", + "keyring", + "near-abi", + "near-account-id", + "near-api", + "near-contract-standards", + "near-crypto", + "near-gas", + "near-jsonrpc-client", + "near-jsonrpc-primitives", + "near-ledger", + "near-primitives", + "near-sdk", + "near-token", + "near-workspaces", + "openssl", + "reqwest", + "serde", + "serde_json", + "slipped10", + "thiserror", + "tokio", + "tracing", + "url", + "zstd 0.13.2", +] + [[package]] name = "near-chain-configs" version = "0.26.0" @@ -2293,21 +2319,18 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.20.1" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" -dependencies = [ - "portable-atomic", -] +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "opaque-debug" @@ -2317,9 +2340,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "7b8cefcf97f41316955f9294cd61f639bdcfa9f2f230faac6cb896aa8ab64704" dependencies = [ "bitflags 2.6.0", "cfg-if 1.0.0", @@ -2358,9 +2381,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -2455,18 +2478,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", @@ -2497,12 +2520,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -2578,9 +2595,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" dependencies = [ "unicode-ident", ] @@ -2770,9 +2787,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" dependencies = [ "log", "once_cell", @@ -2794,9 +2811,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -2811,9 +2828,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "ryu" @@ -2823,9 +2840,9 @@ checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -2912,7 +2929,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d0283c0a4a22a0f1b0e4edca251aa20b92fc96eaa09b84bec052f9415e9d71" +dependencies = [ + "bitflags 2.6.0", + "core-foundation 0.10.0", "core-foundation-sys", "libc", "security-framework-sys", @@ -3005,9 +3035,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9720086b3357bcb44fce40117d769a4d068c70ecfa190850a980a71755f66fcc" +checksum = "8e28bdad6db2b8340e449f7108f020b3b092e8583a9e3fb82713e1d4e71fe817" dependencies = [ "base64 0.22.1", "chrono", @@ -3023,9 +3053,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.10.0" +version = "3.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1abbfe725f27678f4663bcacb75a83e829fd464c25d78dd038a3a29e307cec" +checksum = "9d846214a9854ef724f3da161b426242d8de7c1fc7de2f89bb1efcb154dca79d" dependencies = [ "darling", "proc-macro2", @@ -3363,7 +3393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.6.0", - "core-foundation", + "core-foundation 0.9.4", "system-configuration-sys", ] @@ -3731,9 +3761,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if 1.0.0", "once_cell", @@ -3742,9 +3772,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", @@ -3757,9 +3787,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -3769,9 +3799,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3779,9 +3809,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", @@ -3792,9 +3822,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasmparser" @@ -3804,9 +3834,9 @@ checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index b802be4..dc637ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "near" -version = "0.1.0" +name = "near-api" +version = "0.2.0" authors = [ "akorchyn ", "frol ", @@ -8,8 +8,10 @@ authors = [ ] license = "MIT OR Apache-2.0" edition = "2021" -repository = "https://github.com/akorchyn/near-api-rs" -description = "The near protocol API that helps to interact with NEAR Protocol" +repository = "https://github.com/near/near-api-rs" +description = "Rust library to interact with NEAR Protocol via RPC API" + +exclude = ["resources", "examples", "tests"] [dependencies] borsh = "1.5" @@ -65,4 +67,4 @@ workspaces = ["dep:near-workspaces"] [dev-dependencies] tokio = { version = "1.0", default-features = false, features = ["full"] } -near = { path = ".", features = ["workspaces"] } +near-api = { path = ".", features = ["workspaces"] } diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..0e52542 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,176 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..72dc60d --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,19 @@ +The MIT License (MIT) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/examples/account_key_pooling.rs b/examples/account_key_pooling.rs index 9013539..4f87c77 100644 --- a/examples/account_key_pooling.rs +++ b/examples/account_key_pooling.rs @@ -3,7 +3,7 @@ /// /// This is an example of how to use account key pooling to send multiple transactions /// using different keys. -use near::{signer::Signer, Account, NetworkConfig, Tokens}; +use near_api::{signer::Signer, Account, NetworkConfig, Tokens}; use near_token::NearToken; use std::sync::Arc; diff --git a/examples/create_account_and_send_near.rs b/examples/create_account_and_send_near.rs index d9ba1c7..b55eca2 100644 --- a/examples/create_account_and_send_near.rs +++ b/examples/create_account_and_send_near.rs @@ -1,5 +1,5 @@ -use near::{signer::Signer, NetworkConfig}; use near_account_id::AccountId; +use near_api::{signer::Signer, NetworkConfig}; use near_token::NearToken; #[tokio::main] @@ -8,7 +8,7 @@ async fn main() { let account = network.dev_create_account().await.unwrap(); let network = NetworkConfig::from(network); - let balance = near::Tokens::of(account.id().clone()) + let balance = near_api::Tokens::of(account.id().clone()) .near_balance() .fetch_from(&network) .await @@ -19,7 +19,7 @@ async fn main() { let new_account: AccountId = format!("{}.{}", "bob", account.id()).parse().unwrap(); let signer = Signer::new(Signer::from_workspace(&account)).unwrap(); - near::Account::create_account() + near_api::Account::create_account() .fund_myself( new_account.clone(), account.id().clone(), @@ -33,7 +33,7 @@ async fn main() { .await .unwrap(); - near::Tokens::of(account.id().clone()) + near_api::Tokens::of(account.id().clone()) .send_to(new_account.clone()) .near(NearToken::from_near(1)) .with_signer(signer) @@ -41,12 +41,12 @@ async fn main() { .await .unwrap(); - let new_acccount_balance = near::Tokens::of(account.id().clone()) + let new_acccount_balance = near_api::Tokens::of(account.id().clone()) .near_balance() .fetch_from(&network) .await .unwrap(); - let bob_balance = near::Tokens::of(new_account) + let bob_balance = near_api::Tokens::of(new_account) .near_balance() .fetch_from(&network) .await diff --git a/examples/deploy_and_call_method.rs b/examples/deploy_and_call_method.rs index 80ea36d..5f4c089 100644 --- a/examples/deploy_and_call_method.rs +++ b/examples/deploy_and_call_method.rs @@ -1,4 +1,4 @@ -use near::{signer::Signer, types::Data, Contract, NetworkConfig}; +use near_api::{signer::Signer, types::Data, Contract, NetworkConfig}; #[tokio::main] async fn main() { diff --git a/examples/ft.rs b/examples/ft.rs index b8de57e..ab62e0a 100644 --- a/examples/ft.rs +++ b/examples/ft.rs @@ -1,4 +1,4 @@ -use near::{signer::Signer, types::tokens::FTBalance, Contract, NetworkConfig, Tokens}; +use near_api::{signer::Signer, types::tokens::FTBalance, Contract, NetworkConfig, Tokens}; use serde_json::json; #[tokio::main] diff --git a/examples/nft.rs b/examples/nft.rs index 327f3c7..c1bd86a 100644 --- a/examples/nft.rs +++ b/examples/nft.rs @@ -1,4 +1,4 @@ -use near::{signer::Signer, Contract, NetworkConfig, Tokens}; +use near_api::{signer::Signer, Contract, NetworkConfig, Tokens}; use near_contract_standards::non_fungible_token::metadata::TokenMetadata; use near_token::NearToken; use serde_json::json; diff --git a/examples/sign_options.rs b/examples/sign_options.rs index 9aadd31..f884776 100644 --- a/examples/sign_options.rs +++ b/examples/sign_options.rs @@ -1,4 +1,4 @@ -use near::{signer::Signer, Account, NetworkConfig}; +use near_api::{signer::Signer, Account, NetworkConfig}; use near_crypto::SecretKey; use near_primitives::account::AccessKeyPermission; diff --git a/src/common/query.rs b/src/common/query.rs index 46f59aa..19aee23 100644 --- a/src/common/query.rs +++ b/src/common/query.rs @@ -18,7 +18,7 @@ use tracing::{debug, error, info, instrument, trace, warn}; use crate::{config::NetworkConfig, errors::QueryError, types::Data}; -const QUERY_EXECUTOR_TARGET: &str = "near::query::executor"; +const QUERY_EXECUTOR_TARGET: &str = "near_api::query::executor"; type ResultWithMethod = core::result::Result>; diff --git a/src/common/secret.rs b/src/common/secret.rs index ca9ae5e..23ab0f6 100644 --- a/src/common/secret.rs +++ b/src/common/secret.rs @@ -96,7 +96,7 @@ where } else { let mnemonic = bip39::Mnemonic::generate(self.word_count.unwrap_or(DEFAULT_WORD_COUNT)) .map_err(SecretError::from)?; - mnemonic.word_iter().collect::>().join(" ") + mnemonic.words().collect::>().join(" ") }; let signer = Signer::seed_phrase_with_hd_path( diff --git a/src/common/send.rs b/src/common/send.rs index 2f2a964..c74d0bc 100644 --- a/src/common/send.rs +++ b/src/common/send.rs @@ -25,8 +25,8 @@ use super::{ signed_delegate_action::SignedDelegateActionAsBase64, META_TRANSACTION_VALID_FOR_DEFAULT, }; -const TX_EXECUTOR_TARGET: &str = "near::tx::executor"; -const META_EXECUTOR_TARGET: &str = "near::meta::executor"; +const TX_EXECUTOR_TARGET: &str = "near_api::tx::executor"; +const META_EXECUTOR_TARGET: &str = "near_api::meta::executor"; #[async_trait::async_trait] pub trait Transactionable: Send + Sync { diff --git a/src/signer/access_keyfile_signer.rs b/src/signer/access_keyfile_signer.rs index 035f026..60b6423 100644 --- a/src/signer/access_keyfile_signer.rs +++ b/src/signer/access_keyfile_signer.rs @@ -10,7 +10,7 @@ use crate::{ types::transactions::PrepopulateTransaction, }; -const ACCESS_KEYFILE_SIGNER_TARGET: &str = "near::signer::access_keyfile"; +const ACCESS_KEYFILE_SIGNER_TARGET: &str = "near_api::signer::access_keyfile"; #[derive(Debug, Clone)] pub struct AccessKeyFileSigner { diff --git a/src/signer/keystore.rs b/src/signer/keystore.rs index 3cda127..38971ea 100644 --- a/src/signer/keystore.rs +++ b/src/signer/keystore.rs @@ -15,7 +15,7 @@ use crate::{ use super::{AccountKeyPair, SignerTrait}; -const KEYSTORE_SIGNER_TARGET: &str = "near::signer::keystore"; +const KEYSTORE_SIGNER_TARGET: &str = "near_api::signer::keystore"; #[derive(Debug, Clone)] pub struct KeystoreSigner { diff --git a/src/signer/ledger.rs b/src/signer/ledger.rs index d7cda8a..2aea6e7 100644 --- a/src/signer/ledger.rs +++ b/src/signer/ledger.rs @@ -13,7 +13,7 @@ use crate::{ use super::SignerTrait; -const LEDGER_SIGNER_TARGET: &str = "near::signer::ledger"; +const LEDGER_SIGNER_TARGET: &str = "near_api::signer::ledger"; #[derive(Debug, Clone)] pub struct LedgerSigner { diff --git a/src/signer/mod.rs b/src/signer/mod.rs index ec3114b..ba84ea4 100644 --- a/src/signer/mod.rs +++ b/src/signer/mod.rs @@ -34,7 +34,7 @@ pub mod keystore; pub mod ledger; pub mod secret_key; -const SIGNER_TARGET: &str = "near::signer"; +const SIGNER_TARGET: &str = "near_api::signer"; #[derive(Debug, Deserialize, Clone)] pub struct AccountKeyPair { diff --git a/src/signer/secret_key.rs b/src/signer/secret_key.rs index 78e8447..18fb46d 100644 --- a/src/signer/secret_key.rs +++ b/src/signer/secret_key.rs @@ -6,7 +6,7 @@ use crate::{errors::SignerError, types::transactions::PrepopulateTransaction}; use super::SignerTrait; -const SECRET_KEY_SIGNER_TARGET: &str = "near::signer::secret_key"; +const SECRET_KEY_SIGNER_TARGET: &str = "near_api::signer::secret_key"; #[derive(Debug, Clone)] pub struct SecretKeySigner { diff --git a/tests/account.rs b/tests/account.rs index 4f1178e..351ab3d 100644 --- a/tests/account.rs +++ b/tests/account.rs @@ -1,5 +1,5 @@ -use near::{signer::Signer, NetworkConfig}; use near_account_id::AccountId; +use near_api::{signer::Signer, NetworkConfig}; use near_primitives::{account::AccessKeyPermission, views::AccessKeyPermissionView}; use near_token::NearToken; @@ -7,11 +7,11 @@ use near_token::NearToken; async fn create_and_delete_account() { let network = near_workspaces::sandbox().await.unwrap(); let account = network.dev_create_account().await.unwrap(); - let network: near::NetworkConfig = NetworkConfig::from(network); + let network: near_api::NetworkConfig = NetworkConfig::from(network); let new_account: AccountId = format!("{}.{}", "bob", account.id()).parse().unwrap(); - near::Account::create_account() + near_api::Account::create_account() .fund_myself( new_account.clone(), account.id().clone(), @@ -27,7 +27,7 @@ async fn create_and_delete_account() { .unwrap() .assert_success(); - let balance_before_del = near::Tokens::of(new_account.clone()) + let balance_before_del = near_api::Tokens::of(new_account.clone()) .near_balance() .fetch_from(&network) .await @@ -35,7 +35,7 @@ async fn create_and_delete_account() { assert_eq!(balance_before_del.liquid.as_near(), 1); - dbg!(near::Account(account.id().clone()) + dbg!(near_api::Account(account.id().clone()) .delete_account_with_beneficiary(new_account.clone()) .with_signer(Signer::new(Signer::from_workspace(&account)).unwrap()) .send_to(&network) @@ -43,7 +43,7 @@ async fn create_and_delete_account() { .unwrap()) .assert_success(); - near::Tokens::of(account.id().clone()) + near_api::Tokens::of(account.id().clone()) .near_balance() .fetch_from(&network) .await @@ -52,7 +52,7 @@ async fn create_and_delete_account() { // TODO: why do we need a sleep to wait for beneficiary transfer? tokio::time::sleep(std::time::Duration::from_secs(1)).await; - let balance_after_del = near::Tokens::of(new_account.clone()) + let balance_after_del = near_api::Tokens::of(new_account.clone()) .near_balance() .fetch_from(&network) .await @@ -65,9 +65,9 @@ async fn transfer_funds() { let network = near_workspaces::sandbox().await.unwrap(); let alice = network.dev_create_account().await.unwrap(); let bob = network.dev_create_account().await.unwrap(); - let network: near::NetworkConfig = NetworkConfig::from(network); + let network: near_api::NetworkConfig = NetworkConfig::from(network); - near::Tokens::of(alice.id().clone()) + near_api::Tokens::of(alice.id().clone()) .send_to(bob.id().clone()) .near(NearToken::from_near(50)) .with_signer(Signer::new(Signer::from_workspace(&alice)).unwrap()) @@ -76,13 +76,13 @@ async fn transfer_funds() { .unwrap() .assert_success(); - let alice_balance = near::Tokens::of(alice.id().clone()) + let alice_balance = near_api::Tokens::of(alice.id().clone()) .near_balance() .fetch_from(&network) .await .unwrap(); - let bob_balance = near::Tokens::of(bob.id().clone()) + let bob_balance = near_api::Tokens::of(bob.id().clone()) .near_balance() .fetch_from(&network) .await @@ -97,9 +97,9 @@ async fn transfer_funds() { async fn access_key_management() { let network = near_workspaces::sandbox().await.unwrap(); let alice = network.dev_create_account().await.unwrap(); - let network: near::NetworkConfig = NetworkConfig::from(network); + let network: near_api::NetworkConfig = NetworkConfig::from(network); - let alice_acc = near::Account(alice.id().clone()); + let alice_acc = near_api::Account(alice.id().clone()); let keys = alice_acc.list_keys().fetch_from(&network).await.unwrap(); assert_eq!(keys.keys.len(), 1); diff --git a/tests/contract.rs b/tests/contract.rs index 7546ca0..698e187 100644 --- a/tests/contract.rs +++ b/tests/contract.rs @@ -1,4 +1,4 @@ -use near::{signer::Signer, types::Data, Contract, NetworkConfig}; +use near_api::{signer::Signer, types::Data, Contract, NetworkConfig}; use serde_json::json; #[tokio::test] diff --git a/tests/multiple_tx_at_same_time_from_same-_user.rs b/tests/multiple_tx_at_same_time_from_same-_user.rs index 19c8b2c..65378ce 100644 --- a/tests/multiple_tx_at_same_time_from_same-_user.rs +++ b/tests/multiple_tx_at_same_time_from_same-_user.rs @@ -1,7 +1,7 @@ use std::{collections::HashMap, sync::Arc}; use futures::future::join_all; -use near::{ +use near_api::{ signer::{Signer, SignerTrait}, Account, NetworkConfig, Tokens, };