@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-delete-sub-account.js","names":[],"sources":["../../src/account-layer/use-delete-sub-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteSubAccountMutationOptions,\n getSubAccountsCountOfUserQueryKey,\n getUserSubAccountsAddressesQueryKey,\n getUserSubAccountsQueryKey,\n type DeleteSubAccountParameters,\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 useDeleteSubAccount}.\n */\nexport type UseDeleteSubAccountParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useDeleteSubAccount} mutation.\n */\nexport type DeleteSubAccountResult = WriteResult;\n\n/** Return type of {@link useDeleteSubAccount}. */\nexport type UseDeleteSubAccountReturnType = UseMutationResult<\n DeleteSubAccountResult,\n SymmioRequestError,\n DeleteSubAccountParameters\n>;\n\n/**\n * Submit a `deleteSubAccount` transaction. Deletion is irreversible and only\n * succeeds once the subaccount has no virtual accounts, zero balance, no open\n * positions, and no pending quotes (the call reverts otherwise). On success, the\n * connected user's `getUserSubAccounts`, `getUserSubAccountsAddresses`, and\n * `getSubAccountsCountOfUser` queries are invalidated so mounted lists refetch\n * without the removed subaccount.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDeleteSubAccount();\n * <button onClick={() => mutate({ subAccount: \"0xsub…\" })}>Delete</button>\n * ```\n */\nexport function useDeleteSubAccount(parameters: UseDeleteSubAccountParameters = {}): UseDeleteSubAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = deleteSubAccountMutationOptions(config);\n\n return useMutation<DeleteSubAccountResult, SymmioRequestError, DeleteSubAccountParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({\n subAccount: variables.subAccount,\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":";;;;;;;;;;AAiDA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAoF;EACzF,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,IAAM,IAAkB,EAAU,WAAW;IAM7C,OAAO,EAAmB,GAAQ,MALf,EAAK,WAAW;KACjC,YAAY,EAAU;KACtB,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,27 @@
|
|
|
1
|
+
import { DepositAndAllocateForAccountParameters } 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 useDepositAndAllocate}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseDepositAndAllocateParameters = WriteParameters;
|
|
9
|
+
/** Result returned by the {@link useDepositAndAllocate} mutation. */
|
|
10
|
+
export type DepositAndAllocateResult = WriteResult;
|
|
11
|
+
/** Return type of {@link useDepositAndAllocate}. */
|
|
12
|
+
export type UseDepositAndAllocateReturnType = UseMutationResult<DepositAndAllocateResult, SymmioRequestError, DepositAndAllocateForAccountParameters>;
|
|
13
|
+
/**
|
|
14
|
+
* Submit a `depositAndAllocateForAccount` transaction, crediting collateral to a
|
|
15
|
+
* subaccount **and allocating it into trading margin** in one transaction. The
|
|
16
|
+
* connected wallet must own the subaccount, and must have approved the collateral
|
|
17
|
+
* to the SYMMIO core first (see `useApproveCollateral`). On success, the connected
|
|
18
|
+
* wallet's collateral allowance and balance queries are invalidated.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { mutate, status, error } = useDepositAndAllocate();
|
|
23
|
+
* mutate({ account: "0xsub…", amount: 1_000000n });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useDepositAndAllocate(parameters?: UseDepositAndAllocateParameters): UseDepositAndAllocateReturnType;
|
|
27
|
+
//# sourceMappingURL=use-deposit-and-allocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deposit-and-allocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sCAAsC,EAC5C,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,+BAA+B,GAAG,eAAe,CAAC;AAE9D,qEAAqE;AACrE,MAAM,MAAM,wBAAwB,GAAG,WAAW,CAAC;AAEnD,oDAAoD;AACpD,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAC7D,wBAAwB,EACxB,kBAAkB,EAClB,sCAAsC,CACvC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,GAAE,+BAAoC,GAC/C,+BAA+B,CAkCjC"}
|
|
@@ -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 { depositAndAllocateForAccountMutationOptions as a, getCollateralAllowanceQueryKey as o, getCollateralBalanceQueryKey as s } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as c } from "wagmi";
|
|
9
|
+
import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
|
|
10
|
+
//#region src/account-layer/use-deposit-and-allocate.ts
|
|
11
|
+
function d(d = {}) {
|
|
12
|
+
let f = t(d), p = e(), { address: m } = c(), h = u(), g = a(f);
|
|
13
|
+
return l({
|
|
14
|
+
mutationKey: g.mutationKey,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
let t = e.chainId ?? p;
|
|
18
|
+
return r(f, await g.mutationFn({
|
|
19
|
+
account: e.account,
|
|
20
|
+
amount: e.amount,
|
|
21
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
22
|
+
chainId: t
|
|
23
|
+
}), {
|
|
24
|
+
chainId: t,
|
|
25
|
+
waitForReceipt: d.waitForReceipt,
|
|
26
|
+
confirmations: d.confirmations
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw n(e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onSuccess: () => {
|
|
33
|
+
let e = m ? { owner: m } : void 0;
|
|
34
|
+
h.invalidateQueries({ predicate: i(o, e) }), h.invalidateQueries({ predicate: i(s, e) });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { d as useDepositAndAllocate };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=use-deposit-and-allocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deposit-and-allocate.js","names":[],"sources":["../../src/account-layer/use-deposit-and-allocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n depositAndAllocateForAccountMutationOptions,\n getCollateralAllowanceQueryKey,\n getCollateralBalanceQueryKey,\n type DepositAndAllocateForAccountParameters,\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 useDepositAndAllocate}.\n */\nexport type UseDepositAndAllocateParameters = WriteParameters;\n\n/** Result returned by the {@link useDepositAndAllocate} mutation. */\nexport type DepositAndAllocateResult = WriteResult;\n\n/** Return type of {@link useDepositAndAllocate}. */\nexport type UseDepositAndAllocateReturnType = UseMutationResult<\n DepositAndAllocateResult,\n SymmioRequestError,\n DepositAndAllocateForAccountParameters\n>;\n\n/**\n * Submit a `depositAndAllocateForAccount` transaction, crediting collateral to a\n * subaccount **and allocating it into trading margin** in one transaction. The\n * connected wallet must own the subaccount, and must have approved the collateral\n * to the SYMMIO core first (see `useApproveCollateral`). On success, the connected\n * wallet's collateral allowance and balance queries are invalidated.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDepositAndAllocate();\n * mutate({ account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport function useDepositAndAllocate(\n parameters: UseDepositAndAllocateParameters = {},\n): UseDepositAndAllocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = depositAndAllocateForAccountMutationOptions(config);\n\n return useMutation<DepositAndAllocateResult, SymmioRequestError, DepositAndAllocateForAccountParameters>({\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: () => {\n const partial = address ? { owner: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralAllowanceQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralBalanceQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AA6CA,SAAgB,EACd,IAA8C,CAAC,GACd;CACjC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAA4C,CAAM;CAE/D,OAAO,EAAkG;EACvG,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,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,OAAO,EAAQ,IAAI,KAAA;GAE/C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAgC,CAAO,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA8B,CAAO,EAAE,CAAC;EACzG;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DepositForAccountParameters } 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 useDeposit}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseDepositParameters = WriteParameters;
|
|
9
|
+
/** Result returned by the {@link useDeposit} mutation. */
|
|
10
|
+
export type DepositResult = WriteResult;
|
|
11
|
+
/** Return type of {@link useDeposit}. */
|
|
12
|
+
export type UseDepositReturnType = UseMutationResult<DepositResult, SymmioRequestError, DepositForAccountParameters>;
|
|
13
|
+
/**
|
|
14
|
+
* Submit a `depositForAccount` transaction, crediting collateral to a
|
|
15
|
+
* subaccount's available balance. The connected wallet must own the subaccount,
|
|
16
|
+
* and must have approved the collateral to the SYMMIO core first (see
|
|
17
|
+
* `useApproveCollateral`). On success, the connected wallet's collateral
|
|
18
|
+
* allowance and balance queries are invalidated so mounted reads refetch.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { mutate, status, error } = useDeposit();
|
|
23
|
+
* mutate({ account: "0xsub…", amount: 1_000000n });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useDeposit(parameters?: UseDepositParameters): UseDepositReturnType;
|
|
27
|
+
//# sourceMappingURL=use-deposit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deposit.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-deposit.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,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,oBAAoB,GAAG,eAAe,CAAC;AAEnD,0DAA0D;AAC1D,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC;AAExC,yCAAyC;AACzC,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,aAAa,EAAE,kBAAkB,EAAE,2BAA2B,CAAC,CAAC;AAErH;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,UAAU,GAAE,oBAAyB,GAAG,oBAAoB,CAkCtF"}
|
|
@@ -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 { depositForAccountMutationOptions as a, getCollateralAllowanceQueryKey as o, getCollateralBalanceQueryKey as s } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as c } from "wagmi";
|
|
9
|
+
import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
|
|
10
|
+
//#region src/account-layer/use-deposit.ts
|
|
11
|
+
function d(d = {}) {
|
|
12
|
+
let f = t(d), p = e(), { address: m } = c(), h = u(), g = a(f);
|
|
13
|
+
return l({
|
|
14
|
+
mutationKey: g.mutationKey,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
let t = e.chainId ?? p;
|
|
18
|
+
return r(f, await g.mutationFn({
|
|
19
|
+
account: e.account,
|
|
20
|
+
amount: e.amount,
|
|
21
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
22
|
+
chainId: t
|
|
23
|
+
}), {
|
|
24
|
+
chainId: t,
|
|
25
|
+
waitForReceipt: d.waitForReceipt,
|
|
26
|
+
confirmations: d.confirmations
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw n(e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onSuccess: () => {
|
|
33
|
+
let e = m ? { owner: m } : void 0;
|
|
34
|
+
h.invalidateQueries({ predicate: i(o, e) }), h.invalidateQueries({ predicate: i(s, e) });
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { d as useDeposit };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=use-deposit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-deposit.js","names":[],"sources":["../../src/account-layer/use-deposit.ts"],"sourcesContent":["\"use client\";\n\nimport {\n depositForAccountMutationOptions,\n getCollateralAllowanceQueryKey,\n getCollateralBalanceQueryKey,\n type DepositForAccountParameters,\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 useDeposit}.\n */\nexport type UseDepositParameters = WriteParameters;\n\n/** Result returned by the {@link useDeposit} mutation. */\nexport type DepositResult = WriteResult;\n\n/** Return type of {@link useDeposit}. */\nexport type UseDepositReturnType = UseMutationResult<DepositResult, SymmioRequestError, DepositForAccountParameters>;\n\n/**\n * Submit a `depositForAccount` transaction, crediting collateral to a\n * subaccount's available balance. The connected wallet must own the subaccount,\n * and must have approved the collateral to the SYMMIO core first (see\n * `useApproveCollateral`). On success, the connected wallet's collateral\n * allowance and balance queries are invalidated so mounted reads refetch.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useDeposit();\n * mutate({ account: \"0xsub…\", amount: 1_000000n });\n * ```\n */\nexport function useDeposit(parameters: UseDepositParameters = {}): UseDepositReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = depositForAccountMutationOptions(config);\n\n return useMutation<DepositResult, SymmioRequestError, DepositForAccountParameters>({\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: () => {\n const partial = address ? { owner: address } : undefined;\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralAllowanceQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getCollateralBalanceQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AAyCA,SAAgB,EAAW,IAAmC,CAAC,GAAyB;CACtF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAAiC,CAAM;CAEpD,OAAO,EAA4E;EACjF,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,iBAAiB;GACf,IAAM,IAAU,IAAU,EAAE,OAAO,EAAQ,IAAI,KAAA;GAE/C,AADA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAgC,CAAO,EAAE,CAAC,GACzG,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA8B,CAAO,EAAE,CAAC;EACzG;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EditAccountNameParameters } 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 useEditAccountName}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseEditAccountNameParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Result returned by the {@link useEditAccountName} mutation.
|
|
11
|
+
*/
|
|
12
|
+
export type EditAccountNameResult = WriteResult;
|
|
13
|
+
/** Return type of {@link useEditAccountName}. */
|
|
14
|
+
export type UseEditAccountNameReturnType = UseMutationResult<EditAccountNameResult, SymmioRequestError, EditAccountNameParameters>;
|
|
15
|
+
/**
|
|
16
|
+
* Submit an `editAccountName` transaction for a subaccount. On success, every
|
|
17
|
+
* `getUserSubAccounts` query for the connected wallet is invalidated so mounted
|
|
18
|
+
* lists refetch with the new name.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { mutate, status, error } = useEditAccountName();
|
|
23
|
+
* <button onClick={() => mutate({ account: "0xsub…", name: "Trading Bot" })}>Rename</button>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useEditAccountName(parameters?: UseEditAccountNameParameters): UseEditAccountNameReturnType;
|
|
27
|
+
//# sourceMappingURL=use-edit-account-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-edit-account-name.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-edit-account-name.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,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,4BAA4B,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEhD,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,qBAAqB,EACrB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAkC9G"}
|
|
@@ -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 { editAccountNameMutationOptions as a, getUserSubAccountsQueryKey as o } from "@symmio/trading-core";
|
|
8
|
+
import { useConnection as s } from "wagmi";
|
|
9
|
+
import { useMutation as c, useQueryClient as l } from "@tanstack/react-query";
|
|
10
|
+
//#region src/account-layer/use-edit-account-name.ts
|
|
11
|
+
function u(u = {}) {
|
|
12
|
+
let d = t(u), f = e(), { address: p } = s(), m = l(), h = a(d);
|
|
13
|
+
return c({
|
|
14
|
+
mutationKey: h.mutationKey,
|
|
15
|
+
mutationFn: async (e) => {
|
|
16
|
+
try {
|
|
17
|
+
let t = e.chainId ?? f;
|
|
18
|
+
return r(d, await h.mutationFn({
|
|
19
|
+
account: e.account,
|
|
20
|
+
name: e.name,
|
|
21
|
+
simulateBeforeWrite: e.simulateBeforeWrite,
|
|
22
|
+
chainId: t
|
|
23
|
+
}), {
|
|
24
|
+
chainId: t,
|
|
25
|
+
waitForReceipt: u.waitForReceipt,
|
|
26
|
+
confirmations: u.confirmations
|
|
27
|
+
});
|
|
28
|
+
} catch (e) {
|
|
29
|
+
throw n(e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
onSuccess: () => {
|
|
33
|
+
m.invalidateQueries({ predicate: i(o, p ? { user: p } : void 0) });
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { u as useEditAccountName };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=use-edit-account-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-edit-account-name.js","names":[],"sources":["../../src/account-layer/use-edit-account-name.ts"],"sourcesContent":["\"use client\";\n\nimport {\n editAccountNameMutationOptions,\n getUserSubAccountsQueryKey,\n type EditAccountNameParameters,\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 useEditAccountName}.\n */\nexport type UseEditAccountNameParameters = WriteParameters;\n\n/**\n * Result returned by the {@link useEditAccountName} mutation.\n */\nexport type EditAccountNameResult = WriteResult;\n\n/** Return type of {@link useEditAccountName}. */\nexport type UseEditAccountNameReturnType = UseMutationResult<\n EditAccountNameResult,\n SymmioRequestError,\n EditAccountNameParameters\n>;\n\n/**\n * Submit an `editAccountName` transaction for a subaccount. On success, every\n * `getUserSubAccounts` query for the connected wallet is invalidated so mounted\n * lists refetch with the new name.\n *\n * @example\n * ```tsx\n * const { mutate, status, error } = useEditAccountName();\n * <button onClick={() => mutate({ account: \"0xsub…\", name: \"Trading Bot\" })}>Rename</button>\n * ```\n */\nexport function useEditAccountName(parameters: UseEditAccountNameParameters = {}): UseEditAccountNameReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const queryClient = useQueryClient();\n\n const base = editAccountNameMutationOptions(config);\n\n return useMutation<EditAccountNameResult, SymmioRequestError, EditAccountNameParameters>({\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 name: variables.name,\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 void queryClient.invalidateQueries({\n predicate: predicateMatch(getUserSubAccountsQueryKey, address ? { user: address } : undefined),\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;;AA4CA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAc,EAAe,GAE7B,IAAO,EAA+B,CAAM;CAElD,OAAO,EAAkF;EACvF,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,MAAM,EAAU;KAChB,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,EAAiB,kBAAkB,EACjC,WAAW,EAAe,GAA4B,IAAU,EAAE,MAAM,EAAQ,IAAI,KAAA,CAAS,EAC/F,CAAC;EACH;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ConfigParameter, GetPredictedNextVirtualAccountOptions, GetPredictedNextVirtualAccountReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link usePredictedNextVirtualAccount}: the core query options
|
|
6
|
+
* (`subAccount`, `isolationType`, `symbolId`, chain id, TanStack `query`
|
|
7
|
+
* overrides) plus an optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UsePredictedNextVirtualAccountParameters = GetPredictedNextVirtualAccountOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link usePredictedNextVirtualAccount}. */
|
|
11
|
+
export type UsePredictedNextVirtualAccountReturnType = UseQueryResult<GetPredictedNextVirtualAccountReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Predict the deterministic address of the next Virtual Account (VA) a
|
|
14
|
+
* subaccount would create for a given `(isolationType, symbolId)`.
|
|
15
|
+
*
|
|
16
|
+
* In lowcap, an instant-open isolates its position into a VA that does not exist
|
|
17
|
+
* on-chain until the trade lands; the AccountLayer computes that VA's address up
|
|
18
|
+
* front. Use this to surface a brand-new position's VA — e.g. as the `partyA`
|
|
19
|
+
* for quote reads — before it is created. The prediction is stable per
|
|
20
|
+
* `(subAccount, isolationType, symbolId)` only until the subaccount's virtual
|
|
21
|
+
* nonce advances, so a short default `staleTime` applies (override via
|
|
22
|
+
* `query.staleTime`).
|
|
23
|
+
*
|
|
24
|
+
* The query is disabled until `subAccount`, `isolationType`, and `symbolId` are
|
|
25
|
+
* all set. `chainId` defaults to the connected chain. Errors are normalized to
|
|
26
|
+
* {@link SymmioRequestError}.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { data: va } = usePredictedNextVirtualAccount({
|
|
31
|
+
* subAccount: "0xsub…",
|
|
32
|
+
* isolationType: VIRTUAL_ACCOUNT_ISOLATION_TYPE.MARKET_LONG,
|
|
33
|
+
* symbolId: 1n,
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function usePredictedNextVirtualAccount(parameters?: UsePredictedNextVirtualAccountParameters): UsePredictedNextVirtualAccountReturnType;
|
|
38
|
+
//# sourceMappingURL=use-predicted-next-virtual-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-predicted-next-virtual-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-predicted-next-virtual-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,qCAAqC,EAC1C,KAAK,wCAAwC,EAC9C,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,wCAAwC,GAAG,qCAAqC,GAAG,eAAe,CAAC;AAE/G,6DAA6D;AAC7D,MAAM,MAAM,wCAAwC,GAAG,cAAc,CACnE,wCAAwC,EACxC,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,GAAE,wCAA6C,GACxD,wCAAwC,CAkB1C"}
|
|
@@ -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 { getPredictedNextVirtualAccountQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/account-layer/use-predicted-next-virtual-account.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 usePredictedNextVirtualAccount };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-predicted-next-virtual-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-predicted-next-virtual-account.js","names":[],"sources":["../../src/account-layer/use-predicted-next-virtual-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getPredictedNextVirtualAccountQueryOptions,\n type ConfigParameter,\n type GetPredictedNextVirtualAccountOptions,\n type GetPredictedNextVirtualAccountReturnType,\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 usePredictedNextVirtualAccount}: the core query options\n * (`subAccount`, `isolationType`, `symbolId`, chain id, TanStack `query`\n * overrides) plus an optional `config`.\n */\nexport type UsePredictedNextVirtualAccountParameters = GetPredictedNextVirtualAccountOptions & ConfigParameter;\n\n/** Return type of {@link usePredictedNextVirtualAccount}. */\nexport type UsePredictedNextVirtualAccountReturnType = UseQueryResult<\n GetPredictedNextVirtualAccountReturnType,\n SymmioRequestError\n>;\n\n/**\n * Predict the deterministic address of the next Virtual Account (VA) a\n * subaccount would create for a given `(isolationType, symbolId)`.\n *\n * In lowcap, an instant-open isolates its position into a VA that does not exist\n * on-chain until the trade lands; the AccountLayer computes that VA's address up\n * front. Use this to surface a brand-new position's VA — e.g. as the `partyA`\n * for quote reads — before it is created. The prediction is stable per\n * `(subAccount, isolationType, symbolId)` only until the subaccount's virtual\n * nonce advances, so a short default `staleTime` applies (override via\n * `query.staleTime`).\n *\n * The query is disabled until `subAccount`, `isolationType`, and `symbolId` are\n * all set. `chainId` defaults to the connected chain. Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: va } = usePredictedNextVirtualAccount({\n * subAccount: \"0xsub…\",\n * isolationType: VIRTUAL_ACCOUNT_ISOLATION_TYPE.MARKET_LONG,\n * symbolId: 1n,\n * });\n * ```\n */\nexport function usePredictedNextVirtualAccount(\n parameters: UsePredictedNextVirtualAccountParameters = {},\n): UsePredictedNextVirtualAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getPredictedNextVirtualAccountQueryOptions(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 UsePredictedNextVirtualAccountReturnType;\n}\n"],"mappings":";;;;;;;AAoDA,SAAgB,EACd,IAAuD,CAAC,GACd;CAC1C,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA2C,GAAQ;EACjE,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,43 @@
|
|
|
1
|
+
import { RemoveMarginParameters, 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 useRemoveMargin}.
|
|
7
|
+
*/
|
|
8
|
+
export type UseRemoveMarginParameters = WriteParameters;
|
|
9
|
+
/**
|
|
10
|
+
* Variables for the {@link useRemoveMargin} 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 RemoveMarginVariables = Omit<RemoveMarginParameters, "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 useRemoveMargin} mutation. */
|
|
20
|
+
export type RemoveMarginResult = WriteResult;
|
|
21
|
+
/** Return type of {@link useRemoveMargin}. */
|
|
22
|
+
export type UseRemoveMarginReturnType = UseMutationResult<RemoveMarginResult, SymmioRequestError, RemoveMarginVariables>;
|
|
23
|
+
/**
|
|
24
|
+
* Remove margin from a virtual account (VA) — a deallocate via
|
|
25
|
+
* `AccountLayer.removeMargin`. The hook **fetches a fresh Muon uPnL signature**
|
|
26
|
+
* (the contract requires it to prove the VA stays solvent) immediately before
|
|
27
|
+
* submitting, unless you pass one as `upnlSig`. The connected wallet must own the
|
|
28
|
+
* VA. On success, the VA's balance reads are invalidated.
|
|
29
|
+
*
|
|
30
|
+
* @remarks
|
|
31
|
+
* Subject to the on-chain deallocate debounce — submitting too soon after a prior
|
|
32
|
+
* deallocate reverts. That (and an insolvent result, or a stale signature) is
|
|
33
|
+
* surfaced as a normalized {@link SymmioRequestError}; enabling `simulateBeforeWrite`
|
|
34
|
+
* catches it as a dry-run before anything is signed.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const { mutate } = useRemoveMargin();
|
|
39
|
+
* mutate({ virtualAccount: "0xva…", amount: 50_000000000000000000n });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function useRemoveMargin(parameters?: UseRemoveMarginParameters): UseRemoveMarginReturnType;
|
|
43
|
+
//# sourceMappingURL=use-remove-margin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-remove-margin.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-remove-margin.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,sBAAsB,EAC3B,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,yBAAyB,GAAG,eAAe,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,GAAG;IAC5E,iFAAiF;IACjF,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C,8CAA8C;AAC9C,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CACvD,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CAwCrG"}
|
|
@@ -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 { getAccountBalanceInfoQueryKey as a, getAccountBalanceOfQueryKey as o, getDeallocateUpnlSig as s, removeMarginMutationOptions as c } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as l, useQueryClient as u } from "@tanstack/react-query";
|
|
9
|
+
//#region src/account-layer/use-remove-margin.ts
|
|
10
|
+
function d(d = {}) {
|
|
11
|
+
let f = t(d), p = e(), m = u(), h = c(f);
|
|
12
|
+
return l({
|
|
13
|
+
mutationKey: h.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
let t = e.chainId ?? p, n = e.upnlSig ?? await s(f, {
|
|
17
|
+
virtualAccount: e.virtualAccount,
|
|
18
|
+
chainId: t
|
|
19
|
+
});
|
|
20
|
+
return r(f, await h.mutationFn({
|
|
21
|
+
virtualAccount: e.virtualAccount,
|
|
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.virtualAccount };
|
|
37
|
+
m.invalidateQueries({ predicate: i(a, n) }), m.invalidateQueries({ predicate: i(o, n) });
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { d as useRemoveMargin };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=use-remove-margin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-remove-margin.js","names":[],"sources":["../../src/account-layer/use-remove-margin.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getAccountBalanceInfoQueryKey,\n getAccountBalanceOfQueryKey,\n getDeallocateUpnlSig,\n removeMarginMutationOptions,\n type RemoveMarginParameters,\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 useRemoveMargin}.\n */\nexport type UseRemoveMarginParameters = WriteParameters;\n\n/**\n * Variables for the {@link useRemoveMargin} 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 RemoveMarginVariables = Omit<RemoveMarginParameters, \"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 useRemoveMargin} mutation. */\nexport type RemoveMarginResult = WriteResult;\n\n/** Return type of {@link useRemoveMargin}. */\nexport type UseRemoveMarginReturnType = UseMutationResult<\n RemoveMarginResult,\n SymmioRequestError,\n RemoveMarginVariables\n>;\n\n/**\n * Remove margin from a virtual account (VA) — a deallocate via\n * `AccountLayer.removeMargin`. The hook **fetches a fresh Muon uPnL signature**\n * (the contract requires it to prove the VA stays solvent) immediately before\n * submitting, unless you pass one as `upnlSig`. The connected wallet must own the\n * VA. On success, the VA's 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 } = useRemoveMargin();\n * mutate({ virtualAccount: \"0xva…\", amount: 50_000000000000000000n });\n * ```\n */\nexport function useRemoveMargin(parameters: UseRemoveMarginParameters = {}): UseRemoveMarginReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n\n const base = removeMarginMutationOptions(config);\n\n return useMutation<RemoveMarginResult, SymmioRequestError, RemoveMarginVariables>({\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.virtualAccount,\n chainId: resolvedChainId,\n }));\n const hash = await base.mutationFn({\n virtualAccount: variables.virtualAccount,\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.virtualAccount };\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceInfoQueryKey, partial) });\n void queryClient.invalidateQueries({ predicate: predicateMatch(getAccountBalanceOfQueryKey, partial) });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA+DA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAE7B,IAAO,EAA4B,CAAM;CAE/C,OAAO,EAA2E;EAChF,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,gBAAgB,EAAU;KAC1B,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,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,24 @@
|
|
|
1
|
+
import { ConfigParameter, SimulateAddMarginParameters, SimulateAddMarginReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSimulateAddMargin}: an optional `config` override. The
|
|
6
|
+
* dry-run's inputs are passed as the mutation `variables`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSimulateAddMarginParameters = ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSimulateAddMargin}. */
|
|
10
|
+
export type UseSimulateAddMarginReturnType = UseMutationResult<SimulateAddMarginReturnType, SymmioRequestError, SimulateAddMarginParameters>;
|
|
11
|
+
/**
|
|
12
|
+
* On-demand dry-run (`simulateContract`) of `addMargin`. Call `mutate(args)` to
|
|
13
|
+
* run it; `data` holds viem's `{ request, result }` (a would-be revert surfaces
|
|
14
|
+
* as a normalized {@link SymmioRequestError}). `from` defaults to the connected
|
|
15
|
+
* wallet and `chainId` to the connected chain.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const sim = useSimulateAddMargin();
|
|
20
|
+
* sim.mutate({ virtualAccount: "0xva…", amount: 50_000000000000000000n });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useSimulateAddMargin(parameters?: UseSimulateAddMarginParameters): UseSimulateAddMarginReturnType;
|
|
24
|
+
//# sourceMappingURL=use-simulate-add-margin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-add-margin.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-simulate-add-margin.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,eAAe,CAAC;AAE7D,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,iBAAiB,CAC5D,2BAA2B,EAC3B,kBAAkB,EAClB,2BAA2B,CAC5B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CAoBpH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { simulateAddMarginMutationOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useConnection as i } from "wagmi";
|
|
7
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
8
|
+
//#region src/account-layer/use-simulate-add-margin.ts
|
|
9
|
+
function o(o = {}) {
|
|
10
|
+
let s = t(o), c = e(), { address: l } = i(), u = r(s);
|
|
11
|
+
return a({
|
|
12
|
+
mutationKey: u.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await u.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? c,
|
|
18
|
+
from: e.from ?? l
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw n(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as useSimulateAddMargin };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=use-simulate-add-margin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-add-margin.js","names":[],"sources":["../../src/account-layer/use-simulate-add-margin.ts"],"sourcesContent":["\"use client\";\n\nimport {\n simulateAddMarginMutationOptions,\n type ConfigParameter,\n type SimulateAddMarginParameters,\n type SimulateAddMarginReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, 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\";\n\n/**\n * Parameters for {@link useSimulateAddMargin}: an optional `config` override. The\n * dry-run's inputs are passed as the mutation `variables`.\n */\nexport type UseSimulateAddMarginParameters = ConfigParameter;\n\n/** Return type of {@link useSimulateAddMargin}. */\nexport type UseSimulateAddMarginReturnType = UseMutationResult<\n SimulateAddMarginReturnType,\n SymmioRequestError,\n SimulateAddMarginParameters\n>;\n\n/**\n * On-demand dry-run (`simulateContract`) of `addMargin`. Call `mutate(args)` to\n * run it; `data` holds viem's `{ request, result }` (a would-be revert surfaces\n * as a normalized {@link SymmioRequestError}). `from` defaults to the connected\n * wallet and `chainId` to the connected chain.\n *\n * @example\n * ```tsx\n * const sim = useSimulateAddMargin();\n * sim.mutate({ virtualAccount: \"0xva…\", amount: 50_000000000000000000n });\n * ```\n */\nexport function useSimulateAddMargin(parameters: UseSimulateAddMarginParameters = {}): UseSimulateAddMarginReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const base = simulateAddMarginMutationOptions(config);\n\n return useMutation<SimulateAddMarginReturnType, SymmioRequestError, SimulateAddMarginParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({\n ...variables,\n chainId: variables.chainId ?? chainId,\n from: variables.from ?? address,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n });\n}\n"],"mappings":";;;;;;;;AAwCA,SAAgB,EAAqB,IAA6C,CAAC,GAAmC;CACpH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAO,EAAiC,CAAM;CAEpD,OAAO,EAA0F;EAC/F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAC3B,GAAG;KACH,SAAS,EAAU,WAAW;KAC9B,MAAM,EAAU,QAAQ;IAC1B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, SimulateAllocateParameters, SimulateAllocateReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSimulateAllocate}: an optional `config` override. The
|
|
6
|
+
* dry-run's inputs are passed as the mutation `variables`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSimulateAllocateParameters = ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSimulateAllocate}. */
|
|
10
|
+
export type UseSimulateAllocateReturnType = UseMutationResult<SimulateAllocateReturnType, SymmioRequestError, SimulateAllocateParameters>;
|
|
11
|
+
/**
|
|
12
|
+
* On-demand dry-run (`simulateContract`) of `allocate`. Call `mutate(args)` to
|
|
13
|
+
* run it; `data` holds viem's `{ request, result }` (a would-be revert surfaces
|
|
14
|
+
* as a normalized {@link SymmioRequestError}). `from` defaults to the connected
|
|
15
|
+
* wallet and `chainId` to the connected chain.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const sim = useSimulateAllocate();
|
|
20
|
+
* sim.mutate({ ...args });
|
|
21
|
+
* // sim.data?.result, sim.isPending, sim.error
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useSimulateAllocate(parameters?: UseSimulateAllocateParameters): UseSimulateAllocateReturnType;
|
|
25
|
+
//# sourceMappingURL=use-simulate-allocate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-allocate.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-simulate-allocate.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,CAC3D,0BAA0B,EAC1B,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAoBjH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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 { simulateAllocateMutationOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useConnection as i } from "wagmi";
|
|
7
|
+
import { useMutation as a } from "@tanstack/react-query";
|
|
8
|
+
//#region src/account-layer/use-simulate-allocate.ts
|
|
9
|
+
function o(o = {}) {
|
|
10
|
+
let s = t(o), c = e(), { address: l } = i(), u = r(s);
|
|
11
|
+
return a({
|
|
12
|
+
mutationKey: u.mutationKey,
|
|
13
|
+
mutationFn: async (e) => {
|
|
14
|
+
try {
|
|
15
|
+
return await u.mutationFn({
|
|
16
|
+
...e,
|
|
17
|
+
chainId: e.chainId ?? c,
|
|
18
|
+
from: e.from ?? l
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw n(e);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { o as useSimulateAllocate };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=use-simulate-allocate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-allocate.js","names":[],"sources":["../../src/account-layer/use-simulate-allocate.ts"],"sourcesContent":["\"use client\";\n\nimport {\n simulateAllocateMutationOptions,\n type ConfigParameter,\n type SimulateAllocateParameters,\n type SimulateAllocateReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, 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\";\n\n/**\n * Parameters for {@link useSimulateAllocate}: an optional `config` override. The\n * dry-run's inputs are passed as the mutation `variables`.\n */\nexport type UseSimulateAllocateParameters = ConfigParameter;\n\n/** Return type of {@link useSimulateAllocate}. */\nexport type UseSimulateAllocateReturnType = UseMutationResult<\n SimulateAllocateReturnType,\n SymmioRequestError,\n SimulateAllocateParameters\n>;\n\n/**\n * On-demand dry-run (`simulateContract`) of `allocate`. Call `mutate(args)` to\n * run it; `data` holds viem's `{ request, result }` (a would-be revert surfaces\n * as a normalized {@link SymmioRequestError}). `from` defaults to the connected\n * wallet and `chainId` to the connected chain.\n *\n * @example\n * ```tsx\n * const sim = useSimulateAllocate();\n * sim.mutate({ ...args });\n * // sim.data?.result, sim.isPending, sim.error\n * ```\n */\nexport function useSimulateAllocate(parameters: UseSimulateAllocateParameters = {}): UseSimulateAllocateReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const base = simulateAllocateMutationOptions(config);\n\n return useMutation<SimulateAllocateReturnType, SymmioRequestError, SimulateAllocateParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({\n ...variables,\n chainId: variables.chainId ?? chainId,\n from: variables.from ?? address,\n });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n });\n}\n"],"mappings":";;;;;;;;AAyCA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAO,EAAgC,CAAM;CAEnD,OAAO,EAAwF;EAC7F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAC3B,GAAG;KACH,SAAS,EAAU,WAAW;KAC9B,MAAM,EAAU,QAAQ;IAC1B,CAAC;GACH,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, SimulateCreateSubAccountsParameters, SimulateCreateSubAccountsReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSimulateCreateSubAccounts}: an optional `config` override. The dry-run's
|
|
6
|
+
* inputs are passed as the mutation `variables`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSimulateCreateSubAccountsParameters = ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSimulateCreateSubAccounts}. */
|
|
10
|
+
export type UseSimulateCreateSubAccountsReturnType = UseMutationResult<SimulateCreateSubAccountsReturnType, SymmioRequestError, SimulateCreateSubAccountsParameters>;
|
|
11
|
+
/**
|
|
12
|
+
* On-demand dry-run (`simulateContract`) of `createSubAccounts`. Call `mutate(args)`
|
|
13
|
+
* to run it; `data` holds viem's `{ request, result }` (a would-be revert surfaces
|
|
14
|
+
* as a normalized {@link SymmioRequestError}). `from` defaults to the connected
|
|
15
|
+
* wallet and `chainId` to the connected chain.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const sim = useSimulateCreateSubAccounts();
|
|
20
|
+
* sim.mutate({ ...args });
|
|
21
|
+
* // sim.data?.result, sim.isPending, sim.error
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useSimulateCreateSubAccounts(parameters?: UseSimulateCreateSubAccountsParameters): UseSimulateCreateSubAccountsReturnType;
|
|
25
|
+
//# sourceMappingURL=use-simulate-create-sub-accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-create-sub-accounts.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-simulate-create-sub-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mCAAmC,EACxC,KAAK,mCAAmC,EACzC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,sCAAsC,GAAG,eAAe,CAAC;AAErE,2DAA2D;AAC3D,MAAM,MAAM,sCAAsC,GAAG,iBAAiB,CACpE,mCAAmC,EACnC,kBAAkB,EAClB,mCAAmC,CACpC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,GAAE,sCAA2C,GACtD,sCAAsC,CAoBxC"}
|