@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-collateral-allowance.d.ts","sourceRoot":"","sources":["../../src/collateral/use-collateral-allowance.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACtC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,GAAG,eAAe,CAAC;AAE/F,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,gCAAgC,EAAE,kBAAkB,CAAC,CAAC;AAEpH;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,gCAAqC,GAChD,gCAAgC,CAkBlC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getCollateralAllowanceQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/collateral/use-collateral-allowance.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 useCollateralAllowance };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-collateral-allowance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-collateral-allowance.js","names":[],"sources":["../../src/collateral/use-collateral-allowance.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getCollateralAllowanceQueryOptions,\n type ConfigParameter,\n type GetCollateralAllowanceOptions,\n type GetCollateralAllowanceReturnType,\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 useCollateralAllowance}: the core query options (owner,\n * chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseCollateralAllowanceParameters = GetCollateralAllowanceOptions & ConfigParameter;\n\n/** Return type of {@link useCollateralAllowance}. */\nexport type UseCollateralAllowanceReturnType = UseQueryResult<GetCollateralAllowanceReturnType, SymmioRequestError>;\n\n/**\n * Read how much collateral `owner` has approved the SYMMIO core to spend. The\n * query is disabled until `owner` is set. `chainId` defaults to the connected\n * chain. Use it to decide whether a `useApproveCollateral` call is needed before\n * depositing.\n *\n * @example\n * ```tsx\n * const { data: allowance } = useCollateralAllowance({ owner: address });\n * const needsApproval = (allowance ?? 0n) < amount;\n * ```\n */\nexport function useCollateralAllowance(\n parameters: UseCollateralAllowanceParameters = {},\n): UseCollateralAllowanceReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getCollateralAllowanceQueryOptions(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 UseCollateralAllowanceReturnType;\n}\n"],"mappings":";;;;;;;AAmCA,SAAgB,EACd,IAA+C,CAAC,GACd;CAClC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,GAAQ;EACzD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ConfigParameter, GetCollateralBalanceOptions, GetCollateralBalanceReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useCollateralBalance}: the core query options (owner,
|
|
6
|
+
* chain id, TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseCollateralBalanceParameters = GetCollateralBalanceOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useCollateralBalance}. */
|
|
10
|
+
export type UseCollateralBalanceReturnType = UseQueryResult<GetCollateralBalanceReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Read `owner`'s wallet balance of the chain's collateral token (e.g. USDC) — the
|
|
13
|
+
* funds available to deposit. The query is disabled until `owner` is set.
|
|
14
|
+
* `chainId` defaults to the connected chain.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { data: balance } = useCollateralBalance({ owner: address });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useCollateralBalance(parameters?: UseCollateralBalanceParameters): UseCollateralBalanceReturnType;
|
|
22
|
+
//# sourceMappingURL=use-collateral-balance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-collateral-balance.d.ts","sourceRoot":"","sources":["../../src/collateral/use-collateral-balance.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,8BAA8B,EACpC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,2BAA2B,GAAG,eAAe,CAAC;AAE3F,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,cAAc,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;AAEhH;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CAkBpH"}
|
|
@@ -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 { getCollateralBalanceQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/collateral/use-collateral-balance.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 useCollateralBalance };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-collateral-balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-collateral-balance.js","names":[],"sources":["../../src/collateral/use-collateral-balance.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getCollateralBalanceQueryOptions,\n type ConfigParameter,\n type GetCollateralBalanceOptions,\n type GetCollateralBalanceReturnType,\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 useCollateralBalance}: the core query options (owner,\n * chain id, TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseCollateralBalanceParameters = GetCollateralBalanceOptions & ConfigParameter;\n\n/** Return type of {@link useCollateralBalance}. */\nexport type UseCollateralBalanceReturnType = UseQueryResult<GetCollateralBalanceReturnType, SymmioRequestError>;\n\n/**\n * Read `owner`'s wallet balance of the chain's collateral token (e.g. USDC) — the\n * funds available to deposit. The query is disabled until `owner` is set.\n * `chainId` defaults to the connected chain.\n *\n * @example\n * ```tsx\n * const { data: balance } = useCollateralBalance({ owner: address });\n * ```\n */\nexport function useCollateralBalance(parameters: UseCollateralBalanceParameters = {}): UseCollateralBalanceReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getCollateralBalanceQueryOptions(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 UseCollateralBalanceReturnType;\n}\n"],"mappings":";;;;;;;AAiCA,SAAgB,EAAqB,IAA6C,CAAC,GAAmC;CACpH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAiC,GAAQ;EACvD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigParameter, SimulateApproveCollateralParameters, SimulateApproveCollateralReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSimulateApproveCollateral}: an optional `config` override. The dry-run's
|
|
6
|
+
* inputs are passed as the mutation `variables`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSimulateApproveCollateralParameters = ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSimulateApproveCollateral}. */
|
|
10
|
+
export type UseSimulateApproveCollateralReturnType = UseMutationResult<SimulateApproveCollateralReturnType, SymmioRequestError, SimulateApproveCollateralParameters>;
|
|
11
|
+
/**
|
|
12
|
+
* On-demand dry-run (`simulateContract`) of `approveCollateral` (the ERC20
|
|
13
|
+
* `approve`). Call `mutate(args)` to run it; `data` holds viem's
|
|
14
|
+
* `{ request, result }` (a would-be revert surfaces as a normalized
|
|
15
|
+
* {@link SymmioRequestError}). `from` defaults to the connected wallet and
|
|
16
|
+
* `chainId` to the connected chain.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const sim = useSimulateApproveCollateral();
|
|
21
|
+
* sim.mutate({ ...args });
|
|
22
|
+
* // sim.data?.result, sim.isPending, sim.error
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function useSimulateApproveCollateral(parameters?: UseSimulateApproveCollateralParameters): UseSimulateApproveCollateralReturnType;
|
|
26
|
+
//# sourceMappingURL=use-simulate-approve-collateral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-approve-collateral.d.ts","sourceRoot":"","sources":["../../src/collateral/use-simulate-approve-collateral.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;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,GAAE,sCAA2C,GACtD,sCAAsC,CAoBxC"}
|
|
@@ -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 { simulateApproveCollateralMutationOptions 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/collateral/use-simulate-approve-collateral.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 useSimulateApproveCollateral };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=use-simulate-approve-collateral.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-simulate-approve-collateral.js","names":[],"sources":["../../src/collateral/use-simulate-approve-collateral.ts"],"sourcesContent":["\"use client\";\n\nimport {\n simulateApproveCollateralMutationOptions,\n type ConfigParameter,\n type SimulateApproveCollateralParameters,\n type SimulateApproveCollateralReturnType,\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 useSimulateApproveCollateral}: an optional `config` override. The dry-run's\n * inputs are passed as the mutation `variables`.\n */\nexport type UseSimulateApproveCollateralParameters = ConfigParameter;\n\n/** Return type of {@link useSimulateApproveCollateral}. */\nexport type UseSimulateApproveCollateralReturnType = UseMutationResult<\n SimulateApproveCollateralReturnType,\n SymmioRequestError,\n SimulateApproveCollateralParameters\n>;\n\n/**\n * On-demand dry-run (`simulateContract`) of `approveCollateral` (the ERC20\n * `approve`). Call `mutate(args)` to run it; `data` holds viem's\n * `{ request, result }` (a would-be revert surfaces as a normalized\n * {@link SymmioRequestError}). `from` defaults to the connected wallet and\n * `chainId` to the connected chain.\n *\n * @example\n * ```tsx\n * const sim = useSimulateApproveCollateral();\n * sim.mutate({ ...args });\n * // sim.data?.result, sim.isPending, sim.error\n * ```\n */\nexport function useSimulateApproveCollateral(\n parameters: UseSimulateApproveCollateralParameters = {},\n): UseSimulateApproveCollateralReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const { address } = useConnection();\n const base = simulateApproveCollateralMutationOptions(config);\n\n return useMutation<SimulateApproveCollateralReturnType, SymmioRequestError, SimulateApproveCollateralParameters>({\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":";;;;;;;;AA0CA,SAAgB,EACd,IAAqD,CAAC,GACd;CACxC,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,EAAE,eAAY,EAAc,GAC5B,IAAO,EAAyC,CAAM;CAE5D,OAAO,EAA0G;EAC/G,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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/error-codes/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ConfigParameter, GetSolverErrorCodesOptions, GetSolverErrorCodesReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useSolverErrorCodes}: the core query options (chain id,
|
|
6
|
+
* TanStack `query` overrides) plus an optional `config`.
|
|
7
|
+
*/
|
|
8
|
+
export type UseSolverErrorCodesParameters = GetSolverErrorCodesOptions & ConfigParameter;
|
|
9
|
+
/** Return type of {@link useSolverErrorCodes}. */
|
|
10
|
+
export type UseSolverErrorCodesReturnType = UseQueryResult<GetSolverErrorCodesReturnType, SymmioRequestError>;
|
|
11
|
+
/**
|
|
12
|
+
* Fetch the chain solver's error-code → message map (the `/error_codes`
|
|
13
|
+
* endpoint). The map is effectively static, so it is cached with
|
|
14
|
+
* `staleTime: Infinity`; prefer the {@link useSolverErrorMessage} selector to
|
|
15
|
+
* resolve a single code.
|
|
16
|
+
*
|
|
17
|
+
* Returns react-query's full {@link UseQueryResult}. Errors are normalized to
|
|
18
|
+
* {@link SymmioRequestError} so `error.kind` is always a documented value.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* const { data: codes } = useSolverErrorCodes();
|
|
23
|
+
* const message = codes?.[2000];
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useSolverErrorCodes(parameters?: UseSolverErrorCodesParameters): UseSolverErrorCodesReturnType;
|
|
27
|
+
//# sourceMappingURL=use-solver-error-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-solver-error-codes.d.ts","sourceRoot":"","sources":["../../src/error-codes/use-solver-error-codes.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,GAAG,eAAe,CAAC;AAEzF,kDAAkD;AAClD,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAE9G;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAkBjH"}
|
|
@@ -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 { getSolverErrorCodesQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/error-codes/use-solver-error-codes.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 useSolverErrorCodes };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-solver-error-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-solver-error-codes.js","names":[],"sources":["../../src/error-codes/use-solver-error-codes.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getSolverErrorCodesQueryOptions,\n type ConfigParameter,\n type GetSolverErrorCodesOptions,\n type GetSolverErrorCodesReturnType,\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 useSolverErrorCodes}: the core query options (chain id,\n * TanStack `query` overrides) plus an optional `config`.\n */\nexport type UseSolverErrorCodesParameters = GetSolverErrorCodesOptions & ConfigParameter;\n\n/** Return type of {@link useSolverErrorCodes}. */\nexport type UseSolverErrorCodesReturnType = UseQueryResult<GetSolverErrorCodesReturnType, SymmioRequestError>;\n\n/**\n * Fetch the chain solver's error-code → message map (the `/error_codes`\n * endpoint). The map is effectively static, so it is cached with\n * `staleTime: Infinity`; prefer the {@link useSolverErrorMessage} selector to\n * resolve a single code.\n *\n * Returns react-query's full {@link UseQueryResult}. Errors are normalized to\n * {@link SymmioRequestError} so `error.kind` is always a documented value.\n *\n * @example\n * ```tsx\n * const { data: codes } = useSolverErrorCodes();\n * const message = codes?.[2000];\n * ```\n */\nexport function useSolverErrorCodes(parameters: UseSolverErrorCodesParameters = {}): UseSolverErrorCodesReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getSolverErrorCodesQueryOptions(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 UseSolverErrorCodesReturnType;\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAgC,GAAQ;EACtD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { UseSolverErrorCodesParameters } from './use-solver-error-codes';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve a single solver error code — the `errorCode` reported on a failed
|
|
4
|
+
* open/close notification or carried on a failed `UnifiedQuote` — to its
|
|
5
|
+
* human-readable message.
|
|
6
|
+
*
|
|
7
|
+
* Returns `undefined` while the code map is loading, when `code` is `null` /
|
|
8
|
+
* absent, or when the solver does not register the code. Wraps
|
|
9
|
+
* {@link useSolverErrorCodes}; `parameters` (chain id, `config`, TanStack
|
|
10
|
+
* `query` overrides) are forwarded to the underlying map query.
|
|
11
|
+
*
|
|
12
|
+
* @param code - The numeric solver error code to resolve.
|
|
13
|
+
* @param parameters - Optional chain id, `config`, and TanStack `query` overrides.
|
|
14
|
+
* @returns The resolved message, or `undefined` when it cannot be resolved.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const message = useSolverErrorMessage(quote.errorCode);
|
|
19
|
+
* if (message) return <ResultError message={message} />;
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useSolverErrorMessage(code?: number | null, parameters?: UseSolverErrorCodesParameters): string | undefined;
|
|
23
|
+
//# sourceMappingURL=use-solver-error-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-solver-error-message.d.ts","sourceRoot":"","sources":["../../src/error-codes/use-solver-error-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,6BAA6B,EAAE,MAAM,0BAA0B,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,EACpB,UAAU,GAAE,6BAAkC,GAC7C,MAAM,GAAG,SAAS,CAIpB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSolverErrorCodes as e } from "./use-solver-error-codes.js";
|
|
3
|
+
//#region src/error-codes/use-solver-error-message.ts
|
|
4
|
+
function t(t, n = {}) {
|
|
5
|
+
let { data: r } = e(n);
|
|
6
|
+
if (!(t == null || !r)) return r[t];
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as useSolverErrorMessage };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=use-solver-error-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-solver-error-message.js","names":[],"sources":["../../src/error-codes/use-solver-error-message.ts"],"sourcesContent":["\"use client\";\n\nimport { useSolverErrorCodes, type UseSolverErrorCodesParameters } from \"./use-solver-error-codes\";\n\n/**\n * Resolve a single solver error code — the `errorCode` reported on a failed\n * open/close notification or carried on a failed `UnifiedQuote` — to its\n * human-readable message.\n *\n * Returns `undefined` while the code map is loading, when `code` is `null` /\n * absent, or when the solver does not register the code. Wraps\n * {@link useSolverErrorCodes}; `parameters` (chain id, `config`, TanStack\n * `query` overrides) are forwarded to the underlying map query.\n *\n * @param code - The numeric solver error code to resolve.\n * @param parameters - Optional chain id, `config`, and TanStack `query` overrides.\n * @returns The resolved message, or `undefined` when it cannot be resolved.\n *\n * @example\n * ```tsx\n * const message = useSolverErrorMessage(quote.errorCode);\n * if (message) return <ResultError message={message} />;\n * ```\n */\nexport function useSolverErrorMessage(\n code?: number | null,\n parameters: UseSolverErrorCodesParameters = {},\n): string | undefined {\n const { data } = useSolverErrorCodes(parameters);\n if (code == null || !data) return undefined;\n return data[code];\n}\n"],"mappings":";;;AAwBA,SAAgB,EACd,GACA,IAA4C,CAAC,GACzB;CACpB,IAAM,EAAE,YAAS,EAAoB,CAAU;CAC3C,WAAQ,QAAQ,CAAC,IACrB,OAAO,EAAK;AACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SymmioRequestError } from './symmio-request-error';
|
|
2
|
+
/**
|
|
3
|
+
* Classify any thrown value into a {@link SymmioRequestError}. Hooks call this
|
|
4
|
+
* inside their `queryFn` / `mutationFn` so consumers always see the same
|
|
5
|
+
* discriminated shape, regardless of which viem error type fired underneath.
|
|
6
|
+
*
|
|
7
|
+
* The order of `walk` matters: a wallet-popup dismissal nests inside a
|
|
8
|
+
* `TransactionExecutionError`, so the rejection check has to consider every
|
|
9
|
+
* level of the cause chain, not just the topmost throw.
|
|
10
|
+
*
|
|
11
|
+
* @param err - The thrown value (typed `unknown` because Promises can reject with anything).
|
|
12
|
+
*/
|
|
13
|
+
export declare function normalizeSymmError(err: unknown): SymmioRequestError;
|
|
14
|
+
//# sourceMappingURL=normalize-symm-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-symm-error.d.ts","sourceRoot":"","sources":["../../src/errors/normalize-symm-error.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,CAsFnE"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { SymmioRequestError as e } from "./symmio-request-error.js";
|
|
2
|
+
import { SymmApiError as t, SymmError as n } from "@symmio/trading-core";
|
|
3
|
+
import { BaseError as r, ContractFunctionRevertedError as i, EstimateGasExecutionError as a, HttpRequestError as o, InsufficientFundsError as s, TimeoutError as c, TransactionExecutionError as l, UserRejectedRequestError as u } from "viem";
|
|
4
|
+
//#region src/errors/normalize-symm-error.ts
|
|
5
|
+
function d(r) {
|
|
6
|
+
if (r instanceof e) return r;
|
|
7
|
+
if (r instanceof t) return new e({
|
|
8
|
+
kind: "api",
|
|
9
|
+
message: r.message,
|
|
10
|
+
code: r.code,
|
|
11
|
+
status: r.status,
|
|
12
|
+
responseData: r.responseData,
|
|
13
|
+
cause: r
|
|
14
|
+
});
|
|
15
|
+
if (r instanceof n) return new e({
|
|
16
|
+
kind: "sdk",
|
|
17
|
+
message: r.message,
|
|
18
|
+
code: r.code,
|
|
19
|
+
cause: r
|
|
20
|
+
});
|
|
21
|
+
let d = f(r);
|
|
22
|
+
if (d) {
|
|
23
|
+
let t = p(d, u);
|
|
24
|
+
if (t) return new e({
|
|
25
|
+
kind: "user-rejected",
|
|
26
|
+
message: t.shortMessage || "Wallet request was rejected.",
|
|
27
|
+
cause: r
|
|
28
|
+
});
|
|
29
|
+
let n = p(d, i);
|
|
30
|
+
if (n) {
|
|
31
|
+
let t = n.reason ?? n.data?.errorName;
|
|
32
|
+
return new e({
|
|
33
|
+
kind: "contract-revert",
|
|
34
|
+
message: n.shortMessage || `Contract reverted${t ? `: ${t}` : "."}`,
|
|
35
|
+
reason: t,
|
|
36
|
+
cause: r
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
let f = p(d, s);
|
|
40
|
+
if (f) return new e({
|
|
41
|
+
kind: "insufficient-funds",
|
|
42
|
+
message: f.shortMessage || "Insufficient funds for gas.",
|
|
43
|
+
cause: r
|
|
44
|
+
});
|
|
45
|
+
let m = p(d, o) || p(d, c) || p(d, a) || p(d, l);
|
|
46
|
+
return m ? new e({
|
|
47
|
+
kind: "rpc",
|
|
48
|
+
message: m.shortMessage || m.message,
|
|
49
|
+
shortMessage: m.shortMessage,
|
|
50
|
+
cause: r
|
|
51
|
+
}) : new e({
|
|
52
|
+
kind: "rpc",
|
|
53
|
+
message: d.shortMessage || d.message,
|
|
54
|
+
shortMessage: d.shortMessage,
|
|
55
|
+
cause: r
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return r instanceof Error ? new e({
|
|
59
|
+
kind: "unknown",
|
|
60
|
+
message: r.message,
|
|
61
|
+
cause: r
|
|
62
|
+
}) : new e({
|
|
63
|
+
kind: "unknown",
|
|
64
|
+
message: typeof r == "string" ? r : "An unknown error occurred.",
|
|
65
|
+
cause: r
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function f(e) {
|
|
69
|
+
let t = e, n = 0;
|
|
70
|
+
for (; t && n < 16;) {
|
|
71
|
+
if (t instanceof r) return t;
|
|
72
|
+
if (t instanceof Error && t.cause) {
|
|
73
|
+
t = t.cause, n += 1;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function p(e, t) {
|
|
80
|
+
let n = e.walk((e) => e instanceof t);
|
|
81
|
+
return n instanceof t ? n : void 0;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { d as normalizeSymmError };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=normalize-symm-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-symm-error.js","names":[],"sources":["../../src/errors/normalize-symm-error.ts"],"sourcesContent":["import { SymmApiError, SymmError } from \"@symmio/trading-core\";\nimport {\n BaseError,\n ContractFunctionRevertedError,\n EstimateGasExecutionError,\n HttpRequestError,\n InsufficientFundsError,\n TimeoutError,\n TransactionExecutionError,\n UserRejectedRequestError,\n} from \"viem\";\nimport { SymmioRequestError } from \"./symmio-request-error\";\n\n/**\n * Classify any thrown value into a {@link SymmioRequestError}. Hooks call this\n * inside their `queryFn` / `mutationFn` so consumers always see the same\n * discriminated shape, regardless of which viem error type fired underneath.\n *\n * The order of `walk` matters: a wallet-popup dismissal nests inside a\n * `TransactionExecutionError`, so the rejection check has to consider every\n * level of the cause chain, not just the topmost throw.\n *\n * @param err - The thrown value (typed `unknown` because Promises can reject with anything).\n */\nexport function normalizeSymmError(err: unknown): SymmioRequestError {\n if (err instanceof SymmioRequestError) return err;\n\n if (err instanceof SymmApiError) {\n return new SymmioRequestError({\n kind: \"api\",\n message: err.message,\n code: err.code,\n status: err.status,\n responseData: err.responseData,\n cause: err,\n });\n }\n\n if (err instanceof SymmError) {\n return new SymmioRequestError({\n kind: \"sdk\",\n message: err.message,\n code: err.code,\n cause: err,\n });\n }\n\n const viemErr = findViemError(err);\n\n if (viemErr) {\n const userRejected = findInCauseChain(viemErr, UserRejectedRequestError);\n if (userRejected) {\n return new SymmioRequestError({\n kind: \"user-rejected\",\n message: userRejected.shortMessage || \"Wallet request was rejected.\",\n cause: err,\n });\n }\n\n const revert = findInCauseChain(viemErr, ContractFunctionRevertedError);\n if (revert) {\n const reason = revert.reason ?? revert.data?.errorName;\n return new SymmioRequestError({\n kind: \"contract-revert\",\n message: revert.shortMessage || `Contract reverted${reason ? `: ${reason}` : \".\"}`,\n reason,\n cause: err,\n });\n }\n\n const insufficient = findInCauseChain(viemErr, InsufficientFundsError);\n if (insufficient) {\n return new SymmioRequestError({\n kind: \"insufficient-funds\",\n message: insufficient.shortMessage || \"Insufficient funds for gas.\",\n cause: err,\n });\n }\n\n const transport =\n findInCauseChain(viemErr, HttpRequestError) ||\n findInCauseChain(viemErr, TimeoutError) ||\n findInCauseChain(viemErr, EstimateGasExecutionError) ||\n findInCauseChain(viemErr, TransactionExecutionError);\n if (transport) {\n return new SymmioRequestError({\n kind: \"rpc\",\n message: transport.shortMessage || transport.message,\n shortMessage: transport.shortMessage,\n cause: err,\n });\n }\n\n return new SymmioRequestError({\n kind: \"rpc\",\n message: viemErr.shortMessage || viemErr.message,\n shortMessage: viemErr.shortMessage,\n cause: err,\n });\n }\n\n if (err instanceof Error) {\n return new SymmioRequestError({ kind: \"unknown\", message: err.message, cause: err });\n }\n\n return new SymmioRequestError({\n kind: \"unknown\",\n message: typeof err === \"string\" ? err : \"An unknown error occurred.\",\n cause: err,\n });\n}\n\n/**\n * Walk an error and its `cause` chain looking for a viem `BaseError`. Returns\n * the first one found, or `undefined`.\n *\n * @internal\n */\nfunction findViemError(err: unknown): BaseError | undefined {\n let current: unknown = err;\n let depth = 0;\n while (current && depth < 16) {\n if (current instanceof BaseError) return current;\n if (current instanceof Error && current.cause) {\n current = current.cause;\n depth += 1;\n continue;\n }\n return undefined;\n }\n return undefined;\n}\n\n/**\n * Walk a viem `BaseError`'s `walk()` chain looking for a specific subclass.\n *\n * @internal\n */\nfunction findInCauseChain<T extends BaseError>(err: BaseError, ctor: new (...args: never[]) => T): T | undefined {\n const found = err.walk((candidate) => candidate instanceof ctor);\n return found instanceof ctor ? (found as T) : undefined;\n}\n"],"mappings":";;;;AAwBA,SAAgB,EAAmB,GAAkC;CACnE,IAAI,aAAe,GAAoB,OAAO;CAE9C,IAAI,aAAe,GACjB,OAAO,IAAI,EAAmB;EAC5B,MAAM;EACN,SAAS,EAAI;EACb,MAAM,EAAI;EACV,QAAQ,EAAI;EACZ,cAAc,EAAI;EAClB,OAAO;CACT,CAAC;CAGH,IAAI,aAAe,GACjB,OAAO,IAAI,EAAmB;EAC5B,MAAM;EACN,SAAS,EAAI;EACb,MAAM,EAAI;EACV,OAAO;CACT,CAAC;CAGH,IAAM,IAAU,EAAc,CAAG;CAEjC,IAAI,GAAS;EACX,IAAM,IAAe,EAAiB,GAAS,CAAwB;EACvE,IAAI,GACF,OAAO,IAAI,EAAmB;GAC5B,MAAM;GACN,SAAS,EAAa,gBAAgB;GACtC,OAAO;EACT,CAAC;EAGH,IAAM,IAAS,EAAiB,GAAS,CAA6B;EACtE,IAAI,GAAQ;GACV,IAAM,IAAS,EAAO,UAAU,EAAO,MAAM;GAC7C,OAAO,IAAI,EAAmB;IAC5B,MAAM;IACN,SAAS,EAAO,gBAAgB,oBAAoB,IAAS,KAAK,MAAW;IAC7E;IACA,OAAO;GACT,CAAC;EACH;EAEA,IAAM,IAAe,EAAiB,GAAS,CAAsB;EACrE,IAAI,GACF,OAAO,IAAI,EAAmB;GAC5B,MAAM;GACN,SAAS,EAAa,gBAAgB;GACtC,OAAO;EACT,CAAC;EAGH,IAAM,IACJ,EAAiB,GAAS,CAAgB,KAC1C,EAAiB,GAAS,CAAY,KACtC,EAAiB,GAAS,CAAyB,KACnD,EAAiB,GAAS,CAAyB;EAUrD,OATI,IACK,IAAI,EAAmB;GAC5B,MAAM;GACN,SAAS,EAAU,gBAAgB,EAAU;GAC7C,cAAc,EAAU;GACxB,OAAO;EACT,CAAC,IAGI,IAAI,EAAmB;GAC5B,MAAM;GACN,SAAS,EAAQ,gBAAgB,EAAQ;GACzC,cAAc,EAAQ;GACtB,OAAO;EACT,CAAC;CACH;CAMA,OAJI,aAAe,QACV,IAAI,EAAmB;EAAE,MAAM;EAAW,SAAS,EAAI;EAAS,OAAO;CAAI,CAAC,IAG9E,IAAI,EAAmB;EAC5B,MAAM;EACN,SAAS,OAAO,KAAQ,WAAW,IAAM;EACzC,OAAO;CACT,CAAC;AACH;AAQA,SAAS,EAAc,GAAqC;CAC1D,IAAI,IAAmB,GACnB,IAAQ;CACZ,OAAO,KAAW,IAAQ,KAAI;EAC5B,IAAI,aAAmB,GAAW,OAAO;EACzC,IAAI,aAAmB,SAAS,EAAQ,OAAO;GAE7C,AADA,IAAU,EAAQ,OAClB,KAAS;GACT;EACF;EACA;CACF;AAEF;AAOA,SAAS,EAAsC,GAAgB,GAAkD;CAC/G,IAAM,IAAQ,EAAI,MAAM,MAAc,aAAqB,CAAI;CAC/D,OAAO,aAAiB,IAAQ,IAAc,KAAA;AAChD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { SymmioNormalizedErrorKind } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Options accepted by the {@link SymmioRequestError} constructor. Carries
|
|
4
|
+
* the discriminator-specific fields the UI cares about.
|
|
5
|
+
*/
|
|
6
|
+
export interface SymmioRequestErrorOptions {
|
|
7
|
+
kind: SymmioNormalizedErrorKind;
|
|
8
|
+
message: string;
|
|
9
|
+
/** SDK error code (e.g., "FETCH_MARKETS_FAILED", "UNSUPPORTED_CHAIN"). */
|
|
10
|
+
code?: string;
|
|
11
|
+
/** HTTP status code. Only meaningful when `kind === "api"`. */
|
|
12
|
+
status?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Raw response body returned by the server. Only meaningful when `kind === "api"`.
|
|
15
|
+
* Forwarded verbatim from `SymmApiError.responseData` so the UI can render the
|
|
16
|
+
* server's structured error fields without unwrapping `cause`.
|
|
17
|
+
*/
|
|
18
|
+
responseData?: unknown;
|
|
19
|
+
/** Solidity revert reason. Only meaningful when `kind === "contract-revert"`. */
|
|
20
|
+
reason?: string;
|
|
21
|
+
/** viem's human-readable short message. Only meaningful when `kind === "rpc"`. */
|
|
22
|
+
shortMessage?: string;
|
|
23
|
+
/** The original underlying error, kept for debugging. */
|
|
24
|
+
cause?: unknown;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The single error class every SYMMIO React hook throws when a read or write
|
|
28
|
+
* fails. Carries a discriminator (`kind`) the UI can switch on without
|
|
29
|
+
* inspecting viem's internal error hierarchy.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const { error } = useUserSubAccounts({ user });
|
|
33
|
+
* if (error?.kind === "user-rejected") return null; // silent
|
|
34
|
+
* if (error?.kind === "contract-revert") return <ShowReason reason={error.reason} />;
|
|
35
|
+
* if (error?.kind === "api") return <ApiError status={error.status} code={error.code} />;
|
|
36
|
+
* if (error) return <GenericError message={error.message} />;
|
|
37
|
+
*/
|
|
38
|
+
export declare class SymmioRequestError extends Error {
|
|
39
|
+
readonly name = "SymmioRequestError";
|
|
40
|
+
/** Classification used by the UI to branch on this failure. */
|
|
41
|
+
readonly kind: SymmioNormalizedErrorKind;
|
|
42
|
+
/** SDK error code (e.g., "FETCH_MARKETS_FAILED"). */
|
|
43
|
+
readonly code?: string;
|
|
44
|
+
/** HTTP status code when `kind === "api"`. */
|
|
45
|
+
readonly status?: number;
|
|
46
|
+
/** Raw response body returned by the server when `kind === "api"`. */
|
|
47
|
+
readonly responseData?: unknown;
|
|
48
|
+
/** Solidity revert reason when `kind === "contract-revert"`. */
|
|
49
|
+
readonly reason?: string;
|
|
50
|
+
/** viem's short message when `kind === "rpc"`. */
|
|
51
|
+
readonly shortMessage?: string;
|
|
52
|
+
constructor(options: SymmioRequestErrorOptions);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=symmio-request-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symmio-request-error.d.ts","sourceRoot":"","sources":["../../src/errors/symmio-request-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAkB,IAAI,wBAAwB;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC,gEAAgE;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,yBAAyB;CAS/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/errors/symmio-request-error.ts
|
|
2
|
+
var e = class extends Error {
|
|
3
|
+
name = "SymmioRequestError";
|
|
4
|
+
kind;
|
|
5
|
+
code;
|
|
6
|
+
status;
|
|
7
|
+
responseData;
|
|
8
|
+
reason;
|
|
9
|
+
shortMessage;
|
|
10
|
+
constructor(e) {
|
|
11
|
+
super(e.message, { cause: e.cause }), this.kind = e.kind, this.code = e.code, this.status = e.status, this.responseData = e.responseData, this.reason = e.reason, this.shortMessage = e.shortMessage;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as SymmioRequestError };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=symmio-request-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"symmio-request-error.js","names":[],"sources":["../../src/errors/symmio-request-error.ts"],"sourcesContent":["import type { SymmioNormalizedErrorKind } from \"./types\";\n\n/**\n * Options accepted by the {@link SymmioRequestError} constructor. Carries\n * the discriminator-specific fields the UI cares about.\n */\nexport interface SymmioRequestErrorOptions {\n kind: SymmioNormalizedErrorKind;\n message: string;\n /** SDK error code (e.g., \"FETCH_MARKETS_FAILED\", \"UNSUPPORTED_CHAIN\"). */\n code?: string;\n /** HTTP status code. Only meaningful when `kind === \"api\"`. */\n status?: number;\n /**\n * Raw response body returned by the server. Only meaningful when `kind === \"api\"`.\n * Forwarded verbatim from `SymmApiError.responseData` so the UI can render the\n * server's structured error fields without unwrapping `cause`.\n */\n responseData?: unknown;\n /** Solidity revert reason. Only meaningful when `kind === \"contract-revert\"`. */\n reason?: string;\n /** viem's human-readable short message. Only meaningful when `kind === \"rpc\"`. */\n shortMessage?: string;\n /** The original underlying error, kept for debugging. */\n cause?: unknown;\n}\n\n/**\n * The single error class every SYMMIO React hook throws when a read or write\n * fails. Carries a discriminator (`kind`) the UI can switch on without\n * inspecting viem's internal error hierarchy.\n *\n * @example\n * const { error } = useUserSubAccounts({ user });\n * if (error?.kind === \"user-rejected\") return null; // silent\n * if (error?.kind === \"contract-revert\") return <ShowReason reason={error.reason} />;\n * if (error?.kind === \"api\") return <ApiError status={error.status} code={error.code} />;\n * if (error) return <GenericError message={error.message} />;\n */\nexport class SymmioRequestError extends Error {\n override readonly name = \"SymmioRequestError\";\n /** Classification used by the UI to branch on this failure. */\n readonly kind: SymmioNormalizedErrorKind;\n /** SDK error code (e.g., \"FETCH_MARKETS_FAILED\"). */\n readonly code?: string;\n /** HTTP status code when `kind === \"api\"`. */\n readonly status?: number;\n /** Raw response body returned by the server when `kind === \"api\"`. */\n readonly responseData?: unknown;\n /** Solidity revert reason when `kind === \"contract-revert\"`. */\n readonly reason?: string;\n /** viem's short message when `kind === \"rpc\"`. */\n readonly shortMessage?: string;\n\n constructor(options: SymmioRequestErrorOptions) {\n super(options.message, { cause: options.cause });\n this.kind = options.kind;\n this.code = options.code;\n this.status = options.status;\n this.responseData = options.responseData;\n this.reason = options.reason;\n this.shortMessage = options.shortMessage;\n }\n}\n"],"mappings":";AAuCA,IAAa,IAAb,cAAwC,MAAM;CAC5C,OAAyB;CAEzB;CAEA;CAEA;CAEA;CAEA;CAEA;CAEA,YAAY,GAAoC;EAO9C,AANA,MAAM,EAAQ,SAAS,EAAE,OAAO,EAAQ,MAAM,CAAC,GAC/C,KAAK,OAAO,EAAQ,MACpB,KAAK,OAAO,EAAQ,MACpB,KAAK,SAAS,EAAQ,QACtB,KAAK,eAAe,EAAQ,cAC5B,KAAK,SAAS,EAAQ,QACtB,KAAK,eAAe,EAAQ;CAC9B;AACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classification of a normalized SYMMIO SDK error. The discriminator the UI
|
|
3
|
+
* switches on to decide how to render a failed read or write.
|
|
4
|
+
*
|
|
5
|
+
* - `user-rejected` — the connected wallet popup was dismissed by the user.
|
|
6
|
+
* UIs typically silence this case (no toast, no banner).
|
|
7
|
+
* - `contract-revert` — the on-chain call reverted. `reason` carries the
|
|
8
|
+
* Solidity revert string when one was emitted.
|
|
9
|
+
* - `insufficient-funds` — the signing EOA had not enough native gas to send
|
|
10
|
+
* the transaction. Distinct from `contract-revert` because there is no
|
|
11
|
+
* revert reason and the remediation is "top up the wallet".
|
|
12
|
+
* - `rpc` — a transport-layer failure (network, RPC node unreachable, bad
|
|
13
|
+
* response). `shortMessage` carries viem's human-readable form.
|
|
14
|
+
* - `api` — an HTTP/REST API failure (solver, price service, etc). `status`
|
|
15
|
+
* carries the HTTP status code, `code` carries the SDK error code.
|
|
16
|
+
* - `sdk` — an SDK-level precondition failed: unknown chain, missing config,
|
|
17
|
+
* missing wallet, etc. `code` carries the SDK error code.
|
|
18
|
+
* - `unknown` — fell through every classifier. Treat as a real bug to fix.
|
|
19
|
+
*/
|
|
20
|
+
export type SymmioNormalizedErrorKind = "user-rejected" | "contract-revert" | "insufficient-funds" | "rpc" | "api" | "sdk" | "unknown";
|
|
21
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/errors/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,yBAAyB,GACjC,eAAe,GACf,iBAAiB,GACjB,oBAAoB,GACpB,KAAK,GACL,KAAK,GACL,KAAK,GACL,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fees/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, GetFeeForUserOptions, GetFeeForUserReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useFeeForUser}: the core query options (user, symbol id,
|
|
6
|
+
* optional affiliate, chain id, TanStack `query` overrides) plus an optional
|
|
7
|
+
* `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseFeeForUserParameters = GetFeeForUserOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useFeeForUser}. */
|
|
11
|
+
export type UseFeeForUserReturnType = UseQueryResult<GetFeeForUserReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read SYMMIO fee settings for a user/account and symbol id.
|
|
14
|
+
*
|
|
15
|
+
* Omitted `affiliate` resolves through the chain config. Omitted `chainId`
|
|
16
|
+
* resolves through the connected SYMMIO chain. Errors are normalized to
|
|
17
|
+
* {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data } = useFeeForUser({ user, symbolId: 1n });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useFeeForUser(parameters: UseFeeForUserParameters): UseFeeForUserReturnType;
|
|
25
|
+
//# sourceMappingURL=use-fee-for-user.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fee-for-user.d.ts","sourceRoot":"","sources":["../../src/fees/use-fee-for-user.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC7B,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,uBAAuB,GAAG,oBAAoB,GAAG,eAAe,CAAC;AAE7E,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAAC,uBAAuB,EAAE,kBAAkB,CAAC,CAAC;AAElG;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,uBAAuB,GAAG,uBAAuB,CAkB1F"}
|
|
@@ -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 { getFeeForUserQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/fees/use-fee-for-user.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 useFeeForUser };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-fee-for-user.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-fee-for-user.js","names":[],"sources":["../../src/fees/use-fee-for-user.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getFeeForUserQueryOptions,\n type ConfigParameter,\n type GetFeeForUserOptions,\n type GetFeeForUserReturnType,\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 useFeeForUser}: the core query options (user, symbol id,\n * optional affiliate, chain id, TanStack `query` overrides) plus an optional\n * `config`.\n */\nexport type UseFeeForUserParameters = GetFeeForUserOptions & ConfigParameter;\n\n/** Return type of {@link useFeeForUser}. */\nexport type UseFeeForUserReturnType = UseQueryResult<GetFeeForUserReturnType, SymmioRequestError>;\n\n/**\n * Read SYMMIO fee settings for a user/account and symbol id.\n *\n * Omitted `affiliate` resolves through the chain config. Omitted `chainId`\n * resolves through the connected SYMMIO chain. Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useFeeForUser({ user, symbolId: 1n });\n * ```\n */\nexport function useFeeForUser(parameters: UseFeeForUserParameters): UseFeeForUserReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getFeeForUserQueryOptions(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 UseFeeForUserReturnType;\n}\n"],"mappings":";;;;;;;AAoCA,SAAgB,EAAc,GAA8D;CAC1F,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA0B,GAAQ;EAChD,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"}
|