@symmio/trading-react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/account-layer/index.d.ts +29 -0
- package/dist/account-layer/index.d.ts.map +1 -0
- package/dist/account-layer/use-account-balance-info.d.ts +22 -0
- package/dist/account-layer/use-account-balance-info.d.ts.map +1 -0
- package/dist/account-layer/use-account-balance-info.js +23 -0
- package/dist/account-layer/use-account-balance-info.js.map +1 -0
- package/dist/account-layer/use-account-balance-of.d.ts +22 -0
- package/dist/account-layer/use-account-balance-of.d.ts.map +1 -0
- package/dist/account-layer/use-account-balance-of.js +23 -0
- package/dist/account-layer/use-account-balance-of.js.map +1 -0
- package/dist/account-layer/use-add-margin.d.ts +26 -0
- package/dist/account-layer/use-add-margin.d.ts.map +1 -0
- package/dist/account-layer/use-add-margin.js +40 -0
- package/dist/account-layer/use-add-margin.js.map +1 -0
- package/dist/account-layer/use-allocate.d.ts +25 -0
- package/dist/account-layer/use-allocate.d.ts.map +1 -0
- package/dist/account-layer/use-allocate.js +40 -0
- package/dist/account-layer/use-allocate.js.map +1 -0
- package/dist/account-layer/use-create-sub-accounts.d.ts +36 -0
- package/dist/account-layer/use-create-sub-accounts.d.ts.map +1 -0
- package/dist/account-layer/use-create-sub-accounts.js +41 -0
- package/dist/account-layer/use-create-sub-accounts.js.map +1 -0
- package/dist/account-layer/use-deallocate.d.ts +44 -0
- package/dist/account-layer/use-deallocate.d.ts.map +1 -0
- package/dist/account-layer/use-deallocate.js +44 -0
- package/dist/account-layer/use-deallocate.js.map +1 -0
- package/dist/account-layer/use-delete-sub-account.d.ts +30 -0
- package/dist/account-layer/use-delete-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-delete-sub-account.js +40 -0
- package/dist/account-layer/use-delete-sub-account.js.map +1 -0
- package/dist/account-layer/use-deposit-and-allocate.d.ts +27 -0
- package/dist/account-layer/use-deposit-and-allocate.d.ts.map +1 -0
- package/dist/account-layer/use-deposit-and-allocate.js +41 -0
- package/dist/account-layer/use-deposit-and-allocate.js.map +1 -0
- package/dist/account-layer/use-deposit.d.ts +27 -0
- package/dist/account-layer/use-deposit.d.ts.map +1 -0
- package/dist/account-layer/use-deposit.js +41 -0
- package/dist/account-layer/use-deposit.js.map +1 -0
- package/dist/account-layer/use-edit-account-name.d.ts +27 -0
- package/dist/account-layer/use-edit-account-name.d.ts.map +1 -0
- package/dist/account-layer/use-edit-account-name.js +40 -0
- package/dist/account-layer/use-edit-account-name.js.map +1 -0
- package/dist/account-layer/use-predicted-next-virtual-account.d.ts +38 -0
- package/dist/account-layer/use-predicted-next-virtual-account.d.ts.map +1 -0
- package/dist/account-layer/use-predicted-next-virtual-account.js +27 -0
- package/dist/account-layer/use-predicted-next-virtual-account.js.map +1 -0
- package/dist/account-layer/use-remove-margin.d.ts +43 -0
- package/dist/account-layer/use-remove-margin.d.ts.map +1 -0
- package/dist/account-layer/use-remove-margin.js +44 -0
- package/dist/account-layer/use-remove-margin.js.map +1 -0
- package/dist/account-layer/use-simulate-add-margin.d.ts +24 -0
- package/dist/account-layer/use-simulate-add-margin.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-add-margin.js +29 -0
- package/dist/account-layer/use-simulate-add-margin.js.map +1 -0
- package/dist/account-layer/use-simulate-allocate.d.ts +25 -0
- package/dist/account-layer/use-simulate-allocate.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-allocate.js +29 -0
- package/dist/account-layer/use-simulate-allocate.js.map +1 -0
- package/dist/account-layer/use-simulate-create-sub-accounts.d.ts +25 -0
- package/dist/account-layer/use-simulate-create-sub-accounts.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-create-sub-accounts.js +29 -0
- package/dist/account-layer/use-simulate-create-sub-accounts.js.map +1 -0
- package/dist/account-layer/use-simulate-deallocate.d.ts +29 -0
- package/dist/account-layer/use-simulate-deallocate.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-deallocate.js +29 -0
- package/dist/account-layer/use-simulate-deallocate.js.map +1 -0
- package/dist/account-layer/use-simulate-delete-sub-account.d.ts +25 -0
- package/dist/account-layer/use-simulate-delete-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-delete-sub-account.js +29 -0
- package/dist/account-layer/use-simulate-delete-sub-account.js.map +1 -0
- package/dist/account-layer/use-simulate-deposit-and-allocate.d.ts +25 -0
- package/dist/account-layer/use-simulate-deposit-and-allocate.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-deposit-and-allocate.js +29 -0
- package/dist/account-layer/use-simulate-deposit-and-allocate.js.map +1 -0
- package/dist/account-layer/use-simulate-deposit.d.ts +25 -0
- package/dist/account-layer/use-simulate-deposit.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-deposit.js +29 -0
- package/dist/account-layer/use-simulate-deposit.js.map +1 -0
- package/dist/account-layer/use-simulate-edit-account-name.d.ts +25 -0
- package/dist/account-layer/use-simulate-edit-account-name.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-edit-account-name.js +29 -0
- package/dist/account-layer/use-simulate-edit-account-name.js.map +1 -0
- package/dist/account-layer/use-simulate-remove-margin.d.ts +30 -0
- package/dist/account-layer/use-simulate-remove-margin.d.ts.map +1 -0
- package/dist/account-layer/use-simulate-remove-margin.js +29 -0
- package/dist/account-layer/use-simulate-remove-margin.js.map +1 -0
- package/dist/account-layer/use-sub-account-virtual-nonce.d.ts +23 -0
- package/dist/account-layer/use-sub-account-virtual-nonce.d.ts.map +1 -0
- package/dist/account-layer/use-sub-account-virtual-nonce.js +27 -0
- package/dist/account-layer/use-sub-account-virtual-nonce.js.map +1 -0
- package/dist/account-layer/use-sub-account.d.ts +22 -0
- package/dist/account-layer/use-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-sub-account.js +27 -0
- package/dist/account-layer/use-sub-account.js.map +1 -0
- package/dist/account-layer/use-sub-accounts-count-of-user.d.ts +22 -0
- package/dist/account-layer/use-sub-accounts-count-of-user.d.ts.map +1 -0
- package/dist/account-layer/use-sub-accounts-count-of-user.js +27 -0
- package/dist/account-layer/use-sub-accounts-count-of-user.js.map +1 -0
- package/dist/account-layer/use-user-sub-accounts-addresses.d.ts +24 -0
- package/dist/account-layer/use-user-sub-accounts-addresses.d.ts.map +1 -0
- package/dist/account-layer/use-user-sub-accounts-addresses.js +27 -0
- package/dist/account-layer/use-user-sub-accounts-addresses.js.map +1 -0
- package/dist/account-layer/use-user-sub-accounts.d.ts +28 -0
- package/dist/account-layer/use-user-sub-accounts.d.ts.map +1 -0
- package/dist/account-layer/use-user-sub-accounts.js +27 -0
- package/dist/account-layer/use-user-sub-accounts.js.map +1 -0
- package/dist/account-layer/use-virtual-account.d.ts +35 -0
- package/dist/account-layer/use-virtual-account.d.ts.map +1 -0
- package/dist/account-layer/use-virtual-account.js +32 -0
- package/dist/account-layer/use-virtual-account.js.map +1 -0
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.d.ts +25 -0
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.js +27 -0
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.js.map +1 -0
- package/dist/balance-history/index.d.ts +4 -0
- package/dist/balance-history/index.d.ts.map +1 -0
- package/dist/balance-history/use-balance-history.d.ts +26 -0
- package/dist/balance-history/use-balance-history.d.ts.map +1 -0
- package/dist/balance-history/use-balance-history.js +27 -0
- package/dist/balance-history/use-balance-history.js.map +1 -0
- package/dist/balance-history/use-deposit-history.d.ts +19 -0
- package/dist/balance-history/use-deposit-history.d.ts.map +1 -0
- package/dist/balance-history/use-deposit-history.js +14 -0
- package/dist/balance-history/use-deposit-history.js.map +1 -0
- package/dist/balance-history/use-withdraw-history.d.ts +20 -0
- package/dist/balance-history/use-withdraw-history.d.ts.map +1 -0
- package/dist/balance-history/use-withdraw-history.js +14 -0
- package/dist/balance-history/use-withdraw-history.js.map +1 -0
- package/dist/collateral/index.d.ts +5 -0
- package/dist/collateral/index.d.ts.map +1 -0
- package/dist/collateral/use-approve-collateral.d.ts +27 -0
- package/dist/collateral/use-approve-collateral.d.ts.map +1 -0
- package/dist/collateral/use-approve-collateral.js +40 -0
- package/dist/collateral/use-approve-collateral.js.map +1 -0
- package/dist/collateral/use-collateral-allowance.d.ts +24 -0
- package/dist/collateral/use-collateral-allowance.d.ts.map +1 -0
- package/dist/collateral/use-collateral-allowance.js +27 -0
- package/dist/collateral/use-collateral-allowance.js.map +1 -0
- package/dist/collateral/use-collateral-balance.d.ts +22 -0
- package/dist/collateral/use-collateral-balance.d.ts.map +1 -0
- package/dist/collateral/use-collateral-balance.js +27 -0
- package/dist/collateral/use-collateral-balance.js.map +1 -0
- package/dist/collateral/use-simulate-approve-collateral.d.ts +26 -0
- package/dist/collateral/use-simulate-approve-collateral.d.ts.map +1 -0
- package/dist/collateral/use-simulate-approve-collateral.js +29 -0
- package/dist/collateral/use-simulate-approve-collateral.js.map +1 -0
- package/dist/error-codes/index.d.ts +3 -0
- package/dist/error-codes/index.d.ts.map +1 -0
- package/dist/error-codes/use-solver-error-codes.d.ts +27 -0
- package/dist/error-codes/use-solver-error-codes.d.ts.map +1 -0
- package/dist/error-codes/use-solver-error-codes.js +27 -0
- package/dist/error-codes/use-solver-error-codes.js.map +1 -0
- package/dist/error-codes/use-solver-error-message.d.ts +23 -0
- package/dist/error-codes/use-solver-error-message.d.ts.map +1 -0
- package/dist/error-codes/use-solver-error-message.js +11 -0
- package/dist/error-codes/use-solver-error-message.js.map +1 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/normalize-symm-error.d.ts +14 -0
- package/dist/errors/normalize-symm-error.d.ts.map +1 -0
- package/dist/errors/normalize-symm-error.js +86 -0
- package/dist/errors/normalize-symm-error.js.map +1 -0
- package/dist/errors/symmio-request-error.d.ts +54 -0
- package/dist/errors/symmio-request-error.d.ts.map +1 -0
- package/dist/errors/symmio-request-error.js +17 -0
- package/dist/errors/symmio-request-error.js.map +1 -0
- package/dist/errors/types.d.ts +21 -0
- package/dist/errors/types.d.ts.map +1 -0
- package/dist/fees/index.d.ts +2 -0
- package/dist/fees/index.d.ts.map +1 -0
- package/dist/fees/use-fee-for-user.d.ts +25 -0
- package/dist/fees/use-fee-for-user.d.ts.map +1 -0
- package/dist/fees/use-fee-for-user.js +27 -0
- package/dist/fees/use-fee-for-user.js.map +1 -0
- package/dist/index.d.ts +184 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/instant-layer/index.d.ts +14 -0
- package/dist/instant-layer/index.d.ts.map +1 -0
- package/dist/instant-layer/use-delegation-expiry.d.ts +22 -0
- package/dist/instant-layer/use-delegation-expiry.d.ts.map +1 -0
- package/dist/instant-layer/use-delegation-expiry.js +23 -0
- package/dist/instant-layer/use-delegation-expiry.js.map +1 -0
- package/dist/instant-layer/use-grant-delegation.d.ts +26 -0
- package/dist/instant-layer/use-grant-delegation.d.ts.map +1 -0
- package/dist/instant-layer/use-grant-delegation.js +38 -0
- package/dist/instant-layer/use-grant-delegation.js.map +1 -0
- package/dist/instant-layer/use-instant-close-auto.d.ts +29 -0
- package/dist/instant-layer/use-instant-close-auto.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-close-auto.js +32 -0
- package/dist/instant-layer/use-instant-close-auto.js.map +1 -0
- package/dist/instant-layer/use-instant-close-bulk-auto.d.ts +26 -0
- package/dist/instant-layer/use-instant-close-bulk-auto.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-close-bulk-auto.js +32 -0
- package/dist/instant-layer/use-instant-close-bulk-auto.js.map +1 -0
- package/dist/instant-layer/use-instant-close-bulk.d.ts +24 -0
- package/dist/instant-layer/use-instant-close-bulk.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-close-bulk.js +32 -0
- package/dist/instant-layer/use-instant-close-bulk.js.map +1 -0
- package/dist/instant-layer/use-instant-close.d.ts +29 -0
- package/dist/instant-layer/use-instant-close.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-close.js +32 -0
- package/dist/instant-layer/use-instant-close.js.map +1 -0
- package/dist/instant-layer/use-instant-closes.d.ts +25 -0
- package/dist/instant-layer/use-instant-closes.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-closes.js +27 -0
- package/dist/instant-layer/use-instant-closes.js.map +1 -0
- package/dist/instant-layer/use-instant-open-auto.d.ts +31 -0
- package/dist/instant-layer/use-instant-open-auto.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-open-auto.js +32 -0
- package/dist/instant-layer/use-instant-open-auto.js.map +1 -0
- package/dist/instant-layer/use-instant-open-quote-id.d.ts +28 -0
- package/dist/instant-layer/use-instant-open-quote-id.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-open-quote-id.js +27 -0
- package/dist/instant-layer/use-instant-open-quote-id.js.map +1 -0
- package/dist/instant-layer/use-instant-open.d.ts +33 -0
- package/dist/instant-layer/use-instant-open.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-open.js +32 -0
- package/dist/instant-layer/use-instant-open.js.map +1 -0
- package/dist/instant-layer/use-instant-opens.d.ts +25 -0
- package/dist/instant-layer/use-instant-opens.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-opens.js +27 -0
- package/dist/instant-layer/use-instant-opens.js.map +1 -0
- package/dist/instant-layer/use-is-delegation-active.d.ts +22 -0
- package/dist/instant-layer/use-is-delegation-active.d.ts.map +1 -0
- package/dist/instant-layer/use-is-delegation-active.js +23 -0
- package/dist/instant-layer/use-is-delegation-active.js.map +1 -0
- package/dist/instant-layer/use-simulate-grant-delegation.d.ts +25 -0
- package/dist/instant-layer/use-simulate-grant-delegation.d.ts.map +1 -0
- package/dist/instant-layer/use-simulate-grant-delegation.js +29 -0
- package/dist/instant-layer/use-simulate-grant-delegation.js.map +1 -0
- package/dist/locked-params/index.d.ts +2 -0
- package/dist/locked-params/index.d.ts.map +1 -0
- package/dist/locked-params/use-locked-params.d.ts +23 -0
- package/dist/locked-params/use-locked-params.d.ts.map +1 -0
- package/dist/locked-params/use-locked-params.js +27 -0
- package/dist/locked-params/use-locked-params.js.map +1 -0
- package/dist/markets/index.d.ts +3 -0
- package/dist/markets/index.d.ts.map +1 -0
- package/dist/markets/use-markets.d.ts +26 -0
- package/dist/markets/use-markets.d.ts.map +1 -0
- package/dist/markets/use-markets.js +27 -0
- package/dist/markets/use-markets.js.map +1 -0
- package/dist/markets/use-onchain-contract-markets.d.ts +24 -0
- package/dist/markets/use-onchain-contract-markets.d.ts.map +1 -0
- package/dist/markets/use-onchain-contract-markets.js +27 -0
- package/dist/markets/use-onchain-contract-markets.js.map +1 -0
- package/dist/muon/index.d.ts +11 -0
- package/dist/muon/index.d.ts.map +1 -0
- package/dist/muon/use-deallocate-upnl-sig.d.ts +28 -0
- package/dist/muon/use-deallocate-upnl-sig.d.ts.map +1 -0
- package/dist/muon/use-deallocate-upnl-sig.js +27 -0
- package/dist/muon/use-deallocate-upnl-sig.js.map +1 -0
- package/dist/muon/use-muon-party-a-overview.d.ts +29 -0
- package/dist/muon/use-muon-party-a-overview.d.ts.map +1 -0
- package/dist/muon/use-muon-party-a-overview.js +27 -0
- package/dist/muon/use-muon-party-a-overview.js.map +1 -0
- package/dist/muon/use-muon-price-range.d.ts +35 -0
- package/dist/muon/use-muon-price-range.d.ts.map +1 -0
- package/dist/muon/use-muon-price-range.js +31 -0
- package/dist/muon/use-muon-price-range.js.map +1 -0
- package/dist/muon/use-muon-price.d.ts +28 -0
- package/dist/muon/use-muon-price.d.ts.map +1 -0
- package/dist/muon/use-muon-price.js +27 -0
- package/dist/muon/use-muon-price.js.map +1 -0
- package/dist/muon/use-muon-settle-upnl.d.ts +29 -0
- package/dist/muon/use-muon-settle-upnl.d.ts.map +1 -0
- package/dist/muon/use-muon-settle-upnl.js +28 -0
- package/dist/muon/use-muon-settle-upnl.js.map +1 -0
- package/dist/muon/use-muon-upnl-a-with-symbol-price.d.ts +29 -0
- package/dist/muon/use-muon-upnl-a-with-symbol-price.d.ts.map +1 -0
- package/dist/muon/use-muon-upnl-a-with-symbol-price.js +28 -0
- package/dist/muon/use-muon-upnl-a-with-symbol-price.js.map +1 -0
- package/dist/muon/use-muon-upnl-a.d.ts +28 -0
- package/dist/muon/use-muon-upnl-a.d.ts.map +1 -0
- package/dist/muon/use-muon-upnl-a.js +27 -0
- package/dist/muon/use-muon-upnl-a.js.map +1 -0
- package/dist/muon/use-muon-upnl-b.d.ts +29 -0
- package/dist/muon/use-muon-upnl-b.d.ts.map +1 -0
- package/dist/muon/use-muon-upnl-b.js +28 -0
- package/dist/muon/use-muon-upnl-b.js.map +1 -0
- package/dist/muon/use-muon-upnl-with-symbol-price.d.ts +28 -0
- package/dist/muon/use-muon-upnl-with-symbol-price.d.ts.map +1 -0
- package/dist/muon/use-muon-upnl-with-symbol-price.js +29 -0
- package/dist/muon/use-muon-upnl-with-symbol-price.js.map +1 -0
- package/dist/muon/use-muon-upnl.d.ts +28 -0
- package/dist/muon/use-muon-upnl.d.ts.map +1 -0
- package/dist/muon/use-muon-upnl.js +28 -0
- package/dist/muon/use-muon-upnl.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/use-search-notifications.d.ts +29 -0
- package/dist/notifications/use-search-notifications.d.ts.map +1 -0
- package/dist/notifications/use-search-notifications.js +27 -0
- package/dist/notifications/use-search-notifications.js.map +1 -0
- package/dist/notional-cap/index.d.ts +4 -0
- package/dist/notional-cap/index.d.ts.map +1 -0
- package/dist/notional-cap/use-notional-cap-all.d.ts +32 -0
- package/dist/notional-cap/use-notional-cap-all.d.ts.map +1 -0
- package/dist/notional-cap/use-notional-cap-all.js +32 -0
- package/dist/notional-cap/use-notional-cap-all.js.map +1 -0
- package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts +36 -0
- package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts.map +1 -0
- package/dist/notional-cap/use-notional-cap-by-symbol-id.js +32 -0
- package/dist/notional-cap/use-notional-cap-by-symbol-id.js.map +1 -0
- package/dist/notional-cap/use-open-interest-by-symbol-id.d.ts +34 -0
- package/dist/notional-cap/use-open-interest-by-symbol-id.d.ts.map +1 -0
- package/dist/notional-cap/use-open-interest-by-symbol-id.js +32 -0
- package/dist/notional-cap/use-open-interest-by-symbol-id.js.map +1 -0
- package/dist/price-service/index.d.ts +9 -0
- package/dist/price-service/index.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-by-market-id.d.ts +42 -0
- package/dist/price-service/use-enigma-price-by-market-id.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-by-market-id.js +30 -0
- package/dist/price-service/use-enigma-price-by-market-id.js.map +1 -0
- package/dist/price-service/use-enigma-price-by-name.d.ts +41 -0
- package/dist/price-service/use-enigma-price-by-name.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-by-name.js +45 -0
- package/dist/price-service/use-enigma-price-by-name.js.map +1 -0
- package/dist/price-service/use-enigma-price-service-health.d.ts +20 -0
- package/dist/price-service/use-enigma-price-service-health.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-service-health.js +27 -0
- package/dist/price-service/use-enigma-price-service-health.js.map +1 -0
- package/dist/price-service/use-enigma-price-service-metadata.d.ts +20 -0
- package/dist/price-service/use-enigma-price-service-metadata.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-service-metadata.js +27 -0
- package/dist/price-service/use-enigma-price-service-metadata.js.map +1 -0
- package/dist/price-service/use-enigma-price-service-prices-by-addresses.d.ts +20 -0
- package/dist/price-service/use-enigma-price-service-prices-by-addresses.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-service-prices-by-addresses.js +27 -0
- package/dist/price-service/use-enigma-price-service-prices-by-addresses.js.map +1 -0
- package/dist/price-service/use-enigma-price-service-prices-by-names.d.ts +20 -0
- package/dist/price-service/use-enigma-price-service-prices-by-names.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-service-prices-by-names.js +27 -0
- package/dist/price-service/use-enigma-price-service-prices-by-names.js.map +1 -0
- package/dist/price-service/use-enigma-price-service-symbols-info.d.ts +20 -0
- package/dist/price-service/use-enigma-price-service-symbols-info.d.ts.map +1 -0
- package/dist/price-service/use-enigma-price-service-symbols-info.js +27 -0
- package/dist/price-service/use-enigma-price-service-symbols-info.js.map +1 -0
- package/dist/price-service/use-enigma-prices.d.ts +40 -0
- package/dist/price-service/use-enigma-prices.d.ts.map +1 -0
- package/dist/price-service/use-enigma-prices.js +47 -0
- package/dist/price-service/use-enigma-prices.js.map +1 -0
- package/dist/provider/index.d.ts +4 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/symmio-config-context.d.ts +9 -0
- package/dist/provider/symmio-config-context.d.ts.map +1 -0
- package/dist/provider/symmio-config-context.js +8 -0
- package/dist/provider/symmio-config-context.js.map +1 -0
- package/dist/provider/symmio-provider.d.ts +49 -0
- package/dist/provider/symmio-provider.d.ts.map +1 -0
- package/dist/provider/symmio-provider.js +39 -0
- package/dist/provider/symmio-provider.js.map +1 -0
- package/dist/provider/use-symmio-chain-id.d.ts +14 -0
- package/dist/provider/use-symmio-chain-id.d.ts.map +1 -0
- package/dist/provider/use-symmio-chain-id.js +10 -0
- package/dist/provider/use-symmio-chain-id.js.map +1 -0
- package/dist/provider/use-symmio-config.d.ts +24 -0
- package/dist/provider/use-symmio-config.d.ts.map +1 -0
- package/dist/provider/use-symmio-config.js +13 -0
- package/dist/provider/use-symmio-config.js.map +1 -0
- package/dist/quotes/index.d.ts +16 -0
- package/dist/quotes/index.d.ts.map +1 -0
- package/dist/quotes/optimistic-quotes-store.d.ts +47 -0
- package/dist/quotes/optimistic-quotes-store.d.ts.map +1 -0
- package/dist/quotes/optimistic-quotes-store.js +27 -0
- package/dist/quotes/optimistic-quotes-store.js.map +1 -0
- package/dist/quotes/use-account-liquidation-price.d.ts +39 -0
- package/dist/quotes/use-account-liquidation-price.d.ts.map +1 -0
- package/dist/quotes/use-account-liquidation-price.js +57 -0
- package/dist/quotes/use-account-liquidation-price.js.map +1 -0
- package/dist/quotes/use-grouped-quotes.d.ts +55 -0
- package/dist/quotes/use-grouped-quotes.d.ts.map +1 -0
- package/dist/quotes/use-grouped-quotes.js +21 -0
- package/dist/quotes/use-grouped-quotes.js.map +1 -0
- package/dist/quotes/use-managed-quotes.d.ts +108 -0
- package/dist/quotes/use-managed-quotes.d.ts.map +1 -0
- package/dist/quotes/use-managed-quotes.js +314 -0
- package/dist/quotes/use-managed-quotes.js.map +1 -0
- package/dist/quotes/use-party-a-open-positions.d.ts +23 -0
- package/dist/quotes/use-party-a-open-positions.d.ts.map +1 -0
- package/dist/quotes/use-party-a-open-positions.js +27 -0
- package/dist/quotes/use-party-a-open-positions.js.map +1 -0
- package/dist/quotes/use-party-a-pending-quotes.d.ts +23 -0
- package/dist/quotes/use-party-a-pending-quotes.d.ts.map +1 -0
- package/dist/quotes/use-party-a-pending-quotes.js +27 -0
- package/dist/quotes/use-party-a-pending-quotes.js.map +1 -0
- package/dist/quotes/use-quote-events-by-type.d.ts +26 -0
- package/dist/quotes/use-quote-events-by-type.d.ts.map +1 -0
- package/dist/quotes/use-quote-events-by-type.js +27 -0
- package/dist/quotes/use-quote-events-by-type.js.map +1 -0
- package/dist/quotes/use-quote-funding.d.ts +35 -0
- package/dist/quotes/use-quote-funding.d.ts.map +1 -0
- package/dist/quotes/use-quote-funding.js +21 -0
- package/dist/quotes/use-quote-funding.js.map +1 -0
- package/dist/quotes/use-quote-history.d.ts +26 -0
- package/dist/quotes/use-quote-history.d.ts.map +1 -0
- package/dist/quotes/use-quote-history.js +27 -0
- package/dist/quotes/use-quote-history.js.map +1 -0
- package/dist/quotes/use-quote-platform-fee.d.ts +31 -0
- package/dist/quotes/use-quote-platform-fee.d.ts.map +1 -0
- package/dist/quotes/use-quote-platform-fee.js +31 -0
- package/dist/quotes/use-quote-platform-fee.js.map +1 -0
- package/dist/quotes/use-quote-price-history.d.ts +24 -0
- package/dist/quotes/use-quote-price-history.d.ts.map +1 -0
- package/dist/quotes/use-quote-price-history.js +14 -0
- package/dist/quotes/use-quote-price-history.js.map +1 -0
- package/dist/quotes/use-quote-upnl-and-pnl.d.ts +34 -0
- package/dist/quotes/use-quote-upnl-and-pnl.d.ts.map +1 -0
- package/dist/quotes/use-quote-upnl-and-pnl.js +61 -0
- package/dist/quotes/use-quote-upnl-and-pnl.js.map +1 -0
- package/dist/quotes/use-quote.d.ts +23 -0
- package/dist/quotes/use-quote.d.ts.map +1 -0
- package/dist/quotes/use-quote.js +27 -0
- package/dist/quotes/use-quote.js.map +1 -0
- package/dist/quotes/use-quotes-funding.d.ts +52 -0
- package/dist/quotes/use-quotes-funding.d.ts.map +1 -0
- package/dist/quotes/use-quotes-funding.js +80 -0
- package/dist/quotes/use-quotes-funding.js.map +1 -0
- package/dist/quotes/use-subgraph-query.d.ts +25 -0
- package/dist/quotes/use-subgraph-query.d.ts.map +1 -0
- package/dist/quotes/use-subgraph-query.js +27 -0
- package/dist/quotes/use-subgraph-query.js.map +1 -0
- package/dist/tpsl/index.d.ts +8 -0
- package/dist/tpsl/index.d.ts.map +1 -0
- package/dist/tpsl/to-quote-tpsl.d.ts +19 -0
- package/dist/tpsl/to-quote-tpsl.d.ts.map +1 -0
- package/dist/tpsl/to-quote-tpsl.js +46 -0
- package/dist/tpsl/to-quote-tpsl.js.map +1 -0
- package/dist/tpsl/tpsl-confirming.d.ts +36 -0
- package/dist/tpsl/tpsl-confirming.d.ts.map +1 -0
- package/dist/tpsl/tpsl-confirming.js +28 -0
- package/dist/tpsl/tpsl-confirming.js.map +1 -0
- package/dist/tpsl/use-quote-tpsl.d.ts +34 -0
- package/dist/tpsl/use-quote-tpsl.d.ts.map +1 -0
- package/dist/tpsl/use-quote-tpsl.js +73 -0
- package/dist/tpsl/use-quote-tpsl.js.map +1 -0
- package/dist/tpsl/use-set-quote-tpsl.d.ts +22 -0
- package/dist/tpsl/use-set-quote-tpsl.d.ts.map +1 -0
- package/dist/tpsl/use-set-quote-tpsl.js +43 -0
- package/dist/tpsl/use-set-quote-tpsl.js.map +1 -0
- package/dist/tpsl/use-tpsl-config.d.ts +14 -0
- package/dist/tpsl/use-tpsl-config.d.ts.map +1 -0
- package/dist/tpsl/use-tpsl-config.js +31 -0
- package/dist/tpsl/use-tpsl-config.js.map +1 -0
- package/dist/tpsl/use-tpsl-signing-spec.d.ts +13 -0
- package/dist/tpsl/use-tpsl-signing-spec.d.ts.map +1 -0
- package/dist/tpsl/use-tpsl-signing-spec.js +31 -0
- package/dist/tpsl/use-tpsl-signing-spec.js.map +1 -0
- package/dist/tpsl/use-watch-tpsl-notifications.d.ts +30 -0
- package/dist/tpsl/use-watch-tpsl-notifications.d.ts.map +1 -0
- package/dist/tpsl/use-watch-tpsl-notifications.js +44 -0
- package/dist/tpsl/use-watch-tpsl-notifications.js.map +1 -0
- package/dist/transactions/index.d.ts +4 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/resolve-write-result.d.ts +40 -0
- package/dist/transactions/resolve-write-result.d.ts.map +1 -0
- package/dist/transactions/resolve-write-result.js +15 -0
- package/dist/transactions/resolve-write-result.js.map +1 -0
- package/dist/transactions/use-transactions-store.d.ts +52 -0
- package/dist/transactions/use-transactions-store.d.ts.map +1 -0
- package/dist/transactions/use-transactions-store.js +24 -0
- package/dist/transactions/use-transactions-store.js.map +1 -0
- package/dist/transactions/write-types.d.ts +28 -0
- package/dist/transactions/write-types.d.ts.map +1 -0
- package/dist/transfers/index.d.ts +2 -0
- package/dist/transfers/index.d.ts.map +1 -0
- package/dist/transfers/use-transfer-history.d.ts +26 -0
- package/dist/transfers/use-transfer-history.d.ts.map +1 -0
- package/dist/transfers/use-transfer-history.js +27 -0
- package/dist/transfers/use-transfer-history.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/predicate-match.d.ts +27 -0
- package/dist/utils/predicate-match.d.ts.map +1 -0
- package/dist/utils/predicate-match.js +18 -0
- package/dist/utils/predicate-match.js.map +1 -0
- package/dist/wallet/index.d.ts +5 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/use-connect-wallet.d.ts +34 -0
- package/dist/wallet/use-connect-wallet.d.ts.map +1 -0
- package/dist/wallet/use-connect-wallet.js +24 -0
- package/dist/wallet/use-connect-wallet.js.map +1 -0
- package/dist/wallet/use-disconnect-wallet.d.ts +20 -0
- package/dist/wallet/use-disconnect-wallet.d.ts.map +1 -0
- package/dist/wallet/use-disconnect-wallet.js +21 -0
- package/dist/wallet/use-disconnect-wallet.js.map +1 -0
- package/dist/wallet/use-switch-to-symmio-chain.d.ts +29 -0
- package/dist/wallet/use-switch-to-symmio-chain.d.ts.map +1 -0
- package/dist/wallet/use-switch-to-symmio-chain.js +24 -0
- package/dist/wallet/use-switch-to-symmio-chain.js.map +1 -0
- package/dist/wallet/use-wallet-account.d.ts +32 -0
- package/dist/wallet/use-wallet-account.d.ts.map +1 -0
- package/dist/wallet/use-wallet-account.js +18 -0
- package/dist/wallet/use-wallet-account.js.map +1 -0
- package/dist/websocket/index.d.ts +2 -0
- package/dist/websocket/index.d.ts.map +1 -0
- package/dist/websocket/use-notifications.d.ts +48 -0
- package/dist/websocket/use-notifications.d.ts.map +1 -0
- package/dist/websocket/use-notifications.js +51 -0
- package/dist/websocket/use-notifications.js.map +1 -0
- package/dist/withdraw/index.d.ts +11 -0
- package/dist/withdraw/index.d.ts.map +1 -0
- package/dist/withdraw/use-finalize-withdraw-request.d.ts +26 -0
- package/dist/withdraw/use-finalize-withdraw-request.d.ts.map +1 -0
- package/dist/withdraw/use-finalize-withdraw-request.js +40 -0
- package/dist/withdraw/use-finalize-withdraw-request.js.map +1 -0
- package/dist/withdraw/use-initiate-withdraw.d.ts +28 -0
- package/dist/withdraw/use-initiate-withdraw.d.ts.map +1 -0
- package/dist/withdraw/use-initiate-withdraw.js +42 -0
- package/dist/withdraw/use-initiate-withdraw.js.map +1 -0
- package/dist/withdraw/use-last-withdraw-request-id.d.ts +22 -0
- package/dist/withdraw/use-last-withdraw-request-id.d.ts.map +1 -0
- package/dist/withdraw/use-last-withdraw-request-id.js +27 -0
- package/dist/withdraw/use-last-withdraw-request-id.js.map +1 -0
- package/dist/withdraw/use-pending-withdraw-requests.d.ts +21 -0
- package/dist/withdraw/use-pending-withdraw-requests.d.ts.map +1 -0
- package/dist/withdraw/use-pending-withdraw-requests.js +27 -0
- package/dist/withdraw/use-pending-withdraw-requests.js.map +1 -0
- package/dist/withdraw/use-request-cancel-withdraw.d.ts +25 -0
- package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -0
- package/dist/withdraw/use-request-cancel-withdraw.js +40 -0
- package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -0
- package/dist/withdraw/use-simulate-finalize-withdraw-request.d.ts +25 -0
- package/dist/withdraw/use-simulate-finalize-withdraw-request.d.ts.map +1 -0
- package/dist/withdraw/use-simulate-finalize-withdraw-request.js +29 -0
- package/dist/withdraw/use-simulate-finalize-withdraw-request.js.map +1 -0
- package/dist/withdraw/use-simulate-initiate-withdraw.d.ts +26 -0
- package/dist/withdraw/use-simulate-initiate-withdraw.d.ts.map +1 -0
- package/dist/withdraw/use-simulate-initiate-withdraw.js +29 -0
- package/dist/withdraw/use-simulate-initiate-withdraw.js.map +1 -0
- package/dist/withdraw/use-simulate-request-cancel-withdraw.d.ts +25 -0
- package/dist/withdraw/use-simulate-request-cancel-withdraw.d.ts.map +1 -0
- package/dist/withdraw/use-simulate-request-cancel-withdraw.js +29 -0
- package/dist/withdraw/use-simulate-request-cancel-withdraw.js.map +1 -0
- package/dist/withdraw/use-withdraw-requests.d.ts +21 -0
- package/dist/withdraw/use-withdraw-requests.d.ts.map +1 -0
- package/dist/withdraw/use-withdraw-requests.js +27 -0
- package/dist/withdraw/use-withdraw-requests.js.map +1 -0
- package/dist/withdraw/use-withdrawable-time.d.ts +22 -0
- package/dist/withdraw/use-withdrawable-time.d.ts.map +1 -0
- package/dist/withdraw/use-withdrawable-time.js +27 -0
- package/dist/withdraw/use-withdrawable-time.js.map +1 -0
- package/package.json +112 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getPartyAOpenPositionsQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-party-a-open-positions.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as usePartyAOpenPositions };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-party-a-open-positions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-party-a-open-positions.js","names":[],"sources":["../../src/quotes/use-party-a-open-positions.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getPartyAOpenPositionsQueryOptions,\n type ConfigParameter,\n type GetPartyAOpenPositionsOptions,\n type GetPartyAOpenPositionsReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link usePartyAOpenPositions}: the core query options (partyA,\n * pagination, chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UsePartyAOpenPositionsParameters = GetPartyAOpenPositionsOptions & ConfigParameter;\n\n/** Return type of {@link usePartyAOpenPositions}. */\nexport type UsePartyAOpenPositionsReturnType = UseQueryResult<GetPartyAOpenPositionsReturnType, SymmioRequestError>;\n\n/**\n * Read a partyA's open positions (full `Quote` structs) from the SYMMIO core.\n * `partyA` is a SubAccount (Majors) or Virtual Account (VibeCaps). The query is\n * disabled until `partyA` is set. `chainId` defaults to the connected chain.\n * Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: positions, isLoading } = usePartyAOpenPositions({ partyA: \"0xva…\" });\n * ```\n */\nexport function usePartyAOpenPositions(\n parameters: UsePartyAOpenPositionsParameters = {},\n): UsePartyAOpenPositionsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getPartyAOpenPositionsQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UsePartyAOpenPositionsReturnType;\n}\n"],"mappings":";;;;;;;AAkCA,SAAgB,EACd,IAA+C,CAAC,GACd;CAClC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,GAAQ;EACzD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ConfigParameter, GetPartyAPendingQuotesOptions, GetPartyAPendingQuotesReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link usePartyAPendingQuotes}: the core query options (partyA,
|
|
6
|
+
* chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UsePartyAPendingQuotesParameters = GetPartyAPendingQuotesOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link usePartyAPendingQuotes}. */
|
|
10
|
+
export type UsePartyAPendingQuotesReturnType = UseQueryResult<GetPartyAPendingQuotesReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read the ids of a partyA's pending quotes (`PENDING` / `LOCKED` /
|
|
13
|
+
* `CANCEL_PENDING`) from the SYMMIO core. Hydrate each id with {@link useQuote}.
|
|
14
|
+
* The query is disabled until `partyA` is set. `chainId` defaults to the
|
|
15
|
+
* connected chain. Errors are normalized to {@link SymmioRequestError}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { data: ids } = usePartyAPendingQuotes({ partyA: "0xva…" });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function usePartyAPendingQuotes(parameters?: UsePartyAPendingQuotesParameters): UsePartyAPendingQuotesReturnType;
|
|
23
|
+
//# sourceMappingURL=use-party-a-pending-quotes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-party-a-pending-quotes.d.ts","sourceRoot":"","sources":["../../src/quotes/use-party-a-pending-quotes.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACtC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,GAAG,eAAe,CAAC;AAE/F,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,gCAAgC,EAAE,kBAAkB,CAAC,CAAC;AAEpH;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,gCAAqC,GAChD,gCAAgC,CAkBlC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getPartyAPendingQuotesQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-party-a-pending-quotes.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as usePartyAPendingQuotes };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-party-a-pending-quotes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-party-a-pending-quotes.js","names":[],"sources":["../../src/quotes/use-party-a-pending-quotes.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getPartyAPendingQuotesQueryOptions,\n type ConfigParameter,\n type GetPartyAPendingQuotesOptions,\n type GetPartyAPendingQuotesReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link usePartyAPendingQuotes}: the core query options (partyA,\n * chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UsePartyAPendingQuotesParameters = GetPartyAPendingQuotesOptions & ConfigParameter;\n\n/** Return type of {@link usePartyAPendingQuotes}. */\nexport type UsePartyAPendingQuotesReturnType = UseQueryResult<GetPartyAPendingQuotesReturnType, SymmioRequestError>;\n\n/**\n * Read the ids of a partyA's pending quotes (`PENDING` / `LOCKED` /\n * `CANCEL_PENDING`) from the SYMMIO core. Hydrate each id with {@link useQuote}.\n * The query is disabled until `partyA` is set. `chainId` defaults to the\n * connected chain. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: ids } = usePartyAPendingQuotes({ partyA: \"0xva…\" });\n * ```\n */\nexport function usePartyAPendingQuotes(\n parameters: UsePartyAPendingQuotesParameters = {},\n): UsePartyAPendingQuotesReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getPartyAPendingQuotesQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UsePartyAPendingQuotesReturnType;\n}\n"],"mappings":";;;;;;;AAkCA,SAAgB,EACd,IAA+C,CAAC,GACd;CAClC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,GAAQ;EACzD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigParameter, GetQuoteEventsByTypeOptions, GetQuoteEventsByTypeReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useQuoteEventsByType}: the core query options (quote id,
|
|
6
|
+
* types, paging, sort, chain id, TanStack `query` overrides) plus an optional
|
|
7
|
+
* `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseQuoteEventsByTypeParameters = GetQuoteEventsByTypeOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useQuoteEventsByType}. */
|
|
11
|
+
export type UseQuoteEventsByTypeReturnType = UseQueryResult<GetQuoteEventsByTypeReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read non-terminal `QuoteEvent`s for one quote from the analytics subgraph,
|
|
14
|
+
* filtered to the requested event types. Pair with {@link PRICE_HISTORY_EVENT_TYPES}
|
|
15
|
+
* (or call {@link useQuotePriceHistory} for that preset filter).
|
|
16
|
+
*
|
|
17
|
+
* `chainId` defaults to the connected chain. Errors normalized to
|
|
18
|
+
* {@link SymmioRequestError}.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { data } = useQuoteEventsByType({ quoteId: quote.quoteId, types: PRICE_HISTORY_EVENT_TYPES });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useQuoteEventsByType(parameters: UseQuoteEventsByTypeParameters): UseQuoteEventsByTypeReturnType;
|
|
26
|
+
//# sourceMappingURL=use-quote-events-by-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-events-by-type.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-events-by-type.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,GAAG,eAAe,CAAC;AAE3F,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;AAEhH;;;;;;;;;;;;GAYG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,8BAA8B,GAAG,8BAA8B,CAkB/G"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getQuoteEventsByTypeQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-quote-events-by-type.ts
|
|
8
|
+
function a(a) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useQuoteEventsByType };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-quote-events-by-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-events-by-type.js","names":[],"sources":["../../src/quotes/use-quote-events-by-type.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteEventsByTypeQueryOptions,\n type ConfigParameter,\n type GetQuoteEventsByTypeOptions,\n type GetQuoteEventsByTypeReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useQuoteEventsByType}: the core query options (quote id,\n * types, paging, sort, chain id, TanStack `query` overrides) plus an optional\n * `config`.\n */\nexport type UseQuoteEventsByTypeParameters = GetQuoteEventsByTypeOptions & ConfigParameter;\n\n/** Return type of {@link useQuoteEventsByType}. */\nexport type UseQuoteEventsByTypeReturnType = UseQueryResult<GetQuoteEventsByTypeReturnType, SymmioRequestError>;\n\n/**\n * Read non-terminal `QuoteEvent`s for one quote from the analytics subgraph,\n * filtered to the requested event types. Pair with {@link PRICE_HISTORY_EVENT_TYPES}\n * (or call {@link useQuotePriceHistory} for that preset filter).\n *\n * `chainId` defaults to the connected chain. Errors normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useQuoteEventsByType({ quoteId: quote.quoteId, types: PRICE_HISTORY_EVENT_TYPES });\n * ```\n */\nexport function useQuoteEventsByType(parameters: UseQuoteEventsByTypeParameters): UseQuoteEventsByTypeReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getQuoteEventsByTypeQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQuoteEventsByTypeReturnType;\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,EAAqB,GAA4E;CAC/G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAiC,GAAQ;EACvD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ConfigParameter, QuoteFundingData } from '@symmio/trading-core';
|
|
2
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for {@link useQuoteFunding}.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseQuoteFundingParameters extends ConfigParameter {
|
|
7
|
+
/** On-chain quote id. `undefined` (off-chain) disables the query. */
|
|
8
|
+
quoteId?: bigint;
|
|
9
|
+
/** Optional chain id override; defaults to the connected chain. */
|
|
10
|
+
chainId?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Return type of {@link useQuoteFunding}.
|
|
14
|
+
*/
|
|
15
|
+
export interface UseQuoteFundingReturnType {
|
|
16
|
+
/** The funding row for this quote, or `null` until it resolves. */
|
|
17
|
+
data: QuoteFundingData | null;
|
|
18
|
+
/** `true` while the subgraph query is loading. */
|
|
19
|
+
isLoading: boolean;
|
|
20
|
+
/** Normalized request error, when one occurred. */
|
|
21
|
+
error: SymmioRequestError | null;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Read funding totals (paid / received / net) for a single on-chain quote.
|
|
25
|
+
* Disabled while `quoteId` is `undefined` (off-chain row).
|
|
26
|
+
*
|
|
27
|
+
* Thin wrapper over {@link useQuotesFunding} with a one-element batch.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* const { data, isLoading } = useQuoteFunding({ quoteId: quote.quoteId });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function useQuoteFunding(parameters: UseQuoteFundingParameters): UseQuoteFundingReturnType;
|
|
35
|
+
//# sourceMappingURL=use-quote-funding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-funding.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-funding.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,mEAAmE;IACnE,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC9B,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,yBAAyB,GAAG,yBAAyB,CAYhG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuotesFunding as e } from "./use-quotes-funding.js";
|
|
3
|
+
import { useMemo as t } from "react";
|
|
4
|
+
//#region src/quotes/use-quote-funding.ts
|
|
5
|
+
var n = [];
|
|
6
|
+
function r(r) {
|
|
7
|
+
let { quoteId: i, chainId: a, config: o } = r, s = e({
|
|
8
|
+
quotes: t(() => i === void 0 ? n : [{ quoteId: i }], [i]),
|
|
9
|
+
chainId: a,
|
|
10
|
+
config: o
|
|
11
|
+
});
|
|
12
|
+
return {
|
|
13
|
+
data: s.rows[0] ?? null,
|
|
14
|
+
isLoading: s.isLoading,
|
|
15
|
+
error: s.error
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { r as useQuoteFunding };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=use-quote-funding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-funding.js","names":[],"sources":["../../src/quotes/use-quote-funding.ts"],"sourcesContent":["\"use client\";\n\nimport type { ConfigParameter, QuoteFundingData } from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useQuotesFunding } from \"./use-quotes-funding\";\n\n/**\n * Parameters for {@link useQuoteFunding}.\n */\nexport interface UseQuoteFundingParameters extends ConfigParameter {\n /** On-chain quote id. `undefined` (off-chain) disables the query. */\n quoteId?: bigint;\n /** Optional chain id override; defaults to the connected chain. */\n chainId?: number;\n}\n\n/**\n * Return type of {@link useQuoteFunding}.\n */\nexport interface UseQuoteFundingReturnType {\n /** The funding row for this quote, or `null` until it resolves. */\n data: QuoteFundingData | null;\n /** `true` while the subgraph query is loading. */\n isLoading: boolean;\n /** Normalized request error, when one occurred. */\n error: SymmioRequestError | null;\n}\n\nconst EMPTY_QUOTES: readonly { quoteId?: bigint }[] = [];\n\n/**\n * Read funding totals (paid / received / net) for a single on-chain quote.\n * Disabled while `quoteId` is `undefined` (off-chain row).\n *\n * Thin wrapper over {@link useQuotesFunding} with a one-element batch.\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useQuoteFunding({ quoteId: quote.quoteId });\n * ```\n */\nexport function useQuoteFunding(parameters: UseQuoteFundingParameters): UseQuoteFundingReturnType {\n const { quoteId, chainId, config } = parameters;\n\n const quotes = useMemo(() => (quoteId === undefined ? EMPTY_QUOTES : [{ quoteId }]), [quoteId]);\n\n const batch = useQuotesFunding({ quotes, chainId, config });\n\n return {\n data: batch.rows[0] ?? null,\n isLoading: batch.isLoading,\n error: batch.error,\n };\n}\n"],"mappings":";;;;AA6BA,IAAM,IAAgD,CAAC;AAavD,SAAgB,EAAgB,GAAkE;CAChG,IAAM,EAAE,YAAS,YAAS,cAAW,GAI/B,IAAQ,EAAiB;EAAE,QAFlB,QAAe,MAAY,KAAA,IAAY,IAAe,CAAC,EAAE,WAAQ,CAAC,GAAI,CAAC,CAAO,CAE5D;EAAQ;EAAS;CAAO,CAAC;CAE1D,OAAO;EACL,MAAM,EAAM,KAAK,MAAM;EACvB,WAAW,EAAM;EACjB,OAAO,EAAM;CACf;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigParameter, GetQuoteHistoryOptions, GetQuoteHistoryReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useQuoteHistory}: the core query options (subAccounts,
|
|
6
|
+
* close type, paging, time range, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseQuoteHistoryParameters = GetQuoteHistoryOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useQuoteHistory}. */
|
|
11
|
+
export type UseQuoteHistoryReturnType = UseQueryResult<GetQuoteHistoryReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read a subaccount's closed/liquidated quote history from the analytics
|
|
14
|
+
* subgraph. Each row is one close/liquidation event with its immutable metadata
|
|
15
|
+
* snapshot applied, so partial-close rows stay individually accurate. The query
|
|
16
|
+
* is disabled until at least one `subAccount` is supplied; `chainId` defaults to
|
|
17
|
+
* the connected chain. Errors are normalized to {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data } = useQuoteHistory({ subAccounts: [active], closeType: QuoteCloseType.Liquidated });
|
|
22
|
+
* data?.rows.map((row) => row.eventId);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useQuoteHistory(parameters: UseQuoteHistoryParameters): UseQuoteHistoryReturnType;
|
|
26
|
+
//# sourceMappingURL=use-quote-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-history.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG,eAAe,CAAC;AAEjF,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,yBAAyB,EAAE,kBAAkB,CAAC,CAAC;AAEtG;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,yBAAyB,GAAG,yBAAyB,CAkBhG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getQuoteHistoryQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-quote-history.ts
|
|
8
|
+
function a(a) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useQuoteHistory };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-quote-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-history.js","names":[],"sources":["../../src/quotes/use-quote-history.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteHistoryQueryOptions,\n type ConfigParameter,\n type GetQuoteHistoryOptions,\n type GetQuoteHistoryReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useQuoteHistory}: the core query options (subAccounts,\n * close type, paging, time range, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseQuoteHistoryParameters = GetQuoteHistoryOptions & ConfigParameter;\n\n/** Return type of {@link useQuoteHistory}. */\nexport type UseQuoteHistoryReturnType = UseQueryResult<GetQuoteHistoryReturnType, SymmioRequestError>;\n\n/**\n * Read a subaccount's closed/liquidated quote history from the analytics\n * subgraph. Each row is one close/liquidation event with its immutable metadata\n * snapshot applied, so partial-close rows stay individually accurate. The query\n * is disabled until at least one `subAccount` is supplied; `chainId` defaults to\n * the connected chain. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useQuoteHistory({ subAccounts: [active], closeType: QuoteCloseType.Liquidated });\n * data?.rows.map((row) => row.eventId);\n * ```\n */\nexport function useQuoteHistory(parameters: UseQuoteHistoryParameters): UseQuoteHistoryReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getQuoteHistoryQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQuoteHistoryReturnType;\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,EAAgB,GAAkE;CAChG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA4B,GAAQ;EAClD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UnifiedQuote } from '@symmio/trading-core';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for {@link useQuotePlatformFee}.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseQuotePlatformFeeParameters {
|
|
6
|
+
/** Unified quote to compute the open + close platform fees for. */
|
|
7
|
+
quote?: UnifiedQuote;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Return type of {@link useQuotePlatformFee}.
|
|
11
|
+
*/
|
|
12
|
+
export interface UseQuotePlatformFeeReturnType {
|
|
13
|
+
/** Open-side platform fee in 18-decimal-wei collateral units. `0n` when the quote has no opened price yet. */
|
|
14
|
+
openFee: bigint;
|
|
15
|
+
/** Close-side platform fee in 18-decimal-wei collateral units. `0n` when the quote has no closed portion yet. */
|
|
16
|
+
closeFee: bigint;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Compute the open-side platform fee for a {@link UnifiedQuote}, plus the close-side
|
|
20
|
+
* platform fee when the quote has a non-zero closed portion (full or partial close).
|
|
21
|
+
*
|
|
22
|
+
* Pulls `quantity`, `openedPrice`, and the open-fee rate (`tradingFee`) for the open
|
|
23
|
+
* leg; uses `closedAmount`, `avgClosedPrice`, and `closeFee` for the close leg.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const { openFee, closeFee } = useQuotePlatformFee({ quote });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useQuotePlatformFee(parameters: UseQuotePlatformFeeParameters): UseQuotePlatformFeeReturnType;
|
|
31
|
+
//# sourceMappingURL=use-quote-platform-fee.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-platform-fee.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-platform-fee.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuD,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG9G;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,mEAAmE;IACnE,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,8GAA8G;IAC9G,OAAO,EAAE,MAAM,CAAC;IAChB,iHAAiH;IACjH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,6BAA6B,GAAG,6BAA6B,CAwB5G"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { calculateClosePlatformFee as e, calculateOpenPlatformFee as t } from "@symmio/trading-core";
|
|
3
|
+
import { useMemo as n } from "react";
|
|
4
|
+
//#region src/quotes/use-quote-platform-fee.ts
|
|
5
|
+
var r = {
|
|
6
|
+
openFee: 0n,
|
|
7
|
+
closeFee: 0n
|
|
8
|
+
};
|
|
9
|
+
function i(i) {
|
|
10
|
+
let { quote: a } = i;
|
|
11
|
+
return n(() => {
|
|
12
|
+
if (!a) return r;
|
|
13
|
+
let n = t({
|
|
14
|
+
quantity: a.quantity,
|
|
15
|
+
openedPrice: a.openedPrice ?? 0n,
|
|
16
|
+
openFeeRate: a.tradingFee ?? 0n
|
|
17
|
+
}), i = a.closedAmount ?? 0n;
|
|
18
|
+
return {
|
|
19
|
+
openFee: n,
|
|
20
|
+
closeFee: i > 0n ? e({
|
|
21
|
+
quantity: i,
|
|
22
|
+
closePrice: a.avgClosedPrice ?? 0n,
|
|
23
|
+
closeFeeRate: a.closeFee ?? 0n
|
|
24
|
+
}) : 0n
|
|
25
|
+
};
|
|
26
|
+
}, [a]);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { i as useQuotePlatformFee };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=use-quote-platform-fee.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-platform-fee.js","names":[],"sources":["../../src/quotes/use-quote-platform-fee.ts"],"sourcesContent":["\"use client\";\n\nimport { calculateClosePlatformFee, calculateOpenPlatformFee, type UnifiedQuote } from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\n\n/**\n * Parameters for {@link useQuotePlatformFee}.\n */\nexport interface UseQuotePlatformFeeParameters {\n /** Unified quote to compute the open + close platform fees for. */\n quote?: UnifiedQuote;\n}\n\n/**\n * Return type of {@link useQuotePlatformFee}.\n */\nexport interface UseQuotePlatformFeeReturnType {\n /** Open-side platform fee in 18-decimal-wei collateral units. `0n` when the quote has no opened price yet. */\n openFee: bigint;\n /** Close-side platform fee in 18-decimal-wei collateral units. `0n` when the quote has no closed portion yet. */\n closeFee: bigint;\n}\n\nconst EMPTY: UseQuotePlatformFeeReturnType = { openFee: 0n, closeFee: 0n };\n\n/**\n * Compute the open-side platform fee for a {@link UnifiedQuote}, plus the close-side\n * platform fee when the quote has a non-zero closed portion (full or partial close).\n *\n * Pulls `quantity`, `openedPrice`, and the open-fee rate (`tradingFee`) for the open\n * leg; uses `closedAmount`, `avgClosedPrice`, and `closeFee` for the close leg.\n *\n * @example\n * ```tsx\n * const { openFee, closeFee } = useQuotePlatformFee({ quote });\n * ```\n */\nexport function useQuotePlatformFee(parameters: UseQuotePlatformFeeParameters): UseQuotePlatformFeeReturnType {\n const { quote } = parameters;\n\n return useMemo(() => {\n if (!quote) return EMPTY;\n\n const openFee = calculateOpenPlatformFee({\n quantity: quote.quantity,\n openedPrice: quote.openedPrice ?? 0n,\n openFeeRate: quote.tradingFee ?? 0n,\n });\n\n const closedAmount = quote.closedAmount ?? 0n;\n const closeFee =\n closedAmount > 0n\n ? calculateClosePlatformFee({\n quantity: closedAmount,\n closePrice: quote.avgClosedPrice ?? 0n,\n closeFeeRate: quote.closeFee ?? 0n,\n })\n : 0n;\n\n return { openFee, closeFee };\n }, [quote]);\n}\n"],"mappings":";;;;AAuBA,IAAM,IAAuC;CAAE,SAAS;CAAI,UAAU;AAAG;AAczE,SAAgB,EAAoB,GAA0E;CAC5G,IAAM,EAAE,aAAU;CAElB,OAAO,QAAc;EACnB,IAAI,CAAC,GAAO,OAAO;EAEnB,IAAM,IAAU,EAAyB;GACvC,UAAU,EAAM;GAChB,aAAa,EAAM,eAAe;GAClC,aAAa,EAAM,cAAc;EACnC,CAAC,GAEK,IAAe,EAAM,gBAAgB;EAU3C,OAAO;GAAE;GAAS,UARhB,IAAe,KACX,EAA0B;IACxB,UAAU;IACV,YAAY,EAAM,kBAAkB;IACpC,cAAc,EAAM,YAAY;GAClC,CAAC,IACD;EAEqB;CAC7B,GAAG,CAAC,CAAK,CAAC;AACZ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigParameter } from '@symmio/trading-core';
|
|
2
|
+
import { UseQuoteEventsByTypeParameters, UseQuoteEventsByTypeReturnType } from './use-quote-events-by-type';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for {@link useQuotePriceHistory}. Same as {@link useQuoteEventsByType}
|
|
5
|
+
* minus the `types` field (preset to {@link PRICE_HISTORY_EVENT_TYPES}).
|
|
6
|
+
*/
|
|
7
|
+
export type UseQuotePriceHistoryParameters = Omit<UseQuoteEventsByTypeParameters, "types"> & ConfigParameter;
|
|
8
|
+
/**
|
|
9
|
+
* Read a quote's open-price history from the analytics subgraph. The history
|
|
10
|
+
* includes both explicit price-recompute events (`SETTLE_UPNL`) and funding-rate
|
|
11
|
+
* ticks (`CHARGE_FUNDING_RATE`, `CHARGE_ACCUMULATED_FUNDING_FEE`), which also
|
|
12
|
+
* shift the open price as a side effect. Each row carries a `type` discriminant
|
|
13
|
+
* so the UI can label and format it per event family.
|
|
14
|
+
*
|
|
15
|
+
* Thin wrapper over {@link useQuoteEventsByType} that locks `types` to
|
|
16
|
+
* {@link PRICE_HISTORY_EVENT_TYPES}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { data } = useQuotePriceHistory({ quoteId: quote.quoteId });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useQuotePriceHistory(parameters: UseQuotePriceHistoryParameters): UseQuoteEventsByTypeReturnType;
|
|
24
|
+
//# sourceMappingURL=use-quote-price-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-price-history.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-price-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAA6B,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,EAEL,KAAK,8BAA8B,EACnC,KAAK,8BAA8B,EACpC,MAAM,4BAA4B,CAAC;AAEpC;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC;AAE7G;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,8BAA8B,GAAG,8BAA8B,CAE/G"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useQuoteEventsByType as e } from "./use-quote-events-by-type.js";
|
|
3
|
+
import { PRICE_HISTORY_EVENT_TYPES as t } from "@symmio/trading-core";
|
|
4
|
+
//#region src/quotes/use-quote-price-history.ts
|
|
5
|
+
function n(n) {
|
|
6
|
+
return e({
|
|
7
|
+
...n,
|
|
8
|
+
types: t
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as useQuotePriceHistory };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=use-quote-price-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-price-history.js","names":[],"sources":["../../src/quotes/use-quote-price-history.ts"],"sourcesContent":["\"use client\";\n\nimport { PRICE_HISTORY_EVENT_TYPES, type ConfigParameter } from \"@symmio/trading-core\";\nimport {\n useQuoteEventsByType,\n type UseQuoteEventsByTypeParameters,\n type UseQuoteEventsByTypeReturnType,\n} from \"./use-quote-events-by-type\";\n\n/**\n * Parameters for {@link useQuotePriceHistory}. Same as {@link useQuoteEventsByType}\n * minus the `types` field (preset to {@link PRICE_HISTORY_EVENT_TYPES}).\n */\nexport type UseQuotePriceHistoryParameters = Omit<UseQuoteEventsByTypeParameters, \"types\"> & ConfigParameter;\n\n/**\n * Read a quote's open-price history from the analytics subgraph. The history\n * includes both explicit price-recompute events (`SETTLE_UPNL`) and funding-rate\n * ticks (`CHARGE_FUNDING_RATE`, `CHARGE_ACCUMULATED_FUNDING_FEE`), which also\n * shift the open price as a side effect. Each row carries a `type` discriminant\n * so the UI can label and format it per event family.\n *\n * Thin wrapper over {@link useQuoteEventsByType} that locks `types` to\n * {@link PRICE_HISTORY_EVENT_TYPES}.\n *\n * @example\n * ```tsx\n * const { data } = useQuotePriceHistory({ quoteId: quote.quoteId });\n * ```\n */\nexport function useQuotePriceHistory(parameters: UseQuotePriceHistoryParameters): UseQuoteEventsByTypeReturnType {\n return useQuoteEventsByType({ ...parameters, types: PRICE_HISTORY_EVENT_TYPES });\n}\n"],"mappings":";;;;AA8BA,SAAgB,EAAqB,GAA4E;CAC/G,OAAO,EAAqB;EAAE,GAAG;EAAY,OAAO;CAA0B,CAAC;AACjF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { CalculateQuotePnlReturnType, CalculateQuoteUpnlReturnType, ConfigParameter, UnifiedQuote } from '@symmio/trading-core';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for {@link useQuoteUpnlAndPnl}.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseQuoteUpnlAndPnlParameters extends ConfigParameter {
|
|
6
|
+
/** Unified quote to compute UPNL + realized PNL for. */
|
|
7
|
+
quote?: UnifiedQuote;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Return type of {@link useQuoteUpnlAndPnl}.
|
|
11
|
+
*/
|
|
12
|
+
export interface UseQuoteUpnlAndPnlReturnType extends CalculateQuoteUpnlReturnType, CalculateQuotePnlReturnType {
|
|
13
|
+
/** Mark price used in the calc, decimal string. `null` until the first tick. */
|
|
14
|
+
markPrice: string | null;
|
|
15
|
+
/** Leverage derived from the quote's locked-margin breakdown, decimal string. */
|
|
16
|
+
leverage: string;
|
|
17
|
+
/** `true` while markets or mark-price are resolving. */
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Compute unrealized PNL (open size, vs mark) and realized PNL (closed size,
|
|
22
|
+
* vs the quote's recorded close price) for a single {@link UnifiedQuote}.
|
|
23
|
+
*
|
|
24
|
+
* Mark price is resolved live via {@link useEnigmaPriceByMarketId} on the
|
|
25
|
+
* quote's `symbolId`. UPNL stays `"0"` until the first tick for that market
|
|
26
|
+
* arrives.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { upnl, upnlPercent, pnl, pnlPercent, markPrice } = useQuoteUpnlAndPnl({ quote });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function useQuoteUpnlAndPnl(parameters: UseQuoteUpnlAndPnlParameters): UseQuoteUpnlAndPnlReturnType;
|
|
34
|
+
//# sourceMappingURL=use-quote-upnl-and-pnl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-upnl-and-pnl.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote-upnl-and-pnl.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAI9B;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,eAAe;IACnE,wDAAwD;IACxD,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,4BAA6B,SAAQ,4BAA4B,EAAE,2BAA2B;IAC7G,gFAAgF;IAChF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,iFAAiF;IACjF,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,SAAS,EAAE,OAAO,CAAC;CACpB;AAYD;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,4BAA4B,GAAG,4BAA4B,CAkDzG"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEnigmaPriceByMarketId as e } from "../price-service/use-enigma-price-by-market-id.js";
|
|
3
|
+
import { calculateQuoteLeverage as t, calculateQuotePnl as n, calculateQuoteUpnl as r } from "@symmio/trading-core";
|
|
4
|
+
import { useMemo as i } from "react";
|
|
5
|
+
//#region src/quotes/use-quote-upnl-and-pnl.ts
|
|
6
|
+
var a = {
|
|
7
|
+
upnl: "0",
|
|
8
|
+
upnlPercent: "0",
|
|
9
|
+
pnl: "0",
|
|
10
|
+
pnlPercent: "0",
|
|
11
|
+
markPrice: null,
|
|
12
|
+
leverage: "0",
|
|
13
|
+
isLoading: !1
|
|
14
|
+
};
|
|
15
|
+
function o(o) {
|
|
16
|
+
let { quote: s } = o, c = e({
|
|
17
|
+
marketId: s?.symbolId ?? 0n,
|
|
18
|
+
enabled: s !== void 0
|
|
19
|
+
});
|
|
20
|
+
return i(() => {
|
|
21
|
+
if (!s) return a;
|
|
22
|
+
let e = s.initialLockedValues ?? s.lockedValues, i = t({
|
|
23
|
+
quantity: s.quantity,
|
|
24
|
+
requestedOpenPrice: s.requestedOpenPrice,
|
|
25
|
+
lockedValues: e
|
|
26
|
+
}), o = s.closedAmount ?? 0n, l = c.markPrice, { upnl: u, upnlPercent: d } = l ? r({
|
|
27
|
+
markPrice: l,
|
|
28
|
+
positionType: s.positionType,
|
|
29
|
+
quantity: s.quantity,
|
|
30
|
+
closedAmount: o,
|
|
31
|
+
openedPrice: s.openedPrice ?? 0n,
|
|
32
|
+
leverage: i
|
|
33
|
+
}) : {
|
|
34
|
+
upnl: "0",
|
|
35
|
+
upnlPercent: "0"
|
|
36
|
+
}, { pnl: f, pnlPercent: p } = n({
|
|
37
|
+
positionType: s.positionType,
|
|
38
|
+
closedAmount: o,
|
|
39
|
+
closedPrice: s.avgClosedPrice ?? 0n,
|
|
40
|
+
openedPrice: s.openedPrice ?? 0n,
|
|
41
|
+
leverage: i
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
upnl: u,
|
|
45
|
+
upnlPercent: d,
|
|
46
|
+
pnl: f,
|
|
47
|
+
pnlPercent: p,
|
|
48
|
+
markPrice: l,
|
|
49
|
+
leverage: i,
|
|
50
|
+
isLoading: c.isLoading
|
|
51
|
+
};
|
|
52
|
+
}, [
|
|
53
|
+
s,
|
|
54
|
+
c.markPrice,
|
|
55
|
+
c.isLoading
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { o as useQuoteUpnlAndPnl };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=use-quote-upnl-and-pnl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote-upnl-and-pnl.js","names":[],"sources":["../../src/quotes/use-quote-upnl-and-pnl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n calculateQuoteLeverage,\n calculateQuotePnl,\n calculateQuoteUpnl,\n type CalculateQuotePnlReturnType,\n type CalculateQuoteUpnlReturnType,\n type ConfigParameter,\n type UnifiedQuote,\n} from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\nimport { useEnigmaPriceByMarketId } from \"../price-service/use-enigma-price-by-market-id\";\n\n/**\n * Parameters for {@link useQuoteUpnlAndPnl}.\n */\nexport interface UseQuoteUpnlAndPnlParameters extends ConfigParameter {\n /** Unified quote to compute UPNL + realized PNL for. */\n quote?: UnifiedQuote;\n}\n\n/**\n * Return type of {@link useQuoteUpnlAndPnl}.\n */\nexport interface UseQuoteUpnlAndPnlReturnType extends CalculateQuoteUpnlReturnType, CalculateQuotePnlReturnType {\n /** Mark price used in the calc, decimal string. `null` until the first tick. */\n markPrice: string | null;\n /** Leverage derived from the quote's locked-margin breakdown, decimal string. */\n leverage: string;\n /** `true` while markets or mark-price are resolving. */\n isLoading: boolean;\n}\n\nconst EMPTY: UseQuoteUpnlAndPnlReturnType = {\n upnl: \"0\",\n upnlPercent: \"0\",\n pnl: \"0\",\n pnlPercent: \"0\",\n markPrice: null,\n leverage: \"0\",\n isLoading: false,\n};\n\n/**\n * Compute unrealized PNL (open size, vs mark) and realized PNL (closed size,\n * vs the quote's recorded close price) for a single {@link UnifiedQuote}.\n *\n * Mark price is resolved live via {@link useEnigmaPriceByMarketId} on the\n * quote's `symbolId`. UPNL stays `\"0\"` until the first tick for that market\n * arrives.\n *\n * @example\n * ```tsx\n * const { upnl, upnlPercent, pnl, pnlPercent, markPrice } = useQuoteUpnlAndPnl({ quote });\n * ```\n */\nexport function useQuoteUpnlAndPnl(parameters: UseQuoteUpnlAndPnlParameters): UseQuoteUpnlAndPnlReturnType {\n const { quote } = parameters;\n\n const priceQuery = useEnigmaPriceByMarketId({\n marketId: quote?.symbolId ?? 0n,\n enabled: quote !== undefined,\n });\n\n return useMemo(() => {\n if (!quote) return EMPTY;\n\n const lockedValuesForLeverage = quote.initialLockedValues ?? quote.lockedValues;\n const leverage = calculateQuoteLeverage({\n quantity: quote.quantity,\n requestedOpenPrice: quote.requestedOpenPrice,\n lockedValues: lockedValuesForLeverage,\n });\n\n const closedAmount = quote.closedAmount ?? 0n;\n const markPrice = priceQuery.markPrice;\n\n const { upnl, upnlPercent } = markPrice\n ? calculateQuoteUpnl({\n markPrice,\n positionType: quote.positionType,\n quantity: quote.quantity,\n closedAmount,\n openedPrice: quote.openedPrice ?? 0n,\n leverage,\n })\n : { upnl: \"0\", upnlPercent: \"0\" };\n\n const { pnl, pnlPercent } = calculateQuotePnl({\n positionType: quote.positionType,\n closedAmount,\n closedPrice: quote.avgClosedPrice ?? 0n,\n openedPrice: quote.openedPrice ?? 0n,\n leverage,\n });\n\n return {\n upnl,\n upnlPercent,\n pnl,\n pnlPercent,\n markPrice,\n leverage,\n isLoading: priceQuery.isLoading,\n };\n }, [quote, priceQuery.markPrice, priceQuery.isLoading]);\n}\n"],"mappings":";;;;;AAkCA,IAAM,IAAsC;CAC1C,MAAM;CACN,aAAa;CACb,KAAK;CACL,YAAY;CACZ,WAAW;CACX,UAAU;CACV,WAAW;AACb;AAeA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,EAAE,aAAU,GAEZ,IAAa,EAAyB;EAC1C,UAAU,GAAO,YAAY;EAC7B,SAAS,MAAU,KAAA;CACrB,CAAC;CAED,OAAO,QAAc;EACnB,IAAI,CAAC,GAAO,OAAO;EAEnB,IAAM,IAA0B,EAAM,uBAAuB,EAAM,cAC7D,IAAW,EAAuB;GACtC,UAAU,EAAM;GAChB,oBAAoB,EAAM;GAC1B,cAAc;EAChB,CAAC,GAEK,IAAe,EAAM,gBAAgB,IACrC,IAAY,EAAW,WAEvB,EAAE,SAAM,mBAAgB,IAC1B,EAAmB;GACjB;GACA,cAAc,EAAM;GACpB,UAAU,EAAM;GAChB;GACA,aAAa,EAAM,eAAe;GAClC;EACF,CAAC,IACD;GAAE,MAAM;GAAK,aAAa;EAAI,GAE5B,EAAE,QAAK,kBAAe,EAAkB;GAC5C,cAAc,EAAM;GACpB;GACA,aAAa,EAAM,kBAAkB;GACrC,aAAa,EAAM,eAAe;GAClC;EACF,CAAC;EAED,OAAO;GACL;GACA;GACA;GACA;GACA;GACA;GACA,WAAW,EAAW;EACxB;CACF,GAAG;EAAC;EAAO,EAAW;EAAW,EAAW;CAAS,CAAC;AACxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ConfigParameter, GetQuoteOptions, GetQuoteReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useQuote}: the core query options (quote id, chain id,
|
|
6
|
+
* TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseQuoteParameters = GetQuoteOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useQuote}. */
|
|
10
|
+
export type UseQuoteReturnType = UseQueryResult<GetQuoteReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read a single `Quote` by id from the SYMMIO core. Resolves to `null` when no
|
|
13
|
+
* quote exists with that id. The query is disabled until `quoteId` is set.
|
|
14
|
+
* `chainId` defaults to the connected chain. Errors are normalized to
|
|
15
|
+
* {@link SymmioRequestError}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { data: quote } = useQuote({ quoteId: 42n });
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useQuote(parameters?: UseQuoteParameters): UseQuoteReturnType;
|
|
23
|
+
//# sourceMappingURL=use-quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote.d.ts","sourceRoot":"","sources":["../../src/quotes/use-quote.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,eAAe,CAAC;AAEnE,uCAAuC;AACvC,MAAM,MAAM,kBAAkB,GAAG,cAAc,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAExF;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,UAAU,GAAE,kBAAuB,GAAG,kBAAkB,CAkBhF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getQuoteQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/quotes/use-quote.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useQuote };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-quote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-quote.js","names":[],"sources":["../../src/quotes/use-quote.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteQueryOptions,\n type ConfigParameter,\n type GetQuoteOptions,\n type GetQuoteReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useQuote}: the core query options (quote id, chain id,\n * TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseQuoteParameters = GetQuoteOptions & ConfigParameter;\n\n/** Return type of {@link useQuote}. */\nexport type UseQuoteReturnType = UseQueryResult<GetQuoteReturnType, SymmioRequestError>;\n\n/**\n * Read a single `Quote` by id from the SYMMIO core. Resolves to `null` when no\n * quote exists with that id. The query is disabled until `quoteId` is set.\n * `chainId` defaults to the connected chain. Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: quote } = useQuote({ quoteId: 42n });\n * ```\n */\nexport function useQuote(parameters: UseQuoteParameters = {}): UseQuoteReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getQuoteQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQuoteReturnType;\n}\n"],"mappings":";;;;;;;AAkCA,SAAgB,EAAS,IAAiC,CAAC,GAAuB;CAChF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAqB,GAAQ;EAC3C,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|