@symmio/trading-core 4.2.1 → 4.4.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/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-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 +2 -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 +26 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +673 -615
- 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.d.ts +3 -1
- package/dist/solvers/estimated-price/get-estimated-price.d.ts.map +1 -1
- package/dist/solvers/estimated-price/get-estimated-price.js +6 -6
- package/dist/solvers/estimated-price/get-estimated-price.js.map +1 -1
- package/dist/solvers/estimated-price/to-estimated-price.d.ts +2 -1
- package/dist/solvers/estimated-price/to-estimated-price.d.ts.map +1 -1
- package/dist/solvers/estimated-price/to-estimated-price.js +4 -1
- package/dist/solvers/estimated-price/to-estimated-price.js.map +1 -1
- 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/solvers/types/generated/enigma-solver.d.ts +1 -0
- package/dist/solvers/types/generated/enigma-solver.d.ts.map +1 -1
- package/dist/solvers/types/generated/enigma-solver.js.map +1 -1
- 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
|
@@ -1,57 +1,67 @@
|
|
|
1
1
|
import { instantLayerAbi as e } from "../../symmio-contracts/abi/v0.8.6/instant-layer.js";
|
|
2
2
|
import { getInstantLayerEip712Domain as t, signSignedOperation as n } from "../../solvers/instant-open/shared/eip712.js";
|
|
3
3
|
import { buildSignedOperation as r } from "../../solvers/instant-open/shared/operations.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { resolveGaslessIdempotencyKey as i } from "../idempotency-key.js";
|
|
5
|
+
import { getInstantLayerNonce as a } from "../../symmio-contracts/instant-layer/actions/get-instant-layer-nonce.js";
|
|
6
|
+
import { GASLESS_SIGNATURE_LIFETIME_SECONDS as o } from "../constants.js";
|
|
7
|
+
import { blocksGaslessNonceStream as s, gaslessInstantNonceStreamKey as c, getGaslessPendingAcceptance as l, readGaslessStreamNonce as u, submitOnGaslessNonceStream as d, withGaslessNonceLock as f } from "../nonce-lock.js";
|
|
8
|
+
import { relayInstantOperations as p } from "../relay-instant-operations/relay-instant-operations.js";
|
|
9
|
+
import { encodeFunctionData as m } from "viem";
|
|
8
10
|
//#region src/gasless/relay-grant-delegation/relay-grant-delegation.ts
|
|
9
|
-
async function
|
|
10
|
-
let { chainId:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
async function h(h, g) {
|
|
12
|
+
let { chainId: _, account: v, delegatedSigner: y, selectors: b, expiryTimestamp: x, from: S } = g, C = BigInt(Math.floor(Date.now() / 1e3) + o), w = g.idempotencyKey !== void 0, T = i(g.idempotencyKey), E = h.getChainConfig(_), D = c(E.chainId, v);
|
|
13
|
+
if (w) {
|
|
14
|
+
let e = l(h, [D], T);
|
|
15
|
+
if (e) return e;
|
|
16
|
+
}
|
|
17
|
+
let O = await h.getWalletClient({
|
|
18
|
+
chainId: _,
|
|
19
|
+
from: S
|
|
20
|
+
}), k = t(h, { chainId: _ }), A = m({
|
|
14
21
|
abi: e,
|
|
15
22
|
functionName: "grantDelegation",
|
|
16
23
|
args: [{
|
|
17
24
|
account: {
|
|
18
|
-
addr:
|
|
25
|
+
addr: v,
|
|
19
26
|
isPartyB: !1
|
|
20
27
|
},
|
|
21
|
-
delegatedSigner:
|
|
22
|
-
selectors: [...
|
|
23
|
-
expiryTimestamp:
|
|
28
|
+
delegatedSigner: y,
|
|
29
|
+
selectors: [...b],
|
|
30
|
+
expiryTimestamp: x
|
|
24
31
|
}]
|
|
25
|
-
})
|
|
26
|
-
return
|
|
27
|
-
let e = await
|
|
28
|
-
chainId:
|
|
29
|
-
account:
|
|
30
|
-
})
|
|
31
|
-
signer:
|
|
32
|
-
target:
|
|
33
|
-
callData:
|
|
34
|
-
signerAccount:
|
|
35
|
-
deadline:
|
|
32
|
+
});
|
|
33
|
+
return f(h, D, async () => {
|
|
34
|
+
let e = await u(h, D, () => a(h, {
|
|
35
|
+
chainId: _,
|
|
36
|
+
account: v
|
|
37
|
+
}), w ? T : void 0), t = r({
|
|
38
|
+
signer: O.account.address,
|
|
39
|
+
target: E.addresses.instantLayerAddress,
|
|
40
|
+
callData: A,
|
|
41
|
+
signerAccount: v,
|
|
42
|
+
deadline: C,
|
|
36
43
|
nonce: e + 1n
|
|
37
|
-
}),
|
|
38
|
-
return
|
|
44
|
+
}), i = await n(t, k, O);
|
|
45
|
+
return d(h, D, {
|
|
39
46
|
signedNonce: e + 1n,
|
|
40
47
|
service: "operations",
|
|
41
|
-
chainId:
|
|
42
|
-
deadline:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
chainId: E.chainId,
|
|
49
|
+
deadline: C,
|
|
50
|
+
idempotencyKey: T,
|
|
51
|
+
callerOwnedKey: w
|
|
52
|
+
}, () => p(h, {
|
|
53
|
+
chainId: _,
|
|
54
|
+
userAddress: O.account.address,
|
|
46
55
|
operationType: "grantDelegation",
|
|
47
56
|
operations: [{
|
|
48
|
-
operation:
|
|
49
|
-
signature:
|
|
50
|
-
}]
|
|
51
|
-
|
|
57
|
+
operation: t,
|
|
58
|
+
signature: i
|
|
59
|
+
}],
|
|
60
|
+
idempotencyKey: T
|
|
61
|
+
}), s);
|
|
52
62
|
});
|
|
53
63
|
}
|
|
54
64
|
//#endregion
|
|
55
|
-
export {
|
|
65
|
+
export { h as relayGrantDelegation };
|
|
56
66
|
|
|
57
67
|
//# sourceMappingURL=relay-grant-delegation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-grant-delegation.js","names":[],"sources":["../../../src/gasless/relay-grant-delegation/relay-grant-delegation.ts"],"sourcesContent":["import { encodeFunctionData, type Address, type Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type {
|
|
1
|
+
{"version":3,"file":"relay-grant-delegation.js","names":[],"sources":["../../../src/gasless/relay-grant-delegation/relay-grant-delegation.ts"],"sourcesContent":["import { encodeFunctionData, type Address, type Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport type {\n ChainIdParameter,\n Compute,\n FromParameter,\n GaslessIdempotencyKeyParameter,\n} from \"../../shared/types/properties\";\nimport { getInstantLayerEip712Domain, signSignedOperation } from \"../../solvers/instant-open/shared/eip712\";\nimport { buildSignedOperation } from \"../../solvers/instant-open/shared/operations\";\nimport { instantLayerAbi } from \"../../symmio-contracts/abi/v0.8.6/instant-layer\";\nimport { getInstantLayerNonce } from \"../../symmio-contracts/instant-layer/actions/get-instant-layer-nonce\";\nimport { GASLESS_SIGNATURE_LIFETIME_SECONDS } from \"../constants\";\nimport { resolveGaslessIdempotencyKey } from \"../idempotency-key\";\nimport {\n blocksGaslessNonceStream,\n gaslessInstantNonceStreamKey,\n getGaslessPendingAcceptance,\n readGaslessStreamNonce,\n submitOnGaslessNonceStream,\n withGaslessNonceLock,\n} from \"../nonce-lock\";\nimport { relayInstantOperations } from \"../relay-instant-operations/relay-instant-operations\";\nimport type { GaslessSubmitReceipt } from \"../types\";\n\n/**\n * Parameters for {@link relayGrantDelegation}.\n */\nexport type RelayGrantDelegationParameters = Compute<\n ChainIdParameter &\n FromParameter &\n GaslessIdempotencyKeyParameter & {\n /**\n * The sub-account granting the delegation. The account **owner's** wallet\n * signs the operation — a delegation grant is always owner-signed.\n */\n account: Address;\n /** The signer being delegated to (e.g. a session key address). */\n delegatedSigner: Address;\n /** Function selectors the delegate may sign for. */\n selectors: readonly Hex[];\n /** Unix timestamp (seconds) when the delegation expires. */\n expiryTimestamp: bigint;\n }\n>;\n\n/** Return type of {@link relayGrantDelegation}. */\nexport type RelayGrantDelegationReturnType = GaslessSubmitReceipt;\n\n/**\n * Grant an Instant Layer delegation **through the gasless relayer** — no\n * native gas needed.\n *\n * **Prefer `grantDelegation` with `gasless: true`.** A grant is a relayable\n * write, so the ordinary action relays it and returns a transaction hash, with\n * no separate code path and no separate result shape. This stays as the\n * low-level escape hatch, for when you want the `requestId` and the fee figures\n * off the acceptance receipt — the same relationship `relayInstantOperations`\n * has with the transparent path.\n *\n * A delegation grant is an ordinary owner-signed InstantLayer operation:\n * `grantDelegation(DelegationInfo)` calldata targeting the InstantLayer,\n * signed under the InstantLayer EIP-712 domain with a fresh sequential nonce,\n * submitted through `relay-instant`. (The old standalone delegation-relay\n * endpoint and `SignedDelegation` payload no longer exist.) Combine with\n * `GASLESS_SESSION_KEY_SELECTORS` to onboard a session key that can then sign\n * gasless account management without further wallet prompts.\n *\n * Fire-and-forget like every relay: persist the returned `requestId` and poll\n * `getGaslessRequest` (or `waitForGaslessRequest`) to a terminal status. The\n * wallet-paid alternative is the plain `grantDelegation` write.\n *\n * Pass `idempotencyKey` (one per user action, from\n * `generateGaslessIdempotencyKey`) to make the grant retryable: a later call\n * with the same key never waits for its own earlier submit, returns that\n * submit's receipt when this config saw it accepted, and is otherwise accepted\n * by the service at most once. Omitted, a key is generated for this call alone.\n * The signature's deadline is fixed when the call starts\n * (`GASLESS_SIGNATURE_LIFETIME_SECONDS`).\n *\n * @param config - The SDK config (must have a `getWalletClient` resolver).\n * @param parameters - Delegation fields, optional chain id / signer / idempotency-key override.\n * @returns The acceptance receipt; persist `requestId` immediately.\n * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmApiError} `GASLESS_RELAY_SUBMIT_FAILED` on HTTP failure.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; call again under the same `idempotencyKey`, or replay it with\n * `resubmitGaslessRequest`, rather than signing a new grant under a new key.\n *\n * @example\n * ```ts\n * const receipt = await relayGrantDelegation(config, {\n * account: subAccount,\n * delegatedSigner: sessionKeyAddress,\n * selectors: GASLESS_SESSION_KEY_SELECTORS,\n * expiryTimestamp: BigInt(Math.floor(Date.now() / 1000) + 30 * 24 * 3600),\n * });\n * ```\n */\nexport async function relayGrantDelegation(\n config: Config,\n parameters: RelayGrantDelegationParameters,\n): Promise<RelayGrantDelegationReturnType> {\n const { chainId, account, delegatedSigner, selectors, expiryTimestamp, from } = parameters;\n\n /** Fixed when the call starts, before any lock wait or prompt. */\n const deadline = BigInt(Math.floor(Date.now() / 1000) + GASLESS_SIGNATURE_LIFETIME_SECONDS);\n /** One key per user action; validated before any network call or prompt. */\n const callerOwnedKey = parameters.idempotencyKey !== undefined;\n const idempotencyKey = resolveGaslessIdempotencyKey(parameters.idempotencyKey);\n\n const chain = config.getChainConfig(chainId);\n const streamKey = gaslessInstantNonceStreamKey(chain.chainId, account);\n\n /** This config already saw an attempt under the same key accepted: return it instead of signing again. */\n if (callerOwnedKey) {\n const earlier = getGaslessPendingAcceptance(config, [streamKey], idempotencyKey);\n if (earlier) return earlier;\n }\n\n const walletClient = await config.getWalletClient({ chainId, from });\n const domain = getInstantLayerEip712Domain(config, { chainId });\n\n const callData = encodeFunctionData({\n abi: instantLayerAbi,\n functionName: \"grantDelegation\",\n args: [\n {\n account: { addr: account, isPartyB: false },\n delegatedSigner,\n selectors: [...selectors],\n expiryTimestamp,\n },\n ],\n });\n\n return withGaslessNonceLock(config, streamKey, async () => {\n const currentNonce = await readGaslessStreamNonce(\n config,\n streamKey,\n () => getInstantLayerNonce(config, { chainId, account }),\n callerOwnedKey ? idempotencyKey : undefined,\n );\n\n const operation = buildSignedOperation({\n signer: walletClient.account.address,\n target: chain.addresses.instantLayerAddress,\n callData,\n signerAccount: account,\n deadline,\n nonce: currentNonce + 1n,\n });\n const signature = await signSignedOperation(operation, domain, walletClient);\n\n return submitOnGaslessNonceStream(\n config,\n streamKey,\n {\n signedNonce: currentNonce + 1n,\n service: \"operations\",\n chainId: chain.chainId,\n deadline,\n idempotencyKey,\n callerOwnedKey,\n },\n () =>\n relayInstantOperations(config, {\n chainId,\n userAddress: walletClient.account.address,\n operationType: \"grantDelegation\",\n /** A delegation grant is an ordinary InstantLayer operation: wallet 0. */\n operations: [{ operation, signature }],\n idempotencyKey,\n }),\n blocksGaslessNonceStream,\n );\n });\n}\n"],"mappings":";;;;;;;;;;AAoGA,eAAsB,EACpB,GACA,GACyC;CACzC,IAAM,EAAE,YAAS,YAAS,oBAAiB,cAAW,oBAAiB,YAAS,GAG1E,IAAW,OAAO,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI,IAAI,CAAkC,GAEpF,IAAiB,EAAW,mBAAmB,KAAA,GAC/C,IAAiB,EAA6B,EAAW,cAAc,GAEvE,IAAQ,EAAO,eAAe,CAAO,GACrC,IAAY,EAA6B,EAAM,SAAS,CAAO;CAGrE,IAAI,GAAgB;EAClB,IAAM,IAAU,EAA4B,GAAQ,CAAC,CAAS,GAAG,CAAc;EAC/E,IAAI,GAAS,OAAO;CACtB;CAEA,IAAM,IAAe,MAAM,EAAO,gBAAgB;EAAE;EAAS;CAAK,CAAC,GAC7D,IAAS,EAA4B,GAAQ,EAAE,WAAQ,CAAC,GAExD,IAAW,EAAmB;EAClC,KAAK;EACL,cAAc;EACd,MAAM,CACJ;GACE,SAAS;IAAE,MAAM;IAAS,UAAU;GAAM;GAC1C;GACA,WAAW,CAAC,GAAG,CAAS;GACxB;EACF,CACF;CACF,CAAC;CAED,OAAO,EAAqB,GAAQ,GAAW,YAAY;EACzD,IAAM,IAAe,MAAM,EACzB,GACA,SACM,EAAqB,GAAQ;GAAE;GAAS;EAAQ,CAAC,GACvD,IAAiB,IAAiB,KAAA,CACpC,GAEM,IAAY,EAAqB;GACrC,QAAQ,EAAa,QAAQ;GAC7B,QAAQ,EAAM,UAAU;GACxB;GACA,eAAe;GACf;GACA,OAAO,IAAe;EACxB,CAAC,GACK,IAAY,MAAM,EAAoB,GAAW,GAAQ,CAAY;EAE3E,OAAO,EACL,GACA,GACA;GACE,aAAa,IAAe;GAC5B,SAAS;GACT,SAAS,EAAM;GACf;GACA;GACA;EACF,SAEE,EAAuB,GAAQ;GAC7B;GACA,aAAa,EAAa,QAAQ;GAClC,eAAe;GAEf,YAAY,CAAC;IAAE;IAAW;GAAU,CAAC;GACrC;EACF,CAAC,GACH,CACF;CACF,CAAC;AACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address, Hex } from 'viem';
|
|
2
2
|
import { Config } from '../../core/config/index.js';
|
|
3
|
-
import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
|
|
3
|
+
import { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from '../../shared/types/properties.js';
|
|
4
4
|
import { SignedOperation } from '../../solvers/instant-open/shared/types.js';
|
|
5
5
|
import { GaslessSubmitReceipt } from '../types.js';
|
|
6
6
|
/**
|
|
@@ -32,7 +32,7 @@ export interface GaslessSignedOperationInput {
|
|
|
32
32
|
/**
|
|
33
33
|
* Parameters for {@link relayInstantOperations}.
|
|
34
34
|
*/
|
|
35
|
-
export type RelayInstantOperationsParameters = Compute<ChainIdParameter & {
|
|
35
|
+
export type RelayInstantOperationsParameters = Compute<ChainIdParameter & GaslessIdempotencyKeyParameter & {
|
|
36
36
|
/**
|
|
37
37
|
* The signed operations, in execution order. The batch is **atomic** — one
|
|
38
38
|
* revert rolls back every operation and every fee — so only bundle
|
|
@@ -57,18 +57,6 @@ export type RelayInstantOperationsParameters = Compute<ChainIdParameter & {
|
|
|
57
57
|
* batch must leave every operation on wallet `0`.
|
|
58
58
|
*/
|
|
59
59
|
templateId?: number;
|
|
60
|
-
/**
|
|
61
|
-
* Stable retry key (max 128 chars). Defaults to a random UUID.
|
|
62
|
-
*
|
|
63
|
-
* **One key per signature.** The signed operations are built by the caller
|
|
64
|
-
* here, so the key is a parameter: pass the same one to replay a submit
|
|
65
|
-
* whose response was lost, and the service returns the existing record
|
|
66
|
-
* instead of duplicating work. Change anything in the batch — re-sign, add
|
|
67
|
-
* an operation, move a wallet id — and the key must change too, or the
|
|
68
|
-
* service answers `409 IDEMPOTENCY_KEY_CONFLICT`
|
|
69
|
-
* (`isGaslessIdempotencyConflictError`).
|
|
70
|
-
*/
|
|
71
|
-
idempotencyKey?: string;
|
|
72
60
|
/** Non-secret client correlation data stored with the request. */
|
|
73
61
|
metadata?: Record<string, unknown>;
|
|
74
62
|
}>;
|
|
@@ -99,9 +87,20 @@ export type RelayInstantOperationsReturnType = GaslessSubmitReceipt;
|
|
|
99
87
|
* receipt's `owner`, `walletIds` and `idempotencyKey` with its `requestId`: a
|
|
100
88
|
* bare request id is not enough context to reconcile a workflow after a reload.
|
|
101
89
|
*
|
|
90
|
+
* `idempotencyKey` is one key per **user action** (default: a random UUID per
|
|
91
|
+
* call). Any later submit under the key, the same signed operations or ones
|
|
92
|
+
* signed again, returns the request the key is bound to (`202`, the same
|
|
93
|
+
* `requestId`) and runs nothing new. The key is used up once that request
|
|
94
|
+
* ends; a new action needs a new key.
|
|
95
|
+
*
|
|
96
|
+
* Sign every operation with a near deadline, as the SDK's own writes do
|
|
97
|
+
* (`GASLESS_SIGNATURE_LIFETIME_SECONDS`). A deadline of `0` never expires, so
|
|
98
|
+
* an unresolved request could never be settled by waiting.
|
|
99
|
+
*
|
|
102
100
|
* @param config - The SDK config.
|
|
103
|
-
* @param parameters - Signed operations, workflow labels,
|
|
101
|
+
* @param parameters - Signed operations, workflow labels, idempotency key.
|
|
104
102
|
* @returns The acceptance receipt; persist `requestId` immediately.
|
|
103
|
+
* @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.
|
|
105
104
|
* @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.
|
|
106
105
|
* @throws {SymmError} `GASLESS_EMPTY_BATCH` for an empty `operations` array.
|
|
107
106
|
* @throws {SymmError} `GASLESS_TEMPLATE_ID_INVALID` for a `templateId` that is not a non-negative safe integer.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-instant-operations.d.ts","sourceRoot":"","sources":["../../../src/gasless/relay-instant-operations/relay-instant-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC/
|
|
1
|
+
{"version":3,"file":"relay-instant-operations.d.ts","sourceRoot":"","sources":["../../../src/gasless/relay-instant-operations/relay-instant-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AAC/G,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAK/E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,8CAA8C;IAC9C,SAAS,EAAE,eAAe,CAAC;IAC3B,oDAAoD;IACpD,SAAS,EAAE,GAAG,CAAC;IACf,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC;IACvB,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,SAAS,GAAG,EAAE,CAAC;IACtC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,gCAAgC,GAAG,OAAO,CACpD,gBAAgB,GACd,8BAA8B,GAAG;IAC/B;;;;;OAKG;IACH,UAAU,EAAE,SAAS,2BAA2B,EAAE,CAAC;IACnD;;;;OAIG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB,6EAA6E;IAC7E,WAAW,EAAE,OAAO,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CACJ,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,CAAC;AA4BpE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,gCAAgC,GAC3C,OAAO,CAAC,gCAAgC,CAAC,CAgD3C"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SymmError as e } from "../../shared/errors/symm-error.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolveGaslessIdempotencyKey as t } from "../idempotency-key.js";
|
|
3
|
+
import { postGaslessSubmit as n, resolveGaslessHttp as r } from "../http.js";
|
|
3
4
|
import { assertGaslessWalletId as i, toGaslessWalletIdWire as a } from "../wallet-id.js";
|
|
4
5
|
import { toGaslessSubmitReceipt as o } from "../to-gasless-submit-receipt.js";
|
|
5
6
|
import { formatGaslessOperation as s } from "../format-gasless-operation.js";
|
|
@@ -10,30 +11,30 @@ function c(t, n) {
|
|
|
10
11
|
return r;
|
|
11
12
|
}
|
|
12
13
|
async function l(i, l) {
|
|
13
|
-
let { chainId: u, operations: d, operationType: f, userAddress: p, accountId: m, templateId: h, metadata: g } = l;
|
|
14
|
+
let { chainId: u, operations: d, operationType: f, userAddress: p, accountId: m, templateId: h, metadata: g } = l, _ = t(l.idempotencyKey);
|
|
14
15
|
if (d.length === 0) throw new e("validation", "GASLESS_EMPTY_BATCH", "Gasless: relayInstantOperations needs at least one signed operation — the service rejects an empty batch.");
|
|
15
16
|
if (h !== void 0 && (!Number.isSafeInteger(h) || h < 0)) throw new e("validation", "GASLESS_TEMPLATE_ID_INVALID", `Gasless: templateId ${h} is not a non-negative safe integer. An unguarded value serializes to JSON \`null\`, which the service reads as "no template" and relays as a plain batch.`);
|
|
16
|
-
let
|
|
17
|
+
let v = c(d, h), y = r(i, {
|
|
17
18
|
chainId: u,
|
|
18
19
|
service: "operations"
|
|
19
|
-
})
|
|
20
|
-
return o(await n(
|
|
21
|
-
idempotencyKey:
|
|
20
|
+
});
|
|
21
|
+
return o(await n(y, "/gateway/relay-instant", {
|
|
22
|
+
idempotencyKey: _,
|
|
22
23
|
userAddress: p,
|
|
23
24
|
...m === void 0 ? {} : { accountId: m },
|
|
24
25
|
operationType: f,
|
|
25
26
|
...h === void 0 ? {} : { templateId: h },
|
|
26
27
|
signedOps: d.map((e) => s(e.operation)),
|
|
27
28
|
signatures: d.map((e) => e.signature),
|
|
28
|
-
walletIds:
|
|
29
|
+
walletIds: v.map(a),
|
|
29
30
|
fills: d.map((e) => [...e.fills ?? []]),
|
|
30
31
|
flexFillerSignatures: d.map((e) => [...e.flexFillerSignatures ?? []]),
|
|
31
32
|
...g === void 0 ? {} : { metadata: g }
|
|
32
|
-
},
|
|
33
|
+
}, _), {
|
|
33
34
|
owner: p,
|
|
34
|
-
walletIds:
|
|
35
|
-
idempotencyKey:
|
|
36
|
-
protocolInstance:
|
|
35
|
+
walletIds: v,
|
|
36
|
+
idempotencyKey: _,
|
|
37
|
+
protocolInstance: y.protocolInstance
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relay-instant-operations.js","names":[],"sources":["../../../src/gasless/relay-instant-operations/relay-instant-operations.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport type { SignedOperation } from \"../../solvers/instant-open/shared/types\";\nimport { formatGaslessOperation } from \"../format-gasless-operation\";\nimport { generateGaslessIdempotencyKey, postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { toGaslessSubmitReceipt } from \"../to-gasless-submit-receipt\";\nimport type { GaslessSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireOperationAccepted, GaslessWireRelayInstantRequest } from \"../wire-types\";\n\n/**\n * One pre-signed InstantLayer operation for a relay batch: the struct exactly\n * as it was EIP-712 signed, plus the 65-byte signature. Optional flex fills\n * and their filler signatures ride alongside when a flex-field flow uses them.\n */\nexport interface GaslessSignedOperationInput {\n /** The operation struct exactly as signed. */\n operation: SignedOperation;\n /** 65-byte EIP-712 signature over the operation. */\n signature: Hex;\n /** Flex fill payloads for this operation (rare; defaults to none). */\n fills?: readonly Hex[];\n /** Signatures authorizing the flex fills (parallel to `fills`). */\n flexFillerSignatures?: readonly Hex[];\n /**\n * Which of the owner's GaslessWallets this operation executes from. Defaults\n * to `0n`, which is what every ordinary InstantLayer operation and every\n * delegation grant uses.\n *\n * Only a **gasless-wallet `execute`** operation names a positive id, and the\n * id must match the wallet the operation was signed against: the signed\n * `target` is that wallet's address, so changing the id without re-signing\n * relays the signature against the wrong wallet and the batch reverts.\n */\n walletId?: bigint;\n}\n\n/**\n * Parameters for {@link relayInstantOperations}.\n */\nexport type RelayInstantOperationsParameters = Compute<\n ChainIdParameter & {\n /**\n * The signed operations, in execution order. The batch is **atomic** — one\n * revert rolls back every operation and every fee — so only bundle\n * operations that must share fate. Replay nonces must be strictly\n * sequential in this order (`current + 1`, `current + 2`, …).\n */\n operations: readonly GaslessSignedOperationInput[];\n /**\n * Workflow label stored with the request (display, metrics, idempotency).\n * Free-form, 1–128 chars; fees are derived on-chain from calldata\n * selectors, never from this. Keep it stable per action.\n */\n operationType: string;\n /** Wallet the workflow is tracked under (not necessarily the raw signer). */\n userAddress: Address;\n /** Optional client accounting id stored with the request. */\n accountId?: string;\n /**\n * Registered result-chained template id; omit for independent batches.\n *\n * The contract's `relayInstantTemplate` takes no wallet ids, so a template\n * batch must leave every operation on wallet `0`.\n */\n templateId?: number;\n /**\n * Stable retry key (max 128 chars). Defaults to a random UUID.\n *\n * **One key per signature.** The signed operations are built by the caller\n * here, so the key is a parameter: pass the same one to replay a submit\n * whose response was lost, and the service returns the existing record\n * instead of duplicating work. Change anything in the batch — re-sign, add\n * an operation, move a wallet id — and the key must change too, or the\n * service answers `409 IDEMPOTENCY_KEY_CONFLICT`\n * (`isGaslessIdempotencyConflictError`).\n */\n idempotencyKey?: string;\n /** Non-secret client correlation data stored with the request. */\n metadata?: Record<string, unknown>;\n }\n>;\n\n/** Return type of {@link relayInstantOperations}. */\nexport type RelayInstantOperationsReturnType = GaslessSubmitReceipt;\n\n/**\n * The wallet ids a batch relays under, one per operation, validated.\n *\n * Always sent explicitly, never left to the service's zero-filling default:\n * an omitted array is a legacy-client affordance, and relying on it would make\n * a dropped or reordered id indistinguishable from \"no wallets selected\".\n *\n * @internal\n */\nfunction toGaslessBatchWalletIds(\n operations: readonly GaslessSignedOperationInput[],\n templateId: number | undefined,\n): bigint[] {\n const walletIds = operations.map((entry, index) =>\n assertGaslessWalletId(entry.walletId ?? 0n, `operations[${index}].walletId`),\n );\n if (templateId !== undefined && walletIds.some((walletId) => walletId !== 0n)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_TEMPLATE_WALLET_ID_UNSUPPORTED\",\n `Gasless: templateId ${templateId} relays through relayInstantTemplate, which takes no wallet ids — every operation in a template batch must use wallet 0. Relay gasless-wallet operations as an ordinary batch instead.`,\n );\n }\n return walletIds;\n}\n\n/**\n * Submit signed InstantLayer operations to the GaslessQ relayer.\n *\n * Fire-and-forget: the service validates and simulates the batch, returns\n * `202` with a `request_id`, and broadcasts asynchronously — poll\n * `getGaslessRequest` (or await `waitForGaslessRequest`) to a terminal status.\n *\n * Transport failures are dispositioned before they reach you: a `429` or a\n * gateway-`503` is resent under the same key (it never reached the service),\n * an ambiguous failure is resent once and then thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` with the exact bytes to replay\n * (`getGaslessUnconfirmedSubmit` → `resubmitGaslessRequest`), and a definitive\n * 4xx is thrown as-is — inspect it with `parseGaslessErrorDetail` or\n * `classifyGaslessFailure`, and treat only `isConfirmedGaslessFeeLimitError` /\n * `isConfirmedGaslessUnavailableError` as safe grounds for a wallet-paid retry.\n *\n * **A 202 is the point of no return**: the workflow exists server-side and the\n * transaction may execute even if polling later fails — never re-submit the\n * same intent through the wallet afterwards.\n *\n * The batch always carries an explicit `walletIds` array, one decimal id per\n * operation, taken from each entry's `walletId` (default `0n`). Persist the\n * receipt's `owner`, `walletIds` and `idempotencyKey` with its `requestId`: a\n * bare request id is not enough context to reconcile a workflow after a reload.\n *\n * @param config - The SDK config.\n * @param parameters - Signed operations, workflow labels, retry key.\n * @returns The acceptance receipt; persist `requestId` immediately.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_EMPTY_BATCH` for an empty `operations` array.\n * @throws {SymmError} `GASLESS_TEMPLATE_ID_INVALID` for a `templateId` that is not a non-negative safe integer.\n * @throws {SymmError} `GASLESS_TEMPLATE_WALLET_ID_UNSUPPORTED` when a template batch names a non-zero wallet id.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_RELAY_SUBMIT_FAILED` on HTTP failure.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit.\n * @throws {SymmApiError} `GASLESS_INSTANCE_MISMATCH` when a `2xx` came from another\n * protocol instance; the accepted body (its `request_id`) stays in `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await relayInstantOperations(config, {\n * userAddress: owner,\n * operationType: \"initiateWithdraw\",\n * operations: [{ operation, signature }],\n * });\n * const record = await waitForGaslessRequest(config, { requestId: receipt.requestId });\n * ```\n */\nexport async function relayInstantOperations(\n config: Config,\n parameters: RelayInstantOperationsParameters,\n): Promise<RelayInstantOperationsReturnType> {\n const { chainId, operations, operationType, userAddress, accountId, templateId, metadata } = parameters;\n if (operations.length === 0) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_EMPTY_BATCH\",\n \"Gasless: relayInstantOperations needs at least one signed operation — the service rejects an empty batch.\",\n );\n }\n if (templateId !== undefined && (!Number.isSafeInteger(templateId) || templateId < 0)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_TEMPLATE_ID_INVALID\",\n `Gasless: templateId ${templateId} is not a non-negative safe integer. An unguarded value serializes to JSON \\`null\\`, which the service reads as \"no template\" and relays as a plain batch.`,\n );\n }\n const walletIds = toGaslessBatchWalletIds(operations, templateId);\n\n const context = resolveGaslessHttp(config, { chainId, service: \"operations\" });\n const idempotencyKey = parameters.idempotencyKey ?? generateGaslessIdempotencyKey();\n\n const body: GaslessWireRelayInstantRequest = {\n idempotencyKey,\n userAddress,\n ...(accountId !== undefined ? { accountId } : {}),\n operationType,\n ...(templateId !== undefined ? { templateId } : {}),\n signedOps: operations.map((entry) => formatGaslessOperation(entry.operation)),\n signatures: operations.map((entry) => entry.signature),\n walletIds: walletIds.map(toGaslessWalletIdWire),\n fills: operations.map((entry) => [...(entry.fills ?? [])]),\n flexFillerSignatures: operations.map((entry) => [...(entry.flexFillerSignatures ?? [])]),\n ...(metadata !== undefined ? { metadata } : {}),\n };\n\n const raw = await postGaslessSubmit<GaslessWireOperationAccepted>(\n context,\n \"/gateway/relay-instant\",\n body,\n idempotencyKey,\n );\n\n return toGaslessSubmitReceipt(raw, {\n owner: userAddress,\n walletIds,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n}\n"],"mappings":";;;;;;AAiGA,SAAS,EACP,GACA,GACU;CACV,IAAM,IAAY,EAAW,KAAK,GAAO,MACvC,EAAsB,EAAM,YAAY,IAAI,cAAc,EAAM,WAAW,CAC7E;CACA,IAAI,MAAe,KAAA,KAAa,EAAU,MAAM,MAAa,MAAa,EAAE,GAC1E,MAAM,IAAI,EACR,cACA,0CACA,uBAAuB,EAAW,uLACpC;CAEF,OAAO;AACT;AAmDA,eAAsB,EACpB,GACA,GAC2C;CAC3C,IAAM,EAAE,YAAS,eAAY,kBAAe,gBAAa,cAAW,eAAY,gBAAa;CAC7F,IAAI,EAAW,WAAW,GACxB,MAAM,IAAI,EACR,cACA,uBACA,2GACF;CAEF,IAAI,MAAe,KAAA,MAAc,CAAC,OAAO,cAAc,CAAU,KAAK,IAAa,IACjF,MAAM,IAAI,EACR,cACA,+BACA,uBAAuB,EAAW,2JACpC;CAEF,IAAM,IAAY,EAAwB,GAAY,CAAU,GAE1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAa,CAAC,GACvE,IAAiB,EAAW,kBAAkB,EAA8B;CAuBlF,OAAO,EAAuB,MAPZ,EAChB,GACA,0BACA;EAhBA;EACA;EACA,GAAI,MAAc,KAAA,IAA4B,CAAC,IAAjB,EAAE,aAAU;EAC1C;EACA,GAAI,MAAe,KAAA,IAA6B,CAAC,IAAlB,EAAE,cAAW;EAC5C,WAAW,EAAW,KAAK,MAAU,EAAuB,EAAM,SAAS,CAAC;EAC5E,YAAY,EAAW,KAAK,MAAU,EAAM,SAAS;EACrD,WAAW,EAAU,IAAI,CAAqB;EAC9C,OAAO,EAAW,KAAK,MAAU,CAAC,GAAI,EAAM,SAAS,CAAC,CAAE,CAAC;EACzD,sBAAsB,EAAW,KAAK,MAAU,CAAC,GAAI,EAAM,wBAAwB,CAAC,CAAE,CAAC;EACvF,GAAI,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;CAMxC,GACA,CACF,GAEmC;EACjC,OAAO;EACP;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"relay-instant-operations.js","names":[],"sources":["../../../src/gasless/relay-instant-operations/relay-instant-operations.ts"],"sourcesContent":["import type { Address, Hex } from \"viem\";\nimport type { Config } from \"../../core/config\";\nimport { SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute, GaslessIdempotencyKeyParameter } from \"../../shared/types/properties\";\nimport type { SignedOperation } from \"../../solvers/instant-open/shared/types\";\nimport { formatGaslessOperation } from \"../format-gasless-operation\";\nimport { postGaslessSubmit, resolveGaslessHttp } from \"../http\";\nimport { resolveGaslessIdempotencyKey } from \"../idempotency-key\";\nimport { toGaslessSubmitReceipt } from \"../to-gasless-submit-receipt\";\nimport type { GaslessSubmitReceipt } from \"../types\";\nimport { assertGaslessWalletId, toGaslessWalletIdWire } from \"../wallet-id\";\nimport type { GaslessWireOperationAccepted, GaslessWireRelayInstantRequest } from \"../wire-types\";\n\n/**\n * One pre-signed InstantLayer operation for a relay batch: the struct exactly\n * as it was EIP-712 signed, plus the 65-byte signature. Optional flex fills\n * and their filler signatures ride alongside when a flex-field flow uses them.\n */\nexport interface GaslessSignedOperationInput {\n /** The operation struct exactly as signed. */\n operation: SignedOperation;\n /** 65-byte EIP-712 signature over the operation. */\n signature: Hex;\n /** Flex fill payloads for this operation (rare; defaults to none). */\n fills?: readonly Hex[];\n /** Signatures authorizing the flex fills (parallel to `fills`). */\n flexFillerSignatures?: readonly Hex[];\n /**\n * Which of the owner's GaslessWallets this operation executes from. Defaults\n * to `0n`, which is what every ordinary InstantLayer operation and every\n * delegation grant uses.\n *\n * Only a **gasless-wallet `execute`** operation names a positive id, and the\n * id must match the wallet the operation was signed against: the signed\n * `target` is that wallet's address, so changing the id without re-signing\n * relays the signature against the wrong wallet and the batch reverts.\n */\n walletId?: bigint;\n}\n\n/**\n * Parameters for {@link relayInstantOperations}.\n */\nexport type RelayInstantOperationsParameters = Compute<\n ChainIdParameter &\n GaslessIdempotencyKeyParameter & {\n /**\n * The signed operations, in execution order. The batch is **atomic** — one\n * revert rolls back every operation and every fee — so only bundle\n * operations that must share fate. Replay nonces must be strictly\n * sequential in this order (`current + 1`, `current + 2`, …).\n */\n operations: readonly GaslessSignedOperationInput[];\n /**\n * Workflow label stored with the request (display, metrics, idempotency).\n * Free-form, 1–128 chars; fees are derived on-chain from calldata\n * selectors, never from this. Keep it stable per action.\n */\n operationType: string;\n /** Wallet the workflow is tracked under (not necessarily the raw signer). */\n userAddress: Address;\n /** Optional client accounting id stored with the request. */\n accountId?: string;\n /**\n * Registered result-chained template id; omit for independent batches.\n *\n * The contract's `relayInstantTemplate` takes no wallet ids, so a template\n * batch must leave every operation on wallet `0`.\n */\n templateId?: number;\n /** Non-secret client correlation data stored with the request. */\n metadata?: Record<string, unknown>;\n }\n>;\n\n/** Return type of {@link relayInstantOperations}. */\nexport type RelayInstantOperationsReturnType = GaslessSubmitReceipt;\n\n/**\n * The wallet ids a batch relays under, one per operation, validated.\n *\n * Always sent explicitly, never left to the service's zero-filling default:\n * an omitted array is a legacy-client affordance, and relying on it would make\n * a dropped or reordered id indistinguishable from \"no wallets selected\".\n *\n * @internal\n */\nfunction toGaslessBatchWalletIds(\n operations: readonly GaslessSignedOperationInput[],\n templateId: number | undefined,\n): bigint[] {\n const walletIds = operations.map((entry, index) =>\n assertGaslessWalletId(entry.walletId ?? 0n, `operations[${index}].walletId`),\n );\n if (templateId !== undefined && walletIds.some((walletId) => walletId !== 0n)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_TEMPLATE_WALLET_ID_UNSUPPORTED\",\n `Gasless: templateId ${templateId} relays through relayInstantTemplate, which takes no wallet ids — every operation in a template batch must use wallet 0. Relay gasless-wallet operations as an ordinary batch instead.`,\n );\n }\n return walletIds;\n}\n\n/**\n * Submit signed InstantLayer operations to the GaslessQ relayer.\n *\n * Fire-and-forget: the service validates and simulates the batch, returns\n * `202` with a `request_id`, and broadcasts asynchronously — poll\n * `getGaslessRequest` (or await `waitForGaslessRequest`) to a terminal status.\n *\n * Transport failures are dispositioned before they reach you: a `429` or a\n * gateway-`503` is resent under the same key (it never reached the service),\n * an ambiguous failure is resent once and then thrown as\n * `GASLESS_SUBMIT_UNCONFIRMED` with the exact bytes to replay\n * (`getGaslessUnconfirmedSubmit` → `resubmitGaslessRequest`), and a definitive\n * 4xx is thrown as-is — inspect it with `parseGaslessErrorDetail` or\n * `classifyGaslessFailure`, and treat only `isConfirmedGaslessFeeLimitError` /\n * `isConfirmedGaslessUnavailableError` as safe grounds for a wallet-paid retry.\n *\n * **A 202 is the point of no return**: the workflow exists server-side and the\n * transaction may execute even if polling later fails — never re-submit the\n * same intent through the wallet afterwards.\n *\n * The batch always carries an explicit `walletIds` array, one decimal id per\n * operation, taken from each entry's `walletId` (default `0n`). Persist the\n * receipt's `owner`, `walletIds` and `idempotencyKey` with its `requestId`: a\n * bare request id is not enough context to reconcile a workflow after a reload.\n *\n * `idempotencyKey` is one key per **user action** (default: a random UUID per\n * call). Any later submit under the key, the same signed operations or ones\n * signed again, returns the request the key is bound to (`202`, the same\n * `requestId`) and runs nothing new. The key is used up once that request\n * ends; a new action needs a new key.\n *\n * Sign every operation with a near deadline, as the SDK's own writes do\n * (`GASLESS_SIGNATURE_LIFETIME_SECONDS`). A deadline of `0` never expires, so\n * an unresolved request could never be settled by waiting.\n *\n * @param config - The SDK config.\n * @param parameters - Signed operations, workflow labels, idempotency key.\n * @returns The acceptance receipt; persist `requestId` immediately.\n * @throws {SymmError} `GASLESS_IDEMPOTENCY_KEY_INVALID` for a blank key or one longer than 128 characters.\n * @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION`.\n * @throws {SymmError} `GASLESS_EMPTY_BATCH` for an empty `operations` array.\n * @throws {SymmError} `GASLESS_TEMPLATE_ID_INVALID` for a `templateId` that is not a non-negative safe integer.\n * @throws {SymmError} `GASLESS_TEMPLATE_WALLET_ID_UNSUPPORTED` when a template batch names a non-zero wallet id.\n * @throws {SymmError} `GASLESS_WALLET_ID_INVALID` for a wallet id outside the `uint256` range.\n * @throws {SymmApiError} `GASLESS_RELAY_SUBMIT_FAILED` on HTTP failure.\n * @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` when the outcome could not be\n * established; `responseData` is the replayable submit.\n * @throws {SymmApiError} `GASLESS_INSTANCE_MISMATCH` when a `2xx` came from another\n * protocol instance; the accepted body (its `request_id`) stays in `responseData`.\n *\n * @example\n * ```ts\n * const receipt = await relayInstantOperations(config, {\n * userAddress: owner,\n * operationType: \"initiateWithdraw\",\n * operations: [{ operation, signature }],\n * });\n * const record = await waitForGaslessRequest(config, { requestId: receipt.requestId });\n * ```\n */\nexport async function relayInstantOperations(\n config: Config,\n parameters: RelayInstantOperationsParameters,\n): Promise<RelayInstantOperationsReturnType> {\n const { chainId, operations, operationType, userAddress, accountId, templateId, metadata } = parameters;\n const idempotencyKey = resolveGaslessIdempotencyKey(parameters.idempotencyKey);\n if (operations.length === 0) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_EMPTY_BATCH\",\n \"Gasless: relayInstantOperations needs at least one signed operation — the service rejects an empty batch.\",\n );\n }\n if (templateId !== undefined && (!Number.isSafeInteger(templateId) || templateId < 0)) {\n throw new SymmError(\n \"validation\",\n \"GASLESS_TEMPLATE_ID_INVALID\",\n `Gasless: templateId ${templateId} is not a non-negative safe integer. An unguarded value serializes to JSON \\`null\\`, which the service reads as \"no template\" and relays as a plain batch.`,\n );\n }\n const walletIds = toGaslessBatchWalletIds(operations, templateId);\n\n const context = resolveGaslessHttp(config, { chainId, service: \"operations\" });\n\n const body: GaslessWireRelayInstantRequest = {\n idempotencyKey,\n userAddress,\n ...(accountId !== undefined ? { accountId } : {}),\n operationType,\n ...(templateId !== undefined ? { templateId } : {}),\n signedOps: operations.map((entry) => formatGaslessOperation(entry.operation)),\n signatures: operations.map((entry) => entry.signature),\n walletIds: walletIds.map(toGaslessWalletIdWire),\n fills: operations.map((entry) => [...(entry.fills ?? [])]),\n flexFillerSignatures: operations.map((entry) => [...(entry.flexFillerSignatures ?? [])]),\n ...(metadata !== undefined ? { metadata } : {}),\n };\n\n const raw = await postGaslessSubmit<GaslessWireOperationAccepted>(\n context,\n \"/gateway/relay-instant\",\n body,\n idempotencyKey,\n );\n\n return toGaslessSubmitReceipt(raw, {\n owner: userAddress,\n walletIds,\n idempotencyKey,\n protocolInstance: context.protocolInstance,\n });\n}\n"],"mappings":";;;;;;;AAuFA,SAAS,EACP,GACA,GACU;CACV,IAAM,IAAY,EAAW,KAAK,GAAO,MACvC,EAAsB,EAAM,YAAY,IAAI,cAAc,EAAM,WAAW,CAC7E;CACA,IAAI,MAAe,KAAA,KAAa,EAAU,MAAM,MAAa,MAAa,EAAE,GAC1E,MAAM,IAAI,EACR,cACA,0CACA,uBAAuB,EAAW,uLACpC;CAEF,OAAO;AACT;AA8DA,eAAsB,EACpB,GACA,GAC2C;CAC3C,IAAM,EAAE,YAAS,eAAY,kBAAe,gBAAa,cAAW,eAAY,gBAAa,GACvF,IAAiB,EAA6B,EAAW,cAAc;CAC7E,IAAI,EAAW,WAAW,GACxB,MAAM,IAAI,EACR,cACA,uBACA,2GACF;CAEF,IAAI,MAAe,KAAA,MAAc,CAAC,OAAO,cAAc,CAAU,KAAK,IAAa,IACjF,MAAM,IAAI,EACR,cACA,+BACA,uBAAuB,EAAW,2JACpC;CAEF,IAAM,IAAY,EAAwB,GAAY,CAAU,GAE1D,IAAU,EAAmB,GAAQ;EAAE;EAAS,SAAS;CAAa,CAAC;CAuB7E,OAAO,EAAuB,MAPZ,EAChB,GACA,0BACA;EAhBA;EACA;EACA,GAAI,MAAc,KAAA,IAA4B,CAAC,IAAjB,EAAE,aAAU;EAC1C;EACA,GAAI,MAAe,KAAA,IAA6B,CAAC,IAAlB,EAAE,cAAW;EAC5C,WAAW,EAAW,KAAK,MAAU,EAAuB,EAAM,SAAS,CAAC;EAC5E,YAAY,EAAW,KAAK,MAAU,EAAM,SAAS;EACrD,WAAW,EAAU,IAAI,CAAqB;EAC9C,OAAO,EAAW,KAAK,MAAU,CAAC,GAAI,EAAM,SAAS,CAAC,CAAE,CAAC;EACzD,sBAAsB,EAAW,KAAK,MAAU,CAAC,GAAI,EAAM,wBAAwB,CAAC,CAAE,CAAC;EACvF,GAAI,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;CAMxC,GACA,CACF,GAEmC;EACjC,OAAO;EACP;EACA;EACA,kBAAkB,EAAQ;CAC5B,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayable-writes.d.ts","sourceRoot":"","sources":["../../src/gasless/relayable-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAahF;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,cAAc,GAAG,cAAc,CAAC;AAEhF,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IACpC,0DAA0D;IAC1D,MAAM,EAAE,sBAAsB,CAAC;IAC/B,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,GAAG,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"relayable-writes.d.ts","sourceRoot":"","sources":["../../src/gasless/relayable-writes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,WAAW,EAAE,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AAahF;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,cAAc,GAAG,cAAc,CAAC;AAEhF,sFAAsF;AACtF,MAAM,WAAW,qBAAqB;IACpC,0DAA0D;IAC1D,MAAM,EAAE,sBAAsB,CAAC;IAC/B,8EAA8E;IAC9E,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,GAAG,EAAE,qBAAqB,CA4F3E,CAAC;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,2BAA2B,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CASxE,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,EAAE,SAAS,GAAG,EAAyC,CAAC;AAEhG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,6BAA6B,EAAE,SAAS,GAAG,EAcvD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,sCAAsC,EAAE,SAAS,GAAG,EAEhE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,GAAG,GAAG,OAAO,CAEjE"}
|
|
@@ -53,6 +53,10 @@ var a = new Map([
|
|
|
53
53
|
target: "symmio",
|
|
54
54
|
operationType: "approveOperationalFee"
|
|
55
55
|
}],
|
|
56
|
+
[i(n, "approveOperationalFee"), {
|
|
57
|
+
target: "symmio",
|
|
58
|
+
operationType: "approveOperationalFeeAllowance"
|
|
59
|
+
}],
|
|
56
60
|
[i(e, "addMargin"), {
|
|
57
61
|
target: "accountLayer",
|
|
58
62
|
operationType: "addMargin"
|
|
@@ -61,6 +65,26 @@ var a = new Map([
|
|
|
61
65
|
target: "accountLayer",
|
|
62
66
|
operationType: "removeMargin"
|
|
63
67
|
}],
|
|
68
|
+
[i(e, "setupTimelocks"), {
|
|
69
|
+
target: "accountLayer",
|
|
70
|
+
operationType: "setupTimelocks"
|
|
71
|
+
}],
|
|
72
|
+
[i(e, "clearTimelocks"), {
|
|
73
|
+
target: "accountLayer",
|
|
74
|
+
operationType: "clearTimelocks"
|
|
75
|
+
}],
|
|
76
|
+
[i(e, "scheduleTimelockOp"), {
|
|
77
|
+
target: "accountLayer",
|
|
78
|
+
operationType: "scheduleTimelockOp"
|
|
79
|
+
}],
|
|
80
|
+
[i(e, "cancelTimelockOp"), {
|
|
81
|
+
target: "accountLayer",
|
|
82
|
+
operationType: "cancelTimelockOp"
|
|
83
|
+
}],
|
|
84
|
+
[i(e, "executeTimelockOp"), {
|
|
85
|
+
target: "accountLayer",
|
|
86
|
+
operationType: "executeTimelockOp"
|
|
87
|
+
}],
|
|
64
88
|
[i(e, "createSubAccounts"), {
|
|
65
89
|
target: "accountLayer",
|
|
66
90
|
operationType: "createSubAccounts"
|
|
@@ -84,6 +108,10 @@ var a = new Map([
|
|
|
84
108
|
[i(t, "grantDelegation"), {
|
|
85
109
|
target: "instantLayer",
|
|
86
110
|
operationType: "grantDelegation"
|
|
111
|
+
}],
|
|
112
|
+
[i(t, "grantDelegations"), {
|
|
113
|
+
target: "instantLayer",
|
|
114
|
+
operationType: "grantDelegations"
|
|
87
115
|
}]
|
|
88
116
|
]), o = new Map([
|
|
89
117
|
n,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relayable-writes.js","names":[],"sources":["../../src/gasless/relayable-writes.ts"],"sourcesContent":["import { toFunctionSelector, type Abi, type AbiFunction, type Hex } from \"viem\";\nimport { accountLayerAbi } from \"../symmio-contracts/abi/v0.8.6/account-layer\";\nimport { instantLayerAbi } from \"../symmio-contracts/abi/v0.8.6/instant-layer\";\nimport { symmioAbi } from \"../symmio-contracts/abi/v0.8.6/symmio\";\n\nfunction selectorFromAbi(abi: Abi, name: string): Hex {\n const fragment = abi.find((item) => item.type === \"function\" && item.name === name) as AbiFunction | undefined;\n if (!fragment) {\n throw new Error(`relayable-writes: ABI is missing function \"${name}\" — the shipped ABI changed shape.`);\n }\n return toFunctionSelector(fragment);\n}\n\n/**\n * Which contract a relayable write targets.\n *\n * The transparent dispatcher does not read it — the seam that builds the call\n * supplies the concrete address — but a gasless batch resolves each call's\n * target from it (`relayGaslessBatch`), which is why it must name the contract\n * that actually declares the function.\n */\nexport type GaslessRelayableTarget = \"symmio\" | \"accountLayer\" | \"instantLayer\";\n\n/** One relayable write: its target contract and the workflow label to relay under. */\nexport interface GaslessRelayableWrite {\n /** Contract the InstantLayer calls with this calldata. */\n target: GaslessRelayableTarget;\n /** Stable `operationType` label stored with relayed requests of this kind. */\n operationType: string;\n}\n\n/**\n * The selector → relayable-write map behind the transparent gasless mode.\n * Selectors are derived from the shipped v0.8.6 ABIs at module load (never\n * hardcoded), so an ABI change fails loudly here. Gasless is a perps-core-only\n * facility, which makes the shipped ABIs exactly the deployment it targets.\n *\n * The map gates only what the SDK *attempts* — whether the vendor's fee policy\n * accepts a selector is enforced server-side and surfaces as a submit error,\n * so vendor policy never needs to be mirrored here.\n *\n * @internal\n */\nexport const GASLESS_RELAYABLE_WRITES: ReadonlyMap<Hex, GaslessRelayableWrite> = new Map<Hex, GaslessRelayableWrite>([\n /** AccountLayer._call-proxied core-diamond writes (signerAccount = the sub-account). */\n [selectorFromAbi(symmioAbi as Abi, \"allocate\"), { target: \"symmio\", operationType: \"allocate\" }],\n [selectorFromAbi(symmioAbi as Abi, \"deallocate\"), { target: \"symmio\", operationType: \"deallocate\" }],\n [selectorFromAbi(symmioAbi as Abi, \"initiateWithdraw\"), { target: \"symmio\", operationType: \"initiateWithdraw\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestCancelWithdraw\"),\n { target: \"symmio\", operationType: \"requestCancelWithdraw\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"finalizeWithdrawRequest\"),\n { target: \"symmio\", operationType: \"finalizeWithdrawRequest\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelQuote\"),\n { target: \"symmio\", operationType: \"requestToCancelQuote\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelCloseRequest\"),\n { target: \"symmio\", operationType: \"requestToCancelCloseRequest\" },\n ],\n [selectorFromAbi(symmioAbi as Abi, \"forceCancelQuote\"), { target: \"symmio\", operationType: \"forceCancelQuote\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"forceCancelCloseRequest\"),\n { target: \"symmio\", operationType: \"forceCancelCloseRequest\" },\n ],\n [selectorFromAbi(symmioAbi as Abi, \"forceClosePosition\"), { target: \"symmio\", operationType: \"forceClosePosition\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"approveOperationalFeeWithMultiplier\"),\n { target: \"symmio\", operationType: \"approveOperationalFee\" },\n ],\n /**\n * Direct AccountLayer writes. The billing `signerAccount` differs per write:\n * the VA's parent sub-account for margin, the named sub-account for the rest,\n * and `gasless.account` (required) for `createSubAccounts`, whose accounts do\n * not exist yet.\n */\n [selectorFromAbi(accountLayerAbi as Abi, \"addMargin\"), { target: \"accountLayer\", operationType: \"addMargin\" }],\n [selectorFromAbi(accountLayerAbi as Abi, \"removeMargin\"), { target: \"accountLayer\", operationType: \"removeMargin\" }],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"createSubAccounts\"),\n { target: \"accountLayer\", operationType: \"createSubAccounts\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"deleteSubAccount\"),\n { target: \"accountLayer\", operationType: \"deleteSubAccount\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"editAccountName\"),\n { target: \"accountLayer\", operationType: \"editAccountName\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"depositForAccount\"),\n { target: \"accountLayer\", operationType: \"depositForAccount\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"depositAndAllocateForAccount\"),\n { target: \"accountLayer\", operationType: \"depositAndAllocateForAccount\" },\n ],\n /** Direct InstantLayer write (signerAccount = the granting sub-account itself). */\n [\n selectorFromAbi(instantLayerAbi as Abi, \"grantDelegation\"),\n { target: \"instantLayer\", operationType: \"grantDelegation\" },\n ],\n]);\n\n/**\n * Every relayable write's ABI item, keyed by function name — the names a\n * gasless batch call may use without passing an ABI\n * (`{ functionName: \"allocate\", args }`), and each one's exact inputs.\n *\n * Derived from the same shipped ABIs as {@link GASLESS_RELAYABLE_SELECTORS}, so\n * it holds exactly the relayable functions and can never name one the relayer\n * would refuse. Use it to list the writes a batch can carry, or to show a\n * call's signature.\n *\n * @example\n * ```ts\n * import { formatAbiItem } from \"viem/utils\";\n *\n * for (const item of GASLESS_RELAYABLE_FUNCTIONS.values()) console.log(formatAbiItem(item, { includeName: true }));\n * // \"allocate(uint256 amount)\", …\n * ```\n */\nexport const GASLESS_RELAYABLE_FUNCTIONS: ReadonlyMap<string, AbiFunction> = new Map(\n [symmioAbi, accountLayerAbi, instantLayerAbi].flatMap((abi) =>\n (abi as Abi)\n .filter(\n (item): item is AbiFunction =>\n item.type === \"function\" && GASLESS_RELAYABLE_WRITES.has(toFunctionSelector(item)),\n )\n .map((item) => [item.name, item] as const),\n ),\n);\n\n/**\n * Every selector the transparent gasless mode can relay.\n *\n * **Not a delegation set.** This list includes `grantDelegation`, because the\n * relayer carries it like any other write — but delegating that selector buys a\n * session key nothing. The InstantLayer routes an operation whose target is the\n * InstantLayer itself to `_verifyGrantOperation`, which reverts unless the\n * signer is the account owner, and `grantDelegation` is `onlyOwner` on top of\n * that: a delegate-signed grant is rejected by the contract outright. Handing a\n * key the selector would only turn a clear \"the owner must sign this\" into an\n * opaque relay rejection, so no delegation set carries it. To onboard a key,\n * use `getSessionKeySelectors`.\n */\nexport const GASLESS_RELAYABLE_SELECTORS: readonly Hex[] = [...GASLESS_RELAYABLE_WRITES.keys()];\n\n/**\n * The selectors safe to delegate to a session key for gasless account\n * management — everything a key needs to run an account unattended **except**\n * moving collateral out of it (see {@link GASLESS_SESSION_KEY_WITHDRAW_SELECTORS}).\n *\n * **Enumerated deliberately — never derived from {@link GASLESS_RELAYABLE_WRITES}.**\n * Relayability and delegability are different questions. The first asks whether\n * the relayer will carry a write at all; the second asks whether a browser-held\n * key may sign it with no wallet prompt. Deriving this list from the map would\n * widen a session key's authority every time a write becomes relayable, so each\n * selector is listed here on its own merits.\n *\n * Deliberately absent, though relayable:\n *\n * - `initiateWithdraw` — the one write that picks a destination for the\n * sub-account's collateral. It lives in\n * {@link GASLESS_SESSION_KEY_WITHDRAW_SELECTORS}, granted only on an explicit\n * opt-in.\n * - `createSubAccounts` — the one relayable AccountLayer write with **no**\n * `onlyAccountOwner` guard, so the InstantLayer's per-account delegation scope\n * never confines it: a key granted this selector is not bounded to the account\n * that granted it. It stays owner-signed for that reason, not because creating\n * an account is sensitive.\n * - `deleteSubAccount` — destroys the account the delegation is scoped to, which\n * is not a step a key should take unattended.\n * - `depositForAccount` and `depositAndAllocateForAccount` — `CoreFacet` funds\n * these straight from the signer's own token balance, so they reach collateral\n * that has not entered the sub-account yet.\n * - `grantDelegation` — the contract rejects a delegate-signed grant (see\n * {@link GASLESS_RELAYABLE_SELECTORS}), so it would relay only to revert.\n *\n * `editAccountName` and `forceClosePosition` **are** in the set: the first is\n * scope-confined by `onlyAccountOwner` and writes nothing but a bounded display\n * string, and the second is guarded identically to the two force-cancels beside\n * it and can only finish a close the owner already initiated.\n *\n * Pair it with `grantDelegation` (itself relayable, so the onboarding grant\n * needs no gas either) to give a key promptless account management. In an app\n * that also trades, prefer `getSessionKeySelectors`, which unions this set with\n * the trade lifecycle and resolves the chain's contracts generation for you.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: GASLESS_SESSION_KEY_SELECTORS,\n * expiryTimestamp,\n * gasless: true,\n * });\n * ```\n */\nexport const GASLESS_SESSION_KEY_SELECTORS: readonly Hex[] = [\n selectorFromAbi(symmioAbi as Abi, \"allocate\"),\n selectorFromAbi(symmioAbi as Abi, \"deallocate\"),\n selectorFromAbi(symmioAbi as Abi, \"requestCancelWithdraw\"),\n selectorFromAbi(symmioAbi as Abi, \"finalizeWithdrawRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelQuote\"),\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelCloseRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"forceCancelQuote\"),\n selectorFromAbi(symmioAbi as Abi, \"forceCancelCloseRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"forceClosePosition\"),\n selectorFromAbi(symmioAbi as Abi, \"approveOperationalFeeWithMultiplier\"),\n selectorFromAbi(accountLayerAbi as Abi, \"addMargin\"),\n selectorFromAbi(accountLayerAbi as Abi, \"removeMargin\"),\n selectorFromAbi(accountLayerAbi as Abi, \"editAccountName\"),\n];\n\n/**\n * The withdrawal authority a session key only gets on an explicit opt-in:\n * `initiateWithdraw`, and nothing else.\n *\n * It is split out of {@link GASLESS_SESSION_KEY_SELECTORS} because it is the one\n * delegable write that names a destination.\n * `initiateWithdraw(WithdrawPart[] parts, bool speedUp, bytes data)` carries a\n * caller-supplied `receiver` in every part, so a key holding this selector can\n * send the sub-account's collateral to an address of its own choosing — that is\n * authority over the funds, not merely over the account's bookkeeping.\n *\n * The other two withdrawal writes stay in the base set precisely because they\n * cannot do that: `finalizeWithdrawRequest(address user, uint256 requestId)` and\n * `requestCancelWithdraw(uint256 requestId)` take no receiver at all. They can\n * only settle or cancel a request whose destination an owner-signed\n * `initiateWithdraw` already fixed, so the worst a key can do with them is\n * complete or unwind a transfer the owner authorized.\n *\n * Grant it when a key must run withdrawals end to end unattended, and treat the\n * grant as what it is: the key can drain the sub-account until the delegation\n * expires or is revoked.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: [...GASLESS_SESSION_KEY_SELECTORS, ...GASLESS_SESSION_KEY_WITHDRAW_SELECTORS],\n * expiryTimestamp,\n * gasless: true,\n * });\n * ```\n */\nexport const GASLESS_SESSION_KEY_WITHDRAW_SELECTORS: readonly Hex[] = [\n selectorFromAbi(symmioAbi as Abi, \"initiateWithdraw\"),\n];\n\n/**\n * Whether a calldata selector is relayable by the transparent gasless mode.\n *\n * @param selector - A `0x`-prefixed 4-byte selector (calldata's first 4 bytes).\n * @returns `true` when the gasless dispatcher would attempt to relay it.\n *\n * @example\n * ```ts\n * isGaslessRelayableSelector(calldata.slice(0, 10) as Hex);\n * ```\n */\nexport function isGaslessRelayableSelector(selector: Hex): boolean {\n return GASLESS_RELAYABLE_WRITES.has(selector.toLowerCase() as Hex);\n}\n"],"mappings":";;;;;AAKA,SAAS,EAAgB,GAAU,GAAmB;CACpD,IAAM,IAAW,EAAI,MAAM,MAAS,EAAK,SAAS,cAAc,EAAK,SAAS,CAAI;CAClF,IAAI,CAAC,GACH,MAAU,MAAM,8CAA8C,EAAK,mCAAmC;CAExG,OAAO,EAAmB,CAAQ;AACpC;AAgCA,IAAa,IAAoE,IAAI,IAAgC;CAEnH,CAAC,EAAgB,GAAkB,UAAU,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAW,CAAC;CAC/F,CAAC,EAAgB,GAAkB,YAAY,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAa,CAAC;CACnG,CAAC,EAAgB,GAAkB,kBAAkB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAmB,CAAC;CAC/G,CACE,EAAgB,GAAkB,uBAAuB,GACzD;EAAE,QAAQ;EAAU,eAAe;CAAwB,CAC7D;CACA,CACE,EAAgB,GAAkB,yBAAyB,GAC3D;EAAE,QAAQ;EAAU,eAAe;CAA0B,CAC/D;CACA,CACE,EAAgB,GAAkB,sBAAsB,GACxD;EAAE,QAAQ;EAAU,eAAe;CAAuB,CAC5D;CACA,CACE,EAAgB,GAAkB,6BAA6B,GAC/D;EAAE,QAAQ;EAAU,eAAe;CAA8B,CACnE;CACA,CAAC,EAAgB,GAAkB,kBAAkB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAmB,CAAC;CAC/G,CACE,EAAgB,GAAkB,yBAAyB,GAC3D;EAAE,QAAQ;EAAU,eAAe;CAA0B,CAC/D;CACA,CAAC,EAAgB,GAAkB,oBAAoB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAqB,CAAC;CACnH,CACE,EAAgB,GAAkB,qCAAqC,GACvE;EAAE,QAAQ;EAAU,eAAe;CAAwB,CAC7D;CAOA,CAAC,EAAgB,GAAwB,WAAW,GAAG;EAAE,QAAQ;EAAgB,eAAe;CAAY,CAAC;CAC7G,CAAC,EAAgB,GAAwB,cAAc,GAAG;EAAE,QAAQ;EAAgB,eAAe;CAAe,CAAC;CACnH,CACE,EAAgB,GAAwB,mBAAmB,GAC3D;EAAE,QAAQ;EAAgB,eAAe;CAAoB,CAC/D;CACA,CACE,EAAgB,GAAwB,kBAAkB,GAC1D;EAAE,QAAQ;EAAgB,eAAe;CAAmB,CAC9D;CACA,CACE,EAAgB,GAAwB,iBAAiB,GACzD;EAAE,QAAQ;EAAgB,eAAe;CAAkB,CAC7D;CACA,CACE,EAAgB,GAAwB,mBAAmB,GAC3D;EAAE,QAAQ;EAAgB,eAAe;CAAoB,CAC/D;CACA,CACE,EAAgB,GAAwB,8BAA8B,GACtE;EAAE,QAAQ;EAAgB,eAAe;CAA+B,CAC1E;CAEA,CACE,EAAgB,GAAwB,iBAAiB,GACzD;EAAE,QAAQ;EAAgB,eAAe;CAAkB,CAC7D;AACF,CAAC,GAoBY,IAAgE,IAAI,IAC/E;CAAC;CAAW;CAAiB;AAAe,EAAE,SAAS,MACpD,EACE,QACE,MACC,EAAK,SAAS,cAAc,EAAyB,IAAI,EAAmB,CAAI,CAAC,CACrF,EACC,KAAK,MAAS,CAAC,EAAK,MAAM,CAAI,CAAU,CAC7C,CACF,GAea,IAA8C,CAAC,GAAG,EAAyB,KAAK,CAAC,GAsDjF,IAAgD;CAC3D,EAAgB,GAAkB,UAAU;CAC5C,EAAgB,GAAkB,YAAY;CAC9C,EAAgB,GAAkB,uBAAuB;CACzD,EAAgB,GAAkB,yBAAyB;CAC3D,EAAgB,GAAkB,sBAAsB;CACxD,EAAgB,GAAkB,6BAA6B;CAC/D,EAAgB,GAAkB,kBAAkB;CACpD,EAAgB,GAAkB,yBAAyB;CAC3D,EAAgB,GAAkB,oBAAoB;CACtD,EAAgB,GAAkB,qCAAqC;CACvE,EAAgB,GAAwB,WAAW;CACnD,EAAgB,GAAwB,cAAc;CACtD,EAAgB,GAAwB,iBAAiB;AAC3D,GAmCa,IAAyD,CACpE,EAAgB,GAAkB,kBAAkB,CACtD;AAaA,SAAgB,EAA2B,GAAwB;CACjE,OAAO,EAAyB,IAAI,EAAS,YAAY,CAAQ;AACnE"}
|
|
1
|
+
{"version":3,"file":"relayable-writes.js","names":[],"sources":["../../src/gasless/relayable-writes.ts"],"sourcesContent":["import { toFunctionSelector, type Abi, type AbiFunction, type Hex } from \"viem\";\nimport { accountLayerAbi } from \"../symmio-contracts/abi/v0.8.6/account-layer\";\nimport { instantLayerAbi } from \"../symmio-contracts/abi/v0.8.6/instant-layer\";\nimport { symmioAbi } from \"../symmio-contracts/abi/v0.8.6/symmio\";\n\nfunction selectorFromAbi(abi: Abi, name: string): Hex {\n const fragment = abi.find((item) => item.type === \"function\" && item.name === name) as AbiFunction | undefined;\n if (!fragment) {\n throw new Error(`relayable-writes: ABI is missing function \"${name}\" — the shipped ABI changed shape.`);\n }\n return toFunctionSelector(fragment);\n}\n\n/**\n * Which contract a relayable write targets.\n *\n * The transparent dispatcher does not read it — the seam that builds the call\n * supplies the concrete address — but a gasless batch resolves each call's\n * target from it (`relayGaslessBatch`), which is why it must name the contract\n * that actually declares the function.\n */\nexport type GaslessRelayableTarget = \"symmio\" | \"accountLayer\" | \"instantLayer\";\n\n/** One relayable write: its target contract and the workflow label to relay under. */\nexport interface GaslessRelayableWrite {\n /** Contract the InstantLayer calls with this calldata. */\n target: GaslessRelayableTarget;\n /** Stable `operationType` label stored with relayed requests of this kind. */\n operationType: string;\n}\n\n/**\n * The selector → relayable-write map behind the transparent gasless mode.\n * Selectors are derived from the shipped v0.8.6 ABIs at module load (never\n * hardcoded), so an ABI change fails loudly here. Gasless is a perps-core-only\n * facility, which makes the shipped ABIs exactly the deployment it targets.\n *\n * The map gates only what the SDK *attempts* — whether the vendor's fee policy\n * accepts a selector is enforced server-side and surfaces as a submit error,\n * so vendor policy never needs to be mirrored here.\n *\n * @internal\n */\nexport const GASLESS_RELAYABLE_WRITES: ReadonlyMap<Hex, GaslessRelayableWrite> = new Map<Hex, GaslessRelayableWrite>([\n /** AccountLayer._call-proxied core-diamond writes (signerAccount = the sub-account). */\n [selectorFromAbi(symmioAbi as Abi, \"allocate\"), { target: \"symmio\", operationType: \"allocate\" }],\n [selectorFromAbi(symmioAbi as Abi, \"deallocate\"), { target: \"symmio\", operationType: \"deallocate\" }],\n [selectorFromAbi(symmioAbi as Abi, \"initiateWithdraw\"), { target: \"symmio\", operationType: \"initiateWithdraw\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestCancelWithdraw\"),\n { target: \"symmio\", operationType: \"requestCancelWithdraw\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"finalizeWithdrawRequest\"),\n { target: \"symmio\", operationType: \"finalizeWithdrawRequest\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelQuote\"),\n { target: \"symmio\", operationType: \"requestToCancelQuote\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelCloseRequest\"),\n { target: \"symmio\", operationType: \"requestToCancelCloseRequest\" },\n ],\n [selectorFromAbi(symmioAbi as Abi, \"forceCancelQuote\"), { target: \"symmio\", operationType: \"forceCancelQuote\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"forceCancelCloseRequest\"),\n { target: \"symmio\", operationType: \"forceCancelCloseRequest\" },\n ],\n [selectorFromAbi(symmioAbi as Abi, \"forceClosePosition\"), { target: \"symmio\", operationType: \"forceClosePosition\" }],\n [\n selectorFromAbi(symmioAbi as Abi, \"approveOperationalFeeWithMultiplier\"),\n { target: \"symmio\", operationType: \"approveOperationalFee\" },\n ],\n [\n selectorFromAbi(symmioAbi as Abi, \"approveOperationalFee\"),\n { target: \"symmio\", operationType: \"approveOperationalFeeAllowance\" },\n ],\n /**\n * Direct AccountLayer writes. The billing `signerAccount` differs per write:\n * the VA's parent sub-account for margin, the named sub-account for the rest,\n * and `gasless.account` (required) for `createSubAccounts`, whose accounts do\n * not exist yet.\n */\n [selectorFromAbi(accountLayerAbi as Abi, \"addMargin\"), { target: \"accountLayer\", operationType: \"addMargin\" }],\n [selectorFromAbi(accountLayerAbi as Abi, \"removeMargin\"), { target: \"accountLayer\", operationType: \"removeMargin\" }],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"setupTimelocks\"),\n { target: \"accountLayer\", operationType: \"setupTimelocks\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"clearTimelocks\"),\n { target: \"accountLayer\", operationType: \"clearTimelocks\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"scheduleTimelockOp\"),\n { target: \"accountLayer\", operationType: \"scheduleTimelockOp\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"cancelTimelockOp\"),\n { target: \"accountLayer\", operationType: \"cancelTimelockOp\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"executeTimelockOp\"),\n { target: \"accountLayer\", operationType: \"executeTimelockOp\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"createSubAccounts\"),\n { target: \"accountLayer\", operationType: \"createSubAccounts\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"deleteSubAccount\"),\n { target: \"accountLayer\", operationType: \"deleteSubAccount\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"editAccountName\"),\n { target: \"accountLayer\", operationType: \"editAccountName\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"depositForAccount\"),\n { target: \"accountLayer\", operationType: \"depositForAccount\" },\n ],\n [\n selectorFromAbi(accountLayerAbi as Abi, \"depositAndAllocateForAccount\"),\n { target: \"accountLayer\", operationType: \"depositAndAllocateForAccount\" },\n ],\n /** Direct InstantLayer writes (signerAccount = the granting sub-account itself). */\n [\n selectorFromAbi(instantLayerAbi as Abi, \"grantDelegation\"),\n { target: \"instantLayer\", operationType: \"grantDelegation\" },\n ],\n [\n selectorFromAbi(instantLayerAbi as Abi, \"grantDelegations\"),\n { target: \"instantLayer\", operationType: \"grantDelegations\" },\n ],\n]);\n\n/**\n * Every relayable write's ABI item, keyed by function name — the names a\n * gasless batch call may use without passing an ABI\n * (`{ functionName: \"allocate\", args }`), and each one's exact inputs.\n *\n * Derived from the same shipped ABIs as {@link GASLESS_RELAYABLE_SELECTORS}, so\n * it holds exactly the relayable functions and can never name one the relayer\n * would refuse. Use it to list the writes a batch can carry, or to show a\n * call's signature.\n *\n * @example\n * ```ts\n * import { formatAbiItem } from \"viem/utils\";\n *\n * for (const item of GASLESS_RELAYABLE_FUNCTIONS.values()) console.log(formatAbiItem(item, { includeName: true }));\n * // \"allocate(uint256 amount)\", …\n * ```\n */\nexport const GASLESS_RELAYABLE_FUNCTIONS: ReadonlyMap<string, AbiFunction> = new Map(\n [symmioAbi, accountLayerAbi, instantLayerAbi].flatMap((abi) =>\n (abi as Abi)\n .filter(\n (item): item is AbiFunction =>\n item.type === \"function\" && GASLESS_RELAYABLE_WRITES.has(toFunctionSelector(item)),\n )\n .map((item) => [item.name, item] as const),\n ),\n);\n\n/**\n * Every selector the transparent gasless mode can relay.\n *\n * **Not a delegation set.** This list includes `grantDelegation`, because the\n * relayer carries it like any other write — but delegating that selector buys a\n * session key nothing. The InstantLayer routes an operation whose target is the\n * InstantLayer itself to `_verifyGrantOperation`, which reverts unless the\n * signer is the account owner, and `grantDelegation` is `onlyOwner` on top of\n * that: a delegate-signed grant is rejected by the contract outright. Handing a\n * key the selector would only turn a clear \"the owner must sign this\" into an\n * opaque relay rejection, so no delegation set carries it. To onboard a key,\n * use `getSessionKeySelectors`.\n */\nexport const GASLESS_RELAYABLE_SELECTORS: readonly Hex[] = [...GASLESS_RELAYABLE_WRITES.keys()];\n\n/**\n * The selectors safe to delegate to a session key for gasless account\n * management — everything a key needs to run an account unattended **except**\n * moving collateral out of it (see {@link GASLESS_SESSION_KEY_WITHDRAW_SELECTORS}).\n *\n * **Enumerated deliberately — never derived from {@link GASLESS_RELAYABLE_WRITES}.**\n * Relayability and delegability are different questions. The first asks whether\n * the relayer will carry a write at all; the second asks whether a browser-held\n * key may sign it with no wallet prompt. Deriving this list from the map would\n * widen a session key's authority every time a write becomes relayable, so each\n * selector is listed here on its own merits.\n *\n * Deliberately absent, though relayable:\n *\n * - `initiateWithdraw` — the one write that picks a destination for the\n * sub-account's collateral. It lives in\n * {@link GASLESS_SESSION_KEY_WITHDRAW_SELECTORS}, granted only on an explicit\n * opt-in.\n * - `createSubAccounts` — the one relayable AccountLayer write with **no**\n * `onlyAccountOwner` guard, so the InstantLayer's per-account delegation scope\n * never confines it: a key granted this selector is not bounded to the account\n * that granted it. It stays owner-signed for that reason, not because creating\n * an account is sensitive.\n * - `deleteSubAccount` — destroys the account the delegation is scoped to, which\n * is not a step a key should take unattended.\n * - `depositForAccount` and `depositAndAllocateForAccount` — `CoreFacet` funds\n * these straight from the signer's own token balance, so they reach collateral\n * that has not entered the sub-account yet.\n * - `grantDelegation` — the contract rejects a delegate-signed grant (see\n * {@link GASLESS_RELAYABLE_SELECTORS}), so it would relay only to revert.\n *\n * `editAccountName` and `forceClosePosition` **are** in the set: the first is\n * scope-confined by `onlyAccountOwner` and writes nothing but a bounded display\n * string, and the second is guarded identically to the two force-cancels beside\n * it and can only finish a close the owner already initiated.\n *\n * Pair it with `grantDelegation` (itself relayable, so the onboarding grant\n * needs no gas either) to give a key promptless account management. In an app\n * that also trades, prefer `getSessionKeySelectors`, which unions this set with\n * the trade lifecycle and resolves the chain's contracts generation for you.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: GASLESS_SESSION_KEY_SELECTORS,\n * expiryTimestamp,\n * gasless: true,\n * });\n * ```\n */\nexport const GASLESS_SESSION_KEY_SELECTORS: readonly Hex[] = [\n selectorFromAbi(symmioAbi as Abi, \"allocate\"),\n selectorFromAbi(symmioAbi as Abi, \"deallocate\"),\n selectorFromAbi(symmioAbi as Abi, \"requestCancelWithdraw\"),\n selectorFromAbi(symmioAbi as Abi, \"finalizeWithdrawRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelQuote\"),\n selectorFromAbi(symmioAbi as Abi, \"requestToCancelCloseRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"forceCancelQuote\"),\n selectorFromAbi(symmioAbi as Abi, \"forceCancelCloseRequest\"),\n selectorFromAbi(symmioAbi as Abi, \"forceClosePosition\"),\n selectorFromAbi(symmioAbi as Abi, \"approveOperationalFeeWithMultiplier\"),\n selectorFromAbi(accountLayerAbi as Abi, \"addMargin\"),\n selectorFromAbi(accountLayerAbi as Abi, \"removeMargin\"),\n selectorFromAbi(accountLayerAbi as Abi, \"editAccountName\"),\n];\n\n/**\n * The withdrawal authority a session key only gets on an explicit opt-in:\n * `initiateWithdraw`, and nothing else.\n *\n * It is split out of {@link GASLESS_SESSION_KEY_SELECTORS} because it is the one\n * delegable write that names a destination.\n * `initiateWithdraw(WithdrawPart[] parts, bool speedUp, bytes data)` carries a\n * caller-supplied `receiver` in every part, so a key holding this selector can\n * send the sub-account's collateral to an address of its own choosing — that is\n * authority over the funds, not merely over the account's bookkeeping.\n *\n * The other two withdrawal writes stay in the base set precisely because they\n * cannot do that: `finalizeWithdrawRequest(address user, uint256 requestId)` and\n * `requestCancelWithdraw(uint256 requestId)` take no receiver at all. They can\n * only settle or cancel a request whose destination an owner-signed\n * `initiateWithdraw` already fixed, so the worst a key can do with them is\n * complete or unwind a transfer the owner authorized.\n *\n * Grant it when a key must run withdrawals end to end unattended, and treat the\n * grant as what it is: the key can drain the sub-account until the delegation\n * expires or is revoked.\n *\n * @example\n * ```ts\n * await grantDelegation(config, {\n * account: { addr: subAccount, isPartyB: false },\n * delegatedSigner: sessionKey,\n * selectors: [...GASLESS_SESSION_KEY_SELECTORS, ...GASLESS_SESSION_KEY_WITHDRAW_SELECTORS],\n * expiryTimestamp,\n * gasless: true,\n * });\n * ```\n */\nexport const GASLESS_SESSION_KEY_WITHDRAW_SELECTORS: readonly Hex[] = [\n selectorFromAbi(symmioAbi as Abi, \"initiateWithdraw\"),\n];\n\n/**\n * Whether a calldata selector is relayable by the transparent gasless mode.\n *\n * @param selector - A `0x`-prefixed 4-byte selector (calldata's first 4 bytes).\n * @returns `true` when the gasless dispatcher would attempt to relay it.\n *\n * @example\n * ```ts\n * isGaslessRelayableSelector(calldata.slice(0, 10) as Hex);\n * ```\n */\nexport function isGaslessRelayableSelector(selector: Hex): boolean {\n return GASLESS_RELAYABLE_WRITES.has(selector.toLowerCase() as Hex);\n}\n"],"mappings":";;;;;AAKA,SAAS,EAAgB,GAAU,GAAmB;CACpD,IAAM,IAAW,EAAI,MAAM,MAAS,EAAK,SAAS,cAAc,EAAK,SAAS,CAAI;CAClF,IAAI,CAAC,GACH,MAAU,MAAM,8CAA8C,EAAK,mCAAmC;CAExG,OAAO,EAAmB,CAAQ;AACpC;AAgCA,IAAa,IAAoE,IAAI,IAAgC;CAEnH,CAAC,EAAgB,GAAkB,UAAU,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAW,CAAC;CAC/F,CAAC,EAAgB,GAAkB,YAAY,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAa,CAAC;CACnG,CAAC,EAAgB,GAAkB,kBAAkB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAmB,CAAC;CAC/G,CACE,EAAgB,GAAkB,uBAAuB,GACzD;EAAE,QAAQ;EAAU,eAAe;CAAwB,CAC7D;CACA,CACE,EAAgB,GAAkB,yBAAyB,GAC3D;EAAE,QAAQ;EAAU,eAAe;CAA0B,CAC/D;CACA,CACE,EAAgB,GAAkB,sBAAsB,GACxD;EAAE,QAAQ;EAAU,eAAe;CAAuB,CAC5D;CACA,CACE,EAAgB,GAAkB,6BAA6B,GAC/D;EAAE,QAAQ;EAAU,eAAe;CAA8B,CACnE;CACA,CAAC,EAAgB,GAAkB,kBAAkB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAmB,CAAC;CAC/G,CACE,EAAgB,GAAkB,yBAAyB,GAC3D;EAAE,QAAQ;EAAU,eAAe;CAA0B,CAC/D;CACA,CAAC,EAAgB,GAAkB,oBAAoB,GAAG;EAAE,QAAQ;EAAU,eAAe;CAAqB,CAAC;CACnH,CACE,EAAgB,GAAkB,qCAAqC,GACvE;EAAE,QAAQ;EAAU,eAAe;CAAwB,CAC7D;CACA,CACE,EAAgB,GAAkB,uBAAuB,GACzD;EAAE,QAAQ;EAAU,eAAe;CAAiC,CACtE;CAOA,CAAC,EAAgB,GAAwB,WAAW,GAAG;EAAE,QAAQ;EAAgB,eAAe;CAAY,CAAC;CAC7G,CAAC,EAAgB,GAAwB,cAAc,GAAG;EAAE,QAAQ;EAAgB,eAAe;CAAe,CAAC;CACnH,CACE,EAAgB,GAAwB,gBAAgB,GACxD;EAAE,QAAQ;EAAgB,eAAe;CAAiB,CAC5D;CACA,CACE,EAAgB,GAAwB,gBAAgB,GACxD;EAAE,QAAQ;EAAgB,eAAe;CAAiB,CAC5D;CACA,CACE,EAAgB,GAAwB,oBAAoB,GAC5D;EAAE,QAAQ;EAAgB,eAAe;CAAqB,CAChE;CACA,CACE,EAAgB,GAAwB,kBAAkB,GAC1D;EAAE,QAAQ;EAAgB,eAAe;CAAmB,CAC9D;CACA,CACE,EAAgB,GAAwB,mBAAmB,GAC3D;EAAE,QAAQ;EAAgB,eAAe;CAAoB,CAC/D;CACA,CACE,EAAgB,GAAwB,mBAAmB,GAC3D;EAAE,QAAQ;EAAgB,eAAe;CAAoB,CAC/D;CACA,CACE,EAAgB,GAAwB,kBAAkB,GAC1D;EAAE,QAAQ;EAAgB,eAAe;CAAmB,CAC9D;CACA,CACE,EAAgB,GAAwB,iBAAiB,GACzD;EAAE,QAAQ;EAAgB,eAAe;CAAkB,CAC7D;CACA,CACE,EAAgB,GAAwB,mBAAmB,GAC3D;EAAE,QAAQ;EAAgB,eAAe;CAAoB,CAC/D;CACA,CACE,EAAgB,GAAwB,8BAA8B,GACtE;EAAE,QAAQ;EAAgB,eAAe;CAA+B,CAC1E;CAEA,CACE,EAAgB,GAAwB,iBAAiB,GACzD;EAAE,QAAQ;EAAgB,eAAe;CAAkB,CAC7D;CACA,CACE,EAAgB,GAAwB,kBAAkB,GAC1D;EAAE,QAAQ;EAAgB,eAAe;CAAmB,CAC9D;AACF,CAAC,GAoBY,IAAgE,IAAI,IAC/E;CAAC;CAAW;CAAiB;AAAe,EAAE,SAAS,MACpD,EACE,QACE,MACC,EAAK,SAAS,cAAc,EAAyB,IAAI,EAAmB,CAAI,CAAC,CACrF,EACC,KAAK,MAAS,CAAC,EAAK,MAAM,CAAI,CAAU,CAC7C,CACF,GAea,IAA8C,CAAC,GAAG,EAAyB,KAAK,CAAC,GAsDjF,IAAgD;CAC3D,EAAgB,GAAkB,UAAU;CAC5C,EAAgB,GAAkB,YAAY;CAC9C,EAAgB,GAAkB,uBAAuB;CACzD,EAAgB,GAAkB,yBAAyB;CAC3D,EAAgB,GAAkB,sBAAsB;CACxD,EAAgB,GAAkB,6BAA6B;CAC/D,EAAgB,GAAkB,kBAAkB;CACpD,EAAgB,GAAkB,yBAAyB;CAC3D,EAAgB,GAAkB,oBAAoB;CACtD,EAAgB,GAAkB,qCAAqC;CACvE,EAAgB,GAAwB,WAAW;CACnD,EAAgB,GAAwB,cAAc;CACtD,EAAgB,GAAwB,iBAAiB;AAC3D,GAmCa,IAAyD,CACpE,EAAgB,GAAkB,kBAAkB,CACtD;AAaA,SAAgB,EAA2B,GAAwB;CACjE,OAAO,EAAyB,IAAI,EAAS,YAAY,CAAQ;AACnE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GaslessRequestContext } from '../core/chains/types.js';
|
|
2
|
+
import { GaslessHttpContext } from './http.js';
|
|
3
|
+
/** Resolve fresh credentials without retaining application errors or mutating the shared context. */
|
|
4
|
+
export declare function resolveGaslessRequestHeaders(context: GaslessHttpContext, method: GaslessRequestContext["method"]): Promise<{
|
|
5
|
+
[x: string]: string;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=request-headers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-headers.d.ts","sourceRoot":"","sources":["../../src/gasless/request-headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAElE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,qGAAqG;AACrG,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,qBAAqB,CAAC,QAAQ,CAAC;;GAoCxC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { SymmError as e } from "../shared/errors/symm-error.js";
|
|
2
|
+
//#region src/gasless/request-headers.ts
|
|
3
|
+
async function t(t, n) {
|
|
4
|
+
try {
|
|
5
|
+
let e = { ...t.headers };
|
|
6
|
+
function r(t, n) {
|
|
7
|
+
for (let n of Object.keys(e)) n.toLowerCase() === t.toLowerCase() && delete e[n];
|
|
8
|
+
Object.defineProperty(e, t, {
|
|
9
|
+
value: n,
|
|
10
|
+
enumerable: !0,
|
|
11
|
+
configurable: !0,
|
|
12
|
+
writable: !0
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
if (t.getRequestHeaders) {
|
|
16
|
+
let e = await t.getRequestHeaders({
|
|
17
|
+
chainId: t.chainId,
|
|
18
|
+
service: t.service,
|
|
19
|
+
method: n
|
|
20
|
+
});
|
|
21
|
+
for (let [t, n] of Object.entries(e)) {
|
|
22
|
+
if (!/^[!#$%&'*+.^_`|~\w-]+$/.test(t) || typeof n != "string" || /[\r\n\0]/.test(n)) throw Error("Invalid application header");
|
|
23
|
+
r(t, n);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return r("Accept", "application/json"), n === "POST" && r("Content-Type", "application/json"), e;
|
|
27
|
+
} catch {
|
|
28
|
+
throw new e("config", "GASLESS_REQUEST_HEADERS_FAILED", "Gasless: application request headers could not be resolved. No request was sent by this attempt; preserve any earlier pending submission for recovery.");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { t as resolveGaslessRequestHeaders };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=request-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-headers.js","names":[],"sources":["../../src/gasless/request-headers.ts"],"sourcesContent":["import type { GaslessRequestContext } from \"../core/chains/types\";\nimport { SymmError } from \"../shared/errors/symm-error\";\nimport type { GaslessHttpContext } from \"./http\";\n\n/** Resolve fresh credentials without retaining application errors or mutating the shared context. */\nexport async function resolveGaslessRequestHeaders(\n context: GaslessHttpContext,\n method: GaslessRequestContext[\"method\"],\n) {\n try {\n const headers = { ...context.headers };\n\n function setHeader(name: string, value: string): void {\n for (const existing of Object.keys(headers)) {\n if (existing.toLowerCase() === name.toLowerCase()) delete headers[existing];\n }\n Object.defineProperty(headers, name, { value, enumerable: true, configurable: true, writable: true });\n }\n\n if (context.getRequestHeaders) {\n const additional = await context.getRequestHeaders({\n chainId: context.chainId,\n service: context.service,\n method,\n });\n for (const [name, value] of Object.entries(additional)) {\n if (!/^[!#$%&'*+.^_`|~\\w-]+$/.test(name) || typeof value !== \"string\" || /[\\r\\n\\0]/.test(value)) {\n throw new Error(\"Invalid application header\");\n }\n setHeader(name, value);\n }\n }\n setHeader(\"Accept\", \"application/json\");\n if (method === \"POST\") setHeader(\"Content-Type\", \"application/json\");\n return headers;\n } catch {\n // A callback or getter may throw credentials in its message/cause. Never retain it.\n throw new SymmError(\n \"config\",\n \"GASLESS_REQUEST_HEADERS_FAILED\",\n \"Gasless: application request headers could not be resolved. No request was sent by this attempt; preserve any earlier pending submission for recovery.\",\n );\n }\n}\n"],"mappings":";;AAKA,eAAsB,EACpB,GACA,GACA;CACA,IAAI;EACF,IAAM,IAAU,EAAE,GAAG,EAAQ,QAAQ;EAErC,SAAS,EAAU,GAAc,GAAqB;GACpD,KAAK,IAAM,KAAY,OAAO,KAAK,CAAO,GACxC,AAAI,EAAS,YAAY,MAAM,EAAK,YAAY,KAAG,OAAO,EAAQ;GAEpE,OAAO,eAAe,GAAS,GAAM;IAAE;IAAO,YAAY;IAAM,cAAc;IAAM,UAAU;GAAK,CAAC;EACtG;EAEA,IAAI,EAAQ,mBAAmB;GAC7B,IAAM,IAAa,MAAM,EAAQ,kBAAkB;IACjD,SAAS,EAAQ;IACjB,SAAS,EAAQ;IACjB;GACF,CAAC;GACD,KAAK,IAAM,CAAC,GAAM,MAAU,OAAO,QAAQ,CAAU,GAAG;IACtD,IAAI,CAAC,yBAAyB,KAAK,CAAI,KAAK,OAAO,KAAU,YAAY,WAAW,KAAK,CAAK,GAC5F,MAAU,MAAM,4BAA4B;IAE9C,EAAU,GAAM,CAAK;GACvB;EACF;EAGA,OAFA,EAAU,UAAU,kBAAkB,GAClC,MAAW,UAAQ,EAAU,gBAAgB,kBAAkB,GAC5D;CACT,QAAQ;EAEN,MAAM,IAAI,EACR,UACA,kCACA,wJACF;CACF;AACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getSubAccount as e } from "../symmio-contracts/account-layer/actions/get-sub-account.js";
|
|
2
|
+
import { getVirtualAccount as t } from "../symmio-contracts/account-layer/actions/get-virtual-account.js";
|
|
3
3
|
import { isAddressEqual as n, zeroAddress as r } from "viem";
|
|
4
4
|
//#region src/gasless/resolve-wallet-identities.ts
|
|
5
5
|
async function i(i, a) {
|
|
6
|
-
let { chainId: o, account: s } = a, c = await
|
|
6
|
+
let { chainId: o, account: s } = a, c = await t(i, {
|
|
7
7
|
chainId: o,
|
|
8
8
|
account: s
|
|
9
|
-
}), l = c.isExists ? c.parentAccount : s, u = await
|
|
9
|
+
}), l = c.isExists ? c.parentAccount : s, u = await e(i, {
|
|
10
10
|
chainId: o,
|
|
11
11
|
account: l
|
|
12
12
|
});
|
|
@@ -11,14 +11,21 @@ export type ResubmitGaslessRequestReturnType = GaslessSubmitReceipt | GaslessDep
|
|
|
11
11
|
*
|
|
12
12
|
* This is the vendor's prescribed recovery for a lost response: the same key
|
|
13
13
|
* with the same payload either lands the request or returns the record the
|
|
14
|
-
* service already created, so it can never execute the intent twice.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* service already created, so it can never execute the intent twice. Re-running
|
|
15
|
+
* the intent through the wallet would double-execute whatever the relayer
|
|
16
|
+
* accepted. For a write sent with a caller-owned `gasless.idempotencyKey`,
|
|
17
|
+
* calling the write again under that key is the simpler recovery: it needs no
|
|
18
|
+
* recorded bytes.
|
|
17
19
|
*
|
|
18
20
|
* The body is sent exactly as recorded, never rebuilt: the signatures inside it
|
|
19
21
|
* cover specific nonces and deadlines, and a regenerated payload would be a
|
|
20
22
|
* different request under a key the service has already bound.
|
|
21
23
|
*
|
|
24
|
+
* A refused replay stays unconfirmed: a gateway refusal or a service verdict on
|
|
25
|
+
* the replay describes only the replay, while the original attempt may have
|
|
26
|
+
* executed. Keep the record, and never treat that refusal as grounds for a
|
|
27
|
+
* wallet-paid retry.
|
|
28
|
+
*
|
|
22
29
|
* A deposit settlement is re-verified the same way the original submit was —
|
|
23
30
|
* the wallet's deterministic address is read before the POST and checked
|
|
24
31
|
* against the acceptance — so a replay can never sweep a wallet you did not
|
|
@@ -31,7 +38,7 @@ export type ResubmitGaslessRequestReturnType = GaslessSubmitReceipt | GaslessDep
|
|
|
31
38
|
* @throws {SymmError} `GASLESS_NOT_CONFIGURED` / `GASLESS_UNSUPPORTED_CONTRACTS_VERSION` for the recorded chain.
|
|
32
39
|
* @throws {SymmError} `GASLESS_RESUBMIT_BODY_INVALID` when the record is not a submit this SDK produced.
|
|
33
40
|
* @throws {SymmApiError} `GASLESS_SUBMIT_UNCONFIRMED` again when the replay is itself
|
|
34
|
-
* inconclusive — keep the record and try again later.
|
|
41
|
+
* inconclusive or refused — keep the record and try again later.
|
|
35
42
|
*
|
|
36
43
|
* @example
|
|
37
44
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resubmit-gasless-request.d.ts","sourceRoot":"","sources":["../../../src/gasless/resubmit-gasless-request/resubmit-gasless-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,KAAK,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAItE,qFAAqF;AACrF,MAAM,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AAExE,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GAAG,2BAA2B,CAAC;AA0BlG
|
|
1
|
+
{"version":3,"file":"resubmit-gasless-request.d.ts","sourceRoot":"","sources":["../../../src/gasless/resubmit-gasless-request/resubmit-gasless-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMhD,OAAO,KAAK,EAAE,2BAA2B,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAItE,qFAAqF;AACrF,MAAM,MAAM,gCAAgC,GAAG,wBAAwB,CAAC;AAExE,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GAAG,2BAA2B,CAAC;AA0BlG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,gCAAgC,GACvC,OAAO,CAAC,gCAAgC,CAAC,CAuC3C"}
|
|
@@ -22,7 +22,7 @@ async function d(e, c) {
|
|
|
22
22
|
}), g = l(p);
|
|
23
23
|
if (f === "/gateway/relay-instant") {
|
|
24
24
|
let e = u(g, "userAddress"), n = Array.isArray(g.walletIds) ? g.walletIds.map((e, t) => r(e, `walletIds[${t}]`)) : [];
|
|
25
|
-
return i(await t(h, f, p, m), {
|
|
25
|
+
return i(await t(h, f, p, m, { replay: !0 }), {
|
|
26
26
|
owner: e,
|
|
27
27
|
walletIds: n,
|
|
28
28
|
idempotencyKey: m,
|
|
@@ -33,7 +33,7 @@ async function d(e, c) {
|
|
|
33
33
|
chainId: d,
|
|
34
34
|
owner: _,
|
|
35
35
|
walletId: v
|
|
36
|
-
}), b = s(await t(h, f, p, m), {
|
|
36
|
+
}), b = s(await t(h, f, p, m, { replay: !0 }), {
|
|
37
37
|
owner: _,
|
|
38
38
|
walletId: v,
|
|
39
39
|
idempotencyKey: m,
|