@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 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close-bulk-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-close-bulk-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,8BAA8B,EACnC,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,sDAAsD;AACtD,MAAM,MAAM,iCAAiC,GAAG,eAAe,CAAC;AAEhE,sDAAsD;AACtD,MAAM,MAAM,iCAAiC,GAAG,iBAAiB,CAC/D,0BAA0B,EAC1B,kBAAkB,EAClB,8BAA8B,CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,GAAE,iCAAsC,GACjD,iCAAiC,CAoBnC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { getInstantClosesQueryKey as i, instantCloseBulkAutoMutationOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
8
|
+
//#region src/instant-layer/use-instant-close-bulk-auto.ts
|
|
9
|
+
function c(c = {}) {
|
|
10
|
+
let l = t(c), u = e(), d = s(), f = a(l);
|
|
11
|
+
return o({
|
|
12
|
+
mutationKey: f.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await f.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? u
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e, t) => {
|
|
24
|
+
let n = l.getChainConfigKey(t.chainId ?? u);
|
|
25
|
+
d.invalidateQueries({ predicate: r(i, { configKey: n }) });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as useInstantCloseBulkAuto };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-instant-close-bulk-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close-bulk-auto.js","names":[],"sources":["../../src/instant-layer/use-instant-close-bulk-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantClosesQueryKey,\n instantCloseBulkAutoMutationOptions,\n type ConfigParameter,\n type InstantCloseBulkAutoParameters,\n type InstantCloseBulkReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { predicateMatch } from \"../utils\";\n\n/** Parameters for {@link useInstantCloseBulkAuto}. */\nexport type UseInstantCloseBulkAutoParameters = ConfigParameter;\n\n/** Return type of {@link useInstantCloseBulkAuto}. */\nexport type UseInstantCloseBulkAutoReturnType = UseMutationResult<\n InstantCloseBulkReturnType,\n SymmioRequestError,\n InstantCloseBulkAutoParameters\n>;\n\n/**\n * Close multiple lowcap instant positions in one solver round-trip, deriving\n * each order's wei fields from UI-shape inputs (market id, slippage, mark\n * price, …) via `prepareInstantCloseParams`. Friendly default for \"close-all\"\n * flows.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantCloseBulkAuto();\n * await mutateAsync({\n * from: sessionKey,\n * orders: [\n * { partyA, market: { id: 1 }, positionType: PositionType.LONG, quoteId: 1n, quantityToClose: \"0.5\", slippage: 1 },\n * ],\n * });\n * ```\n */\nexport function useInstantCloseBulkAuto(\n parameters: UseInstantCloseBulkAutoParameters = {},\n): UseInstantCloseBulkAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantCloseBulkAutoMutationOptions(config);\n\n return useMutation<InstantCloseBulkReturnType, SymmioRequestError, InstantCloseBulkAutoParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantClosesQueryKey, { configKey }) });\n },\n });\n}\n"],"mappings":";;;;;;;;AA2CA,SAAgB,EACd,IAAgD,CAAC,GACd;CACnC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAAoC,CAAM;CAEvD,OAAO,EAA4F;EACjG,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GACvE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA0B,EAAE,aAAU,CAAC,EAAE,CAAC;EAC3G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigParameter, InstantCloseBulkParameters, InstantCloseBulkReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/** Parameters for {@link useInstantCloseBulk}. */
|
|
5
|
+
export type UseInstantCloseBulkParameters = ConfigParameter;
|
|
6
|
+
/** Return type of {@link useInstantCloseBulk}. */
|
|
7
|
+
export type UseInstantCloseBulkReturnType = UseMutationResult<InstantCloseBulkReturnType, SymmioRequestError, InstantCloseBulkParameters>;
|
|
8
|
+
/**
|
|
9
|
+
* Close multiple lowcap instant positions in one solver round-trip. Every
|
|
10
|
+
* input order must already carry wei-shape fields (`closePrice`,
|
|
11
|
+
* `quantityToClose`); use {@link useInstantCloseBulkAuto} when you want the SDK
|
|
12
|
+
* to derive those from UI-shape inputs.
|
|
13
|
+
*
|
|
14
|
+
* Invalidates the instant-closes feed on success so the closing rows appear in
|
|
15
|
+
* the consumer's quote list immediately.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { mutateAsync } = useInstantCloseBulk();
|
|
20
|
+
* await mutateAsync({ from: sessionKey, orders: [...] });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useInstantCloseBulk(parameters?: UseInstantCloseBulkParameters): UseInstantCloseBulkReturnType;
|
|
24
|
+
//# sourceMappingURL=use-instant-close-bulk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close-bulk.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-close-bulk.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAC3D,0BAA0B,EAC1B,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAoBjH"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { getInstantClosesQueryKey as i, instantCloseBulkMutationOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
8
|
+
//#region src/instant-layer/use-instant-close-bulk.ts
|
|
9
|
+
function c(c = {}) {
|
|
10
|
+
let l = t(c), u = e(), d = s(), f = a(l);
|
|
11
|
+
return o({
|
|
12
|
+
mutationKey: f.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await f.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? u
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e, t) => {
|
|
24
|
+
let n = l.getChainConfigKey(t.chainId ?? u);
|
|
25
|
+
d.invalidateQueries({ predicate: r(i, { configKey: n }) });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as useInstantCloseBulk };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-instant-close-bulk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close-bulk.js","names":[],"sources":["../../src/instant-layer/use-instant-close-bulk.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantClosesQueryKey,\n instantCloseBulkMutationOptions,\n type ConfigParameter,\n type InstantCloseBulkParameters,\n type InstantCloseBulkReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { predicateMatch } from \"../utils\";\n\n/** Parameters for {@link useInstantCloseBulk}. */\nexport type UseInstantCloseBulkParameters = ConfigParameter;\n\n/** Return type of {@link useInstantCloseBulk}. */\nexport type UseInstantCloseBulkReturnType = UseMutationResult<\n InstantCloseBulkReturnType,\n SymmioRequestError,\n InstantCloseBulkParameters\n>;\n\n/**\n * Close multiple lowcap instant positions in one solver round-trip. Every\n * input order must already carry wei-shape fields (`closePrice`,\n * `quantityToClose`); use {@link useInstantCloseBulkAuto} when you want the SDK\n * to derive those from UI-shape inputs.\n *\n * Invalidates the instant-closes feed on success so the closing rows appear in\n * the consumer's quote list immediately.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantCloseBulk();\n * await mutateAsync({ from: sessionKey, orders: [...] });\n * ```\n */\nexport function useInstantCloseBulk(parameters: UseInstantCloseBulkParameters = {}): UseInstantCloseBulkReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantCloseBulkMutationOptions(config);\n\n return useMutation<InstantCloseBulkReturnType, SymmioRequestError, InstantCloseBulkParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantClosesQueryKey, { configKey }) });\n },\n });\n}\n"],"mappings":";;;;;;;;AAyCA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAwF;EAC7F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GACvE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA0B,EAAE,aAAU,CAAC,EAAE,CAAC;EAC3G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ConfigParameter, InstantCloseParameters, InstantCloseReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantClose}.
|
|
6
|
+
*/
|
|
7
|
+
export type UseInstantCloseParameters = ConfigParameter;
|
|
8
|
+
/** Return type of {@link useInstantClose}. */
|
|
9
|
+
export type UseInstantCloseReturnType = UseMutationResult<InstantCloseReturnType, SymmioRequestError, InstantCloseParameters>;
|
|
10
|
+
/**
|
|
11
|
+
* Close (or partially close) a lowcap instant position via the pure
|
|
12
|
+
* `instantClose` primitive.
|
|
13
|
+
*
|
|
14
|
+
* Every input is required — the SDK does no fetching. Use this hook when the
|
|
15
|
+
* caller already has the slippage-adjusted close price and the wei quantity
|
|
16
|
+
* to close in hand. For the friendlier "just give me the close intent" path,
|
|
17
|
+
* use {@link useInstantCloseAuto}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { mutateAsync } = useInstantClose();
|
|
22
|
+
* await mutateAsync({
|
|
23
|
+
* partyA: "0xva…",
|
|
24
|
+
* order: { quoteId: 42n, closePrice: 50_000n * 10n ** 18n, quantityToClose: 10n ** 18n },
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare function useInstantClose(parameters?: UseInstantCloseParameters): UseInstantCloseReturnType;
|
|
29
|
+
//# sourceMappingURL=use-instant-close.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-close.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC5B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,eAAe,CAAC;AAExD,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,CACvB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CA0BrG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { getInstantClosesQueryKey as i, instantCloseMutationOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
8
|
+
//#region src/instant-layer/use-instant-close.ts
|
|
9
|
+
function c(c = {}) {
|
|
10
|
+
let l = t(c), u = e(), d = s(), f = a(l);
|
|
11
|
+
return o({
|
|
12
|
+
mutationKey: f.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await f.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? u
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e, t) => {
|
|
24
|
+
let n = l.getChainConfigKey(t.chainId ?? u);
|
|
25
|
+
d.invalidateQueries({ predicate: r(i, { configKey: n }) });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as useInstantClose };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-instant-close.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-close.js","names":[],"sources":["../../src/instant-layer/use-instant-close.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantClosesQueryKey,\n instantCloseMutationOptions,\n type ConfigParameter,\n type InstantCloseParameters,\n type InstantCloseReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantClose}.\n */\nexport type UseInstantCloseParameters = ConfigParameter;\n\n/** Return type of {@link useInstantClose}. */\nexport type UseInstantCloseReturnType = UseMutationResult<\n InstantCloseReturnType,\n SymmioRequestError,\n InstantCloseParameters\n>;\n\n/**\n * Close (or partially close) a lowcap instant position via the pure\n * `instantClose` primitive.\n *\n * Every input is required — the SDK does no fetching. Use this hook when the\n * caller already has the slippage-adjusted close price and the wei quantity\n * to close in hand. For the friendlier \"just give me the close intent\" path,\n * use {@link useInstantCloseAuto}.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantClose();\n * await mutateAsync({\n * partyA: \"0xva…\",\n * order: { quoteId: 42n, closePrice: 50_000n * 10n ** 18n, quantityToClose: 10n ** 18n },\n * });\n * ```\n */\nexport function useInstantClose(parameters: UseInstantCloseParameters = {}): UseInstantCloseReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantCloseMutationOptions(config);\n\n return useMutation<InstantCloseReturnType, SymmioRequestError, InstantCloseParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n /**\n * A freshly submitted instant-close exists on the hedger but not in any\n * cached read yet. Invalidate the instant-closes feed so it refetches and the\n * closing row appears immediately — and so the managed-quotes consumer, which\n * polls the feed only while a close is in flight, fetches it once to bootstrap.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantClosesQueryKey, { configKey }) });\n },\n });\n}\n"],"mappings":";;;;;;;;AA8CA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA4B,CAAM;CAE/C,OAAO,EAAgF;EACrF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAOjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GACvE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA0B,EAAE,aAAU,CAAC,EAAE,CAAC;EAC3G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, GetInstantClosesOptions, GetInstantClosesReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantCloses}: the core query options (partyA,
|
|
6
|
+
* optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.
|
|
7
|
+
* `refetchInterval`) plus an optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseInstantClosesParameters = GetInstantClosesOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useInstantCloses}. */
|
|
11
|
+
export type UseInstantClosesReturnType = UseQueryResult<GetInstantClosesReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read a sub-account's pending instant-close records from one hedger, with
|
|
14
|
+
* caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the
|
|
15
|
+
* connected chain; disable the query from the consumer via `query.enabled`
|
|
16
|
+
* (e.g. until a valid `partyA` is entered). Errors are normalized to
|
|
17
|
+
* {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data } = useInstantCloses({ partyA, query: { refetchInterval: 3_000 } });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useInstantCloses(parameters: UseInstantClosesParameters): UseInstantClosesReturnType;
|
|
25
|
+
//# sourceMappingURL=use-instant-closes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-closes.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-closes.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAChC,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,0BAA0B,GAAG,uBAAuB,GAAG,eAAe,CAAC;AAEnF,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG,cAAc,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAExG;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,0BAA0B,GAAG,0BAA0B,CAkBnG"}
|
|
@@ -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 { getInstantClosesQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/instant-layer/use-instant-closes.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 useInstantCloses };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-instant-closes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-closes.js","names":[],"sources":["../../src/instant-layer/use-instant-closes.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantClosesQueryOptions,\n type ConfigParameter,\n type GetInstantClosesOptions,\n type GetInstantClosesReturnType,\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 useInstantCloses}: the core query options (partyA,\n * optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.\n * `refetchInterval`) plus an optional `config`.\n */\nexport type UseInstantClosesParameters = GetInstantClosesOptions & ConfigParameter;\n\n/** Return type of {@link useInstantCloses}. */\nexport type UseInstantClosesReturnType = UseQueryResult<GetInstantClosesReturnType, SymmioRequestError>;\n\n/**\n * Read a sub-account's pending instant-close records from one hedger, with\n * caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the\n * connected chain; disable the query from the consumer via `query.enabled`\n * (e.g. until a valid `partyA` is entered). Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useInstantCloses({ partyA, query: { refetchInterval: 3_000 } });\n * ```\n */\nexport function useInstantCloses(parameters: UseInstantClosesParameters): UseInstantClosesReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInstantClosesQueryOptions(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 UseInstantClosesReturnType;\n}\n"],"mappings":";;;;;;;AAoCA,SAAgB,EAAiB,GAAoE;CACnG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA6B,GAAQ;EACnD,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 { ConfigParameter, InstantOpenReturnType, PrepareInstantOpenParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantOpenAuto}.
|
|
6
|
+
*/
|
|
7
|
+
export type UseInstantOpenAutoParameters = ConfigParameter;
|
|
8
|
+
/** Return type of {@link useInstantOpenAuto}. */
|
|
9
|
+
export type UseInstantOpenAutoReturnType = UseMutationResult<InstantOpenReturnType, SymmioRequestError, PrepareInstantOpenParameters>;
|
|
10
|
+
/**
|
|
11
|
+
* Open a lowcap instant position via the wizard `instantOpenAuto` action.
|
|
12
|
+
*
|
|
13
|
+
* Friendly default: accepts the minimal trade intent and lets the SDK fetch
|
|
14
|
+
* market metadata, mark price, locked params, and fee rates. Pre-fill any
|
|
15
|
+
* optional field on the variables (e.g. cache-hot `markPrice`) to skip its
|
|
16
|
+
* fetch. For full control — inspect / mutate resolved params between fetch and
|
|
17
|
+
* submit — use {@link useInstantOpen} after calling
|
|
18
|
+
* `prepareInstantOpenParams(config, …)` directly.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { mutateAsync } = useInstantOpenAuto();
|
|
23
|
+
* await mutateAsync({
|
|
24
|
+
* walletAddress, sessionKeyAddress, signTypedData,
|
|
25
|
+
* marketId: 1, positionType: "LONG",
|
|
26
|
+
* userInput: "100", leverage: 5, slippage: 1,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare function useInstantOpenAuto(parameters?: UseInstantOpenAutoParameters): UseInstantOpenAutoReturnType;
|
|
31
|
+
//# sourceMappingURL=use-instant-open-auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,4BAA4B,CAC7B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAyB9G"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { getInstantOpensQueryKey as i, instantOpenAutoMutationOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
8
|
+
//#region src/instant-layer/use-instant-open-auto.ts
|
|
9
|
+
function c(c = {}) {
|
|
10
|
+
let l = t(c), u = e(), d = s(), f = a(l);
|
|
11
|
+
return o({
|
|
12
|
+
mutationKey: f.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await f.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? u
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e, t) => {
|
|
24
|
+
let n = l.getChainConfigKey(t.chainId ?? u);
|
|
25
|
+
d.invalidateQueries({ predicate: r(i, { configKey: n }) });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as useInstantOpenAuto };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-instant-open-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open-auto.js","names":[],"sources":["../../src/instant-layer/use-instant-open-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenAutoMutationOptions,\n type ConfigParameter,\n type InstantOpenReturnType,\n type PrepareInstantOpenParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpenAuto}.\n */\nexport type UseInstantOpenAutoParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpenAuto}. */\nexport type UseInstantOpenAutoReturnType = UseMutationResult<\n InstantOpenReturnType,\n SymmioRequestError,\n PrepareInstantOpenParameters\n>;\n\n/**\n * Open a lowcap instant position via the wizard `instantOpenAuto` action.\n *\n * Friendly default: accepts the minimal trade intent and lets the SDK fetch\n * market metadata, mark price, locked params, and fee rates. Pre-fill any\n * optional field on the variables (e.g. cache-hot `markPrice`) to skip its\n * fetch. For full control — inspect / mutate resolved params between fetch and\n * submit — use {@link useInstantOpen} after calling\n * `prepareInstantOpenParams(config, …)` directly.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantOpenAuto();\n * await mutateAsync({\n * walletAddress, sessionKeyAddress, signTypedData,\n * marketId: 1, positionType: \"LONG\",\n * userInput: \"100\", leverage: 5, slippage: 1,\n * });\n * ```\n */\nexport function useInstantOpenAuto(parameters: UseInstantOpenAutoParameters = {}): UseInstantOpenAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantOpenAutoMutationOptions(config);\n\n return useMutation<InstantOpenReturnType, SymmioRequestError, PrepareInstantOpenParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n /**\n * A freshly submitted instant-open exists on the hedger but not in any\n * cached read yet. Invalidate the instant-opens feed so it refetches and\n * the optimistic row appears immediately — without waiting for a poll.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n },\n });\n}\n"],"mappings":";;;;;;;;AAgDA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAqF;EAC1F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAMjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GACvE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC;EAC1G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConfigParameter, GetInstantOpenQuoteIdOptions, GetInstantOpenQuoteIdReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantOpenQuoteId}: the core query options
|
|
6
|
+
* (tempQuoteId, optional hedger `baseUrl`, chain id, TanStack `query`
|
|
7
|
+
* overrides) plus an optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseInstantOpenQuoteIdParameters = GetInstantOpenQuoteIdOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useInstantOpenQuoteId}. */
|
|
11
|
+
export type UseInstantOpenQuoteIdReturnType = UseQueryResult<GetInstantOpenQuoteIdReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the on-chain quote id for a hedger temp id — the reconciliation
|
|
14
|
+
* handoff for a pending instant open. Returns `null` until the trade is anchored
|
|
15
|
+
* on-chain; poll via `query.refetchInterval` and disable once a non-null id
|
|
16
|
+
* arrives. `chainId` defaults to the connected chain. Errors are normalized to
|
|
17
|
+
* {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data: quoteId } = useInstantOpenQuoteId({
|
|
22
|
+
* tempQuoteId,
|
|
23
|
+
* query: { refetchInterval: (q) => (q.state.data == null ? 2_000 : false) },
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useInstantOpenQuoteId(parameters: UseInstantOpenQuoteIdParameters): UseInstantOpenQuoteIdReturnType;
|
|
28
|
+
//# sourceMappingURL=use-instant-open-quote-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open-quote-id.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open-quote-id.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,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,+BAA+B,GAAG,4BAA4B,GAAG,eAAe,CAAC;AAE7F,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,EAAE,kBAAkB,CAAC,CAAC;AAElH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,+BAA+B,GAAG,+BAA+B,CAkBlH"}
|
|
@@ -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 { getInstantOpenQuoteIdQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/instant-layer/use-instant-open-quote-id.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 useInstantOpenQuoteId };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-instant-open-quote-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open-quote-id.js","names":[],"sources":["../../src/instant-layer/use-instant-open-quote-id.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpenQuoteIdQueryOptions,\n type ConfigParameter,\n type GetInstantOpenQuoteIdOptions,\n type GetInstantOpenQuoteIdReturnType,\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 useInstantOpenQuoteId}: the core query options\n * (tempQuoteId, optional hedger `baseUrl`, chain id, TanStack `query`\n * overrides) plus an optional `config`.\n */\nexport type UseInstantOpenQuoteIdParameters = GetInstantOpenQuoteIdOptions & ConfigParameter;\n\n/** Return type of {@link useInstantOpenQuoteId}. */\nexport type UseInstantOpenQuoteIdReturnType = UseQueryResult<GetInstantOpenQuoteIdReturnType, SymmioRequestError>;\n\n/**\n * Resolve the on-chain quote id for a hedger temp id — the reconciliation\n * handoff for a pending instant open. Returns `null` until the trade is anchored\n * on-chain; poll via `query.refetchInterval` and disable once a non-null id\n * arrives. `chainId` defaults to the connected chain. Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: quoteId } = useInstantOpenQuoteId({\n * tempQuoteId,\n * query: { refetchInterval: (q) => (q.state.data == null ? 2_000 : false) },\n * });\n * ```\n */\nexport function useInstantOpenQuoteId(parameters: UseInstantOpenQuoteIdParameters): UseInstantOpenQuoteIdReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInstantOpenQuoteIdQueryOptions(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 UseInstantOpenQuoteIdReturnType;\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,EAAsB,GAA8E;CAClH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAkC,GAAQ;EACxD,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,33 @@
|
|
|
1
|
+
import { ConfigParameter, InstantOpenParameters, InstantOpenReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantOpen}.
|
|
6
|
+
*/
|
|
7
|
+
export type UseInstantOpenParameters = ConfigParameter;
|
|
8
|
+
/** Return type of {@link useInstantOpen}. */
|
|
9
|
+
export type UseInstantOpenReturnType = UseMutationResult<InstantOpenReturnType, SymmioRequestError, InstantOpenParameters>;
|
|
10
|
+
/**
|
|
11
|
+
* Open a lowcap instant position via the pure `instantOpen` primitive.
|
|
12
|
+
*
|
|
13
|
+
* Every input is required — the SDK does no fetching. Use this hook when the
|
|
14
|
+
* caller already has market metadata, locked params, mark price, and fee
|
|
15
|
+
* rates in hand (e.g. pre-fetched via `useMarkets`, `useLockedParams`,
|
|
16
|
+
* `useEnigmaPriceServicePricesByNames`, `useFeeForUser`). For the friendlier
|
|
17
|
+
* "just give me the trade intent" path, use {@link useInstantOpenAuto}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { mutateAsync } = useInstantOpen();
|
|
22
|
+
* const { tempQuoteId } = await mutateAsync({
|
|
23
|
+
* walletAddress, sessionKeyAddress, signTypedData,
|
|
24
|
+
* marketId: 1, marketName: "BTCUSDT", pricePrecision: 2, quantityPrecision: 3,
|
|
25
|
+
* positionType: "LONG", userInput: "100", leverage: 5, slippage: 1,
|
|
26
|
+
* cvaPercent: "2", lfPercent: "1", partyAmmPercent: "3", partyBmmPercent: "3",
|
|
27
|
+
* markPrice: "50000",
|
|
28
|
+
* feeRates: { openFee: feeQuery.data.openFee, closeFee: feeQuery.data.closeFee },
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function useInstantOpen(parameters?: UseInstantOpenParameters): UseInstantOpenReturnType;
|
|
33
|
+
//# sourceMappingURL=use-instant-open.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-open.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,eAAe,CAAC;AAEvD,6CAA6C;AAC7C,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CACtD,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,UAAU,GAAE,wBAA6B,GAAG,wBAAwB,CAyBlG"}
|
|
@@ -0,0 +1,32 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { getInstantOpensQueryKey as i, instantOpenMutationOptions as a } from "@symmio/trading-core";
|
|
7
|
+
import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
|
|
8
|
+
//#region src/instant-layer/use-instant-open.ts
|
|
9
|
+
function c(c = {}) {
|
|
10
|
+
let l = t(c), u = e(), d = s(), f = a(l);
|
|
11
|
+
return o({
|
|
12
|
+
mutationKey: f.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await f.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? u
|
|
18
|
+
});
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e, t) => {
|
|
24
|
+
let n = l.getChainConfigKey(t.chainId ?? u);
|
|
25
|
+
d.invalidateQueries({ predicate: r(i, { configKey: n }) });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { c as useInstantOpen };
|
|
31
|
+
|
|
32
|
+
//# sourceMappingURL=use-instant-open.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-open.js","names":[],"sources":["../../src/instant-layer/use-instant-open.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenMutationOptions,\n type ConfigParameter,\n type InstantOpenParameters,\n type InstantOpenReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpen}.\n */\nexport type UseInstantOpenParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpen}. */\nexport type UseInstantOpenReturnType = UseMutationResult<\n InstantOpenReturnType,\n SymmioRequestError,\n InstantOpenParameters\n>;\n\n/**\n * Open a lowcap instant position via the pure `instantOpen` primitive.\n *\n * Every input is required — the SDK does no fetching. Use this hook when the\n * caller already has market metadata, locked params, mark price, and fee\n * rates in hand (e.g. pre-fetched via `useMarkets`, `useLockedParams`,\n * `useEnigmaPriceServicePricesByNames`, `useFeeForUser`). For the friendlier\n * \"just give me the trade intent\" path, use {@link useInstantOpenAuto}.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantOpen();\n * const { tempQuoteId } = await mutateAsync({\n * walletAddress, sessionKeyAddress, signTypedData,\n * marketId: 1, marketName: \"BTCUSDT\", pricePrecision: 2, quantityPrecision: 3,\n * positionType: \"LONG\", userInput: \"100\", leverage: 5, slippage: 1,\n * cvaPercent: \"2\", lfPercent: \"1\", partyAmmPercent: \"3\", partyBmmPercent: \"3\",\n * markPrice: \"50000\",\n * feeRates: { openFee: feeQuery.data.openFee, closeFee: feeQuery.data.closeFee },\n * });\n * ```\n */\nexport function useInstantOpen(parameters: UseInstantOpenParameters = {}): UseInstantOpenReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantOpenMutationOptions(config);\n\n return useMutation<InstantOpenReturnType, SymmioRequestError, InstantOpenParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n /**\n * A freshly submitted instant-open exists on the hedger but not in any\n * cached read yet. Invalidate the instant-opens feed so it refetches and\n * the optimistic row appears immediately — without waiting for a poll.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n },\n });\n}\n"],"mappings":";;;;;;;;AAkDA,SAAgB,EAAe,IAAuC,CAAC,GAA6B;CAClG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA2B,CAAM;CAE9C,OAAO,EAA8E;EACnF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAMjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GACvE,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC;EAC1G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, GetInstantOpensOptions, GetInstantOpensReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useInstantOpens}: the core query options (partyA,
|
|
6
|
+
* optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.
|
|
7
|
+
* `refetchInterval`) plus an optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseInstantOpensParameters = GetInstantOpensOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useInstantOpens}. */
|
|
11
|
+
export type UseInstantOpensReturnType = UseQueryResult<GetInstantOpensReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read a sub-account's pending instant-open records from one hedger, with
|
|
14
|
+
* caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the
|
|
15
|
+
* connected chain; disable the query from the consumer via `query.enabled`
|
|
16
|
+
* (e.g. until a valid `partyA` is entered). Errors are normalized to
|
|
17
|
+
* {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data } = useInstantOpens({ partyA, query: { refetchInterval: 3_000 } });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useInstantOpens(parameters: UseInstantOpensParameters): UseInstantOpensReturnType;
|
|
25
|
+
//# sourceMappingURL=use-instant-opens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-opens.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-opens.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;;;;;;;;;;;GAWG;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 { getInstantOpensQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/instant-layer/use-instant-opens.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 useInstantOpens };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-instant-opens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-opens.js","names":[],"sources":["../../src/instant-layer/use-instant-opens.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryOptions,\n type ConfigParameter,\n type GetInstantOpensOptions,\n type GetInstantOpensReturnType,\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 useInstantOpens}: the core query options (partyA,\n * optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.\n * `refetchInterval`) plus an optional `config`.\n */\nexport type UseInstantOpensParameters = GetInstantOpensOptions & ConfigParameter;\n\n/** Return type of {@link useInstantOpens}. */\nexport type UseInstantOpensReturnType = UseQueryResult<GetInstantOpensReturnType, SymmioRequestError>;\n\n/**\n * Read a sub-account's pending instant-open records from one hedger, with\n * caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the\n * connected chain; disable the query from the consumer via `query.enabled`\n * (e.g. until a valid `partyA` is entered). Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useInstantOpens({ partyA, query: { refetchInterval: 3_000 } });\n * ```\n */\nexport function useInstantOpens(parameters: UseInstantOpensParameters): UseInstantOpensReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInstantOpensQueryOptions(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 UseInstantOpensReturnType;\n}\n"],"mappings":";;;;;;;AAoCA,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,22 @@
|
|
|
1
|
+
import { ConfigParameter, GetIsDelegationActiveOptions, GetIsDelegationActiveReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useIsDelegationActive}: the core query options
|
|
6
|
+
* (account, delegate, selector, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseIsDelegationActiveParameters = GetIsDelegationActiveOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useIsDelegationActive}. */
|
|
11
|
+
export type UseIsDelegationActiveReturnType = UseQueryResult<GetIsDelegationActiveReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read whether one Instant Layer delegation is active according to the
|
|
14
|
+
* contract. Omitted `chainId` resolves through the SDK config.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { data: isActive } = useIsDelegationActive({ account, delegate, selector });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useIsDelegationActive(parameters: UseIsDelegationActiveParameters): UseIsDelegationActiveReturnType;
|
|
22
|
+
//# sourceMappingURL=use-is-delegation-active.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-delegation-active.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-is-delegation-active.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,4BAA4B,EACjC,KAAK,+BAA+B,EACrC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;;;GAIG;AACH,MAAM,MAAM,+BAA+B,GAAG,4BAA4B,GAAG,eAAe,CAAC;AAE7F,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,+BAA+B,EAAE,kBAAkB,CAAC,CAAC;AAElH;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,+BAA+B,GAAG,+BAA+B,CAclH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioConfig as e } from "../provider/use-symmio-config.js";
|
|
3
|
+
import { normalizeSymmError as t } from "../errors/normalize-symm-error.js";
|
|
4
|
+
import { getIsDelegationActiveQueryOptions as n } from "@symmio/trading-core";
|
|
5
|
+
import { useQuery as r } from "@tanstack/react-query";
|
|
6
|
+
//#region src/instant-layer/use-is-delegation-active.ts
|
|
7
|
+
function i(i) {
|
|
8
|
+
let a = n(e(i), i);
|
|
9
|
+
return r({
|
|
10
|
+
...a,
|
|
11
|
+
queryFn: async () => {
|
|
12
|
+
try {
|
|
13
|
+
return await a.queryFn();
|
|
14
|
+
} catch (e) {
|
|
15
|
+
throw t(e);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { i as useIsDelegationActive };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=use-is-delegation-active.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-is-delegation-active.js","names":[],"sources":["../../src/instant-layer/use-is-delegation-active.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getIsDelegationActiveQueryOptions,\n type ConfigParameter,\n type GetIsDelegationActiveOptions,\n type GetIsDelegationActiveReturnType,\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 { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useIsDelegationActive}: the core query options\n * (account, delegate, selector, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseIsDelegationActiveParameters = GetIsDelegationActiveOptions & ConfigParameter;\n\n/** Return type of {@link useIsDelegationActive}. */\nexport type UseIsDelegationActiveReturnType = UseQueryResult<GetIsDelegationActiveReturnType, SymmioRequestError>;\n\n/**\n * Read whether one Instant Layer delegation is active according to the\n * contract. Omitted `chainId` resolves through the SDK config.\n *\n * @example\n * ```tsx\n * const { data: isActive } = useIsDelegationActive({ account, delegate, selector });\n * ```\n */\nexport function useIsDelegationActive(parameters: UseIsDelegationActiveParameters): UseIsDelegationActiveReturnType {\n const config = useSymmioConfig(parameters);\n const options = getIsDelegationActiveQueryOptions(config, parameters);\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 UseIsDelegationActiveReturnType;\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,EAAsB,GAA8E;CAElH,IAAM,IAAU,EADD,EAAgB,CACmB,GAAQ,CAAU;CAEpE,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"}
|