@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,31 @@
|
|
|
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 { getTpSlConfigQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/tpsl/use-tpsl-config.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s,
|
|
12
|
+
query: {
|
|
13
|
+
staleTime: 6e4,
|
|
14
|
+
...a.query
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return i({
|
|
18
|
+
...c,
|
|
19
|
+
queryFn: async () => {
|
|
20
|
+
try {
|
|
21
|
+
return await c.queryFn();
|
|
22
|
+
} catch (e) {
|
|
23
|
+
throw n(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as useTpSlConfig };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=use-tpsl-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tpsl-config.js","names":[],"sources":["../../src/tpsl/use-tpsl-config.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getTpSlConfigQueryOptions,\n type ConfigParameter,\n type GetTpSlConfigOptions,\n type GetTpSlConfigReturnType,\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/** Parameters for {@link useTpSlConfig}. */\nexport type UseTpSlConfigParameters = GetTpSlConfigOptions & ConfigParameter;\n\n/** Return type of {@link useTpSlConfig}. */\nexport type UseTpSlConfigReturnType = UseQueryResult<GetTpSlConfigReturnType, SymmioRequestError>;\n\n/**\n * Read the TP/SL handler's `/configs/` rules — `minPriceDistancePercent` and\n * `minProfitStopLossSpreadPercent`. Pair with `validateTpSl()` to live-check\n * user input.\n */\nexport function useTpSlConfig(parameters: UseTpSlConfigParameters = {}): UseTpSlConfigReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getTpSlConfigQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n query: { staleTime: 60_000, ...parameters.query },\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 UseTpSlConfigReturnType;\n}\n"],"mappings":";;;;;;;AAyBA,SAAgB,EAAc,IAAsC,CAAC,GAA4B;CAC/F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA0B,GAAQ;EAChD,GAAG;EACH,SAAS,EAAW,WAAW;EAC/B,OAAO;GAAE,WAAW;GAAQ,GAAG,EAAW;EAAM;CAClD,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,13 @@
|
|
|
1
|
+
import { ConfigParameter, GetTpSlSigningSpecOptions, GetTpSlSigningSpecReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/** Parameters for {@link useTpSlSigningSpec}. */
|
|
5
|
+
export type UseTpSlSigningSpecParameters = GetTpSlSigningSpecOptions & ConfigParameter;
|
|
6
|
+
/** Return type of {@link useTpSlSigningSpec}. */
|
|
7
|
+
export type UseTpSlSigningSpecReturnType = UseQueryResult<GetTpSlSigningSpecReturnType, SymmioRequestError>;
|
|
8
|
+
/**
|
|
9
|
+
* Read the handler's EIP-712 signing spec (`<base>/signing-spec`). Cached
|
|
10
|
+
* indefinitely — the spec is stable per deployment.
|
|
11
|
+
*/
|
|
12
|
+
export declare function useTpSlSigningSpec(parameters?: UseTpSlSigningSpecParameters): UseTpSlSigningSpecReturnType;
|
|
13
|
+
//# sourceMappingURL=use-tpsl-signing-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tpsl-signing-spec.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-tpsl-signing-spec.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAEvF,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC;AAE5G;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAmB9G"}
|
|
@@ -0,0 +1,31 @@
|
|
|
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 { getTpSlSigningSpecQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/tpsl/use-tpsl-signing-spec.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s,
|
|
12
|
+
query: {
|
|
13
|
+
staleTime: Infinity,
|
|
14
|
+
...a.query
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return i({
|
|
18
|
+
...c,
|
|
19
|
+
queryFn: async () => {
|
|
20
|
+
try {
|
|
21
|
+
return await c.queryFn();
|
|
22
|
+
} catch (e) {
|
|
23
|
+
throw n(e);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as useTpSlSigningSpec };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=use-tpsl-signing-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-tpsl-signing-spec.js","names":[],"sources":["../../src/tpsl/use-tpsl-signing-spec.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getTpSlSigningSpecQueryOptions,\n type ConfigParameter,\n type GetTpSlSigningSpecOptions,\n type GetTpSlSigningSpecReturnType,\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/** Parameters for {@link useTpSlSigningSpec}. */\nexport type UseTpSlSigningSpecParameters = GetTpSlSigningSpecOptions & ConfigParameter;\n\n/** Return type of {@link useTpSlSigningSpec}. */\nexport type UseTpSlSigningSpecReturnType = UseQueryResult<GetTpSlSigningSpecReturnType, SymmioRequestError>;\n\n/**\n * Read the handler's EIP-712 signing spec (`<base>/signing-spec`). Cached\n * indefinitely — the spec is stable per deployment.\n */\nexport function useTpSlSigningSpec(parameters: UseTpSlSigningSpecParameters = {}): UseTpSlSigningSpecReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getTpSlSigningSpecQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n query: { staleTime: Infinity, ...parameters.query },\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 UseTpSlSigningSpecReturnType;\n}\n"],"mappings":";;;;;;;AAwBA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA+B,GAAQ;EACrD,GAAG;EACH,SAAS,EAAW,WAAW;EAC/B,OAAO;GAAE,WAAW;GAAU,GAAG,EAAW;EAAM;CACpD,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,30 @@
|
|
|
1
|
+
import { ConfigParameter, SocketStatus, TpSlNotification } from '@symmio/trading-core';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useWatchTpSlNotifications}.
|
|
6
|
+
*/
|
|
7
|
+
export interface UseWatchTpSlNotificationsParameters extends ConfigParameter {
|
|
8
|
+
/** SubAccount address — required to subscribe. */
|
|
9
|
+
account?: Address;
|
|
10
|
+
/** Target chain id. Defaults to the connected chain. */
|
|
11
|
+
chainId?: number;
|
|
12
|
+
/** Subscribe only when `true` (and `account` is set). Default `true`. */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
/** Called for every normalized TP/SL report. */
|
|
15
|
+
onNotification?: (notification: TpSlNotification) => void;
|
|
16
|
+
}
|
|
17
|
+
/** Return type of {@link useWatchTpSlNotifications}. */
|
|
18
|
+
export interface UseWatchTpSlNotificationsReturnType {
|
|
19
|
+
/** Live socket status. */
|
|
20
|
+
status: SocketStatus;
|
|
21
|
+
/** Last transport / parse error, normalized, or `null`. */
|
|
22
|
+
error: SymmioRequestError | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Subscribe to the TP/SL notifications WebSocket for a subaccount. Reuses the
|
|
26
|
+
* SDK's shared socket pool so multiple components on the same account share
|
|
27
|
+
* one connection.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useWatchTpSlNotifications(parameters: UseWatchTpSlNotificationsParameters): UseWatchTpSlNotificationsReturnType;
|
|
30
|
+
//# sourceMappingURL=use-watch-tpsl-notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-watch-tpsl-notifications.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-watch-tpsl-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;GAEG;AACH,MAAM,WAAW,mCAAoC,SAAQ,eAAe;IAC1E,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gDAAgD;IAChD,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC3D;AAED,wDAAwD;AACxD,MAAM,WAAW,mCAAmC;IAClD,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,2DAA2D;IAC3D,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,mCAAmC,GAC9C,mCAAmC,CAqCrC"}
|
|
@@ -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 { watchTpSlNotifications as r } from "@symmio/trading-core";
|
|
6
|
+
import { useEffect as i, useRef as a, useState as o } from "react";
|
|
7
|
+
//#region src/tpsl/use-watch-tpsl-notifications.ts
|
|
8
|
+
function s(s) {
|
|
9
|
+
let { account: c, chainId: l, enabled: u = !0, onNotification: d } = s, f = t(s), p = e(), m = l ?? p, [h, g] = o("closed"), [_, v] = o(null), y = a(d);
|
|
10
|
+
y.current = d;
|
|
11
|
+
let b = u && !!c;
|
|
12
|
+
return i(() => {
|
|
13
|
+
if (!b || !c) {
|
|
14
|
+
g("closed");
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
v(null);
|
|
18
|
+
let e;
|
|
19
|
+
try {
|
|
20
|
+
e = r(f, {
|
|
21
|
+
account: c,
|
|
22
|
+
chainId: m,
|
|
23
|
+
onNotification: (e) => y.current?.(e),
|
|
24
|
+
onStatusChange: g,
|
|
25
|
+
onError: (e) => v(n(e))
|
|
26
|
+
});
|
|
27
|
+
} catch (e) {
|
|
28
|
+
v(n(e)), g("closed");
|
|
29
|
+
}
|
|
30
|
+
return () => e?.();
|
|
31
|
+
}, [
|
|
32
|
+
b,
|
|
33
|
+
c,
|
|
34
|
+
f,
|
|
35
|
+
m
|
|
36
|
+
]), {
|
|
37
|
+
status: h,
|
|
38
|
+
error: _
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { s as useWatchTpSlNotifications };
|
|
43
|
+
|
|
44
|
+
//# sourceMappingURL=use-watch-tpsl-notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-watch-tpsl-notifications.js","names":[],"sources":["../../src/tpsl/use-watch-tpsl-notifications.ts"],"sourcesContent":["\"use client\";\n\nimport {\n watchTpSlNotifications,\n type ConfigParameter,\n type SocketStatus,\n type TpSlNotification,\n} from \"@symmio/trading-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport type { Address } from \"viem\";\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 useWatchTpSlNotifications}.\n */\nexport interface UseWatchTpSlNotificationsParameters extends ConfigParameter {\n /** SubAccount address — required to subscribe. */\n account?: Address;\n /** Target chain id. Defaults to the connected chain. */\n chainId?: number;\n /** Subscribe only when `true` (and `account` is set). Default `true`. */\n enabled?: boolean;\n /** Called for every normalized TP/SL report. */\n onNotification?: (notification: TpSlNotification) => void;\n}\n\n/** Return type of {@link useWatchTpSlNotifications}. */\nexport interface UseWatchTpSlNotificationsReturnType {\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport / parse error, normalized, or `null`. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Subscribe to the TP/SL notifications WebSocket for a subaccount. Reuses the\n * SDK's shared socket pool so multiple components on the same account share\n * one connection.\n */\nexport function useWatchTpSlNotifications(\n parameters: UseWatchTpSlNotificationsParameters,\n): UseWatchTpSlNotificationsReturnType {\n const { account, chainId, enabled = true, onNotification } = parameters;\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const resolvedChainId = chainId ?? defaultChainId;\n\n const [status, setStatus] = useState<SocketStatus>(\"closed\");\n const [error, setError] = useState<SymmioRequestError | null>(null);\n\n const onNotificationRef = useRef(onNotification);\n onNotificationRef.current = onNotification;\n\n const active = enabled && Boolean(account);\n\n useEffect(() => {\n if (!active || !account) {\n setStatus(\"closed\");\n return;\n }\n setError(null);\n let unwatch: (() => void) | undefined;\n try {\n unwatch = watchTpSlNotifications(config, {\n account,\n chainId: resolvedChainId,\n onNotification: (notification) => onNotificationRef.current?.(notification),\n onStatusChange: setStatus,\n onError: (err) => setError(normalizeSymmError(err)),\n });\n } catch (err) {\n setError(normalizeSymmError(err));\n setStatus(\"closed\");\n }\n return () => unwatch?.();\n }, [active, account, config, resolvedChainId]);\n\n return { status, error };\n}\n"],"mappings":";;;;;;;AA0CA,SAAgB,EACd,GACqC;CACrC,IAAM,EAAE,YAAS,YAAS,aAAU,IAAM,sBAAmB,GACvD,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAkB,KAAW,GAE7B,CAAC,GAAQ,KAAa,EAAuB,QAAQ,GACrD,CAAC,GAAO,KAAY,EAAoC,IAAI,GAE5D,IAAoB,EAAO,CAAc;CAC/C,EAAkB,UAAU;CAE5B,IAAM,IAAS,KAAW,EAAQ;CAwBlC,OAtBA,QAAgB;EACd,IAAI,CAAC,KAAU,CAAC,GAAS;GACvB,EAAU,QAAQ;GAClB;EACF;EACA,EAAS,IAAI;EACb,IAAI;EACJ,IAAI;GACF,IAAU,EAAuB,GAAQ;IACvC;IACA,SAAS;IACT,iBAAiB,MAAiB,EAAkB,UAAU,CAAY;IAC1E,gBAAgB;IAChB,UAAU,MAAQ,EAAS,EAAmB,CAAG,CAAC;GACpD,CAAC;EACH,SAAS,GAAK;GAEZ,AADA,EAAS,EAAmB,CAAG,CAAC,GAChC,EAAU,QAAQ;EACpB;EACA,aAAa,IAAU;CACzB,GAAG;EAAC;EAAQ;EAAS;EAAQ;CAAe,CAAC,GAEtC;EAAE;EAAQ;CAAM;AACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transactions/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Config } from '@symmio/trading-core';
|
|
2
|
+
import { Hash } from 'viem';
|
|
3
|
+
import { WriteResult } from './write-types';
|
|
4
|
+
/**
|
|
5
|
+
* Options for {@link resolveWriteResult}.
|
|
6
|
+
*/
|
|
7
|
+
interface ResolveWriteResultOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Chain the transaction was submitted on. Resolves the public client that
|
|
10
|
+
* polls for the receipt; omit to use the config's default chain.
|
|
11
|
+
*/
|
|
12
|
+
chainId?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Resolve only after the receipt is mined (default `true`). When `false`,
|
|
15
|
+
* resolve immediately with just the hash.
|
|
16
|
+
*/
|
|
17
|
+
waitForReceipt?: boolean;
|
|
18
|
+
/** Confirmations to wait for when `waitForReceipt` is true. Defaults to `1`. */
|
|
19
|
+
confirmations?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Shared tail of every write hook's `mutationFn`. Given a submitted transaction
|
|
23
|
+
* `hash`, either return it immediately (`waitForReceipt: false`) or poll for the
|
|
24
|
+
* mined receipt and return both. Applies the package-wide write defaults
|
|
25
|
+
* (`waitForReceipt: true`, `confirmations: 1`).
|
|
26
|
+
*
|
|
27
|
+
* @param config - The SDK config (its `getClient` resolves the polling client).
|
|
28
|
+
* @param hash - The submitted transaction hash.
|
|
29
|
+
* @param options - Chain id and receipt-wait behavior.
|
|
30
|
+
* @returns The hash, plus the receipt when `waitForReceipt` is enabled.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const hash = await base.mutationFn({ ...variables, chainId });
|
|
35
|
+
* return resolveWriteResult(config, hash, { chainId, waitForReceipt, confirmations });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function resolveWriteResult(config: Config, hash: Hash, options?: ResolveWriteResultOptions): Promise<WriteResult>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=resolve-write-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-write-result.d.ts","sourceRoot":"","sources":["../../src/transactions/resolve-write-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;GAEG;AACH,UAAU,yBAAyB;IACjC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,WAAW,CAAC,CAKtB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/transactions/resolve-write-result.ts
|
|
2
|
+
async function e(e, t, n = {}) {
|
|
3
|
+
let { chainId: r, waitForReceipt: i = !0, confirmations: a = 1 } = n;
|
|
4
|
+
return i ? {
|
|
5
|
+
hash: t,
|
|
6
|
+
receipt: await e.getClient({ chainId: r }).waitForTransactionReceipt({
|
|
7
|
+
hash: t,
|
|
8
|
+
confirmations: a
|
|
9
|
+
})
|
|
10
|
+
} : { hash: t };
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as resolveWriteResult };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=resolve-write-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-write-result.js","names":[],"sources":["../../src/transactions/resolve-write-result.ts"],"sourcesContent":["import type { Config } from \"@symmio/trading-core\";\nimport type { Hash } from \"viem\";\nimport type { WriteResult } from \"./write-types\";\n\n/**\n * Options for {@link resolveWriteResult}.\n */\ninterface ResolveWriteResultOptions {\n /**\n * Chain the transaction was submitted on. Resolves the public client that\n * polls for the receipt; omit to use the config's default chain.\n */\n chainId?: number;\n /**\n * Resolve only after the receipt is mined (default `true`). When `false`,\n * resolve immediately with just the hash.\n */\n waitForReceipt?: boolean;\n /** Confirmations to wait for when `waitForReceipt` is true. Defaults to `1`. */\n confirmations?: number;\n}\n\n/**\n * Shared tail of every write hook's `mutationFn`. Given a submitted transaction\n * `hash`, either return it immediately (`waitForReceipt: false`) or poll for the\n * mined receipt and return both. Applies the package-wide write defaults\n * (`waitForReceipt: true`, `confirmations: 1`).\n *\n * @param config - The SDK config (its `getClient` resolves the polling client).\n * @param hash - The submitted transaction hash.\n * @param options - Chain id and receipt-wait behavior.\n * @returns The hash, plus the receipt when `waitForReceipt` is enabled.\n *\n * @example\n * ```ts\n * const hash = await base.mutationFn({ ...variables, chainId });\n * return resolveWriteResult(config, hash, { chainId, waitForReceipt, confirmations });\n * ```\n */\nexport async function resolveWriteResult(\n config: Config,\n hash: Hash,\n options: ResolveWriteResultOptions = {},\n): Promise<WriteResult> {\n const { chainId, waitForReceipt = true, confirmations = 1 } = options;\n if (!waitForReceipt) return { hash };\n const receipt = await config.getClient({ chainId }).waitForTransactionReceipt({ hash, confirmations });\n return { hash, receipt };\n}\n"],"mappings":";AAuCA,eAAsB,EACpB,GACA,GACA,IAAqC,CAAC,GAChB;CACtB,IAAM,EAAE,YAAS,oBAAiB,IAAM,mBAAgB,MAAM;CAG9D,OAFK,IAEE;EAAE;EAAM,SAAA,MADO,EAAO,UAAU,EAAE,WAAQ,CAAC,EAAE,0BAA0B;GAAE;GAAM;EAAc,CAAC;CAC9E,IAFK,EAAE,QAAK;AAGrC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Hash } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* State of a single tracked transaction.
|
|
4
|
+
*/
|
|
5
|
+
export interface TrackedTx {
|
|
6
|
+
/** Transaction hash. Unique within a chain. */
|
|
7
|
+
hash: Hash;
|
|
8
|
+
/** Chain id the transaction was broadcast on. */
|
|
9
|
+
chainId: number;
|
|
10
|
+
/** Short human-readable label, e.g. `"Rename account"`. Shown in toasts. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Status the tx is in. Updated when the host calls `markConfirmed` / `markFailed`. */
|
|
13
|
+
status: "pending" | "confirmed" | "failed";
|
|
14
|
+
/** `Date.now()` at insertion time. Used for ordering. */
|
|
15
|
+
createdAt: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Store state plus the mutators used to update it.
|
|
19
|
+
*/
|
|
20
|
+
export interface TransactionsStoreState {
|
|
21
|
+
txs: readonly TrackedTx[];
|
|
22
|
+
/** Insert a pending transaction. Duplicate hashes are ignored. */
|
|
23
|
+
add: (tx: Omit<TrackedTx, "status" | "createdAt">) => void;
|
|
24
|
+
/** Promote a pending tx to `confirmed`. No-op if the hash is not tracked. */
|
|
25
|
+
markConfirmed: (hash: Hash) => void;
|
|
26
|
+
/** Promote a pending tx to `failed`. No-op if the hash is not tracked. */
|
|
27
|
+
markFailed: (hash: Hash) => void;
|
|
28
|
+
/** Wipe every tracked transaction. */
|
|
29
|
+
clear: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Lightweight zustand store for tracking in-flight transactions in the UI —
|
|
33
|
+
* the data backing pending-tx badges, post-confirmation toasts, and "view in
|
|
34
|
+
* explorer" links. Opt-in: hooks like `useEditAccountName` do **not** populate
|
|
35
|
+
* this store automatically; the host wires it up.
|
|
36
|
+
*
|
|
37
|
+
* Usage is identical to any zustand store — call `useTransactionsStore()` from
|
|
38
|
+
* a component to subscribe to the full state, or pass a selector for fine-
|
|
39
|
+
* grained subscriptions:
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* const pending = useTransactionsStore((s) => s.txs.filter((t) => t.status === "pending"));
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* const { add, markConfirmed } = useTransactionsStore();
|
|
46
|
+
* const hash = await sendTx();
|
|
47
|
+
* add({ hash, chainId, label: "Rename account" });
|
|
48
|
+
* await waitFor(hash);
|
|
49
|
+
* markConfirmed(hash);
|
|
50
|
+
*/
|
|
51
|
+
export declare const useTransactionsStore: import('zustand').UseBoundStore<import('zustand').StoreApi<TransactionsStoreState>>;
|
|
52
|
+
//# sourceMappingURL=use-transactions-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transactions-store.d.ts","sourceRoot":"","sources":["../../src/transactions/use-transactions-store.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGjC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,+CAA+C;IAC/C,IAAI,EAAE,IAAI,CAAC;IACX,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;IACd,uFAAuF;IACvF,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,GAAG,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1B,kEAAkE;IAClE,GAAG,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,GAAG,WAAW,CAAC,KAAK,IAAI,CAAC;IAC3D,6EAA6E;IAC7E,aAAa,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACpC,0EAA0E;IAC1E,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACjC,sCAAsC;IACtC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,qFAkB9B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { create as e } from "zustand";
|
|
3
|
+
//#region src/transactions/use-transactions-store.ts
|
|
4
|
+
var t = e((e) => ({
|
|
5
|
+
txs: [],
|
|
6
|
+
add: (t) => e((e) => e.txs.some((e) => e.hash === t.hash) ? e : { txs: [...e.txs, {
|
|
7
|
+
...t,
|
|
8
|
+
status: "pending",
|
|
9
|
+
createdAt: Date.now()
|
|
10
|
+
}] }),
|
|
11
|
+
markConfirmed: (t) => e((e) => ({ txs: e.txs.map((e) => e.hash === t ? {
|
|
12
|
+
...e,
|
|
13
|
+
status: "confirmed"
|
|
14
|
+
} : e) })),
|
|
15
|
+
markFailed: (t) => e((e) => ({ txs: e.txs.map((e) => e.hash === t ? {
|
|
16
|
+
...e,
|
|
17
|
+
status: "failed"
|
|
18
|
+
} : e) })),
|
|
19
|
+
clear: () => e({ txs: [] })
|
|
20
|
+
}));
|
|
21
|
+
//#endregion
|
|
22
|
+
export { t as useTransactionsStore };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=use-transactions-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transactions-store.js","names":[],"sources":["../../src/transactions/use-transactions-store.ts"],"sourcesContent":["\"use client\";\n\nimport type { Hash } from \"viem\";\nimport { create } from \"zustand\";\n\n/**\n * State of a single tracked transaction.\n */\nexport interface TrackedTx {\n /** Transaction hash. Unique within a chain. */\n hash: Hash;\n /** Chain id the transaction was broadcast on. */\n chainId: number;\n /** Short human-readable label, e.g. `\"Rename account\"`. Shown in toasts. */\n label: string;\n /** Status the tx is in. Updated when the host calls `markConfirmed` / `markFailed`. */\n status: \"pending\" | \"confirmed\" | \"failed\";\n /** `Date.now()` at insertion time. Used for ordering. */\n createdAt: number;\n}\n\n/**\n * Store state plus the mutators used to update it.\n */\nexport interface TransactionsStoreState {\n txs: readonly TrackedTx[];\n /** Insert a pending transaction. Duplicate hashes are ignored. */\n add: (tx: Omit<TrackedTx, \"status\" | \"createdAt\">) => void;\n /** Promote a pending tx to `confirmed`. No-op if the hash is not tracked. */\n markConfirmed: (hash: Hash) => void;\n /** Promote a pending tx to `failed`. No-op if the hash is not tracked. */\n markFailed: (hash: Hash) => void;\n /** Wipe every tracked transaction. */\n clear: () => void;\n}\n\n/**\n * Lightweight zustand store for tracking in-flight transactions in the UI —\n * the data backing pending-tx badges, post-confirmation toasts, and \"view in\n * explorer\" links. Opt-in: hooks like `useEditAccountName` do **not** populate\n * this store automatically; the host wires it up.\n *\n * Usage is identical to any zustand store — call `useTransactionsStore()` from\n * a component to subscribe to the full state, or pass a selector for fine-\n * grained subscriptions:\n *\n * @example\n * const pending = useTransactionsStore((s) => s.txs.filter((t) => t.status === \"pending\"));\n *\n * @example\n * const { add, markConfirmed } = useTransactionsStore();\n * const hash = await sendTx();\n * add({ hash, chainId, label: \"Rename account\" });\n * await waitFor(hash);\n * markConfirmed(hash);\n */\nexport const useTransactionsStore = create<TransactionsStoreState>((set) => ({\n txs: [],\n add: (tx) =>\n set((state) => {\n if (state.txs.some((existing) => existing.hash === tx.hash)) return state;\n return {\n txs: [...state.txs, { ...tx, status: \"pending\", createdAt: Date.now() }],\n };\n }),\n markConfirmed: (hash) =>\n set((state) => ({\n txs: state.txs.map((tx) => (tx.hash === hash ? { ...tx, status: \"confirmed\" } : tx)),\n })),\n markFailed: (hash) =>\n set((state) => ({\n txs: state.txs.map((tx) => (tx.hash === hash ? { ...tx, status: \"failed\" } : tx)),\n })),\n clear: () => set({ txs: [] }),\n}));\n"],"mappings":";;;AAwDA,IAAa,IAAuB,GAAgC,OAAS;CAC3E,KAAK,CAAC;CACN,MAAM,MACJ,GAAK,MACC,EAAM,IAAI,MAAM,MAAa,EAAS,SAAS,EAAG,IAAI,IAAU,IAC7D,EACL,KAAK,CAAC,GAAG,EAAM,KAAK;EAAE,GAAG;EAAI,QAAQ;EAAW,WAAW,KAAK,IAAI;CAAE,CAAC,EACzE,CACD;CACH,gBAAgB,MACd,GAAK,OAAW,EACd,KAAK,EAAM,IAAI,KAAK,MAAQ,EAAG,SAAS,IAAO;EAAE,GAAG;EAAI,QAAQ;CAAY,IAAI,CAAG,EACrF,EAAE;CACJ,aAAa,MACX,GAAK,OAAW,EACd,KAAK,EAAM,IAAI,KAAK,MAAQ,EAAG,SAAS,IAAO;EAAE,GAAG;EAAI,QAAQ;CAAS,IAAI,CAAG,EAClF,EAAE;CACJ,aAAa,EAAI,EAAE,KAAK,CAAC,EAAE,CAAC;AAC9B,EAAE"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ConfigParameter } from '@symmio/trading-core';
|
|
2
|
+
import { Hash, TransactionReceipt } from 'viem';
|
|
3
|
+
/**
|
|
4
|
+
* Parameters shared by every write hook — those that submit a transaction and
|
|
5
|
+
* optionally wait for its receipt. A slice-specific hook's parameter type
|
|
6
|
+
* extends (or aliases) this; the transaction's own call inputs (addresses,
|
|
7
|
+
* amounts, …) are passed as the mutation `variables`, not here.
|
|
8
|
+
*/
|
|
9
|
+
export interface WriteParameters extends ConfigParameter {
|
|
10
|
+
/**
|
|
11
|
+
* Resolve only after the receipt is mined (default `true`). Set `false` to
|
|
12
|
+
* resolve as soon as the tx hash is broadcast — useful for optimistic UIs.
|
|
13
|
+
*/
|
|
14
|
+
waitForReceipt?: boolean;
|
|
15
|
+
/** Confirmations to wait for when `waitForReceipt` is true. Defaults to `1`. */
|
|
16
|
+
confirmations?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Result shared by every write hook: the submitted transaction hash, plus the
|
|
20
|
+
* mined receipt when `waitForReceipt` is enabled.
|
|
21
|
+
*/
|
|
22
|
+
export interface WriteResult {
|
|
23
|
+
/** The submitted transaction hash. */
|
|
24
|
+
hash: Hash;
|
|
25
|
+
/** The mined receipt, present when `waitForReceipt` is enabled. */
|
|
26
|
+
receipt?: TransactionReceipt;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=write-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-types.d.ts","sourceRoot":"","sources":["../../src/transactions/write-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gFAAgF;IAChF,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,IAAI,EAAE,IAAI,CAAC;IACX,mEAAmE;IACnE,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/transfers/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigParameter, GetTransferHistoryOptions, GetTransferHistoryReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useTransferHistory}: the core query options (accounts,
|
|
6
|
+
* direction, paging, time range, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseTransferHistoryParameters = GetTransferHistoryOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useTransferHistory}. */
|
|
11
|
+
export type UseTransferHistoryReturnType = UseQueryResult<GetTransferHistoryReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read internal transfers (margin moves between SYMMIO accounts) from the events
|
|
14
|
+
* subgraph. Each row carries raw `from` / `to` endpoints, an 18-decimal `amount`,
|
|
15
|
+
* and a `direction` relative to the queried accounts. The query is disabled until
|
|
16
|
+
* at least one `account` is supplied; `chainId` defaults to the connected chain.
|
|
17
|
+
* Errors are normalized to {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data } = useTransferHistory({ accounts: [subAccount], direction: "outgoing" });
|
|
22
|
+
* data?.rows.map((row) => `${row.from} → ${row.to}`);
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useTransferHistory(parameters: UseTransferHistoryParameters): UseTransferHistoryReturnType;
|
|
26
|
+
//# sourceMappingURL=use-transfer-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transfer-history.d.ts","sourceRoot":"","sources":["../../src/transfers/use-transfer-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,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,4BAA4B,GAAG,yBAAyB,GAAG,eAAe,CAAC;AAEvF,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,cAAc,CAAC,4BAA4B,EAAE,kBAAkB,CAAC,CAAC;AAE5G;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,4BAA4B,GAAG,4BAA4B,CAkBzG"}
|
|
@@ -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 { getTransferHistoryQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/transfers/use-transfer-history.ts
|
|
8
|
+
function a(a) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useTransferHistory };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-transfer-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-transfer-history.js","names":[],"sources":["../../src/transfers/use-transfer-history.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getTransferHistoryQueryOptions,\n type ConfigParameter,\n type GetTransferHistoryOptions,\n type GetTransferHistoryReturnType,\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 useTransferHistory}: the core query options (accounts,\n * direction, paging, time range, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseTransferHistoryParameters = GetTransferHistoryOptions & ConfigParameter;\n\n/** Return type of {@link useTransferHistory}. */\nexport type UseTransferHistoryReturnType = UseQueryResult<GetTransferHistoryReturnType, SymmioRequestError>;\n\n/**\n * Read internal transfers (margin moves between SYMMIO accounts) from the events\n * subgraph. Each row carries raw `from` / `to` endpoints, an 18-decimal `amount`,\n * and a `direction` relative to the queried accounts. The query is disabled until\n * at least one `account` is supplied; `chainId` defaults to the connected chain.\n * Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useTransferHistory({ accounts: [subAccount], direction: \"outgoing\" });\n * data?.rows.map((row) => `${row.from} → ${row.to}`);\n * ```\n */\nexport function useTransferHistory(parameters: UseTransferHistoryParameters): UseTransferHistoryReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getTransferHistoryQueryOptions(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 UseTransferHistoryReturnType;\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA+B,GAAQ;EACrD,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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Query, QueryKey } from '@tanstack/react-query';
|
|
2
|
+
/**
|
|
3
|
+
* Build a `predicate` for `queryClient.invalidateQueries({ predicate })` from a
|
|
4
|
+
* core query-key factory and an optional partial of its options.
|
|
5
|
+
*
|
|
6
|
+
* A cache entry matches when:
|
|
7
|
+
* 1. its key's leading tag equals the factory's tag (the key's first segment), and
|
|
8
|
+
* 2. for every field in the partial, the key's trailing options object has an
|
|
9
|
+
* equal value. Omitted fields match anything.
|
|
10
|
+
*
|
|
11
|
+
* Both the partial and the stored keys are run through the same factory, so
|
|
12
|
+
* `bigint` values are compared in the decimal-string form the factory emits.
|
|
13
|
+
* This enables "invalidate every subaccount query for `user`, regardless of
|
|
14
|
+
* pagination or chain" — which TanStack's leading-prefix matching can't express.
|
|
15
|
+
*
|
|
16
|
+
* @param keyFn - A core query-key factory, e.g. `getUserSubAccountsQueryKey`.
|
|
17
|
+
* @param partial - Fields to match on. Omit to match every entry from `keyFn`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* queryClient.invalidateQueries({
|
|
22
|
+
* predicate: predicateMatch(getUserSubAccountsQueryKey, { user }),
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function predicateMatch<options extends object>(keyFn: (options?: options) => readonly unknown[], partial?: options): (query: Query<unknown, Error, unknown, QueryKey>) => boolean;
|
|
27
|
+
//# sourceMappingURL=predicate-match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate-match.d.ts","sourceRoot":"","sources":["../../src/utils/predicate-match.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,OAAO,SAAS,MAAM,EACnD,KAAK,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,SAAS,OAAO,EAAE,EAChD,OAAO,CAAC,EAAE,OAAO,GAChB,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,OAAO,CAoB9D"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/utils/predicate-match.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = e(t), r = n[0], i = n[1] ?? {};
|
|
4
|
+
return (e) => {
|
|
5
|
+
let n = e.queryKey;
|
|
6
|
+
if (n[0] !== r) return !1;
|
|
7
|
+
if (!t) return !0;
|
|
8
|
+
let a = n[1];
|
|
9
|
+
if (typeof a != "object" || !a) return !1;
|
|
10
|
+
let o = a;
|
|
11
|
+
for (let [e, t] of Object.entries(i)) if (t !== void 0 && o[e] !== t) return !1;
|
|
12
|
+
return !0;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as predicateMatch };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=predicate-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicate-match.js","names":[],"sources":["../../src/utils/predicate-match.ts"],"sourcesContent":["import type { Query, QueryKey } from \"@tanstack/react-query\";\n\n/**\n * Build a `predicate` for `queryClient.invalidateQueries({ predicate })` from a\n * core query-key factory and an optional partial of its options.\n *\n * A cache entry matches when:\n * 1. its key's leading tag equals the factory's tag (the key's first segment), and\n * 2. for every field in the partial, the key's trailing options object has an\n * equal value. Omitted fields match anything.\n *\n * Both the partial and the stored keys are run through the same factory, so\n * `bigint` values are compared in the decimal-string form the factory emits.\n * This enables \"invalidate every subaccount query for `user`, regardless of\n * pagination or chain\" — which TanStack's leading-prefix matching can't express.\n *\n * @param keyFn - A core query-key factory, e.g. `getUserSubAccountsQueryKey`.\n * @param partial - Fields to match on. Omit to match every entry from `keyFn`.\n *\n * @example\n * ```ts\n * queryClient.invalidateQueries({\n * predicate: predicateMatch(getUserSubAccountsQueryKey, { user }),\n * });\n * ```\n */\nexport function predicateMatch<options extends object>(\n keyFn: (options?: options) => readonly unknown[],\n partial?: options,\n): (query: Query<unknown, Error, unknown, QueryKey>) => boolean {\n const reference = keyFn(partial);\n const tag = reference[0];\n const referenceFilter = (reference[1] ?? {}) as Record<string, unknown>;\n\n return (query) => {\n const key = query.queryKey;\n if (key[0] !== tag) return false;\n if (!partial) return true;\n\n const segment = key[1];\n if (typeof segment !== \"object\" || segment === null) return false;\n\n const record = segment as Record<string, unknown>;\n for (const [field, value] of Object.entries(referenceFilter)) {\n if (value === undefined) continue;\n if (record[field] !== value) return false;\n }\n return true;\n };\n}\n"],"mappings":";AA0BA,SAAgB,EACd,GACA,GAC8D;CAC9D,IAAM,IAAY,EAAM,CAAO,GACzB,IAAM,EAAU,IAChB,IAAmB,EAAU,MAAM,CAAC;CAE1C,QAAQ,MAAU;EAChB,IAAM,IAAM,EAAM;EAClB,IAAI,EAAI,OAAO,GAAK,OAAO;EAC3B,IAAI,CAAC,GAAS,OAAO;EAErB,IAAM,IAAU,EAAI;EACpB,IAAI,OAAO,KAAY,aAAY,GAAkB,OAAO;EAE5D,IAAM,IAAS;EACf,KAAK,IAAM,CAAC,GAAO,MAAU,OAAO,QAAQ,CAAe,GACrD,UAAU,KAAA,KACV,EAAO,OAAW,GAAO,OAAO;EAEtC,OAAO;CACT;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Connector } from 'wagmi';
|
|
2
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
3
|
+
/**
|
|
4
|
+
* Result shape returned by {@link useConnectWallet}.
|
|
5
|
+
*/
|
|
6
|
+
export interface UseConnectWalletResult {
|
|
7
|
+
/** Connectors registered in the host's wagmi config. */
|
|
8
|
+
connectors: readonly Connector[];
|
|
9
|
+
/**
|
|
10
|
+
* Initiate a wallet connection. Resolves once the user has accepted the
|
|
11
|
+
* popup; rejects with a {@link SymmioRequestError} (kind `"user-rejected"`
|
|
12
|
+
* when the popup was dismissed).
|
|
13
|
+
*/
|
|
14
|
+
connect: (connector: Connector) => Promise<void>;
|
|
15
|
+
/** wagmi's mutation status, passed through for UI binding. */
|
|
16
|
+
status: "idle" | "pending" | "success" | "error";
|
|
17
|
+
/** Normalized error if the most recent connect attempt failed. */
|
|
18
|
+
error?: SymmioRequestError;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wraps wagmi's `useConnect` with the SDK's error normalization. The host app
|
|
22
|
+
* decides which connectors are available (injected, walletConnect, mock, etc.)
|
|
23
|
+
* via its wagmi config; this hook just surfaces them.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* const { connectors, connect, status, error } = useConnectWallet();
|
|
27
|
+
* return connectors.map((c) => (
|
|
28
|
+
* <button key={c.id} onClick={() => connect(c)} disabled={status === "pending"}>
|
|
29
|
+
* {c.name}
|
|
30
|
+
* </button>
|
|
31
|
+
* ));
|
|
32
|
+
*/
|
|
33
|
+
export declare function useConnectWallet(): UseConnectWalletResult;
|
|
34
|
+
//# sourceMappingURL=use-connect-wallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-connect-wallet.d.ts","sourceRoot":"","sources":["../../src/wallet/use-connect-wallet.ts"],"names":[],"mappings":"AAGA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,wDAAwD;IACxD,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IACjC;;;;OAIG;IACH,OAAO,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,8DAA8D;IAC9D,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,kEAAkE;IAClE,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAkBzD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { normalizeSymmError as e } from "../errors/normalize-symm-error.js";
|
|
3
|
+
import { useMemo as t } from "react";
|
|
4
|
+
import { useConnect as n, useConnectors as r } from "wagmi";
|
|
5
|
+
//#region src/wallet/use-connect-wallet.ts
|
|
6
|
+
function i() {
|
|
7
|
+
let { mutateAsync: i, status: a, error: o } = n();
|
|
8
|
+
return {
|
|
9
|
+
status: a,
|
|
10
|
+
connectors: r(),
|
|
11
|
+
error: t(() => o ? e(o) : void 0, [o]),
|
|
12
|
+
connect: async (t) => {
|
|
13
|
+
try {
|
|
14
|
+
await i({ connector: t });
|
|
15
|
+
} catch (t) {
|
|
16
|
+
throw e(t);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as useConnectWallet };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=use-connect-wallet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-connect-wallet.js","names":[],"sources":["../../src/wallet/use-connect-wallet.ts"],"sourcesContent":["\"use client\";\n\nimport { useMemo } from \"react\";\nimport { useConnect, useConnectors, type Connector } from \"wagmi\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\n\n/**\n * Result shape returned by {@link useConnectWallet}.\n */\nexport interface UseConnectWalletResult {\n /** Connectors registered in the host's wagmi config. */\n connectors: readonly Connector[];\n /**\n * Initiate a wallet connection. Resolves once the user has accepted the\n * popup; rejects with a {@link SymmioRequestError} (kind `\"user-rejected\"`\n * when the popup was dismissed).\n */\n connect: (connector: Connector) => Promise<void>;\n /** wagmi's mutation status, passed through for UI binding. */\n status: \"idle\" | \"pending\" | \"success\" | \"error\";\n /** Normalized error if the most recent connect attempt failed. */\n error?: SymmioRequestError;\n}\n\n/**\n * Wraps wagmi's `useConnect` with the SDK's error normalization. The host app\n * decides which connectors are available (injected, walletConnect, mock, etc.)\n * via its wagmi config; this hook just surfaces them.\n *\n * @example\n * const { connectors, connect, status, error } = useConnectWallet();\n * return connectors.map((c) => (\n * <button key={c.id} onClick={() => connect(c)} disabled={status === \"pending\"}>\n * {c.name}\n * </button>\n * ));\n */\nexport function useConnectWallet(): UseConnectWalletResult {\n const { mutateAsync, status, error } = useConnect();\n const connectors = useConnectors();\n\n const normalized = useMemo(() => (error ? normalizeSymmError(error) : undefined), [error]);\n\n return {\n status,\n connectors,\n error: normalized,\n connect: async (connector) => {\n try {\n await mutateAsync({ connector });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n };\n}\n"],"mappings":";;;;;AAsCA,SAAgB,IAA2C;CACzD,IAAM,EAAE,gBAAa,WAAQ,aAAU,EAAW;CAKlD,OAAO;EACL;EACA,YANiB,EAMjB;EACA,OALiB,QAAe,IAAQ,EAAmB,CAAK,IAAI,KAAA,GAAY,CAAC,CAAK,CAK/E;EACP,SAAS,OAAO,MAAc;GAC5B,IAAI;IACF,MAAM,EAAY,EAAE,aAAU,CAAC;GACjC,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF;AACF"}
|