project-cpu-mcp 0.10.0 → 0.12.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/README.md +111 -35
- package/dist/api/authentication-required.error.d.ts +6 -0
- package/dist/api/authentication-required.error.d.ts.map +1 -0
- package/dist/api/authentication-required.error.js +9 -0
- package/dist/api/authentication-required.error.js.map +1 -0
- package/dist/api/client.d.ts +7 -5
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/client.js +29 -14
- package/dist/api/client.js.map +1 -1
- package/dist/api/constants.d.ts +2 -0
- package/dist/api/constants.d.ts.map +1 -1
- package/dist/api/constants.js +6 -0
- package/dist/api/constants.js.map +1 -1
- package/dist/api/types.d.ts +189 -220
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js +43 -29
- package/dist/api/types.js.map +1 -1
- package/dist/config/constants.d.ts +6 -2
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +6 -2
- package/dist/config/constants.js.map +1 -1
- package/dist/config/types.js +2 -2
- package/dist/config/types.js.map +1 -1
- package/dist/contracts/cell.abi.d.ts +26 -2
- package/dist/contracts/cell.abi.d.ts.map +1 -1
- package/dist/contracts/cell.abi.js +21 -2
- package/dist/contracts/cell.abi.js.map +1 -1
- package/dist/contracts/erc20.abi.d.ts.map +1 -1
- package/dist/contracts/erc20.abi.js +1 -2
- package/dist/contracts/erc20.abi.js.map +1 -1
- package/dist/contracts/trade.abi.d.ts +341 -0
- package/dist/contracts/trade.abi.d.ts.map +1 -1
- package/dist/contracts/trade.abi.js +163 -0
- package/dist/contracts/trade.abi.js.map +1 -1
- package/dist/contracts/trade.types.d.ts +14 -0
- package/dist/contracts/trade.types.d.ts.map +1 -0
- package/dist/contracts/trade.types.js +15 -0
- package/dist/contracts/trade.types.js.map +1 -0
- package/dist/contracts/transport.abi.d.ts +4 -0
- package/dist/contracts/transport.abi.d.ts.map +1 -1
- package/dist/contracts/transport.abi.js +1 -0
- package/dist/contracts/transport.abi.js.map +1 -1
- package/dist/index.js +40 -3
- package/dist/index.js.map +1 -1
- package/dist/logger/constants.d.ts +7 -0
- package/dist/logger/constants.d.ts.map +1 -1
- package/dist/logger/constants.js +11 -0
- package/dist/logger/constants.js.map +1 -1
- package/dist/logger/file-log.utils.d.ts +4 -0
- package/dist/logger/file-log.utils.d.ts.map +1 -0
- package/dist/logger/file-log.utils.js +23 -0
- package/dist/logger/file-log.utils.js.map +1 -0
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js +5 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger/logger.d.ts +4 -0
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +48 -3
- package/dist/logger/logger.js.map +1 -1
- package/dist/logger/redact.utils.d.ts.map +1 -1
- package/dist/logger/redact.utils.js +7 -2
- package/dist/logger/redact.utils.js.map +1 -1
- package/dist/logger/types.d.ts +8 -0
- package/dist/logger/types.d.ts.map +1 -1
- package/dist/map/attention.utils.d.ts.map +1 -1
- package/dist/map/attention.utils.js +1 -0
- package/dist/map/attention.utils.js.map +1 -1
- package/dist/map/cell-view.utils.d.ts.map +1 -1
- package/dist/map/cell-view.utils.js +5 -3
- package/dist/map/cell-view.utils.js.map +1 -1
- package/dist/map/process-projection.utils.js +2 -2
- package/dist/map/process-projection.utils.js.map +1 -1
- package/dist/map/reader.utils.d.ts.map +1 -1
- package/dist/map/reader.utils.js +3 -2
- package/dist/map/reader.utils.js.map +1 -1
- package/dist/map/storage.utils.d.ts.map +1 -1
- package/dist/map/storage.utils.js +5 -1
- package/dist/map/storage.utils.js.map +1 -1
- package/dist/map/types.d.ts +21 -0
- package/dist/map/types.d.ts.map +1 -1
- package/dist/map/types.js +6 -0
- package/dist/map/types.js.map +1 -1
- package/dist/paybox/auth/authority.d.ts +46 -0
- package/dist/paybox/auth/authority.d.ts.map +1 -0
- package/dist/paybox/auth/authority.js +410 -0
- package/dist/paybox/auth/authority.js.map +1 -0
- package/dist/paybox/auth/browser-opener.d.ts +8 -0
- package/dist/paybox/auth/browser-opener.d.ts.map +1 -0
- package/dist/paybox/auth/browser-opener.js +22 -0
- package/dist/paybox/auth/browser-opener.js.map +1 -0
- package/dist/paybox/auth/browser-opener.utils.d.ts +2 -0
- package/dist/paybox/auth/browser-opener.utils.d.ts.map +1 -0
- package/dist/paybox/auth/browser-opener.utils.js +10 -0
- package/dist/paybox/auth/browser-opener.utils.js.map +1 -0
- package/dist/paybox/auth/constants.d.ts +16 -0
- package/dist/paybox/auth/constants.d.ts.map +1 -0
- package/dist/paybox/auth/constants.js +16 -0
- package/dist/paybox/auth/constants.js.map +1 -0
- package/dist/paybox/auth/coordinator.d.ts +21 -0
- package/dist/paybox/auth/coordinator.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.factory.d.ts +5 -0
- package/dist/paybox/auth/coordinator.factory.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.factory.js +5 -0
- package/dist/paybox/auth/coordinator.factory.js.map +1 -0
- package/dist/paybox/auth/coordinator.js +87 -0
- package/dist/paybox/auth/coordinator.js.map +1 -0
- package/dist/paybox/auth/coordinator.utils.d.ts +4 -0
- package/dist/paybox/auth/coordinator.utils.d.ts.map +1 -0
- package/dist/paybox/auth/coordinator.utils.js +8 -0
- package/dist/paybox/auth/coordinator.utils.js.map +1 -0
- package/dist/paybox/auth/flow-session.d.ts +24 -0
- package/dist/paybox/auth/flow-session.d.ts.map +1 -0
- package/dist/paybox/auth/flow-session.js +155 -0
- package/dist/paybox/auth/flow-session.js.map +1 -0
- package/dist/paybox/auth/loopback-flow.d.ts +49 -0
- package/dist/paybox/auth/loopback-flow.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-flow.js +381 -0
- package/dist/paybox/auth/loopback-flow.js.map +1 -0
- package/dist/paybox/auth/loopback-flow.utils.d.ts +7 -0
- package/dist/paybox/auth/loopback-flow.utils.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-flow.utils.js +47 -0
- package/dist/paybox/auth/loopback-flow.utils.js.map +1 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.d.ts +3 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.js +228 -0
- package/dist/paybox/auth/loopback-page-fonts.constants.js.map +1 -0
- package/dist/paybox/auth/loopback-page.utils.d.ts +4 -0
- package/dist/paybox/auth/loopback-page.utils.d.ts.map +1 -0
- package/dist/paybox/auth/loopback-page.utils.js +261 -0
- package/dist/paybox/auth/loopback-page.utils.js.map +1 -0
- package/dist/paybox/auth/provisioning.utils.d.ts +3 -0
- package/dist/paybox/auth/provisioning.utils.d.ts.map +1 -0
- package/dist/paybox/auth/provisioning.utils.js +27 -0
- package/dist/paybox/auth/provisioning.utils.js.map +1 -0
- package/dist/paybox/auth/signing-key.utils.d.ts +2 -0
- package/dist/paybox/auth/signing-key.utils.d.ts.map +1 -0
- package/dist/paybox/auth/signing-key.utils.js +14 -0
- package/dist/paybox/auth/signing-key.utils.js.map +1 -0
- package/dist/paybox/auth/types.d.ts +18 -0
- package/dist/paybox/auth/types.d.ts.map +1 -0
- package/dist/paybox/auth/types.js +6 -0
- package/dist/paybox/auth/types.js.map +1 -0
- package/dist/paybox/auth/utils.d.ts +5 -0
- package/dist/paybox/auth/utils.d.ts.map +1 -0
- package/dist/paybox/auth/utils.js +17 -0
- package/dist/paybox/auth/utils.js.map +1 -0
- package/dist/paybox/constants.d.ts +11 -0
- package/dist/paybox/constants.d.ts.map +1 -0
- package/dist/paybox/constants.js +11 -0
- package/dist/paybox/constants.js.map +1 -0
- package/dist/paybox/errors.d.ts +43 -0
- package/dist/paybox/errors.d.ts.map +1 -0
- package/dist/paybox/errors.js +141 -0
- package/dist/paybox/errors.js.map +1 -0
- package/dist/paybox/sdk/adapter.d.ts +16 -0
- package/dist/paybox/sdk/adapter.d.ts.map +1 -0
- package/dist/paybox/sdk/adapter.js +127 -0
- package/dist/paybox/sdk/adapter.js.map +1 -0
- package/dist/paybox/sdk/constants.d.ts +14 -0
- package/dist/paybox/sdk/constants.d.ts.map +1 -0
- package/dist/paybox/sdk/constants.js +23 -0
- package/dist/paybox/sdk/constants.js.map +1 -0
- package/dist/paybox/sdk/factory.d.ts +4 -0
- package/dist/paybox/sdk/factory.d.ts.map +1 -0
- package/dist/paybox/sdk/factory.js +24 -0
- package/dist/paybox/sdk/factory.js.map +1 -0
- package/dist/paybox/sdk/logging.utils.d.ts +4 -0
- package/dist/paybox/sdk/logging.utils.d.ts.map +1 -0
- package/dist/paybox/sdk/logging.utils.js +19 -0
- package/dist/paybox/sdk/logging.utils.js.map +1 -0
- package/dist/paybox/sdk/utils.d.ts +7 -0
- package/dist/paybox/sdk/utils.d.ts.map +1 -0
- package/dist/paybox/sdk/utils.js +182 -0
- package/dist/paybox/sdk/utils.js.map +1 -0
- package/dist/paybox/storage.d.ts +17 -0
- package/dist/paybox/storage.d.ts.map +1 -0
- package/dist/paybox/storage.js +87 -0
- package/dist/paybox/storage.js.map +1 -0
- package/dist/paybox/types.d.ts +481 -0
- package/dist/paybox/types.d.ts.map +1 -0
- package/dist/paybox/types.js +144 -0
- package/dist/paybox/types.js.map +1 -0
- package/dist/paybox/wallet/manager.d.ts +22 -0
- package/dist/paybox/wallet/manager.d.ts.map +1 -0
- package/dist/paybox/wallet/manager.js +111 -0
- package/dist/paybox/wallet/manager.js.map +1 -0
- package/dist/paybox/wallet/rpc.client.d.ts +16 -0
- package/dist/paybox/wallet/rpc.client.d.ts.map +1 -0
- package/dist/paybox/wallet/rpc.client.js +53 -0
- package/dist/paybox/wallet/rpc.client.js.map +1 -0
- package/dist/paybox/wallet/utils.d.ts +5 -0
- package/dist/paybox/wallet/utils.d.ts.map +1 -0
- package/dist/paybox/wallet/utils.js +82 -0
- package/dist/paybox/wallet/utils.js.map +1 -0
- package/dist/server.constants.d.ts.map +1 -1
- package/dist/server.constants.js +5 -2
- package/dist/server.constants.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +8 -2
- package/dist/server.js.map +1 -1
- package/dist/services/app-config.utils.d.ts.map +1 -1
- package/dist/services/app-config.utils.js +22 -11
- package/dist/services/app-config.utils.js.map +1 -1
- package/dist/services/auth.service.d.ts +3 -5
- package/dist/services/auth.service.d.ts.map +1 -1
- package/dist/services/auth.service.js +20 -77
- package/dist/services/auth.service.js.map +1 -1
- package/dist/services/cell.client.d.ts.map +1 -1
- package/dist/services/cell.client.js +22 -9
- package/dist/services/cell.client.js.map +1 -1
- package/dist/services/lot-return.constants.d.ts +3 -0
- package/dist/services/lot-return.constants.d.ts.map +1 -0
- package/dist/services/lot-return.constants.js +35 -0
- package/dist/services/lot-return.constants.js.map +1 -0
- package/dist/services/lot-return.service.d.ts +25 -0
- package/dist/services/lot-return.service.d.ts.map +1 -0
- package/dist/services/lot-return.service.js +151 -0
- package/dist/services/lot-return.service.js.map +1 -0
- package/dist/services/lot-return.types.d.ts +19 -0
- package/dist/services/lot-return.types.d.ts.map +1 -0
- package/dist/services/lot-return.types.js +2 -0
- package/dist/services/lot-return.types.js.map +1 -0
- package/dist/services/lot-return.utils.d.ts +33 -0
- package/dist/services/lot-return.utils.d.ts.map +1 -0
- package/dist/services/lot-return.utils.js +128 -0
- package/dist/services/lot-return.utils.js.map +1 -0
- package/dist/services/lot-terms.constants.d.ts +4 -0
- package/dist/services/lot-terms.constants.d.ts.map +1 -0
- package/dist/services/lot-terms.constants.js +5 -0
- package/dist/services/lot-terms.constants.js.map +1 -0
- package/dist/services/lot-terms.helpers.d.ts +11 -0
- package/dist/services/lot-terms.helpers.d.ts.map +1 -0
- package/dist/services/lot-terms.helpers.js +45 -0
- package/dist/services/lot-terms.helpers.js.map +1 -0
- package/dist/services/lot-terms.service.d.ts +20 -0
- package/dist/services/lot-terms.service.d.ts.map +1 -0
- package/dist/services/lot-terms.service.js +119 -0
- package/dist/services/lot-terms.service.js.map +1 -0
- package/dist/services/lot-terms.types.d.ts +25 -0
- package/dist/services/lot-terms.types.d.ts.map +1 -0
- package/dist/services/lot-terms.types.js +2 -0
- package/dist/services/lot-terms.types.js.map +1 -0
- package/dist/services/reveal-revert.utils.d.ts +1 -0
- package/dist/services/reveal-revert.utils.d.ts.map +1 -1
- package/dist/services/reveal-revert.utils.js +20 -0
- package/dist/services/reveal-revert.utils.js.map +1 -1
- package/dist/services/reveal.constants.d.ts +1 -1
- package/dist/services/reveal.constants.d.ts.map +1 -1
- package/dist/services/reveal.constants.js +1 -1
- package/dist/services/reveal.constants.js.map +1 -1
- package/dist/services/reveal.service.d.ts +4 -3
- package/dist/services/reveal.service.d.ts.map +1 -1
- package/dist/services/reveal.service.js +35 -10
- package/dist/services/reveal.service.js.map +1 -1
- package/dist/services/reveal.utils.d.ts +7 -8
- package/dist/services/reveal.utils.d.ts.map +1 -1
- package/dist/services/reveal.utils.js +15 -8
- package/dist/services/reveal.utils.js.map +1 -1
- package/dist/services/route.constants.d.ts +12 -1
- package/dist/services/route.constants.d.ts.map +1 -1
- package/dist/services/route.constants.js +66 -15
- package/dist/services/route.constants.js.map +1 -1
- package/dist/services/route.lots.d.ts +18 -0
- package/dist/services/route.lots.d.ts.map +1 -0
- package/dist/services/route.lots.js +33 -0
- package/dist/services/route.lots.js.map +1 -0
- package/dist/services/route.service.d.ts +13 -4
- package/dist/services/route.service.d.ts.map +1 -1
- package/dist/services/route.service.js +95 -13
- package/dist/services/route.service.js.map +1 -1
- package/dist/services/route.types.d.ts +76 -0
- package/dist/services/route.types.d.ts.map +1 -0
- package/dist/services/route.types.js +8 -0
- package/dist/services/route.types.js.map +1 -0
- package/dist/services/route.utils.d.ts +19 -0
- package/dist/services/route.utils.d.ts.map +1 -1
- package/dist/services/route.utils.js +35 -0
- package/dist/services/route.utils.js.map +1 -1
- package/dist/services/trade-eviction.constants.d.ts +12 -0
- package/dist/services/trade-eviction.constants.d.ts.map +1 -0
- package/dist/services/trade-eviction.constants.js +25 -0
- package/dist/services/trade-eviction.constants.js.map +1 -0
- package/dist/services/trade-eviction.service.d.ts +22 -0
- package/dist/services/trade-eviction.service.d.ts.map +1 -0
- package/dist/services/trade-eviction.service.js +101 -0
- package/dist/services/trade-eviction.service.js.map +1 -0
- package/dist/services/trade-eviction.types.d.ts +30 -0
- package/dist/services/trade-eviction.types.d.ts.map +1 -0
- package/dist/services/trade-eviction.types.js +2 -0
- package/dist/services/trade-eviction.types.js.map +1 -0
- package/dist/services/trade-eviction.utils.d.ts +9 -0
- package/dist/services/trade-eviction.utils.d.ts.map +1 -0
- package/dist/services/trade-eviction.utils.js +38 -0
- package/dist/services/trade-eviction.utils.js.map +1 -0
- package/dist/services/trade-rules.service.d.ts +15 -0
- package/dist/services/trade-rules.service.d.ts.map +1 -0
- package/dist/services/trade-rules.service.js +45 -0
- package/dist/services/trade-rules.service.js.map +1 -0
- package/dist/services/trade.client.d.ts +11 -1
- package/dist/services/trade.client.d.ts.map +1 -1
- package/dist/services/trade.client.js +87 -0
- package/dist/services/trade.client.js.map +1 -1
- package/dist/services/trade.constants.d.ts +9 -0
- package/dist/services/trade.constants.d.ts.map +1 -0
- package/dist/services/trade.constants.js +28 -0
- package/dist/services/trade.constants.js.map +1 -0
- package/dist/services/trade.helpers.d.ts +9 -1
- package/dist/services/trade.helpers.d.ts.map +1 -1
- package/dist/services/trade.helpers.js +40 -27
- package/dist/services/trade.helpers.js.map +1 -1
- package/dist/services/transport-revert.utils.d.ts +3 -0
- package/dist/services/transport-revert.utils.d.ts.map +1 -0
- package/dist/services/transport-revert.utils.js +15 -0
- package/dist/services/transport-revert.utils.js.map +1 -0
- package/dist/services/transport.client.d.ts.map +1 -1
- package/dist/services/transport.client.js +14 -6
- package/dist/services/transport.client.js.map +1 -1
- package/dist/services/types.d.ts +249 -21
- package/dist/services/types.d.ts.map +1 -1
- package/dist/services/types.js +25 -0
- package/dist/services/types.js.map +1 -1
- package/dist/services/warehouse.utils.d.ts +8 -0
- package/dist/services/warehouse.utils.d.ts.map +1 -1
- package/dist/services/warehouse.utils.js +25 -0
- package/dist/services/warehouse.utils.js.map +1 -1
- package/dist/session/manager.d.ts +1 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +13 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/storage.d.ts +0 -3
- package/dist/session/storage.d.ts.map +1 -1
- package/dist/session/storage.js +6 -43
- package/dist/session/storage.js.map +1 -1
- package/dist/session/types.d.ts +4 -98
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +0 -15
- package/dist/session/types.js.map +1 -1
- package/dist/tools/authenticate.d.ts +1 -1
- package/dist/tools/authenticate.d.ts.map +1 -1
- package/dist/tools/authenticate.js +19 -45
- package/dist/tools/authenticate.js.map +1 -1
- package/dist/tools/config/get-game-config/constants.d.ts +3 -0
- package/dist/tools/config/get-game-config/constants.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/constants.js +13 -2
- package/dist/tools/config/get-game-config/constants.js.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.js +6 -3
- package/dist/tools/config/get-game-config/get-game-config.js.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.utils.d.ts +4 -4
- package/dist/tools/config/get-game-config/get-game-config.utils.d.ts.map +1 -1
- package/dist/tools/config/get-game-config/get-game-config.utils.js +26 -9
- package/dist/tools/config/get-game-config/get-game-config.utils.js.map +1 -1
- package/dist/tools/config/get-game-config/types.d.ts +6 -2
- package/dist/tools/config/get-game-config/types.d.ts.map +1 -1
- package/dist/tools/config/resource-lens/resource-lens.utils.d.ts.map +1 -1
- package/dist/tools/config/resource-lens/resource-lens.utils.js +5 -4
- package/dist/tools/config/resource-lens/resource-lens.utils.js.map +1 -1
- package/dist/tools/map/attention/attention.d.ts.map +1 -1
- package/dist/tools/map/attention/attention.js +16 -5
- package/dist/tools/map/attention/attention.js.map +1 -1
- package/dist/tools/map/attention/constants.d.ts +6 -0
- package/dist/tools/map/attention/constants.d.ts.map +1 -1
- package/dist/tools/map/attention/constants.js +16 -2
- package/dist/tools/map/attention/constants.js.map +1 -1
- package/dist/tools/map/attention/evicted.service.d.ts +19 -0
- package/dist/tools/map/attention/evicted.service.d.ts.map +1 -0
- package/dist/tools/map/attention/evicted.service.js +73 -0
- package/dist/tools/map/attention/evicted.service.js.map +1 -0
- package/dist/tools/map/attention/evicted.utils.d.ts +16 -0
- package/dist/tools/map/attention/evicted.utils.d.ts.map +1 -0
- package/dist/tools/map/attention/evicted.utils.js +72 -0
- package/dist/tools/map/attention/evicted.utils.js.map +1 -0
- package/dist/tools/map/attention/panel.utils.d.ts.map +1 -1
- package/dist/tools/map/attention/panel.utils.js +1 -0
- package/dist/tools/map/attention/panel.utils.js.map +1 -1
- package/dist/tools/map/attention/types.d.ts +17 -0
- package/dist/tools/map/attention/types.d.ts.map +1 -1
- package/dist/tools/map/attention/types.js.map +1 -1
- package/dist/tools/map/get-map/constants.d.ts.map +1 -1
- package/dist/tools/map/get-map/constants.js +4 -2
- package/dist/tools/map/get-map/constants.js.map +1 -1
- package/dist/tools/reveal/constants.d.ts.map +1 -1
- package/dist/tools/reveal/constants.js +3 -1
- package/dist/tools/reveal/constants.js.map +1 -1
- package/dist/tools/trade/buy-lot/buy-lot.d.ts.map +1 -1
- package/dist/tools/trade/buy-lot/buy-lot.js +2 -0
- package/dist/tools/trade/buy-lot/buy-lot.js.map +1 -1
- package/dist/tools/trade/buy-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/buy-lot/constants.js +2 -0
- package/dist/tools/trade/buy-lot/constants.js.map +1 -1
- package/dist/tools/trade/buyer-guard/constants.d.ts +4 -0
- package/dist/tools/trade/buyer-guard/constants.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/constants.js +11 -0
- package/dist/tools/trade/buyer-guard/constants.js.map +1 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts +9 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.js +15 -0
- package/dist/tools/trade/buyer-guard/lot-open.guard.js.map +1 -0
- package/dist/tools/trade/buyer-guard/types.d.ts +6 -0
- package/dist/tools/trade/buyer-guard/types.d.ts.map +1 -0
- package/dist/tools/trade/buyer-guard/types.js +2 -0
- package/dist/tools/trade/buyer-guard/types.js.map +1 -0
- package/dist/tools/trade/constants.d.ts +5 -0
- package/dist/tools/trade/constants.d.ts.map +1 -0
- package/dist/tools/trade/constants.js +14 -0
- package/dist/tools/trade/constants.js.map +1 -0
- package/dist/tools/trade/create-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/create-lot/constants.js +4 -1
- package/dist/tools/trade/create-lot/constants.js.map +1 -1
- package/dist/tools/trade/create-lot/create-lot.d.ts +2 -1
- package/dist/tools/trade/create-lot/create-lot.d.ts.map +1 -1
- package/dist/tools/trade/create-lot/create-lot.js +15 -1
- package/dist/tools/trade/create-lot/create-lot.js.map +1 -1
- package/dist/tools/trade/evict-lot/constants.d.ts +4 -0
- package/dist/tools/trade/evict-lot/constants.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/constants.js +13 -0
- package/dist/tools/trade/evict-lot/constants.js.map +1 -0
- package/dist/tools/trade/evict-lot/evict-lot.d.ts +6 -0
- package/dist/tools/trade/evict-lot/evict-lot.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/evict-lot.js +35 -0
- package/dist/tools/trade/evict-lot/evict-lot.js.map +1 -0
- package/dist/tools/trade/evict-lot/format.utils.d.ts +5 -0
- package/dist/tools/trade/evict-lot/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/format.utils.js +10 -0
- package/dist/tools/trade/evict-lot/format.utils.js.map +1 -0
- package/dist/tools/trade/evict-lot/types.d.ts +5 -0
- package/dist/tools/trade/evict-lot/types.d.ts.map +1 -0
- package/dist/tools/trade/evict-lot/types.js +8 -0
- package/dist/tools/trade/evict-lot/types.js.map +1 -0
- package/dist/tools/trade/format.utils.d.ts +2 -4
- package/dist/tools/trade/format.utils.d.ts.map +1 -1
- package/dist/tools/trade/format.utils.js +11 -13
- package/dist/tools/trade/format.utils.js.map +1 -1
- package/dist/tools/trade/get-lot/constants.d.ts.map +1 -1
- package/dist/tools/trade/get-lot/constants.js +2 -1
- package/dist/tools/trade/get-lot/constants.js.map +1 -1
- package/dist/tools/trade/list-lots/constants.d.ts +2 -0
- package/dist/tools/trade/list-lots/constants.d.ts.map +1 -1
- package/dist/tools/trade/list-lots/constants.js +5 -1
- package/dist/tools/trade/list-lots/constants.js.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.d.ts.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.js +2 -1
- package/dist/tools/trade/list-lots/list-lots.js.map +1 -1
- package/dist/tools/trade/list-lots/list-lots.utils.d.ts +8 -0
- package/dist/tools/trade/list-lots/list-lots.utils.d.ts.map +1 -0
- package/dist/tools/trade/list-lots/list-lots.utils.js +10 -0
- package/dist/tools/trade/list-lots/list-lots.utils.js.map +1 -0
- package/dist/tools/trade/list-mine/constants.d.ts.map +1 -1
- package/dist/tools/trade/list-mine/constants.js +3 -1
- package/dist/tools/trade/list-mine/constants.js.map +1 -1
- package/dist/tools/trade/lot-terms/constants.d.ts +5 -0
- package/dist/tools/trade/lot-terms/constants.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/constants.js +13 -0
- package/dist/tools/trade/lot-terms/constants.js.map +1 -0
- package/dist/tools/trade/lot-terms/factory.d.ts +4 -0
- package/dist/tools/trade/lot-terms/factory.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/factory.js +14 -0
- package/dist/tools/trade/lot-terms/factory.js.map +1 -0
- package/dist/tools/trade/lot-terms/format.utils.d.ts +4 -0
- package/dist/tools/trade/lot-terms/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/format.utils.js +30 -0
- package/dist/tools/trade/lot-terms/format.utils.js.map +1 -0
- package/dist/tools/trade/lot-terms/lot-terms.d.ts +5 -0
- package/dist/tools/trade/lot-terms/lot-terms.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/lot-terms.js +23 -0
- package/dist/tools/trade/lot-terms/lot-terms.js.map +1 -0
- package/dist/tools/trade/lot-terms/types.d.ts +6 -0
- package/dist/tools/trade/lot-terms/types.d.ts.map +1 -0
- package/dist/tools/trade/lot-terms/types.js +7 -0
- package/dist/tools/trade/lot-terms/types.js.map +1 -0
- package/dist/tools/trade/market-index/constants.d.ts.map +1 -1
- package/dist/tools/trade/market-index/constants.js +2 -0
- package/dist/tools/trade/market-index/constants.js.map +1 -1
- package/dist/tools/trade/markets/constants.d.ts.map +1 -1
- package/dist/tools/trade/markets/constants.js +2 -1
- package/dist/tools/trade/markets/constants.js.map +1 -1
- package/dist/tools/trade/quote-buy/constants.d.ts.map +1 -1
- package/dist/tools/trade/quote-buy/constants.js +4 -2
- package/dist/tools/trade/quote-buy/constants.js.map +1 -1
- package/dist/tools/trade/quote-buy/quote-buy.d.ts.map +1 -1
- package/dist/tools/trade/quote-buy/quote-buy.js +2 -0
- package/dist/tools/trade/quote-buy/quote-buy.js.map +1 -1
- package/dist/tools/trade/quote-lot-return/constants.d.ts +2 -0
- package/dist/tools/trade/quote-lot-return/constants.d.ts.map +1 -0
- package/dist/tools/trade/quote-lot-return/constants.js +11 -0
- package/dist/tools/trade/quote-lot-return/constants.js.map +1 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts +5 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.d.ts.map +1 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.js +20 -0
- package/dist/tools/trade/quote-lot-return/quote-lot-return.js.map +1 -0
- package/dist/tools/trade/return-lot/constants.d.ts +5 -0
- package/dist/tools/trade/return-lot/constants.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/constants.js +26 -0
- package/dist/tools/trade/return-lot/constants.js.map +1 -0
- package/dist/tools/trade/return-lot/factory.d.ts +4 -0
- package/dist/tools/trade/return-lot/factory.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/factory.js +18 -0
- package/dist/tools/trade/return-lot/factory.js.map +1 -0
- package/dist/tools/trade/return-lot/format.utils.d.ts +5 -0
- package/dist/tools/trade/return-lot/format.utils.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/format.utils.js +39 -0
- package/dist/tools/trade/return-lot/format.utils.js.map +1 -0
- package/dist/tools/trade/return-lot/return-lot.d.ts +5 -0
- package/dist/tools/trade/return-lot/return-lot.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/return-lot.js +25 -0
- package/dist/tools/trade/return-lot/return-lot.js.map +1 -0
- package/dist/tools/trade/return-lot/types.d.ts +11 -0
- package/dist/tools/trade/return-lot/types.d.ts.map +1 -0
- package/dist/tools/trade/return-lot/types.js +21 -0
- package/dist/tools/trade/return-lot/types.js.map +1 -0
- package/dist/tools/trade/types.d.ts +0 -4
- package/dist/tools/trade/types.d.ts.map +1 -1
- package/dist/tools/trade/types.js +4 -12
- package/dist/tools/trade/types.js.map +1 -1
- package/dist/tools/transport/constants.d.ts.map +1 -1
- package/dist/tools/transport/constants.js +9 -0
- package/dist/tools/transport/constants.js.map +1 -1
- package/dist/tools/transport/network/constants.d.ts +2 -0
- package/dist/tools/transport/network/constants.d.ts.map +1 -1
- package/dist/tools/transport/network/constants.js +2 -0
- package/dist/tools/transport/network/constants.js.map +1 -1
- package/dist/tools/transport/network/panel.utils.d.ts +2 -2
- package/dist/tools/transport/network/panel.utils.d.ts.map +1 -1
- package/dist/tools/transport/network/panel.utils.js +20 -0
- package/dist/tools/transport/network/panel.utils.js.map +1 -1
- package/dist/tools/transport/network/route-network.d.ts.map +1 -1
- package/dist/tools/transport/network/route-network.js +1 -1
- package/dist/tools/transport/network/route-network.js.map +1 -1
- package/dist/tools/transport/next-hops/next-hops.d.ts.map +1 -1
- package/dist/tools/transport/next-hops/next-hops.js +13 -3
- package/dist/tools/transport/next-hops/next-hops.js.map +1 -1
- package/dist/tools/transport/quote/constants.d.ts.map +1 -1
- package/dist/tools/transport/quote/constants.js +5 -3
- package/dist/tools/transport/quote/constants.js.map +1 -1
- package/dist/tools/transport/types.d.ts +2 -0
- package/dist/tools/transport/types.d.ts.map +1 -1
- package/dist/tools/transport/types.js +16 -0
- package/dist/tools/transport/types.js.map +1 -1
- package/dist/tools/types.d.ts +7 -1
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js +16 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/wei.constants.d.ts +6 -0
- package/dist/utils/wei.constants.d.ts.map +1 -0
- package/dist/utils/wei.constants.js +6 -0
- package/dist/utils/wei.constants.js.map +1 -0
- package/dist/wallet/index.d.ts.map +1 -1
- package/dist/wallet/index.js +2 -3
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/types.d.ts +0 -9
- package/dist/wallet/types.d.ts.map +1 -1
- package/dist/wallet/types.js.map +1 -1
- package/package.json +2 -2
- package/dist/tools/trade/cancel-lot/cancel-lot.d.ts +0 -4
- package/dist/tools/trade/cancel-lot/cancel-lot.d.ts.map +0 -1
- package/dist/tools/trade/cancel-lot/cancel-lot.js +0 -20
- package/dist/tools/trade/cancel-lot/cancel-lot.js.map +0 -1
- package/dist/tools/trade/cancel-lot/constants.d.ts +0 -2
- package/dist/tools/trade/cancel-lot/constants.d.ts.map +0 -1
- package/dist/tools/trade/cancel-lot/constants.js +0 -8
- package/dist/tools/trade/cancel-lot/constants.js.map +0 -1
- package/dist/wallet/agw.manager.d.ts +0 -20
- package/dist/wallet/agw.manager.d.ts.map +0 -1
- package/dist/wallet/agw.manager.js +0 -90
- package/dist/wallet/agw.manager.js.map +0 -1
- package/dist/wallet/agw.provider.d.ts +0 -14
- package/dist/wallet/agw.provider.d.ts.map +0 -1
- package/dist/wallet/agw.provider.js +0 -48
- package/dist/wallet/agw.provider.js.map +0 -1
package/dist/services/types.js
CHANGED
|
@@ -18,9 +18,12 @@ export var ModeFreeReason;
|
|
|
18
18
|
export var CellRevertName;
|
|
19
19
|
(function (CellRevertName) {
|
|
20
20
|
CellRevertName["INSUFFICIENT_REVEAL_PAYMENT"] = "InsufficientRevealPayment";
|
|
21
|
+
CellRevertName["REVEAL_SERVICE_FEES_EXCEED_BUDGET"] = "RevealServiceFeesExceedBudget";
|
|
21
22
|
CellRevertName["REVEAL_PAYMENT_NOT_CONFIGURED"] = "RevealPaymentNotConfigured";
|
|
22
23
|
CellRevertName["REVEAL_HOOK_NOT_CONFIGURED"] = "RevealHookNotConfigured";
|
|
23
24
|
CellRevertName["HOOK_DELIVERY_FAILED"] = "HookDeliveryFailed";
|
|
25
|
+
CellRevertName["METADATA_PUBLISHER_NOT_CONFIGURED"] = "MetadataPublisherNotConfigured";
|
|
26
|
+
CellRevertName["PUBLISHER_DELIVERY_FAILED"] = "PublisherDeliveryFailed";
|
|
24
27
|
CellRevertName["REFUND_FAILED"] = "RefundFailed";
|
|
25
28
|
CellRevertName["REVEAL_NOT_CONFIGURED"] = "RevealNotConfigured";
|
|
26
29
|
CellRevertName["REVEAL_CELL_OCCUPIED"] = "RevealCellOccupied";
|
|
@@ -30,6 +33,10 @@ export var CellRevertName;
|
|
|
30
33
|
CellRevertName["DEPOSITS_NOT_EXHAUSTED"] = "DepositsNotExhausted";
|
|
31
34
|
CellRevertName["REVEAL_REQUEST_ID_IN_USE"] = "RevealRequestIdInUse";
|
|
32
35
|
})(CellRevertName || (CellRevertName = {}));
|
|
36
|
+
export var TransportRevertName;
|
|
37
|
+
(function (TransportRevertName) {
|
|
38
|
+
TransportRevertName["STORAGE_FULL"] = "StorageFull";
|
|
39
|
+
})(TransportRevertName || (TransportRevertName = {}));
|
|
33
40
|
export var UpgradeRevertName;
|
|
34
41
|
(function (UpgradeRevertName) {
|
|
35
42
|
UpgradeRevertName["NOT_REVEALED"] = "NotRevealed";
|
|
@@ -64,6 +71,24 @@ export var DeliveryFilter;
|
|
|
64
71
|
DeliveryFilter["Delivered"] = "delivered";
|
|
65
72
|
DeliveryFilter["ReadyToFinalize"] = "ready_to_finalize";
|
|
66
73
|
})(DeliveryFilter || (DeliveryFilter = {}));
|
|
74
|
+
/** Why a new listing on this hub and resource cannot go ahead right now. */
|
|
75
|
+
export var LotListingBlocker;
|
|
76
|
+
(function (LotListingBlocker) {
|
|
77
|
+
/** The seller has an evicted remainder on this hub with no return scheduled — checked before anything else. */
|
|
78
|
+
LotListingBlocker["EvictedPending"] = "evicted_pending";
|
|
79
|
+
/** Every live-lot slot for this seller/hub/resource is taken. */
|
|
80
|
+
LotListingBlocker["SellerLotLimit"] = "seller_lot_limit";
|
|
81
|
+
/** The hub cannot hold a lot of this resource at all: its window has no room between the bounds. */
|
|
82
|
+
LotListingBlocker["EmptyWindow"] = "empty_window";
|
|
83
|
+
})(LotListingBlocker || (LotListingBlocker = {}));
|
|
84
|
+
/** Which contract branch settled a Lot return — one player intent, two lifecycle sources. */
|
|
85
|
+
export var LotReturnBranch;
|
|
86
|
+
(function (LotReturnBranch) {
|
|
87
|
+
/** An Open lot: the offer is withdrawn and the remainder ships home. */
|
|
88
|
+
LotReturnBranch["Cancelled"] = "cancelled";
|
|
89
|
+
/** An Evicted lot: the remainder the hub owner threw out ships home. */
|
|
90
|
+
LotReturnBranch["Reclaimed"] = "reclaimed";
|
|
91
|
+
})(LotReturnBranch || (LotReturnBranch = {}));
|
|
67
92
|
export var SwapToken;
|
|
68
93
|
(function (SwapToken) {
|
|
69
94
|
SwapToken["ETH"] = "ETH";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/services/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/services/types.ts"],"names":[],"mappings":"AAyDA,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACtB,uCAAqB,CAAA;IACrB,2CAAyB,CAAA;IACzB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
import type { CraftStackView } from '../api/types.js';
|
|
2
3
|
import type { Cell } from '../map/types.js';
|
|
3
4
|
import { type ResourceNames } from '../utils/format.utils.js';
|
|
4
5
|
export declare function assertWarehouseHas(resources: ResourceNames, state: Cell | null, required: Array<CraftStackView>, tokenId: string, action: string): void;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a shipment of `required` units of one resource still fits in a cell as it stands. The game API's
|
|
8
|
+
* `used` figure already includes liquid balance, incoming transport, and lot reservations, so it is the full
|
|
9
|
+
* occupancy to subtract from the shelf. `emptyStorageCap` carries the config rule when the map has no held row:
|
|
10
|
+
* null is uncapped WCPU, while every other missing cap resolves to zero.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assessDestinationCapacity(cell: Cell, resourceId: number, required: bigint, emptyStorageCap: bigint | null): DestinationCapacityView;
|
|
5
13
|
//# sourceMappingURL=warehouse.utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse.utils.d.ts","sourceRoot":"","sources":["../../src/services/warehouse.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM5E,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,IAAI,GAAG,IAAI,EAClB,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,EAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACf,IAAI,CAcN"}
|
|
1
|
+
{"version":3,"file":"warehouse.utils.d.ts","sourceRoot":"","sources":["../../src/services/warehouse.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAM5E,wBAAgB,kBAAkB,CAC9B,SAAS,EAAE,aAAa,EACxB,KAAK,EAAE,IAAI,GAAG,IAAI,EAClB,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,EAC/B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACf,IAAI,CAcN;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACrC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,GAAG,IAAI,GAC/B,uBAAuB,CAkBzB"}
|
|
@@ -16,4 +16,29 @@ export function assertWarehouseHas(resources, state, required, tokenId, action)
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Whether a shipment of `required` units of one resource still fits in a cell as it stands. The game API's
|
|
21
|
+
* `used` figure already includes liquid balance, incoming transport, and lot reservations, so it is the full
|
|
22
|
+
* occupancy to subtract from the shelf. `emptyStorageCap` carries the config rule when the map has no held row:
|
|
23
|
+
* null is uncapped WCPU, while every other missing cap resolves to zero.
|
|
24
|
+
*/
|
|
25
|
+
export function assessDestinationCapacity(cell, resourceId, required, emptyStorageCap) {
|
|
26
|
+
const storage = cell.resources.find((r) => r.resourceId === resourceId)?.storage ?? null;
|
|
27
|
+
if (storage === null) {
|
|
28
|
+
return emptyStorageCap === null
|
|
29
|
+
? { fits: true, required: required.toString(), free: null }
|
|
30
|
+
: {
|
|
31
|
+
fits: required <= emptyStorageCap,
|
|
32
|
+
required: required.toString(),
|
|
33
|
+
free: emptyStorageCap.toString(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (storage.cap === null) {
|
|
37
|
+
return { fits: true, required: required.toString(), free: null };
|
|
38
|
+
}
|
|
39
|
+
const taken = BigInt(storage.used);
|
|
40
|
+
const cap = BigInt(storage.cap);
|
|
41
|
+
const free = cap > taken ? cap - taken : 0n;
|
|
42
|
+
return { fits: required <= free, required: required.toString(), free: free.toString() };
|
|
43
|
+
}
|
|
19
44
|
//# sourceMappingURL=warehouse.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"warehouse.utils.js","sourceRoot":"","sources":["../../src/services/warehouse.utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"warehouse.utils.js","sourceRoot":"","sources":["../../src/services/warehouse.utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAsB,MAAM,0BAA0B,CAAC;AAE5E,+GAA+G;AAC/G,6GAA6G;AAC7G,iHAAiH;AACjH,sGAAsG;AACtG,MAAM,UAAU,kBAAkB,CAC9B,SAAwB,EACxB,KAAkB,EAClB,QAA+B,EAC/B,OAAe,EACf,MAAc;IAEd,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO;IACX,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,KAAK,GAAG,CAAC,UAAU,CAAC,EAAE,OAAO,IAAI,GAAG,CAAC;QAC1F,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACpC,MAAM,IAAI,GAAG,YAAY,CAAC,SAAS,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;YACrD,MAAM,IAAI,KAAK,CACX,QAAQ,OAAO,UAAU,GAAG,CAAC,MAAM,IAAI,IAAI,wBAAwB,MAAM,eAAe,IAAI,GAAG;gBAC3F,qCAAqC,CAC5C,CAAC;QACN,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;;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3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/session/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/G,qBAAa,cAAc;IACvB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,qBAAqB;IAM1C;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB,SAAS,IAAI,aAAa;IAU1B,UAAU,IAAI,WAAW;IAUzB,MAAM,IAAI,MAAM;IAUhB,eAAe,IAAI,OAAO;IAI1B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAiBzB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAOnC,KAAK,IAAI,IAAI;IAOb,aAAa,IAAI,UAAU;IAI3B,OAAO,CAAC,iBAAiB;CAK5B"}
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/session/manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAwB,KAAK,WAAW,EAAE,KAAK,qBAAqB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/G,qBAAa,cAAc;IACvB,OAAO,CAAC,OAAO,CAA4B;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkB;IAC1C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAU;IACjC,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,qBAAqB;IAM1C;;OAEG;IACH,UAAU,IAAI,IAAI;IAKlB,SAAS,IAAI,aAAa;IAU1B,UAAU,IAAI,WAAW;IAUzB,MAAM,IAAI,MAAM;IAUhB,eAAe,IAAI,OAAO;IAI1B,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAiBzB,QAAQ,IAAI,IAAI;IAiBhB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAOnC,KAAK,IAAI,IAAI;IAOb,aAAa,IAAI,UAAU;IAI3B,OAAO,CAAC,iBAAiB;CAK5B"}
|
package/dist/session/manager.js
CHANGED
|
@@ -54,6 +54,19 @@ export class SessionManager {
|
|
|
54
54
|
this.session = updated;
|
|
55
55
|
this.storage.save(updated);
|
|
56
56
|
}
|
|
57
|
+
clearJwt() {
|
|
58
|
+
this.assertInitialized();
|
|
59
|
+
if (!this.session) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const updated = {
|
|
63
|
+
...this.session,
|
|
64
|
+
jwt: null,
|
|
65
|
+
updatedAt: new Date().toISOString(),
|
|
66
|
+
};
|
|
67
|
+
this.session = updated;
|
|
68
|
+
this.storage.save(updated);
|
|
69
|
+
}
|
|
57
70
|
setSession(data) {
|
|
58
71
|
this.assertInitialized();
|
|
59
72
|
this.session = data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/session/manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAsE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE/G,MAAM,OAAO,cAAc;IACf,OAAO,GAAuB,IAAI,CAAC;IAC1B,OAAO,CAAkB;IACzB,UAAU,CAAa;IACvB,MAAM,CAAU;IACzB,WAAW,GAAG,KAAK,CAAC;IAE5B,YAAY,OAA8B;QACtC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,M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B,OAAO;QACX,CAAC;QAED,MAAM,OAAO,GAAgB;YACzB,GAAG,IAAI,CAAC,OAAO;YACf,GAAG,EAAE,IAAI;YACT,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACtC,CAAC;QAEF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,UAAU,CAAC,IAAiB;QACxB,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK;QACD,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAEzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,aAAa;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAEO,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;QAChF,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -10,12 +10,9 @@ export declare class SessionStorage implements ISessionStorage {
|
|
|
10
10
|
delete(): void;
|
|
11
11
|
private get sessionDir();
|
|
12
12
|
private get sessionFile();
|
|
13
|
-
private get sessionKeyFile();
|
|
14
13
|
private loadJson;
|
|
15
|
-
private loadKey;
|
|
16
14
|
private ensureDir;
|
|
17
15
|
private writeFileAtomic;
|
|
18
|
-
private wipeAndDeleteKey;
|
|
19
16
|
private tryUnlink;
|
|
20
17
|
}
|
|
21
18
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/session/storage.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/session/storage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,WAAW,EAAqB,MAAM,YAAY,CAAC;AAEvF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD,qBAAa,cAAe,YAAW,eAAe;IAE9C,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO;IAGpC,MAAM,IAAI,OAAO;IAIjB,IAAI,IAAI,WAAW,GAAG,IAAI;IAe1B,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI;IAO7B,MAAM,IAAI,IAAI;IAId,OAAO,KAAK,UAAU,GAErB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,OAAO,CAAC,QAAQ;IAWhB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,SAAS;CAcpB"}
|
package/dist/session/storage.js
CHANGED
|
@@ -2,8 +2,8 @@ import { randomBytes } from 'node:crypto';
|
|
|
2
2
|
import * as fs from 'node:fs';
|
|
3
3
|
import * as path from 'node:path';
|
|
4
4
|
import { SESSION_DIR_MODE, SESSION_FILE_MODE } from './constants.js';
|
|
5
|
-
import { sessionDataSchema
|
|
6
|
-
import { SESSION_DIR, SESSION_FILE
|
|
5
|
+
import { sessionDataSchema } from './types.js';
|
|
6
|
+
import { SESSION_DIR, SESSION_FILE } from '../config/constants.js';
|
|
7
7
|
import { errorMessage } from '../utils/error.utils.js';
|
|
8
8
|
export class SessionStorage {
|
|
9
9
|
homeDir;
|
|
@@ -20,12 +20,10 @@ export class SessionStorage {
|
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
const sessionPrivateKey = this.loadKey();
|
|
25
|
-
return { ...json, sessionPrivateKey };
|
|
23
|
+
return this.loadJson();
|
|
26
24
|
}
|
|
27
25
|
catch (error) {
|
|
28
|
-
this.logger.warn('session
|
|
26
|
+
this.logger.warn('session file is invalid or incompatible; removing and treating as missing', {
|
|
29
27
|
reason: errorMessage(error),
|
|
30
28
|
});
|
|
31
29
|
this.delete();
|
|
@@ -34,19 +32,11 @@ export class SessionStorage {
|
|
|
34
32
|
}
|
|
35
33
|
save(data) {
|
|
36
34
|
const validated = sessionDataSchema.parse(data);
|
|
37
|
-
const { sessionPrivateKey, ...json } = validated;
|
|
38
35
|
this.ensureDir();
|
|
39
|
-
this.writeFileAtomic(this.sessionFile, JSON.stringify(
|
|
40
|
-
if (sessionPrivateKey !== null) {
|
|
41
|
-
this.writeFileAtomic(this.sessionKeyFile, sessionPrivateKey);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
this.wipeAndDeleteKey();
|
|
45
|
-
}
|
|
36
|
+
this.writeFileAtomic(this.sessionFile, JSON.stringify(validated, null, 2));
|
|
46
37
|
}
|
|
47
38
|
delete() {
|
|
48
39
|
this.tryUnlink(this.sessionFile);
|
|
49
|
-
this.wipeAndDeleteKey();
|
|
50
40
|
}
|
|
51
41
|
get sessionDir() {
|
|
52
42
|
return path.join(this.homeDir, SESSION_DIR);
|
|
@@ -54,30 +44,16 @@ export class SessionStorage {
|
|
|
54
44
|
get sessionFile() {
|
|
55
45
|
return path.join(this.sessionDir, SESSION_FILE);
|
|
56
46
|
}
|
|
57
|
-
get sessionKeyFile() {
|
|
58
|
-
return path.join(this.sessionDir, SESSION_KEY_FILE);
|
|
59
|
-
}
|
|
60
47
|
loadJson() {
|
|
61
48
|
const raw = fs.readFileSync(this.sessionFile, 'utf-8');
|
|
62
49
|
const parsed = JSON.parse(raw);
|
|
63
|
-
const result =
|
|
50
|
+
const result = sessionDataSchema.safeParse(parsed);
|
|
64
51
|
if (!result.success) {
|
|
65
52
|
const issues = result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join(', ');
|
|
66
53
|
throw new Error(`Invalid session file at ${this.sessionFile}: ${issues}`);
|
|
67
54
|
}
|
|
68
55
|
return result.data;
|
|
69
56
|
}
|
|
70
|
-
loadKey() {
|
|
71
|
-
if (!fs.existsSync(this.sessionKeyFile)) {
|
|
72
|
-
return null;
|
|
73
|
-
}
|
|
74
|
-
const raw = fs.readFileSync(this.sessionKeyFile, 'utf-8').trim();
|
|
75
|
-
const result = sessionPrivateKeySchema.safeParse(raw);
|
|
76
|
-
if (!result.success) {
|
|
77
|
-
throw new Error(`Invalid session key file at ${this.sessionKeyFile}`);
|
|
78
|
-
}
|
|
79
|
-
return result.data;
|
|
80
|
-
}
|
|
81
57
|
ensureDir() {
|
|
82
58
|
fs.mkdirSync(this.sessionDir, { recursive: true, mode: SESSION_DIR_MODE });
|
|
83
59
|
fs.chmodSync(this.sessionDir, SESSION_DIR_MODE);
|
|
@@ -88,19 +64,6 @@ export class SessionStorage {
|
|
|
88
64
|
fs.renameSync(tempFile, filePath);
|
|
89
65
|
fs.chmodSync(filePath, SESSION_FILE_MODE);
|
|
90
66
|
}
|
|
91
|
-
wipeAndDeleteKey() {
|
|
92
|
-
if (!fs.existsSync(this.sessionKeyFile)) {
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
try {
|
|
96
|
-
const stats = fs.statSync(this.sessionKeyFile);
|
|
97
|
-
fs.writeFileSync(this.sessionKeyFile, Buffer.alloc(stats.size), { flag: 'r+' });
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
// best-effort; continue to unlink
|
|
101
|
-
}
|
|
102
|
-
this.tryUnlink(this.sessionKeyFile);
|
|
103
|
-
}
|
|
104
67
|
tryUnlink(filePath) {
|
|
105
68
|
try {
|
|
106
69
|
fs.unlinkSync(filePath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/session/storage.ts"],"names":[],"mappings":"A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
3
|
import { WalletMode } from '../types.js';
|
|
4
|
-
export declare const agwSessionConfigSchema: z.ZodObject<{
|
|
5
|
-
accountAddress: z.ZodString;
|
|
6
|
-
sessionHash: z.ZodString;
|
|
7
|
-
policies: z.ZodUnknown;
|
|
8
|
-
expiresAt: z.ZodNumber;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
accountAddress: string;
|
|
11
|
-
sessionHash: string;
|
|
12
|
-
expiresAt: number;
|
|
13
|
-
policies?: unknown;
|
|
14
|
-
}, {
|
|
15
|
-
accountAddress: string;
|
|
16
|
-
sessionHash: string;
|
|
17
|
-
expiresAt: number;
|
|
18
|
-
policies?: unknown;
|
|
19
|
-
}>;
|
|
20
4
|
export declare const sessionDataSchema: z.ZodObject<{
|
|
21
5
|
walletMode: z.ZodNativeEnum<typeof WalletMode>;
|
|
22
6
|
address: z.ZodString;
|
|
23
|
-
sessionPrivateKey: z.ZodNullable<z.ZodString>;
|
|
24
7
|
jwt: z.ZodNullable<z.ZodString>;
|
|
25
|
-
sessionConfig: z.ZodNullable<z.ZodObject<{
|
|
26
|
-
accountAddress: z.ZodString;
|
|
27
|
-
sessionHash: z.ZodString;
|
|
28
|
-
policies: z.ZodUnknown;
|
|
29
|
-
expiresAt: z.ZodNumber;
|
|
30
|
-
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
accountAddress: string;
|
|
32
|
-
sessionHash: string;
|
|
33
|
-
expiresAt: number;
|
|
34
|
-
policies?: unknown;
|
|
35
|
-
}, {
|
|
36
|
-
accountAddress: string;
|
|
37
|
-
sessionHash: string;
|
|
38
|
-
expiresAt: number;
|
|
39
|
-
policies?: unknown;
|
|
40
|
-
}>>;
|
|
41
8
|
createdAt: z.ZodString;
|
|
42
9
|
updatedAt: z.ZodString;
|
|
43
10
|
}, "strip", z.ZodTypeAny, {
|
|
44
11
|
jwt: string | null;
|
|
45
12
|
walletMode: WalletMode;
|
|
46
13
|
address: string;
|
|
47
|
-
sessionPrivateKey: string | null;
|
|
48
|
-
sessionConfig: {
|
|
49
|
-
accountAddress: string;
|
|
50
|
-
sessionHash: string;
|
|
51
|
-
expiresAt: number;
|
|
52
|
-
policies?: unknown;
|
|
53
|
-
} | null;
|
|
54
14
|
createdAt: string;
|
|
55
15
|
updatedAt: string;
|
|
56
16
|
}, {
|
|
57
17
|
jwt: string | null;
|
|
58
18
|
walletMode: WalletMode;
|
|
59
19
|
address: string;
|
|
60
|
-
sessionPrivateKey: string | null;
|
|
61
|
-
sessionConfig: {
|
|
62
|
-
accountAddress: string;
|
|
63
|
-
sessionHash: string;
|
|
64
|
-
expiresAt: number;
|
|
65
|
-
policies?: unknown;
|
|
66
|
-
} | null;
|
|
67
20
|
createdAt: string;
|
|
68
21
|
updatedAt: string;
|
|
69
22
|
}>;
|
|
70
|
-
export declare const sessionJsonSchema: z.ZodObject<Omit<{
|
|
71
|
-
walletMode: z.ZodNativeEnum<typeof WalletMode>;
|
|
72
|
-
address: z.ZodString;
|
|
73
|
-
sessionPrivateKey: z.ZodNullable<z.ZodString>;
|
|
74
|
-
jwt: z.ZodNullable<z.ZodString>;
|
|
75
|
-
sessionConfig: z.ZodNullable<z.ZodObject<{
|
|
76
|
-
accountAddress: z.ZodString;
|
|
77
|
-
sessionHash: z.ZodString;
|
|
78
|
-
policies: z.ZodUnknown;
|
|
79
|
-
expiresAt: z.ZodNumber;
|
|
80
|
-
}, "strip", z.ZodTypeAny, {
|
|
81
|
-
accountAddress: string;
|
|
82
|
-
sessionHash: string;
|
|
83
|
-
expiresAt: number;
|
|
84
|
-
policies?: unknown;
|
|
85
|
-
}, {
|
|
86
|
-
accountAddress: string;
|
|
87
|
-
sessionHash: string;
|
|
88
|
-
expiresAt: number;
|
|
89
|
-
policies?: unknown;
|
|
90
|
-
}>>;
|
|
91
|
-
createdAt: z.ZodString;
|
|
92
|
-
updatedAt: z.ZodString;
|
|
93
|
-
}, "sessionPrivateKey">, "strip", z.ZodTypeAny, {
|
|
94
|
-
jwt: string | null;
|
|
95
|
-
walletMode: WalletMode;
|
|
96
|
-
address: string;
|
|
97
|
-
sessionConfig: {
|
|
98
|
-
accountAddress: string;
|
|
99
|
-
sessionHash: string;
|
|
100
|
-
expiresAt: number;
|
|
101
|
-
policies?: unknown;
|
|
102
|
-
} | null;
|
|
103
|
-
createdAt: string;
|
|
104
|
-
updatedAt: string;
|
|
105
|
-
}, {
|
|
106
|
-
jwt: string | null;
|
|
107
|
-
walletMode: WalletMode;
|
|
108
|
-
address: string;
|
|
109
|
-
sessionConfig: {
|
|
110
|
-
accountAddress: string;
|
|
111
|
-
sessionHash: string;
|
|
112
|
-
expiresAt: number;
|
|
113
|
-
policies?: unknown;
|
|
114
|
-
} | null;
|
|
115
|
-
createdAt: string;
|
|
116
|
-
updatedAt: string;
|
|
117
|
-
}>;
|
|
118
|
-
export type SessionJsonData = z.infer<typeof sessionJsonSchema>;
|
|
119
|
-
export declare const sessionPrivateKeySchema: z.ZodString;
|
|
120
|
-
export type AgwSessionConfig = z.infer<typeof agwSessionConfigSchema>;
|
|
121
23
|
export type SessionData = z.infer<typeof sessionDataSchema>;
|
|
122
24
|
export interface ISessionStorage {
|
|
123
25
|
load(): SessionData | null;
|
|
@@ -125,6 +27,10 @@ export interface ISessionStorage {
|
|
|
125
27
|
delete(): void;
|
|
126
28
|
exists(): boolean;
|
|
127
29
|
}
|
|
30
|
+
/** The game-session capability API clients need to revoke a rejected bearer token. */
|
|
31
|
+
export interface IJwtSession {
|
|
32
|
+
clearJwt(): void;
|
|
33
|
+
}
|
|
128
34
|
export declare enum SessionStatus {
|
|
129
35
|
Active = "active",
|
|
130
36
|
Expired = "expired",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EAM5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,MAAM,WAAW,eAAe;IAC5B,IAAI,IAAI,WAAW,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC9B,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,IAAI,OAAO,CAAC;CACrB;AAED,sFAAsF;AACtF,MAAM,WAAW,WAAW;IACxB,QAAQ,IAAI,IAAI,CAAC;CACpB;AAED,oBAAY,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,OAAO,YAAY;CACtB;AAED,MAAM,WAAW,qBAAqB;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,MAAM,EAAE,OAAO,CAAC;CACnB"}
|
package/dist/session/types.js
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { WalletMode } from '../types.js';
|
|
3
|
-
export const agwSessionConfigSchema = z.object({
|
|
4
|
-
accountAddress: z.string(),
|
|
5
|
-
sessionHash: z.string(),
|
|
6
|
-
policies: z.unknown(),
|
|
7
|
-
expiresAt: z.number(),
|
|
8
|
-
});
|
|
9
3
|
export const sessionDataSchema = z.object({
|
|
10
4
|
walletMode: z.nativeEnum(WalletMode),
|
|
11
5
|
address: z.string(),
|
|
12
|
-
sessionPrivateKey: z
|
|
13
|
-
.string()
|
|
14
|
-
.regex(/^0x[0-9a-fA-F]{64}$/, 'sessionPrivateKey must be a 32-byte hex string')
|
|
15
|
-
.nullable(),
|
|
16
6
|
jwt: z.string().nullable(),
|
|
17
|
-
sessionConfig: agwSessionConfigSchema.nullable(),
|
|
18
7
|
createdAt: z.string(),
|
|
19
8
|
updatedAt: z.string(),
|
|
20
9
|
});
|
|
21
|
-
export const sessionJsonSchema = sessionDataSchema.omit({ sessionPrivateKey: true });
|
|
22
|
-
export const sessionPrivateKeySchema = z
|
|
23
|
-
.string()
|
|
24
|
-
.regex(/^0x[0-9a-fA-F]{64}$/, 'sessionPrivateKey must be a 32-byte hex string');
|
|
25
10
|
export var SessionStatus;
|
|
26
11
|
(function (SessionStatus) {
|
|
27
12
|
SessionStatus["Active"] = "active";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/session/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,UAAU,EAAE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAgBH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,kCAAiB,CAAA;IACjB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACvB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AppContext } from '../types.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type ToolRegistrar } from './types.js';
|
|
3
3
|
export declare function registerAuthenticateTool(server: ToolRegistrar, context: AppContext): void;
|
|
4
4
|
//# sourceMappingURL=authenticate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"authenticate.d.ts","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAazE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CA0BzF"}
|
|
@@ -1,66 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PayboxCoordinator } from '../paybox/auth/coordinator.js';
|
|
2
|
+
import { PayboxWalletSelectionError } from '../paybox/errors.js';
|
|
3
|
+
import { PayboxErrorCode } from '../paybox/types.js';
|
|
2
4
|
import { WalletMode } from '../types.js';
|
|
3
5
|
import { PERSONA_BRIEF_MARKER } from './persona/constants.js';
|
|
6
|
+
import { authenticateInputSchema } from './types.js';
|
|
4
7
|
const DESCRIPTION = [
|
|
5
8
|
'Create a blockchain session.',
|
|
6
9
|
'Call this tool when other tools fail with authentication or session errors',
|
|
7
10
|
'(e.g. "not authenticated", "session expired").',
|
|
8
11
|
'In EVM mode this signs in via SIWE locally and stores the token.',
|
|
9
|
-
'In
|
|
12
|
+
'In Paybox mode it opens browser authorization and returns the URL as a fallback.',
|
|
10
13
|
'Once authenticated, subsequent wallet-dependent tools will work automatically.',
|
|
11
14
|
'Pass force=true to discard the cached session and authenticate from scratch',
|
|
12
15
|
'(e.g. after the game server was reset and the stored token references a stale user).',
|
|
13
16
|
].join(' ');
|
|
14
|
-
const inputSchema = {
|
|
15
|
-
force: z
|
|
16
|
-
.boolean()
|
|
17
|
-
.nullable()
|
|
18
|
-
.default(null)
|
|
19
|
-
.describe('Ignore the stored session and re-run authentication from scratch.'),
|
|
20
|
-
};
|
|
21
17
|
export function registerAuthenticateTool(server, context) {
|
|
22
18
|
const authService = context.auth;
|
|
23
19
|
const description = context.config.OPERATOR_PERSONA ? `${DESCRIPTION} ${PERSONA_BRIEF_MARKER}` : DESCRIPTION;
|
|
24
|
-
server.registerTool('cpu_authenticate', { description, inputSchema }, async (args) => {
|
|
20
|
+
server.registerTool('cpu_authenticate', { description, inputSchema: authenticateInputSchema }, async (args) => {
|
|
25
21
|
const force = args.force ?? false;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
return {
|
|
33
|
-
content: [{ type: 'text', text: `Authenticated as ${address}. Session token stored${suffix}` }],
|
|
34
|
-
};
|
|
22
|
+
const payboxCredentialId = args.payboxCredentialId ?? null;
|
|
23
|
+
if (context.config.WALLET_MODE === WalletMode.PAYBOX) {
|
|
24
|
+
if (!(context.wallet instanceof PayboxCoordinator)) {
|
|
25
|
+
throw new Error('Paybox wallet mode is not configured.');
|
|
26
|
+
}
|
|
27
|
+
const result = await context.wallet.authenticate({ force, payboxCredentialId });
|
|
28
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }] };
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return { content: [{ type: 'text', text: 'Already authenticated. Session is active.' }] };
|
|
30
|
+
if (payboxCredentialId !== null) {
|
|
31
|
+
throw new PayboxWalletSelectionError(PayboxErrorCode.WalletSelectionNotPending);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
content: [
|
|
44
|
-
{
|
|
45
|
-
type: 'text',
|
|
46
|
-
text: `Authentication already in progress. Ask the user to open this URL to approve:\n${pending.verificationUrl}`,
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
const result = await authService.authenticateDevice();
|
|
33
|
+
await (force ? authService.reauthenticate() : authService.getAccessToken());
|
|
34
|
+
const address = context.wallet.get().getAddress();
|
|
35
|
+
const suffix = force ? ' (forced fresh SIWE login).' : '.';
|
|
52
36
|
return {
|
|
53
|
-
content: [
|
|
54
|
-
{
|
|
55
|
-
type: 'text',
|
|
56
|
-
text: [
|
|
57
|
-
'Ask the user to open this URL in their browser to approve the session:',
|
|
58
|
-
result.verificationUrl,
|
|
59
|
-
'',
|
|
60
|
-
'Polling for approval in the background...',
|
|
61
|
-
].join('\n'),
|
|
62
|
-
},
|
|
63
|
-
],
|
|
37
|
+
content: [{ type: 'text', text: `Authenticated as ${address}. Session token stored${suffix}` }],
|
|
64
38
|
};
|
|
65
39
|
});
|
|
66
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,oBAAoB,EA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AC;QACD,IAAI,kBAAkB,KAAK,IAAI,EAAE,CAAC;YAC9B,MAAM,IAAI,0BAA0B,CAAC,eAAe,CAAC,yBAAyB,CAAC,CAAC;QACpF,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;QAC5E,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;QAClD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,GAAG,CAAC;QAC3D,OAAO;YACH,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,oBAAoB,OAAO,yBAAyB,MAAM,EAAE,EAAE,CAAC;SAClG,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export declare const SALE_FEE_STRUCTURAL_BOUND_PERCENT = 100;
|
|
2
2
|
export declare const SALE_FEE_STRUCTURAL_BOUND_NOTE = "(the structural bound \u2014 a hub owner can set any rate up to this maximum)";
|
|
3
|
+
export declare const LOT_LISTING_LABEL = "Lot listing:";
|
|
4
|
+
export declare const EFFECTIVE_BOUNDS_SOURCE_NOTE: string;
|
|
5
|
+
export declare const LOT_LISTING_UNAVAILABLE_NOTE: string;
|
|
3
6
|
export declare const ENTRY_POINT_LOOKUP: {
|
|
4
7
|
building: string;
|
|
5
8
|
buildingSearch: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/tools/config/get-game-config/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD,eAAO,MAAM,8BAA8B,kFACmC,CAAC;AAE/E,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAC;AAEF,eA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