@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SYMMIO
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './use-account-balance-info';
|
|
2
|
+
export * from './use-account-balance-of';
|
|
3
|
+
export * from './use-add-margin';
|
|
4
|
+
export * from './use-allocate';
|
|
5
|
+
export * from './use-create-sub-accounts';
|
|
6
|
+
export * from './use-deallocate';
|
|
7
|
+
export * from './use-delete-sub-account';
|
|
8
|
+
export * from './use-deposit';
|
|
9
|
+
export * from './use-deposit-and-allocate';
|
|
10
|
+
export * from './use-edit-account-name';
|
|
11
|
+
export * from './use-predicted-next-virtual-account';
|
|
12
|
+
export * from './use-remove-margin';
|
|
13
|
+
export * from './use-simulate-add-margin';
|
|
14
|
+
export * from './use-simulate-allocate';
|
|
15
|
+
export * from './use-simulate-create-sub-accounts';
|
|
16
|
+
export * from './use-simulate-deallocate';
|
|
17
|
+
export * from './use-simulate-delete-sub-account';
|
|
18
|
+
export * from './use-simulate-deposit';
|
|
19
|
+
export * from './use-simulate-deposit-and-allocate';
|
|
20
|
+
export * from './use-simulate-edit-account-name';
|
|
21
|
+
export * from './use-simulate-remove-margin';
|
|
22
|
+
export * from './use-sub-account';
|
|
23
|
+
export * from './use-sub-account-virtual-nonce';
|
|
24
|
+
export * from './use-sub-accounts-count-of-user';
|
|
25
|
+
export * from './use-user-sub-accounts';
|
|
26
|
+
export * from './use-user-sub-accounts-addresses';
|
|
27
|
+
export * from './use-virtual-account';
|
|
28
|
+
export * from './use-virtual-accounts-addresses-of-sub-account';
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account-layer/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wBAAwB,CAAC;AACvC,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mBAAmB,CAAC;AAClC,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,yBAAyB,CAAC;AACxC,cAAc,mCAAmC,CAAC;AAClD,cAAc,uBAAuB,CAAC;AACtC,cAAc,iDAAiD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConfigParameter, GetAccountBalanceInfoOptions, GetAccountBalanceInfoReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useAccountBalanceInfo}: the core query options
|
|
6
|
+
* (account, chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseAccountBalanceInfoParameters = GetAccountBalanceInfoOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useAccountBalanceInfo}. */
|
|
10
|
+
export type UseAccountBalanceInfoReturnType = UseQueryResult<GetAccountBalanceInfoReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read raw `balanceInfoOfPartyA` fields for a SYMMIO account. The query is
|
|
13
|
+
* disabled until `account` is set. Omitted `chainId` resolves through the SDK
|
|
14
|
+
* config. Errors are normalized to {@link SymmioRequestError}.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { data, isLoading } = useAccountBalanceInfo({ account });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAccountBalanceInfo(parameters?: UseAccountBalanceInfoParameters): UseAccountBalanceInfoReturnType;
|
|
22
|
+
//# sourceMappingURL=use-account-balance-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-balance-info.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-info.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;;;GAGG;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;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAcjC"}
|
|
@@ -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 { getAccountBalanceInfoQueryOptions as n } from "@symmio/trading-core";
|
|
5
|
+
import { useQuery as r } from "@tanstack/react-query";
|
|
6
|
+
//#region src/account-layer/use-account-balance-info.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 useAccountBalanceInfo };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=use-account-balance-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-balance-info.js","names":[],"sources":["../../src/account-layer/use-account-balance-info.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceInfoQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceInfoOptions,\n type GetAccountBalanceInfoReturnType,\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 useAccountBalanceInfo}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseAccountBalanceInfoParameters = GetAccountBalanceInfoOptions & ConfigParameter;\n\n/** Return type of {@link useAccountBalanceInfo}. */\nexport type UseAccountBalanceInfoReturnType = UseQueryResult<GetAccountBalanceInfoReturnType, SymmioRequestError>;\n\n/**\n * Read raw `balanceInfoOfPartyA` fields for a SYMMIO account. The query is\n * disabled until `account` is set. Omitted `chainId` resolves through the SDK\n * config. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useAccountBalanceInfo({ account });\n * ```\n */\nexport function useAccountBalanceInfo(\n parameters: UseAccountBalanceInfoParameters = {},\n): UseAccountBalanceInfoReturnType {\n const config = useSymmioConfig(parameters);\n const options = getAccountBalanceInfoQueryOptions(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 UseAccountBalanceInfoReturnType;\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,EACd,IAA8C,CAAC,GACd;CAEjC,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConfigParameter, GetAccountBalanceOfOptions, GetAccountBalanceOfReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useAccountBalanceOf}: the core query options
|
|
6
|
+
* (account, chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseAccountBalanceOfParameters = GetAccountBalanceOfOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useAccountBalanceOf}. */
|
|
10
|
+
export type UseAccountBalanceOfReturnType = UseQueryResult<GetAccountBalanceOfReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read raw `balanceOf` for a SYMMIO account. The query is disabled until
|
|
13
|
+
* `account` is set. Omitted `chainId` resolves through the SDK config. Errors are
|
|
14
|
+
* normalized to {@link SymmioRequestError}.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { data } = useAccountBalanceOf({ account });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useAccountBalanceOf(parameters?: UseAccountBalanceOfParameters): UseAccountBalanceOfReturnType;
|
|
22
|
+
//# sourceMappingURL=use-account-balance-of.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-balance-of.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-account-balance-of.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,GAAG,eAAe,CAAC;AAEzF,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAE9G;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAcjH"}
|
|
@@ -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 { getAccountBalanceOfQueryOptions as n } from "@symmio/trading-core";
|
|
5
|
+
import { useQuery as r } from "@tanstack/react-query";
|
|
6
|
+
//#region src/account-layer/use-account-balance-of.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 useAccountBalanceOf };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=use-account-balance-of.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-balance-of.js","names":[],"sources":["../../src/account-layer/use-account-balance-of.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceOfQueryOptions,\n type ConfigParameter,\n type GetAccountBalanceOfOptions,\n type GetAccountBalanceOfReturnType,\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 useAccountBalanceOf}: the core query options\n * (account, chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseAccountBalanceOfParameters = GetAccountBalanceOfOptions & ConfigParameter;\n\n/** Return type of {@link useAccountBalanceOf}. */\nexport type UseAccountBalanceOfReturnType = UseQueryResult<GetAccountBalanceOfReturnType, SymmioRequestError>;\n\n/**\n * Read raw `balanceOf` for a SYMMIO account. The query is disabled until\n * `account` is set. Omitted `chainId` resolves through the SDK config. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useAccountBalanceOf({ account });\n * ```\n */\nexport function useAccountBalanceOf(parameters: UseAccountBalanceOfParameters = {}): UseAccountBalanceOfReturnType {\n const config = useSymmioConfig(parameters);\n const options = getAccountBalanceOfQueryOptions(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 UseAccountBalanceOfReturnType;\n}\n"],"mappings":";;;;;;AAgCA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CAEjH,IAAM,IAAU,EADD,EAAgB,CACiB,GAAQ,CAAU;CAElE,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 { AddMarginParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useAddMargin}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseAddMarginParameters = WriteParameters;
|
|
9
|
+
/** Result returned by the {@link useAddMargin} mutation. */
|
|
10
|
+
export type AddMarginResult = WriteResult;
|
|
11
|
+
/** Return type of {@link useAddMargin}. */
|
|
12
|
+
export type UseAddMarginReturnType = UseMutationResult<AddMarginResult, SymmioRequestError, AddMarginParameters>;
|
|
13
|
+
/**
|
|
14
|
+
* Add margin to a virtual account (VA) — move collateral from the parent
|
|
15
|
+
* subaccount's available balance into the VA via `AccountLayer.addMargin`. The
|
|
16
|
+
* connected wallet must own the VA. No signature is required. On success, the
|
|
17
|
+
* VA's balance reads are invalidated so mounted views refetch.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { mutate } = useAddMargin();
|
|
22
|
+
* mutate({ virtualAccount: "0xva…", amount: 50_000000000000000000n });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAddMargin(parameters?: UseAddMarginParameters): UseAddMarginReturnType;
|
|
26
|
+
//# sourceMappingURL=use-add-margin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-add-margin.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-add-margin.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,mBAAmB,EACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,eAAe,CAAC;AAErD,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC;AAE1C,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,eAAe,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AAEjH;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,UAAU,GAAE,sBAA2B,GAAG,sBAAsB,CAiC5F"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { addMarginMutationOptions as a, getAccountBalanceInfoQueryKey as o, getAccountBalanceOfQueryKey as s } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as c, useQueryClient as l } from "@tanstack/react-query";
|
|
9
|
+
//#region src/account-layer/use-add-margin.ts
|
|
10
|
+
function u(u = {}) {
|
|
11
|
+
let d = t(u), f = e(), p = l(), m = a(d);
|
|
12
|
+
return c({
|
|
13
|
+
mutationKey: m.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
let t = e.chainId ?? f;
|
|
17
|
+
return r(d, await m.mutationFn({
|
|
18
|
+
virtualAccount: e.virtualAccount,
|
|
19
|
+
amount: e.amount,
|
|
20
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
21
|
+
chainId: t
|
|
22
|
+
}), {
|
|
23
|
+
chainId: t,
|
|
24
|
+
waitForReceipt: u.waitForReceipt,
|
|
25
|
+
confirmations: u.confirmations
|
|
26
|
+
});
|
|
27
|
+
} catch (e) {
|
|
28
|
+
throw n(e);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onSuccess: (e, t) => {
|
|
32
|
+
let n = { account: t.virtualAccount };
|
|
33
|
+
p.invalidateQueries({ predicate: i(o, n) }), p.invalidateQueries({ predicate: i(s, n) });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { u as useAddMargin };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=use-add-margin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-add-margin.js","names":[],"sources":["../../src/account-layer/use-add-margin.ts"],"sourcesContent":["\"use client\";\n\nimport {\n addMarginMutationOptions,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n type AddMarginParameters,\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useAddMargin}.\n */\nexport type UseAddMarginParameters = WriteParameters;\n\n/** Result returned by the {@link useAddMargin} mutation. */\nexport type AddMarginResult = WriteResult;\n\n/** Return type of {@link useAddMargin}. */\nexport type UseAddMarginReturnType = UseMutationResult<AddMarginResult, SymmioRequestError, AddMarginParameters>;\n\n/**\n * Add margin to a virtual account (VA) — move collateral from the parent\n * subaccount's available balance into the VA via `AccountLayer.addMargin`. The\n * connected wallet must own the VA. No signature is required. On success, the\n * VA's balance reads are invalidated so mounted views refetch.\n *\n * @example\n * ```tsx\n * const { mutate } = useAddMargin();\n * mutate({ virtualAccount: \"0xva…\", amount: 50_000000000000000000n });\n * ```\n */\nexport function useAddMargin(parameters: UseAddMarginParameters = {}): UseAddMarginReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = addMarginMutationOptions(config);\n\n return useMutation<AddMarginResult, SymmioRequestError, AddMarginParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n virtualAccount: variables.virtualAccount,\n amount: variables.amount,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.virtualAccount };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAuCA,SAAgB,EAAa,IAAqC,CAAC,GAA2B;CAC5F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAAyB,CAAM;CAE5C,OAAO,EAAsE;EAC3E,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,OAAO,EAAmB,GAAQ,MANf,EAAK,WAAW;KACjC,gBAAgB,EAAU;KAC1B,QAAQ,EAAU;KAClB,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,eAAe;GAEpD,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AllocateParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useAllocate}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseAllocateParameters = WriteParameters;
|
|
9
|
+
/** Result returned by the {@link useAllocate} mutation. */
|
|
10
|
+
export type AllocateResult = WriteResult;
|
|
11
|
+
/** Return type of {@link useAllocate}. */
|
|
12
|
+
export type UseAllocateReturnType = UseMutationResult<AllocateResult, SymmioRequestError, AllocateParameters>;
|
|
13
|
+
/**
|
|
14
|
+
* Allocate a subaccount's available balance into its allocated (tradeable)
|
|
15
|
+
* balance (routed through the AccountLayer `_call` proxy). On success, the
|
|
16
|
+
* subaccount's balance-info and balance-of reads are invalidated.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { mutate } = useAllocate();
|
|
21
|
+
* mutate({ account: "0xsub…", amount: 1_000000000000000000n });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useAllocate(parameters?: UseAllocateParameters): UseAllocateReturnType;
|
|
25
|
+
//# sourceMappingURL=use-allocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-allocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-allocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAEpD,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AAEzC,0CAA0C;AAC1C,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;AAE9G;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,UAAU,GAAE,qBAA0B,GAAG,qBAAqB,CAiCzF"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { allocateMutationOptions as a, getAccountBalanceInfoQueryKey as o, getAccountBalanceOfQueryKey as s } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as c, useQueryClient as l } from "@tanstack/react-query";
|
|
9
|
+
//#region src/account-layer/use-allocate.ts
|
|
10
|
+
function u(u = {}) {
|
|
11
|
+
let d = t(u), f = e(), p = l(), m = a(d);
|
|
12
|
+
return c({
|
|
13
|
+
mutationKey: m.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
let t = e.chainId ?? f;
|
|
17
|
+
return r(d, await m.mutationFn({
|
|
18
|
+
account: e.account,
|
|
19
|
+
amount: e.amount,
|
|
20
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
21
|
+
chainId: t
|
|
22
|
+
}), {
|
|
23
|
+
chainId: t,
|
|
24
|
+
waitForReceipt: u.waitForReceipt,
|
|
25
|
+
confirmations: u.confirmations
|
|
26
|
+
});
|
|
27
|
+
} catch (e) {
|
|
28
|
+
throw n(e);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onSuccess: (e, t) => {
|
|
32
|
+
let n = { account: t.account };
|
|
33
|
+
p.invalidateQueries({ predicate: i(o, n) }), p.invalidateQueries({ predicate: i(s, n) });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { u as useAllocate };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=use-allocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-allocate.js","names":[],"sources":["../../src/account-layer/use-allocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n allocateMutationOptions,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n type AllocateParameters,\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useAllocate}.\n */\nexport type UseAllocateParameters = WriteParameters;\n\n/** Result returned by the {@link useAllocate} mutation. */\nexport type AllocateResult = WriteResult;\n\n/** Return type of {@link useAllocate}. */\nexport type UseAllocateReturnType = UseMutationResult<AllocateResult, SymmioRequestError, AllocateParameters>;\n\n/**\n * Allocate a subaccount's available balance into its allocated (tradeable)\n * balance (routed through the AccountLayer `_call` proxy). On success, the\n * subaccount's balance-info and balance-of reads are invalidated.\n *\n * @example\n * ```tsx\n * const { mutate } = useAllocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000000000000000n });\n * ```\n */\nexport function useAllocate(parameters: UseAllocateParameters = {}): UseAllocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = allocateMutationOptions(config);\n\n return useMutation<AllocateResult, SymmioRequestError, AllocateParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n account: variables.account,\n amount: variables.amount,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.account };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAsCA,SAAgB,EAAY,IAAoC,CAAC,GAA0B;CACzF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAAwB,CAAM;CAE3C,OAAO,EAAoE;EACzE,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,OAAO,EAAmB,GAAQ,MANf,EAAK,WAAW;KACjC,SAAS,EAAU;KACnB,QAAQ,EAAU;KAClB,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,QAAQ;GAE7C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CreateSubAccountsParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useCreateSubAccounts}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseCreateSubAccountsParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Result returned by the {@link useCreateSubAccounts} mutation.
|
|
11
|
+
*/
|
|
12
|
+
export type CreateSubAccountsResult = WriteResult;
|
|
13
|
+
/** Return type of {@link useCreateSubAccounts}. */
|
|
14
|
+
export type UseCreateSubAccountsReturnType = UseMutationResult<CreateSubAccountsResult, SymmioRequestError, CreateSubAccountsParameters>;
|
|
15
|
+
/**
|
|
16
|
+
* Submit a `createSubAccounts` transaction. The connected wallet becomes the
|
|
17
|
+
* `owner` of every created subaccount. On success, the connected user's
|
|
18
|
+
* `getUserSubAccounts`, `getUserSubAccountsAddresses`, and
|
|
19
|
+
* `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* The created subaccount addresses are not returned directly — read them from the
|
|
23
|
+
* refetched list (or the `SubAccountCreated` receipt events). This hook resolves
|
|
24
|
+
* with the tx hash (and receipt when `waitForReceipt` is enabled).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const { mutate, status, error } = useCreateSubAccounts();
|
|
29
|
+
* mutate({
|
|
30
|
+
* affiliate,
|
|
31
|
+
* accountsData: [{ name: "Main", metadata: "0x", symmioCore, isolationType, singleVAMode }],
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function useCreateSubAccounts(parameters?: UseCreateSubAccountsParameters): UseCreateSubAccountsReturnType;
|
|
36
|
+
//# sourceMappingURL=use-create-sub-accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-create-sub-accounts.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-create-sub-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG,eAAe,CAAC;AAE7D;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAElD,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAC5D,uBAAuB,EACvB,kBAAkB,EAClB,2BAA2B,CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CAmCpH"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { createSubAccountsMutationOptions as a, getSubAccountsCountOfUserQueryKey as o, getUserSubAccountsAddressesQueryKey as s, getUserSubAccountsQueryKey as c } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as l } from "wagmi";
|
|
9
|
+
import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
|
|
10
|
+
//#region src/account-layer/use-create-sub-accounts.ts
|
|
11
|
+
function f(f = {}) {
|
|
12
|
+
let p = t(f), m = e(), { address: h } = l(), g = d(), _ = a(p);
|
|
13
|
+
return u({
|
|
14
|
+
mutationKey: _.mutationKey,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
let t = e.chainId ?? m;
|
|
18
|
+
return r(p, await _.mutationFn({
|
|
19
|
+
affiliate: e.affiliate,
|
|
20
|
+
accountsData: e.accountsData,
|
|
21
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
22
|
+
chainId: t
|
|
23
|
+
}), {
|
|
24
|
+
chainId: t,
|
|
25
|
+
waitForReceipt: f.waitForReceipt,
|
|
26
|
+
confirmations: f.confirmations
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw n(e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onSuccess: () => {
|
|
33
|
+
let e = h ? { user: h } : void 0;
|
|
34
|
+
g.invalidateQueries({ predicate: i(c, e) }), g.invalidateQueries({ predicate: i(s, e) }), g.invalidateQueries({ predicate: i(o, e) });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { f as useCreateSubAccounts };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=use-create-sub-accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-create-sub-accounts.js","names":[],"sources":["../../src/account-layer/use-create-sub-accounts.ts"],"sourcesContent":["\"use client\";\n\nimport {\n createSubAccountsMutationOptions,\n getSubAccountsCountOfUserQueryKey,\n getUserSubAccountsAddressesQueryKey,\n getUserSubAccountsQueryKey,\n type CreateSubAccountsParameters,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } from \"@tanstack/react-query\";\nimport { useConnection } from \"wagmi\";\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useCreateSubAccounts}.\n */\nexport type UseCreateSubAccountsParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useCreateSubAccounts} mutation.\n */\nexport type CreateSubAccountsResult = WriteResult;\n\n/** Return type of {@link useCreateSubAccounts}. */\nexport type UseCreateSubAccountsReturnType = UseMutationResult<\n CreateSubAccountsResult,\n SymmioRequestError,\n CreateSubAccountsParameters\n>;\n\n/**\n * Submit a `createSubAccounts` transaction. The connected wallet becomes the\n * `owner` of every created subaccount. On success, the connected user's\n * `getUserSubAccounts`, `getUserSubAccountsAddresses`, and\n * `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch.\n *\n * @remarks\n * The created subaccount addresses are not returned directly — read them from the\n * refetched list (or the `SubAccountCreated` receipt events). This hook resolves\n * with the tx hash (and receipt when `waitForReceipt` is enabled).\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useCreateSubAccounts();\n * mutate({\n * affiliate,\n * accountsData: [{ name: \"Main\", metadata: \"0x\", symmioCore, isolationType, singleVAMode }],\n * });\n * ```\n */\nexport function useCreateSubAccounts(parameters: UseCreateSubAccountsParameters = {}): UseCreateSubAccountsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = createSubAccountsMutationOptions(config);\n\n return useMutation<CreateSubAccountsResult, SymmioRequestError, CreateSubAccountsParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n affiliate: variables.affiliate,\n accountsData: variables.accountsData,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: () => {\n const partial = address ? { user: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getUserSubAccountsAddressesQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getSubAccountsCountOfUserQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAuDA,SAAgB,EAAqB,IAA6C,CAAC,GAAmC;CACpH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAAiC,CAAM;CAEpD,OAAO,EAAsF;EAC3F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAO7C,OAAO,EAAmB,GAAQ,MANf,EAAK,WAAW;KACjC,WAAW,EAAU;KACrB,cAAc,EAAU;KACxB,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,MAAM,EAAQ,IAAI,KAAA;GAG9C,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA4B,CAAO,EAAE,CAAC,GACrG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAqC,CAAO,EAAE,CAAC,GAC9G,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAmC,CAAO,EAAE,CAAC;EAC9G;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { DeallocateParameters, SingleUpnlSig } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useDeallocate}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseDeallocateParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Variables for the {@link useDeallocate} mutation: the core action's inputs
|
|
11
|
+
* except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon
|
|
12
|
+
* uPnL signature itself before submitting; pass one only to reuse a signature you
|
|
13
|
+
* already fetched.
|
|
14
|
+
*/
|
|
15
|
+
export type DeallocateVariables = Omit<DeallocateParameters, "upnlSig"> & {
|
|
16
|
+
/** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */
|
|
17
|
+
upnlSig?: SingleUpnlSig;
|
|
18
|
+
};
|
|
19
|
+
/** Result returned by the {@link useDeallocate} mutation. */
|
|
20
|
+
export type DeallocateResult = WriteResult;
|
|
21
|
+
/** Return type of {@link useDeallocate}. */
|
|
22
|
+
export type UseDeallocateReturnType = UseMutationResult<DeallocateResult, SymmioRequestError, DeallocateVariables>;
|
|
23
|
+
/**
|
|
24
|
+
* Deallocate a subaccount's allocated (tradeable) balance back into its available
|
|
25
|
+
* balance (routed through the AccountLayer `_call` proxy). The hook **fetches a
|
|
26
|
+
* fresh Muon uPnL signature** (the contract requires it to prove the subaccount
|
|
27
|
+
* stays solvent) immediately before submitting, unless you pass one as `upnlSig`.
|
|
28
|
+
* The connected wallet must own the subaccount. On success, the subaccount's
|
|
29
|
+
* balance reads are invalidated.
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Subject to the on-chain deallocate debounce — submitting too soon after a prior
|
|
33
|
+
* deallocate reverts. That (and an insolvent result, or a stale signature) is
|
|
34
|
+
* surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`
|
|
35
|
+
* catches it as a dry-run before anything is signed.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const { mutate } = useDeallocate();
|
|
40
|
+
* mutate({ account: "0xsub…", amount: 1_000000000000000000n });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function useDeallocate(parameters?: UseDeallocateParameters): UseDeallocateReturnType;
|
|
44
|
+
//# sourceMappingURL=use-deallocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deallocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deallocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,GAAG;IACxE,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE3C,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AAEnH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAAC,UAAU,GAAE,uBAA4B,GAAG,uBAAuB,CAwC/F"}
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { deallocateMutationOptions as a, getAccountBalanceInfoQueryKey as o, getAccountBalanceOfQueryKey as s, getDeallocateUpnlSig as c } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
|
|
9
|
+
//#region src/account-layer/use-deallocate.ts
|
|
10
|
+
function d(d = {}) {
|
|
11
|
+
let f = t(d), p = e(), m = u(), h = a(f);
|
|
12
|
+
return l({
|
|
13
|
+
mutationKey: h.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
let t = e.chainId ?? p, n = e.upnlSig ?? await c(f, {
|
|
17
|
+
virtualAccount: e.account,
|
|
18
|
+
chainId: t
|
|
19
|
+
});
|
|
20
|
+
return r(f, await h.mutationFn({
|
|
21
|
+
account: e.account,
|
|
22
|
+
amount: e.amount,
|
|
23
|
+
upnlSig: n,
|
|
24
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
25
|
+
chainId: t
|
|
26
|
+
}), {
|
|
27
|
+
chainId: t,
|
|
28
|
+
waitForReceipt: d.waitForReceipt,
|
|
29
|
+
confirmations: d.confirmations
|
|
30
|
+
});
|
|
31
|
+
} catch (e) {
|
|
32
|
+
throw n(e);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
onSuccess: (e, t) => {
|
|
36
|
+
let n = { account: t.account };
|
|
37
|
+
m.invalidateQueries({ predicate: i(o, n) }), m.invalidateQueries({ predicate: i(s, n) });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { d as useDeallocate };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=use-deallocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deallocate.js","names":[],"sources":["../../src/account-layer/use-deallocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deallocateMutationOptions,\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n type DeallocateParameters,\n type SingleUpnlSig,\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 { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useDeallocate}.\n */\nexport type UseDeallocateParameters = WriteParameters;\n\n/**\n * Variables for the {@link useDeallocate} mutation: the core action's inputs\n * except `upnlSig` is **optional**. When omitted, the hook fetches a fresh Muon\n * uPnL signature itself before submitting; pass one only to reuse a signature you\n * already fetched.\n */\nexport type DeallocateVariables = Omit<DeallocateParameters, \"upnlSig\"> & {\n /** A pre-fetched Muon uPnL signature. Omit to let the hook fetch a fresh one. */\n upnlSig?: SingleUpnlSig;\n};\n\n/** Result returned by the {@link useDeallocate} mutation. */\nexport type DeallocateResult = WriteResult;\n\n/** Return type of {@link useDeallocate}. */\nexport type UseDeallocateReturnType = UseMutationResult<DeallocateResult, SymmioRequestError, DeallocateVariables>;\n\n/**\n * Deallocate a subaccount's allocated (tradeable) balance back into its available\n * balance (routed through the AccountLayer `_call` proxy). The hook **fetches a\n * fresh Muon uPnL signature** (the contract requires it to prove the subaccount\n * stays solvent) immediately before submitting, unless you pass one as `upnlSig`.\n * The connected wallet must own the subaccount. On success, the subaccount's\n * balance reads are invalidated.\n *\n * @remarks\n * Subject to the on-chain deallocate debounce — submitting too soon after a prior\n * deallocate reverts. That (and an insolvent result, or a stale signature) is\n * surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`\n * catches it as a dry-run before anything is signed.\n *\n * @example\n * ```tsx\n * const { mutate } = useDeallocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000000000000000n });\n * ```\n */\nexport function useDeallocate(parameters: UseDeallocateParameters = {}): UseDeallocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = deallocateMutationOptions(config);\n\n return useMutation<DeallocateResult, SymmioRequestError, DeallocateVariables>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const upnlSig =\n variables.upnlSig ??\n (await getDeallocateUpnlSig(config, {\n virtualAccount: variables.account,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({\n account: variables.account,\n amount: variables.amount,\n upnlSig,\n simulateBeforeWrite: variables.simulateBeforeWrite,\n chainId: resolvedChainId,\n });\n return resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n const partial = { account: variables.account };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA4DA,SAAgB,EAAc,IAAsC,CAAC,GAA4B;CAC/F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAA0B,CAAM;CAE7C,OAAO,EAAuE;EAC5E,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW,GACvC,IACJ,EAAU,WACT,MAAM,EAAqB,GAAQ;KAClC,gBAAgB,EAAU;KAC1B,SAAS;IACX,CAAC;IAQH,OAAO,EAAmB,GAAQ,MAPf,EAAK,WAAW;KACjC,SAAS,EAAU;KACnB,QAAQ,EAAU;KAClB;KACA,qBAAqB,EAAU;KAC/B,SAAS;IACX,CAAC,GACuC;KACtC,SAAS;KACT,gBAAgB,EAAW;KAC3B,eAAe,EAAW;IAC5B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GACjC,IAAM,IAAU,EAAE,SAAS,EAAU,QAAQ;GAE7C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA+B,CAAO,EAAE,CAAC,GACxG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA6B,CAAO,EAAE,CAAC;EACxG;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DeleteSubAccountParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
import { WriteParameters, WriteResult } from '../transactions';
|
|
5
|
+
/**
|
|
6
|
+
* Parameters for {@link useDeleteSubAccount}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseDeleteSubAccountParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Result returned by the {@link useDeleteSubAccount} mutation.
|
|
11
|
+
*/
|
|
12
|
+
export type DeleteSubAccountResult = WriteResult;
|
|
13
|
+
/** Return type of {@link useDeleteSubAccount}. */
|
|
14
|
+
export type UseDeleteSubAccountReturnType = UseMutationResult<DeleteSubAccountResult, SymmioRequestError, DeleteSubAccountParameters>;
|
|
15
|
+
/**
|
|
16
|
+
* Submit a `deleteSubAccount` transaction. Deletion is irreversible and only
|
|
17
|
+
* succeeds once the subaccount has no virtual accounts, zero balance, no open
|
|
18
|
+
* positions, and no pending quotes (the call reverts otherwise). On success, the
|
|
19
|
+
* connected user's `getUserSubAccounts`, `getUserSubAccountsAddresses`, and
|
|
20
|
+
* `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch
|
|
21
|
+
* without the removed subaccount.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
* const { mutate, status, error } = useDeleteSubAccount();
|
|
26
|
+
* <button onClick={() => mutate({ subAccount: "0xsub…" })}>Delete</button>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useDeleteSubAccount(parameters?: UseDeleteSubAccountParameters): UseDeleteSubAccountReturnType;
|
|
30
|
+
//# sourceMappingURL=use-delete-sub-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-delete-sub-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-delete-sub-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAAsB,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG7F;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAEjD,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAC3D,sBAAsB,EACtB,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAkCjH"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { predicateMatch as i } from "../utils/predicate-match.js";
|
|
7
|
+
import { deleteSubAccountMutationOptions as a, getSubAccountsCountOfUserQueryKey as o, getUserSubAccountsAddressesQueryKey as s, getUserSubAccountsQueryKey as c } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as l } from "wagmi";
|
|
9
|
+
import { useMutation as u, useQueryClient as d } from "@tanstack/react-query";
|
|
10
|
+
//#region src/account-layer/use-delete-sub-account.ts
|
|
11
|
+
function f(f = {}) {
|
|
12
|
+
let p = t(f), m = e(), { address: h } = l(), g = d(), _ = a(p);
|
|
13
|
+
return u({
|
|
14
|
+
mutationKey: _.mutationKey,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
let t = e.chainId ?? m;
|
|
18
|
+
return r(p, await _.mutationFn({
|
|
19
|
+
subAccount: e.subAccount,
|
|
20
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
21
|
+
chainId: t
|
|
22
|
+
}), {
|
|
23
|
+
chainId: t,
|
|
24
|
+
waitForReceipt: f.waitForReceipt,
|
|
25
|
+
confirmations: f.confirmations
|
|
26
|
+
});
|
|
27
|
+
} catch (e) {
|
|
28
|
+
throw n(e);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
onSuccess: () => {
|
|
32
|
+
let e = h ? { user: h } : void 0;
|
|
33
|
+
g.invalidateQueries({ predicate: i(c, e) }), g.invalidateQueries({ predicate: i(s, e) }), g.invalidateQueries({ predicate: i(o, e) });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { f as useDeleteSubAccount };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=use-delete-sub-account.js.map
|