@symmio/trading-core 4.3.0 → 4.5.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/dist/candles/adapters/tradingview/map-resolution.d.ts.map +1 -1
- package/dist/candles/adapters/tradingview/map-resolution.js +2 -0
- package/dist/candles/adapters/tradingview/map-resolution.js.map +1 -1
- package/dist/candles/adapters/tradingview/to-tradingview-datafeed.d.ts.map +1 -1
- package/dist/candles/adapters/tradingview/to-tradingview-datafeed.js +6 -4
- package/dist/candles/adapters/tradingview/to-tradingview-datafeed.js.map +1 -1
- package/dist/candles/history-query.d.ts +67 -0
- package/dist/candles/history-query.d.ts.map +1 -0
- package/dist/candles/history-query.js +80 -0
- package/dist/candles/history-query.js.map +1 -0
- package/dist/candles/index.d.ts +3 -0
- package/dist/candles/index.d.ts.map +1 -1
- package/dist/candles/merge-candle-pages.d.ts +5 -0
- package/dist/candles/merge-candle-pages.d.ts.map +1 -0
- package/dist/candles/merge-candle-pages.js +13 -0
- package/dist/candles/merge-candle-pages.js.map +1 -0
- package/dist/candles/query.d.ts +5 -1
- package/dist/candles/query.d.ts.map +1 -1
- package/dist/candles/query.js +3 -2
- package/dist/candles/query.js.map +1 -1
- package/dist/candles/refresh-candle-history.d.ts +31 -0
- package/dist/candles/refresh-candle-history.d.ts.map +1 -0
- package/dist/candles/refresh-candle-history.js +91 -0
- package/dist/candles/refresh-candle-history.js.map +1 -0
- package/dist/candles/resolution.d.ts +3 -3
- package/dist/candles/resolution.d.ts.map +1 -1
- package/dist/candles/resolution.js +1 -0
- package/dist/candles/resolution.js.map +1 -1
- package/dist/candles/sources/binance/create-binance-candle-source.d.ts.map +1 -1
- package/dist/candles/sources/binance/create-binance-candle-source.js +3 -1
- package/dist/candles/sources/binance/create-binance-candle-source.js.map +1 -1
- package/dist/candles/sources/lowcap/create-lowcap-candle-source.d.ts +35 -0
- package/dist/candles/sources/lowcap/create-lowcap-candle-source.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/create-lowcap-candle-source.js +104 -0
- package/dist/candles/sources/lowcap/create-lowcap-candle-source.js.map +1 -0
- package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.d.ts +4 -0
- package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.js +40 -0
- package/dist/candles/sources/lowcap/create-lowcap-symbol-loader.js.map +1 -0
- package/dist/candles/sources/lowcap/get-lowcap-candles.d.ts +12 -0
- package/dist/candles/sources/lowcap/get-lowcap-candles.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/get-lowcap-candles.js +48 -0
- package/dist/candles/sources/lowcap/get-lowcap-candles.js.map +1 -0
- package/dist/candles/sources/lowcap/index.d.ts +2 -0
- package/dist/candles/sources/lowcap/index.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/lowcap-candle-time.d.ts +9 -0
- package/dist/candles/sources/lowcap/lowcap-candle-time.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/lowcap-candle-time.js +24 -0
- package/dist/candles/sources/lowcap/lowcap-candle-time.js.map +1 -0
- package/dist/candles/sources/lowcap/map-resolution.d.ts +16 -0
- package/dist/candles/sources/lowcap/map-resolution.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/map-resolution.js +26 -0
- package/dist/candles/sources/lowcap/map-resolution.js.map +1 -0
- package/dist/candles/sources/lowcap/resolve-lowcap-symbol.d.ts +12 -0
- package/dist/candles/sources/lowcap/resolve-lowcap-symbol.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/resolve-lowcap-symbol.js +8 -0
- package/dist/candles/sources/lowcap/resolve-lowcap-symbol.js.map +1 -0
- package/dist/candles/sources/lowcap/watch-lowcap-candles.d.ts +19 -0
- package/dist/candles/sources/lowcap/watch-lowcap-candles.d.ts.map +1 -0
- package/dist/candles/sources/lowcap/watch-lowcap-candles.js +104 -0
- package/dist/candles/sources/lowcap/watch-lowcap-candles.js.map +1 -0
- package/dist/candles/types.d.ts +32 -16
- package/dist/candles/types.d.ts.map +1 -1
- package/dist/core/chains/registry.d.ts.map +1 -1
- package/dist/core/chains/registry.js +4 -5
- package/dist/core/chains/registry.js.map +1 -1
- package/dist/core/chains/types.d.ts +36 -1
- package/dist/core/chains/types.d.ts.map +1 -1
- package/dist/core/chains/types.js.map +1 -1
- package/dist/core/config/merge-chain-config.js +6 -3
- package/dist/core/config/merge-chain-config.js.map +1 -1
- package/dist/gasless/batch/calls.d.ts +21 -7
- package/dist/gasless/batch/calls.d.ts.map +1 -1
- package/dist/gasless/batch/calls.js +17 -16
- package/dist/gasless/batch/calls.js.map +1 -1
- package/dist/gasless/batch/resolve-gasless-batch.d.ts +10 -1
- package/dist/gasless/batch/resolve-gasless-batch.d.ts.map +1 -1
- package/dist/gasless/batch/resolve-gasless-batch.js +17 -15
- package/dist/gasless/batch/resolve-gasless-batch.js.map +1 -1
- package/dist/gasless/classify-gasless-failure.d.ts +3 -1
- package/dist/gasless/classify-gasless-failure.d.ts.map +1 -1
- package/dist/gasless/classify-gasless-failure.js +10 -10
- package/dist/gasless/classify-gasless-failure.js.map +1 -1
- package/dist/gasless/confirm-gasless-request/confirm-gasless-request.js +5 -5
- package/dist/gasless/constants.d.ts +21 -0
- package/dist/gasless/constants.d.ts.map +1 -1
- package/dist/gasless/constants.js +2 -2
- package/dist/gasless/constants.js.map +1 -1
- package/dist/gasless/delegation-preflight.js +10 -10
- package/dist/gasless/deployment-key.d.ts +39 -0
- package/dist/gasless/deployment-key.d.ts.map +1 -0
- package/dist/gasless/deployment-key.js +22 -0
- package/dist/gasless/deployment-key.js.map +1 -0
- package/dist/gasless/dispatch/attempt-start.d.ts +31 -0
- package/dist/gasless/dispatch/attempt-start.d.ts.map +1 -0
- package/dist/gasless/dispatch/attempt-start.js +14 -0
- package/dist/gasless/dispatch/attempt-start.js.map +1 -0
- package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts +4 -43
- package/dist/gasless/dispatch/maybe-relay-as-gasless.d.ts.map +1 -1
- package/dist/gasless/dispatch/maybe-relay-as-gasless.js +24 -182
- package/dist/gasless/dispatch/maybe-relay-as-gasless.js.map +1 -1
- package/dist/gasless/dispatch/resolve-gasless-write.d.ts +40 -0
- package/dist/gasless/dispatch/resolve-gasless-write.d.ts.map +1 -0
- package/dist/gasless/dispatch/resolve-gasless-write.js +48 -0
- package/dist/gasless/dispatch/resolve-gasless-write.js.map +1 -0
- package/dist/gasless/dispatch/submit-gasless-write.d.ts +11 -0
- package/dist/gasless/dispatch/submit-gasless-write.d.ts.map +1 -0
- package/dist/gasless/dispatch/submit-gasless-write.js +180 -0
- package/dist/gasless/dispatch/submit-gasless-write.js.map +1 -0
- package/dist/gasless/dispatch/types.d.ts +42 -0
- package/dist/gasless/dispatch/types.d.ts.map +1 -0
- package/dist/gasless/effective-instant-selectors.d.ts +11 -0
- package/dist/gasless/effective-instant-selectors.d.ts.map +1 -0
- package/dist/gasless/effective-instant-selectors.js +25 -0
- package/dist/gasless/effective-instant-selectors.js.map +1 -0
- package/dist/gasless/fallback.d.ts +43 -0
- package/dist/gasless/fallback.d.ts.map +1 -1
- package/dist/gasless/fallback.js +27 -17
- package/dist/gasless/fallback.js.map +1 -1
- package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts +13 -5
- package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.d.ts.map +1 -1
- package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js +88 -81
- package/dist/gasless/gasless-wallet-execute/gasless-wallet-execute.js.map +1 -1
- package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.d.ts +20 -0
- package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.d.ts.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.js +29 -0
- package/dist/gasless/get-gasless-batch-funding/batch-fee-approvals.js.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.d.ts +43 -0
- package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.d.ts.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.js +96 -0
- package/dist/gasless/get-gasless-batch-funding/get-gasless-batch-funding.js.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/index.d.ts +4 -0
- package/dist/gasless/get-gasless-batch-funding/index.d.ts.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/query.d.ts +31 -0
- package/dist/gasless/get-gasless-batch-funding/query.d.ts.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/query.js +22 -0
- package/dist/gasless/get-gasless-batch-funding/query.js.map +1 -0
- package/dist/gasless/get-gasless-batch-funding/types.d.ts +80 -0
- package/dist/gasless/get-gasless-batch-funding/types.d.ts.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.d.ts +33 -0
- package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.d.ts.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.js +31 -0
- package/dist/gasless/get-gasless-margin-funding/get-gasless-margin-funding.js.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/index.d.ts +4 -0
- package/dist/gasless/get-gasless-margin-funding/index.d.ts.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/query.d.ts +31 -0
- package/dist/gasless/get-gasless-margin-funding/query.d.ts.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/query.js +22 -0
- package/dist/gasless/get-gasless-margin-funding/query.js.map +1 -0
- package/dist/gasless/get-gasless-margin-funding/types.d.ts +27 -0
- package/dist/gasless/get-gasless-margin-funding/types.d.ts.map +1 -0
- package/dist/gasless/get-session-key-selectors.d.ts +18 -4
- package/dist/gasless/get-session-key-selectors.d.ts.map +1 -1
- package/dist/gasless/get-session-key-selectors.js +20 -12
- package/dist/gasless/get-session-key-selectors.js.map +1 -1
- package/dist/gasless/http.d.ts +7 -7
- package/dist/gasless/http.d.ts.map +1 -1
- package/dist/gasless/http.js +70 -72
- package/dist/gasless/http.js.map +1 -1
- package/dist/gasless/idempotency-key.d.ts +33 -0
- package/dist/gasless/idempotency-key.d.ts.map +1 -0
- package/dist/gasless/idempotency-key.js +15 -0
- package/dist/gasless/idempotency-key.js.map +1 -0
- package/dist/gasless/index.d.ts +4 -0
- package/dist/gasless/index.d.ts.map +1 -1
- package/dist/gasless/nonce-lock.d.ts +55 -17
- package/dist/gasless/nonce-lock.d.ts.map +1 -1
- package/dist/gasless/nonce-lock.js +53 -26
- package/dist/gasless/nonce-lock.js.map +1 -1
- package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts +30 -0
- package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.d.ts.map +1 -0
- package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js +67 -0
- package/dist/gasless/relay-gasless-batch/preflight-batch-delegations.js.map +1 -0
- package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts +30 -9
- package/dist/gasless/relay-gasless-batch/relay-gasless-batch.d.ts.map +1 -1
- package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js +99 -102
- package/dist/gasless/relay-gasless-batch/relay-gasless-batch.js.map +1 -1
- package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts +18 -0
- package/dist/gasless/relay-gasless-batch/resolve-batch-signers.d.ts.map +1 -0
- package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js +17 -0
- package/dist/gasless/relay-gasless-batch/resolve-batch-signers.js.map +1 -0
- package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts +8 -5
- package/dist/gasless/relay-gasless-batch/sign-gasless-batch.d.ts.map +1 -1
- package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js +22 -16
- package/dist/gasless/relay-gasless-batch/sign-gasless-batch.js.map +1 -1
- package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts +13 -7
- package/dist/gasless/relay-grant-delegation/relay-grant-delegation.d.ts.map +1 -1
- package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js +46 -36
- package/dist/gasless/relay-grant-delegation/relay-grant-delegation.js.map +1 -1
- package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts +14 -15
- package/dist/gasless/relay-instant-operations/relay-instant-operations.d.ts.map +1 -1
- package/dist/gasless/relay-instant-operations/relay-instant-operations.js +12 -11
- package/dist/gasless/relay-instant-operations/relay-instant-operations.js.map +1 -1
- package/dist/gasless/relayable-writes.d.ts.map +1 -1
- package/dist/gasless/relayable-writes.js +28 -0
- package/dist/gasless/relayable-writes.js.map +1 -1
- package/dist/gasless/request-headers.d.ts +7 -0
- package/dist/gasless/request-headers.d.ts.map +1 -0
- package/dist/gasless/request-headers.js +34 -0
- package/dist/gasless/request-headers.js.map +1 -0
- package/dist/gasless/resolve-wallet-identities.js +4 -4
- package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts +11 -4
- package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.d.ts.map +1 -1
- package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js +2 -2
- package/dist/gasless/resubmit-gasless-request/resubmit-gasless-request.js.map +1 -1
- package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts +10 -14
- package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.d.ts.map +1 -1
- package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js +3 -2
- package/dist/gasless/settle-gasless-deposit-existing-account/settle-gasless-deposit-existing-account.js.map +1 -1
- package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts +15 -15
- package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.d.ts.map +1 -1
- package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js +13 -12
- package/dist/gasless/settle-gasless-deposit-new-account/settle-gasless-deposit-new-account.js.map +1 -1
- package/dist/gasless/unconfirmed-submit.d.ts +12 -8
- package/dist/gasless/unconfirmed-submit.d.ts.map +1 -1
- package/dist/gasless/unconfirmed-submit.js +1 -1
- package/dist/gasless/unconfirmed-submit.js.map +1 -1
- package/dist/index.d.ts +27 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +680 -615
- package/dist/pools/listing-config/to-listing-config.d.ts +10 -3
- package/dist/pools/listing-config/to-listing-config.d.ts.map +1 -1
- package/dist/pools/listing-config/to-listing-config.js +5 -1
- package/dist/pools/listing-config/to-listing-config.js.map +1 -1
- package/dist/pools/types/generated/listing-backend.d.ts +266 -1
- package/dist/pools/types/generated/listing-backend.d.ts.map +1 -1
- package/dist/pools/types/generated/listing-backend.js.map +1 -1
- package/dist/pools/types.d.ts +7 -0
- package/dist/pools/types.d.ts.map +1 -1
- package/dist/pools/types.js.map +1 -1
- package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.d.ts +39 -0
- package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.d.ts.map +1 -0
- package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.js +43 -0
- package/dist/price-service/enigma/ohlcv/fetch-enigma-ohlcv.js.map +1 -0
- package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.d.ts +67 -0
- package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.d.ts.map +1 -0
- package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.js +15 -0
- package/dist/price-service/enigma/ohlcv/generated/enigma-price-service-ohlcv.js.map +1 -0
- package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.d.ts +21 -0
- package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.d.ts.map +1 -0
- package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.js +36 -0
- package/dist/price-service/enigma/ohlcv/parse-enigma-ohlcv.js.map +1 -0
- package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.d.ts +2 -0
- package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.d.ts.map +1 -1
- package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.js +12 -8
- package/dist/price-service/enigma/symbols-info/get-enigma-price-service-symbols-info.js.map +1 -1
- package/dist/shared/errors/symm-error.js +3 -3
- package/dist/shared/types/properties.d.ts +45 -8
- package/dist/shared/types/properties.d.ts.map +1 -1
- package/dist/solvers/capabilities.d.ts.map +1 -1
- package/dist/solvers/capabilities.js +4 -2
- package/dist/solvers/capabilities.js.map +1 -1
- package/dist/solvers/estimated-price/get-estimated-price.js +6 -6
- package/dist/solvers/force-close/force-close-auto.d.ts.map +1 -1
- package/dist/solvers/force-close/force-close-auto.js +70 -69
- package/dist/solvers/force-close/force-close-auto.js.map +1 -1
- package/dist/solvers/get-error-message/get-error-message.js +4 -4
- package/dist/solvers/get-party-a-upnl/get-party-a-upnl.js +4 -4
- package/dist/solvers/get-solver-balance-info/get-solver-balance-info.js +4 -4
- package/dist/solvers/get-solver-info/get-solver-info.d.ts +5 -2
- package/dist/solvers/get-solver-info/get-solver-info.d.ts.map +1 -1
- package/dist/solvers/get-solver-info/get-solver-info.js +14 -12
- package/dist/solvers/get-solver-info/get-solver-info.js.map +1 -1
- package/dist/solvers/get-solver-info/parse-timelock-info.d.ts +5 -0
- package/dist/solvers/get-solver-info/parse-timelock-info.d.ts.map +1 -0
- package/dist/solvers/get-solver-info/parse-timelock-info.js +27 -0
- package/dist/solvers/get-solver-info/parse-timelock-info.js.map +1 -0
- package/dist/solvers/get-solver-open-interest/get-solver-open-interest.js +4 -4
- package/dist/solvers/get-solver-price-range/get-solver-price-range.js +4 -4
- package/dist/solvers/get-solver-readiness/get-solver-readiness.js +4 -4
- package/dist/solvers/instant-open/get-instant-opens/adapters/enigma-instant-opens.js +17 -17
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts +8 -7
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js +43 -39
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts +16 -0
- package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.d.ts.map +1 -0
- package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js +92 -0
- package/dist/solvers/instant-open/instant-open/adapters/enigma-margin-timelock.js.map +1 -0
- package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.js +1 -1
- package/dist/solvers/instant-open/instant-open/index.d.ts +2 -0
- package/dist/solvers/instant-open/instant-open/index.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/instant-open.d.ts +22 -6
- package/dist/solvers/instant-open/instant-open/instant-open.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/instant-open.js +35 -27
- package/dist/solvers/instant-open/instant-open/instant-open.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts +12 -0
- package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.d.ts.map +1 -0
- package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js +49 -0
- package/dist/solvers/instant-open/instant-open/prepared/submit-prepared-instant-open.js.map +1 -0
- package/dist/solvers/instant-open/instant-open/prepared/types.d.ts +20 -0
- package/dist/solvers/instant-open/instant-open/prepared/types.d.ts.map +1 -0
- package/dist/solvers/instant-open/instant-open/types.d.ts +5 -4
- package/dist/solvers/instant-open/instant-open/types.d.ts.map +1 -1
- package/dist/solvers/instant-open/shared/hedger-api.d.ts.map +1 -1
- package/dist/solvers/instant-open/shared/hedger-api.js +38 -26
- package/dist/solvers/instant-open/shared/hedger-api.js.map +1 -1
- package/dist/solvers/markets/adapters/enigma-markets.js +34 -34
- package/dist/solvers/notional-cap/get-notional-cap-page.js +4 -4
- package/dist/solvers/revenue/get-solver-revenue.js +10 -10
- package/dist/solvers/revenue-records/get-revenue-records.js +11 -11
- package/dist/solvers/symbols/get-symbols.js +13 -13
- package/dist/solvers/trade-volume/get-trade-volume.js +10 -10
- package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts +46 -0
- package/dist/symmio-contracts/abi/v0.8.6/instant-layer.d.ts.map +1 -1
- package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js +53 -0
- package/dist/symmio-contracts/abi/v0.8.6/instant-layer.js.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/actions/add-margin.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/add-margin.js +41 -27
- package/dist/symmio-contracts/account-layer/actions/add-margin.js.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts +23 -9
- package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js +15 -36
- package/dist/symmio-contracts/account-layer/actions/create-sub-accounts.js.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/actions/delete-sub-account.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js +40 -26
- package/dist/symmio-contracts/account-layer/actions/delete-sub-account.js.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts +1 -1
- package/dist/symmio-contracts/account-layer/actions/edit-account-name.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/edit-account-name.js +18 -37
- package/dist/symmio-contracts/account-layer/actions/edit-account-name.js.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts +46 -0
- package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js +20 -0
- package/dist/symmio-contracts/account-layer/actions/get-active-virtual-account-by-key.js.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts +31 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js +15 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-count-of-sub-account.js.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts +54 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js +26 -0
- package/dist/symmio-contracts/account-layer/actions/get-virtual-accounts-of-sub-account.js.map +1 -0
- package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/actions/remove-margin.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/actions/remove-margin.js +50 -32
- package/dist/symmio-contracts/account-layer/actions/remove-margin.js.map +1 -1
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js +10 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/cancel-timelock-op.js.map +1 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts +9 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js +13 -0
- package/dist/symmio-contracts/account-layer/cancel-timelock-op/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js +10 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/clear-timelocks.js.map +1 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts +9 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/query.js +13 -0
- package/dist/symmio-contracts/account-layer/clear-timelocks/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js +9 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/execute-timelock-op.js.map +1 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts +9 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js +13 -0
- package/dist/symmio-contracts/account-layer/execute-timelock-op/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js +16 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/get-min-timelock-delay.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/get-min-timelock-delay/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js +22 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/get-selector-timelock.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts +22 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js +21 -0
- package/dist/symmio-contracts/account-layer/get-selector-timelock/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js +22 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/get-timelock-schedule.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts +13 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js +17 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/get-timelock-schedule-grace-period.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-grace-period/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js +67 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/get-timelock-schedule-state.js.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts +21 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js +21 -0
- package/dist/symmio-contracts/account-layer/get-timelock-schedule-state/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts +15 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js +17 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/hash-timelock-approval.js.map +1 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/hash-timelock-approval/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/hook-metadata.d.ts +47 -0
- package/dist/symmio-contracts/account-layer/hook-metadata.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/hook-metadata.js +30 -0
- package/dist/symmio-contracts/account-layer/hook-metadata.js.map +1 -0
- package/dist/symmio-contracts/account-layer/index.d.ts +21 -0
- package/dist/symmio-contracts/account-layer/index.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts +14 -0
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js +17 -0
- package/dist/symmio-contracts/account-layer/is-timelock-approval-used/is-timelock-approval-used.js.map +1 -0
- package/dist/symmio-contracts/account-layer/query/generate-account-manager-address.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-account-balance-info.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-account-balance-of.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts +43 -0
- package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js +31 -0
- package/dist/symmio-contracts/account-layer/query/get-active-virtual-account-by-key.js.map +1 -0
- package/dist/symmio-contracts/account-layer/query/get-affiliate-state.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-sub-account-virtual-nonce.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-sub-accounts-count-of-user.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts-addresses.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-user-sub-accounts.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-addresses-of-sub-account.js +6 -6
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts +39 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js +29 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-count-of-sub-account.js.map +1 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts +39 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js +31 -0
- package/dist/symmio-contracts/account-layer/query/get-virtual-accounts-of-sub-account.js.map +1 -0
- package/dist/symmio-contracts/account-layer/query/predict-next-virtual-account.js +6 -6
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts +2 -0
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts +19 -0
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js +10 -0
- package/dist/symmio-contracts/account-layer/resolve-timelock-root-account/resolve-timelock-root-account.js.map +1 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts +9 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js +13 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts +12 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js +10 -0
- package/dist/symmio-contracts/account-layer/schedule-timelock-op/schedule-timelock-op.js.map +1 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts +3 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/index.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts +9 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/query.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/query.js +13 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/query.js.map +1 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts +13 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js +18 -0
- package/dist/symmio-contracts/account-layer/setup-timelocks/setup-timelocks.js.map +1 -0
- package/dist/symmio-contracts/account-layer/timelock-selector.d.ts +4 -0
- package/dist/symmio-contracts/account-layer/timelock-selector.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/timelock-selector.js +9 -0
- package/dist/symmio-contracts/account-layer/timelock-selector.js.map +1 -0
- package/dist/symmio-contracts/account-layer/timelock-test.d.ts +7 -0
- package/dist/symmio-contracts/account-layer/timelock-test.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/timelock-types.d.ts +66 -0
- package/dist/symmio-contracts/account-layer/timelock-types.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/types.d.ts +32 -2
- package/dist/symmio-contracts/account-layer/types.d.ts.map +1 -1
- package/dist/symmio-contracts/account-layer/types.js.map +1 -1
- package/dist/symmio-contracts/account-layer/write-timelock.d.ts +10 -0
- package/dist/symmio-contracts/account-layer/write-timelock.d.ts.map +1 -0
- package/dist/symmio-contracts/account-layer/write-timelock.js +51 -0
- package/dist/symmio-contracts/account-layer/write-timelock.js.map +1 -0
- package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts +4 -1
- package/dist/symmio-contracts/instant-layer/actions/grant-delegation.d.ts.map +1 -1
- package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js +42 -38
- package/dist/symmio-contracts/instant-layer/actions/grant-delegation.js.map +1 -1
- package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts +75 -0
- package/dist/symmio-contracts/instant-layer/actions/grant-delegations.d.ts.map +1 -0
- package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js +46 -0
- package/dist/symmio-contracts/instant-layer/actions/grant-delegations.js.map +1 -0
- package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts +32 -0
- package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.d.ts.map +1 -0
- package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js +18 -0
- package/dist/symmio-contracts/instant-layer/actions/simulate-grant-delegations.js.map +1 -0
- package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts +33 -0
- package/dist/symmio-contracts/instant-layer/grant-delegations-input.d.ts.map +1 -0
- package/dist/symmio-contracts/instant-layer/grant-delegations-input.js +18 -0
- package/dist/symmio-contracts/instant-layer/grant-delegations-input.js.map +1 -0
- package/dist/symmio-contracts/instant-layer/index.d.ts +4 -0
- package/dist/symmio-contracts/instant-layer/index.d.ts.map +1 -1
- package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts +22 -0
- package/dist/symmio-contracts/instant-layer/query/grant-delegations.d.ts.map +1 -0
- package/dist/symmio-contracts/instant-layer/query/grant-delegations.js +12 -0
- package/dist/symmio-contracts/instant-layer/query/grant-delegations.js.map +1 -0
- package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts +19 -0
- package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.d.ts.map +1 -0
- package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js +12 -0
- package/dist/symmio-contracts/instant-layer/query/simulate-grant-delegations.js.map +1 -0
- package/dist/symmio-contracts/symmio/actions/allocate.d.ts +3 -0
- package/dist/symmio-contracts/symmio/actions/allocate.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/allocate.js +22 -16
- package/dist/symmio-contracts/symmio/actions/allocate.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts +74 -0
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js +36 -0
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee-allowance.js.map +1 -0
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts +3 -0
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js +32 -29
- package/dist/symmio-contracts/symmio/actions/approve-operational-fee.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts +3 -0
- package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js +37 -28
- package/dist/symmio-contracts/symmio/actions/deallocate-and-initiate-withdraw.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/deallocate.d.ts +3 -0
- package/dist/symmio-contracts/symmio/actions/deallocate.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/deallocate.js +30 -20
- package/dist/symmio-contracts/symmio/actions/deallocate.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts +5 -0
- package/dist/symmio-contracts/symmio/actions/initiate-withdraw.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js +31 -18
- package/dist/symmio-contracts/symmio/actions/initiate-withdraw.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts +4 -0
- package/dist/symmio-contracts/symmio/actions/withdraw-auto.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/withdraw-auto.js +30 -25
- package/dist/symmio-contracts/symmio/actions/withdraw-auto.js.map +1 -1
- package/dist/symmio-contracts/symmio/actions/withdraw.d.ts +4 -0
- package/dist/symmio-contracts/symmio/actions/withdraw.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/actions/withdraw.js +12 -8
- package/dist/symmio-contracts/symmio/actions/withdraw.js.map +1 -1
- package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts +48 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js +33 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/execute-account-calls.js.map +1 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts +23 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/query.js +12 -0
- package/dist/symmio-contracts/symmio/execute-account-calls/query.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts +22 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js +14 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/get-deallocate-debounce-time.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts +34 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js +21 -0
- package/dist/symmio-contracts/symmio/get-deallocate-debounce-time/query.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts +34 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js +35 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/get-pending-withdraw-requests-batch.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts +15 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js +20 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/limit-concurrency.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts +22 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js +30 -0
- package/dist/symmio-contracts/symmio/get-pending-withdraw-requests-batch/query.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts +30 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js +15 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/get-withdraw-cooldown-of.js.map +1 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts +3 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/index.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts +38 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js +24 -0
- package/dist/symmio-contracts/symmio/get-withdraw-cooldown-of/query.js.map +1 -0
- package/dist/symmio-contracts/symmio/index.d.ts +6 -0
- package/dist/symmio-contracts/symmio/index.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/internal/call-as-sub-account.d.ts.map +1 -1
- package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js +35 -34
- package/dist/symmio-contracts/symmio/internal/call-as-sub-account.js.map +1 -1
- package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts +18 -0
- package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js +14 -0
- package/dist/symmio-contracts/symmio/internal/resolve-default-operational-fee-charger.js.map +1 -0
- package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts +18 -0
- package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.d.ts.map +1 -0
- package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js +12 -0
- package/dist/symmio-contracts/symmio/query/approve-operational-fee-allowance.js.map +1 -0
- package/dist/symmio-subgraph/executeSubgraphRequest.js +3 -3
- package/dist/timelock/approval.d.ts +142 -0
- package/dist/timelock/approval.d.ts.map +1 -0
- package/dist/timelock/approval.js +176 -0
- package/dist/timelock/approval.js.map +1 -0
- package/dist/timelock/attempt-outcome.d.ts +37 -0
- package/dist/timelock/attempt-outcome.d.ts.map +1 -0
- package/dist/timelock/attempt-outcome.js +70 -0
- package/dist/timelock/attempt-outcome.js.map +1 -0
- package/dist/timelock/confirm-write.d.ts +5 -0
- package/dist/timelock/confirm-write.d.ts.map +1 -0
- package/dist/timelock/confirm-write.js +18 -0
- package/dist/timelock/confirm-write.js.map +1 -0
- package/dist/timelock/early-withdraw/early-withdraw.d.ts +60 -0
- package/dist/timelock/early-withdraw/early-withdraw.d.ts.map +1 -0
- package/dist/timelock/early-withdraw/early-withdraw.js +94 -0
- package/dist/timelock/early-withdraw/early-withdraw.js.map +1 -0
- package/dist/timelock/early-withdraw/index.d.ts +2 -0
- package/dist/timelock/early-withdraw/index.d.ts.map +1 -0
- package/dist/timelock/errors.d.ts +23 -0
- package/dist/timelock/errors.d.ts.map +1 -0
- package/dist/timelock/errors.js +29 -0
- package/dist/timelock/errors.js.map +1 -0
- package/dist/timelock/execute-protected-batch.d.ts +31 -0
- package/dist/timelock/execute-protected-batch.d.ts.map +1 -0
- package/dist/timelock/execute-protected-batch.js +148 -0
- package/dist/timelock/execute-protected-batch.js.map +1 -0
- package/dist/timelock/execute-protected-call.d.ts +68 -0
- package/dist/timelock/execute-protected-call.d.ts.map +1 -0
- package/dist/timelock/execute-protected-call.js +146 -0
- package/dist/timelock/execute-protected-call.js.map +1 -0
- package/dist/timelock/execute-protected-function.d.ts +51 -0
- package/dist/timelock/execute-protected-function.d.ts.map +1 -0
- package/dist/timelock/execute-protected-function.js +37 -0
- package/dist/timelock/execute-protected-function.js.map +1 -0
- package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts +38 -0
- package/dist/timelock/get-timelock-policy/get-timelock-policy.d.ts.map +1 -0
- package/dist/timelock/get-timelock-policy/get-timelock-policy.js +49 -0
- package/dist/timelock/get-timelock-policy/get-timelock-policy.js.map +1 -0
- package/dist/timelock/get-timelock-policy/index.d.ts +3 -0
- package/dist/timelock/get-timelock-policy/index.d.ts.map +1 -0
- package/dist/timelock/get-timelock-policy/query.d.ts +13 -0
- package/dist/timelock/get-timelock-policy/query.d.ts.map +1 -0
- package/dist/timelock/get-timelock-policy/query.js +21 -0
- package/dist/timelock/get-timelock-policy/query.js.map +1 -0
- package/dist/timelock/index.d.ts +14 -0
- package/dist/timelock/index.d.ts.map +1 -0
- package/dist/timelock/normalize-timelock-revert.d.ts +3 -0
- package/dist/timelock/normalize-timelock-revert.d.ts.map +1 -0
- package/dist/timelock/normalize-timelock-revert.js +11 -0
- package/dist/timelock/normalize-timelock-revert.js.map +1 -0
- package/dist/timelock/policy-change.d.ts +72 -0
- package/dist/timelock/policy-change.d.ts.map +1 -0
- package/dist/timelock/policy-change.js +63 -0
- package/dist/timelock/policy-change.js.map +1 -0
- package/dist/timelock/policy.d.ts +19 -0
- package/dist/timelock/policy.d.ts.map +1 -0
- package/dist/timelock/policy.js +59 -0
- package/dist/timelock/policy.js.map +1 -0
- package/dist/timelock/protected-call-preflight.d.ts +10 -0
- package/dist/timelock/protected-call-preflight.d.ts.map +1 -0
- package/dist/timelock/protected-call-preflight.js +17 -0
- package/dist/timelock/protected-call-preflight.js.map +1 -0
- package/dist/timelock/root-account.d.ts +14 -0
- package/dist/timelock/root-account.d.ts.map +1 -0
- package/dist/timelock/root-account.js +9 -0
- package/dist/timelock/root-account.js.map +1 -0
- package/dist/timelock/scheduled-call-match.d.ts +4 -0
- package/dist/timelock/scheduled-call-match.d.ts.map +1 -0
- package/dist/timelock/scheduled-call-match.js +43 -0
- package/dist/timelock/scheduled-call-match.js.map +1 -0
- package/dist/timelock/setup-timelock-policy/index.d.ts +2 -0
- package/dist/timelock/setup-timelock-policy/index.d.ts.map +1 -0
- package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts +46 -0
- package/dist/timelock/setup-timelock-policy/setup-timelock-policy.d.ts.map +1 -0
- package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js +58 -0
- package/dist/timelock/setup-timelock-policy/setup-timelock-policy.js.map +1 -0
- package/dist/timelock/support.d.ts +4 -0
- package/dist/timelock/support.d.ts.map +1 -0
- package/dist/timelock/support.js +9 -0
- package/dist/timelock/support.js.map +1 -0
- package/dist/transactions/execute-contract-write.d.ts +9 -0
- package/dist/transactions/execute-contract-write.d.ts.map +1 -0
- package/dist/transactions/execute-contract-write.js +35 -0
- package/dist/transactions/execute-contract-write.js.map +1 -0
- package/dist/transactions/execute-write.d.ts +32 -0
- package/dist/transactions/execute-write.d.ts.map +1 -0
- package/dist/transactions/execute-write.js +23 -0
- package/dist/transactions/execute-write.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { Address, Hex } from 'viem';
|
|
3
|
+
import { Config } from '../core/config/index.js';
|
|
4
|
+
import { SignedOperation } from '../solvers/instant-open/shared/types.js';
|
|
5
|
+
import { SignedTimelockApproval } from '../symmio-contracts/account-layer/types.js';
|
|
6
|
+
import { TimelockSolverError } from './errors.js';
|
|
7
|
+
/** Solver-advertised, deployment-specific public timelock capability. */
|
|
8
|
+
export interface TimelockApprovalCapability {
|
|
9
|
+
unlocker: Address;
|
|
10
|
+
validitySeconds: number;
|
|
11
|
+
minTimelockDelaySeconds: number;
|
|
12
|
+
requestDomain: {
|
|
13
|
+
name: "SymmioTimelockApprovalRequest";
|
|
14
|
+
version: "1";
|
|
15
|
+
chainId: number | string;
|
|
16
|
+
verifyingContract: Address;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/** Stable request body accepted by a compatible timelock-approval provider. */
|
|
20
|
+
export interface TimelockApprovalRequestPayload {
|
|
21
|
+
signedOperation: {
|
|
22
|
+
signer: Address;
|
|
23
|
+
target: Address;
|
|
24
|
+
callData: Hex;
|
|
25
|
+
signerAccount: {
|
|
26
|
+
addr: Address;
|
|
27
|
+
isPartyB: false;
|
|
28
|
+
};
|
|
29
|
+
flexFields: [];
|
|
30
|
+
maxUses: string;
|
|
31
|
+
replayAttackHeader: {
|
|
32
|
+
nonce: string;
|
|
33
|
+
deadline: string;
|
|
34
|
+
salt: Hex;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
signature: Hex;
|
|
38
|
+
}
|
|
39
|
+
/** Raw success response defined by the public timelock-approval API. */
|
|
40
|
+
export interface TimelockApprovalResponse {
|
|
41
|
+
account: Address;
|
|
42
|
+
unlocker: Address;
|
|
43
|
+
call_data_hash: Hex;
|
|
44
|
+
deadline: number | string;
|
|
45
|
+
salt: Hex;
|
|
46
|
+
signature: Hex;
|
|
47
|
+
approval_hash: Hex;
|
|
48
|
+
remaining_approvals: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Transport seam for a public-approval service. The SDK never assumes a solver
|
|
52
|
+
* vendor, URL, authentication mechanism, or retry policy.
|
|
53
|
+
*
|
|
54
|
+
* Implementations MUST issue one request only. An ambiguous result must be
|
|
55
|
+
* surfaced to the caller because repeating the POST creates another approval.
|
|
56
|
+
*/
|
|
57
|
+
export interface TimelockApprovalProvider {
|
|
58
|
+
requestApproval(request: TimelockApprovalRequestPayload, options?: {
|
|
59
|
+
signal?: AbortSignal;
|
|
60
|
+
}): Promise<TimelockApprovalResponse>;
|
|
61
|
+
}
|
|
62
|
+
/** HTTP failure from a standard `/timelock-approval` provider. */
|
|
63
|
+
export declare class TimelockApprovalHttpError extends TimelockSolverError {
|
|
64
|
+
readonly name = "TimelockApprovalHttpError";
|
|
65
|
+
readonly responseBody: unknown;
|
|
66
|
+
constructor(status: number, responseBody: unknown, options: {
|
|
67
|
+
url: string;
|
|
68
|
+
statusText: string;
|
|
69
|
+
retryAfterMs: number | null;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Create a provider for the standard public endpoint. It performs exactly one
|
|
74
|
+
* POST and never retries; callers own ambiguous-outcome recovery.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createHttpTimelockApprovalProvider(parameters: {
|
|
77
|
+
baseUrl: string;
|
|
78
|
+
client?: AxiosInstance;
|
|
79
|
+
headers?: Readonly<Record<string, string>>;
|
|
80
|
+
}): TimelockApprovalProvider;
|
|
81
|
+
/** Raw operation and deployment domain to sign for one public approval request. */
|
|
82
|
+
export interface PrepareTimelockApprovalRequestParameters {
|
|
83
|
+
chainId?: number;
|
|
84
|
+
/** Account the raw Core call executes for; may be a VA. */
|
|
85
|
+
account: Address;
|
|
86
|
+
/** Canonical raw Core calldata, never its hash or the AccountLayer `_call` wrapper. */
|
|
87
|
+
callData: Hex;
|
|
88
|
+
capability: TimelockApprovalCapability;
|
|
89
|
+
/** Unix-seconds API request deadline. Must be in the future and at most one hour ahead. */
|
|
90
|
+
deadline: bigint;
|
|
91
|
+
from?: Address;
|
|
92
|
+
salt?: Hex;
|
|
93
|
+
}
|
|
94
|
+
/** Immutable signed request; preparing does not contact the approval provider. */
|
|
95
|
+
export interface PreparedTimelockApprovalRequest {
|
|
96
|
+
operation: SignedOperation;
|
|
97
|
+
request: TimelockApprovalRequestPayload;
|
|
98
|
+
}
|
|
99
|
+
/** One approval attempt, including expected root and a caller-selected transport. */
|
|
100
|
+
export interface RequestTimelockApprovalParameters extends PrepareTimelockApprovalRequestParameters {
|
|
101
|
+
provider: TimelockApprovalProvider;
|
|
102
|
+
/** Expected root account. Response validation rejects a different account. */
|
|
103
|
+
rootAccount: Address;
|
|
104
|
+
signal?: AbortSignal;
|
|
105
|
+
}
|
|
106
|
+
/** Response fields bound to the requested account, provider and calldata. Signature validity is checked on-chain. */
|
|
107
|
+
export interface ValidatedTimelockApproval {
|
|
108
|
+
signedApproval: SignedTimelockApproval;
|
|
109
|
+
approvalHash: Hex;
|
|
110
|
+
remainingApprovals: number;
|
|
111
|
+
request: PreparedTimelockApprovalRequest;
|
|
112
|
+
}
|
|
113
|
+
/** Build AccountLayer `_call(account, [rawCoreCallData])` for timelock execution. */
|
|
114
|
+
export declare function encodeTimelockedCoreCall(account: Address, callData: Hex): Hex;
|
|
115
|
+
/**
|
|
116
|
+
* Build and sign an immutable public-approval request. Persist the returned
|
|
117
|
+
* object before transport if the application needs recovery after a timeout.
|
|
118
|
+
*/
|
|
119
|
+
export declare function prepareTimelockApprovalRequest(config: Config, parameters: PrepareTimelockApprovalRequestParameters): Promise<PreparedTimelockApprovalRequest>;
|
|
120
|
+
/**
|
|
121
|
+
* Request exactly one approval and validate the security-critical response.
|
|
122
|
+
* Expiry uses the selected chain's latest block, not the device clock.
|
|
123
|
+
* Signature bytes are preserved without a fixed length; the execution contract verifies EOA/EIP-1271 validity.
|
|
124
|
+
* Response validation failures retain the untrusted response in `SymmApiError.responseData`.
|
|
125
|
+
* This function deliberately has no automatic retry, including after a chain-time read failure.
|
|
126
|
+
*/
|
|
127
|
+
export declare function requestTimelockApproval(config: Config, parameters: RequestTimelockApprovalParameters): Promise<ValidatedTimelockApproval>;
|
|
128
|
+
/**
|
|
129
|
+
* TanStack mutation options with retries forcibly disabled. A QueryClient-wide
|
|
130
|
+
* retry default must never duplicate approval issuance after an unknown POST.
|
|
131
|
+
*/
|
|
132
|
+
export declare function requestTimelockApprovalMutationOptions(config: Config): {
|
|
133
|
+
mutationKey: readonly ["requestTimelockApproval"];
|
|
134
|
+
mutationFn: (variables: RequestTimelockApprovalParameters) => Promise<ValidatedTimelockApproval>;
|
|
135
|
+
retry: false;
|
|
136
|
+
};
|
|
137
|
+
/** Public EIP-712 schema, exported for custom provider integrations and audits. */
|
|
138
|
+
export declare const TIMELOCK_APPROVAL_REQUEST_TYPES: Record<string, {
|
|
139
|
+
name: string;
|
|
140
|
+
type: string;
|
|
141
|
+
}[]>;
|
|
142
|
+
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/timelock/approval.ts"],"names":[],"mappings":"AAAA,OAAc,EAAgB,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,EAOL,KAAK,OAAO,EACZ,KAAK,GAAG,EAET,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAM7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,yEAAyE;AACzE,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,OAA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B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,+BAA+B,CAAC;CAC1C;AAED,qFAAqF;AACrF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG,CAM7E;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,wCAAwC,GACnD,OAAO,CAAC,+BAA+B,CAAC,CA6E1C;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,iCAAiC,GAC5C,OAAO,CAAC,yBAAyB,CAAC,CAwFpC;AAiBD;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,MAAM,EAAE,MAAM;;4BAGzC,iCAAiC;;EAG5D;AAED,mFAAmF;AACnF,eAAO,MAAM,+BAA+B;;;IAAyB,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { accountLayerAbi as e } from "../symmio-contracts/abi/v0.8.6/account-layer.js";
|
|
2
|
+
import { parseRetryAfterMs as t } from "../shared/errors/retry-after.js";
|
|
3
|
+
import { readHttpHeader as n } from "../shared/utils/http-header.js";
|
|
4
|
+
import { SymmApiError as r, SymmError as i } from "../shared/errors/symm-error.js";
|
|
5
|
+
import { SIGNED_OPERATION_TYPES as a, signSignedOperation as o } from "../solvers/instant-open/shared/eip712.js";
|
|
6
|
+
import { buildSignedOperation as s, generateSalt as c } from "../solvers/instant-open/shared/operations.js";
|
|
7
|
+
import { TimelockSolverError as l } from "./errors.js";
|
|
8
|
+
import { assertTimelockSupported as u } from "./support.js";
|
|
9
|
+
import d, { isAxiosError as f } from "axios";
|
|
10
|
+
import { encodeFunctionData as p, isAddress as m, isAddressEqual as h, isHex as g, keccak256 as _, size as v } from "viem";
|
|
11
|
+
//#region src/timelock/approval.ts
|
|
12
|
+
var y = class extends l {
|
|
13
|
+
name = "TimelockApprovalHttpError";
|
|
14
|
+
responseBody;
|
|
15
|
+
constructor(e, t, n) {
|
|
16
|
+
let r = b(t), i = r?.code, a = r?.error_message;
|
|
17
|
+
super({
|
|
18
|
+
code: typeof i == "number" || typeof i == "string" ? String(i) : "TIMELOCK_APPROVAL_HTTP_ERROR",
|
|
19
|
+
message: typeof a == "string" ? a : `Timelock approval request failed with HTTP ${e}.`,
|
|
20
|
+
status: e,
|
|
21
|
+
statusText: n.statusText,
|
|
22
|
+
responseData: t,
|
|
23
|
+
url: n.url,
|
|
24
|
+
method: "POST",
|
|
25
|
+
retryAfterMs: n.retryAfterMs
|
|
26
|
+
}), this.responseBody = t;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
function b(e) {
|
|
30
|
+
return typeof e == "object" && e && !Array.isArray(e) ? e : void 0;
|
|
31
|
+
}
|
|
32
|
+
function x(e) {
|
|
33
|
+
let r = e.client ?? d;
|
|
34
|
+
return { async requestApproval(i, a) {
|
|
35
|
+
let o = `${e.baseUrl.replace(/\/$/, "")}/timelock-approval`;
|
|
36
|
+
try {
|
|
37
|
+
return (await r.post(o, i, {
|
|
38
|
+
headers: {
|
|
39
|
+
"Content-Type": "application/json",
|
|
40
|
+
...e.headers
|
|
41
|
+
},
|
|
42
|
+
signal: a?.signal
|
|
43
|
+
})).data;
|
|
44
|
+
} catch (e) {
|
|
45
|
+
throw f(e) ? new y(e.response?.status ?? 0, e.response?.data, {
|
|
46
|
+
url: o,
|
|
47
|
+
statusText: e.response?.statusText ?? "Unknown",
|
|
48
|
+
retryAfterMs: t(n(e.response?.headers, "retry-after"))
|
|
49
|
+
}) : e;
|
|
50
|
+
}
|
|
51
|
+
} };
|
|
52
|
+
}
|
|
53
|
+
function S(t, n) {
|
|
54
|
+
return p({
|
|
55
|
+
abi: e,
|
|
56
|
+
functionName: "_call",
|
|
57
|
+
args: [t, [n]]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async function C(e, t) {
|
|
61
|
+
u(e, t.chainId);
|
|
62
|
+
let n = e.getChainConfig(t.chainId), r = Number(t.capability.requestDomain.chainId);
|
|
63
|
+
if (t.capability.requestDomain.name !== "SymmioTimelockApprovalRequest" || t.capability.requestDomain.version !== "1" || r !== n.chainId || !h(t.capability.requestDomain.verifyingContract, n.addresses.accountLayerAddress)) throw new i("validation", "TIMELOCK_APPROVAL_DOMAIN_MISMATCH", "Timelock approval capability does not match the selected chain and AccountLayer.");
|
|
64
|
+
let a = await e.getClient({ chainId: n.chainId }).getBlock({ blockTag: "latest" });
|
|
65
|
+
if (t.deadline <= a.timestamp || t.deadline > a.timestamp + 3600n) throw new i("validation", "TIMELOCK_APPROVAL_REQUEST_DEADLINE_INVALID", "Timelock approval request deadline must be in the future and no more than one hour ahead.");
|
|
66
|
+
let l = await e.getWalletClient({
|
|
67
|
+
chainId: n.chainId,
|
|
68
|
+
from: t.from
|
|
69
|
+
});
|
|
70
|
+
if (l.chain?.id !== r) throw new i("validation", "TIMELOCK_WALLET_CHAIN_MISMATCH", "Switch the signing wallet to the approval request chain.");
|
|
71
|
+
let d = s({
|
|
72
|
+
signer: l.account.address,
|
|
73
|
+
target: n.addresses.accountLayerAddress,
|
|
74
|
+
callData: t.callData,
|
|
75
|
+
signerAccount: t.account,
|
|
76
|
+
deadline: t.deadline,
|
|
77
|
+
nonce: 0n,
|
|
78
|
+
salt: t.salt ?? c(),
|
|
79
|
+
flexFields: [],
|
|
80
|
+
maxUses: 1n
|
|
81
|
+
}), f = await o(d, {
|
|
82
|
+
name: t.capability.requestDomain.name,
|
|
83
|
+
version: t.capability.requestDomain.version,
|
|
84
|
+
chainId: r,
|
|
85
|
+
verifyingContract: t.capability.requestDomain.verifyingContract
|
|
86
|
+
}, l), p = await e.getClient({ chainId: n.chainId }).getBlock({ blockTag: "latest" });
|
|
87
|
+
if (t.deadline <= p.timestamp || t.deadline > p.timestamp + 3600n) throw new i("validation", "TIMELOCK_APPROVAL_REQUEST_DEADLINE_INVALID", "The request expired while signing. No approval was requested.");
|
|
88
|
+
return {
|
|
89
|
+
operation: d,
|
|
90
|
+
request: {
|
|
91
|
+
signedOperation: {
|
|
92
|
+
signer: d.signer,
|
|
93
|
+
target: d.target,
|
|
94
|
+
callData: d.callData,
|
|
95
|
+
signerAccount: {
|
|
96
|
+
addr: d.signerAccount.addr,
|
|
97
|
+
isPartyB: !1
|
|
98
|
+
},
|
|
99
|
+
flexFields: [],
|
|
100
|
+
maxUses: d.maxUses.toString(),
|
|
101
|
+
replayAttackHeader: {
|
|
102
|
+
nonce: d.replayAttackHeader.nonce.toString(),
|
|
103
|
+
deadline: d.replayAttackHeader.deadline.toString(),
|
|
104
|
+
salt: d.replayAttackHeader.salt
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
signature: f
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
async function w(e, t) {
|
|
112
|
+
let n = await C(e, t), r = await t.provider.requestApproval(n.request, { signal: t.signal });
|
|
113
|
+
if (!b(r)) throw T(r, "TIMELOCK_APPROVAL_RESPONSE_MISMATCH", "The provider returned no valid approval.");
|
|
114
|
+
if ("code" in r || "error_code" in r || "error_category" in r || "error_message" in r) throw new l({
|
|
115
|
+
code: "TIMELOCK_APPROVAL_INVALID_RESPONSE",
|
|
116
|
+
message: "No approval returned.",
|
|
117
|
+
status: 200,
|
|
118
|
+
statusText: "OK",
|
|
119
|
+
responseData: r,
|
|
120
|
+
url: "",
|
|
121
|
+
method: "POST"
|
|
122
|
+
});
|
|
123
|
+
let i = _(t.callData), a = (e, t) => typeof e == "string" && g(e) && v(e) === t, o;
|
|
124
|
+
try {
|
|
125
|
+
o = BigInt(r.deadline);
|
|
126
|
+
} catch {
|
|
127
|
+
o = 0n;
|
|
128
|
+
}
|
|
129
|
+
if (!m(r.account, { strict: !1 }) || !m(r.unlocker, { strict: !1 }) || !a(r.call_data_hash, 32) || !a(r.salt, 32) || typeof r.signature != "string" || !/^0x(?:[0-9a-fA-F]{2})*$/.test(r.signature) || !a(r.approval_hash, 32) || !Number.isSafeInteger(r.remaining_approvals) || r.remaining_approvals < 0 || o <= 0n || !h(r.account, t.rootAccount) || !h(r.unlocker, t.capability.unlocker) || r.call_data_hash.toLowerCase() !== i.toLowerCase()) throw T(r, "TIMELOCK_APPROVAL_RESPONSE_MISMATCH", "Timelock approval response does not match the requested root account, unlocker, or calldata.");
|
|
130
|
+
let s;
|
|
131
|
+
try {
|
|
132
|
+
s = (await e.getClient({ chainId: Number(t.capability.requestDomain.chainId) }).getBlock({ blockTag: "latest" })).timestamp;
|
|
133
|
+
} catch (e) {
|
|
134
|
+
throw T(r, "TIMELOCK_APPROVAL_TIME_UNAVAILABLE", "Approval was returned but chain time could not be checked. Retain the response and reconcile before retrying.", e);
|
|
135
|
+
}
|
|
136
|
+
if (o <= s) throw T(r, "TIMELOCK_APPROVAL_RESPONSE_MISMATCH", "The returned timelock approval has expired according to chain time. Reconcile before requesting another approval.");
|
|
137
|
+
return {
|
|
138
|
+
signedApproval: {
|
|
139
|
+
approval: {
|
|
140
|
+
account: r.account,
|
|
141
|
+
unlocker: r.unlocker,
|
|
142
|
+
callDataHash: r.call_data_hash,
|
|
143
|
+
deadline: o,
|
|
144
|
+
salt: r.salt
|
|
145
|
+
},
|
|
146
|
+
signature: r.signature
|
|
147
|
+
},
|
|
148
|
+
approvalHash: r.approval_hash,
|
|
149
|
+
remainingApprovals: r.remaining_approvals,
|
|
150
|
+
request: n
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
function T(e, t, n, i) {
|
|
154
|
+
return new r({
|
|
155
|
+
code: t,
|
|
156
|
+
message: n,
|
|
157
|
+
status: 0,
|
|
158
|
+
statusText: "Unknown",
|
|
159
|
+
url: "",
|
|
160
|
+
method: "POST",
|
|
161
|
+
responseData: e,
|
|
162
|
+
cause: i === void 0 ? void 0 : i instanceof Error ? i : Error("Chain time read failed", { cause: i })
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
function E(e) {
|
|
166
|
+
return {
|
|
167
|
+
mutationKey: ["requestTimelockApproval"],
|
|
168
|
+
mutationFn: (t) => w(e, t),
|
|
169
|
+
retry: !1
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
var D = a;
|
|
173
|
+
//#endregion
|
|
174
|
+
export { D as TIMELOCK_APPROVAL_REQUEST_TYPES, y as TimelockApprovalHttpError, x as createHttpTimelockApprovalProvider, S as encodeTimelockedCoreCall, C as prepareTimelockApprovalRequest, w as requestTimelockApproval, E as requestTimelockApprovalMutationOptions };
|
|
175
|
+
|
|
176
|
+
//# sourceMappingURL=approval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval.js","names":[],"sources":["../../src/timelock/approval.ts"],"sourcesContent":["import axios, { isAxiosError, type AxiosInstance } from \"axios\";\nimport {\n encodeFunctionData,\n isAddress,\n isAddressEqual,\n isHex,\n keccak256,\n size,\n type Address,\n type Hex,\n type TypedDataDomain,\n} from \"viem\";\nimport type { Config } from \"../core/config\";\nimport { parseRetryAfterMs } from \"../shared/errors/retry-after\";\nimport { SymmApiError, SymmError } from \"../shared/errors/symm-error\";\nimport { readHttpHeader } from \"../shared/utils/http-header\";\nimport { SIGNED_OPERATION_TYPES, signSignedOperation } from \"../solvers/instant-open/shared/eip712\";\nimport { buildSignedOperation, generateSalt } from \"../solvers/instant-open/shared/operations\";\nimport type { SignedOperation } from \"../solvers/instant-open/shared/types\";\nimport { accountLayerAbi } from \"../symmio-contracts/abi/v0.8.6/account-layer\";\nimport type { SignedTimelockApproval } from \"../symmio-contracts/account-layer/types\";\nimport { TimelockSolverError } from \"./errors\";\nimport { assertTimelockSupported } from \"./support\";\n\n/** Solver-advertised, deployment-specific public timelock capability. */\nexport interface TimelockApprovalCapability {\n unlocker: Address;\n validitySeconds: number;\n minTimelockDelaySeconds: number;\n requestDomain: {\n name: \"SymmioTimelockApprovalRequest\";\n version: \"1\";\n chainId: number | string;\n verifyingContract: Address;\n };\n}\n\n/** Stable request body accepted by a compatible timelock-approval provider. */\nexport interface TimelockApprovalRequestPayload {\n signedOperation: {\n signer: Address;\n target: Address;\n callData: Hex;\n signerAccount: { addr: Address; isPartyB: false };\n flexFields: [];\n maxUses: string;\n replayAttackHeader: { nonce: string; deadline: string; salt: Hex };\n };\n signature: Hex;\n}\n\n/** Raw success response defined by the public timelock-approval API. */\nexport interface TimelockApprovalResponse {\n account: Address;\n unlocker: Address;\n call_data_hash: Hex;\n deadline: number | string;\n salt: Hex;\n signature: Hex;\n approval_hash: Hex;\n remaining_approvals: number;\n}\n\n/**\n * Transport seam for a public-approval service. The SDK never assumes a solver\n * vendor, URL, authentication mechanism, or retry policy.\n *\n * Implementations MUST issue one request only. An ambiguous result must be\n * surfaced to the caller because repeating the POST creates another approval.\n */\nexport interface TimelockApprovalProvider {\n requestApproval(\n request: TimelockApprovalRequestPayload,\n options?: { signal?: AbortSignal },\n ): Promise<TimelockApprovalResponse>;\n}\n\n/** HTTP failure from a standard `/timelock-approval` provider. */\nexport class TimelockApprovalHttpError extends TimelockSolverError {\n override readonly name = \"TimelockApprovalHttpError\";\n readonly responseBody: unknown;\n constructor(\n status: number,\n responseBody: unknown,\n options: { url: string; statusText: string; retryAfterMs: number | null },\n ) {\n const body = record(responseBody);\n const providerCode = body?.code;\n const providerMessage = body?.error_message;\n const code =\n typeof providerCode === \"number\" || typeof providerCode === \"string\"\n ? String(providerCode)\n : \"TIMELOCK_APPROVAL_HTTP_ERROR\";\n super({\n code,\n message:\n typeof providerMessage === \"string\" ? providerMessage : `Timelock approval request failed with HTTP ${status}.`,\n status,\n statusText: options.statusText,\n responseData: responseBody,\n url: options.url,\n method: \"POST\",\n retryAfterMs: options.retryAfterMs,\n });\n this.responseBody = responseBody;\n }\n}\n\nfunction record(value: unknown): Record<string, unknown> | undefined {\n return typeof value === \"object\" && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : undefined;\n}\n\n/**\n * Create a provider for the standard public endpoint. It performs exactly one\n * POST and never retries; callers own ambiguous-outcome recovery.\n */\nexport function createHttpTimelockApprovalProvider(parameters: {\n baseUrl: string;\n client?: AxiosInstance;\n headers?: Readonly<Record<string, string>>;\n}): TimelockApprovalProvider {\n const client = parameters.client ?? axios;\n return {\n async requestApproval(request, options) {\n const url = `${parameters.baseUrl.replace(/\\/$/, \"\")}/timelock-approval`;\n try {\n const response = await client.post<TimelockApprovalResponse>(url, request, {\n headers: { \"Content-Type\": \"application/json\", ...parameters.headers },\n signal: options?.signal,\n });\n return response.data;\n } catch (error) {\n if (!isAxiosError(error)) throw error;\n throw new TimelockApprovalHttpError(error.response?.status ?? 0, error.response?.data, {\n url,\n statusText: error.response?.statusText ?? \"Unknown\",\n retryAfterMs: parseRetryAfterMs(readHttpHeader(error.response?.headers, \"retry-after\")),\n });\n }\n },\n };\n}\n\n/** Raw operation and deployment domain to sign for one public approval request. */\nexport interface PrepareTimelockApprovalRequestParameters {\n chainId?: number;\n /** Account the raw Core call executes for; may be a VA. */\n account: Address;\n /** Canonical raw Core calldata, never its hash or the AccountLayer `_call` wrapper. */\n callData: Hex;\n capability: TimelockApprovalCapability;\n /** Unix-seconds API request deadline. Must be in the future and at most one hour ahead. */\n deadline: bigint;\n from?: Address;\n salt?: Hex;\n}\n\n/** Immutable signed request; preparing does not contact the approval provider. */\nexport interface PreparedTimelockApprovalRequest {\n operation: SignedOperation;\n request: TimelockApprovalRequestPayload;\n}\n\n/** One approval attempt, including expected root and a caller-selected transport. */\nexport interface RequestTimelockApprovalParameters extends PrepareTimelockApprovalRequestParameters {\n provider: TimelockApprovalProvider;\n /** Expected root account. Response validation rejects a different account. */\n rootAccount: Address;\n signal?: AbortSignal;\n}\n\n/** Response fields bound to the requested account, provider and calldata. Signature validity is checked on-chain. */\nexport interface ValidatedTimelockApproval {\n signedApproval: SignedTimelockApproval;\n approvalHash: Hex;\n remainingApprovals: number;\n request: PreparedTimelockApprovalRequest;\n}\n\n/** Build AccountLayer `_call(account, [rawCoreCallData])` for timelock execution. */\nexport function encodeTimelockedCoreCall(account: Address, callData: Hex): Hex {\n return encodeFunctionData({\n abi: accountLayerAbi,\n functionName: \"_call\",\n args: [account, [callData]],\n });\n}\n\n/**\n * Build and sign an immutable public-approval request. Persist the returned\n * object before transport if the application needs recovery after a timeout.\n */\nexport async function prepareTimelockApprovalRequest(\n config: Config,\n parameters: PrepareTimelockApprovalRequestParameters,\n): Promise<PreparedTimelockApprovalRequest> {\n assertTimelockSupported(config, parameters.chainId);\n const chain = config.getChainConfig(parameters.chainId);\n const domainChainId = Number(parameters.capability.requestDomain.chainId);\n if (\n parameters.capability.requestDomain.name !== \"SymmioTimelockApprovalRequest\" ||\n parameters.capability.requestDomain.version !== \"1\" ||\n domainChainId !== chain.chainId ||\n !isAddressEqual(parameters.capability.requestDomain.verifyingContract, chain.addresses.accountLayerAddress)\n ) {\n throw new SymmError(\n \"validation\",\n \"TIMELOCK_APPROVAL_DOMAIN_MISMATCH\",\n \"Timelock approval capability does not match the selected chain and AccountLayer.\",\n );\n }\n const block = await config.getClient({ chainId: chain.chainId }).getBlock({ blockTag: \"latest\" });\n if (parameters.deadline <= block.timestamp || parameters.deadline > block.timestamp + 3600n) {\n throw new SymmError(\n \"validation\",\n \"TIMELOCK_APPROVAL_REQUEST_DEADLINE_INVALID\",\n \"Timelock approval request deadline must be in the future and no more than one hour ahead.\",\n );\n }\n\n const wallet = await config.getWalletClient({ chainId: chain.chainId, from: parameters.from });\n if (wallet.chain?.id !== domainChainId)\n throw new SymmError(\n \"validation\",\n \"TIMELOCK_WALLET_CHAIN_MISMATCH\",\n \"Switch the signing wallet to the approval request chain.\",\n );\n const operation = buildSignedOperation({\n signer: wallet.account.address,\n target: chain.addresses.accountLayerAddress,\n callData: parameters.callData,\n signerAccount: parameters.account,\n deadline: parameters.deadline,\n nonce: 0n,\n salt: parameters.salt ?? generateSalt(),\n flexFields: [],\n maxUses: 1n,\n });\n const domain: TypedDataDomain = {\n name: parameters.capability.requestDomain.name,\n version: parameters.capability.requestDomain.version,\n chainId: domainChainId,\n verifyingContract: parameters.capability.requestDomain.verifyingContract,\n };\n const signature = await signSignedOperation(operation, domain, wallet);\n const afterSigning = await config.getClient({ chainId: chain.chainId }).getBlock({ blockTag: \"latest\" });\n if (parameters.deadline <= afterSigning.timestamp || parameters.deadline > afterSigning.timestamp + 3600n) {\n throw new SymmError(\n \"validation\",\n \"TIMELOCK_APPROVAL_REQUEST_DEADLINE_INVALID\",\n \"The request expired while signing. No approval was requested.\",\n );\n }\n return {\n operation,\n request: {\n signedOperation: {\n signer: operation.signer,\n target: operation.target,\n callData: operation.callData,\n signerAccount: { addr: operation.signerAccount.addr, isPartyB: false },\n flexFields: [],\n maxUses: operation.maxUses.toString(),\n replayAttackHeader: {\n nonce: operation.replayAttackHeader.nonce.toString(),\n deadline: operation.replayAttackHeader.deadline.toString(),\n salt: operation.replayAttackHeader.salt,\n },\n },\n signature,\n },\n };\n}\n\n/**\n * Request exactly one approval and validate the security-critical response.\n * Expiry uses the selected chain's latest block, not the device clock.\n * Signature bytes are preserved without a fixed length; the execution contract verifies EOA/EIP-1271 validity.\n * Response validation failures retain the untrusted response in `SymmApiError.responseData`.\n * This function deliberately has no automatic retry, including after a chain-time read failure.\n */\nexport async function requestTimelockApproval(\n config: Config,\n parameters: RequestTimelockApprovalParameters,\n): Promise<ValidatedTimelockApproval> {\n const prepared = await prepareTimelockApprovalRequest(config, parameters);\n const response = await parameters.provider.requestApproval(prepared.request, { signal: parameters.signal });\n if (!record(response))\n throw approvalResponseError(\n response,\n \"TIMELOCK_APPROVAL_RESPONSE_MISMATCH\",\n \"The provider returned no valid approval.\",\n );\n if (\"code\" in response || \"error_code\" in response || \"error_category\" in response || \"error_message\" in response) {\n throw new TimelockSolverError({\n code: \"TIMELOCK_APPROVAL_INVALID_RESPONSE\",\n message: \"No approval returned.\",\n status: 200,\n statusText: \"OK\",\n responseData: response,\n url: \"\",\n method: \"POST\",\n });\n }\n const expectedHash = keccak256(parameters.callData);\n const validHex = (value: unknown, bytes: number): value is Hex =>\n typeof value === \"string\" && isHex(value) && size(value) === bytes;\n let approvalDeadline: bigint;\n try {\n approvalDeadline = BigInt(response.deadline);\n } catch {\n approvalDeadline = 0n;\n }\n if (\n !isAddress(response.account, { strict: false }) ||\n !isAddress(response.unlocker, { strict: false }) ||\n !validHex(response.call_data_hash, 32) ||\n !validHex(response.salt, 32) ||\n // EIP-1271 unlockers accept arbitrary bytes, including empty signatures.\n // Only validate byte encoding here; the contract verifies signature validity.\n typeof response.signature !== \"string\" ||\n !/^0x(?:[0-9a-fA-F]{2})*$/.test(response.signature) ||\n !validHex(response.approval_hash, 32) ||\n !Number.isSafeInteger(response.remaining_approvals) ||\n response.remaining_approvals < 0 ||\n approvalDeadline <= 0n ||\n !isAddressEqual(response.account, parameters.rootAccount) ||\n !isAddressEqual(response.unlocker, parameters.capability.unlocker) ||\n response.call_data_hash.toLowerCase() !== expectedHash.toLowerCase()\n ) {\n throw approvalResponseError(\n response,\n \"TIMELOCK_APPROVAL_RESPONSE_MISMATCH\",\n \"Timelock approval response does not match the requested root account, unlocker, or calldata.\",\n );\n }\n let now: bigint;\n try {\n const block = await config\n .getClient({ chainId: Number(parameters.capability.requestDomain.chainId) })\n .getBlock({ blockTag: \"latest\" });\n now = block.timestamp;\n } catch (cause) {\n throw approvalResponseError(\n response,\n \"TIMELOCK_APPROVAL_TIME_UNAVAILABLE\",\n \"Approval was returned but chain time could not be checked. Retain the response and reconcile before retrying.\",\n cause,\n );\n }\n if (approvalDeadline <= now) {\n throw approvalResponseError(\n response,\n \"TIMELOCK_APPROVAL_RESPONSE_MISMATCH\",\n \"The returned timelock approval has expired according to chain time. Reconcile before requesting another approval.\",\n );\n }\n return {\n signedApproval: {\n approval: {\n account: response.account,\n unlocker: response.unlocker,\n callDataHash: response.call_data_hash,\n deadline: approvalDeadline,\n salt: response.salt,\n },\n signature: response.signature,\n },\n approvalHash: response.approval_hash,\n remainingApprovals: response.remaining_approvals,\n request: prepared,\n };\n}\n\nfunction approvalResponseError(response: unknown, code: string, message: string, cause?: unknown): SymmApiError {\n return new SymmApiError({\n code,\n message,\n // Custom providers do not expose HTTP metadata. Do not invent a status or URL.\n status: 0,\n statusText: \"Unknown\",\n url: \"\",\n method: \"POST\",\n responseData: response,\n cause:\n cause === undefined ? undefined : cause instanceof Error ? cause : new Error(\"Chain time read failed\", { cause }),\n });\n}\n\n/**\n * TanStack mutation options with retries forcibly disabled. A QueryClient-wide\n * retry default must never duplicate approval issuance after an unknown POST.\n */\nexport function requestTimelockApprovalMutationOptions(config: Config) {\n return {\n mutationKey: [\"requestTimelockApproval\"] as const,\n mutationFn: (variables: RequestTimelockApprovalParameters) => requestTimelockApproval(config, variables),\n retry: false as const,\n };\n}\n\n/** Public EIP-712 schema, exported for custom provider integrations and audits. */\nexport const TIMELOCK_APPROVAL_REQUEST_TYPES = SIGNED_OPERATION_TYPES;\n"],"mappings":";;;;;;;;;;;AA8EA,IAAa,IAAb,cAA+C,EAAoB;CACjE,OAAyB;CACzB;CACA,YACE,GACA,GACA,GACA;EACA,IAAM,IAAO,EAAO,CAAY,GAC1B,IAAe,GAAM,MACrB,IAAkB,GAAM;EAgB9B,AAXA,MAAM;GACJ,MAJA,OAAO,KAAiB,YAAY,OAAO,KAAiB,WACxD,OAAO,CAAY,IACnB;GAGJ,SACE,OAAO,KAAoB,WAAW,IAAkB,8CAA8C,EAAO;GAC/G;GACA,YAAY,EAAQ;GACpB,cAAc;GACd,KAAK,EAAQ;GACb,QAAQ;GACR,cAAc,EAAQ;EACxB,CAAC,GACD,KAAK,eAAe;CACtB;AACF;AAEA,SAAS,EAAO,GAAqD;CACnE,OAAO,OAAO,KAAU,YAAY,KAAkB,CAAC,MAAM,QAAQ,CAAK,IACrE,IACD,KAAA;AACN;AAMA,SAAgB,EAAmC,GAItB;CAC3B,IAAM,IAAS,EAAW,UAAU;CACpC,OAAO,EACL,MAAM,gBAAgB,GAAS,GAAS;EACtC,IAAM,IAAM,GAAG,EAAW,QAAQ,QAAQ,OAAO,E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tB;EACA,cAAc,EAAS;EACvB,oBAAoB,EAAS;EAC7B,SAAS;CACX;AACF;AAEA,SAAS,EAAsB,GAAmB,GAAc,GAAiB,GAA+B;CAC9G,OAAO,IAAI,EAAa;EACtB;EACA;EAEA,QAAQ;EACR,YAAY;EACZ,KAAK;EACL,QAAQ;EACR,cAAc;EACd,OACE,MAAU,KAAA,IAAY,KAAA,IAAY,aAAiB,QAAQ,IAAY,MAAM,0BAA0B,EAAE,SAAM,CAAC;CACpH,CAAC;AACH;AAMA,SAAgB,EAAuC,GAAgB;CACrE,OAAO;EACL,aAAa,CAAC,yBAAyB;EACvC,aAAa,MAAiD,EAAwB,GAAQ,CAAS;EACvG,OAAO;CACT;AACF;AAGA,IAAa,IAAkC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a submitted transaction hash retained anywhere in an SDK error chain.
|
|
3
|
+
*
|
|
4
|
+
* @param error - An SDK, viem, wallet, or relayer error.
|
|
5
|
+
* @returns The first valid transaction hash, or `undefined` when submission is not evidenced.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTimelockRecoveryTransactionHash(error: unknown): string | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Check whether an error retains evidence that a relay or transaction may have been submitted.
|
|
10
|
+
*
|
|
11
|
+
* @param error - An SDK, viem, wallet, or relayer error.
|
|
12
|
+
* @returns `true` when a transaction hash, request ID, or idempotency key is present.
|
|
13
|
+
* @remarks A positive result is deliberately conservative: reconcile the existing attempt before retrying.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasTimelockSubmissionEvidence(error: unknown): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Check whether the provider explicitly rejected an approval before issuing one.
|
|
18
|
+
*
|
|
19
|
+
* @param error - A normalized or raw timelock approval error.
|
|
20
|
+
* @returns `true` only for documented, definitive provider rejection status/code pairs.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isDefiniteTimelockApprovalRejection(error: unknown): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Check whether the user definitely rejected before any relay or transaction was submitted.
|
|
25
|
+
*
|
|
26
|
+
* @param error - A normalized or raw wallet error.
|
|
27
|
+
* @returns `true` only when rejection is explicit and no submission evidence exists.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isUnsubmittedTimelockWalletRejection(error: unknown): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Check whether a gasless relay definitively rejected during simulation before submission.
|
|
32
|
+
*
|
|
33
|
+
* @param error - A normalized or raw gasless relay error.
|
|
34
|
+
* @returns `true` only for HTTP 400 `SIMULATION_REVERTED` without submission evidence.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isDefiniteGaslessSimulationRejection(error: unknown): boolean;
|
|
37
|
+
//# sourceMappingURL=attempt-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attempt-outcome.d.ts","sourceRoot":"","sources":["../../src/timelock/attempt-outcome.ts"],"names":[],"mappings":"AAsBA;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAQrF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CA0BrE;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAa3E;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAG5E;AAED;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAK5E"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { parseGaslessErrorDetail as e } from "../gasless/errors.js";
|
|
2
|
+
import { UserRejectedRequestError as t } from "viem";
|
|
3
|
+
//#region src/timelock/attempt-outcome.ts
|
|
4
|
+
var n = new Map([
|
|
5
|
+
[400, new Set([
|
|
6
|
+
3700,
|
|
7
|
+
3701,
|
|
8
|
+
3702,
|
|
9
|
+
3703,
|
|
10
|
+
3704,
|
|
11
|
+
3710
|
|
12
|
+
])],
|
|
13
|
+
[403, new Set([3709])],
|
|
14
|
+
[429, new Set([3705])]
|
|
15
|
+
]);
|
|
16
|
+
function r(e) {
|
|
17
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = e;
|
|
18
|
+
for (let e = 0; e < 12 && r && typeof r == "object" && !n.has(r); e++) {
|
|
19
|
+
n.add(r);
|
|
20
|
+
let e = r;
|
|
21
|
+
t.push(e), r = e.cause;
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
function i(e) {
|
|
26
|
+
for (let t of r(e)) for (let e of [
|
|
27
|
+
"hash",
|
|
28
|
+
"transactionHash",
|
|
29
|
+
"txHash",
|
|
30
|
+
"broadcastHash"
|
|
31
|
+
]) {
|
|
32
|
+
let n = t[e];
|
|
33
|
+
if (typeof n == "string" && /^0x[\da-fA-F]{64}$/.test(n)) return n;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function a(e) {
|
|
37
|
+
if (i(e)) return !0;
|
|
38
|
+
for (let t of r(e)) {
|
|
39
|
+
if (t.code === "GASLESS_SUBMIT_UNCONFIRMED" || t.requestId || t.request_id || t.idempotencyKey || t.idempotency_key) return !0;
|
|
40
|
+
let e = t.responseData;
|
|
41
|
+
if (!e || typeof e != "object") continue;
|
|
42
|
+
let n = e;
|
|
43
|
+
if (n.requestId || n.request_id || n.idempotencyKey || n.idempotency_key || n.transactionHash || n.txHash || n.broadcastHash) return !0;
|
|
44
|
+
}
|
|
45
|
+
return !1;
|
|
46
|
+
}
|
|
47
|
+
function o(e) {
|
|
48
|
+
for (let t of r(e)) {
|
|
49
|
+
if (t.kind !== "api") continue;
|
|
50
|
+
let e = t.timelock ?? t.details;
|
|
51
|
+
if (!e || typeof e != "object") continue;
|
|
52
|
+
let r = e.knownCode, i = typeof r == "number" ? r : Number(t.code);
|
|
53
|
+
if (Number.isSafeInteger(i)) {
|
|
54
|
+
if (typeof t.status == "number") {
|
|
55
|
+
if (n.get(t.status)?.has(i)) return !0;
|
|
56
|
+
} else if ([...n.values()].some((e) => e.has(i))) return !0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return !1;
|
|
60
|
+
}
|
|
61
|
+
function s(e) {
|
|
62
|
+
return a(e) ? !1 : r(e).some((e) => e.kind === "user-rejected" || e instanceof t);
|
|
63
|
+
}
|
|
64
|
+
function c(t) {
|
|
65
|
+
return a(t) ? !1 : r(t).some((t) => t.status === 400 && e(t)?.code === "SIMULATION_REVERTED");
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { i as getTimelockRecoveryTransactionHash, a as hasTimelockSubmissionEvidence, c as isDefiniteGaslessSimulationRejection, o as isDefiniteTimelockApprovalRejection, s as isUnsubmittedTimelockWalletRejection };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=attempt-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attempt-outcome.js","names":[],"sources":["../../src/timelock/attempt-outcome.ts"],"sourcesContent":["import { UserRejectedRequestError } from \"viem\";\nimport { parseGaslessErrorDetail } from \"../gasless/errors\";\n\nconst DEFINITE_APPROVAL_REJECTIONS = new Map<number, ReadonlySet<number>>([\n [400, new Set([3700, 3701, 3702, 3703, 3704, 3710])],\n [403, new Set([3709])],\n [429, new Set([3705])],\n]);\n\nfunction records(error: unknown): Record<string, unknown>[] {\n const result: Record<string, unknown>[] = [];\n const seen = new Set<object>();\n let current = error;\n for (let depth = 0; depth < 12 && current && typeof current === \"object\" && !seen.has(current); depth++) {\n seen.add(current);\n const record = current as Record<string, unknown>;\n result.push(record);\n current = record.cause;\n }\n return result;\n}\n\n/**\n * Find a submitted transaction hash retained anywhere in an SDK error chain.\n *\n * @param error - An SDK, viem, wallet, or relayer error.\n * @returns The first valid transaction hash, or `undefined` when submission is not evidenced.\n */\nexport function getTimelockRecoveryTransactionHash(error: unknown): string | undefined {\n for (const record of records(error)) {\n for (const key of [\"hash\", \"transactionHash\", \"txHash\", \"broadcastHash\"] as const) {\n const value = record[key];\n if (typeof value === \"string\" && /^0x[\\da-fA-F]{64}$/.test(value)) return value;\n }\n }\n return undefined;\n}\n\n/**\n * Check whether an error retains evidence that a relay or transaction may have been submitted.\n *\n * @param error - An SDK, viem, wallet, or relayer error.\n * @returns `true` when a transaction hash, request ID, or idempotency key is present.\n * @remarks A positive result is deliberately conservative: reconcile the existing attempt before retrying.\n */\nexport function hasTimelockSubmissionEvidence(error: unknown): boolean {\n if (getTimelockRecoveryTransactionHash(error)) return true;\n for (const record of records(error)) {\n if (\n record.code === \"GASLESS_SUBMIT_UNCONFIRMED\" ||\n record.requestId ||\n record.request_id ||\n record.idempotencyKey ||\n record.idempotency_key\n )\n return true;\n const response = record.responseData;\n if (!response || typeof response !== \"object\") continue;\n const value = response as Record<string, unknown>;\n if (\n value.requestId ||\n value.request_id ||\n value.idempotencyKey ||\n value.idempotency_key ||\n value.transactionHash ||\n value.txHash ||\n value.broadcastHash\n )\n return true;\n }\n return false;\n}\n\n/**\n * Check whether the provider explicitly rejected an approval before issuing one.\n *\n * @param error - A normalized or raw timelock approval error.\n * @returns `true` only for documented, definitive provider rejection status/code pairs.\n */\nexport function isDefiniteTimelockApprovalRejection(error: unknown): boolean {\n for (const record of records(error)) {\n if (record.kind !== \"api\") continue;\n const details = record.timelock ?? record.details;\n if (!details || typeof details !== \"object\") continue;\n const knownCode = (details as Record<string, unknown>).knownCode;\n const code = typeof knownCode === \"number\" ? knownCode : Number(record.code);\n if (!Number.isSafeInteger(code)) continue;\n if (typeof record.status === \"number\") {\n if (DEFINITE_APPROVAL_REJECTIONS.get(record.status)?.has(code)) return true;\n } else if ([...DEFINITE_APPROVAL_REJECTIONS.values()].some((codes) => codes.has(code))) return true;\n }\n return false;\n}\n\n/**\n * Check whether the user definitely rejected before any relay or transaction was submitted.\n *\n * @param error - A normalized or raw wallet error.\n * @returns `true` only when rejection is explicit and no submission evidence exists.\n */\nexport function isUnsubmittedTimelockWalletRejection(error: unknown): boolean {\n if (hasTimelockSubmissionEvidence(error)) return false;\n return records(error).some((record) => record.kind === \"user-rejected\" || record instanceof UserRejectedRequestError);\n}\n\n/**\n * Check whether a gasless relay definitively rejected during simulation before submission.\n *\n * @param error - A normalized or raw gasless relay error.\n * @returns `true` only for HTTP 400 `SIMULATION_REVERTED` without submission evidence.\n */\nexport function isDefiniteGaslessSimulationRejection(error: unknown): boolean {\n if (hasTimelockSubmissionEvidence(error)) return false;\n return records(error).some(\n (record) => record.status === 400 && parseGaslessErrorDetail(record)?.code === \"SIMULATION_REVERTED\",\n );\n}\n"],"mappings":";;;AAGA,IAAM,IAA+B,IAAI,IAAiC;CACxE,CAAC,KAAK,IAAI,IAAI;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;CAAI,CAAC,CAAC;CACnD,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;CACrB,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,EAAQ,GAA2C;CAC1D,IAAM,IAAoC,CAAC,GACrC,oBAAO,IAAI,IAAY,GACzB,IAAU;CACd,KAAK,IAAI,IAAQ,GAAG,IAAQ,MAAM,KAAW,OAAO,KAAY,YAAY,CAAC,EAAK,IAAI,CAAO,GAAG,KAAS;EACvG,EAAK,IAAI,CAAO;EAChB,IAAM,IAAS;EAEf,AADA,EAAO,KAAK,CAAM,GAClB,IAAU,EAAO;CACnB;CACA,OAAO;AACT;AAQA,SAAgB,EAAmC,GAAoC;CACrF,KAAK,IAAM,KAAU,EAAQ,CAAK,GAChC,KAAK,IAAM,KAAO;EAAC;EAAQ;EAAmB;EAAU;CAAe,GAAY;EACjF,IAAM,IAAQ,EAAO;EACrB,IAAI,OAAO,KAAU,YAAY,qBAAqB,KAAK,CAAK,GAAG,OAAO;CAC5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
|
|
1
|
+
import { Hash } from 'viem';
|
|
2
|
+
import { Config } from '../core/config/index.js';
|
|
3
|
+
/** Confirm the original wallet hash or relay request, never submit a replacement operation. @internal */
|
|
4
|
+
export declare function confirmTimelockWrite(config: Config, chainId: number | undefined, hash: Hash): Promise<import('viem').TransactionReceipt>;
|
|
5
|
+
//# sourceMappingURL=confirm-write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-write.d.ts","sourceRoot":"","sources":["../../src/timelock/confirm-write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7C,yGAAyG;AACzG,wBAAsB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,8CAejG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SymmError as e } from "../shared/errors/symm-error.js";
|
|
2
|
+
import { getGaslessWriteRequest as t } from "../gasless/write-request-registry.js";
|
|
3
|
+
import { confirmGaslessRequest as n } from "../gasless/confirm-gasless-request/confirm-gasless-request.js";
|
|
4
|
+
//#region src/timelock/confirm-write.ts
|
|
5
|
+
async function r(r, i, a) {
|
|
6
|
+
let o = t(r, { hash: a }), s = o ? (await n(r, {
|
|
7
|
+
chainId: o.chainId,
|
|
8
|
+
requestId: o.requestId,
|
|
9
|
+
service: o.service,
|
|
10
|
+
until: "receipt"
|
|
11
|
+
})).receipt : await r.getClient({ chainId: i }).waitForTransactionReceipt({ hash: a });
|
|
12
|
+
if (!s || s.status !== "success") throw new e("validation", "TIMELOCK_TRANSACTION_REVERTED", "The timelock transaction did not succeed.");
|
|
13
|
+
return s;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as confirmTimelockWrite };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=confirm-write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-write.js","names":[],"sources":["../../src/timelock/confirm-write.ts"],"sourcesContent":["import type { Hash } from \"viem\";\nimport type { Config } from \"../core/config\";\nimport { confirmGaslessRequest } from \"../gasless/confirm-gasless-request\";\nimport { getGaslessWriteRequest } from \"../gasless/write-request-registry\";\nimport { SymmError } from \"../shared/errors/symm-error\";\n\n/** Confirm the original wallet hash or relay request, never submit a replacement operation. @internal */\nexport async function confirmTimelockWrite(config: Config, chainId: number | undefined, hash: Hash) {\n const relayed = getGaslessWriteRequest(config, { hash });\n const receipt = relayed\n ? (\n await confirmGaslessRequest(config, {\n chainId: relayed.chainId,\n requestId: relayed.requestId,\n service: relayed.service,\n until: \"receipt\",\n })\n ).receipt\n : await config.getClient({ chainId }).waitForTransactionReceipt({ hash });\n if (!receipt || receipt.status !== \"success\")\n throw new SymmError(\"validation\", \"TIMELOCK_TRANSACTION_REVERTED\", \"The timelock transaction did not succeed.\");\n return receipt;\n}\n"],"mappings":";;;;AAOA,eAAsB,EAAqB,GAAgB,GAA6B,GAAY;CAClG,IAAM,IAAU,EAAuB,GAAQ,EAAE,QAAK,CAAC,GACjD,IAAU,KAEV,MAAM,EAAsB,GAAQ;EAClC,SAAS,EAAQ;EACjB,WAAW,EAAQ;EACnB,SAAS,EAAQ;EACjB,OAAO;CACT,CAAC,GACD,UACF,MAAM,EAAO,UAAU,EAAE,WAAQ,CAAC,EAAE,0BAA0B,EAAE,QAAK,CAAC;CAC1E,IAAI,CAAC,KAAW,EAAQ,WAAW,WACjC,MAAM,IAAI,EAAU,cAAc,iCAAiC,2CAA2C;CAChH,OAAO;AACT"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Address, Hash, Hex } from 'viem';
|
|
2
|
+
import { Config } from '../../core/config/index.js';
|
|
3
|
+
import { TimelockWriteParameters } from '../../symmio-contracts/account-layer/timelock-types.js';
|
|
4
|
+
import { InitiateWithdrawParameters } from '../../symmio-contracts/symmio/actions/initiate-withdraw.js';
|
|
5
|
+
import { TimelockApprovalProvider, ValidatedTimelockApproval } from '../approval.js';
|
|
6
|
+
import { GetTimelockPolicyParameters } from '../get-timelock-policy/get-timelock-policy.js';
|
|
7
|
+
/** Exact Core withdrawal variants. Amounts retain the deployed contract's raw units. */
|
|
8
|
+
export type EarlyWithdrawalCall = {
|
|
9
|
+
method: "withdraw";
|
|
10
|
+
amount: bigint;
|
|
11
|
+
} | {
|
|
12
|
+
method: "withdrawTo";
|
|
13
|
+
recipient: Address;
|
|
14
|
+
amount: bigint;
|
|
15
|
+
} | ({
|
|
16
|
+
method: "initiateWithdraw";
|
|
17
|
+
} & Pick<InitiateWithdrawParameters, "parts" | "speedUp" | "providerData">);
|
|
18
|
+
/** Early-withdrawal inputs. Public approval signing and transaction execution have distinct wallet identities. */
|
|
19
|
+
export type EarlyWithdrawParameters = Omit<GetTimelockPolicyParameters, "selectors"> & TimelockWriteParameters & {
|
|
20
|
+
withdrawal: EarlyWithdrawalCall;
|
|
21
|
+
provider?: TimelockApprovalProvider;
|
|
22
|
+
/** Optional delegated approval signer. `from` continues to select the execution wallet. */
|
|
23
|
+
approvalSigner?: Address;
|
|
24
|
+
/** Request expiry in Unix seconds, at most one hour ahead. */
|
|
25
|
+
deadline: bigint;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
/** Persist the one issued approval before execution. A persistence failure stops submission. */
|
|
28
|
+
onApproval?: (approval: ValidatedTimelockApproval) => void | Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
/** Submitted transaction, not proof of withdrawal completion. Retain the approval for recovery. */
|
|
31
|
+
export interface EarlyWithdrawResult {
|
|
32
|
+
hash: Hash;
|
|
33
|
+
rootAccount: Address;
|
|
34
|
+
callData: Hex;
|
|
35
|
+
approval: ValidatedTimelockApproval;
|
|
36
|
+
}
|
|
37
|
+
/** Failure after issuance. Reuse/reconcile this approval; never automatically request another. */
|
|
38
|
+
export declare class EarlyWithdrawExecutionError extends Error {
|
|
39
|
+
/** Present when submission returned a hash but receipt confirmation subsequently failed. */
|
|
40
|
+
readonly hash?: Hash;
|
|
41
|
+
readonly approval: ValidatedTimelockApproval;
|
|
42
|
+
readonly callData: Hex;
|
|
43
|
+
constructor(approval: ValidatedTimelockApproval, callData: Hex, cause: unknown, hash?: Hash);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Request one approval and submit one Core withdrawal, retaining the original account inside `_call`.
|
|
47
|
+
* @param config - Provider-neutral SDK config.
|
|
48
|
+
* @param parameters - Raw-unit withdrawal, deployment/provider, signer and normal write controls.
|
|
49
|
+
* @returns Transaction hash and issued approval. Confirm the receipt; Core cooldown/finalization still apply.
|
|
50
|
+
* @remarks Omitted `gasless` inherits the SDK execution policy; explicit `false` selects wallet submission.
|
|
51
|
+
* @example const submitted = await earlyWithdraw(config, { account, withdrawal: { method: "withdraw", amount }, deadline });
|
|
52
|
+
*/
|
|
53
|
+
export declare function earlyWithdraw(config: Config, parameters: EarlyWithdrawParameters): Promise<EarlyWithdrawResult>;
|
|
54
|
+
/** One approval attempt only; even a global mutation retry default cannot repeat issuance. */
|
|
55
|
+
export declare function earlyWithdrawMutationOptions(config: Config): {
|
|
56
|
+
mutationKey: readonly ["earlyWithdraw"];
|
|
57
|
+
retry: false;
|
|
58
|
+
mutationFn: (parameters: EarlyWithdrawParameters) => Promise<EarlyWithdrawResult>;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=early-withdraw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"early-withdraw.d.ts","sourceRoot":"","sources":["../../../src/timelock/early-withdraw/early-withdraw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,OAAO,EAAE,KAAK,IAAI,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AACvG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,KAA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