[package]
description = "Move types for the `Perpetuals` package"
name        = "af-iperps"
version     = "0.46.3"

authors.workspace      = true
categories.workspace   = true
edition.workspace      = true
license.workspace      = true
repository.workspace   = true
rust-version.workspace = true

[package.metadata.docs.rs]
# To build locally:
# RUSTDOCFLAGS="--generate-link-to-definition" cargo doc --all-features --no-deps --open
all-features = true
rustdoc-args = [
    # Generate links to definition in rustdoc source code pages
    # https://github.com/rust-lang/rust/pull/84176
    "--generate-link-to-definition",
]

[lints]
workspace = true

[features]
graphql = [
    "dep:async-stream",
    "dep:cynic",
    "dep:enum-as-inner",
    "dep:futures",
    "dep:graphql-extract",
    "dep:sui-gql-client",
    "dep:sui-gql-schema",
    "sui-gql-schema/build",
]
stop-orders = ["dep:fastcrypto"]

[dependencies]
# Public dependencies; a SemVer-breaking bump in one of these must come with a SemVer-breaking bump
# to this crate
# https://rust-lang.github.io/rfcs/3516-public-private-dependencies.html
af-sui-pkg-sdk    = { version = "0.15.3", public = true, path = "../af-sui-pkg-sdk" }
af-utilities      = { version = "0.15.0", public = true, path = "../af-utilities" }
num_enum          = { version = "0.7", public = true }
strum             = { version = "0.28", public = true, features = ["derive"] }
sui-framework-sdk = { version = "0.17.3", public = true, path = "../sui-framework-sdk" }
sui-gql-client    = { version = "0.26", public = true, default-features = false, optional = true, path = "../sui-gql-client" }
sui-sdk-types     = { version = "0.3", public = true }

# TODO: remove this after using Rust's `Option` (see TODO in `lib.rs`)
move-stdlib-sdk = { version = "0.16.3", public = true, path = "../move-stdlib-sdk" }


af-move-type = { version = "0.19.1", path = "../af-move-type" }
af-sui-types = { version = "0.18.0", path = "../af-sui-types" }

clap        = { version = "4", features = ["derive"] }
derive_more = { version = "2", features = ["display", "from", "is_variant", "try_into"] }
num-traits  = "0.2"
remain      = "0.2"
serde       = "1"
thiserror   = "2"

# GraphQL RPC (optional)
async-stream    = { version = "0.3", optional = true }
cynic           = { version = "3", optional = true }
enum-as-inner   = { version = "0.7", optional = true }
futures         = { version = "0.3", optional = true }
graphql-extract = { version = "0.0.12", path = "../graphql-extract", optional = true }

# Stop Orders
fastcrypto = { version = "0.1", optional = true }

[build-dependencies.sui-gql-schema]
default-features = false
features         = ["build"]
optional         = true
path             = "../sui-gql-schema"
version = "0.18.0"


[dev-dependencies]
af-ptbuilder   = { path = "../af-ptbuilder" }
af-sui-types   = { path = "../af-sui-types", features = ["hash"] }
clap           = { version = "4", features = ["derive"] }
color-eyre     = "0.6"
indicatif      = "0.18"
insta          = "1"
nonempty       = "0.12"
num_enum       = "0.7"
proptest       = "1"
reqwest        = "0.13"
rgb            = "0.8"
sui-gql-client = { path = "../sui-gql-client" }
test-strategy  = "0.4"
textplots      = "0.8"
tokio          = { version = "1", features = ["full"] }
tokio-test     = "0.4"


[[example]]
name              = "clearing-house-orders"
path              = "examples/fetch/clearing_house_orders.rs"
required-features = ["graphql"]

[[example]]
name              = "order-maps"
path              = "examples/fetch/order_maps.rs"
required-features = ["graphql"]

[[example]]
name              = "map-orders"
path              = "examples/fetch/map_orders.rs"
required-features = ["graphql"]

[[example]]
name              = "clearing-house-vault"
path              = "examples/fetch/clearing_house_vault.rs"
required-features = ["graphql"]

[[example]]
name              = "clearing-house-positions"
path              = "examples/fetch/clearing_house_positions.rs"
required-features = ["graphql"]

[[example]]
name              = "all-orders-concurrently"
path              = "examples/fetch/all_orders_concurrently.rs"
required-features = ["graphql"]

[[example]]
name              = "create-account"
path              = "examples/ptb/create_account.rs"
required-features = ["graphql"]

[[example]]
name              = "deposit-collateral"
path              = "examples/ptb/deposit_collateral.rs"
required-features = ["graphql"]

[[example]]
name              = "withdraw-collateral"
path              = "examples/ptb/withdraw_collateral.rs"
required-features = ["graphql"]

[[example]]
name              = "place-orders"
path              = "examples/ptb/place_orders.rs"
required-features = ["graphql"]

[[example]]
name              = "cancel-orders"
path              = "examples/ptb/cancel_orders.rs"
required-features = ["graphql"]
