@otim/utils 0.0.4 → 0.0.6
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/api/index.d.mts +1858 -7
- package/dist/api/index.d.mts.map +1 -0
- package/dist/api/index.d.ts +1857 -6
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1514 -1994
- package/dist/api/index.js.map +1 -7
- package/dist/api/index.mjs +1394 -1962
- package/dist/api/index.mjs.map +1 -7
- package/dist/api-urls-B-GTEiT3.d.mts +49 -0
- package/dist/api-urls-B-GTEiT3.d.mts.map +1 -0
- package/dist/api-urls-Cd20DG4i.js +171 -0
- package/dist/api-urls-Cd20DG4i.js.map +1 -0
- package/dist/api-urls-DJcIKBCy.mjs +135 -0
- package/dist/api-urls-DJcIKBCy.mjs.map +1 -0
- package/dist/api-urls-SKeIQMoZ.d.ts +49 -0
- package/dist/api-urls-SKeIQMoZ.d.ts.map +1 -0
- package/dist/chains/index.d.mts +13568 -16
- package/dist/chains/index.d.mts.map +1 -0
- package/dist/chains/index.d.ts +13567 -15
- package/dist/chains/index.d.ts.map +1 -1
- package/dist/chains/index.js +3615 -424
- package/dist/chains/index.js.map +1 -7
- package/dist/chains/index.mjs +3561 -440
- package/dist/chains/index.mjs.map +1 -7
- package/dist/chunk-kSYXY2_d.js +34 -0
- package/dist/client-factory-7xUSPC9I.mjs +42 -0
- package/dist/client-factory-7xUSPC9I.mjs.map +1 -0
- package/dist/client-factory-C3A4RPdj.d.ts +22 -0
- package/dist/client-factory-C3A4RPdj.d.ts.map +1 -0
- package/dist/client-factory-CTI_Nt35.js +49 -0
- package/dist/client-factory-CTI_Nt35.js.map +1 -0
- package/dist/client-factory-DOL0ZTWy.d.mts +22 -0
- package/dist/client-factory-DOL0ZTWy.d.mts.map +1 -0
- package/dist/constants.d.mts +14 -24
- package/dist/constants.d.mts.map +1 -0
- package/dist/constants.d.ts +13 -23
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +31 -46
- package/dist/constants.js.map +1 -7
- package/dist/constants.mjs +22 -26
- package/dist/constants.mjs.map +1 -7
- package/dist/date-CFzrYcjE.js +536 -0
- package/dist/date-CFzrYcjE.js.map +1 -0
- package/dist/date-gBac-Om9.mjs +313 -0
- package/dist/date-gBac-Om9.mjs.map +1 -0
- package/dist/defineProperty-DbMdhrDE.js +49 -0
- package/dist/defineProperty-DzhmunJg.mjs +43 -0
- package/dist/formatters/index.d.mts +1 -2
- package/dist/formatters/index.d.ts +1 -2
- package/dist/formatters/index.js +0 -19
- package/dist/formatters/index.mjs +1 -1
- package/dist/helpers/index.d.mts +562 -19
- package/dist/helpers/index.d.mts.map +1 -0
- package/dist/helpers/index.d.ts +561 -18
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +106 -1344
- package/dist/helpers/index.mjs +3 -1315
- package/dist/helpers-BNiSxjGq.mjs +895 -0
- package/dist/helpers-BNiSxjGq.mjs.map +1 -0
- package/dist/helpers-DoC7Xl12.js +1291 -0
- package/dist/helpers-DoC7Xl12.js.map +1 -0
- package/dist/index-Bv0kUz4w.d.ts +540 -0
- package/dist/index-Bv0kUz4w.d.ts.map +1 -0
- package/dist/index-DartTKk2.d.mts +540 -0
- package/dist/index-DartTKk2.d.mts.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -2
- package/dist/index.mjs +1 -1
- package/dist/instructions/index.d.mts +687 -6
- package/dist/instructions/index.d.mts.map +1 -0
- package/dist/instructions/index.d.ts +686 -5
- package/dist/instructions/index.d.ts.map +1 -1
- package/dist/instructions/index.js +1912 -1091
- package/dist/instructions/index.js.map +1 -7
- package/dist/instructions/index.mjs +1887 -1058
- package/dist/instructions/index.mjs.map +1 -7
- package/dist/payments/index.d.mts +322 -16
- package/dist/payments/index.d.mts.map +1 -0
- package/dist/payments/index.d.ts +321 -15
- package/dist/payments/index.d.ts.map +1 -1
- package/dist/payments/index.js +616 -1258
- package/dist/payments/index.js.map +1 -7
- package/dist/payments/index.mjs +594 -1236
- package/dist/payments/index.mjs.map +1 -7
- package/dist/schemas/index.d.mts +2 -10
- package/dist/schemas/index.d.ts +2 -10
- package/dist/schemas/index.js +350 -393
- package/dist/schemas/index.js.map +1 -7
- package/dist/schemas/index.mjs +283 -371
- package/dist/schemas/index.mjs.map +1 -7
- package/dist/server/index.d.mts +354 -3
- package/dist/server/index.d.mts.map +1 -0
- package/dist/server/index.d.ts +353 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +248 -435
- package/dist/server/index.js.map +1 -7
- package/dist/server/index.mjs +199 -404
- package/dist/server/index.mjs.map +1 -7
- package/dist/server/react.d.mts +16 -0
- package/dist/server/react.d.mts.map +1 -0
- package/dist/server/react.d.ts +16 -0
- package/dist/server/react.d.ts.map +1 -0
- package/dist/server/react.js +30 -0
- package/dist/server/react.js.map +1 -0
- package/dist/server/react.mjs +28 -0
- package/dist/server/react.mjs.map +1 -0
- package/dist/wallet/wagmi/index.d.mts +23 -2
- package/dist/wallet/wagmi/index.d.mts.map +1 -0
- package/dist/wallet/wagmi/index.d.ts +22 -1
- package/dist/wallet/wagmi/index.d.ts.map +1 -1
- package/dist/wallet/wagmi/index.js +86 -417
- package/dist/wallet/wagmi/index.js.map +1 -7
- package/dist/wallet/wagmi/index.mjs +82 -418
- package/dist/wallet/wagmi/index.mjs.map +1 -7
- package/package.json +39 -28
- package/dist/api/api.d.mts +0 -18
- package/dist/api/api.d.ts +0 -18
- package/dist/api/api.d.ts.map +0 -1
- package/dist/api/core/error.d.mts +0 -74
- package/dist/api/core/error.d.ts +0 -74
- package/dist/api/core/error.d.ts.map +0 -1
- package/dist/api/core/index.d.mts +0 -4
- package/dist/api/core/index.d.ts +0 -4
- package/dist/api/core/index.d.ts.map +0 -1
- package/dist/api/core/instance.d.mts +0 -13
- package/dist/api/core/instance.d.ts +0 -13
- package/dist/api/core/instance.d.ts.map +0 -1
- package/dist/api/core/service.d.mts +0 -51
- package/dist/api/core/service.d.ts +0 -51
- package/dist/api/core/service.d.ts.map +0 -1
- package/dist/api/schemas/account.d.mts +0 -44
- package/dist/api/schemas/account.d.ts +0 -44
- package/dist/api/schemas/account.d.ts.map +0 -1
- package/dist/api/schemas/activity.d.mts +0 -277
- package/dist/api/schemas/activity.d.ts +0 -277
- package/dist/api/schemas/activity.d.ts.map +0 -1
- package/dist/api/schemas/auth.d.mts +0 -127
- package/dist/api/schemas/auth.d.ts +0 -127
- package/dist/api/schemas/auth.d.ts.map +0 -1
- package/dist/api/schemas/chain.d.mts +0 -15
- package/dist/api/schemas/chain.d.ts +0 -15
- package/dist/api/schemas/chain.d.ts.map +0 -1
- package/dist/api/schemas/config.d.mts +0 -33
- package/dist/api/schemas/config.d.ts +0 -33
- package/dist/api/schemas/config.d.ts.map +0 -1
- package/dist/api/schemas/contacts.d.mts +0 -27
- package/dist/api/schemas/contacts.d.ts +0 -27
- package/dist/api/schemas/contacts.d.ts.map +0 -1
- package/dist/api/schemas/index.d.mts +0 -12
- package/dist/api/schemas/index.d.ts +0 -12
- package/dist/api/schemas/index.d.ts.map +0 -1
- package/dist/api/schemas/instruction.d.mts +0 -446
- package/dist/api/schemas/instruction.d.ts +0 -446
- package/dist/api/schemas/instruction.d.ts.map +0 -1
- package/dist/api/schemas/integration.d.mts +0 -166
- package/dist/api/schemas/integration.d.ts +0 -166
- package/dist/api/schemas/integration.d.ts.map +0 -1
- package/dist/api/schemas/operating-account.d.mts +0 -11
- package/dist/api/schemas/operating-account.d.ts +0 -11
- package/dist/api/schemas/operating-account.d.ts.map +0 -1
- package/dist/api/schemas/payments.d.mts +0 -234
- package/dist/api/schemas/payments.d.ts +0 -234
- package/dist/api/schemas/payments.d.ts.map +0 -1
- package/dist/api/schemas/transaction.d.mts +0 -37
- package/dist/api/schemas/transaction.d.ts +0 -37
- package/dist/api/schemas/transaction.d.ts.map +0 -1
- package/dist/api/services/account.d.mts +0 -8
- package/dist/api/services/account.d.ts +0 -8
- package/dist/api/services/account.d.ts.map +0 -1
- package/dist/api/services/activity.d.mts +0 -7
- package/dist/api/services/activity.d.ts +0 -7
- package/dist/api/services/activity.d.ts.map +0 -1
- package/dist/api/services/auth.d.mts +0 -12
- package/dist/api/services/auth.d.ts +0 -12
- package/dist/api/services/auth.d.ts.map +0 -1
- package/dist/api/services/base.d.mts +0 -10
- package/dist/api/services/base.d.ts +0 -10
- package/dist/api/services/base.d.ts.map +0 -1
- package/dist/api/services/config.d.mts +0 -10
- package/dist/api/services/config.d.ts +0 -10
- package/dist/api/services/config.d.ts.map +0 -1
- package/dist/api/services/contacts.d.mts +0 -8
- package/dist/api/services/contacts.d.ts +0 -8
- package/dist/api/services/contacts.d.ts.map +0 -1
- package/dist/api/services/developer.d.mts +0 -6
- package/dist/api/services/developer.d.ts +0 -6
- package/dist/api/services/developer.d.ts.map +0 -1
- package/dist/api/services/index.d.mts +0 -13
- package/dist/api/services/index.d.ts +0 -13
- package/dist/api/services/index.d.ts.map +0 -1
- package/dist/api/services/instruction.d.mts +0 -12
- package/dist/api/services/instruction.d.ts +0 -12
- package/dist/api/services/instruction.d.ts.map +0 -1
- package/dist/api/services/integration.d.mts +0 -8
- package/dist/api/services/integration.d.ts +0 -8
- package/dist/api/services/integration.d.ts.map +0 -1
- package/dist/api/services/operating-account.d.mts +0 -8
- package/dist/api/services/operating-account.d.ts +0 -8
- package/dist/api/services/operating-account.d.ts.map +0 -1
- package/dist/api/services/payments.d.mts +0 -14
- package/dist/api/services/payments.d.ts +0 -14
- package/dist/api/services/payments.d.ts.map +0 -1
- package/dist/api/services/transaction.d.mts +0 -8
- package/dist/api/services/transaction.d.ts +0 -8
- package/dist/api/services/transaction.d.ts.map +0 -1
- package/dist/api/services/uniswap-token-list-service.d.mts +0 -66
- package/dist/api/services/uniswap-token-list-service.d.ts +0 -66
- package/dist/api/services/uniswap-token-list-service.d.ts.map +0 -1
- package/dist/api/utils/index.d.mts +0 -2
- package/dist/api/utils/index.d.ts +0 -2
- package/dist/api/utils/index.d.ts.map +0 -1
- package/dist/api/utils/pagination.d.mts +0 -32
- package/dist/api/utils/pagination.d.ts +0 -32
- package/dist/api/utils/pagination.d.ts.map +0 -1
- package/dist/chains/config/all-chains.d.mts +0 -4243
- package/dist/chains/config/all-chains.d.ts +0 -4243
- package/dist/chains/config/all-chains.d.ts.map +0 -1
- package/dist/chains/config/custom-chains.d.mts +0 -49
- package/dist/chains/config/custom-chains.d.ts +0 -49
- package/dist/chains/config/custom-chains.d.ts.map +0 -1
- package/dist/chains/config/mainnet-chains.d.mts +0 -1063
- package/dist/chains/config/mainnet-chains.d.ts +0 -1063
- package/dist/chains/config/mainnet-chains.d.ts.map +0 -1
- package/dist/chains/config/supported-chains.d.mts +0 -2172
- package/dist/chains/config/supported-chains.d.ts +0 -2172
- package/dist/chains/config/supported-chains.d.ts.map +0 -1
- package/dist/chains/config/testnet-chains.d.mts +0 -1110
- package/dist/chains/config/testnet-chains.d.ts +0 -1110
- package/dist/chains/config/testnet-chains.d.ts.map +0 -1
- package/dist/chains/lambda/chain-mapping.d.mts +0 -55
- package/dist/chains/lambda/chain-mapping.d.ts +0 -55
- package/dist/chains/lambda/chain-mapping.d.ts.map +0 -1
- package/dist/chains/lambda/index.d.mts +0 -2
- package/dist/chains/lambda/index.d.ts +0 -2
- package/dist/chains/lambda/index.d.ts.map +0 -1
- package/dist/chains/tokens/chain-tokens.d.mts +0 -6
- package/dist/chains/tokens/chain-tokens.d.ts +0 -6
- package/dist/chains/tokens/chain-tokens.d.ts.map +0 -1
- package/dist/chains/tokens/token-addresses.d.mts +0 -8
- package/dist/chains/tokens/token-addresses.d.ts +0 -8
- package/dist/chains/tokens/token-addresses.d.ts.map +0 -1
- package/dist/chains/tokens/token-metadata.d.mts +0 -5
- package/dist/chains/tokens/token-metadata.d.ts +0 -5
- package/dist/chains/tokens/token-metadata.d.ts.map +0 -1
- package/dist/chains/types.d.mts +0 -23
- package/dist/chains/types.d.ts +0 -23
- package/dist/chains/types.d.ts.map +0 -1
- package/dist/chains/utils/filter-tokens.d.mts +0 -3
- package/dist/chains/utils/filter-tokens.d.ts +0 -3
- package/dist/chains/utils/filter-tokens.d.ts.map +0 -1
- package/dist/chains/utils/stablecoin.d.mts +0 -7
- package/dist/chains/utils/stablecoin.d.ts +0 -7
- package/dist/chains/utils/stablecoin.d.ts.map +0 -1
- package/dist/chains/utils/token-maps.d.mts +0 -10
- package/dist/chains/utils/token-maps.d.ts +0 -10
- package/dist/chains/utils/token-maps.d.ts.map +0 -1
- package/dist/env.d.mts +0 -17
- package/dist/env.d.ts +0 -17
- package/dist/env.d.ts.map +0 -1
- package/dist/formatters/index.d.ts.map +0 -1
- package/dist/formatters/index.js.map +0 -7
- package/dist/formatters/index.mjs.map +0 -7
- package/dist/helpers/address.d.mts +0 -7
- package/dist/helpers/address.d.ts +0 -7
- package/dist/helpers/address.d.ts.map +0 -1
- package/dist/helpers/blockchain.d.mts +0 -41
- package/dist/helpers/blockchain.d.ts +0 -41
- package/dist/helpers/blockchain.d.ts.map +0 -1
- package/dist/helpers/date.d.mts +0 -70
- package/dist/helpers/date.d.ts +0 -70
- package/dist/helpers/date.d.ts.map +0 -1
- package/dist/helpers/datetime.d.mts +0 -57
- package/dist/helpers/datetime.d.ts +0 -57
- package/dist/helpers/datetime.d.ts.map +0 -1
- package/dist/helpers/domain.d.mts +0 -2
- package/dist/helpers/domain.d.ts +0 -2
- package/dist/helpers/domain.d.ts.map +0 -1
- package/dist/helpers/index.js.map +0 -7
- package/dist/helpers/index.mjs.map +0 -7
- package/dist/helpers/intl.d.mts +0 -20
- package/dist/helpers/intl.d.ts +0 -20
- package/dist/helpers/intl.d.ts.map +0 -1
- package/dist/helpers/logger.d.mts +0 -26
- package/dist/helpers/logger.d.ts +0 -26
- package/dist/helpers/logger.d.ts.map +0 -1
- package/dist/helpers/mask-options.d.mts +0 -10
- package/dist/helpers/mask-options.d.ts +0 -10
- package/dist/helpers/mask-options.d.ts.map +0 -1
- package/dist/helpers/num-formatter.d.mts +0 -3
- package/dist/helpers/num-formatter.d.ts +0 -3
- package/dist/helpers/num-formatter.d.ts.map +0 -1
- package/dist/helpers/polling.d.mts +0 -39
- package/dist/helpers/polling.d.ts +0 -39
- package/dist/helpers/polling.d.ts.map +0 -1
- package/dist/helpers/random.d.mts +0 -10
- package/dist/helpers/random.d.ts +0 -10
- package/dist/helpers/random.d.ts.map +0 -1
- package/dist/helpers/sdk-loader.d.mts +0 -25
- package/dist/helpers/sdk-loader.d.ts +0 -25
- package/dist/helpers/sdk-loader.d.ts.map +0 -1
- package/dist/helpers/signatures.d.mts +0 -17
- package/dist/helpers/signatures.d.ts +0 -17
- package/dist/helpers/signatures.d.ts.map +0 -1
- package/dist/helpers/string.d.mts +0 -17
- package/dist/helpers/string.d.ts +0 -17
- package/dist/helpers/string.d.ts.map +0 -1
- package/dist/helpers/types.d.mts +0 -39
- package/dist/helpers/types.d.ts +0 -39
- package/dist/helpers/types.d.ts.map +0 -1
- package/dist/helpers/url.d.mts +0 -11
- package/dist/helpers/url.d.ts +0 -11
- package/dist/helpers/url.d.ts.map +0 -1
- package/dist/helpers/window.d.mts +0 -37
- package/dist/helpers/window.d.ts +0 -37
- package/dist/helpers/window.d.ts.map +0 -1
- package/dist/helpers/zod.d.mts +0 -51
- package/dist/helpers/zod.d.ts +0 -51
- package/dist/helpers/zod.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -7
- package/dist/index.mjs.map +0 -7
- package/dist/instructions/actions/index.d.mts +0 -5
- package/dist/instructions/actions/index.d.ts +0 -5
- package/dist/instructions/actions/index.d.ts.map +0 -1
- package/dist/instructions/actions/refuel/index.d.mts +0 -15
- package/dist/instructions/actions/refuel/index.d.ts +0 -15
- package/dist/instructions/actions/refuel/index.d.ts.map +0 -1
- package/dist/instructions/actions/swap/index.d.mts +0 -19
- package/dist/instructions/actions/swap/index.d.ts +0 -19
- package/dist/instructions/actions/swap/index.d.ts.map +0 -1
- package/dist/instructions/actions/sweep/index.d.mts +0 -16
- package/dist/instructions/actions/sweep/index.d.ts +0 -16
- package/dist/instructions/actions/sweep/index.d.ts.map +0 -1
- package/dist/instructions/actions/transfer/index.d.mts +0 -13
- package/dist/instructions/actions/transfer/index.d.ts +0 -13
- package/dist/instructions/actions/transfer/index.d.ts.map +0 -1
- package/dist/instructions/activate.d.mts +0 -84
- package/dist/instructions/activate.d.ts +0 -84
- package/dist/instructions/activate.d.ts.map +0 -1
- package/dist/instructions/build.d.mts +0 -146
- package/dist/instructions/build.d.ts +0 -146
- package/dist/instructions/build.d.ts.map +0 -1
- package/dist/instructions/constants.d.mts +0 -9
- package/dist/instructions/constants.d.ts +0 -9
- package/dist/instructions/constants.d.ts.map +0 -1
- package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.mts +0 -609
- package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.ts +0 -609
- package/dist/instructions/contracts/artifacts/abi/build-instruction-action-arguments-abi.d.ts.map +0 -1
- package/dist/instructions/types.d.mts +0 -289
- package/dist/instructions/types.d.ts +0 -289
- package/dist/instructions/types.d.ts.map +0 -1
- package/dist/payments/action-names.d.mts +0 -16
- package/dist/payments/action-names.d.ts +0 -16
- package/dist/payments/action-names.d.ts.map +0 -1
- package/dist/payments/actions/index.d.mts +0 -5
- package/dist/payments/actions/index.d.ts +0 -5
- package/dist/payments/actions/index.d.ts.map +0 -1
- package/dist/payments/actions/sweep-cctp.d.mts +0 -15
- package/dist/payments/actions/sweep-cctp.d.ts +0 -15
- package/dist/payments/actions/sweep-cctp.d.ts.map +0 -1
- package/dist/payments/actions/sweep-erc20.d.mts +0 -12
- package/dist/payments/actions/sweep-erc20.d.ts +0 -12
- package/dist/payments/actions/sweep-erc20.d.ts.map +0 -1
- package/dist/payments/actions/sweep-uniswap-v3.d.mts +0 -17
- package/dist/payments/actions/sweep-uniswap-v3.d.ts +0 -17
- package/dist/payments/actions/sweep-uniswap-v3.d.ts.map +0 -1
- package/dist/payments/actions/sweep.d.mts +0 -12
- package/dist/payments/actions/sweep.d.ts +0 -12
- package/dist/payments/actions/sweep.d.ts.map +0 -1
- package/dist/payments/build.d.mts +0 -28
- package/dist/payments/build.d.ts +0 -28
- package/dist/payments/build.d.ts.map +0 -1
- package/dist/payments/chain-token-config-builder.d.mts +0 -10
- package/dist/payments/chain-token-config-builder.d.ts +0 -10
- package/dist/payments/chain-token-config-builder.d.ts.map +0 -1
- package/dist/payments/comprehensive-payment-request.d.mts +0 -26
- package/dist/payments/comprehensive-payment-request.d.ts +0 -26
- package/dist/payments/comprehensive-payment-request.d.ts.map +0 -1
- package/dist/payments/config/cctp.d.mts +0 -14
- package/dist/payments/config/cctp.d.ts +0 -14
- package/dist/payments/config/cctp.d.ts.map +0 -1
- package/dist/payments/config/index.d.mts +0 -3
- package/dist/payments/config/index.d.ts +0 -3
- package/dist/payments/config/index.d.ts.map +0 -1
- package/dist/payments/config/tokens.d.mts +0 -14
- package/dist/payments/config/tokens.d.ts +0 -14
- package/dist/payments/config/tokens.d.ts.map +0 -1
- package/dist/payments/instruction-registry.d.mts +0 -19
- package/dist/payments/instruction-registry.d.ts +0 -19
- package/dist/payments/instruction-registry.d.ts.map +0 -1
- package/dist/payments/payment-metadata-builder.d.mts +0 -56
- package/dist/payments/payment-metadata-builder.d.ts +0 -56
- package/dist/payments/payment-metadata-builder.d.ts.map +0 -1
- package/dist/payments/payment-metadata.d.mts +0 -15
- package/dist/payments/payment-metadata.d.ts +0 -15
- package/dist/payments/payment-metadata.d.ts.map +0 -1
- package/dist/payments/payment-request-token-resolver.d.mts +0 -25
- package/dist/payments/payment-request-token-resolver.d.ts +0 -25
- package/dist/payments/payment-request-token-resolver.d.ts.map +0 -1
- package/dist/payments/types.d.mts +0 -40
- package/dist/payments/types.d.ts +0 -40
- package/dist/payments/types.d.ts.map +0 -1
- package/dist/payments/validation.d.mts +0 -19
- package/dist/payments/validation.d.ts +0 -19
- package/dist/payments/validation.d.ts.map +0 -1
- package/dist/schemas/account.d.mts +0 -9
- package/dist/schemas/account.d.ts +0 -9
- package/dist/schemas/account.d.ts.map +0 -1
- package/dist/schemas/brand.d.mts +0 -7
- package/dist/schemas/brand.d.ts +0 -7
- package/dist/schemas/brand.d.ts.map +0 -1
- package/dist/schemas/contact.d.mts +0 -18
- package/dist/schemas/contact.d.ts +0 -18
- package/dist/schemas/contact.d.ts.map +0 -1
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/instruction.d.mts +0 -248
- package/dist/schemas/instruction.d.ts +0 -248
- package/dist/schemas/instruction.d.ts.map +0 -1
- package/dist/schemas/misc.d.mts +0 -36
- package/dist/schemas/misc.d.ts +0 -36
- package/dist/schemas/misc.d.ts.map +0 -1
- package/dist/schemas/payment.d.mts +0 -64
- package/dist/schemas/payment.d.ts +0 -64
- package/dist/schemas/payment.d.ts.map +0 -1
- package/dist/schemas/token.d.mts +0 -17
- package/dist/schemas/token.d.ts +0 -17
- package/dist/schemas/token.d.ts.map +0 -1
- package/dist/schemas/transaction.d.mts +0 -65
- package/dist/schemas/transaction.d.ts +0 -65
- package/dist/schemas/transaction.d.ts.map +0 -1
- package/dist/schemas/user.d.mts +0 -24
- package/dist/schemas/user.d.ts +0 -24
- package/dist/schemas/user.d.ts.map +0 -1
- package/dist/server/client.d.mts +0 -3
- package/dist/server/client.d.ts +0 -3
- package/dist/server/client.d.ts.map +0 -1
- package/dist/server/routes/account.d.mts +0 -4
- package/dist/server/routes/account.d.ts +0 -4
- package/dist/server/routes/account.d.ts.map +0 -1
- package/dist/server/routes/auth.d.mts +0 -28
- package/dist/server/routes/auth.d.ts +0 -28
- package/dist/server/routes/auth.d.ts.map +0 -1
- package/dist/server/routes/bridge.d.mts +0 -254
- package/dist/server/routes/bridge.d.ts +0 -254
- package/dist/server/routes/bridge.d.ts.map +0 -1
- package/dist/server/routes/config.d.mts +0 -3
- package/dist/server/routes/config.d.ts +0 -3
- package/dist/server/routes/config.d.ts.map +0 -1
- package/dist/server/routes/index.d.mts +0 -8
- package/dist/server/routes/index.d.ts +0 -8
- package/dist/server/routes/index.d.ts.map +0 -1
- package/dist/server/routes/instruction.d.mts +0 -4
- package/dist/server/routes/instruction.d.ts +0 -4
- package/dist/server/routes/instruction.d.ts.map +0 -1
- package/dist/server/routes/integration.d.mts +0 -4
- package/dist/server/routes/integration.d.ts +0 -4
- package/dist/server/routes/integration.d.ts.map +0 -1
- package/dist/server/routes/payments.d.mts +0 -5
- package/dist/server/routes/payments.d.ts +0 -5
- package/dist/server/routes/payments.d.ts.map +0 -1
- package/dist/server/routes/verify.d.mts +0 -3
- package/dist/server/routes/verify.d.ts +0 -3
- package/dist/server/routes/verify.d.ts.map +0 -1
- package/dist/wallet/wagmi/config.d.mts +0 -18
- package/dist/wallet/wagmi/config.d.ts +0 -18
- package/dist/wallet/wagmi/config.d.ts.map +0 -1
package/dist/api/index.mjs
CHANGED
|
@@ -1,2064 +1,1496 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { i as getOffchainApiUrl } from "../api-urls-DJcIKBCy.mjs";
|
|
2
|
+
import { t as _defineProperty } from "../defineProperty-DzhmunJg.mjs";
|
|
3
|
+
import { z as z$1 } from "zod";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { InstructionAction, PaymentsSchema, eip2098SignatureSchema, hexStringSchema, instructionActionValues, instructionSchema, instructionsSchema, numberSchema, sortValues, transactionSchema, userSchema, vrsSchema } from "@otim/utils/schemas";
|
|
6
|
+
import { parseSchema } from "@otim/utils/helpers";
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
//#region src/api/core/error.ts
|
|
9
|
+
const apiErrorSchema = z$1.object({
|
|
10
|
+
code: z$1.string().nullish(),
|
|
11
|
+
message: z$1.string().nullish(),
|
|
12
|
+
errorCode: z$1.string().nullish(),
|
|
13
|
+
errorMessage: z$1.string().nullish(),
|
|
14
|
+
status: z$1.number().nullish(),
|
|
15
|
+
context: z$1.object({ field_errors: z$1.record(z$1.string(), z$1.string()).nullish() }).nullish()
|
|
16
|
+
});
|
|
17
|
+
const errorResponseSchema = z$1.object({
|
|
18
|
+
message: z$1.string().nullish(),
|
|
19
|
+
errorMessage: z$1.string().nullish(),
|
|
20
|
+
errorCode: z$1.string().nullish(),
|
|
21
|
+
errors: z$1.array(apiErrorSchema).nullish()
|
|
22
|
+
});
|
|
23
|
+
const defaultErrorCode = "unknown";
|
|
24
|
+
const defaultErrorMessage = "Unexpected error";
|
|
25
|
+
/**
|
|
26
|
+
* Extract the most likely server-provided error payload from a thrown value.
|
|
27
|
+
* Supports common shapes from HTTP clients (Axios/fetch) and plain objects.
|
|
28
|
+
*/
|
|
25
29
|
function extractErrorData(maybeError) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!errorData && (maybeError?.errorMessage || maybeError?.message || maybeError?.errorCode)) {
|
|
31
|
-
errorData = maybeError;
|
|
32
|
-
}
|
|
33
|
-
return errorData;
|
|
30
|
+
let errorData = maybeError?.body;
|
|
31
|
+
if (!errorData && maybeError?.response?.data) errorData = maybeError.response.data;
|
|
32
|
+
if (!errorData && (maybeError?.errorMessage || maybeError?.message || maybeError?.errorCode)) errorData = maybeError;
|
|
33
|
+
return errorData;
|
|
34
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Normalize Error Shapes Into One User‑Facing Message.
|
|
37
|
+
* Why: Prefer server messages and avoid leaking technical details.
|
|
38
|
+
*
|
|
39
|
+
* @param maybeError An unknown error thrown by an HTTP client, SDK, or server.
|
|
40
|
+
* @param fallbackMessage Message used when the payload cannot be parsed or
|
|
41
|
+
* lacks a message.
|
|
42
|
+
*/
|
|
35
43
|
function getErrorMessage(maybeError, fallbackMessage) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
const errorMessage = fallbackMessage ?? defaultErrorMessage;
|
|
45
|
+
const errorData = extractErrorData(maybeError);
|
|
46
|
+
const result = errorResponseSchema.safeParse(errorData);
|
|
47
|
+
if (!result.success) return errorMessage;
|
|
48
|
+
const { message, errorMessage: apiErrorMessage, errors } = result.data;
|
|
49
|
+
/**
|
|
50
|
+
* Prioritize Error Message From Backend, Then Message, Then Errors Array.
|
|
51
|
+
* Surfaces the most specific, server‑intended feedback first for better UX.
|
|
52
|
+
*/
|
|
53
|
+
return apiErrorMessage ?? message ?? errors?.[0]?.errorMessage ?? errors?.[0]?.message ?? errorMessage;
|
|
44
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Provide A Unified Error Message And Code For UI/Control‑Flow.
|
|
57
|
+
* Why: Normalize shapes and fall back to an "unknown" code.
|
|
58
|
+
*
|
|
59
|
+
* @param maybeError An unknown error thrown by an HTTP client, SDK, or server.
|
|
60
|
+
* @param fallbackMessage Message used when the payload cannot be parsed or is
|
|
61
|
+
* empty.
|
|
62
|
+
*/
|
|
45
63
|
function getErrorMessageWithCode(maybeError, fallbackMessage) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
errorCode,
|
|
59
|
-
errors
|
|
60
|
-
} = result.data;
|
|
61
|
-
return {
|
|
62
|
-
message: apiErrorMessage ?? message ?? errors?.[0]?.errorMessage ?? errors?.[0]?.message ?? errorMessage,
|
|
63
|
-
code: errorCode ?? errors?.[0]?.errorCode ?? errors?.[0]?.code ?? defaultErrorCode
|
|
64
|
-
};
|
|
64
|
+
const errorMessage = fallbackMessage ?? defaultErrorMessage;
|
|
65
|
+
const errorData = extractErrorData(maybeError);
|
|
66
|
+
const result = errorResponseSchema.safeParse(errorData);
|
|
67
|
+
if (!result.success || !result.data.errors?.[0] && !result.data.errorMessage && !result.data.message) return {
|
|
68
|
+
message: errorMessage,
|
|
69
|
+
code: defaultErrorCode
|
|
70
|
+
};
|
|
71
|
+
const { message, errorMessage: apiErrorMessage, errorCode, errors } = result.data;
|
|
72
|
+
return {
|
|
73
|
+
message: apiErrorMessage ?? message ?? errors?.[0]?.errorMessage ?? errors?.[0]?.message ?? errorMessage,
|
|
74
|
+
code: errorCode ?? errors?.[0]?.errorCode ?? errors?.[0]?.code ?? defaultErrorCode
|
|
75
|
+
};
|
|
65
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Detect User Rejection (e.g., Canceled Wallet Signature).
|
|
79
|
+
* Why: Treat cancellations as benign and keep telemetry clean.
|
|
80
|
+
*
|
|
81
|
+
* @param error The error object to check.
|
|
82
|
+
* @returns true if the error is a user rejection, false otherwise.
|
|
83
|
+
*/
|
|
66
84
|
function isUserRejectionError(error) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
];
|
|
89
|
-
return rejectionPatterns.some((pattern) => errorMessage.includes(pattern));
|
|
85
|
+
if (!error) return false;
|
|
86
|
+
/**
|
|
87
|
+
* Safely Extract Error Message From Various Possible Error Formats.
|
|
88
|
+
* Providers may throw strings, plain objects, or non-Error values.
|
|
89
|
+
*/
|
|
90
|
+
let errorMessage = "";
|
|
91
|
+
if (typeof error === "string") errorMessage = error;
|
|
92
|
+
else if (typeof error === "object") errorMessage = error.message || error.errorMessage || error.details || "";
|
|
93
|
+
if (!errorMessage) errorMessage = String(error);
|
|
94
|
+
errorMessage = errorMessage.toLowerCase();
|
|
95
|
+
return [
|
|
96
|
+
"user rejected",
|
|
97
|
+
"user denied",
|
|
98
|
+
"user cancelled",
|
|
99
|
+
"cancelled by user",
|
|
100
|
+
"rejected by user",
|
|
101
|
+
"user abort",
|
|
102
|
+
"transaction rejected",
|
|
103
|
+
"signature rejected",
|
|
104
|
+
"request rejected"
|
|
105
|
+
].some((pattern) => errorMessage.includes(pattern));
|
|
90
106
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Determine If An Error Code Is User‑Addressable.
|
|
109
|
+
* Why: 1000–1999 are intended to be surfaced to users.
|
|
110
|
+
*
|
|
111
|
+
* @param errorCode The error code to check.
|
|
112
|
+
* @param errorMessage Optional error message.
|
|
113
|
+
*/
|
|
114
|
+
const isUserAddressableError = (errorCode, errorMessage) => {
|
|
115
|
+
return errorCode >= 1e3 && errorCode < 2e3 && Boolean(errorMessage);
|
|
95
116
|
};
|
|
117
|
+
/**
|
|
118
|
+
* Detect Whether An Error Looks Technical/Low‑Level.
|
|
119
|
+
* Why: Avoid leaking framework/runtime details to users; rely on logging.
|
|
120
|
+
*/
|
|
96
121
|
function isTechnicalError(error) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return technicalErrorPatterns.some(
|
|
127
|
-
(pattern) => errorMessage.includes(pattern)
|
|
128
|
-
);
|
|
122
|
+
if (!error) return false;
|
|
123
|
+
/**
|
|
124
|
+
* Safely Extract Error Message From Various Possible Error Formats.
|
|
125
|
+
* Upstream code can throw strings or custom objects instead of Error
|
|
126
|
+
* instances.
|
|
127
|
+
*/
|
|
128
|
+
let errorMessage = "";
|
|
129
|
+
if (typeof error === "string") errorMessage = error;
|
|
130
|
+
else if (typeof error === "object") errorMessage = error.message || error.errorMessage || error.details || "";
|
|
131
|
+
if (!errorMessage) errorMessage = String(error);
|
|
132
|
+
errorMessage = errorMessage.toLowerCase();
|
|
133
|
+
return [
|
|
134
|
+
"is not a function",
|
|
135
|
+
"cannot read prop",
|
|
136
|
+
"cannot read property",
|
|
137
|
+
"reading undefined",
|
|
138
|
+
"read undefined of",
|
|
139
|
+
"cannot access before initialization",
|
|
140
|
+
"is not defined",
|
|
141
|
+
"is undefined",
|
|
142
|
+
"is null",
|
|
143
|
+
"unexpected token",
|
|
144
|
+
"syntax error",
|
|
145
|
+
"reference error",
|
|
146
|
+
"type error",
|
|
147
|
+
"network error",
|
|
148
|
+
"failed to fetch",
|
|
149
|
+
"server components"
|
|
150
|
+
].some((pattern) => errorMessage.includes(pattern));
|
|
129
151
|
}
|
|
130
152
|
function getUserFriendlyErrorMessage(error, fallbackMessage) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
return getErrorMessage(error, fallbackMessage);
|
|
153
|
+
if (isTechnicalError(error)) return "Internal server error";
|
|
154
|
+
return getErrorMessage(error, fallbackMessage);
|
|
135
155
|
}
|
|
136
156
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return instance;
|
|
157
|
+
//#endregion
|
|
158
|
+
//#region src/api/core/instance.ts
|
|
159
|
+
const API_INSTANCE_DEFAULT_TIMEOUT = 3e4;
|
|
160
|
+
const createInstance = (config) => {
|
|
161
|
+
return axios.create({
|
|
162
|
+
timeout: API_INSTANCE_DEFAULT_TIMEOUT,
|
|
163
|
+
...config
|
|
164
|
+
});
|
|
146
165
|
};
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
const createAbortController = () => {
|
|
167
|
+
return new AbortController();
|
|
149
168
|
};
|
|
150
|
-
|
|
151
|
-
|
|
169
|
+
const isInstanceInit = (init) => {
|
|
170
|
+
return !!init && typeof init === "object" && "instance" in init;
|
|
152
171
|
};
|
|
153
172
|
|
|
154
|
-
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/api/core/service.ts
|
|
155
175
|
var ServiceError = class extends Error {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
176
|
+
constructor(message, code) {
|
|
177
|
+
super(message);
|
|
178
|
+
this.code = code;
|
|
179
|
+
this.name = "ServiceError";
|
|
180
|
+
}
|
|
161
181
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
// src/api/schemas/account.ts
|
|
170
|
-
import { z as z2 } from "zod";
|
|
171
|
-
var DelegationStatus = {
|
|
172
|
-
Undelegated: "Undelegated",
|
|
173
|
-
Pending: "Pending",
|
|
174
|
-
Delegated: "Delegated",
|
|
175
|
-
Expired: "Expired",
|
|
176
|
-
Errored: "Errored"
|
|
182
|
+
const HttpMethod = {
|
|
183
|
+
Get: "GET",
|
|
184
|
+
Post: "POST",
|
|
185
|
+
Put: "PUT",
|
|
186
|
+
Delete: "DELETE"
|
|
177
187
|
};
|
|
178
|
-
var delegationStatusValues = Object.values(DelegationStatus);
|
|
179
|
-
var delegationStatusSchema = z2.enum(delegationStatusValues);
|
|
180
|
-
var delegationStatusRequestSchema = z2.object({
|
|
181
|
-
address: z2.string(),
|
|
182
|
-
chainId: z2.number()
|
|
183
|
-
});
|
|
184
|
-
var delegationStatusResponseSchema = z2.object({
|
|
185
|
-
delegationStatus: delegationStatusSchema
|
|
186
|
-
});
|
|
187
|
-
var delegationCreateRequestSchema = z2.object({
|
|
188
|
-
signedAuthorization: z2.string(),
|
|
189
|
-
signerAddress: z2.string()
|
|
190
|
-
});
|
|
191
|
-
var delegationCreateResponseSchema = z2.object({
|
|
192
|
-
success: z2.boolean(),
|
|
193
|
-
transactionHash: z2.string().optional(),
|
|
194
|
-
message: z2.string().optional()
|
|
195
|
-
});
|
|
196
188
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
var DATE_REGEX = /^(19|20)\d{2}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/;
|
|
206
|
-
var DATE_ISO_8601_REGEX = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
|
|
207
|
-
var DATE_STANDARD_REGEX = /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(19|20)\d{2}$/;
|
|
208
|
-
var TIME_REGEX = /^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (AM|PM)$/;
|
|
209
|
-
var regexSchema = (regex, message) => z3.string().regex(regex, message);
|
|
210
|
-
var nonEmptyStringSchema = z3.string().min(1);
|
|
211
|
-
var numberSchema = z3.union([
|
|
212
|
-
z3.number().finite(),
|
|
213
|
-
z3.string().regex(/^-?\d*\.?\d+(?:[eE][-+]?\d+)?$/).transform(Number)
|
|
214
|
-
]);
|
|
215
|
-
var decimalStringSchema = z3.string().regex(/^-?\d*\.?\d+$/).refine((val) => !isNaN(parseFloat(val)), {
|
|
216
|
-
message: "Must be a valid decimal number"
|
|
217
|
-
});
|
|
218
|
-
var bigintSchema = z3.union([
|
|
219
|
-
z3.bigint(),
|
|
220
|
-
z3.string().regex(/^-?\d+$/).transform(BigInt)
|
|
221
|
-
]);
|
|
222
|
-
var hexStringSchema = z3.string().startsWith("0x").transform((val) => val);
|
|
223
|
-
var dateSchema = regexSchema(DATE_REGEX);
|
|
224
|
-
var dateISO8601Schema = regexSchema(DATE_ISO_8601_REGEX);
|
|
225
|
-
var dateStandardSchema = regexSchema(DATE_STANDARD_REGEX);
|
|
226
|
-
var timeSchema = regexSchema(TIME_REGEX);
|
|
227
|
-
var Sort = {
|
|
228
|
-
Asc: "asc",
|
|
229
|
-
Desc: "desc"
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/api/schemas/account.ts
|
|
191
|
+
const DelegationStatus = {
|
|
192
|
+
Undelegated: "Undelegated",
|
|
193
|
+
Pending: "Pending",
|
|
194
|
+
Delegated: "Delegated",
|
|
195
|
+
Expired: "Expired",
|
|
196
|
+
Errored: "Errored"
|
|
230
197
|
};
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
198
|
+
const delegationStatusValues = Object.values(DelegationStatus);
|
|
199
|
+
const delegationStatusSchema = z$1.enum(delegationStatusValues);
|
|
200
|
+
const delegationStatusRequestSchema = z$1.object({
|
|
201
|
+
address: z$1.string(),
|
|
202
|
+
chainId: z$1.number()
|
|
203
|
+
});
|
|
204
|
+
const delegationStatusResponseSchema = z$1.object({ delegationStatus: delegationStatusSchema });
|
|
205
|
+
const delegationCreateRequestSchema = z$1.object({
|
|
206
|
+
signedAuthorization: z$1.string(),
|
|
207
|
+
signerAddress: z$1.string()
|
|
208
|
+
});
|
|
209
|
+
const delegationCreateResponseSchema = z$1.object({
|
|
210
|
+
success: z$1.boolean(),
|
|
211
|
+
transactionHash: z$1.string().optional(),
|
|
212
|
+
message: z$1.string().optional()
|
|
241
213
|
});
|
|
242
214
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
215
|
+
//#endregion
|
|
216
|
+
//#region src/api/schemas/activity.ts
|
|
217
|
+
const actionNameSchema = z$1.enum(instructionActionValues);
|
|
218
|
+
/**
|
|
219
|
+
* Human-readable labels for automation action names.
|
|
220
|
+
*/
|
|
221
|
+
const ACTION_NAME_LABELS = {
|
|
222
|
+
[InstructionAction.Refuel]: "Refuel",
|
|
223
|
+
[InstructionAction.RefuelERC20]: "Refuel",
|
|
224
|
+
[InstructionAction.Transfer]: "Transfer",
|
|
225
|
+
[InstructionAction.TransferERC20]: "Transfer",
|
|
226
|
+
[InstructionAction.TransferCCTP]: "Transfer",
|
|
227
|
+
[InstructionAction.Sweep]: "Sweep",
|
|
228
|
+
[InstructionAction.SweepERC20]: "Sweep",
|
|
229
|
+
[InstructionAction.SweepCCTP]: "Sweep",
|
|
230
|
+
[InstructionAction.SweepUniswapV3]: "Trade",
|
|
231
|
+
[InstructionAction.UniswapV3ExactInput]: "Trade",
|
|
232
|
+
[InstructionAction.DepositERC4626]: "Deposit",
|
|
233
|
+
[InstructionAction.SweepDepositERC4626]: "Deposit",
|
|
234
|
+
[InstructionAction.WithdrawERC4626]: "Withdraw",
|
|
235
|
+
[InstructionAction.SweepWithdrawERC4626]: "Withdraw",
|
|
236
|
+
[InstructionAction.DeactivateInstruction]: "Deactivate",
|
|
237
|
+
[InstructionAction.CallOnce]: "Call Once"
|
|
255
238
|
};
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
SweepCCTP: "sweepCCTP",
|
|
267
|
-
SweepUniswapV3: "sweepUniswapV3",
|
|
268
|
-
SweepDepositAccount: "sweepDepositAccount",
|
|
269
|
-
SweepDepositAccountERC20: "sweepDepositAccountERC20",
|
|
270
|
-
DeactivateInstruction: "deactivateInstruction",
|
|
271
|
-
SweepSkipCCTPDepositAccount: "sweepSkipCCTPDepositAccount"
|
|
239
|
+
const DEFAULT_ACTION_LABEL = "–";
|
|
240
|
+
/**
|
|
241
|
+
* Human-readable labels for payment rails.
|
|
242
|
+
*/
|
|
243
|
+
const PAYMENT_RAIL_LABELS = {
|
|
244
|
+
ach_push: "ACH",
|
|
245
|
+
pix: "PIX",
|
|
246
|
+
sepa: "SEPA",
|
|
247
|
+
spei: "SPEI",
|
|
248
|
+
wire: "Wire"
|
|
272
249
|
};
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
type: z4.enum(instructionScheduleStartValues)
|
|
284
|
-
});
|
|
285
|
-
var nowStartSchema = baseStartSchema.extend({
|
|
286
|
-
type: z4.literal(InstructionScheduleStartType.Now)
|
|
287
|
-
});
|
|
288
|
-
var dateTimeStartSchema = baseStartSchema.extend({
|
|
289
|
-
type: z4.literal(InstructionScheduleStartType.DateTime),
|
|
290
|
-
startDate: dateStandardSchema,
|
|
291
|
-
startTime: z4.string()
|
|
292
|
-
});
|
|
293
|
-
var instructionScheduleStartSchema = z4.discriminatedUnion("type", [
|
|
294
|
-
nowStartSchema,
|
|
295
|
-
dateTimeStartSchema
|
|
296
|
-
]);
|
|
297
|
-
var InstructionScheduleRepeatType = {
|
|
298
|
-
UntilDeactivated: "until-deactivated",
|
|
299
|
-
MaxExecutions: "max-executions"
|
|
250
|
+
/**
|
|
251
|
+
* Human-readable labels for virtual account event types.
|
|
252
|
+
*/
|
|
253
|
+
const VIRTUAL_ACCOUNT_EVENT_LABELS = {
|
|
254
|
+
funds_received: "Funds Received",
|
|
255
|
+
payment_submitted: "Payment Submitted",
|
|
256
|
+
payment_processed: "Payment Processed",
|
|
257
|
+
in_review: "In Review",
|
|
258
|
+
microdeposit: "Microdeposit",
|
|
259
|
+
funds_scheduled: "Funds Scheduled"
|
|
300
260
|
};
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
chain: z4.string().optional()
|
|
369
|
-
});
|
|
370
|
-
var instructionsSchema = z4.array(instructionSchema);
|
|
371
|
-
var instructionSummarySchema = z4.object({
|
|
372
|
-
instructionId: hexStringSchema,
|
|
373
|
-
chainId: z4.number().int(),
|
|
374
|
-
executionCount: z4.number().int(),
|
|
375
|
-
onTimeCount: z4.number().int(),
|
|
376
|
-
lateCount: z4.number().int(),
|
|
377
|
-
wasActivatedDuring: z4.boolean(),
|
|
378
|
-
amount: z4.number().default(0),
|
|
379
|
-
instructedValue: z4.string().nullish().default("0"),
|
|
380
|
-
instructedTokenAddress: z4.string().nullish().default(null)
|
|
381
|
-
});
|
|
382
|
-
var instructionSummariesSchema = z4.array(instructionSummarySchema);
|
|
383
|
-
var instructionSummariesByDateSchema = z4.record(
|
|
384
|
-
z4.string(),
|
|
385
|
-
instructionSummariesSchema
|
|
386
|
-
);
|
|
387
|
-
var InstructionViewTimescale = {
|
|
388
|
-
Days: "days",
|
|
389
|
-
Hours: "hours",
|
|
390
|
-
Minutes: "minutes",
|
|
391
|
-
Seconds: "seconds"
|
|
392
|
-
};
|
|
393
|
-
var instructionViewTimescaleValues = Object.values(
|
|
394
|
-
InstructionViewTimescale
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
// src/schemas/payment.ts
|
|
398
|
-
import { z as z5 } from "zod";
|
|
399
|
-
var PaymentStatus = {
|
|
400
|
-
Due: "due",
|
|
401
|
-
NotDue: "not-due",
|
|
402
|
-
Paid: "paid"
|
|
403
|
-
};
|
|
404
|
-
var PaymentSource = {
|
|
405
|
-
Bill: "Bill",
|
|
406
|
-
Stripe: "Stripe",
|
|
407
|
-
Clio: "Clio",
|
|
408
|
-
QuickBooks: "QuickBooks"
|
|
409
|
-
};
|
|
410
|
-
var paymentRequestSourceValues = [
|
|
411
|
-
PaymentSource.Bill,
|
|
412
|
-
PaymentSource.Stripe,
|
|
413
|
-
PaymentSource.Clio,
|
|
414
|
-
PaymentSource.QuickBooks
|
|
415
|
-
];
|
|
416
|
-
var paymentSchema = z5.object({
|
|
417
|
-
id: z5.string(),
|
|
418
|
-
fromUserId: z5.string().nullable().optional(),
|
|
419
|
-
toUserId: z5.string().nullable().optional(),
|
|
420
|
-
payerAddress: z5.string().nullable().optional(),
|
|
421
|
-
ephemeralWalletAddress: z5.string(),
|
|
422
|
-
ephemeralWalletId: z5.string().optional(),
|
|
423
|
-
instructions: z5.object({
|
|
424
|
-
ids: z5.array(z5.string()),
|
|
425
|
-
completionIds: z5.array(z5.string())
|
|
426
|
-
}).optional(),
|
|
427
|
-
metadata: z5.record(z5.string(), z5.unknown()).optional(),
|
|
428
|
-
// UI-derived fields
|
|
429
|
-
status: z5.union([
|
|
430
|
-
z5.literal(PaymentStatus.Due),
|
|
431
|
-
z5.literal(PaymentStatus.NotDue),
|
|
432
|
-
z5.literal(PaymentStatus.Paid)
|
|
433
|
-
]),
|
|
434
|
-
dueDate: z5.string(),
|
|
435
|
-
amountDue: z5.number(),
|
|
436
|
-
note: z5.string().nullable().optional(),
|
|
437
|
-
address: z5.string().nullable().optional(),
|
|
438
|
-
addedOn: z5.string(),
|
|
439
|
-
source: z5.union([
|
|
440
|
-
z5.literal(PaymentSource.Bill),
|
|
441
|
-
z5.literal(PaymentSource.Stripe),
|
|
442
|
-
z5.literal(PaymentSource.Clio),
|
|
443
|
-
z5.literal(PaymentSource.QuickBooks)
|
|
444
|
-
]).nullish(),
|
|
445
|
-
attachmentUrl: z5.string().url().nullable().optional(),
|
|
446
|
-
attachmentName: z5.string().nullable().optional(),
|
|
447
|
-
fromAccountAddress: z5.string().nullable().optional()
|
|
448
|
-
});
|
|
449
|
-
var PaymentsSchema = z5.array(paymentSchema);
|
|
450
|
-
|
|
451
|
-
// src/schemas/transaction.ts
|
|
452
|
-
import { z as z6 } from "zod";
|
|
453
|
-
var transactionSchema = z6.object({
|
|
454
|
-
instructionId: instructionIdSchema,
|
|
455
|
-
transactionHash: hexStringSchema.optional(),
|
|
456
|
-
blockHash: z6.string().nullable(),
|
|
457
|
-
transactionStatus: z6.string(),
|
|
458
|
-
error: z6.string().nullish(),
|
|
459
|
-
startedAt: z6.string(),
|
|
460
|
-
startedAtBlock: z6.number(),
|
|
461
|
-
finishedAt: z6.string().nullable(),
|
|
462
|
-
finishedAtBlock: z6.number().nullable(),
|
|
463
|
-
amount: z6.object({ value: z6.number(), token: z6.string() }).nullish(),
|
|
464
|
-
instructedValue: z6.string(),
|
|
465
|
-
instructedTokenAddress: z6.string().nullable(),
|
|
466
|
-
executionNum: z6.number(),
|
|
467
|
-
chainId: z6.number().nullish(),
|
|
468
|
-
chain: z6.string().optional()
|
|
469
|
-
});
|
|
470
|
-
var transactionWithValidAmountSchema = transactionSchema.extend({
|
|
471
|
-
amount: z6.object({
|
|
472
|
-
value: z6.number(),
|
|
473
|
-
token: z6.string()
|
|
474
|
-
})
|
|
475
|
-
});
|
|
476
|
-
var transactionsSchema = z6.array(transactionSchema);
|
|
477
|
-
|
|
478
|
-
// src/schemas/user.ts
|
|
479
|
-
import { z as z7 } from "zod";
|
|
480
|
-
var entityIdSchema = z7.string().uuid();
|
|
481
|
-
var addressSchema = z7.string().regex(/^0x[a-fA-F0-9]{40}$/).transform((v) => v.toLowerCase());
|
|
482
|
-
var userPreferencesSchema = z7.object({
|
|
483
|
-
chainId: z7.number().optional(),
|
|
484
|
-
tokenSymbol: z7.string().optional(),
|
|
485
|
-
localCurrency: z7.string().optional()
|
|
486
|
-
});
|
|
487
|
-
var userSchema = z7.object({
|
|
488
|
-
id: entityIdSchema,
|
|
489
|
-
address: addressSchema,
|
|
490
|
-
createdAt: z7.string(),
|
|
491
|
-
updatedAt: z7.string(),
|
|
492
|
-
preferences: userPreferencesSchema.optional(),
|
|
493
|
-
isDeveloper: z7.boolean(),
|
|
494
|
-
developerPublicKey: z7.string().nullable().optional()
|
|
495
|
-
});
|
|
496
|
-
|
|
497
|
-
// src/api/schemas/activity.ts
|
|
498
|
-
var actionNameSchema = z8.enum([
|
|
499
|
-
"refuel",
|
|
500
|
-
"transfer",
|
|
501
|
-
"refuelERC20",
|
|
502
|
-
"transferERC20",
|
|
503
|
-
"uniswapV3ExactInput",
|
|
504
|
-
"deactivateInstruction",
|
|
505
|
-
"sweepCCTP",
|
|
506
|
-
"transferCCTP",
|
|
507
|
-
"sweep",
|
|
508
|
-
"sweepERC20",
|
|
509
|
-
"sweepUniswapV3",
|
|
510
|
-
"depositERC4626",
|
|
511
|
-
"sweepDepositERC4626",
|
|
512
|
-
"withdrawERC4626",
|
|
513
|
-
"sweepWithdrawERC4626",
|
|
514
|
-
"callOnce"
|
|
515
|
-
]);
|
|
516
|
-
var transferFieldsSchema = z8.object({
|
|
517
|
-
token: hexStringSchema,
|
|
518
|
-
from: hexStringSchema,
|
|
519
|
-
to: hexStringSchema,
|
|
520
|
-
value: hexStringSchema
|
|
521
|
-
});
|
|
522
|
-
var swapFieldsSchema = z8.object({
|
|
523
|
-
poolAddress: hexStringSchema,
|
|
524
|
-
fromToken: hexStringSchema,
|
|
525
|
-
toToken: hexStringSchema,
|
|
526
|
-
from: hexStringSchema,
|
|
527
|
-
to: hexStringSchema,
|
|
528
|
-
fromAmount: hexStringSchema,
|
|
529
|
-
toAmount: hexStringSchema
|
|
530
|
-
});
|
|
531
|
-
var cctpBurnFieldsSchema = z8.object({
|
|
532
|
-
token: hexStringSchema,
|
|
533
|
-
from: hexStringSchema,
|
|
534
|
-
mintRecipient: hexStringSchema,
|
|
535
|
-
destinationDomain: hexStringSchema,
|
|
536
|
-
value: hexStringSchema
|
|
537
|
-
});
|
|
538
|
-
var erc4626DepositFieldsSchema = z8.object({
|
|
539
|
-
vault: hexStringSchema,
|
|
540
|
-
token: hexStringSchema,
|
|
541
|
-
from: hexStringSchema,
|
|
542
|
-
owner: hexStringSchema,
|
|
543
|
-
value: hexStringSchema,
|
|
544
|
-
shares: hexStringSchema
|
|
545
|
-
});
|
|
546
|
-
var erc4626WithdrawFieldsSchema = z8.object({
|
|
547
|
-
vault: hexStringSchema,
|
|
548
|
-
token: hexStringSchema,
|
|
549
|
-
from: hexStringSchema,
|
|
550
|
-
to: hexStringSchema,
|
|
551
|
-
value: hexStringSchema,
|
|
552
|
-
shares: hexStringSchema
|
|
553
|
-
});
|
|
554
|
-
var activityDataSchema = z8.union([
|
|
555
|
-
z8.object({ transfer: transferFieldsSchema }),
|
|
556
|
-
z8.object({ swap: swapFieldsSchema }),
|
|
557
|
-
z8.object({ cctpBurn: cctpBurnFieldsSchema }),
|
|
558
|
-
z8.object({ erc4626Deposit: erc4626DepositFieldsSchema }),
|
|
559
|
-
z8.object({ erc4626Withdraw: erc4626WithdrawFieldsSchema })
|
|
261
|
+
/**
|
|
262
|
+
* Formats a payment rail value to a human-readable label.
|
|
263
|
+
*/
|
|
264
|
+
function formatPaymentRail(paymentRail) {
|
|
265
|
+
if (!paymentRail) return DEFAULT_ACTION_LABEL;
|
|
266
|
+
const label = PAYMENT_RAIL_LABELS[paymentRail.toLowerCase()];
|
|
267
|
+
if (label) return label;
|
|
268
|
+
return paymentRail.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Formats an action name to a human-readable label.
|
|
272
|
+
*/
|
|
273
|
+
function formatActionName(actionName, source) {
|
|
274
|
+
if (!actionName) return DEFAULT_ACTION_LABEL;
|
|
275
|
+
if (actionName.startsWith("virtual_account_")) {
|
|
276
|
+
if (source?.payment_rail) return formatPaymentRail(source.payment_rail);
|
|
277
|
+
const eventType = actionName.replace("virtual_account_", "");
|
|
278
|
+
const label = VIRTUAL_ACCOUNT_EVENT_LABELS[eventType];
|
|
279
|
+
if (label) return label;
|
|
280
|
+
return eventType.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
281
|
+
}
|
|
282
|
+
return ACTION_NAME_LABELS[actionName] ?? DEFAULT_ACTION_LABEL;
|
|
283
|
+
}
|
|
284
|
+
const transferFieldsSchema = z$1.object({
|
|
285
|
+
token: hexStringSchema,
|
|
286
|
+
from: hexStringSchema,
|
|
287
|
+
to: hexStringSchema,
|
|
288
|
+
value: hexStringSchema
|
|
289
|
+
});
|
|
290
|
+
const swapFieldsSchema = z$1.object({
|
|
291
|
+
poolAddress: hexStringSchema,
|
|
292
|
+
fromToken: hexStringSchema,
|
|
293
|
+
toToken: hexStringSchema,
|
|
294
|
+
from: hexStringSchema,
|
|
295
|
+
to: hexStringSchema,
|
|
296
|
+
fromAmount: hexStringSchema,
|
|
297
|
+
toAmount: hexStringSchema
|
|
298
|
+
});
|
|
299
|
+
const cctpBurnFieldsSchema = z$1.object({
|
|
300
|
+
token: hexStringSchema,
|
|
301
|
+
from: hexStringSchema,
|
|
302
|
+
mintRecipient: hexStringSchema,
|
|
303
|
+
destinationDomain: hexStringSchema,
|
|
304
|
+
value: hexStringSchema
|
|
305
|
+
});
|
|
306
|
+
const erc4626DepositFieldsSchema = z$1.object({
|
|
307
|
+
vault: hexStringSchema,
|
|
308
|
+
token: hexStringSchema,
|
|
309
|
+
from: hexStringSchema,
|
|
310
|
+
owner: hexStringSchema,
|
|
311
|
+
value: hexStringSchema,
|
|
312
|
+
shares: hexStringSchema
|
|
313
|
+
});
|
|
314
|
+
const erc4626WithdrawFieldsSchema = z$1.object({
|
|
315
|
+
vault: hexStringSchema,
|
|
316
|
+
token: hexStringSchema,
|
|
317
|
+
from: hexStringSchema,
|
|
318
|
+
to: hexStringSchema,
|
|
319
|
+
value: hexStringSchema,
|
|
320
|
+
shares: hexStringSchema
|
|
321
|
+
});
|
|
322
|
+
const activityDataSchema = z$1.union([
|
|
323
|
+
z$1.object({ transfer: transferFieldsSchema }),
|
|
324
|
+
z$1.object({ swap: swapFieldsSchema }),
|
|
325
|
+
z$1.object({ cctpBurn: cctpBurnFieldsSchema }),
|
|
326
|
+
z$1.object({ erc4626Deposit: erc4626DepositFieldsSchema }),
|
|
327
|
+
z$1.object({ erc4626Withdraw: erc4626WithdrawFieldsSchema })
|
|
560
328
|
]);
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
});
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
});
|
|
575
|
-
|
|
329
|
+
const activityRecordSchema = z$1.object({
|
|
330
|
+
actionName: actionNameSchema,
|
|
331
|
+
blockTimestamp: numberSchema,
|
|
332
|
+
transactionHash: hexStringSchema,
|
|
333
|
+
activity: activityDataSchema,
|
|
334
|
+
instructionId: hexStringSchema.nullable(),
|
|
335
|
+
executionCount: z$1.number().nullable()
|
|
336
|
+
});
|
|
337
|
+
const getInstructionActivityRequestSchema = z$1.object({
|
|
338
|
+
chainId: z$1.number(),
|
|
339
|
+
actionNames: z$1.array(actionNameSchema),
|
|
340
|
+
page: numberSchema.optional(),
|
|
341
|
+
perPage: numberSchema.optional()
|
|
342
|
+
});
|
|
343
|
+
const getInstructionActivityResponseSchema = z$1.array(activityRecordSchema);
|
|
576
344
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
});
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
});
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
isAllowed: z9.boolean(),
|
|
634
|
-
message: z9.string().optional()
|
|
635
|
-
});
|
|
636
|
-
var getCurrentUserResponseSchema = z9.object({
|
|
637
|
-
data: userSchema
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/api/schemas/auth.ts
|
|
347
|
+
const authLoginRequestSchema = z$1.object({
|
|
348
|
+
siwe: z$1.string(),
|
|
349
|
+
signature: vrsSchema
|
|
350
|
+
});
|
|
351
|
+
const authLoginResponseSchema = z$1.object({
|
|
352
|
+
authorization: z$1.string(),
|
|
353
|
+
user: userSchema
|
|
354
|
+
});
|
|
355
|
+
const turnkeyVerificationRequestSchema = z$1.object({ email: z$1.string().email() });
|
|
356
|
+
const turnkeyVerificationResponseSchema = z$1.object({
|
|
357
|
+
isLogin: z$1.boolean(),
|
|
358
|
+
codeAlreadyExists: z$1.boolean().optional()
|
|
359
|
+
});
|
|
360
|
+
const attestationSchema = z$1.object({
|
|
361
|
+
credentialId: z$1.string(),
|
|
362
|
+
clientDataJson: z$1.string(),
|
|
363
|
+
attestationObject: z$1.string(),
|
|
364
|
+
transports: z$1.array(z$1.string()).optional()
|
|
365
|
+
});
|
|
366
|
+
const turnkeyLoginRequestSchema = z$1.object({
|
|
367
|
+
email: z$1.email(),
|
|
368
|
+
verificationCode: z$1.coerce.number().int().min(1e5).max(999999),
|
|
369
|
+
passkeyChallenge: z$1.string().optional(),
|
|
370
|
+
attestation: attestationSchema.optional()
|
|
371
|
+
});
|
|
372
|
+
const turnkeyLoginResponseSchema = z$1.object({
|
|
373
|
+
email: z$1.string(),
|
|
374
|
+
subOrgId: z$1.string(),
|
|
375
|
+
walletAddress: z$1.string(),
|
|
376
|
+
isLogin: z$1.boolean().optional()
|
|
377
|
+
});
|
|
378
|
+
const meResponseSchema = userSchema;
|
|
379
|
+
const sessionTokenRequestSchema = z$1.object({
|
|
380
|
+
sessionToken: z$1.string(),
|
|
381
|
+
userId: z$1.string()
|
|
382
|
+
});
|
|
383
|
+
const sessionTokenResponseSchema = z$1.object({ success: z$1.boolean() });
|
|
384
|
+
const sessionVerifyResponseSchema = z$1.object({
|
|
385
|
+
authenticated: z$1.boolean(),
|
|
386
|
+
hasSessionToken: z$1.boolean()
|
|
387
|
+
});
|
|
388
|
+
/**
|
|
389
|
+
* @todo
|
|
390
|
+
* - Remove later, this is a temporary schema for the whitelist check
|
|
391
|
+
*/
|
|
392
|
+
const whitelistCheckRequestSchema = z$1.object({ email: z$1.string().email() });
|
|
393
|
+
const whitelistCheckResponseSchema = z$1.object({
|
|
394
|
+
isAllowed: z$1.boolean(),
|
|
395
|
+
message: z$1.string().optional()
|
|
396
|
+
});
|
|
397
|
+
const addressWhitelistCheckRequestSchema = z$1.object({ address: z$1.string() });
|
|
398
|
+
const addressWhitelistCheckResponseSchema = z$1.object({
|
|
399
|
+
isAllowed: z$1.boolean(),
|
|
400
|
+
message: z$1.string().optional()
|
|
638
401
|
});
|
|
639
402
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
});
|
|
648
|
-
var chainSuccessResponseSchema = z10.object({
|
|
649
|
-
success: z10.boolean(),
|
|
650
|
-
chainId: z10.number().optional()
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/api/schemas/chain.ts
|
|
405
|
+
const chainIdSchema = z$1.object({ chainId: z$1.number().nullable() });
|
|
406
|
+
const setChainIdSchema = z$1.object({ chainId: z$1.number().positive() });
|
|
407
|
+
const chainSuccessResponseSchema = z$1.object({
|
|
408
|
+
success: z$1.boolean(),
|
|
409
|
+
chainId: z$1.number().optional()
|
|
651
410
|
});
|
|
652
411
|
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
});
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
address: hexStringSchema
|
|
669
|
-
})
|
|
670
|
-
)
|
|
671
|
-
});
|
|
672
|
-
var getConfigChainsResponseSchema = z11.unknown();
|
|
673
|
-
var getMaxPriorityFeePerGasEstimateSchema = z11.object({
|
|
674
|
-
chainId: z11.number()
|
|
675
|
-
});
|
|
676
|
-
var getMaxPriorityFeePerGasEstimateResponseSchema = z11.object({
|
|
677
|
-
slowMaxPriorityFeeEstimate: z11.number(),
|
|
678
|
-
normalMaxPriorityFeeEstimate: z11.number(),
|
|
679
|
-
fastMaxPriorityFeeEstimate: z11.number()
|
|
412
|
+
//#endregion
|
|
413
|
+
//#region src/api/schemas/config.ts
|
|
414
|
+
const getDelegateAddressSchema = z$1.object({ chainId: z$1.number() });
|
|
415
|
+
const getDelegateAddressResponseSchema = z$1.object({ otimDelegateAddress: z$1.string() });
|
|
416
|
+
const getConfigTokensRequestParametersSchema = z$1.object({ chainId: z$1.number() });
|
|
417
|
+
const getConfigTokensResponseSchema = z$1.object({ tokens: z$1.array(z$1.object({
|
|
418
|
+
symbol: z$1.any(),
|
|
419
|
+
address: hexStringSchema
|
|
420
|
+
})) });
|
|
421
|
+
const getConfigChainsResponseSchema = z$1.unknown();
|
|
422
|
+
const getMaxPriorityFeePerGasEstimateSchema = z$1.object({ chainId: z$1.number() });
|
|
423
|
+
const getMaxPriorityFeePerGasEstimateResponseSchema = z$1.object({
|
|
424
|
+
slowMaxPriorityFeeEstimate: z$1.number(),
|
|
425
|
+
normalMaxPriorityFeeEstimate: z$1.number(),
|
|
426
|
+
fastMaxPriorityFeeEstimate: z$1.number()
|
|
680
427
|
});
|
|
681
428
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
});
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
});
|
|
699
|
-
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region src/api/schemas/contacts.ts
|
|
431
|
+
const newContactRequestSchema = z$1.object({
|
|
432
|
+
address: hexStringSchema,
|
|
433
|
+
name: z$1.string()
|
|
434
|
+
});
|
|
435
|
+
const getContactsRequestSchema = z$1.object({
|
|
436
|
+
perPage: numberSchema.optional(),
|
|
437
|
+
page: numberSchema.optional()
|
|
438
|
+
});
|
|
439
|
+
const contactSchema = z$1.object({
|
|
440
|
+
userId: z$1.string(),
|
|
441
|
+
address: hexStringSchema,
|
|
442
|
+
name: z$1.string(),
|
|
443
|
+
createdAt: z$1.string(),
|
|
444
|
+
updatedAt: z$1.string()
|
|
445
|
+
});
|
|
446
|
+
const getContactsResponseSchema = z$1.array(contactSchema);
|
|
700
447
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
});
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
});
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
});
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
});
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
});
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
448
|
+
//#endregion
|
|
449
|
+
//#region src/api/schemas/instruction.ts
|
|
450
|
+
const feeSchema = z$1.object({
|
|
451
|
+
executionFee: hexStringSchema,
|
|
452
|
+
maxBaseFeePerGas: hexStringSchema,
|
|
453
|
+
maxPriorityFeePerGas: hexStringSchema,
|
|
454
|
+
token: hexStringSchema
|
|
455
|
+
});
|
|
456
|
+
const scheduleSchema = z$1.object({
|
|
457
|
+
startAt: numberSchema,
|
|
458
|
+
startBy: numberSchema,
|
|
459
|
+
interval: numberSchema,
|
|
460
|
+
timeout: numberSchema
|
|
461
|
+
});
|
|
462
|
+
const baseActionArgumentsSchema = z$1.object({
|
|
463
|
+
target: hexStringSchema,
|
|
464
|
+
fee: feeSchema,
|
|
465
|
+
token: hexStringSchema
|
|
466
|
+
});
|
|
467
|
+
const refuelActionArgumentsSchema = baseActionArgumentsSchema.extend({
|
|
468
|
+
threshold: numberSchema,
|
|
469
|
+
endBalance: numberSchema,
|
|
470
|
+
gasLimit: numberSchema
|
|
471
|
+
});
|
|
472
|
+
const refuelERC20ActionArgumentsSchema = baseActionArgumentsSchema.extend({
|
|
473
|
+
threshold: numberSchema,
|
|
474
|
+
endBalance: numberSchema,
|
|
475
|
+
gasLimit: numberSchema
|
|
476
|
+
});
|
|
477
|
+
const transferActionArgumentsSchema = baseActionArgumentsSchema.extend({
|
|
478
|
+
value: numberSchema,
|
|
479
|
+
gasLimit: numberSchema,
|
|
480
|
+
schedule: scheduleSchema
|
|
481
|
+
});
|
|
482
|
+
const transferERC20ActionArgumentsSchema = baseActionArgumentsSchema.extend({
|
|
483
|
+
value: numberSchema,
|
|
484
|
+
gasLimit: numberSchema,
|
|
485
|
+
schedule: scheduleSchema
|
|
486
|
+
});
|
|
487
|
+
const uniswapV3ExactInputActionArgumentsSchema = z$1.object({
|
|
488
|
+
tokenIn: hexStringSchema,
|
|
489
|
+
tokenOut: hexStringSchema,
|
|
490
|
+
amountIn: numberSchema,
|
|
491
|
+
floorAmountOut: numberSchema,
|
|
492
|
+
feeTier: z$1.string(),
|
|
493
|
+
recipient: hexStringSchema,
|
|
494
|
+
meanPriceLookBack: numberSchema,
|
|
495
|
+
maxPriceDeviationBps: numberSchema,
|
|
496
|
+
fee: feeSchema,
|
|
497
|
+
schedule: scheduleSchema
|
|
498
|
+
});
|
|
499
|
+
const deactivateInstructionActionArgumentsSchema = z$1.object({
|
|
500
|
+
instructionId: hexStringSchema,
|
|
501
|
+
fee: feeSchema
|
|
502
|
+
});
|
|
503
|
+
const depositERC4626ActionArgumentsSchema = z$1.object({
|
|
504
|
+
vault: hexStringSchema,
|
|
505
|
+
recipient: hexStringSchema,
|
|
506
|
+
value: numberSchema,
|
|
507
|
+
minDeposit: numberSchema,
|
|
508
|
+
minTotalShares: numberSchema,
|
|
509
|
+
schedule: scheduleSchema,
|
|
510
|
+
fee: feeSchema
|
|
511
|
+
});
|
|
512
|
+
const sweepDepositERC4626ActionArgumentsSchema = z$1.object({
|
|
513
|
+
vault: hexStringSchema,
|
|
514
|
+
recipient: hexStringSchema,
|
|
515
|
+
threshold: numberSchema,
|
|
516
|
+
endBalance: numberSchema,
|
|
517
|
+
minDeposit: numberSchema,
|
|
518
|
+
minTotalShares: numberSchema,
|
|
519
|
+
fee: feeSchema
|
|
520
|
+
});
|
|
521
|
+
const withdrawERC4626ActionArgumentsSchema = z$1.object({
|
|
522
|
+
vault: hexStringSchema,
|
|
523
|
+
recipient: hexStringSchema,
|
|
524
|
+
value: numberSchema,
|
|
525
|
+
minWithdraw: numberSchema,
|
|
526
|
+
schedule: scheduleSchema,
|
|
527
|
+
fee: feeSchema
|
|
528
|
+
});
|
|
529
|
+
const sweepWithdrawERC4626ActionArgumentsSchema = z$1.object({
|
|
530
|
+
vault: hexStringSchema,
|
|
531
|
+
recipient: hexStringSchema,
|
|
532
|
+
threshold: numberSchema,
|
|
533
|
+
endBalance: numberSchema,
|
|
534
|
+
minWithdraw: numberSchema,
|
|
535
|
+
fee: feeSchema
|
|
536
|
+
});
|
|
537
|
+
const actionArgumentsSchema = z$1.union([
|
|
538
|
+
refuelActionArgumentsSchema,
|
|
539
|
+
refuelERC20ActionArgumentsSchema,
|
|
540
|
+
transferActionArgumentsSchema,
|
|
541
|
+
transferERC20ActionArgumentsSchema,
|
|
542
|
+
uniswapV3ExactInputActionArgumentsSchema,
|
|
543
|
+
deactivateInstructionActionArgumentsSchema,
|
|
544
|
+
depositERC4626ActionArgumentsSchema,
|
|
545
|
+
sweepDepositERC4626ActionArgumentsSchema,
|
|
546
|
+
withdrawERC4626ActionArgumentsSchema,
|
|
547
|
+
sweepWithdrawERC4626ActionArgumentsSchema
|
|
775
548
|
]);
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
});
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
});
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
});
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
});
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
});
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
});
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
549
|
+
const feeResponseSchema$1 = z$1.object({
|
|
550
|
+
token: hexStringSchema,
|
|
551
|
+
executionFee: hexStringSchema,
|
|
552
|
+
maxBaseFeePerGas: hexStringSchema,
|
|
553
|
+
maxPriorityFeePerGas: hexStringSchema
|
|
554
|
+
});
|
|
555
|
+
const scheduleResponseSchema = z$1.object({
|
|
556
|
+
startAt: hexStringSchema,
|
|
557
|
+
startBy: hexStringSchema,
|
|
558
|
+
interval: hexStringSchema,
|
|
559
|
+
timeout: hexStringSchema
|
|
560
|
+
});
|
|
561
|
+
const refuelActionResponseSchema = z$1.object({
|
|
562
|
+
target: hexStringSchema,
|
|
563
|
+
threshold: hexStringSchema,
|
|
564
|
+
endBalance: hexStringSchema,
|
|
565
|
+
gasLimit: hexStringSchema,
|
|
566
|
+
fee: feeResponseSchema$1
|
|
567
|
+
});
|
|
568
|
+
const transferActionResponseSchema = z$1.object({
|
|
569
|
+
target: hexStringSchema,
|
|
570
|
+
value: hexStringSchema,
|
|
571
|
+
gasLimit: hexStringSchema,
|
|
572
|
+
schedule: scheduleResponseSchema,
|
|
573
|
+
fee: feeResponseSchema$1
|
|
574
|
+
});
|
|
575
|
+
const refuelERC20ActionResponseSchema = z$1.object({
|
|
576
|
+
token: hexStringSchema,
|
|
577
|
+
target: hexStringSchema,
|
|
578
|
+
threshold: hexStringSchema,
|
|
579
|
+
endBalance: hexStringSchema,
|
|
580
|
+
fee: feeResponseSchema$1
|
|
581
|
+
});
|
|
582
|
+
const transferERC20ActionResponseSchema = z$1.object({
|
|
583
|
+
token: hexStringSchema,
|
|
584
|
+
target: hexStringSchema,
|
|
585
|
+
value: hexStringSchema,
|
|
586
|
+
schedule: scheduleResponseSchema,
|
|
587
|
+
fee: feeResponseSchema$1
|
|
588
|
+
});
|
|
589
|
+
const actionArgumentsResponseSchema = z$1.union([
|
|
590
|
+
refuelActionResponseSchema,
|
|
591
|
+
transferActionResponseSchema,
|
|
592
|
+
refuelERC20ActionResponseSchema,
|
|
593
|
+
transferERC20ActionResponseSchema
|
|
821
594
|
]);
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
});
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
});
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
nickname: z13.string().nullish(),
|
|
887
|
-
lastErrorCode: z13.number().int(),
|
|
888
|
-
lastErrorMessage: z13.string().nullish()
|
|
889
|
-
});
|
|
890
|
-
var instructionGetRulesRequestSchema = z13.object({
|
|
891
|
-
chainId: z13.number(),
|
|
892
|
-
page: z13.number().optional(),
|
|
893
|
-
perPage: z13.number().optional()
|
|
894
|
-
});
|
|
895
|
-
var instructionGetRulesResponseSchema = z13.array(
|
|
896
|
-
instructionSchema
|
|
897
|
-
);
|
|
595
|
+
const instructionBuildSchema = z$1.object({
|
|
596
|
+
action: hexStringSchema,
|
|
597
|
+
arguments: hexStringSchema,
|
|
598
|
+
maxExecutions: hexStringSchema,
|
|
599
|
+
salt: hexStringSchema,
|
|
600
|
+
nickname: z$1.string().nullish()
|
|
601
|
+
});
|
|
602
|
+
const instructionGetAllRequestSchema = z$1.object({
|
|
603
|
+
address: hexStringSchema,
|
|
604
|
+
chainId: z$1.number(),
|
|
605
|
+
actionName: z$1.string().optional(),
|
|
606
|
+
page: z$1.number().optional(),
|
|
607
|
+
perPage: z$1.number().optional()
|
|
608
|
+
});
|
|
609
|
+
const instructionGetAllResponseSchema = z$1.array(instructionSchema);
|
|
610
|
+
const instructionBuildRequestSchema = z$1.object({
|
|
611
|
+
address: hexStringSchema,
|
|
612
|
+
chainId: z$1.number(),
|
|
613
|
+
salt: z$1.number(),
|
|
614
|
+
maxExecutions: z$1.number(),
|
|
615
|
+
actionArguments: z$1.record(z$1.string(), actionArgumentsSchema).refine((args) => {
|
|
616
|
+
const keys = Object.keys(args);
|
|
617
|
+
return keys.length === 1 && instructionActionValues.includes(keys[0]);
|
|
618
|
+
}, { message: "actionArguments must contain exactly one valid instruction action" })
|
|
619
|
+
});
|
|
620
|
+
const instructionActivateRequestSchema = z$1.object({
|
|
621
|
+
nickname: z$1.string().optional(),
|
|
622
|
+
address: hexStringSchema,
|
|
623
|
+
chainId: z$1.number(),
|
|
624
|
+
salt: hexStringSchema,
|
|
625
|
+
maxExecutions: hexStringSchema,
|
|
626
|
+
action: hexStringSchema,
|
|
627
|
+
arguments: hexStringSchema,
|
|
628
|
+
activationSignature: eip2098SignatureSchema
|
|
629
|
+
});
|
|
630
|
+
const instructionActivateResponseSchema = z$1.object({ instructionId: hexStringSchema });
|
|
631
|
+
const instructionDeactivateRequestSchema = z$1.object({
|
|
632
|
+
address: hexStringSchema,
|
|
633
|
+
chainId: z$1.number(),
|
|
634
|
+
deactivation: z$1.object({ instructionId: hexStringSchema }),
|
|
635
|
+
deactivationSignature: eip2098SignatureSchema
|
|
636
|
+
});
|
|
637
|
+
const instructionDeactivateResponseSchema = z$1.unknown();
|
|
638
|
+
const instructionDetailsRequestSchema = z$1.object({
|
|
639
|
+
address: hexStringSchema,
|
|
640
|
+
instructionId: hexStringSchema,
|
|
641
|
+
chainId: z$1.number()
|
|
642
|
+
});
|
|
643
|
+
const instructionDetailsResponseSchema = z$1.object({
|
|
644
|
+
action: hexStringSchema,
|
|
645
|
+
actionArguments: z$1.any(),
|
|
646
|
+
actionName: z$1.string().nullish(),
|
|
647
|
+
salt: hexStringSchema,
|
|
648
|
+
maxExecutions: hexStringSchema,
|
|
649
|
+
nickname: z$1.string().nullish(),
|
|
650
|
+
lastErrorCode: z$1.number().int(),
|
|
651
|
+
lastErrorMessage: z$1.string().nullish()
|
|
652
|
+
});
|
|
653
|
+
const instructionGetRulesRequestSchema = z$1.object({
|
|
654
|
+
chainId: z$1.number(),
|
|
655
|
+
page: z$1.number().optional(),
|
|
656
|
+
perPage: z$1.number().optional()
|
|
657
|
+
});
|
|
658
|
+
const instructionGetRulesResponseSchema = z$1.array(instructionSchema);
|
|
898
659
|
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
660
|
+
//#endregion
|
|
661
|
+
//#region src/api/schemas/integration.ts
|
|
662
|
+
const IntegrationType = {
|
|
663
|
+
Bank: "Bank",
|
|
664
|
+
Clio: "Clio",
|
|
665
|
+
Stripe: "Stripe",
|
|
666
|
+
QuickBooks: "QuickBooks",
|
|
667
|
+
Bill: "Bill",
|
|
668
|
+
Zoho: "Zoho"
|
|
908
669
|
};
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
670
|
+
const integrationTypeValues = [
|
|
671
|
+
IntegrationType.Bank,
|
|
672
|
+
IntegrationType.Clio,
|
|
673
|
+
IntegrationType.Stripe,
|
|
674
|
+
IntegrationType.QuickBooks,
|
|
675
|
+
IntegrationType.Bill,
|
|
676
|
+
IntegrationType.Zoho
|
|
916
677
|
];
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
});
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
});
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
});
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
});
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
});
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
});
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
});
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
});
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
})
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
details: billcomDetailsSchema
|
|
1028
|
-
}),
|
|
1029
|
-
z14.object({
|
|
1030
|
-
integrationType: z14.literal(IntegrationType.Zoho),
|
|
1031
|
-
details: z14.unknown()
|
|
1032
|
-
})
|
|
1033
|
-
]
|
|
1034
|
-
);
|
|
678
|
+
const quickBooksDetailsSchema = z$1.object({
|
|
679
|
+
accessToken: z$1.string().optional(),
|
|
680
|
+
refreshToken: z$1.string().optional(),
|
|
681
|
+
realmId: z$1.string().optional(),
|
|
682
|
+
tokenType: z$1.string().optional(),
|
|
683
|
+
expiresIn: z$1.number().optional(),
|
|
684
|
+
xRefreshTokenExpiresIn: z$1.number().optional()
|
|
685
|
+
});
|
|
686
|
+
const stripeTokensSchema = z$1.object({
|
|
687
|
+
accessToken: z$1.string(),
|
|
688
|
+
refreshToken: z$1.string().optional()
|
|
689
|
+
});
|
|
690
|
+
const stripeDetailsSchema = z$1.object({
|
|
691
|
+
clientId: z$1.string().optional(),
|
|
692
|
+
clientSecret: z$1.string().optional(),
|
|
693
|
+
tokens: stripeTokensSchema.optional()
|
|
694
|
+
});
|
|
695
|
+
const billcomDetailsSchema = z$1.object({
|
|
696
|
+
devKey: z$1.string().optional(),
|
|
697
|
+
sessionId: z$1.string().optional(),
|
|
698
|
+
orgId: z$1.string().optional(),
|
|
699
|
+
rememberMeId: z$1.string().optional()
|
|
700
|
+
});
|
|
701
|
+
const liquidationAddressSchema = z$1.object({
|
|
702
|
+
liquidationAddressId: z$1.string(),
|
|
703
|
+
address: z$1.string(),
|
|
704
|
+
chain: z$1.string(),
|
|
705
|
+
currency: z$1.string(),
|
|
706
|
+
blockchainMemo: z$1.string().optional()
|
|
707
|
+
});
|
|
708
|
+
const plaidAccountSchema = z$1.object({
|
|
709
|
+
accountId: z$1.string(),
|
|
710
|
+
name: z$1.string().optional(),
|
|
711
|
+
mask: z$1.string().optional(),
|
|
712
|
+
subtype: z$1.string().optional(),
|
|
713
|
+
externalAccountId: z$1.string().optional(),
|
|
714
|
+
liquidationAddress: liquidationAddressSchema.optional()
|
|
715
|
+
});
|
|
716
|
+
const plaidConnectionSchema = z$1.object({
|
|
717
|
+
accessToken: z$1.string(),
|
|
718
|
+
itemId: z$1.string(),
|
|
719
|
+
institutionId: z$1.string().optional(),
|
|
720
|
+
institutionName: z$1.string().optional(),
|
|
721
|
+
accounts: z$1.array(plaidAccountSchema)
|
|
722
|
+
});
|
|
723
|
+
const bridgeConnectionSchema = z$1.object({
|
|
724
|
+
customerId: z$1.string(),
|
|
725
|
+
kycLinkId: z$1.string().optional(),
|
|
726
|
+
kycLink: z$1.string().optional(),
|
|
727
|
+
tosLink: z$1.string().optional(),
|
|
728
|
+
completedSteps: z$1.array(z$1.string()).optional()
|
|
729
|
+
});
|
|
730
|
+
const bankDetailsSchema = z$1.object({
|
|
731
|
+
plaid: z$1.array(plaidConnectionSchema).optional(),
|
|
732
|
+
bridge: z$1.array(bridgeConnectionSchema).optional()
|
|
733
|
+
});
|
|
734
|
+
const integrationTypeSchema = z$1.enum(integrationTypeValues);
|
|
735
|
+
const updateIntegrationRequestSchema = z$1.discriminatedUnion("integrationType", [
|
|
736
|
+
z$1.object({
|
|
737
|
+
integrationType: z$1.literal(IntegrationType.QuickBooks),
|
|
738
|
+
details: quickBooksDetailsSchema
|
|
739
|
+
}),
|
|
740
|
+
z$1.object({
|
|
741
|
+
integrationType: z$1.literal(IntegrationType.Bank),
|
|
742
|
+
details: bankDetailsSchema
|
|
743
|
+
}),
|
|
744
|
+
z$1.object({
|
|
745
|
+
integrationType: z$1.literal(IntegrationType.Clio),
|
|
746
|
+
details: z$1.unknown()
|
|
747
|
+
}),
|
|
748
|
+
z$1.object({
|
|
749
|
+
integrationType: z$1.literal(IntegrationType.Stripe),
|
|
750
|
+
details: stripeDetailsSchema
|
|
751
|
+
}),
|
|
752
|
+
z$1.object({
|
|
753
|
+
integrationType: z$1.literal(IntegrationType.Bill),
|
|
754
|
+
details: billcomDetailsSchema
|
|
755
|
+
}),
|
|
756
|
+
z$1.object({
|
|
757
|
+
integrationType: z$1.literal(IntegrationType.Zoho),
|
|
758
|
+
details: z$1.unknown()
|
|
759
|
+
})
|
|
760
|
+
]);
|
|
761
|
+
const getIntegrationRequestSchema = z$1.object({ integrationType: integrationTypeSchema });
|
|
762
|
+
const integrationResponseSchema = z$1.discriminatedUnion("integrationType", [
|
|
763
|
+
z$1.object({
|
|
764
|
+
integrationType: z$1.literal(IntegrationType.QuickBooks),
|
|
765
|
+
details: quickBooksDetailsSchema
|
|
766
|
+
}),
|
|
767
|
+
z$1.object({
|
|
768
|
+
integrationType: z$1.literal(IntegrationType.Bank),
|
|
769
|
+
details: bankDetailsSchema
|
|
770
|
+
}),
|
|
771
|
+
z$1.object({
|
|
772
|
+
integrationType: z$1.literal(IntegrationType.Clio),
|
|
773
|
+
details: z$1.unknown()
|
|
774
|
+
}),
|
|
775
|
+
z$1.object({
|
|
776
|
+
integrationType: z$1.literal(IntegrationType.Stripe),
|
|
777
|
+
details: stripeDetailsSchema
|
|
778
|
+
}),
|
|
779
|
+
z$1.object({
|
|
780
|
+
integrationType: z$1.literal(IntegrationType.Bill),
|
|
781
|
+
details: billcomDetailsSchema
|
|
782
|
+
}),
|
|
783
|
+
z$1.object({
|
|
784
|
+
integrationType: z$1.literal(IntegrationType.Zoho),
|
|
785
|
+
details: z$1.unknown()
|
|
786
|
+
})
|
|
787
|
+
]);
|
|
1035
788
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
});
|
|
1042
|
-
var getOperatingAccountSubOrgResponseSchema = z15.object({
|
|
1043
|
-
subOrganizationId: z15.string()
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/api/schemas/operating-account.ts
|
|
791
|
+
const newOperatingAccountSubOrgResponseSchema = z$1.object({
|
|
792
|
+
subOrganizationId: z$1.string(),
|
|
793
|
+
endUserId: z$1.string()
|
|
1044
794
|
});
|
|
795
|
+
const getOperatingAccountSubOrgResponseSchema = z$1.object({ subOrganizationId: z$1.string() });
|
|
1045
796
|
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
797
|
+
//#endregion
|
|
798
|
+
//#region src/api/schemas/payments.ts
|
|
799
|
+
const paymentRequestsDirectionSchema = z$1.enum(["from", "to"]);
|
|
800
|
+
const orchestrationTypeSchema = z$1.enum(["AutoEarn", "PaymentRequest"]);
|
|
801
|
+
const getPaymentRequestsRequestSchema = z$1.object({
|
|
802
|
+
direction: paymentRequestsDirectionSchema,
|
|
803
|
+
statuses: z$1.array(z$1.enum([
|
|
804
|
+
"pending",
|
|
805
|
+
"inProgress",
|
|
806
|
+
"paid",
|
|
807
|
+
"cancelled",
|
|
808
|
+
"draft"
|
|
809
|
+
])).optional(),
|
|
810
|
+
perPage: numberSchema.optional(),
|
|
811
|
+
page: numberSchema.optional(),
|
|
812
|
+
orchestrationType: orchestrationTypeSchema.optional()
|
|
813
|
+
});
|
|
814
|
+
const paymentRequestStatusSchema = z$1.enum([
|
|
815
|
+
"pending",
|
|
816
|
+
"inProgress",
|
|
817
|
+
"paid",
|
|
818
|
+
"cancelled",
|
|
819
|
+
"draft"
|
|
1061
820
|
]);
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
});
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
});
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
});
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
});
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
821
|
+
const paymentRequestSchema = z$1.object({
|
|
822
|
+
id: z$1.string(),
|
|
823
|
+
fromUserId: z$1.string(),
|
|
824
|
+
toUserId: z$1.string().nullable(),
|
|
825
|
+
payerAddress: hexStringSchema.nullable(),
|
|
826
|
+
ephemeralWalletAddress: hexStringSchema,
|
|
827
|
+
instructions: z$1.object({
|
|
828
|
+
ids: z$1.array(z$1.string()),
|
|
829
|
+
completionIds: z$1.array(z$1.string())
|
|
830
|
+
}),
|
|
831
|
+
metadata: z$1.record(z$1.string(), z$1.unknown()),
|
|
832
|
+
status: paymentRequestStatusSchema,
|
|
833
|
+
createdAt: z$1.string(),
|
|
834
|
+
updatedAt: z$1.string()
|
|
835
|
+
});
|
|
836
|
+
const getPaymentRequestsResponseSchema = z$1.array(paymentRequestSchema);
|
|
837
|
+
const buildEphemeralInstructionSchema = z$1.object({
|
|
838
|
+
chainId: z$1.number(),
|
|
839
|
+
salt: numberSchema,
|
|
840
|
+
maxExecutions: numberSchema,
|
|
841
|
+
actionArguments: z$1.record(z$1.string(), z$1.unknown()),
|
|
842
|
+
setEphemeralTarget: z$1.boolean().optional()
|
|
843
|
+
});
|
|
844
|
+
const paymentRequestBuildRequestSchema = z$1.object({
|
|
845
|
+
payerAddress: hexStringSchema.nullish(),
|
|
846
|
+
completionInstructions: z$1.array(buildEphemeralInstructionSchema),
|
|
847
|
+
instructions: z$1.array(buildEphemeralInstructionSchema),
|
|
848
|
+
metadata: z$1.record(z$1.string(), z$1.unknown()).optional().default({}),
|
|
849
|
+
maxRuns: z$1.number().int().positive({ message: "maxRuns must be greater than 0" }).max(Number.MAX_SAFE_INTEGER, { message: "maxRuns must be less than MAX_SAFE_INTEGER" }).optional()
|
|
850
|
+
});
|
|
851
|
+
const feeResponseSchema = z$1.object({
|
|
852
|
+
token: hexStringSchema,
|
|
853
|
+
executionFee: hexStringSchema,
|
|
854
|
+
maxBaseFeePerGas: hexStringSchema,
|
|
855
|
+
maxPriorityFeePerGas: hexStringSchema
|
|
856
|
+
});
|
|
857
|
+
const buildInstructionResponseSchema = z$1.object({
|
|
858
|
+
address: hexStringSchema,
|
|
859
|
+
chainId: z$1.number(),
|
|
860
|
+
salt: hexStringSchema,
|
|
861
|
+
maxExecutions: hexStringSchema,
|
|
862
|
+
action: hexStringSchema,
|
|
863
|
+
actionName: z$1.string().optional(),
|
|
864
|
+
arguments: hexStringSchema
|
|
865
|
+
});
|
|
866
|
+
const paymentRequestBuildResponseSchema = z$1.object({
|
|
867
|
+
requestId: z$1.string(),
|
|
868
|
+
subOrgId: z$1.string(),
|
|
869
|
+
walletId: z$1.string(),
|
|
870
|
+
ephemeralWalletAddress: hexStringSchema,
|
|
871
|
+
completionInstructions: z$1.array(buildInstructionResponseSchema),
|
|
872
|
+
instructions: z$1.array(buildInstructionResponseSchema)
|
|
873
|
+
});
|
|
874
|
+
const newInstructionRequestSchema = z$1.object({
|
|
875
|
+
nickname: z$1.string().optional(),
|
|
876
|
+
actionName: z$1.string().optional(),
|
|
877
|
+
address: hexStringSchema,
|
|
878
|
+
chainId: z$1.number(),
|
|
879
|
+
salt: hexStringSchema,
|
|
880
|
+
maxExecutions: hexStringSchema,
|
|
881
|
+
action: hexStringSchema,
|
|
882
|
+
arguments: hexStringSchema,
|
|
883
|
+
activationSignature: eip2098SignatureSchema
|
|
884
|
+
});
|
|
885
|
+
const paymentRequestNewRequestSchema = z$1.object({
|
|
886
|
+
requestId: z$1.string(),
|
|
887
|
+
signedAuthorization: z$1.string(),
|
|
888
|
+
completionInstructions: z$1.array(newInstructionRequestSchema),
|
|
889
|
+
instructions: z$1.array(newInstructionRequestSchema)
|
|
890
|
+
});
|
|
891
|
+
const paymentRequestDetailsRequestSchema = z$1.object({ requestId: z$1.string() });
|
|
892
|
+
const paymentRequestDetailsResponseSchema = z$1.object({
|
|
893
|
+
requestId: z$1.string(),
|
|
894
|
+
ephemeralWalletAddress: hexStringSchema,
|
|
895
|
+
ephemeralWalletId: z$1.string().optional(),
|
|
896
|
+
status: z$1.enum([
|
|
897
|
+
"pending",
|
|
898
|
+
"inProgress",
|
|
899
|
+
"paid",
|
|
900
|
+
"cancelled",
|
|
901
|
+
"draft"
|
|
902
|
+
]),
|
|
903
|
+
metadata: z$1.record(z$1.string(), z$1.unknown()),
|
|
904
|
+
numRuns: z$1.number(),
|
|
905
|
+
maxRuns: z$1.number().optional()
|
|
906
|
+
});
|
|
907
|
+
const buildSettlementRequestSchema = z$1.object({
|
|
908
|
+
acceptedTokens: z$1.record(z$1.string(), z$1.array(hexStringSchema)),
|
|
909
|
+
settlementChain: z$1.number(),
|
|
910
|
+
settlementToken: hexStringSchema,
|
|
911
|
+
settlementAmount: numberSchema,
|
|
912
|
+
recipientAddress: hexStringSchema,
|
|
913
|
+
metadata: z$1.record(z$1.string(), z$1.unknown()),
|
|
914
|
+
payerAddress: hexStringSchema.nullish(),
|
|
915
|
+
dueDate: z$1.string().datetime().nullish(),
|
|
916
|
+
maxRuns: z$1.number().int().positive().nullish()
|
|
917
|
+
});
|
|
918
|
+
const buildSettlementResponseSchema = z$1.object({
|
|
919
|
+
requestId: z$1.string(),
|
|
920
|
+
subOrgId: z$1.string(),
|
|
921
|
+
walletId: z$1.string(),
|
|
922
|
+
ephemeralWalletAddress: hexStringSchema,
|
|
923
|
+
completionInstructions: z$1.array(buildInstructionResponseSchema),
|
|
924
|
+
instructions: z$1.array(buildInstructionResponseSchema)
|
|
1162
925
|
});
|
|
1163
926
|
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
});
|
|
1176
|
-
|
|
927
|
+
//#endregion
|
|
928
|
+
//#region src/api/schemas/transaction.ts
|
|
929
|
+
const transactionGetListRequestSchema = z$1.object({
|
|
930
|
+
address: hexStringSchema,
|
|
931
|
+
chainId: z$1.number(),
|
|
932
|
+
instructionIds: z$1.array(z$1.string()).optional(),
|
|
933
|
+
from: z$1.string().optional(),
|
|
934
|
+
to: z$1.string().optional(),
|
|
935
|
+
page: z$1.number().optional(),
|
|
936
|
+
perPage: z$1.number().optional(),
|
|
937
|
+
sort: z$1.enum(sortValues).optional()
|
|
938
|
+
});
|
|
939
|
+
const transactionGetListResponseSchema = z$1.array(transactionSchema);
|
|
1177
940
|
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1194
|
-
warn(message, options) {
|
|
1195
|
-
this.log("warn", message, options);
|
|
1196
|
-
}
|
|
1197
|
-
error(message, options) {
|
|
1198
|
-
this.log("error", message, options);
|
|
1199
|
-
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Log errors with context - useful for non-API errors
|
|
1202
|
-
* For API errors, use the existing getErrorMessage from @otim/utils/api
|
|
1203
|
-
*/
|
|
1204
|
-
logError(error, options = {}) {
|
|
1205
|
-
const { context, operation, metadata } = options;
|
|
1206
|
-
const prefix = this.buildPrefix(context, operation);
|
|
1207
|
-
let message = "Unknown error";
|
|
1208
|
-
if (error instanceof Error) {
|
|
1209
|
-
message = error.message;
|
|
1210
|
-
} else if (typeof error === "string") {
|
|
1211
|
-
message = error;
|
|
1212
|
-
} else if (error && typeof error === "object" && "message" in error) {
|
|
1213
|
-
message = String(error.message);
|
|
1214
|
-
}
|
|
1215
|
-
console.error(prefix ? `${prefix} ${message}` : message);
|
|
1216
|
-
if (metadata && Object.keys(metadata).length > 0) {
|
|
1217
|
-
console.error("Context:", metadata);
|
|
1218
|
-
}
|
|
1219
|
-
if (error instanceof Error && error.stack) {
|
|
1220
|
-
console.error("Stack:", error.stack);
|
|
1221
|
-
} else {
|
|
1222
|
-
console.error("Error details:", error);
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
buildPrefix(context, operation) {
|
|
1226
|
-
const parts = [];
|
|
1227
|
-
if (context) parts.push(`[${context}]`);
|
|
1228
|
-
if (operation) parts.push(`[${operation}]`);
|
|
1229
|
-
return parts.join(" ");
|
|
1230
|
-
}
|
|
1231
|
-
log(level, message, options) {
|
|
1232
|
-
const prefix = options?.context ? `[${options.context}]` : "";
|
|
1233
|
-
const fullMessage = `${prefix} ${message}`.trim();
|
|
1234
|
-
switch (level) {
|
|
1235
|
-
case "debug":
|
|
1236
|
-
case "info":
|
|
1237
|
-
console.log(fullMessage);
|
|
1238
|
-
break;
|
|
1239
|
-
case "warn":
|
|
1240
|
-
console.warn(fullMessage);
|
|
1241
|
-
break;
|
|
1242
|
-
case "error":
|
|
1243
|
-
console.error(fullMessage);
|
|
1244
|
-
break;
|
|
1245
|
-
}
|
|
1246
|
-
if (options?.data) {
|
|
1247
|
-
console.dir(options.data, { depth: null });
|
|
1248
|
-
}
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
|
-
var logger = new Logger();
|
|
1252
|
-
|
|
1253
|
-
// src/helpers/zod.ts
|
|
1254
|
-
import { z as z18 } from "zod";
|
|
1255
|
-
var parseSchema = (values, schema) => {
|
|
1256
|
-
const inputValues = schema.safeParse(values);
|
|
1257
|
-
if (!inputValues.success) {
|
|
1258
|
-
throw new Error(
|
|
1259
|
-
`parseSchema: invalid input values ${JSON.stringify(inputValues.error)}`
|
|
1260
|
-
);
|
|
1261
|
-
}
|
|
1262
|
-
return inputValues.data;
|
|
941
|
+
//#endregion
|
|
942
|
+
//#region src/api/utils/backoff.ts
|
|
943
|
+
const DEFAULT_INITIAL_INTERVAL = 5e3;
|
|
944
|
+
const DEFAULT_MAX_INTERVAL = 3e4;
|
|
945
|
+
const DEFAULT_MULTIPLIER = 1.5;
|
|
946
|
+
/**
|
|
947
|
+
* Calculates an exponential backoff interval based on the failure count.
|
|
948
|
+
*
|
|
949
|
+
* @param failureCount - Number of consecutive failures
|
|
950
|
+
* @param options - Configuration options for the backoff calculation
|
|
951
|
+
* @returns The calculated interval in milliseconds, capped at maxInterval
|
|
952
|
+
*/
|
|
953
|
+
const calculateBackoffInterval = (failureCount, options = {}) => {
|
|
954
|
+
const { initialInterval = DEFAULT_INITIAL_INTERVAL, maxInterval = DEFAULT_MAX_INTERVAL, multiplier = DEFAULT_MULTIPLIER } = options;
|
|
955
|
+
return Math.min(initialInterval * Math.pow(multiplier, failureCount), maxInterval);
|
|
1263
956
|
};
|
|
1264
957
|
|
|
1265
|
-
|
|
958
|
+
//#endregion
|
|
959
|
+
//#region src/api/utils/pagination.ts
|
|
960
|
+
/**
|
|
961
|
+
* Determine if additional pages are likely available based on the number of
|
|
962
|
+
* items received and the requested page size.
|
|
963
|
+
*
|
|
964
|
+
* Returns true when the current page contains at least `requestedPageSize`
|
|
965
|
+
* items, implying there may be more data to fetch.
|
|
966
|
+
*
|
|
967
|
+
* @param items Array of items returned for the current page.
|
|
968
|
+
* @param requestedPageSize The `perPage` value requested for this fetch.
|
|
969
|
+
* @returns Whether another page may be available.
|
|
970
|
+
*/
|
|
1266
971
|
function calculateHasMore(items, requestedPageSize) {
|
|
1267
|
-
|
|
972
|
+
return items.length >= requestedPageSize;
|
|
1268
973
|
}
|
|
974
|
+
/**
|
|
975
|
+
* Extract pagination-related fields from a request object and return them
|
|
976
|
+
* separately from the remaining parameters.
|
|
977
|
+
*
|
|
978
|
+
* @param request Request object containing `page`, `perPage`, and other fields.
|
|
979
|
+
* @returns Object with `paginationParams` and `restParams` split for
|
|
980
|
+
* convenience.
|
|
981
|
+
*/
|
|
1269
982
|
function extractPaginationParams(request) {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
983
|
+
const { page, perPage, ...restParams } = request;
|
|
984
|
+
return {
|
|
985
|
+
paginationParams: {
|
|
986
|
+
page,
|
|
987
|
+
perPage
|
|
988
|
+
},
|
|
989
|
+
restParams
|
|
990
|
+
};
|
|
1275
991
|
}
|
|
992
|
+
/**
|
|
993
|
+
* Provide a standard default for pagination parameters.
|
|
994
|
+
*
|
|
995
|
+
* @returns Default pagination with `page: 0` and `perPage: 100`.
|
|
996
|
+
*/
|
|
1276
997
|
function getDefaultPagination() {
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
998
|
+
return {
|
|
999
|
+
page: 0,
|
|
1000
|
+
perPage: 100
|
|
1001
|
+
};
|
|
1281
1002
|
}
|
|
1282
1003
|
|
|
1283
|
-
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/api/services/base.ts
|
|
1284
1006
|
var BaseService = class {
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
const requestData = { ...restParams, page, perPage };
|
|
1336
|
-
const response = await this.makeRequest({
|
|
1337
|
-
url,
|
|
1338
|
-
method,
|
|
1339
|
-
data: requestData,
|
|
1340
|
-
schema,
|
|
1341
|
-
validateResponse,
|
|
1342
|
-
...config
|
|
1343
|
-
});
|
|
1344
|
-
const hasMore = Array.isArray(response.data) ? calculateHasMore(response.data, perPage) : false;
|
|
1345
|
-
return {
|
|
1346
|
-
data: response.data,
|
|
1347
|
-
hasMore
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1007
|
+
constructor(instance) {
|
|
1008
|
+
this.instance = instance;
|
|
1009
|
+
}
|
|
1010
|
+
async makeRequest({ url, method = HttpMethod.Get, data, schema, validateResponse, ...config }) {
|
|
1011
|
+
try {
|
|
1012
|
+
const res = await this.instance.request({
|
|
1013
|
+
url,
|
|
1014
|
+
method,
|
|
1015
|
+
data,
|
|
1016
|
+
...config
|
|
1017
|
+
});
|
|
1018
|
+
if (validateResponse && !validateResponse(res.data)) throw new ServiceError("Invalid response format", "INVALID_RESPONSE");
|
|
1019
|
+
return { data: schema ? parseSchema(res.data, schema) : res.data };
|
|
1020
|
+
} catch (error) {
|
|
1021
|
+
if (error instanceof ServiceError) throw error;
|
|
1022
|
+
let errorMessage = "Unknown error";
|
|
1023
|
+
let errorCode;
|
|
1024
|
+
if (error && typeof error === "object" && "response" in error) {
|
|
1025
|
+
const responseData = error.response?.data;
|
|
1026
|
+
errorMessage = responseData?.errorMessage || responseData?.message || errorMessage;
|
|
1027
|
+
errorCode = responseData?.errorCode;
|
|
1028
|
+
} else if (error instanceof Error) errorMessage = error.message;
|
|
1029
|
+
throw new ServiceError(errorMessage, errorCode || "REQUEST_FAILED");
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
async makePaginatedRequest({ url, method = HttpMethod.Get, data, schema, validateResponse, ...config }) {
|
|
1033
|
+
const { paginationParams, restParams } = extractPaginationParams(data || {});
|
|
1034
|
+
const { page, perPage } = {
|
|
1035
|
+
...getDefaultPagination(),
|
|
1036
|
+
...paginationParams
|
|
1037
|
+
};
|
|
1038
|
+
const requestData = {
|
|
1039
|
+
...restParams,
|
|
1040
|
+
page,
|
|
1041
|
+
perPage
|
|
1042
|
+
};
|
|
1043
|
+
const response = await this.makeRequest({
|
|
1044
|
+
url,
|
|
1045
|
+
method,
|
|
1046
|
+
data: requestData,
|
|
1047
|
+
schema,
|
|
1048
|
+
validateResponse,
|
|
1049
|
+
...config
|
|
1050
|
+
});
|
|
1051
|
+
const hasMore = Array.isArray(response.data) ? calculateHasMore(response.data, perPage) : false;
|
|
1052
|
+
return {
|
|
1053
|
+
data: response.data,
|
|
1054
|
+
hasMore
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1350
1057
|
};
|
|
1351
1058
|
|
|
1352
|
-
|
|
1059
|
+
//#endregion
|
|
1060
|
+
//#region src/api/services/account.ts
|
|
1353
1061
|
var AccountService = class extends BaseService {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1062
|
+
async getDelegationStatus(requestBody) {
|
|
1063
|
+
return await this.makeRequest({
|
|
1064
|
+
url: "/delegation/status",
|
|
1065
|
+
method: HttpMethod.Get,
|
|
1066
|
+
data: requestBody,
|
|
1067
|
+
schema: delegationStatusResponseSchema
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
async createDelegation(requestBody) {
|
|
1071
|
+
await this.makeRequest({
|
|
1072
|
+
url: "/delegation/new",
|
|
1073
|
+
method: HttpMethod.Post,
|
|
1074
|
+
data: requestBody
|
|
1075
|
+
});
|
|
1076
|
+
return { data: {
|
|
1077
|
+
success: true,
|
|
1078
|
+
message: "Delegation created"
|
|
1079
|
+
} };
|
|
1080
|
+
}
|
|
1373
1081
|
};
|
|
1374
1082
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
validRecords.push(result.data);
|
|
1386
|
-
}
|
|
1387
|
-
});
|
|
1388
|
-
return validRecords;
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region src/api/services/activity.ts
|
|
1085
|
+
const safeParseActivityArray = (data) => {
|
|
1086
|
+
if (!Array.isArray(data)) return [];
|
|
1087
|
+
const validRecords = [];
|
|
1088
|
+
data.forEach((record) => {
|
|
1089
|
+
const result = activityRecordSchema.safeParse(record);
|
|
1090
|
+
if (result.success) validRecords.push(result.data);
|
|
1091
|
+
});
|
|
1092
|
+
return validRecords;
|
|
1389
1093
|
};
|
|
1390
|
-
|
|
1094
|
+
const safeActivityArraySchema = z$1.unknown().transform(safeParseActivityArray);
|
|
1391
1095
|
var ActivityService = class extends BaseService {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1096
|
+
async getInstructionActivity(requestBody) {
|
|
1097
|
+
return this.makePaginatedRequest({
|
|
1098
|
+
url: "/instructions/activity",
|
|
1099
|
+
method: HttpMethod.Get,
|
|
1100
|
+
data: requestBody,
|
|
1101
|
+
schema: safeActivityArraySchema
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1400
1104
|
};
|
|
1401
1105
|
|
|
1402
|
-
|
|
1106
|
+
//#endregion
|
|
1107
|
+
//#region src/api/services/auth.ts
|
|
1403
1108
|
var AuthService = class extends BaseService {
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
method: HttpMethod.Put,
|
|
1443
|
-
data: { preferences }
|
|
1444
|
-
});
|
|
1445
|
-
return res;
|
|
1446
|
-
}
|
|
1109
|
+
async login(requestBody) {
|
|
1110
|
+
return await this.makeRequest({
|
|
1111
|
+
url: "/auth/login",
|
|
1112
|
+
method: HttpMethod.Post,
|
|
1113
|
+
data: requestBody,
|
|
1114
|
+
schema: authLoginResponseSchema
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
async turnkeyVerification(requestBody) {
|
|
1118
|
+
return await this.makeRequest({
|
|
1119
|
+
url: "/turnkey/verification",
|
|
1120
|
+
method: HttpMethod.Post,
|
|
1121
|
+
data: requestBody,
|
|
1122
|
+
schema: turnkeyVerificationResponseSchema
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
async turnkeyLogin(requestBody) {
|
|
1126
|
+
return await this.makeRequest({
|
|
1127
|
+
url: "/turnkey/login",
|
|
1128
|
+
method: HttpMethod.Post,
|
|
1129
|
+
data: requestBody,
|
|
1130
|
+
schema: turnkeyLoginResponseSchema
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
async me() {
|
|
1134
|
+
return await this.makeRequest({
|
|
1135
|
+
url: "/auth/me",
|
|
1136
|
+
method: HttpMethod.Get,
|
|
1137
|
+
schema: userSchema
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1140
|
+
async updatePreferences(preferences) {
|
|
1141
|
+
return await this.makeRequest({
|
|
1142
|
+
url: "/user/preferences",
|
|
1143
|
+
method: HttpMethod.Put,
|
|
1144
|
+
data: { preferences }
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1447
1147
|
};
|
|
1448
1148
|
|
|
1449
|
-
|
|
1149
|
+
//#endregion
|
|
1150
|
+
//#region src/api/services/config.ts
|
|
1450
1151
|
var ConfigService = class extends BaseService {
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
url: `/instruction/estimate/max_priority_fee_per_gas/${requestBody.chainId}`,
|
|
1480
|
-
method: HttpMethod.Get,
|
|
1481
|
-
schema: getMaxPriorityFeePerGasEstimateResponseSchema
|
|
1482
|
-
});
|
|
1483
|
-
return res;
|
|
1484
|
-
}
|
|
1152
|
+
async getDelegateAddress(requestBody) {
|
|
1153
|
+
return await this.makeRequest({
|
|
1154
|
+
url: `/config/delegate/address/${requestBody.chainId}`,
|
|
1155
|
+
method: HttpMethod.Get,
|
|
1156
|
+
schema: getDelegateAddressResponseSchema
|
|
1157
|
+
});
|
|
1158
|
+
}
|
|
1159
|
+
async getConfigTokens({ chainId }) {
|
|
1160
|
+
return await this.makeRequest({
|
|
1161
|
+
url: `/config/tokens/${chainId}`,
|
|
1162
|
+
method: HttpMethod.Get,
|
|
1163
|
+
schema: getConfigTokensResponseSchema
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
async getConfigChains() {
|
|
1167
|
+
return await this.makeRequest({
|
|
1168
|
+
url: `/config/chains`,
|
|
1169
|
+
method: HttpMethod.Get,
|
|
1170
|
+
schema: getConfigChainsResponseSchema
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
async getMaxPriorityFeePerGasEstimate(requestBody) {
|
|
1174
|
+
return await this.makeRequest({
|
|
1175
|
+
url: `/instruction/estimate/max_priority_fee_per_gas/${requestBody.chainId}`,
|
|
1176
|
+
method: HttpMethod.Get,
|
|
1177
|
+
schema: getMaxPriorityFeePerGasEstimateResponseSchema
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1485
1180
|
};
|
|
1486
1181
|
|
|
1487
|
-
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region src/api/services/contacts.ts
|
|
1488
1184
|
var ContactsService = class extends BaseService {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1185
|
+
async create(request) {
|
|
1186
|
+
const validated = newContactRequestSchema.parse(request);
|
|
1187
|
+
return this.makeRequest({
|
|
1188
|
+
url: "/contacts",
|
|
1189
|
+
method: HttpMethod.Put,
|
|
1190
|
+
data: validated
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
async list(request) {
|
|
1194
|
+
const validated = getContactsRequestSchema.parse(request);
|
|
1195
|
+
return this.makePaginatedRequest({
|
|
1196
|
+
url: "/contacts",
|
|
1197
|
+
method: HttpMethod.Get,
|
|
1198
|
+
data: validated,
|
|
1199
|
+
schema: getContactsResponseSchema
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1506
1202
|
};
|
|
1507
1203
|
|
|
1508
|
-
|
|
1204
|
+
//#endregion
|
|
1205
|
+
//#region src/api/services/developer.ts
|
|
1509
1206
|
var DeveloperService = class extends BaseService {
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1207
|
+
async updatePublicKey(developerPublicKey) {
|
|
1208
|
+
return this.makeRequest({
|
|
1209
|
+
url: "/developer/public_key",
|
|
1210
|
+
method: HttpMethod.Put,
|
|
1211
|
+
data: { developerPublicKey }
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
async generateApiKey() {
|
|
1215
|
+
return this.makeRequest({
|
|
1216
|
+
url: "/developer/api_key",
|
|
1217
|
+
method: HttpMethod.Post
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
1523
1220
|
};
|
|
1524
1221
|
|
|
1525
|
-
|
|
1222
|
+
//#endregion
|
|
1223
|
+
//#region src/api/services/instruction.ts
|
|
1526
1224
|
var InstructionService = class extends BaseService {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
data: requestBody,
|
|
1576
|
-
schema: instructionGetRulesResponseSchema
|
|
1577
|
-
});
|
|
1578
|
-
}
|
|
1225
|
+
async all(requestBody) {
|
|
1226
|
+
return this.makePaginatedRequest({
|
|
1227
|
+
url: "/instructions/all",
|
|
1228
|
+
method: HttpMethod.Get,
|
|
1229
|
+
data: requestBody,
|
|
1230
|
+
schema: instructionsSchema
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
async build(requestBody) {
|
|
1234
|
+
return await this.makeRequest({
|
|
1235
|
+
url: "/instruction/build",
|
|
1236
|
+
method: HttpMethod.Post,
|
|
1237
|
+
data: requestBody,
|
|
1238
|
+
schema: instructionBuildSchema
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
async activate(requestBody) {
|
|
1242
|
+
return await this.makeRequest({
|
|
1243
|
+
url: "/instruction/new",
|
|
1244
|
+
method: HttpMethod.Post,
|
|
1245
|
+
data: requestBody,
|
|
1246
|
+
schema: instructionActivateResponseSchema
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
async deactivate(requestBody) {
|
|
1250
|
+
return await this.makeRequest({
|
|
1251
|
+
url: "/instruction/deactivate",
|
|
1252
|
+
method: HttpMethod.Post,
|
|
1253
|
+
data: requestBody,
|
|
1254
|
+
schema: instructionDeactivateResponseSchema
|
|
1255
|
+
});
|
|
1256
|
+
}
|
|
1257
|
+
async details(requestBody) {
|
|
1258
|
+
return await this.makeRequest({
|
|
1259
|
+
url: "/instruction/details",
|
|
1260
|
+
method: HttpMethod.Get,
|
|
1261
|
+
data: requestBody,
|
|
1262
|
+
schema: instructionDetailsResponseSchema
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
async rules(requestBody) {
|
|
1266
|
+
return this.makePaginatedRequest({
|
|
1267
|
+
url: "/instructions/rules",
|
|
1268
|
+
method: HttpMethod.Get,
|
|
1269
|
+
data: requestBody,
|
|
1270
|
+
schema: instructionGetRulesResponseSchema
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1579
1273
|
};
|
|
1580
1274
|
|
|
1581
|
-
|
|
1275
|
+
//#endregion
|
|
1276
|
+
//#region src/api/services/transaction.ts
|
|
1582
1277
|
var TransactionService = class extends BaseService {
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1278
|
+
async list(requestBody) {
|
|
1279
|
+
return this.makePaginatedRequest({
|
|
1280
|
+
url: "/transactions",
|
|
1281
|
+
method: HttpMethod.Get,
|
|
1282
|
+
data: requestBody,
|
|
1283
|
+
schema: transactionGetListResponseSchema
|
|
1284
|
+
});
|
|
1285
|
+
}
|
|
1591
1286
|
};
|
|
1592
1287
|
|
|
1593
|
-
|
|
1288
|
+
//#endregion
|
|
1289
|
+
//#region src/api/services/payments.ts
|
|
1594
1290
|
var PaymentsService = class extends BaseService {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1291
|
+
async getOutgoingPaymentsList(request) {
|
|
1292
|
+
return this.makePaginatedRequest({
|
|
1293
|
+
url: "/api/payments/outgoing",
|
|
1294
|
+
method: HttpMethod.Get,
|
|
1295
|
+
data: request,
|
|
1296
|
+
schema: PaymentsSchema
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
async getIncomingPaymentsList(request) {
|
|
1300
|
+
return this.makePaginatedRequest({
|
|
1301
|
+
url: "/api/payments/incoming",
|
|
1302
|
+
method: HttpMethod.Get,
|
|
1303
|
+
data: request,
|
|
1304
|
+
schema: PaymentsSchema
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
async buildPaymentRequest(requestBody) {
|
|
1308
|
+
return this.makeRequest({
|
|
1309
|
+
url: "/orchestration/build",
|
|
1310
|
+
method: HttpMethod.Post,
|
|
1311
|
+
data: requestBody,
|
|
1312
|
+
schema: paymentRequestBuildResponseSchema
|
|
1313
|
+
});
|
|
1314
|
+
}
|
|
1315
|
+
async newPaymentRequest(requestBody) {
|
|
1316
|
+
return this.makeRequest({
|
|
1317
|
+
url: "/orchestration/new",
|
|
1318
|
+
method: HttpMethod.Post,
|
|
1319
|
+
data: requestBody,
|
|
1320
|
+
validateResponse: () => true
|
|
1321
|
+
});
|
|
1322
|
+
}
|
|
1323
|
+
async getPaymentRequestDetails(requestBody) {
|
|
1324
|
+
return this.makeRequest({
|
|
1325
|
+
url: "/orchestration/details",
|
|
1326
|
+
method: HttpMethod.Get,
|
|
1327
|
+
data: requestBody,
|
|
1328
|
+
schema: paymentRequestDetailsResponseSchema
|
|
1329
|
+
});
|
|
1330
|
+
}
|
|
1331
|
+
async getPaymentRequests(request) {
|
|
1332
|
+
return this.makePaginatedRequest({
|
|
1333
|
+
url: "/orchestrations",
|
|
1334
|
+
method: HttpMethod.Get,
|
|
1335
|
+
data: request,
|
|
1336
|
+
schema: getPaymentRequestsResponseSchema
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
async buildSettlementOrchestration(requestBody) {
|
|
1340
|
+
return this.makeRequest({
|
|
1341
|
+
url: "/orchestration/build/settlement",
|
|
1342
|
+
method: HttpMethod.Post,
|
|
1343
|
+
data: requestBody,
|
|
1344
|
+
schema: buildSettlementResponseSchema
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1651
1347
|
};
|
|
1652
1348
|
|
|
1653
|
-
|
|
1654
|
-
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region src/api/services/integration.ts
|
|
1655
1351
|
function createEmptyIntegrationResponse(integrationType) {
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1352
|
+
switch (integrationType) {
|
|
1353
|
+
case IntegrationType.QuickBooks: return {
|
|
1354
|
+
integrationType: IntegrationType.QuickBooks,
|
|
1355
|
+
details: {}
|
|
1356
|
+
};
|
|
1357
|
+
case IntegrationType.Bank: return {
|
|
1358
|
+
integrationType: IntegrationType.Bank,
|
|
1359
|
+
details: {}
|
|
1360
|
+
};
|
|
1361
|
+
case IntegrationType.Clio: return {
|
|
1362
|
+
integrationType: IntegrationType.Clio,
|
|
1363
|
+
details: {}
|
|
1364
|
+
};
|
|
1365
|
+
case IntegrationType.Stripe: return {
|
|
1366
|
+
integrationType: IntegrationType.Stripe,
|
|
1367
|
+
details: {}
|
|
1368
|
+
};
|
|
1369
|
+
case IntegrationType.Bill: return {
|
|
1370
|
+
integrationType: IntegrationType.Bill,
|
|
1371
|
+
details: {}
|
|
1372
|
+
};
|
|
1373
|
+
case IntegrationType.Zoho: return {
|
|
1374
|
+
integrationType: IntegrationType.Zoho,
|
|
1375
|
+
details: {}
|
|
1376
|
+
};
|
|
1377
|
+
default: return {
|
|
1378
|
+
integrationType: IntegrationType.Bank,
|
|
1379
|
+
details: {}
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1672
1382
|
}
|
|
1673
1383
|
var IntegrationService = class extends BaseService {
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
request.integrationType
|
|
1696
|
-
);
|
|
1697
|
-
return { data: defaultResponse };
|
|
1698
|
-
}
|
|
1699
|
-
throw error;
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1384
|
+
async upsert(request) {
|
|
1385
|
+
return this.makeRequest({
|
|
1386
|
+
url: "/integration",
|
|
1387
|
+
method: HttpMethod.Put,
|
|
1388
|
+
data: request,
|
|
1389
|
+
schema: integrationResponseSchema
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
async get(request) {
|
|
1393
|
+
try {
|
|
1394
|
+
return await this.makeRequest({
|
|
1395
|
+
url: "/integration/get",
|
|
1396
|
+
method: HttpMethod.Post,
|
|
1397
|
+
data: request,
|
|
1398
|
+
schema: integrationResponseSchema
|
|
1399
|
+
});
|
|
1400
|
+
} catch (error) {
|
|
1401
|
+
if (axios.isAxiosError(error) && error.response?.status === 404) return { data: createEmptyIntegrationResponse(request.integrationType) };
|
|
1402
|
+
throw error;
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1702
1405
|
};
|
|
1703
1406
|
|
|
1704
|
-
|
|
1407
|
+
//#endregion
|
|
1408
|
+
//#region src/api/services/operating-account.ts
|
|
1705
1409
|
var OperatingAccountService = class extends BaseService {
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
return res;
|
|
1721
|
-
}
|
|
1410
|
+
async createSubOrganization() {
|
|
1411
|
+
return await this.makeRequest({
|
|
1412
|
+
url: "/operating_accounts/sub_organization/new",
|
|
1413
|
+
method: HttpMethod.Post,
|
|
1414
|
+
schema: newOperatingAccountSubOrgResponseSchema
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
async getSubOrganization() {
|
|
1418
|
+
return await this.makeRequest({
|
|
1419
|
+
url: "/operating_accounts/sub_organization",
|
|
1420
|
+
method: HttpMethod.Get,
|
|
1421
|
+
schema: getOperatingAccountSubOrgResponseSchema
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1722
1424
|
};
|
|
1723
1425
|
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
constructor() {
|
|
1727
|
-
super(...arguments);
|
|
1728
|
-
__publicField(this, "UNISWAP_TOKEN_LIST_URL", "https://ipfs.io/ipns/tokens.uniswap.org");
|
|
1729
|
-
__publicField(this, "FALLBACK_URL", "https://tokens.uniswap.org/");
|
|
1730
|
-
__publicField(this, "CACHE_DURATION", 30 * 60 * 1e3);
|
|
1731
|
-
// 30 minutes
|
|
1732
|
-
__publicField(this, "SUPPORTED_CHAIN_IDS", [1, 10, 42161, 8453]);
|
|
1733
|
-
// mainnet, optimism, arbitrum, base
|
|
1734
|
-
__publicField(this, "tokenListCache", null);
|
|
1735
|
-
__publicField(this, "lastFetch", 0);
|
|
1736
|
-
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Get tokens for a specific chain
|
|
1739
|
-
*/
|
|
1740
|
-
async getTokensForChain({
|
|
1741
|
-
chainId,
|
|
1742
|
-
limit = 50
|
|
1743
|
-
}) {
|
|
1744
|
-
try {
|
|
1745
|
-
const tokenList = await this.fetchTokenList();
|
|
1746
|
-
if (!this.SUPPORTED_CHAIN_IDS.includes(chainId)) {
|
|
1747
|
-
return {
|
|
1748
|
-
data: {
|
|
1749
|
-
tokens: [],
|
|
1750
|
-
source: "uniswap",
|
|
1751
|
-
timestamp: tokenList.timestamp
|
|
1752
|
-
}
|
|
1753
|
-
};
|
|
1754
|
-
}
|
|
1755
|
-
const chainTokens = tokenList.tokens.filter(
|
|
1756
|
-
(token) => token.chainId === chainId
|
|
1757
|
-
);
|
|
1758
|
-
const filteredTokens = chainTokens.filter((token) => {
|
|
1759
|
-
const suspiciousPatterns = [
|
|
1760
|
-
/test/i,
|
|
1761
|
-
/fake/i,
|
|
1762
|
-
/scam/i,
|
|
1763
|
-
/shit/i,
|
|
1764
|
-
/moon/i,
|
|
1765
|
-
/doge/i,
|
|
1766
|
-
/inu/i,
|
|
1767
|
-
/baby/i,
|
|
1768
|
-
/mini/i,
|
|
1769
|
-
/micro/i,
|
|
1770
|
-
/nano/i,
|
|
1771
|
-
/pico/i,
|
|
1772
|
-
/mega/i,
|
|
1773
|
-
/ultra/i,
|
|
1774
|
-
/super/i,
|
|
1775
|
-
/hyper/i,
|
|
1776
|
-
/meta/i,
|
|
1777
|
-
/safe/i,
|
|
1778
|
-
/new/i,
|
|
1779
|
-
/old/i,
|
|
1780
|
-
/v2/i,
|
|
1781
|
-
/v3/i,
|
|
1782
|
-
/v4/i,
|
|
1783
|
-
/v5/i,
|
|
1784
|
-
/2\.0/i,
|
|
1785
|
-
/3\.0/i,
|
|
1786
|
-
/4\.0/i,
|
|
1787
|
-
/5\.0/i
|
|
1788
|
-
];
|
|
1789
|
-
const name = token.name?.toLowerCase() || "";
|
|
1790
|
-
const symbol = token.symbol?.toLowerCase() || "";
|
|
1791
|
-
if (suspiciousPatterns.some(
|
|
1792
|
-
(pattern) => pattern.test(name) || pattern.test(symbol)
|
|
1793
|
-
)) {
|
|
1794
|
-
return false;
|
|
1795
|
-
}
|
|
1796
|
-
if (name.length < 2 || name.length > 50) return false;
|
|
1797
|
-
if (symbol.length < 2 || symbol.length > 20) return false;
|
|
1798
|
-
if (!token.name || !token.symbol || !token.address) return false;
|
|
1799
|
-
return true;
|
|
1800
|
-
});
|
|
1801
|
-
const limitedTokens = filteredTokens.slice(0, limit);
|
|
1802
|
-
return {
|
|
1803
|
-
data: {
|
|
1804
|
-
tokens: limitedTokens,
|
|
1805
|
-
source: "uniswap",
|
|
1806
|
-
timestamp: tokenList.timestamp
|
|
1807
|
-
}
|
|
1808
|
-
};
|
|
1809
|
-
} catch (error) {
|
|
1810
|
-
throw new Error(error instanceof Error ? error.message : "Unknown error");
|
|
1811
|
-
}
|
|
1812
|
-
}
|
|
1813
|
-
/**
|
|
1814
|
-
* Get all supported chains from the token list
|
|
1815
|
-
*/
|
|
1816
|
-
async getSupportedChains() {
|
|
1817
|
-
try {
|
|
1818
|
-
const tokenList = await this.fetchTokenList();
|
|
1819
|
-
const chainIds = Array.from(
|
|
1820
|
-
new Set(tokenList.tokens.map((token) => token.chainId))
|
|
1821
|
-
).sort((a, b) => a - b);
|
|
1822
|
-
return {
|
|
1823
|
-
data: chainIds
|
|
1824
|
-
};
|
|
1825
|
-
} catch (error) {
|
|
1826
|
-
throw new Error(error instanceof Error ? error.message : "Unknown error");
|
|
1827
|
-
}
|
|
1828
|
-
}
|
|
1829
|
-
/**
|
|
1830
|
-
* Search for a specific token by address or symbol
|
|
1831
|
-
*/
|
|
1832
|
-
async findToken(chainId, query) {
|
|
1833
|
-
try {
|
|
1834
|
-
const tokenList = await this.fetchTokenList();
|
|
1835
|
-
const token = tokenList.tokens.find(
|
|
1836
|
-
(t) => t.chainId === chainId && (t.address.toLowerCase() === query.toLowerCase() || t.symbol.toLowerCase() === query.toLowerCase() || t.name.toLowerCase().includes(query.toLowerCase()))
|
|
1837
|
-
);
|
|
1838
|
-
return {
|
|
1839
|
-
data: token || null
|
|
1840
|
-
};
|
|
1841
|
-
} catch (error) {
|
|
1842
|
-
throw new Error(error instanceof Error ? error.message : "Unknown error");
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
/**
|
|
1846
|
-
* Get bridge information for a token
|
|
1847
|
-
*/
|
|
1848
|
-
async getBridgeInfo(chainId, tokenAddress) {
|
|
1849
|
-
try {
|
|
1850
|
-
const tokenList = await this.fetchTokenList();
|
|
1851
|
-
const token = tokenList.tokens.find(
|
|
1852
|
-
(t) => t.chainId === chainId && t.address.toLowerCase() === tokenAddress.toLowerCase()
|
|
1853
|
-
);
|
|
1854
|
-
if (!token || !token.extensions?.bridgeInfo) {
|
|
1855
|
-
return {
|
|
1856
|
-
data: {}
|
|
1857
|
-
};
|
|
1858
|
-
}
|
|
1859
|
-
const bridgeInfo = {};
|
|
1860
|
-
for (const [targetChainId, info] of Object.entries(
|
|
1861
|
-
token.extensions.bridgeInfo
|
|
1862
|
-
)) {
|
|
1863
|
-
bridgeInfo[targetChainId] = info.tokenAddress;
|
|
1864
|
-
}
|
|
1865
|
-
return {
|
|
1866
|
-
data: bridgeInfo
|
|
1867
|
-
};
|
|
1868
|
-
} catch (error) {
|
|
1869
|
-
throw new Error(error instanceof Error ? error.message : "Unknown error");
|
|
1870
|
-
}
|
|
1871
|
-
}
|
|
1872
|
-
/**
|
|
1873
|
-
* Fetch the Uniswap token list
|
|
1874
|
-
*/
|
|
1875
|
-
async fetchTokenList() {
|
|
1876
|
-
const now = Date.now();
|
|
1877
|
-
if (this.tokenListCache && now - this.lastFetch < this.CACHE_DURATION) {
|
|
1878
|
-
return this.tokenListCache;
|
|
1879
|
-
}
|
|
1880
|
-
try {
|
|
1881
|
-
const response = await fetch(this.UNISWAP_TOKEN_LIST_URL, {
|
|
1882
|
-
headers: {
|
|
1883
|
-
Accept: "application/json"
|
|
1884
|
-
}
|
|
1885
|
-
});
|
|
1886
|
-
if (!response.ok) {
|
|
1887
|
-
throw new Error(`IPFS fetch failed: ${response.status}`);
|
|
1888
|
-
}
|
|
1889
|
-
const data = await response.json();
|
|
1890
|
-
this.tokenListCache = data;
|
|
1891
|
-
this.lastFetch = now;
|
|
1892
|
-
return data;
|
|
1893
|
-
} catch (error) {
|
|
1894
|
-
logger.logError(error, {
|
|
1895
|
-
context: this.fetchTokenList.name
|
|
1896
|
-
});
|
|
1897
|
-
try {
|
|
1898
|
-
const response = await fetch(this.FALLBACK_URL, {
|
|
1899
|
-
headers: {
|
|
1900
|
-
Accept: "application/json"
|
|
1901
|
-
}
|
|
1902
|
-
});
|
|
1903
|
-
if (!response.ok) {
|
|
1904
|
-
throw new Error(`Fallback fetch failed: ${response.status}`);
|
|
1905
|
-
}
|
|
1906
|
-
const data = await response.json();
|
|
1907
|
-
this.tokenListCache = data;
|
|
1908
|
-
this.lastFetch = now;
|
|
1909
|
-
return data;
|
|
1910
|
-
} catch (fallbackError) {
|
|
1911
|
-
logger.logError(fallbackError, {
|
|
1912
|
-
context: this.fetchTokenList.name
|
|
1913
|
-
});
|
|
1914
|
-
throw new Error("Unable to fetch Uniswap token list");
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
}
|
|
1918
|
-
};
|
|
1919
|
-
|
|
1920
|
-
// src/api/api.ts
|
|
1426
|
+
//#endregion
|
|
1427
|
+
//#region src/api/api.ts
|
|
1921
1428
|
var APIClient = class {
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1429
|
+
constructor(init) {
|
|
1430
|
+
_defineProperty(this, "account", void 0);
|
|
1431
|
+
_defineProperty(this, "activity", void 0);
|
|
1432
|
+
_defineProperty(this, "auth", void 0);
|
|
1433
|
+
_defineProperty(this, "operatingAccount", void 0);
|
|
1434
|
+
_defineProperty(this, "config", void 0);
|
|
1435
|
+
_defineProperty(this, "contacts", void 0);
|
|
1436
|
+
_defineProperty(this, "developer", void 0);
|
|
1437
|
+
_defineProperty(this, "instruction", void 0);
|
|
1438
|
+
_defineProperty(this, "transaction", void 0);
|
|
1439
|
+
_defineProperty(this, "payments", void 0);
|
|
1440
|
+
_defineProperty(this, "integration", void 0);
|
|
1441
|
+
const instance = isInstanceInit(init) ? init.instance : createInstance({
|
|
1442
|
+
...init,
|
|
1443
|
+
baseURL: init?.environment ? getOffchainApiUrl(init.environment) : init?.baseURL
|
|
1444
|
+
});
|
|
1445
|
+
this.account = new AccountService(instance);
|
|
1446
|
+
this.activity = new ActivityService(instance);
|
|
1447
|
+
this.auth = new AuthService(instance);
|
|
1448
|
+
this.config = new ConfigService(instance);
|
|
1449
|
+
this.contacts = new ContactsService(instance);
|
|
1450
|
+
this.developer = new DeveloperService(instance);
|
|
1451
|
+
this.instruction = new InstructionService(instance);
|
|
1452
|
+
this.integration = new IntegrationService(instance);
|
|
1453
|
+
this.transaction = new TransactionService(instance);
|
|
1454
|
+
this.operatingAccount = new OperatingAccountService(instance);
|
|
1455
|
+
this.payments = new PaymentsService(instance);
|
|
1456
|
+
}
|
|
1947
1457
|
};
|
|
1948
|
-
|
|
1949
|
-
|
|
1458
|
+
const createAPIClient = (...params) => {
|
|
1459
|
+
return new APIClient(...params);
|
|
1950
1460
|
};
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
buildSettlementResponseSchema,
|
|
1983
|
-
calculateHasMore,
|
|
1984
|
-
chainIdSchema,
|
|
1985
|
-
chainSuccessResponseSchema,
|
|
1986
|
-
contactSchema,
|
|
1987
|
-
createAPIClient,
|
|
1988
|
-
createAbortController,
|
|
1989
|
-
createInstance,
|
|
1990
|
-
delegationCreateRequestSchema,
|
|
1991
|
-
delegationCreateResponseSchema,
|
|
1992
|
-
delegationStatusRequestSchema,
|
|
1993
|
-
delegationStatusResponseSchema,
|
|
1994
|
-
delegationStatusSchema,
|
|
1995
|
-
delegationStatusValues,
|
|
1996
|
-
errorResponseSchema,
|
|
1997
|
-
extractPaginationParams,
|
|
1998
|
-
feeResponseSchema2 as feeResponseSchema,
|
|
1999
|
-
getConfigChainsResponseSchema,
|
|
2000
|
-
getConfigTokensRequestParametersSchema,
|
|
2001
|
-
getConfigTokensResponseSchema,
|
|
2002
|
-
getContactsRequestSchema,
|
|
2003
|
-
getContactsResponseSchema,
|
|
2004
|
-
getCurrentUserResponseSchema,
|
|
2005
|
-
getDefaultPagination,
|
|
2006
|
-
getDelegateAddressResponseSchema,
|
|
2007
|
-
getDelegateAddressSchema,
|
|
2008
|
-
getErrorMessage,
|
|
2009
|
-
getErrorMessageWithCode,
|
|
2010
|
-
getInstructionActivityRequestSchema,
|
|
2011
|
-
getInstructionActivityResponseSchema,
|
|
2012
|
-
getIntegrationRequestSchema,
|
|
2013
|
-
getMaxPriorityFeePerGasEstimateResponseSchema,
|
|
2014
|
-
getMaxPriorityFeePerGasEstimateSchema,
|
|
2015
|
-
getOperatingAccountSubOrgResponseSchema,
|
|
2016
|
-
getPaymentRequestsRequestSchema,
|
|
2017
|
-
getPaymentRequestsResponseSchema,
|
|
2018
|
-
getUserFriendlyErrorMessage,
|
|
2019
|
-
instructionActivateRequestSchema,
|
|
2020
|
-
instructionActivateResponseSchema,
|
|
2021
|
-
instructionBuildRequestSchema,
|
|
2022
|
-
instructionBuildSchema,
|
|
2023
|
-
instructionDeactivateRequestSchema,
|
|
2024
|
-
instructionDeactivateResponseSchema,
|
|
2025
|
-
instructionDetailsRequestSchema,
|
|
2026
|
-
instructionDetailsResponseSchema,
|
|
2027
|
-
instructionGetAllRequestSchema,
|
|
2028
|
-
instructionGetAllResponseSchema,
|
|
2029
|
-
instructionGetRulesRequestSchema,
|
|
2030
|
-
instructionGetRulesResponseSchema,
|
|
2031
|
-
integrationResponseSchema,
|
|
2032
|
-
integrationTypeSchema,
|
|
2033
|
-
integrationTypeValues,
|
|
2034
|
-
isInstanceInit,
|
|
2035
|
-
isTechnicalError,
|
|
2036
|
-
isUserAddressableError,
|
|
2037
|
-
isUserRejectionError,
|
|
2038
|
-
meResponseSchema,
|
|
2039
|
-
newContactRequestSchema,
|
|
2040
|
-
newInstructionRequestSchema,
|
|
2041
|
-
newOperatingAccountSubOrgResponseSchema,
|
|
2042
|
-
paymentRequestBuildRequestSchema,
|
|
2043
|
-
paymentRequestBuildResponseSchema,
|
|
2044
|
-
paymentRequestDetailsRequestSchema,
|
|
2045
|
-
paymentRequestDetailsResponseSchema,
|
|
2046
|
-
paymentRequestNewRequestSchema,
|
|
2047
|
-
paymentRequestSchema,
|
|
2048
|
-
paymentRequestStatusSchema,
|
|
2049
|
-
paymentRequestsDirectionSchema,
|
|
2050
|
-
sessionTokenRequestSchema,
|
|
2051
|
-
sessionTokenResponseSchema,
|
|
2052
|
-
sessionVerifyResponseSchema,
|
|
2053
|
-
setChainIdSchema,
|
|
2054
|
-
transactionGetListRequestSchema,
|
|
2055
|
-
transactionGetListResponseSchema,
|
|
2056
|
-
turnkeyLoginRequestSchema,
|
|
2057
|
-
turnkeyLoginResponseSchema,
|
|
2058
|
-
turnkeyVerificationRequestSchema,
|
|
2059
|
-
turnkeyVerificationResponseSchema,
|
|
2060
|
-
updateIntegrationRequestSchema,
|
|
2061
|
-
whitelistCheckRequestSchema,
|
|
2062
|
-
whitelistCheckResponseSchema
|
|
1461
|
+
|
|
1462
|
+
//#endregion
|
|
1463
|
+
//#region src/api/result.ts
|
|
1464
|
+
function success(data) {
|
|
1465
|
+
return {
|
|
1466
|
+
success: true,
|
|
1467
|
+
data
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
function failure(error, code) {
|
|
1471
|
+
return {
|
|
1472
|
+
success: false,
|
|
1473
|
+
error,
|
|
1474
|
+
code
|
|
1475
|
+
};
|
|
1476
|
+
}
|
|
1477
|
+
function isSuccess(result) {
|
|
1478
|
+
return result.success === true;
|
|
1479
|
+
}
|
|
1480
|
+
function isFailure(result) {
|
|
1481
|
+
return result.success === false;
|
|
1482
|
+
}
|
|
1483
|
+
const ErrorCode = {
|
|
1484
|
+
NetworkError: "NETWORK_ERROR",
|
|
1485
|
+
Unauthorized: "UNAUTHORIZED",
|
|
1486
|
+
AuthenticationFailed: "AUTH_FAILED",
|
|
1487
|
+
MissingParameter: "MISSING_PARAMETER",
|
|
1488
|
+
Forbidden: "FORBIDDEN",
|
|
1489
|
+
SessionExpired: "SESSION_EXPIRED",
|
|
1490
|
+
InvalidInput: "INVALID_INPUT",
|
|
1491
|
+
UnknownError: "UNKNOWN_ERROR"
|
|
2063
1492
|
};
|
|
2064
|
-
|
|
1493
|
+
|
|
1494
|
+
//#endregion
|
|
1495
|
+
export { APIClient, AccountService, ActivityService, AuthService, ConfigService, ContactsService, DelegationStatus, DeveloperService, ErrorCode, HttpMethod, InstructionService, IntegrationService, IntegrationType, OperatingAccountService, PaymentsService, ServiceError, TransactionService, actionArgumentsResponseSchema, actionArgumentsSchema, actionNameSchema, activityDataSchema, activityRecordSchema, addressWhitelistCheckRequestSchema, addressWhitelistCheckResponseSchema, apiErrorSchema, attestationSchema, authLoginRequestSchema, authLoginResponseSchema, buildEphemeralInstructionSchema, buildSettlementRequestSchema, buildSettlementResponseSchema, calculateBackoffInterval, calculateHasMore, chainIdSchema, chainSuccessResponseSchema, contactSchema, createAPIClient, createAbortController, createInstance, delegationCreateRequestSchema, delegationCreateResponseSchema, delegationStatusRequestSchema, delegationStatusResponseSchema, delegationStatusSchema, delegationStatusValues, errorResponseSchema, extractPaginationParams, failure, feeResponseSchema, formatActionName, formatPaymentRail, getConfigChainsResponseSchema, getConfigTokensRequestParametersSchema, getConfigTokensResponseSchema, getContactsRequestSchema, getContactsResponseSchema, getDefaultPagination, getDelegateAddressResponseSchema, getDelegateAddressSchema, getErrorMessage, getErrorMessageWithCode, getInstructionActivityRequestSchema, getInstructionActivityResponseSchema, getIntegrationRequestSchema, getMaxPriorityFeePerGasEstimateResponseSchema, getMaxPriorityFeePerGasEstimateSchema, getOperatingAccountSubOrgResponseSchema, getPaymentRequestsRequestSchema, getPaymentRequestsResponseSchema, getUserFriendlyErrorMessage, instructionActivateRequestSchema, instructionActivateResponseSchema, instructionBuildRequestSchema, instructionBuildSchema, instructionDeactivateRequestSchema, instructionDeactivateResponseSchema, instructionDetailsRequestSchema, instructionDetailsResponseSchema, instructionGetAllRequestSchema, instructionGetAllResponseSchema, instructionGetRulesRequestSchema, instructionGetRulesResponseSchema, integrationResponseSchema, integrationTypeSchema, integrationTypeValues, isFailure, isInstanceInit, isSuccess, isTechnicalError, isUserAddressableError, isUserRejectionError, meResponseSchema, newContactRequestSchema, newInstructionRequestSchema, newOperatingAccountSubOrgResponseSchema, orchestrationTypeSchema, paymentRequestBuildRequestSchema, paymentRequestBuildResponseSchema, paymentRequestDetailsRequestSchema, paymentRequestDetailsResponseSchema, paymentRequestNewRequestSchema, paymentRequestSchema, paymentRequestStatusSchema, paymentRequestsDirectionSchema, sessionTokenRequestSchema, sessionTokenResponseSchema, sessionVerifyResponseSchema, setChainIdSchema, success, transactionGetListRequestSchema, transactionGetListResponseSchema, turnkeyLoginRequestSchema, turnkeyLoginResponseSchema, turnkeyVerificationRequestSchema, turnkeyVerificationResponseSchema, updateIntegrationRequestSchema, whitelistCheckRequestSchema, whitelistCheckResponseSchema };
|
|
1496
|
+
//# sourceMappingURL=index.mjs.map
|