@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
package/dist/gasless/http.js
CHANGED
|
@@ -1,126 +1,127 @@
|
|
|
1
1
|
import { readHttpHeader as e } from "../shared/utils/http-header.js";
|
|
2
2
|
import { SymmApiError as t, SymmError as n } from "../shared/errors/symm-error.js";
|
|
3
3
|
import { parseGaslessErrorDetail as r } from "./errors.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
import { resolveGaslessService as i } from "./resolve-gasless.js";
|
|
5
|
+
import { toSanitizedApiError as a } from "../shared/errors/sanitized-api-error.js";
|
|
6
|
+
import { assertGaslessUrlServes as o, parseGaslessUrl as s } from "./gasless-url.js";
|
|
7
|
+
import { resolveGaslessRequestHeaders as c } from "./request-headers.js";
|
|
8
|
+
import { GASLESS_SUBMIT_ROUTES as l, GASLESS_SUBMIT_UNCONFIRMED_CODE as u, readGaslessErrorStatus as d } from "./unconfirmed-submit.js";
|
|
9
|
+
import f, { isAxiosError as p } from "axios";
|
|
10
|
+
var m = "x-gaslessq-protocol-instance";
|
|
11
|
+
function h(e, t) {
|
|
12
|
+
let n = e.getChainConfig(t.chainId), r = i(e, { chainId: t.chainId });
|
|
13
|
+
return g(n.chainId, r, t.service);
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
let r =
|
|
16
|
-
|
|
17
|
-
let i = { Accept: "application/json" },
|
|
18
|
-
return
|
|
15
|
+
function g(e, t, n) {
|
|
16
|
+
let r = s(e, t);
|
|
17
|
+
o(e, r, n);
|
|
18
|
+
let i = { Accept: "application/json" }, a = t.apiKey?.trim();
|
|
19
|
+
return a && (i.Authorization = `Bearer ${a}`), {
|
|
19
20
|
baseURL: r.form === "origin" ? `${r.url}/v1/instances/${encodeURIComponent(r.protocolInstance)}/${n}` : r.form === "service-base" ? r.url : `${r.url}/${n}`,
|
|
20
21
|
headers: i,
|
|
22
|
+
service: n,
|
|
23
|
+
...t.getRequestHeaders ? { getRequestHeaders: t.getRequestHeaders } : {},
|
|
21
24
|
protocolInstance: r.protocolInstance,
|
|
22
25
|
requireInstanceHeader: r.form !== "proxy-root",
|
|
23
26
|
submitTimeoutMs: t.execution?.submitTimeoutMs ?? 3e4,
|
|
24
27
|
chainId: e
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
|
-
function
|
|
28
|
-
let r =
|
|
29
|
-
if (r !== null) throw new n("api", "GASLESS_INSTANCE_MISMATCH",
|
|
30
|
+
function _(e, t) {
|
|
31
|
+
let r = v(e, t);
|
|
32
|
+
if (r !== null) throw new n("api", "GASLESS_INSTANCE_MISMATCH", y(e, r));
|
|
30
33
|
}
|
|
31
|
-
function
|
|
34
|
+
function v(t, n) {
|
|
32
35
|
let r = t.protocolInstance;
|
|
33
36
|
if (!r) return null;
|
|
34
|
-
let i = e(n.headers,
|
|
37
|
+
let i = e(n.headers, m);
|
|
35
38
|
return i === void 0 && !t.requireInstanceHeader || i === r ? null : i ?? "<missing>";
|
|
36
39
|
}
|
|
37
|
-
function
|
|
40
|
+
function y(e, t) {
|
|
38
41
|
return `Gasless: the response came from protocol instance "${t}", but chain ${e.chainId} expects "${e.protocolInstance}". Check the gasless url / protocolInstance pairing.`;
|
|
39
42
|
}
|
|
40
|
-
function
|
|
43
|
+
function b(e) {
|
|
41
44
|
return !(e instanceof t) || e.code !== "GASLESS_INSTANCE_MISMATCH" ? !1 : e.status >= 200 && e.status < 300;
|
|
42
45
|
}
|
|
43
|
-
async function
|
|
46
|
+
async function x(e, t, n, r = {}) {
|
|
44
47
|
try {
|
|
45
|
-
let n = await
|
|
48
|
+
let n = await f.get(t, {
|
|
46
49
|
baseURL: e.baseURL,
|
|
47
|
-
headers: e
|
|
50
|
+
headers: await c(e, "GET"),
|
|
48
51
|
signal: r.signal
|
|
49
52
|
});
|
|
50
|
-
return
|
|
53
|
+
return _(e, n), n.data;
|
|
51
54
|
} catch (t) {
|
|
52
|
-
throw
|
|
55
|
+
throw D(t, e, n);
|
|
53
56
|
}
|
|
54
57
|
}
|
|
55
|
-
function
|
|
58
|
+
function S(e) {
|
|
56
59
|
return new Promise((t) => setTimeout(t, e));
|
|
57
60
|
}
|
|
58
|
-
function
|
|
61
|
+
function C(e, t = Math.random) {
|
|
59
62
|
return Math.max(e ?? 0, 1e3 + Math.floor(t() * 1e3));
|
|
60
63
|
}
|
|
61
|
-
async function
|
|
64
|
+
async function w(e, t, n, r) {
|
|
62
65
|
try {
|
|
63
|
-
return await
|
|
66
|
+
return await f.post(t, n, {
|
|
64
67
|
baseURL: e.baseURL,
|
|
65
|
-
headers:
|
|
66
|
-
...e.headers,
|
|
67
|
-
"Content-Type": "application/json"
|
|
68
|
-
},
|
|
68
|
+
headers: await c(e, "POST"),
|
|
69
69
|
timeout: e.submitTimeoutMs
|
|
70
70
|
});
|
|
71
71
|
} catch (t) {
|
|
72
|
-
throw
|
|
72
|
+
throw D(t, e, r);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
async function
|
|
76
|
-
let { service:
|
|
75
|
+
async function T(e, n, r, i, a = {}) {
|
|
76
|
+
let { service: o, code: s } = l[n], c = Date.now() + e.submitTimeoutMs, u = 0, d = 0, f = a.replay ?? !1;
|
|
77
77
|
for (;;) {
|
|
78
|
-
let
|
|
78
|
+
let a;
|
|
79
79
|
try {
|
|
80
|
-
|
|
81
|
-
} catch (
|
|
82
|
-
let
|
|
83
|
-
if (
|
|
84
|
-
let e =
|
|
85
|
-
if (
|
|
86
|
-
|
|
80
|
+
a = await w(e, n, r, s);
|
|
81
|
+
} catch (a) {
|
|
82
|
+
let s = O(a);
|
|
83
|
+
if (s === "rate-limited" || s === "gateway-not-ready") {
|
|
84
|
+
let e = C(a instanceof t ? a.retryAfterMs : null);
|
|
85
|
+
if (u < 2 && Date.now() + e <= c) {
|
|
86
|
+
u += 1, await S(e);
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
|
|
90
|
+
if (s === "ambiguous" && d === 0) {
|
|
91
|
+
d += 1, f = !0, await S(C(null));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
throw f ? E(e, {
|
|
95
|
+
service: o,
|
|
92
96
|
path: n,
|
|
93
97
|
body: r,
|
|
94
98
|
idempotencyKey: i
|
|
95
|
-
},
|
|
96
|
-
if (c !== "ambiguous") throw o;
|
|
97
|
-
u = !0, await x(S(null));
|
|
98
|
-
continue;
|
|
99
|
+
}, a) : a;
|
|
99
100
|
}
|
|
100
|
-
let
|
|
101
|
-
if (
|
|
101
|
+
let l = v(e, a);
|
|
102
|
+
if (l !== null) throw new t({
|
|
102
103
|
code: "GASLESS_INSTANCE_MISMATCH",
|
|
103
|
-
message: `${
|
|
104
|
-
status:
|
|
105
|
-
statusText:
|
|
106
|
-
responseData:
|
|
104
|
+
message: `${y(e, l)} The submit was accepted there, so reconcile the request id in responseData before submitting anything else.`,
|
|
105
|
+
status: a.status,
|
|
106
|
+
statusText: a.statusText,
|
|
107
|
+
responseData: a.data,
|
|
107
108
|
url: `${e.baseURL}${n}`,
|
|
108
109
|
method: "POST"
|
|
109
110
|
});
|
|
110
|
-
let
|
|
111
|
-
if (typeof
|
|
112
|
-
service:
|
|
111
|
+
let p = a.data?.request_id;
|
|
112
|
+
if (typeof p != "string" || p.length === 0) throw E(e, {
|
|
113
|
+
service: o,
|
|
113
114
|
path: n,
|
|
114
115
|
body: r,
|
|
115
116
|
idempotencyKey: i
|
|
116
117
|
});
|
|
117
|
-
return
|
|
118
|
+
return a.data;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
120
|
-
function
|
|
121
|
-
let i =
|
|
121
|
+
function E(e, n, r) {
|
|
122
|
+
let i = d(r) ?? 0;
|
|
122
123
|
return new t({
|
|
123
|
-
code:
|
|
124
|
+
code: u,
|
|
124
125
|
message: `Gasless: the submit to ${n.path} on chain ${e.chainId} could not be confirmed${i === 0 ? " (no response)" : ` (last status ${i})`}, so the service may already be executing it. Resend the recorded body under idempotency key ${n.idempotencyKey} with resubmitGaslessRequest — never re-run this intent through the wallet.`,
|
|
125
126
|
status: i,
|
|
126
127
|
statusText: r instanceof t ? r.statusText : "",
|
|
@@ -133,14 +134,14 @@ function T(e, n, r) {
|
|
|
133
134
|
cause: r instanceof Error ? r : void 0
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
return e instanceof n ? e :
|
|
137
|
+
function D(e, t, r) {
|
|
138
|
+
return e instanceof n ? e : p(e) ? a(e, {
|
|
138
139
|
code: r,
|
|
139
140
|
baseURL: t.baseURL
|
|
140
141
|
}) : new n("api", r, `Gasless request failed: ${e instanceof Error ? e.message : String(e)}`, { cause: e instanceof Error ? e : void 0 });
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
-
let t =
|
|
143
|
+
function O(e) {
|
|
144
|
+
let t = d(e);
|
|
144
145
|
if (t === void 0) return null;
|
|
145
146
|
let n = typeof r(e)?.gatewayError == "string";
|
|
146
147
|
switch (t) {
|
|
@@ -156,10 +157,7 @@ function D(e) {
|
|
|
156
157
|
default: return t >= 500 ? "ambiguous" : "service";
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
|
-
function O() {
|
|
160
|
-
return globalThis.crypto.randomUUID();
|
|
161
|
-
}
|
|
162
160
|
//#endregion
|
|
163
|
-
export {
|
|
161
|
+
export { g as buildGaslessHttpContext, O as classifyGaslessHttpStatus, x as gaslessGet, b as isGaslessAcceptedInstanceMismatchError, T as postGaslessSubmit, h as resolveGaslessHttp };
|
|
164
162
|
|
|
165
163
|
//# sourceMappingURL=http.js.map
|
package/dist/gasless/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","names":[],"sources":["../../src/gasless/http.ts"],"sourcesContent":["import axios, { isAxiosError, type AxiosResponse } from \"axios\";\nimport type { SymmioGaslessConfig } from \"../core/chains/types\";\nimport type { Config } from \"../core/config\";\nimport { toSanitizedApiError } from \"../shared/errors/sanitized-api-error\";\nimport { SymmApiError, SymmError } from \"../shared/errors/symm-error\";\nimport { readHttpHeader } from \"../shared/utils/http-header\";\nimport { parseGaslessErrorDetail } from \"./errors\";\nimport { assertGaslessUrlServes, parseGaslessUrl } from \"./gasless-url\";\nimport { resolveGaslessService } from \"./resolve-gasless\";\nimport type { GaslessService } from \"./types\";\nimport {\n GASLESS_SUBMIT_ROUTES,\n GASLESS_SUBMIT_UNCONFIRMED_CODE,\n readGaslessErrorStatus,\n type GaslessSubmitPath,\n type GaslessUnconfirmedSubmit,\n} from \"./unconfirmed-submit\";\n\n/** Default HTTP timeout for a gasless submit (`execution.submitTimeoutMs`). @internal */\nexport const GASLESS_SUBMIT_TIMEOUT_MS = 30_000;\n\n/**\n * How many times a submit the gateway itself refused (`429`, or a `503`\n * carrying its `{ error }` envelope) is retried under the same idempotency key.\n * Both mean the request never reached the service, so a retry cannot duplicate\n * anything — the bound exists to keep a submit from outliving its caller.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_THROTTLE_RETRIES = 2;\n\n/** The response header the gateway stamps with the protocol instance that answered. @internal */\nexport const GASLESS_PROTOCOL_INSTANCE_HEADER = \"x-gaslessq-protocol-instance\";\n\n/**\n * A resolved gasless HTTP context for one `(chain, service)` pair: the final\n * per-service base URL, the request headers, and the protocol instance the\n * responses must come from.\n *\n * @internal\n */\nexport interface GaslessHttpContext {\n /** Final service base, e.g. `…/v1/instances/<protocol-instance>/operations`. */\n baseURL: string;\n /** Request headers: `Accept`, plus `Authorization: Bearer …` only when an `apiKey` is configured. */\n headers: Record<string, string>;\n /**\n * The protocol instance responses are asserted against, or `null` when the\n * config names none (a proxy root without `protocolInstance`).\n */\n protocolInstance: string | null;\n /**\n * Whether a response must carry the instance header. `true` for the gateway\n * URL forms, where the gateway itself stamps every routed response; `false`\n * for a proxy root, which may not forward the header, so only a header that\n * is present is checked.\n */\n requireInstanceHeader: boolean;\n /** HTTP timeout applied to submits (POSTs), in ms. */\n submitTimeoutMs: number;\n /** The chain the context was resolved for (for error messages and events). */\n chainId: number;\n}\n\n/**\n * Derive the per-service base URL from a chain's gasless config.\n *\n * The `url` forms are parsed by `parseGaslessUrl`:\n * - a gateway **origin** — the SDK appends\n * `/v1/instances/{protocolInstance}/{service}`;\n * - an **instance root** — the SDK appends `/{service}`;\n * - an instance-pinned **service base** — used as-is, and it must match the\n * requested service;\n * - a **proxy root** — the SDK appends `/{service}`.\n *\n * @internal\n */\nexport function resolveGaslessHttp(\n config: Config,\n parameters: { chainId?: number; service: GaslessService },\n): GaslessHttpContext {\n const chain = config.getChainConfig(parameters.chainId);\n const gasless = resolveGaslessService(config, { chainId: parameters.chainId });\n return buildGaslessHttpContext(chain.chainId, gasless, parameters.service);\n}\n\n/**\n * Build a {@link GaslessHttpContext} from an already-resolved gasless block.\n *\n * Anonymous access is the default: the `Authorization` header is omitted\n * entirely unless a non-blank `apiKey` is configured.\n *\n * @internal\n */\nexport function buildGaslessHttpContext(\n chainId: number,\n gasless: SymmioGaslessConfig,\n service: GaslessService,\n): GaslessHttpContext {\n const url = parseGaslessUrl(chainId, gasless);\n assertGaslessUrlServes(chainId, url, service);\n\n const headers: Record<string, string> = { Accept: \"application/json\" };\n const apiKey = gasless.apiKey?.trim();\n if (apiKey) headers.Authorization = `Bearer ${apiKey}`;\n\n const baseURL =\n url.form === \"origin\"\n ? `${url.url}/v1/instances/${encodeURIComponent(url.protocolInstance)}/${service}`\n : url.form === \"service-base\"\n ? url.url\n : `${url.url}/${service}`;\n\n return {\n baseURL,\n headers,\n protocolInstance: url.protocolInstance,\n requireInstanceHeader: url.form !== \"proxy-root\",\n submitTimeoutMs: gasless.execution?.submitTimeoutMs ?? GASLESS_SUBMIT_TIMEOUT_MS,\n chainId,\n };\n}\n\n/**\n * Assert that a successful response came from the expected protocol instance.\n * The gateway stamps `X-GasLessQ-Protocol-Instance` on every response it\n * routes. A mismatch means a different deployment answered (a\n * staging/production cross-wire), and the response must not be trusted.\n *\n * Gateway URL forms fail closed on a missing header too. A proxy root only\n * fails on a header that is present and wrong, since a proxy may not forward\n * it.\n *\n * @internal\n * @throws {SymmError} `GASLESS_INSTANCE_MISMATCH`\n */\nexport function assertGaslessInstance(context: GaslessHttpContext, response: AxiosResponse): void {\n const actual = readGaslessInstanceMismatch(context, response);\n if (actual === null) return;\n throw new SymmError(\"api\", \"GASLESS_INSTANCE_MISMATCH\", gaslessInstanceMismatchMessage(context, actual));\n}\n\n/**\n * The instance a response was stamped with when it is **not** the expected one,\n * or `null` when the response is trustworthy. `\"<missing>\"` stands for a\n * gateway response that carried no header at all.\n */\nfunction readGaslessInstanceMismatch(context: GaslessHttpContext, response: AxiosResponse): string | null {\n const expected = context.protocolInstance;\n if (!expected) return null;\n const actual = readHttpHeader(response.headers, GASLESS_PROTOCOL_INSTANCE_HEADER);\n if (actual === undefined && !context.requireInstanceHeader) return null;\n return actual === expected ? null : (actual ?? \"<missing>\");\n}\n\nfunction gaslessInstanceMismatchMessage(context: GaslessHttpContext, actual: string): string {\n return `Gasless: the response came from protocol instance \"${actual}\", but chain ${context.chainId} expects \"${context.protocolInstance}\". Check the gasless url / protocolInstance pairing.`;\n}\n\n/**\n * Whether an error is a `GASLESS_INSTANCE_MISMATCH` on a response the gateway\n * **accepted** (a `2xx`) — the submit created a workflow somewhere, on a\n * deployment this config does not address.\n *\n * Nothing about it can be trusted except that it happened, so it is never\n * grounds for a wallet-paid retry, and any signature it consumed must be\n * treated as spent.\n *\n * @internal\n */\nexport function isGaslessAcceptedInstanceMismatchError(err: unknown): boolean {\n if (!(err instanceof SymmApiError) || err.code !== \"GASLESS_INSTANCE_MISMATCH\") return false;\n return err.status >= 200 && err.status < 300;\n}\n\n/**\n * Perform a gasless GET and normalize failures into the house error shape.\n *\n * @param context - The resolved HTTP context for the call's service.\n * @param path - The path under the service base.\n * @param code - The SDK error code a failure is reported under.\n * @param options - `signal` cancels the request in flight — pass TanStack's\n * query signal, or the caller's own, so a poll nobody is waiting for stops\n * spending the deployment's shared request budget.\n *\n * @internal\n */\nexport async function gaslessGet<data>(\n context: GaslessHttpContext,\n path: string,\n code: string,\n options: { signal?: AbortSignal } = {},\n): Promise<data> {\n try {\n const response = await axios.get<data>(path, {\n baseURL: context.baseURL,\n headers: context.headers,\n signal: options.signal,\n });\n assertGaslessInstance(context, response);\n return response.data;\n } catch (err) {\n throw toGaslessError(err, context, code);\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * How long to wait before resending a submit, whether the gateway refused it or\n * its outcome is unknown.\n *\n * `Retry-After` is honored when the gateway sent one and the browser was\n * allowed to read it, but never trusted as a floor of zero: a cross-origin page\n * usually sees `null`, and hammering a throttled gateway is what earned the\n * `429`. So the wait is at least a jittered second, and the jitter keeps a\n * page's concurrent workflows from retrying in lockstep.\n *\n * @param retryAfterMs - The server's requested delay, or `null` when unknown.\n * @param random - Injectable `Math.random`, for deterministic tests.\n * @returns The delay in ms.\n *\n * @internal\n */\nexport function gaslessSubmitRetryDelay(retryAfterMs: number | null, random: () => number = Math.random): number {\n return Math.max(retryAfterMs ?? 0, 1_000 + Math.floor(random() * 1_000));\n}\n\n/** One POST attempt: the axios call plus the house error normalization. */\nasync function postGaslessOnce<data>(\n context: GaslessHttpContext,\n path: string,\n body: unknown,\n code: string,\n): Promise<AxiosResponse<data>> {\n try {\n return await axios.post<data>(path, body, {\n baseURL: context.baseURL,\n headers: { ...context.headers, \"Content-Type\": \"application/json\" },\n timeout: context.submitTimeoutMs,\n });\n } catch (err) {\n throw toGaslessError(err, context, code);\n }\n}\n\n/**\n * POST one gasless **submit** — the only gasless call that can leave a side\n * effect behind when its response is lost — and decide, for every outcome,\n * whether the service can have accepted it.\n *\n * Three dispositions, all under the caller's single idempotency key (the vendor\n * returns the existing record for a byte-identical resend, so reusing the key\n * can never double-execute; a *changed* payload needs a fresh one):\n *\n * - **Refused by the gateway** (`429`, or a `503` carrying its `{ error }`\n * envelope): the request never reached the service. Resent up to\n * {@link GASLESS_SUBMIT_THROTTLE_RETRIES} times after\n * {@link gaslessSubmitRetryDelay}, while the wait still fits inside\n * `execution.submitTimeoutMs`. Exhausted, the gateway's own error is thrown —\n * the one submit failure that is provably *not* accepted, and so the only one\n * a wallet-paid retry may follow.\n * - **Ambiguous** (no response, a timeout, or a `5xx` without the gateway\n * envelope): the service may or may not have accepted it. Resent **once**,\n * after a {@link gaslessSubmitRetryDelay} backoff, then thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` carrying the exact bytes that were sent, so the\n * caller can persist them and replay them later with `resubmitGaslessRequest`.\n * Never a rejection, and never grounds for a wallet retry. The backoff is the\n * vendor's: a resend that races the first attempt's insert can be answered with\n * a `5xx` instead of the record that insert created.\n * - **Answered** (any other status, or a `2xx`): thrown as-is, or returned. A\n * `2xx` without a `request_id` is unconfirmed too — the workflow exists and\n * nothing identifies it. A `2xx` from the wrong protocol instance throws\n * `GASLESS_INSTANCE_MISMATCH` with the parsed body kept in `responseData`,\n * because the `request_id` in it is the only handle on a request that was\n * accepted somewhere.\n *\n * An ambiguous attempt decides every failure after it. A gateway refusal of the\n * resend, or a service verdict on it, describes only the resend — the first\n * attempt may already be executing — so it is thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` with that failure as its `cause`. Thrown as-is,\n * a `429` would read as provably not accepted, and a wallet-paid retry would\n * execute the intent twice.\n *\n * @param context - The resolved HTTP context for the submit's service.\n * @param path - The submit route (see {@link GASLESS_SUBMIT_ROUTES}).\n * @param body - The exact JSON body to send.\n * @param idempotencyKey - The key inside `body`, recorded on an unconfirmed submit.\n * @returns The acceptance body.\n *\n * @internal\n */\nexport async function postGaslessSubmit<data extends { request_id?: string | null }>(\n context: GaslessHttpContext,\n path: GaslessSubmitPath,\n body: unknown,\n idempotencyKey: string,\n): Promise<data> {\n const { service, code } = GASLESS_SUBMIT_ROUTES[path];\n const retriesEndAt = Date.now() + context.submitTimeoutMs;\n let throttleRetries = 0;\n /** Set once an attempt failed ambiguously: the service may hold that attempt. */\n let mayBeAccepted = false;\n\n for (;;) {\n let response: AxiosResponse<data>;\n try {\n response = await postGaslessOnce<data>(context, path, body, code);\n } catch (err) {\n const failure = classifyGaslessHttpStatus(err);\n\n if (failure === \"rate-limited\" || failure === \"gateway-not-ready\") {\n const delay = gaslessSubmitRetryDelay(err instanceof SymmApiError ? err.retryAfterMs : null);\n if (throttleRetries < GASLESS_SUBMIT_THROTTLE_RETRIES && Date.now() + delay <= retriesEndAt) {\n throttleRetries += 1;\n await sleep(delay);\n continue;\n }\n }\n\n /**\n * An answer speaks only for the attempt it came back for. Once an\n * earlier attempt was ambiguous, that attempt may be executing whatever\n * this one was told, so the failure is unconfirmed, never a rejection.\n */\n if (mayBeAccepted) throw unconfirmedGaslessSubmitError(context, { service, path, body, idempotencyKey }, err);\n if (failure !== \"ambiguous\") throw err;\n\n /**\n * The vendor's prescribed recovery for a lost response: resend the\n * identical request under the same key, after a backoff, which either\n * lands it or returns the record it already created.\n */\n mayBeAccepted = true;\n await sleep(gaslessSubmitRetryDelay(null));\n continue;\n }\n\n const mismatch = readGaslessInstanceMismatch(context, response);\n if (mismatch !== null) {\n throw new SymmApiError({\n code: \"GASLESS_INSTANCE_MISMATCH\",\n message: `${gaslessInstanceMismatchMessage(context, mismatch)} The submit was accepted there, so reconcile the request id in responseData before submitting anything else.`,\n status: response.status,\n statusText: response.statusText,\n responseData: response.data,\n url: `${context.baseURL}${path}`,\n method: \"POST\",\n });\n }\n\n const requestId = response.data?.request_id;\n if (typeof requestId !== \"string\" || requestId.length === 0) {\n throw unconfirmedGaslessSubmitError(context, { service, path, body, idempotencyKey });\n }\n return response.data;\n }\n}\n\n/**\n * Build the `GASLESS_SUBMIT_UNCONFIRMED` error, whose `responseData` is the\n * replayable {@link GaslessUnconfirmedSubmit} rather than a response body —\n * there is no trustworthy response body, and the bytes that were sent are the\n * only thing that can recover the workflow.\n */\nfunction unconfirmedGaslessSubmitError(\n context: GaslessHttpContext,\n submit: Omit<GaslessUnconfirmedSubmit, \"chainId\">,\n cause?: unknown,\n): SymmApiError {\n const status = readGaslessErrorStatus(cause) ?? 0;\n return new SymmApiError({\n code: GASLESS_SUBMIT_UNCONFIRMED_CODE,\n message: `Gasless: the submit to ${submit.path} on chain ${context.chainId} could not be confirmed${status === 0 ? \" (no response)\" : ` (last status ${status})`}, so the service may already be executing it. Resend the recorded body under idempotency key ${submit.idempotencyKey} with resubmitGaslessRequest — never re-run this intent through the wallet.`,\n status,\n statusText: cause instanceof SymmApiError ? cause.statusText : \"\",\n responseData: { chainId: context.chainId, ...submit } satisfies GaslessUnconfirmedSubmit,\n url: `${context.baseURL}${submit.path}`,\n method: \"POST\",\n cause: cause instanceof Error ? cause : undefined,\n });\n}\n\n/**\n * The canonical 3-branch error normalization every gasless HTTP call shares.\n *\n * An axios failure becomes a `SymmApiError` whose `cause` is a sanitized\n * snapshot (see `toSanitizedApiError`), never the axios error itself. That\n * error's request config holds the `Authorization` header and the signed body,\n * so the `apiKey` cannot leak through a logged or serialized error.\n * `responseData` stays the raw response body.\n *\n * @internal\n */\nexport function toGaslessError(err: unknown, context: GaslessHttpContext, code: string): Error {\n if (err instanceof SymmError) return err;\n if (isAxiosError(err)) return toSanitizedApiError(err, { code, baseURL: context.baseURL });\n return new SymmError(\"api\", code, `Gasless request failed: ${err instanceof Error ? err.message : String(err)}`, {\n cause: err instanceof Error ? err : undefined,\n });\n}\n\n/**\n * How a failed gasless HTTP call was disposed of, from the status and, where\n * the gateway overloads a status, from the body: the gateway's own\n * `{ \"error\": \"…\" }` envelope versus a service `{ \"detail\": … }` body.\n *\n * - `\"rate-limited\"` — `429`: dropped at the gateway, never forwarded.\n * - `\"gateway-not-ready\"` — `503` with the gateway envelope: its configuration is not ready.\n * - `\"unauthorized\"` / `\"forbidden\"` — `401` / `403`: credentials rejected, or not allowed for this instance or service.\n * - `\"unknown-instance\"` — `404` with the gateway envelope: no such instance or service route.\n * - `\"selector-conflict\"` — `400` with the gateway envelope: the URL and the instance selector disagree.\n * - `\"client-schema\"` — `422`: the service rejected the payload shape (a client bug).\n * - `\"ambiguous\"` — no response (network failure or timeout), `408`, or any other `5xx`: the request may or may not have reached the service.\n * - `\"service\"` — any other status: the service answered with its own verdict (`detail.code`).\n *\n * @internal\n */\nexport type GaslessHttpFailureClass =\n | \"rate-limited\"\n | \"gateway-not-ready\"\n | \"unauthorized\"\n | \"forbidden\"\n | \"unknown-instance\"\n | \"selector-conflict\"\n | \"client-schema\"\n | \"ambiguous\"\n | \"service\";\n\n/**\n * Classify a failed gasless HTTP call — see {@link GaslessHttpFailureClass}.\n *\n * The status is read structurally, so an error a framework layer re-wrapped\n * (`@symmio/trading-react`'s `SymmioRequestError`, which copies `status` and\n * `responseData`) classifies exactly like the `SymmApiError` underneath it.\n *\n * @param err - Anything caught from a gasless HTTP call.\n * @returns The class, or `null` when `err` carries no HTTP status.\n *\n * @internal\n */\nexport function classifyGaslessHttpStatus(err: unknown): GaslessHttpFailureClass | null {\n const status = readGaslessErrorStatus(err);\n if (status === undefined) return null;\n const fromGateway = typeof parseGaslessErrorDetail(err)?.gatewayError === \"string\";\n switch (status) {\n case 0:\n case 408:\n return \"ambiguous\";\n case 401:\n return \"unauthorized\";\n case 403:\n return \"forbidden\";\n case 422:\n return \"client-schema\";\n case 429:\n return \"rate-limited\";\n case 400:\n return fromGateway ? \"selector-conflict\" : \"service\";\n case 404:\n return fromGateway ? \"unknown-instance\" : \"service\";\n case 503:\n return fromGateway ? \"gateway-not-ready\" : \"ambiguous\";\n default:\n return status >= 500 ? \"ambiguous\" : \"service\";\n }\n}\n\n/**\n * Generate a random idempotency key for one gasless submit. Reuse the same key\n * only when retrying the byte-identical request; any change to the payload\n * needs a fresh key.\n */\nexport function generateGaslessIdempotencyKey(): string {\n return globalThis.crypto.randomUUID();\n}\n"],"mappings":";;;;;;;;AAgCA,IAAa,IAAmC;AA6ChD,SAA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,GAAM,2BAA2B,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,KAAK,EAC/G,OAAO,aAAe,QAAQ,IAAM,KAAA,EACtC,CAAC;AACH;AAyCA,SAAgB,EAA0B,GAA8C;CACtF,IAAM,IAAS,EAAuB,CAAG;CACzC,IAAI,MAAW,KAAA,GAAW,OAAO;CACjC,IAAM,IAAc,OAAO,EAAwB,CAAG,GAAG,gBAAiB;CAC1E,QAAQ,GAAR;EACE,KAAK;EACL,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO,IAAc,sBAAsB;EAC7C,KAAK,KACH,OAAO,IAAc,qBAAqB;EAC5C,KAAK,KACH,OAAO,IAAc,sBAAsB;EAC7C,SACE,OAAO,KAAU,MAAM,cAAc;CACzC;AACF;AAOA,SAAgB,IAAwC;CACtD,OAAO,WAAW,OAAO,WAAW;AACtC"}
|
|
1
|
+
{"version":3,"file":"http.js","names":[],"sources":["../../src/gasless/http.ts"],"sourcesContent":["import axios, { isAxiosError, type AxiosResponse } from \"axios\";\nimport type { SymmioGaslessConfig } from \"../core/chains/types\";\nimport type { Config } from \"../core/config\";\nimport { toSanitizedApiError } from \"../shared/errors/sanitized-api-error\";\nimport { SymmApiError, SymmError } from \"../shared/errors/symm-error\";\nimport { readHttpHeader } from \"../shared/utils/http-header\";\nimport { parseGaslessErrorDetail } from \"./errors\";\nimport { assertGaslessUrlServes, parseGaslessUrl } from \"./gasless-url\";\nimport { resolveGaslessRequestHeaders } from \"./request-headers\";\nimport { resolveGaslessService } from \"./resolve-gasless\";\nimport type { GaslessService } from \"./types\";\nimport {\n GASLESS_SUBMIT_ROUTES,\n GASLESS_SUBMIT_UNCONFIRMED_CODE,\n readGaslessErrorStatus,\n type GaslessSubmitPath,\n type GaslessUnconfirmedSubmit,\n} from \"./unconfirmed-submit\";\n\n/** Default HTTP timeout for a gasless submit (`execution.submitTimeoutMs`). @internal */\nexport const GASLESS_SUBMIT_TIMEOUT_MS = 30_000;\n\n/**\n * How many times a submit the gateway itself refused (`429`, or a `503`\n * carrying its `{ error }` envelope) is retried under the same idempotency key.\n * Both mean the request never reached the service, so a retry cannot duplicate\n * anything — the bound exists to keep a submit from outliving its caller.\n *\n * @internal\n */\nexport const GASLESS_SUBMIT_THROTTLE_RETRIES = 2;\n\n/** The response header the gateway stamps with the protocol instance that answered. @internal */\nexport const GASLESS_PROTOCOL_INSTANCE_HEADER = \"x-gaslessq-protocol-instance\";\n\n/**\n * A resolved gasless HTTP context for one `(chain, service)` pair: the final\n * per-service base URL, the request headers, and the protocol instance the\n * responses must come from.\n *\n * @internal\n */\nexport interface GaslessHttpContext {\n /** Sub-service and fresh application authentication for each HTTP attempt. */\n service: GaslessService;\n getRequestHeaders?: SymmioGaslessConfig[\"getRequestHeaders\"];\n /** Final service base, e.g. `…/v1/instances/<protocol-instance>/operations`. */\n baseURL: string;\n /** Request headers: `Accept`, plus `Authorization: Bearer …` only when an `apiKey` is configured. */\n headers: Record<string, string>;\n /**\n * The protocol instance responses are asserted against, or `null` when the\n * config names none (a proxy root without `protocolInstance`).\n */\n protocolInstance: string | null;\n /**\n * Whether a response must carry the instance header. `true` for the gateway\n * URL forms, where the gateway itself stamps every routed response; `false`\n * for a proxy root, which may not forward the header, so only a header that\n * is present is checked.\n */\n requireInstanceHeader: boolean;\n /** HTTP timeout applied to submits (POSTs), in ms. */\n submitTimeoutMs: number;\n /** The chain the context was resolved for (for error messages and events). */\n chainId: number;\n}\n\n/**\n * Derive the per-service base URL from a chain's gasless config.\n *\n * The `url` forms are parsed by `parseGaslessUrl`:\n * - a gateway **origin** — the SDK appends\n * `/v1/instances/{protocolInstance}/{service}`;\n * - an **instance root** — the SDK appends `/{service}`;\n * - an instance-pinned **service base** — used as-is, and it must match the\n * requested service;\n * - a **proxy root** — the SDK appends `/{service}`.\n *\n * @internal\n */\nexport function resolveGaslessHttp(\n config: Config,\n parameters: { chainId?: number; service: GaslessService },\n): GaslessHttpContext {\n const chain = config.getChainConfig(parameters.chainId);\n const gasless = resolveGaslessService(config, { chainId: parameters.chainId });\n return buildGaslessHttpContext(chain.chainId, gasless, parameters.service);\n}\n\n/**\n * Build a {@link GaslessHttpContext} from an already-resolved gasless block.\n *\n * Anonymous access is the default: the `Authorization` header is omitted\n * entirely unless a non-blank `apiKey` is configured.\n *\n * @internal\n */\nexport function buildGaslessHttpContext(\n chainId: number,\n gasless: SymmioGaslessConfig,\n service: GaslessService,\n): GaslessHttpContext {\n const url = parseGaslessUrl(chainId, gasless);\n assertGaslessUrlServes(chainId, url, service);\n\n const headers: Record<string, string> = { Accept: \"application/json\" };\n const apiKey = gasless.apiKey?.trim();\n if (apiKey) headers.Authorization = `Bearer ${apiKey}`;\n\n const baseURL =\n url.form === \"origin\"\n ? `${url.url}/v1/instances/${encodeURIComponent(url.protocolInstance)}/${service}`\n : url.form === \"service-base\"\n ? url.url\n : `${url.url}/${service}`;\n\n return {\n baseURL,\n headers,\n service,\n ...(gasless.getRequestHeaders ? { getRequestHeaders: gasless.getRequestHeaders } : {}),\n protocolInstance: url.protocolInstance,\n requireInstanceHeader: url.form !== \"proxy-root\",\n submitTimeoutMs: gasless.execution?.submitTimeoutMs ?? GASLESS_SUBMIT_TIMEOUT_MS,\n chainId,\n };\n}\n\n/**\n * Assert that a successful response came from the expected protocol instance.\n * The gateway stamps `X-GasLessQ-Protocol-Instance` on every response it\n * routes. A mismatch means a different deployment answered (a\n * staging/production cross-wire), and the response must not be trusted.\n *\n * Gateway URL forms fail closed on a missing header too. A proxy root only\n * fails on a header that is present and wrong, since a proxy may not forward\n * it.\n *\n * @internal\n * @throws {SymmError} `GASLESS_INSTANCE_MISMATCH`\n */\nexport function assertGaslessInstance(context: GaslessHttpContext, response: AxiosResponse): void {\n const actual = readGaslessInstanceMismatch(context, response);\n if (actual === null) return;\n throw new SymmError(\"api\", \"GASLESS_INSTANCE_MISMATCH\", gaslessInstanceMismatchMessage(context, actual));\n}\n\n/**\n * The instance a response was stamped with when it is **not** the expected one,\n * or `null` when the response is trustworthy. `\"<missing>\"` stands for a\n * gateway response that carried no header at all.\n */\nfunction readGaslessInstanceMismatch(context: GaslessHttpContext, response: AxiosResponse): string | null {\n const expected = context.protocolInstance;\n if (!expected) return null;\n const actual = readHttpHeader(response.headers, GASLESS_PROTOCOL_INSTANCE_HEADER);\n if (actual === undefined && !context.requireInstanceHeader) return null;\n return actual === expected ? null : (actual ?? \"<missing>\");\n}\n\nfunction gaslessInstanceMismatchMessage(context: GaslessHttpContext, actual: string): string {\n return `Gasless: the response came from protocol instance \"${actual}\", but chain ${context.chainId} expects \"${context.protocolInstance}\". Check the gasless url / protocolInstance pairing.`;\n}\n\n/**\n * Whether an error is a `GASLESS_INSTANCE_MISMATCH` on a response the gateway\n * **accepted** (a `2xx`) — the submit created a workflow somewhere, on a\n * deployment this config does not address.\n *\n * Nothing about it can be trusted except that it happened, so it is never\n * grounds for a wallet-paid retry, and any signature it consumed must be\n * treated as spent.\n *\n * @internal\n */\nexport function isGaslessAcceptedInstanceMismatchError(err: unknown): boolean {\n if (!(err instanceof SymmApiError) || err.code !== \"GASLESS_INSTANCE_MISMATCH\") return false;\n return err.status >= 200 && err.status < 300;\n}\n\n/**\n * Perform a gasless GET and normalize failures into the house error shape.\n *\n * @param context - The resolved HTTP context for the call's service.\n * @param path - The path under the service base.\n * @param code - The SDK error code a failure is reported under.\n * @param options - `signal` cancels the request in flight — pass TanStack's\n * query signal, or the caller's own, so a poll nobody is waiting for stops\n * spending the deployment's shared request budget.\n *\n * @internal\n */\nexport async function gaslessGet<data>(\n context: GaslessHttpContext,\n path: string,\n code: string,\n options: { signal?: AbortSignal } = {},\n): Promise<data> {\n try {\n const response = await axios.get<data>(path, {\n baseURL: context.baseURL,\n headers: await resolveGaslessRequestHeaders(context, \"GET\"),\n signal: options.signal,\n });\n assertGaslessInstance(context, response);\n return response.data;\n } catch (err) {\n throw toGaslessError(err, context, code);\n }\n}\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\n/**\n * How long to wait before resending a submit, whether the gateway refused it or\n * its outcome is unknown.\n *\n * `Retry-After` is honored when the gateway sent one and the browser was\n * allowed to read it, but never trusted as a floor of zero: a cross-origin page\n * usually sees `null`, and hammering a throttled gateway is what earned the\n * `429`. So the wait is at least a jittered second, and the jitter keeps a\n * page's concurrent workflows from retrying in lockstep.\n *\n * @param retryAfterMs - The server's requested delay, or `null` when unknown.\n * @param random - Injectable `Math.random`, for deterministic tests.\n * @returns The delay in ms.\n *\n * @internal\n */\nexport function gaslessSubmitRetryDelay(retryAfterMs: number | null, random: () => number = Math.random): number {\n return Math.max(retryAfterMs ?? 0, 1_000 + Math.floor(random() * 1_000));\n}\n\n/** One POST attempt: the axios call plus the house error normalization. */\nasync function postGaslessOnce<data>(\n context: GaslessHttpContext,\n path: string,\n body: unknown,\n code: string,\n): Promise<AxiosResponse<data>> {\n try {\n return await axios.post<data>(path, body, {\n baseURL: context.baseURL,\n headers: await resolveGaslessRequestHeaders(context, \"POST\"),\n timeout: context.submitTimeoutMs,\n });\n } catch (err) {\n throw toGaslessError(err, context, code);\n }\n}\n\n/**\n * POST one gasless **submit** — the only gasless call that can leave a side\n * effect behind when its response is lost — and decide, for every outcome,\n * whether the service can have accepted it.\n *\n * Three dispositions, all under the caller's single idempotency key (the vendor\n * returns the existing record for a byte-identical resend, so reusing the key\n * can never double-execute; a *changed* payload needs a fresh one):\n *\n * - **Refused by the gateway** (`429`, or a `503` carrying its `{ error }`\n * envelope): the request never reached the service. Resent up to\n * {@link GASLESS_SUBMIT_THROTTLE_RETRIES} times after\n * {@link gaslessSubmitRetryDelay}, while the wait still fits inside\n * `execution.submitTimeoutMs`. Exhausted, the gateway's own error is thrown —\n * the one submit failure that is provably *not* accepted, and so the only one\n * a wallet-paid retry may follow.\n * - **Ambiguous** (no response, a timeout, or a `5xx` without the gateway\n * envelope): the service may or may not have accepted it. Resent **once**,\n * after a {@link gaslessSubmitRetryDelay} backoff, then thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` carrying the exact bytes that were sent, so the\n * caller can persist them and replay them later with `resubmitGaslessRequest`.\n * Never a rejection, and never grounds for a wallet retry. The backoff is the\n * vendor's: a resend that races the first attempt's insert can be answered with\n * a `5xx` instead of the record that insert created.\n * - **Answered** (any other status, or a `2xx`): thrown as-is, or returned. A\n * `2xx` without a `request_id` is unconfirmed too — the workflow exists and\n * nothing identifies it. A `2xx` from the wrong protocol instance throws\n * `GASLESS_INSTANCE_MISMATCH` with the parsed body kept in `responseData`,\n * because the `request_id` in it is the only handle on a request that was\n * accepted somewhere.\n *\n * An ambiguous attempt decides every failure after it. A gateway refusal of the\n * resend, or a service verdict on it, describes only the resend — the first\n * attempt may already be executing — so it is thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` with that failure as its `cause`. Thrown as-is,\n * a `429` would read as provably not accepted, and a wallet-paid retry would\n * execute the intent twice.\n *\n * @param context - The resolved HTTP context for the submit's service.\n * @param path - The submit route (see {@link GASLESS_SUBMIT_ROUTES}).\n * @param body - The exact JSON body to send.\n * @param idempotencyKey - The key inside `body`, recorded on an unconfirmed submit.\n * @param options - A replay already has an uncertain earlier attempt, even before its first retry here.\n * @returns The acceptance body.\n *\n * @internal\n */\nexport async function postGaslessSubmit<data extends { request_id?: string | null }>(\n context: GaslessHttpContext,\n path: GaslessSubmitPath,\n body: unknown,\n idempotencyKey: string,\n options: { replay?: boolean } = {},\n): Promise<data> {\n const { service, code } = GASLESS_SUBMIT_ROUTES[path];\n const retriesEndAt = Date.now() + context.submitTimeoutMs;\n let throttleRetries = 0;\n let ambiguousRetries = 0;\n /** Set once an attempt failed ambiguously: the service may hold that attempt. */\n let mayBeAccepted = options.replay ?? false;\n\n for (;;) {\n let response: AxiosResponse<data>;\n try {\n response = await postGaslessOnce<data>(context, path, body, code);\n } catch (err) {\n const failure = classifyGaslessHttpStatus(err);\n\n if (failure === \"rate-limited\" || failure === \"gateway-not-ready\") {\n const delay = gaslessSubmitRetryDelay(err instanceof SymmApiError ? err.retryAfterMs : null);\n if (throttleRetries < GASLESS_SUBMIT_THROTTLE_RETRIES && Date.now() + delay <= retriesEndAt) {\n throttleRetries += 1;\n await sleep(delay);\n continue;\n }\n }\n\n /**\n * The vendor's prescribed recovery for a lost response: resend the\n * identical request under the same key, after a backoff, which either\n * lands it or returns the record it already created.\n */\n if (failure === \"ambiguous\" && ambiguousRetries === 0) {\n ambiguousRetries += 1;\n mayBeAccepted = true;\n await sleep(gaslessSubmitRetryDelay(null));\n continue;\n }\n // A refusal describes only this attempt, not any earlier uncertain one.\n if (mayBeAccepted) throw unconfirmedGaslessSubmitError(context, { service, path, body, idempotencyKey }, err);\n throw err;\n }\n\n const mismatch = readGaslessInstanceMismatch(context, response);\n if (mismatch !== null) {\n throw new SymmApiError({\n code: \"GASLESS_INSTANCE_MISMATCH\",\n message: `${gaslessInstanceMismatchMessage(context, mismatch)} The submit was accepted there, so reconcile the request id in responseData before submitting anything else.`,\n status: response.status,\n statusText: response.statusText,\n responseData: response.data,\n url: `${context.baseURL}${path}`,\n method: \"POST\",\n });\n }\n\n const requestId = response.data?.request_id;\n if (typeof requestId !== \"string\" || requestId.length === 0) {\n throw unconfirmedGaslessSubmitError(context, { service, path, body, idempotencyKey });\n }\n return response.data;\n }\n}\n\n/**\n * Build the `GASLESS_SUBMIT_UNCONFIRMED` error, whose `responseData` is the\n * replayable {@link GaslessUnconfirmedSubmit} rather than a response body —\n * there is no trustworthy response body, and the bytes that were sent are the\n * only thing that can recover the workflow.\n */\nfunction unconfirmedGaslessSubmitError(\n context: GaslessHttpContext,\n submit: Omit<GaslessUnconfirmedSubmit, \"chainId\">,\n cause?: unknown,\n): SymmApiError {\n const status = readGaslessErrorStatus(cause) ?? 0;\n return new SymmApiError({\n code: GASLESS_SUBMIT_UNCONFIRMED_CODE,\n message: `Gasless: the submit to ${submit.path} on chain ${context.chainId} could not be confirmed${status === 0 ? \" (no response)\" : ` (last status ${status})`}, so the service may already be executing it. Resend the recorded body under idempotency key ${submit.idempotencyKey} with resubmitGaslessRequest — never re-run this intent through the wallet.`,\n status,\n statusText: cause instanceof SymmApiError ? cause.statusText : \"\",\n responseData: { chainId: context.chainId, ...submit } satisfies GaslessUnconfirmedSubmit,\n url: `${context.baseURL}${submit.path}`,\n method: \"POST\",\n cause: cause instanceof Error ? cause : undefined,\n });\n}\n\n/**\n * The canonical 3-branch error normalization every gasless HTTP call shares.\n *\n * An axios failure becomes a `SymmApiError` whose `cause` is a sanitized\n * snapshot (see `toSanitizedApiError`), never the axios error itself. That\n * error's request config holds the `Authorization` header and the signed body,\n * so the `apiKey` cannot leak through a logged or serialized error.\n * `responseData` stays the raw response body.\n *\n * @internal\n */\nexport function toGaslessError(err: unknown, context: GaslessHttpContext, code: string): Error {\n if (err instanceof SymmError) return err;\n if (isAxiosError(err)) return toSanitizedApiError(err, { code, baseURL: context.baseURL });\n return new SymmError(\"api\", code, `Gasless request failed: ${err instanceof Error ? err.message : String(err)}`, {\n cause: err instanceof Error ? err : undefined,\n });\n}\n\n/**\n * How a failed gasless HTTP call was disposed of, from the status and, where\n * the gateway overloads a status, from the body: the gateway's own\n * `{ \"error\": \"…\" }` envelope versus a service `{ \"detail\": … }` body.\n *\n * - `\"rate-limited\"` — `429`: dropped at the gateway, never forwarded.\n * - `\"gateway-not-ready\"` — `503` with the gateway envelope: its configuration is not ready.\n * - `\"unauthorized\"` / `\"forbidden\"` — `401` / `403`: credentials rejected, or not allowed for this instance or service.\n * - `\"unknown-instance\"` — `404` with the gateway envelope: no such instance or service route.\n * - `\"selector-conflict\"` — `400` with the gateway envelope: the URL and the instance selector disagree.\n * - `\"client-schema\"` — `422`: the service rejected the payload shape (a client bug).\n * - `\"ambiguous\"` — no response (network failure or timeout), `408`, or any other `5xx`: the request may or may not have reached the service.\n * - `\"service\"` — any other status: the service answered with its own verdict (`detail.code`).\n *\n * @internal\n */\nexport type GaslessHttpFailureClass =\n | \"rate-limited\"\n | \"gateway-not-ready\"\n | \"unauthorized\"\n | \"forbidden\"\n | \"unknown-instance\"\n | \"selector-conflict\"\n | \"client-schema\"\n | \"ambiguous\"\n | \"service\";\n\n/**\n * Classify a failed gasless HTTP call — see {@link GaslessHttpFailureClass}.\n *\n * The status is read structurally, so an error a framework layer re-wrapped\n * (`@symmio/trading-react`'s `SymmioRequestError`, which copies `status` and\n * `responseData`) classifies exactly like the `SymmApiError` underneath it.\n *\n * @param err - Anything caught from a gasless HTTP call.\n * @returns The class, or `null` when `err` carries no HTTP status.\n *\n * @internal\n */\nexport function classifyGaslessHttpStatus(err: unknown): GaslessHttpFailureClass | null {\n const status = readGaslessErrorStatus(err);\n if (status === undefined) return null;\n const fromGateway = typeof parseGaslessErrorDetail(err)?.gatewayError === \"string\";\n switch (status) {\n case 0:\n case 408:\n return \"ambiguous\";\n case 401:\n return \"unauthorized\";\n case 403:\n return \"forbidden\";\n case 422:\n return \"client-schema\";\n case 429:\n return \"rate-limited\";\n case 400:\n return fromGateway ? \"selector-conflict\" : \"service\";\n case 404:\n return fromGateway ? \"unknown-instance\" : \"service\";\n case 503:\n return fromGateway ? \"gateway-not-ready\" : \"ambiguous\";\n default:\n return status >= 500 ? \"ambiguous\" : \"service\";\n }\n}\n"],"mappings":";;;;;;;;;AAiCA,IAAa,IAAmC;AAgDhD,SAAgB,EACd,GACA,GACoB;CACpB,IAAM,IAAQ,EAAO,eAAe,EAAW,OAAO,GAChD,IAAU,EAAsB,GAAQ,EAAE,SAAS,EAAW,QAAQ,CAAC;CAC7E,OAAO,EAAwB,EAAM,SAAS,GAAS,EAAW,OAAO;AAC3E;AAUA,SAAgB,EACd,GACA,GACA,GACoB;CACpB,IAAM,IAAM,EAAgB,GAAS,CAAO;CAC5C,EAAuB,GAAS,GAAK,CAAO;CAE5C,IAAM,IAAkC,EAAE,QAAQ,mBAAmB,GAC/D,IAAS,EAAQ,QAAQ,KAAK;CA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O;CACjC,IAAM,IAAc,OAAO,EAAwB,CAAG,GAAG,gBAAiB;CAC1E,QAAQ,GAAR;EACE,KAAK;EACL,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO;EACT,KAAK,KACH,OAAO,IAAc,sBAAsB;EAC7C,KAAK,KACH,OAAO,IAAc,qBAAqB;EAC5C,KAAK,KACH,OAAO,IAAc,sBAAsB;EAC7C,SACE,OAAO,KAAU,MAAM,cAAc;CACzC;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a key for one user action: a random UUID (122 random bits).
|
|
3
|
+
*
|
|
4
|
+
* You may put your own readable label in front (`${flow}:${key}`), keeping the
|
|
5
|
+
* total at most 128 characters. Never build a key only from the action's
|
|
6
|
+
* inputs, never reuse one for another action, and never put secrets or personal
|
|
7
|
+
* data in it: the service stores the key and returns it in status responses.
|
|
8
|
+
* Keys are global to the deployment, so a key must be unique across all users;
|
|
9
|
+
* a random UUID is.
|
|
10
|
+
*
|
|
11
|
+
* @returns A new random key.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* import { generateGaslessIdempotencyKey } from "@symmio/trading-core";
|
|
16
|
+
*
|
|
17
|
+
* const key = `create-subaccount:${generateGaslessIdempotencyKey()}`;
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateGaslessIdempotencyKey(): string;
|
|
21
|
+
/**
|
|
22
|
+
* The key a gasless submit is sent under: the caller's own key, validated, or a
|
|
23
|
+
* new one. Every submit entry point calls it before any prompt, so an invalid
|
|
24
|
+
* key never costs a signature.
|
|
25
|
+
*
|
|
26
|
+
* @param key - The caller's key, when it passed one.
|
|
27
|
+
* @returns The key to send.
|
|
28
|
+
* @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` when the key is blank or longer than 128 characters.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveGaslessIdempotencyKey(key?: string): string;
|
|
33
|
+
//# sourceMappingURL=idempotency-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idempotency-key.d.ts","sourceRoot":"","sources":["../../src/gasless/idempotency-key.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAUjE"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SymmError as e } from "../shared/errors/symm-error.js";
|
|
2
|
+
//#region src/gasless/idempotency-key.ts
|
|
3
|
+
var t = 128;
|
|
4
|
+
function n() {
|
|
5
|
+
return globalThis.crypto.randomUUID();
|
|
6
|
+
}
|
|
7
|
+
function r(r) {
|
|
8
|
+
if (r === void 0) return n();
|
|
9
|
+
if (typeof r != "string" || r.trim().length === 0 || r.length > t) throw new e("validation", "GASLESS_IDEMPOTENCY_KEY_INVALID", `Gasless: an idempotency key must be 1–${t} non-blank characters. Create one per user action with generateGaslessIdempotencyKey().`);
|
|
10
|
+
return r;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as generateGaslessIdempotencyKey, r as resolveGaslessIdempotencyKey };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=idempotency-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"idempotency-key.js","names":[],"sources":["../../src/gasless/idempotency-key.ts"],"sourcesContent":["import { SymmError } from \"../shared/errors/symm-error\";\n\n/** The longest idempotency key the GaslessQ service accepts. */\nconst GASLESS_IDEMPOTENCY_KEY_MAX_LENGTH = 128;\n\n/**\n * Create a key for one user action: a random UUID (122 random bits).\n *\n * You may put your own readable label in front (`${flow}:${key}`), keeping the\n * total at most 128 characters. Never build a key only from the action's\n * inputs, never reuse one for another action, and never put secrets or personal\n * data in it: the service stores the key and returns it in status responses.\n * Keys are global to the deployment, so a key must be unique across all users;\n * a random UUID is.\n *\n * @returns A new random key.\n *\n * @example\n * ```ts\n * import { generateGaslessIdempotencyKey } from \"@symmio/trading-core\";\n *\n * const key = `create-subaccount:${generateGaslessIdempotencyKey()}`;\n * ```\n */\nexport function generateGaslessIdempotencyKey(): string {\n return globalThis.crypto.randomUUID();\n}\n\n/**\n * The key a gasless submit is sent under: the caller's own key, validated, or a\n * new one. Every submit entry point calls it before any prompt, so an invalid\n * key never costs a signature.\n *\n * @param key - The caller's key, when it passed one.\n * @returns The key to send.\n * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` when the key is blank or longer than 128 characters.\n *\n * @internal\n */\nexport function resolveGaslessIdempotencyKey(key?: string): string {\n if (key === undefined) return generateGaslessIdempotencyKey();\n if (typeof key !== \"string\" || key.trim().length === 0 || key.length > GASLESS_IDEMPOTENCY_KEY_MAX_LENGTH) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_IDEMPOTENCY_KEY_INVALID\",\n `Gasless: an idempotency key must be 1–${GASLESS_IDEMPOTENCY_KEY_MAX_LENGTH} non-blank characters. Create one per user action with generateGaslessIdempotencyKey().`,\n );\n }\n return key;\n}\n"],"mappings":";;AAGA,IAAM,IAAqC;AAqB3C,SAAgB,IAAwC;CACtD,OAAO,WAAW,OAAO,WAAW;AACtC;AAaA,SAAgB,EAA6B,GAAsB;CACjE,IAAI,MAAQ,KAAA,GAAW,OAAO,EAA8B;CAC5D,IAAI,OAAO,KAAQ,YAAY,EAAI,KAAK,EAAE,WAAW,KAAK,EAAI,SAAS,GACrE,MAAM,IAAI,EACR,cACA,mCACA,yCAAyC,EAAmC,wFAC9E;CAEF,OAAO;AACT"}
|
package/dist/gasless/index.d.ts
CHANGED
|
@@ -2,20 +2,24 @@ export * from './batch/index.js';
|
|
|
2
2
|
export * from './classify-gasless-failure.js';
|
|
3
3
|
export * from './confirm-gasless-request/index.js';
|
|
4
4
|
export * from './constants.js';
|
|
5
|
+
export * from './deployment-key.js';
|
|
5
6
|
export * from './eip712.js';
|
|
6
7
|
export * from './errors.js';
|
|
7
8
|
export * from './fallback.js';
|
|
8
9
|
export * from './format-gasless-operation.js';
|
|
9
10
|
export * from './gasless-wallet-execute/index.js';
|
|
10
11
|
export * from './get-gasless-batch-fee-quote/index.js';
|
|
12
|
+
export * from './get-gasless-batch-funding/index.js';
|
|
11
13
|
export * from './get-gasless-deposit-policy/index.js';
|
|
12
14
|
export * from './get-gasless-fee-quote/index.js';
|
|
15
|
+
export * from './get-gasless-margin-funding/index.js';
|
|
13
16
|
export * from './get-gasless-request/index.js';
|
|
14
17
|
export * from './get-gasless-request-transactions/index.js';
|
|
15
18
|
export * from './get-gasless-wallet-address/index.js';
|
|
16
19
|
export * from './get-gasless-wallet-creation-fee/index.js';
|
|
17
20
|
export * from './get-gasless-wallet-nonce/index.js';
|
|
18
21
|
export * from './get-session-key-selectors.js';
|
|
22
|
+
export * from './idempotency-key.js';
|
|
19
23
|
export * from './is-newer-gasless-request.js';
|
|
20
24
|
export * from './observe-gasless-request.js';
|
|
21
25
|
export * from './relay-gasless-batch/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/gasless/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,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C;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,SAAS,CAAC;AACxB,cAAc,sBAAsB,CAAC;AACrC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Config } from '../core/config/index.js';
|
|
2
|
-
import { GaslessService } from './types.js';
|
|
2
|
+
import { GaslessService, GaslessSubmitReceipt } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The lock/stream key of an account's **InstantLayer** operation nonces, which
|
|
5
5
|
* the contract counts per `signerAccount`.
|
|
@@ -101,22 +101,22 @@ export declare function blocksGaslessNonceStream(err: unknown): boolean;
|
|
|
101
101
|
* consumed or the signature expires. A definitive rejection records nothing —
|
|
102
102
|
* nothing was accepted, so the nonce is free immediately.
|
|
103
103
|
*
|
|
104
|
+
* Every record carries the submit's idempotency key, so a later attempt under
|
|
105
|
+
* the same key can recognize its own earlier submit (see
|
|
106
|
+
* {@link readGaslessStreamNonce} and {@link getGaslessPendingAcceptance}).
|
|
107
|
+
*
|
|
104
108
|
* @param config - The SDK config.
|
|
105
109
|
* @param key - The stream key the submit was signed on.
|
|
106
|
-
* @param pending - What was signed: the highest nonce, the service, the chain
|
|
110
|
+
* @param pending - What was signed: the highest nonce, the service, the chain, the signature deadline (seconds),
|
|
111
|
+
* the idempotency key, and whether that key is the caller's own.
|
|
107
112
|
* @param submit - Performs the POST and returns the acceptance receipt.
|
|
108
113
|
* @param blocksStream - Whether a thrown error leaves the signed nonce possibly or certainly consumed; pass {@link blocksGaslessNonceStream}.
|
|
109
114
|
* @returns Whatever `submit` resolved with.
|
|
110
115
|
*
|
|
111
116
|
* @internal
|
|
112
117
|
*/
|
|
113
|
-
export declare function submitOnGaslessNonceStream<result extends {
|
|
114
|
-
requestId: string;
|
|
115
|
-
}>(config: Config, key: string, pending: {
|
|
118
|
+
export declare function submitOnGaslessNonceStream<result extends GaslessSubmitReceipt>(config: Config, key: string, pending: GaslessStreamSubmit & {
|
|
116
119
|
signedNonce: bigint;
|
|
117
|
-
service: GaslessService;
|
|
118
|
-
chainId: number;
|
|
119
|
-
deadline: bigint;
|
|
120
120
|
}, submit: () => Promise<result>, blocksStream: (err: unknown) => boolean): Promise<result>;
|
|
121
121
|
/**
|
|
122
122
|
* {@link submitOnGaslessNonceStream} for a submit that signed on **several**
|
|
@@ -127,23 +127,49 @@ export declare function submitOnGaslessNonceStream<result extends {
|
|
|
127
127
|
*
|
|
128
128
|
* @param config - The SDK config.
|
|
129
129
|
* @param streams - Each stream the submit signed on, with the highest nonce it signed there.
|
|
130
|
-
* @param pending - The service, the chain
|
|
130
|
+
* @param pending - The service, the chain, the signature deadline (seconds), the idempotency key and whether that
|
|
131
|
+
* key is the caller's own, shared by every stream.
|
|
131
132
|
* @param submit - Performs the POST and returns the acceptance receipt.
|
|
132
133
|
* @param blocksStream - Whether a thrown error leaves the signed nonces possibly or certainly consumed; pass {@link blocksGaslessNonceStream}.
|
|
133
134
|
* @returns Whatever `submit` resolved with.
|
|
134
135
|
*
|
|
135
136
|
* @internal
|
|
136
137
|
*/
|
|
137
|
-
export declare function submitOnGaslessNonceStreams<result extends {
|
|
138
|
-
requestId: string;
|
|
139
|
-
}>(config: Config, streams: readonly {
|
|
138
|
+
export declare function submitOnGaslessNonceStreams<result extends GaslessSubmitReceipt>(config: Config, streams: readonly {
|
|
140
139
|
key: string;
|
|
141
140
|
signedNonce: bigint;
|
|
142
|
-
}[], pending:
|
|
141
|
+
}[], pending: GaslessStreamSubmit, submit: () => Promise<result>, blocksStream: (err: unknown) => boolean): Promise<result>;
|
|
142
|
+
/**
|
|
143
|
+
* What every stream a submit signed on records about it.
|
|
144
|
+
*
|
|
145
|
+
* @internal
|
|
146
|
+
*/
|
|
147
|
+
export interface GaslessStreamSubmit {
|
|
148
|
+
/** Which service stores the request. */
|
|
143
149
|
service: GaslessService;
|
|
150
|
+
/** The chain the request is submitted on. */
|
|
144
151
|
chainId: number;
|
|
152
|
+
/** The signature deadline, in seconds. */
|
|
145
153
|
deadline: bigint;
|
|
146
|
-
|
|
154
|
+
/** The idempotency key the submit is sent under. */
|
|
155
|
+
idempotencyKey: string;
|
|
156
|
+
/** Whether the key is the caller's own (`gasless.idempotencyKey`) rather than one the SDK generated. */
|
|
157
|
+
callerOwnedKey: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* The acceptance of an earlier submit under the same caller-owned key, on any
|
|
161
|
+
* of the given streams. An attempt that finds one returns it instead of
|
|
162
|
+
* signing again: the service already holds a request for that key, and this
|
|
163
|
+
* config saw it accepted.
|
|
164
|
+
*
|
|
165
|
+
* @param config - The SDK config.
|
|
166
|
+
* @param keys - The stream keys the attempt would sign on.
|
|
167
|
+
* @param idempotencyKey - The attempt's caller-owned key.
|
|
168
|
+
* @returns The earlier acceptance receipt, or `null`.
|
|
169
|
+
*
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
export declare function getGaslessPendingAcceptance(config: Config, keys: readonly string[], idempotencyKey: string): GaslessSubmitReceipt | null;
|
|
147
173
|
/**
|
|
148
174
|
* Read a stream's consumed nonce, waiting first for anything this SDK already
|
|
149
175
|
* signed on it and has not seen land.
|
|
@@ -165,16 +191,28 @@ export declare function submitOnGaslessNonceStreams<result extends {
|
|
|
165
191
|
* see the block. `succeeded` is the relayer's node's view and a public RPC can
|
|
166
192
|
* trail it, so the signed nonce becomes a floor under every later read on the
|
|
167
193
|
* stream; the relayer simulates the next submit against its own node, which
|
|
168
|
-
* already has the block.
|
|
194
|
+
* already has the block. A submit under a caller-owned key never raises that
|
|
195
|
+
* floor: the service may have answered it with an earlier request under the
|
|
196
|
+
* key, whose nonce is not the one recorded here. Its success instead makes the
|
|
197
|
+
* read wait until this RPC returns the successful transaction's receipt, so the
|
|
198
|
+
* nonce it reads includes that block; when the budget runs out first, the read
|
|
199
|
+
* throws rather than return a nonce it knows may be spent.
|
|
200
|
+
*
|
|
201
|
+
* An attempt under the **same** caller-owned key as the pending submit does not
|
|
202
|
+
* wait for it. Both carry one key, and the service accepts a key at most once,
|
|
203
|
+
* so the retry signs from the consumed nonce and lets the service settle which
|
|
204
|
+
* of the two stands. Different keys — different actions — still wait.
|
|
169
205
|
*
|
|
170
206
|
* @param config - The SDK config.
|
|
171
207
|
* @param key - The stream key.
|
|
172
208
|
* @param readConsumedNonce - Reads the stream's consumed nonce on-chain.
|
|
209
|
+
* @param idempotencyKey - The attempt's caller-owned idempotency key, when it has one.
|
|
173
210
|
* @returns The consumed nonce to sign from (sign `+ 1n`).
|
|
174
211
|
* @throws {SymmError} `GASLESS_NONCE_STREAM_BUSY` when the budget runs out with a signature
|
|
175
|
-
* still unaccounted for — signing now would collide with it
|
|
212
|
+
* still unaccounted for — signing now would collide with it — or before this RPC has seen a
|
|
213
|
+
* caller-keyed success, whose spent nonce it would still report as free.
|
|
176
214
|
*
|
|
177
215
|
* @internal
|
|
178
216
|
*/
|
|
179
|
-
export declare function readGaslessStreamNonce(config: Config, key: string, readConsumedNonce: () => Promise<bigint
|
|
217
|
+
export declare function readGaslessStreamNonce(config: Config, key: string, readConsumedNonce: () => Promise<bigint>, idempotencyKey?: string): Promise<bigint>;
|
|
180
218
|
//# sourceMappingURL=nonce-lock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonce-lock.d.ts","sourceRoot":"","sources":["../../src/gasless/nonce-lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"nonce-lock.d.ts","sourceRoot":"","sources":["../../src/gasless/nonce-lock.ts"],"names":[],"mappings":"AACA,OAA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