@argent/x-shared 1.37.0 → 1.38.1
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/.eslintrc.d.cts +45 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/semver.cjs +1 -0
- package/dist/_virtual/semver.js +4 -0
- package/dist/commitlint.config.d.cts +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -19
- package/dist/index.js +424 -4
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +14 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.js +88 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +203 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js +68 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js +166 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +581 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.js +48 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.js +4 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js +42 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js +47 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js +31 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js +61 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js +21 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js +114 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +107 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js +38 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js +32 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js +21 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +107 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js +44 -0
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -0
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +622 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js +10 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js +16 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.js +33 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +15 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js +17 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js +12 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js +7 -0
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -0
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +134 -0
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs +1 -0
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js +629 -0
- package/dist/simulation.cjs +1 -0
- package/dist/simulation.d.ts +1 -1
- package/dist/simulation.js +69 -1
- package/dist/src/account/account.model.cjs +1 -0
- package/dist/src/account/account.model.js +45 -0
- package/dist/src/account/accountv4.cjs +1 -0
- package/dist/src/account/accountv4.js +14 -0
- package/dist/src/account/preferences.model.cjs +1 -0
- package/dist/src/account/preferences.model.js +11 -0
- package/dist/src/assets/tokens.json.cjs +1 -0
- package/dist/src/assets/tokens.json.js +181 -0
- package/dist/src/backend/schema.cjs +1 -0
- package/dist/src/backend/schema.js +14 -0
- package/dist/src/bigdecimal/constants.cjs +1 -0
- package/dist/src/bigdecimal/constants.js +4 -0
- package/dist/src/bigdecimal/createUnitsSchema.cjs +1 -0
- package/dist/src/bigdecimal/createUnitsSchema.js +8 -0
- package/dist/src/bigdecimal/formatUnits.cjs +1 -0
- package/dist/src/bigdecimal/formatUnits.js +11 -0
- package/dist/src/bigdecimal/index.cjs +1 -0
- package/dist/src/bigdecimal/index.js +33 -0
- package/dist/src/bigdecimal/lib.cjs +1 -0
- package/dist/src/bigdecimal/lib.js +53 -0
- package/dist/src/bigdecimal/parseUnits.cjs +1 -0
- package/dist/src/bigdecimal/parseUnits.js +11 -0
- package/dist/src/bigdecimal/utils.cjs +1 -0
- package/dist/src/bigdecimal/utils.js +37 -0
- package/dist/src/cache/CacheService.cjs +1 -0
- package/dist/src/cache/CacheService.js +37 -0
- package/dist/src/chains/starknet/address.cjs +1 -0
- package/dist/src/chains/starknet/address.js +64 -0
- package/dist/src/chains/starknet/addressDomain.cjs +1 -0
- package/dist/src/chains/starknet/addressDomain.js +29 -0
- package/dist/src/chains/starknet/addressInput.cjs +1 -0
- package/dist/src/chains/starknet/addressInput.js +7 -0
- package/dist/src/chains/starknet/argentName.cjs +1 -0
- package/dist/src/chains/starknet/argentName.js +14 -0
- package/dist/src/chains/starknet/cairoVersionSchema.cjs +1 -0
- package/dist/src/chains/starknet/cairoVersionSchema.js +5 -0
- package/dist/src/chains/starknet/constants.cjs +1 -0
- package/dist/src/chains/starknet/constants.js +10 -0
- package/dist/src/chains/starknet/getAddressFromArgentName.cjs +1 -0
- package/dist/src/chains/starknet/getAddressFromArgentName.js +48 -0
- package/dist/src/chains/starknet/getAddressFromStarkName.cjs +1 -0
- package/dist/src/chains/starknet/getAddressFromStarkName.js +70 -0
- package/dist/src/chains/starknet/network.cjs +1 -0
- package/dist/src/chains/starknet/network.js +20 -0
- package/dist/src/chains/starknet/services/address/StarknetAddressService.cjs +1 -0
- package/dist/src/chains/starknet/services/address/StarknetAddressService.js +38 -0
- package/dist/src/chains/starknet/services/deploymentData/constants.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/constants.js +22 -0
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.js +19 -0
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +69 -0
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +59 -0
- package/dist/src/chains/starknet/starknetId.cjs +1 -0
- package/dist/src/chains/starknet/starknetId.js +14 -0
- package/dist/src/errors/account.cjs +1 -0
- package/dist/src/errors/account.js +14 -0
- package/dist/src/errors/address.cjs +1 -0
- package/dist/src/errors/address.js +14 -0
- package/dist/src/errors/baseErrors.cjs +1 -0
- package/dist/src/errors/baseErrors.js +15 -0
- package/dist/src/errors/call.cjs +1 -0
- package/dist/src/errors/call.js +14 -0
- package/dist/src/errors/network.cjs +1 -0
- package/dist/src/errors/network.js +14 -0
- package/dist/src/errors/review.cjs +1 -0
- package/dist/src/errors/review.js +14 -0
- package/dist/src/errors/swap.cjs +1 -0
- package/dist/src/errors/swap.js +14 -0
- package/dist/src/features/simulation/activity/normalize.cjs +1 -0
- package/dist/src/features/simulation/activity/normalize.js +40 -0
- package/dist/src/features/simulation/activity/schema.cjs +1 -0
- package/dist/src/features/simulation/activity/schema.js +236 -0
- package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/createNativeActivity.js +31 -0
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +24 -0
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.js +6 -0
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +10 -0
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +11 -0
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +26 -0
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +22 -0
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.js +13 -0
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.js +33 -0
- package/dist/src/features/simulation/fees/schema.cjs +1 -0
- package/dist/src/features/simulation/fees/schema.js +20 -0
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +18 -0
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.js +6 -0
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/schema.js +215 -0
- package/dist/src/features/simulation/warning/helper.cjs +1 -0
- package/dist/src/features/simulation/warning/helper.js +12 -0
- package/dist/src/features/simulation/warning/schema.cjs +1 -0
- package/dist/src/features/simulation/warning/schema.js +11 -0
- package/dist/src/features/swap/models/order.model.cjs +1 -0
- package/dist/src/features/swap/models/order.model.js +20 -0
- package/dist/src/features/swap/models/quote.model.cjs +1 -0
- package/dist/src/features/swap/models/quote.model.js +36 -0
- package/dist/src/features/swap/models/trade.model.cjs +1 -0
- package/dist/src/features/swap/models/trade.model.js +28 -0
- package/dist/src/features/swap/services/implementation.cjs +1 -0
- package/dist/src/features/swap/services/implementation.js +76 -0
- package/dist/src/features/swap/utils/slippage.cjs +1 -0
- package/dist/src/features/swap/utils/slippage.js +28 -0
- package/dist/src/features/swap/utils/totalFee.cjs +1 -0
- package/dist/src/features/swap/utils/totalFee.js +13 -0
- package/dist/src/http/DateService.cjs +1 -0
- package/dist/src/http/DateService.js +17 -0
- package/dist/src/http/HttpError.cjs +1 -0
- package/dist/src/http/HttpError.js +8 -0
- package/dist/src/http/HttpService.cjs +1 -0
- package/dist/src/http/HttpService.js +90 -0
- package/dist/src/http/IHttpService.cjs +1 -0
- package/dist/src/http/IHttpService.js +7 -0
- package/dist/src/http/SWRService.cjs +1 -0
- package/dist/src/http/SWRService.js +60 -0
- package/dist/src/http/fetcher.cjs +1 -0
- package/dist/src/http/fetcher.js +36 -0
- package/dist/{http → src/http}/index.d.ts +0 -1
- package/dist/src/http/time.cjs +1 -0
- package/dist/src/http/time.js +19 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/knownDapps/KnownDappsBackendService.cjs +1 -0
- package/dist/src/knownDapps/KnownDappsBackendService.js +16 -0
- package/dist/src/knownDapps/schema.cjs +1 -0
- package/dist/src/knownDapps/schema.js +44 -0
- package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -0
- package/dist/src/knownDapps/utils/getDapplandUrl.js +12 -0
- package/dist/src/nameResolution/ResolveNameService.cjs +1 -0
- package/dist/src/nameResolution/ResolveNameService.js +42 -0
- package/dist/src/nameResolution/schema.cjs +1 -0
- package/dist/src/nameResolution/schema.js +25 -0
- package/dist/src/nfts/BackendNftService.cjs +1 -0
- package/dist/src/nfts/BackendNftService.js +119 -0
- package/dist/src/nfts/BackendPaginationError.cjs +1 -0
- package/dist/src/nfts/BackendPaginationError.js +13 -0
- package/dist/{nfts → src/nfts}/index.d.ts +0 -1
- package/dist/src/nfts/utils.cjs +1 -0
- package/dist/src/nfts/utils.js +14 -0
- package/dist/src/onchainRecovery/OnchainRecoveryService.cjs +1 -0
- package/dist/src/onchainRecovery/OnchainRecoveryService.js +69 -0
- package/dist/src/onchainRecovery/schema.cjs +1 -0
- package/dist/src/onchainRecovery/schema.js +49 -0
- package/dist/src/platform/isBraveBrowser.cjs +1 -0
- package/dist/src/platform/isBraveBrowser.js +11 -0
- package/dist/src/platform/isBrowser.cjs +1 -0
- package/dist/src/platform/isBrowser.js +28 -0
- package/dist/src/signer/multisigner.cjs +1 -0
- package/dist/src/signer/multisigner.js +19 -0
- package/dist/src/signer/seedphrase.cjs +1 -0
- package/dist/src/signer/seedphrase.js +7 -0
- package/dist/src/tokens/balances.cjs +1 -0
- package/dist/src/tokens/balances.js +38 -0
- package/dist/src/tokens/constants.cjs +1 -0
- package/dist/src/tokens/constants.js +4 -0
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.cjs +1 -0
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.js +16 -0
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.cjs +1 -0
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.js +11 -0
- package/dist/src/tokens/ensureDecimals.cjs +1 -0
- package/dist/src/tokens/ensureDecimals.js +5 -0
- package/dist/src/tokens/getCurrencySymbol.cjs +1 -0
- package/dist/src/tokens/getCurrencySymbol.js +15 -0
- package/dist/src/tokens/isUnlimitedAmount.cjs +1 -0
- package/dist/src/tokens/isUnlimitedAmount.js +5 -0
- package/dist/src/tokens/prettifyCurrencyValue.cjs +1 -0
- package/dist/src/tokens/prettifyCurrencyValue.js +11 -0
- package/dist/src/tokens/prettifyTokenAmount.cjs +1 -0
- package/dist/src/tokens/prettifyTokenAmount.js +23 -0
- package/dist/src/tokens/service/implementation.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/implementation.d.ts +21 -2
- package/dist/src/tokens/service/implementation.js +64 -0
- package/dist/src/tokens/service/tokenError.cjs +1 -0
- package/dist/src/tokens/service/tokenError.js +14 -0
- package/dist/src/tokens/service/types/backend.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/backend.model.d.ts +818 -73
- package/dist/src/tokens/service/types/backend.model.js +134 -0
- package/dist/src/tokens/service/types/defiPosition.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/defiPosition.model.d.ts +1024 -64
- package/dist/src/tokens/service/types/defiPosition.model.js +75 -0
- package/dist/src/tokens/service/types/defiPositionType.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/defiPositionType.model.d.ts +1 -1
- package/dist/src/tokens/service/types/defiPositionType.model.js +10 -0
- package/dist/src/tokens/service/types/unclaimedRewards.model.cjs +1 -0
- package/dist/src/tokens/service/types/unclaimedRewards.model.js +16 -0
- package/dist/src/tokens/service/types/webToken.model.cjs +1 -0
- package/dist/src/tokens/service/types/webToken.model.js +45 -0
- package/dist/src/transactions/amount.cjs +1 -0
- package/dist/src/transactions/amount.js +24 -0
- package/dist/src/transactions/buildTransactions.cjs +1 -0
- package/dist/src/transactions/buildTransactions.js +34 -0
- package/dist/src/transactions/errors.cjs +1 -0
- package/dist/src/transactions/errors.js +19 -0
- package/dist/src/transactions/estimate/argentMaxFee.cjs +1 -0
- package/dist/src/transactions/estimate/argentMaxFee.js +13 -0
- package/dist/src/transactions/estimate/error.cjs +1 -0
- package/dist/src/transactions/estimate/error.js +14 -0
- package/dist/src/transactions/estimate/model.cjs +1 -0
- package/dist/src/transactions/estimate/model.js +14 -0
- package/dist/src/transactions/estimate/utils.cjs +1 -0
- package/dist/src/transactions/estimate/utils.js +232 -0
- package/dist/src/transactions/findTransfersAndApprovals.cjs +1 -0
- package/dist/src/transactions/findTransfersAndApprovals.js +31 -0
- package/dist/src/transactions/getPrettyRcpError.cjs +1 -0
- package/dist/src/transactions/getPrettyRcpError.js +11 -0
- package/dist/src/transactions/getTransactionVersion.cjs +1 -0
- package/dist/src/transactions/getTransactionVersion.js +18 -0
- package/dist/{transactions → src/transactions}/index.d.ts +0 -6
- package/dist/src/transactions/service/implementation.cjs +1 -0
- package/dist/src/transactions/service/implementation.js +182 -0
- package/dist/src/transactions/service/types.cjs +1 -0
- package/dist/src/transactions/service/types.js +10 -0
- package/dist/src/transactions/transactionReviewTypes.cjs +1 -0
- package/dist/src/transactions/transactionReviewTypes.js +10 -0
- package/dist/src/transactions/transactionVersion.cjs +1 -0
- package/dist/src/transactions/transactionVersion.js +14 -0
- package/dist/src/transactions/txv3.cjs +1 -0
- package/dist/src/transactions/txv3.js +14 -0
- package/dist/src/utils/address.cjs +1 -0
- package/dist/src/utils/address.js +4 -0
- package/dist/src/utils/arrays.cjs +1 -0
- package/dist/src/utils/arrays.js +4 -0
- package/dist/src/utils/avatarImage.cjs +4 -0
- package/dist/src/utils/avatarImage.js +42 -0
- package/dist/src/utils/base58.cjs +1 -0
- package/dist/src/utils/base58.js +15 -0
- package/dist/src/utils/bigNumber.cjs +1 -0
- package/dist/src/utils/bigNumber.js +7 -0
- package/dist/src/utils/bips.cjs +1 -0
- package/dist/src/utils/bips.js +11 -0
- package/dist/src/utils/daysBetween.cjs +1 -0
- package/dist/src/utils/daysBetween.js +7 -0
- package/dist/src/utils/env.cjs +1 -0
- package/dist/src/utils/env.js +4 -0
- package/dist/src/utils/hex.cjs +1 -0
- package/dist/src/utils/hex.js +9 -0
- package/dist/src/utils/id.cjs +1 -0
- package/dist/src/utils/id.js +8 -0
- package/dist/{utils → src/utils}/index.d.ts +0 -1
- package/dist/src/utils/initials.cjs +1 -0
- package/dist/src/utils/initials.js +16 -0
- package/dist/src/utils/isContractDeployed.cjs +1 -0
- package/dist/src/utils/isContractDeployed.js +10 -0
- package/dist/src/utils/nonNullable.cjs +1 -0
- package/dist/src/utils/nonNullable.js +7 -0
- package/dist/src/utils/number/isAllowedAddressHexInputValue.cjs +1 -0
- package/dist/src/utils/number/isAllowedAddressHexInputValue.js +7 -0
- package/dist/src/utils/number/isAllowedNumericInputValue.cjs +1 -0
- package/dist/src/utils/number/isAllowedNumericInputValue.js +8 -0
- package/dist/src/utils/number/isNumeric.cjs +1 -0
- package/dist/src/utils/number/isNumeric.js +4 -0
- package/dist/src/utils/number/prettifyNumber.cjs +1 -0
- package/dist/src/utils/number/prettifyNumber.js +47 -0
- package/dist/src/utils/parseAmount.cjs +1 -0
- package/dist/src/utils/parseAmount.js +14 -0
- package/dist/src/utils/pluralise.cjs +1 -0
- package/dist/src/utils/pluralise.js +4 -0
- package/dist/src/utils/readFileAsString.cjs +1 -0
- package/dist/src/utils/readFileAsString.js +10 -0
- package/dist/src/utils/schemas.cjs +1 -0
- package/dist/src/utils/schemas.js +29 -0
- package/dist/src/utils/starknet/starknet.cjs +1 -0
- package/dist/src/utils/starknet/starknet.js +57 -0
- package/dist/src/utils/starknet/starknetLibTypes.cjs +1 -0
- package/dist/src/utils/starknet/starknetLibTypes.js +7 -0
- package/dist/src/utils/starknet/starknetSchemas.cjs +1 -0
- package/dist/src/utils/starknet/starknetSchemas.js +102 -0
- package/dist/src/utils/transactions.cjs +1 -0
- package/dist/src/utils/transactions.js +11 -0
- package/dist/src/utils/url/urlWithQuery.cjs +1 -0
- package/dist/src/utils/url/urlWithQuery.js +9 -0
- package/dist/src/utils/voidify.cjs +1 -0
- package/dist/src/utils/voidify.js +8 -0
- package/dist/swap.cjs +1 -0
- package/dist/swap.d.ts +1 -1
- package/dist/swap.js +20 -1
- package/package.json +14 -28
- package/dist/bips-DKbEGvGl.mjs +0 -114
- package/dist/bips-DxN0hSiY.js +0 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/useDebounce.d.ts +0 -1
- package/dist/hooks/useDebouncedValue.d.ts +0 -1
- package/dist/http/swr.d.ts +0 -21
- package/dist/index.mjs +0 -4466
- package/dist/nfts/useNfts.d.ts +0 -23
- package/dist/providers/WebAmplitude/WebAmplitudeProvider.d.ts +0 -7
- package/dist/providers/WebAmplitude/index.d.ts +0 -2
- package/dist/providers/WebAmplitude/service.d.ts +0 -7
- package/dist/providers/WebAmplitude/types.d.ts +0 -6
- package/dist/providers/WebAmplitude/utils.d.ts +0 -2
- package/dist/providers/index.d.ts +0 -1
- package/dist/simulation.mjs +0 -255
- package/dist/swap.mjs +0 -183
- package/dist/transactionVersion-C7p_qk9x.js +0 -1
- package/dist/transactionVersion-Cjoucwcx.mjs +0 -793
- package/dist/transactions/useBalanceChange.d.ts +0 -5
- package/dist/transactions/useErc20Transactions.d.ts +0 -6
- package/dist/transactions/useErc721Transactions.d.ts +0 -5
- package/dist/transactions/useErc721Transfers.d.ts +0 -5
- package/dist/transactions/useMaxAmountTransaction.d.ts +0 -7
- package/dist/transactions/useTransactionReview.d.ts +0 -15
- package/dist/transactions/useTransactionReviewV2web.d.ts +0 -1004
- package/dist/utils/useEventEmitter.d.ts +0 -67
- package/dist/webToken.model-5HUiR8ER.js +0 -1
- package/dist/webToken.model-CpudLBp0.mjs +0 -1913
- package/dist/{account → src/account}/account.model.d.ts +0 -0
- package/dist/{account → src/account}/accountv4.d.ts +0 -0
- package/dist/{account → src/account}/index.d.ts +0 -0
- package/dist/{account → src/account}/preferences.model.d.ts +0 -0
- package/dist/{backend → src/backend}/index.d.ts +0 -0
- package/dist/{backend → src/backend}/schema.d.ts +0 -0
- package/dist/{backend → src/backend}/types.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/constants.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/createUnitsSchema.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/formatUnits.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/index.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/lib.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/parseUnits.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/type.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/types.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/utils.d.ts +0 -0
- package/dist/{cache → src/cache}/CacheService.d.ts +0 -0
- package/dist/{cache → src/cache}/ICacheService.d.ts +0 -0
- package/dist/{cache → src/cache}/index.d.ts +0 -0
- package/dist/{chains → src/chains}/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/address.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/addressDomain.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/addressInput.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/argentName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/cairoVersionSchema.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/constants.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/getAddressFromArgentName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/getAddressFromStarkName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/network.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/IStarknetAddressService.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/StarknetAddressService.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/constants.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/deploymentData.schema.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/findImplementationForAccount.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/getAccountClassHash.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/starknetId.d.ts +0 -0
- package/dist/{errors → src/errors}/account.d.ts +0 -0
- package/dist/{errors → src/errors}/address.d.ts +0 -0
- package/dist/{errors → src/errors}/baseErrors.d.ts +0 -0
- package/dist/{errors → src/errors}/call.d.ts +0 -0
- package/dist/{errors → src/errors}/network.d.ts +0 -0
- package/dist/{errors → src/errors}/review.d.ts +0 -0
- package/dist/{errors → src/errors}/swap.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/normalize.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/schema.d.ts +200 -200
- package/dist/{features → src/features}/simulation/activity/utils/createNativeActivity.d.ts +6 -6
- package/dist/{features → src/features}/simulation/activity/utils/getAnyActivityTitle.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/getOverallLastModified.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/hasDelegationActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isMulticallWithDeploymentActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isRejectOnChainActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isUpgradeActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/parseAccountActivities.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/parseFinanceActivities.d.ts +0 -0
- package/dist/{features → src/features}/simulation/fees/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/fees/schema.d.ts +0 -0
- package/dist/{features → src/features}/simulation/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/getMessageFromSimulationError.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/schema.d.ts +1324 -1324
- package/dist/{features → src/features}/simulation/warning/helper.d.ts +0 -0
- package/dist/{features → src/features}/simulation/warning/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/warning/schema.d.ts +0 -0
- package/dist/{features → src/features}/swap/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/order.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/quote.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/trade.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/implementation.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/interface.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/order.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/quote.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/token.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/trade.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/walletAccount.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/slippage.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/totalFee.d.ts +0 -0
- package/dist/{http → src/http}/DateService.d.ts +0 -0
- package/dist/{http → src/http}/HttpError.d.ts +0 -0
- package/dist/{http → src/http}/HttpService.d.ts +0 -0
- package/dist/{http → src/http}/IDateService.d.ts +0 -0
- package/dist/{http → src/http}/IHttpService.d.ts +0 -0
- package/dist/{http → src/http}/SWRService.d.ts +0 -0
- package/dist/{http → src/http}/apiData.d.ts +0 -0
- package/dist/{http → src/http}/fetcher.d.ts +0 -0
- package/dist/{http → src/http}/time.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/IKnownDappsBackendService.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/KnownDappsBackendService.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/index.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/schema.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/utils/getDapplandUrl.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/utils/index.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/IResolveNameService.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/ResolveNameService.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/index.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/schema.d.ts +0 -0
- package/dist/{nfts → src/nfts}/BackendNftService.d.ts +0 -0
- package/dist/{nfts → src/nfts}/BackendPaginationError.d.ts +0 -0
- package/dist/{nfts → src/nfts}/INFTService.d.ts +0 -0
- package/dist/{nfts → src/nfts}/utils.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/IOnchainRecoveryService.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/OnchainRecoveryService.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/index.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/schema.d.ts +0 -0
- package/dist/{platform → src/platform}/index.d.ts +0 -0
- package/dist/{platform → src/platform}/isBraveBrowser.d.ts +0 -0
- package/dist/{platform → src/platform}/isBrowser.d.ts +0 -0
- package/dist/{signer → src/signer}/index.d.ts +0 -0
- package/dist/{signer → src/signer}/multisigner.d.ts +0 -0
- package/dist/{signer → src/signer}/seedphrase.d.ts +0 -0
- package/dist/{tokens → src/tokens}/balances.d.ts +0 -0
- package/dist/{tokens → src/tokens}/constants.d.ts +0 -0
- package/dist/{tokens → src/tokens}/convertTokenAmountToCurrencyValue.d.ts +0 -0
- package/dist/{tokens → src/tokens}/convertTokenUnitAmountWithDecimals.d.ts +0 -0
- package/dist/{tokens → src/tokens}/ensureDecimals.d.ts +0 -0
- package/dist/{tokens → src/tokens}/getCurrencySymbol.d.ts +0 -0
- package/dist/{tokens → src/tokens}/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/isUnlimitedAmount.d.ts +0 -0
- package/dist/{tokens → src/tokens}/prettifyCurrencyValue.d.ts +0 -0
- package/dist/{tokens → src/tokens}/prettifyTokenAmount.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/interface.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/tokenError.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/unclaimedRewards.model.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/webToken.model.d.ts +0 -0
- package/dist/{tokens → src/tokens}/token.d.ts +0 -0
- package/dist/{transactions → src/transactions}/aggregatedSimDataTypes.d.ts +0 -0
- package/dist/{transactions → src/transactions}/amount.d.ts +0 -0
- package/dist/{transactions → src/transactions}/buildTransactions.d.ts +0 -0
- package/dist/{transactions → src/transactions}/deployAccountTypes.d.ts +0 -0
- package/dist/{transactions → src/transactions}/errors.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/argentMaxFee.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/error.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/index.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/model.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/utils.d.ts +0 -0
- package/dist/{transactions → src/transactions}/findTransfersAndApprovals.d.ts +0 -0
- package/dist/{transactions → src/transactions}/getPrettyRcpError.d.ts +0 -0
- package/dist/{transactions → src/transactions}/getTransactionVersion.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/implementation.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/index.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/interface.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/types.d.ts +2 -2
- /package/dist/{transactions → src/transactions}/transactionAction.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionReviewTypes.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionSimulationTypes.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionVersion.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/txv3.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/types.d.ts +0 -0
- /package/dist/{utils → src/utils}/address.d.ts +0 -0
- /package/dist/{utils → src/utils}/arrays.d.ts +0 -0
- /package/dist/{utils → src/utils}/avatarImage.d.ts +0 -0
- /package/dist/{utils → src/utils}/base58.d.ts +0 -0
- /package/dist/{utils → src/utils}/bigNumber.d.ts +0 -0
- /package/dist/{utils → src/utils}/bips.d.ts +0 -0
- /package/dist/{utils → src/utils}/daysBetween.d.ts +0 -0
- /package/dist/{utils → src/utils}/env.d.ts +0 -0
- /package/dist/{utils → src/utils}/hex.d.ts +0 -0
- /package/dist/{utils → src/utils}/id.d.ts +0 -0
- /package/dist/{utils → src/utils}/initials.d.ts +0 -0
- /package/dist/{utils → src/utils}/isContractDeployed.d.ts +0 -0
- /package/dist/{utils → src/utils}/nonNullable.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isAllowedAddressHexInputValue.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isAllowedNumericInputValue.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isNumeric.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/prettifyNumber.d.ts +0 -0
- /package/dist/{utils → src/utils}/parseAmount.d.ts +0 -0
- /package/dist/{utils → src/utils}/pluralise.d.ts +0 -0
- /package/dist/{utils → src/utils}/readFileAsString.d.ts +0 -0
- /package/dist/{utils → src/utils}/schemas.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknet.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknetLibTypes.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknetSchemas.d.ts +0 -0
- /package/dist/{utils → src/utils}/transactions.d.ts +0 -0
- /package/dist/{utils → src/utils}/url/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/url/urlWithQuery.d.ts +0 -0
- /package/dist/{utils → src/utils}/voidify.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),f=require("../fees/schema.cjs"),l=require("../warning/schema.cjs"),n=require("../../../chains/starknet/address.cjs"),k=e.z.object({name:e.z.string(),url:e.z.string(),position:e.z.number()}),o=e.z.object({address:e.z.string(),name:e.z.string(),symbol:e.z.string().optional(),decimals:e.z.number().optional(),unknown:e.z.boolean(),iconUrl:e.z.string().optional(),type:e.z.string()}),i=e.z.discriminatedUnion("type",[e.z.object({type:e.z.literal("amount"),label:e.z.string(),token:o,amount:e.z.string(),usd:e.z.string(),editable:e.z.boolean()}),e.z.object({type:e.z.literal("address"),label:e.z.string(),address:e.z.string(),addressName:e.z.string().optional(),verified:e.z.boolean().optional()}),e.z.object({type:e.z.literal("timestamp"),label:e.z.string(),value:e.z.string()}),e.z.object({type:e.z.literal("token_address"),label:e.z.string(),token:o}),e.z.object({type:e.z.literal("calldata"),label:e.z.string(),entrypoint:e.z.string(),calldata:e.z.array(e.z.string())}),e.z.object({type:e.z.literal("text"),label:e.z.string(),text:e.z.string()}),e.z.object({type:e.z.literal("nft"),label:e.z.string(),token:o})]),z=e.z.object({name:e.z.string(),properties:e.z.array(i),defaultProperties:e.z.array(i).optional()}),m=e.z.union([e.z.literal("verified"),e.z.literal("neutral"),e.z.literal("partial"),e.z.literal("warn")]),p=e.z.object({unknown_token:e.z.unknown().optional(),date_of_addition:e.z.string().optional(),contract_address:n.addressSchema.optional(),reason:e.z.string().optional(),value:e.z.string().or(e.z.number()).optional()}),r=e.z.object({reason:l.reasonsSchema,details:p.optional(),severity:l.severitySchema}),d=e.z.object({assessment:m,warnings:e.z.array(r).optional(),assessmentReasons:e.z.array(e.z.string()).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),action:z}),g=e.z.object({name:e.z.string(),description:e.z.string(),logoUrl:e.z.string(),iconUrl:e.z.string(),argentVerified:e.z.boolean(),links:e.z.array(k)}),u=e.z.object({assessment:e.z.union([e.z.literal("verified"),e.z.literal("neutral"),e.z.literal("partial"),e.z.literal("warn")]),warnings:e.z.array(r).optional(),assessmentDetails:e.z.object({contract_address:e.z.string()}).optional(),targetedDapp:g.optional(),reviews:e.z.array(d)}).optional(),b=e.z.object({banner:e.z.string().nullable().optional(),preview:e.z.string().nullable().optional(),full:e.z.string().nullable().optional(),original:e.z.string().nullable().optional()}),v=e.z.object({twitter:e.z.string().optional(),external:e.z.string().optional(),discord:e.z.string().optional()}),s=e.z.object({address:n.addressSchemaArgentBackend,decimals:e.z.number().optional(),symbol:e.z.string().optional(),name:e.z.string(),description:e.z.string().optional(),type:e.z.string().optional(),usdValue:e.z.string().optional(),iconUrl:e.z.string().optional(),unknown:e.z.boolean().optional(),imageUrls:b.optional(),links:v.optional()}),w=e.z.object({tokenAddress:n.addressSchemaArgentBackend,owner:n.addressSchemaArgentBackend,spender:n.addressSchemaArgentBackend,value:e.z.string().optional(),approvalForAll:e.z.boolean(),details:s.optional()}),A=e.z.object({tokenAddress:n.addressSchemaArgentBackend,from:n.addressSchemaArgentBackend,to:n.addressSchemaArgentBackend,tokenId:e.z.string().optional(),value:e.z.string().optional(),details:s.optional()}),a=e.z.union([e.z.string(),e.z.number(),e.z.bigint()]).transform(t=>parseInt(t.toString(),10)),c={overallFee:a,gasPrice:a,gasUsage:a,dataGasPrice:a.optional(),dataGasConsumed:a.optional()},S=e.z.object({...c,unit:e.z.string().transform(t=>t.toUpperCase()).pipe(e.z.literal("WEI")),maxFee:a}).or(e.z.object({...c,unit:e.z.string().transform(t=>t.toUpperCase()).pipe(e.z.literal("FRI")),maxAmount:a,maxPricePerUnit:a})),E=e.z.object({type:e.z.string(),label:e.z.string(),tokenId:e.z.string().optional(),value:e.z.string().optional(),usdValue:e.z.string().optional(),token:s,sent:e.z.boolean().optional(),tokenIdDetails:e.z.object({name:e.z.string().optional(),description:e.z.string().optional(),imageUrls:b.optional()}).optional()}),U=e.z.object({approvals:e.z.array(w).optional(),transfers:e.z.array(A).optional(),calculatedNonce:e.z.string().optional(),feeEstimation:S,summary:e.z.array(E).optional()}),D=e.z.object({label:e.z.string().optional(),code:e.z.number().optional(),message:e.z.string().optional(),error:e.z.string().optional()}),h=e.z.object({reviewOfTransaction:u,simulation:U,simulationError:e.z.undefined()}),y=e.z.object({reviewOfTransaction:u,simulation:e.z.undefined(),simulationError:D}),j=h.or(y),B=e.z.object({transactions:e.z.array(j)}),P=e.z.object({transactions:e.z.array(j),enrichedFeeEstimation:f.estimatedFeesSchema.optional(),isBackendDown:e.z.boolean().default(!1).optional()});function T(t){return h.safeParse(t).success}function F(t){return y.safeParse(t).success}exports.actionSchema=z;exports.assessmentSchema=m;exports.enrichedSimulateAndReviewSchema=P;exports.feeEstimationSchema=S;exports.isNotTransactionSimulationError=T;exports.isTransactionSimulationError=F;exports.propertySchema=i;exports.reviewSchema=d;exports.simulateAndReviewSchema=B;exports.targetedDappSchema=g;exports.warningDetailsSchema=p;exports.warningSchema=r;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { z as t } from "zod";
|
|
2
|
+
import { estimatedFeesSchema as b } from "../fees/schema.js";
|
|
3
|
+
import { reasonsSchema as u, severitySchema as S } from "../warning/schema.js";
|
|
4
|
+
import { addressSchema as f, addressSchemaArgentBackend as o } from "../../../chains/starknet/address.js";
|
|
5
|
+
const h = t.object({
|
|
6
|
+
name: t.string(),
|
|
7
|
+
url: t.string(),
|
|
8
|
+
position: t.number()
|
|
9
|
+
}), e = t.object({
|
|
10
|
+
address: t.string(),
|
|
11
|
+
name: t.string(),
|
|
12
|
+
symbol: t.string().optional(),
|
|
13
|
+
decimals: t.number().optional(),
|
|
14
|
+
unknown: t.boolean(),
|
|
15
|
+
iconUrl: t.string().optional(),
|
|
16
|
+
type: t.string()
|
|
17
|
+
}), r = t.discriminatedUnion("type", [
|
|
18
|
+
t.object({
|
|
19
|
+
type: t.literal("amount"),
|
|
20
|
+
label: t.string(),
|
|
21
|
+
token: e,
|
|
22
|
+
amount: t.string(),
|
|
23
|
+
usd: t.string(),
|
|
24
|
+
editable: t.boolean()
|
|
25
|
+
}),
|
|
26
|
+
t.object({
|
|
27
|
+
type: t.literal("address"),
|
|
28
|
+
label: t.string(),
|
|
29
|
+
address: t.string(),
|
|
30
|
+
addressName: t.string().optional(),
|
|
31
|
+
// tbd whether it's isVerified or verified
|
|
32
|
+
verified: t.boolean().optional()
|
|
33
|
+
}),
|
|
34
|
+
t.object({
|
|
35
|
+
type: t.literal("timestamp"),
|
|
36
|
+
label: t.string(),
|
|
37
|
+
value: t.string()
|
|
38
|
+
}),
|
|
39
|
+
t.object({
|
|
40
|
+
type: t.literal("token_address"),
|
|
41
|
+
label: t.string(),
|
|
42
|
+
token: e
|
|
43
|
+
}),
|
|
44
|
+
t.object({
|
|
45
|
+
type: t.literal("calldata"),
|
|
46
|
+
label: t.string(),
|
|
47
|
+
entrypoint: t.string(),
|
|
48
|
+
calldata: t.array(t.string())
|
|
49
|
+
}),
|
|
50
|
+
t.object({
|
|
51
|
+
type: t.literal("text"),
|
|
52
|
+
label: t.string(),
|
|
53
|
+
text: t.string()
|
|
54
|
+
}),
|
|
55
|
+
t.object({
|
|
56
|
+
type: t.literal("nft"),
|
|
57
|
+
label: t.string(),
|
|
58
|
+
token: e
|
|
59
|
+
})
|
|
60
|
+
]), j = t.object({
|
|
61
|
+
name: t.string(),
|
|
62
|
+
properties: t.array(r),
|
|
63
|
+
defaultProperties: t.array(r).optional()
|
|
64
|
+
}), y = t.union([
|
|
65
|
+
t.literal("verified"),
|
|
66
|
+
t.literal("neutral"),
|
|
67
|
+
t.literal("partial"),
|
|
68
|
+
t.literal("warn")
|
|
69
|
+
]), k = t.object({
|
|
70
|
+
unknown_token: t.unknown().optional(),
|
|
71
|
+
date_of_addition: t.string().optional(),
|
|
72
|
+
contract_address: f.optional(),
|
|
73
|
+
reason: t.string().optional(),
|
|
74
|
+
value: t.string().or(t.number()).optional()
|
|
75
|
+
}), l = t.object({
|
|
76
|
+
reason: u,
|
|
77
|
+
details: k.optional(),
|
|
78
|
+
severity: S
|
|
79
|
+
}), v = t.object({
|
|
80
|
+
assessment: y,
|
|
81
|
+
warnings: t.array(l).optional(),
|
|
82
|
+
assessmentReasons: t.array(t.string()).optional(),
|
|
83
|
+
assessmentDetails: t.object({
|
|
84
|
+
contract_address: t.string()
|
|
85
|
+
}).optional(),
|
|
86
|
+
action: j
|
|
87
|
+
}), w = t.object({
|
|
88
|
+
name: t.string(),
|
|
89
|
+
description: t.string(),
|
|
90
|
+
logoUrl: t.string(),
|
|
91
|
+
iconUrl: t.string(),
|
|
92
|
+
argentVerified: t.boolean(),
|
|
93
|
+
links: t.array(h)
|
|
94
|
+
}), c = t.object({
|
|
95
|
+
assessment: t.union([
|
|
96
|
+
t.literal("verified"),
|
|
97
|
+
t.literal("neutral"),
|
|
98
|
+
t.literal("partial"),
|
|
99
|
+
t.literal("warn")
|
|
100
|
+
]),
|
|
101
|
+
warnings: t.array(l).optional(),
|
|
102
|
+
assessmentDetails: t.object({
|
|
103
|
+
contract_address: t.string()
|
|
104
|
+
}).optional(),
|
|
105
|
+
targetedDapp: w.optional(),
|
|
106
|
+
reviews: t.array(v)
|
|
107
|
+
}).optional(), p = t.object({
|
|
108
|
+
banner: t.string().nullable().optional(),
|
|
109
|
+
preview: t.string().nullable().optional(),
|
|
110
|
+
full: t.string().nullable().optional(),
|
|
111
|
+
original: t.string().nullable().optional()
|
|
112
|
+
}), U = t.object({
|
|
113
|
+
twitter: t.string().optional(),
|
|
114
|
+
external: t.string().optional(),
|
|
115
|
+
discord: t.string().optional()
|
|
116
|
+
}), i = t.object({
|
|
117
|
+
address: o,
|
|
118
|
+
decimals: t.number().optional(),
|
|
119
|
+
symbol: t.string().optional(),
|
|
120
|
+
name: t.string(),
|
|
121
|
+
description: t.string().optional(),
|
|
122
|
+
type: t.string().optional(),
|
|
123
|
+
usdValue: t.string().optional(),
|
|
124
|
+
iconUrl: t.string().optional(),
|
|
125
|
+
unknown: t.boolean().optional(),
|
|
126
|
+
imageUrls: p.optional(),
|
|
127
|
+
links: U.optional()
|
|
128
|
+
}), E = t.object({
|
|
129
|
+
tokenAddress: o,
|
|
130
|
+
owner: o,
|
|
131
|
+
spender: o,
|
|
132
|
+
value: t.string().optional(),
|
|
133
|
+
approvalForAll: t.boolean(),
|
|
134
|
+
details: i.optional()
|
|
135
|
+
}), A = t.object({
|
|
136
|
+
tokenAddress: o,
|
|
137
|
+
from: o,
|
|
138
|
+
to: o,
|
|
139
|
+
tokenId: t.string().optional(),
|
|
140
|
+
value: t.string().optional(),
|
|
141
|
+
details: i.optional()
|
|
142
|
+
}), a = t.union([t.string(), t.number(), t.bigint()]).transform((n) => parseInt(n.toString(), 10)), s = {
|
|
143
|
+
overallFee: a,
|
|
144
|
+
gasPrice: a,
|
|
145
|
+
gasUsage: a,
|
|
146
|
+
dataGasPrice: a.optional(),
|
|
147
|
+
dataGasConsumed: a.optional()
|
|
148
|
+
}, D = t.object({
|
|
149
|
+
...s,
|
|
150
|
+
unit: t.string().transform((n) => n.toUpperCase()).pipe(t.literal("WEI")),
|
|
151
|
+
maxFee: a
|
|
152
|
+
}).or(t.object({
|
|
153
|
+
...s,
|
|
154
|
+
unit: t.string().transform((n) => n.toUpperCase()).pipe(t.literal("FRI")),
|
|
155
|
+
maxAmount: a,
|
|
156
|
+
maxPricePerUnit: a
|
|
157
|
+
})), x = t.object({
|
|
158
|
+
type: t.string(),
|
|
159
|
+
label: t.string(),
|
|
160
|
+
tokenId: t.string().optional(),
|
|
161
|
+
value: t.string().optional(),
|
|
162
|
+
usdValue: t.string().optional(),
|
|
163
|
+
token: i,
|
|
164
|
+
sent: t.boolean().optional(),
|
|
165
|
+
tokenIdDetails: t.object({
|
|
166
|
+
name: t.string().optional(),
|
|
167
|
+
description: t.string().optional(),
|
|
168
|
+
imageUrls: p.optional()
|
|
169
|
+
}).optional()
|
|
170
|
+
}), F = t.object({
|
|
171
|
+
approvals: t.array(E).optional(),
|
|
172
|
+
transfers: t.array(A).optional(),
|
|
173
|
+
calculatedNonce: t.string().optional(),
|
|
174
|
+
feeEstimation: D,
|
|
175
|
+
summary: t.array(x).optional()
|
|
176
|
+
}), P = t.object({
|
|
177
|
+
label: t.string().optional(),
|
|
178
|
+
code: t.number().optional(),
|
|
179
|
+
message: t.string().optional(),
|
|
180
|
+
error: t.string().optional()
|
|
181
|
+
}), m = t.object({
|
|
182
|
+
reviewOfTransaction: c,
|
|
183
|
+
simulation: F,
|
|
184
|
+
simulationError: t.undefined()
|
|
185
|
+
}), g = t.object({
|
|
186
|
+
reviewOfTransaction: c,
|
|
187
|
+
simulation: t.undefined(),
|
|
188
|
+
simulationError: P
|
|
189
|
+
}), d = m.or(g), C = t.object({
|
|
190
|
+
transactions: t.array(d)
|
|
191
|
+
}), O = t.object({
|
|
192
|
+
transactions: t.array(d),
|
|
193
|
+
enrichedFeeEstimation: b.optional(),
|
|
194
|
+
isBackendDown: t.boolean().default(!1).optional()
|
|
195
|
+
});
|
|
196
|
+
function R(n) {
|
|
197
|
+
return m.safeParse(n).success;
|
|
198
|
+
}
|
|
199
|
+
function V(n) {
|
|
200
|
+
return g.safeParse(n).success;
|
|
201
|
+
}
|
|
202
|
+
export {
|
|
203
|
+
j as actionSchema,
|
|
204
|
+
y as assessmentSchema,
|
|
205
|
+
O as enrichedSimulateAndReviewSchema,
|
|
206
|
+
D as feeEstimationSchema,
|
|
207
|
+
R as isNotTransactionSimulationError,
|
|
208
|
+
V as isTransactionSimulationError,
|
|
209
|
+
r as propertySchema,
|
|
210
|
+
v as reviewSchema,
|
|
211
|
+
C as simulateAndReviewSchema,
|
|
212
|
+
w as targetedDappSchema,
|
|
213
|
+
k as warningDetailsSchema,
|
|
214
|
+
l as warningSchema
|
|
215
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>{if(e.length===0)return null;const t=["critical","high","caution","info"];return e.reduce((r,i)=>{const n=t.indexOf(i.severity),c=t.indexOf(r.severity);return n<c?i:r},e[0])};exports.getHighestSeverity=o;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const o = (e) => {
|
|
2
|
+
if (e.length === 0)
|
|
3
|
+
return null;
|
|
4
|
+
const t = ["critical", "high", "caution", "info"];
|
|
5
|
+
return e.reduce((r, i) => {
|
|
6
|
+
const n = t.indexOf(i.severity), c = t.indexOf(r.severity);
|
|
7
|
+
return n < c ? i : r;
|
|
8
|
+
}, e[0]);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
o as getHighestSeverity
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),t=e.z.union([e.z.literal("critical"),e.z.literal("high"),e.z.literal("caution"),e.z.literal("info")]),i=e.z.string();exports.reasonsSchema=i;exports.severitySchema=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),s=require("./quote.model.cjs"),r=require("../../../chains/starknet/address.cjs"),t=require("../../../utils/starknet/starknet.cjs"),c=e.z.object({chain:e.z.literal("starknet"),sellToken:r.addressSchema,buyToken:r.addressSchema,sellAmount:e.z.string(),buyAmount:e.z.string(),accountAddress:r.addressSchema,slippage:e.z.number().transform(a=>a.toString()),data:s.SwapDataSchema}),n=e.z.object({calls:e.z.array(t.callSchema)});exports.SwapOrderRequestSchema=c;exports.SwapOrderResponseSchema=n;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z as r } from "zod";
|
|
2
|
+
import { SwapDataSchema as t } from "./quote.model.js";
|
|
3
|
+
import { addressSchema as e } from "../../../chains/starknet/address.js";
|
|
4
|
+
import { callSchema as o } from "../../../utils/starknet/starknet.js";
|
|
5
|
+
const l = r.object({
|
|
6
|
+
chain: r.literal("starknet"),
|
|
7
|
+
sellToken: e,
|
|
8
|
+
buyToken: e,
|
|
9
|
+
sellAmount: r.string(),
|
|
10
|
+
buyAmount: r.string(),
|
|
11
|
+
accountAddress: e,
|
|
12
|
+
slippage: r.number().transform((a) => a.toString()),
|
|
13
|
+
data: t
|
|
14
|
+
}), p = r.object({
|
|
15
|
+
calls: r.array(o)
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
l as SwapOrderRequestSchema,
|
|
19
|
+
p as SwapOrderResponseSchema
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),r=require("../../../chains/starknet/address.cjs"),t=e.z.object({quoteId:e.z.string()}),n=e.z.lazy(()=>e.z.object({name:e.z.string(),percent:e.z.number(),sellToken:r.addressSchema,buyToken:r.addressSchema,routes:e.z.array(n)})),a=e.z.object({sellToken:r.addressSchema,sellAmount:e.z.string(),sellAmountInCurrency:e.z.string(),buyToken:r.addressSchema,buyAmount:e.z.string(),buyAmountInCurrency:e.z.string(),expiresAt:e.z.number(),expiresIn:e.z.number(),dexCount:e.z.number(),routes:e.z.array(n),providerName:e.z.string(),providerFee:e.z.string(),providerFeeInCurrency:e.z.string(),providerFeePercentage:e.z.number(),argentFee:e.z.string(),argentFeeInCurrency:e.z.string(),argentFeePercentage:e.z.number(),feeToken:r.addressSchema,data:t});exports.SwapDataSchema=t;exports.SwapQuoteResponseSchema=a;exports.SwapQuoteRouteSchema=n;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
import { addressSchema as r } from "../../../chains/starknet/address.js";
|
|
3
|
+
const t = e.object({
|
|
4
|
+
quoteId: e.string()
|
|
5
|
+
}), n = e.lazy(() => e.object({
|
|
6
|
+
name: e.string(),
|
|
7
|
+
percent: e.number(),
|
|
8
|
+
sellToken: r,
|
|
9
|
+
buyToken: r,
|
|
10
|
+
routes: e.array(n)
|
|
11
|
+
})), u = e.object({
|
|
12
|
+
sellToken: r,
|
|
13
|
+
sellAmount: e.string(),
|
|
14
|
+
sellAmountInCurrency: e.string(),
|
|
15
|
+
buyToken: r,
|
|
16
|
+
buyAmount: e.string(),
|
|
17
|
+
buyAmountInCurrency: e.string(),
|
|
18
|
+
expiresAt: e.number(),
|
|
19
|
+
expiresIn: e.number(),
|
|
20
|
+
dexCount: e.number(),
|
|
21
|
+
routes: e.array(n),
|
|
22
|
+
providerName: e.string(),
|
|
23
|
+
providerFee: e.string(),
|
|
24
|
+
providerFeeInCurrency: e.string(),
|
|
25
|
+
providerFeePercentage: e.number(),
|
|
26
|
+
argentFee: e.string(),
|
|
27
|
+
argentFeeInCurrency: e.string(),
|
|
28
|
+
argentFeePercentage: e.number(),
|
|
29
|
+
feeToken: r,
|
|
30
|
+
data: t
|
|
31
|
+
});
|
|
32
|
+
export {
|
|
33
|
+
t as SwapDataSchema,
|
|
34
|
+
u as SwapQuoteResponseSchema,
|
|
35
|
+
n as SwapQuoteRouteSchema
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("zod"),t=require("../../../tokens/service/types/webToken.model.cjs"),n=require("./quote.model.cjs");exports.TradeType=void 0;(function(r){r.EXACT_PAY="EXACT_PAY",r.EXACT_RECEIVE="EXACT_RECEIVE"})(exports.TradeType||(exports.TradeType={}));const a=e.z.nativeEnum(exports.TradeType),o=e.z.object({payToken:t.webTokenSchema,receiveToken:t.webTokenSchema,tradeType:a.default(exports.TradeType.EXACT_PAY),payAmount:e.z.string(),receiveAmount:e.z.string(),payAmountInCurrency:e.z.string(),receiveAmountInCurrency:e.z.string(),totalFee:e.z.string(),totalFeeInCurrency:e.z.string().optional(),totalFeePercentage:e.z.number(),expiresAt:e.z.number(),expiresIn:e.z.number(),route:n.SwapQuoteRouteSchema,data:n.SwapDataSchema});exports.TradeSchema=o;exports.TradeTypeSchema=a;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
import { webTokenSchema as n } from "../../../tokens/service/types/webToken.model.js";
|
|
3
|
+
import { SwapQuoteRouteSchema as o, SwapDataSchema as a } from "./quote.model.js";
|
|
4
|
+
var t;
|
|
5
|
+
(function(r) {
|
|
6
|
+
r.EXACT_PAY = "EXACT_PAY", r.EXACT_RECEIVE = "EXACT_RECEIVE";
|
|
7
|
+
})(t || (t = {}));
|
|
8
|
+
const m = e.nativeEnum(t), p = e.object({
|
|
9
|
+
payToken: n,
|
|
10
|
+
receiveToken: n,
|
|
11
|
+
tradeType: m.default(t.EXACT_PAY),
|
|
12
|
+
payAmount: e.string(),
|
|
13
|
+
receiveAmount: e.string(),
|
|
14
|
+
payAmountInCurrency: e.string(),
|
|
15
|
+
receiveAmountInCurrency: e.string(),
|
|
16
|
+
totalFee: e.string(),
|
|
17
|
+
totalFeeInCurrency: e.string().optional(),
|
|
18
|
+
totalFeePercentage: e.number(),
|
|
19
|
+
expiresAt: e.number(),
|
|
20
|
+
expiresIn: e.number(),
|
|
21
|
+
route: o,
|
|
22
|
+
data: a
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
p as TradeSchema,
|
|
26
|
+
t as TradeType,
|
|
27
|
+
m as TradeTypeSchema
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("url-join"),a=require("../../../errors/swap.cjs"),p=require("../models/quote.model.cjs"),l=require("../utils/totalFee.cjs"),S=require("../models/trade.model.cjs"),i=require("../models/order.model.cjs"),d=require("../../../utils/url/urlWithQuery.cjs");class y{constructor(e,r){if(this.httpService=e,!r)throw new a.SwapError({code:"NO_SWAP_URL"});this.swapQuoteUrl=u(r,"/quote"),this.swapOrderUrl=u(r,"/order")}async getSwapQuoteForPay(e,r,o,n,t="USD"){const s=d.urlWithQuery(this.swapQuoteUrl,{accountAddress:n,currency:t,chain:"starknet",sellToken:e,buyToken:r,sellAmount:o});try{const c=await this.httpService.get(s);return await p.SwapQuoteResponseSchema.parseAsync(c)}catch(c){throw console.error(c),new a.SwapError({code:"INVALID_QUOTE_RESPONSE"})}}async getSwapTradeFromQuote(e,r,o){if(!r||!o)throw new a.SwapError({code:"INVALID_SWAP_TOKENS"});const{totalFee:n,totalFeeInCurrency:t,totalFeePercentage:s}=l.calculateTotalFee(e);return S.TradeSchema.parse({payToken:r,receiveToken:o,payAmount:e.sellAmount,receiveAmount:e.buyAmount,payAmountInCurrency:e.sellAmountInCurrency,receiveAmountInCurrency:e.buyAmountInCurrency,totalFee:n,totalFeeInCurrency:t,totalFeePercentage:s,expiresAt:e.expiresAt,expiresIn:e.expiresIn,route:e.routes[0],data:e.data})}async getSwapOrderFromTrade(e,r,o){const n=i.SwapOrderRequestSchema.parse({chain:"starknet",sellToken:r.payToken.address,buyToken:r.receiveToken.address,sellAmount:r.payAmount,buyAmount:r.receiveAmount,accountAddress:e,slippage:o/1e4,data:r.data});try{const t=await this.httpService.post(this.swapOrderUrl,{body:JSON.stringify(n),headers:{"Content-Type":"application/json"}});return await i.SwapOrderResponseSchema.parseAsync(t)}catch(t){throw console.error(t),new a.SwapError({code:"INVALID_SWAP_ORDER_RESPONSE"})}}}exports.SharedSwapService=y;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import p from "url-join";
|
|
2
|
+
import { SwapError as a } from "../../../errors/swap.js";
|
|
3
|
+
import { SwapQuoteResponseSchema as i } from "../models/quote.model.js";
|
|
4
|
+
import { calculateTotalFee as u } from "../utils/totalFee.js";
|
|
5
|
+
import { TradeSchema as m } from "../models/trade.model.js";
|
|
6
|
+
import { SwapOrderRequestSchema as l, SwapOrderResponseSchema as S } from "../models/order.model.js";
|
|
7
|
+
import { urlWithQuery as y } from "../../../utils/url/urlWithQuery.js";
|
|
8
|
+
class _ {
|
|
9
|
+
constructor(e, r) {
|
|
10
|
+
if (this.httpService = e, !r)
|
|
11
|
+
throw new a({ code: "NO_SWAP_URL" });
|
|
12
|
+
this.swapQuoteUrl = p(r, "/quote"), this.swapOrderUrl = p(r, "/order");
|
|
13
|
+
}
|
|
14
|
+
async getSwapQuoteForPay(e, r, o, n, t = "USD") {
|
|
15
|
+
const s = y(this.swapQuoteUrl, {
|
|
16
|
+
accountAddress: n,
|
|
17
|
+
currency: t,
|
|
18
|
+
chain: "starknet",
|
|
19
|
+
sellToken: e,
|
|
20
|
+
buyToken: r,
|
|
21
|
+
sellAmount: o
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
const c = await this.httpService.get(s);
|
|
25
|
+
return await i.parseAsync(c);
|
|
26
|
+
} catch (c) {
|
|
27
|
+
throw console.error(c), new a({ code: "INVALID_QUOTE_RESPONSE" });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async getSwapTradeFromQuote(e, r, o) {
|
|
31
|
+
if (!r || !o)
|
|
32
|
+
throw new a({ code: "INVALID_SWAP_TOKENS" });
|
|
33
|
+
const { totalFee: n, totalFeeInCurrency: t, totalFeePercentage: s } = u(e);
|
|
34
|
+
return m.parse({
|
|
35
|
+
payToken: r,
|
|
36
|
+
receiveToken: o,
|
|
37
|
+
payAmount: e.sellAmount,
|
|
38
|
+
receiveAmount: e.buyAmount,
|
|
39
|
+
payAmountInCurrency: e.sellAmountInCurrency,
|
|
40
|
+
receiveAmountInCurrency: e.buyAmountInCurrency,
|
|
41
|
+
totalFee: n,
|
|
42
|
+
totalFeeInCurrency: t,
|
|
43
|
+
totalFeePercentage: s,
|
|
44
|
+
expiresAt: e.expiresAt,
|
|
45
|
+
expiresIn: e.expiresIn,
|
|
46
|
+
route: e.routes[0],
|
|
47
|
+
data: e.data
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async getSwapOrderFromTrade(e, r, o) {
|
|
51
|
+
const n = l.parse({
|
|
52
|
+
chain: "starknet",
|
|
53
|
+
sellToken: r.payToken.address,
|
|
54
|
+
buyToken: r.receiveToken.address,
|
|
55
|
+
sellAmount: r.payAmount,
|
|
56
|
+
buyAmount: r.receiveAmount,
|
|
57
|
+
accountAddress: e,
|
|
58
|
+
slippage: o / 1e4,
|
|
59
|
+
data: r.data
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
const t = await this.httpService.post(this.swapOrderUrl, {
|
|
63
|
+
body: JSON.stringify(n),
|
|
64
|
+
headers: {
|
|
65
|
+
"Content-Type": "application/json"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return await S.parseAsync(t);
|
|
69
|
+
} catch (t) {
|
|
70
|
+
throw console.error(t), new a({ code: "INVALID_SWAP_ORDER_RESPONSE" });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export {
|
|
75
|
+
_ as SharedSwapService
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../../../utils/bips.cjs"),m=require("../models/trade.model.cjs"),r=require("../../../bigdecimal/lib.cjs"),c=require("../../../bigdecimal/constants.cjs");function a(e,i){const t=u.bipsToPercent(i),n={value:BigInt(e.payAmount),decimals:e.payToken.decimals};if(e.tradeType===m.TradeType.EXACT_PAY||t.value<=0n)return n;const o=r.add(c.ONE,t);return r.mul(n,o)}function s(e,i){const t=u.bipsToPercent(i),n={value:BigInt(e.receiveAmount),decimals:e.receiveToken.decimals};if(e.tradeType===m.TradeType.EXACT_RECEIVE)return n;const o=r.add(c.ONE,t);return r.div(n,o)}exports.maximumAmountInForTrade=a;exports.minimumAmountOutFromTrade=s;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { bipsToPercent as i } from "../../../utils/bips.js";
|
|
2
|
+
import { TradeType as m } from "../models/trade.model.js";
|
|
3
|
+
import { add as u, mul as c, div as a } from "../../../bigdecimal/lib.js";
|
|
4
|
+
import { ONE as p } from "../../../bigdecimal/constants.js";
|
|
5
|
+
function f(n, o) {
|
|
6
|
+
const t = i(o), e = {
|
|
7
|
+
value: BigInt(n.payAmount),
|
|
8
|
+
decimals: n.payToken.decimals
|
|
9
|
+
};
|
|
10
|
+
if (n.tradeType === m.EXACT_PAY || t.value <= 0n)
|
|
11
|
+
return e;
|
|
12
|
+
const r = u(p, t);
|
|
13
|
+
return c(e, r);
|
|
14
|
+
}
|
|
15
|
+
function A(n, o) {
|
|
16
|
+
const t = i(o), e = {
|
|
17
|
+
value: BigInt(n.receiveAmount),
|
|
18
|
+
decimals: n.receiveToken.decimals
|
|
19
|
+
};
|
|
20
|
+
if (n.tradeType === m.EXACT_RECEIVE)
|
|
21
|
+
return e;
|
|
22
|
+
const r = u(p, t);
|
|
23
|
+
return a(e, r);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
f as maximumAmountInForTrade,
|
|
27
|
+
A as minimumAmountOutFromTrade
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../../bigdecimal/lib.cjs"),r=require("../../../bigdecimal/utils.cjs");function l(e){const t=BigInt(e.providerFee)+BigInt(e.argentFee),n=o.add(r.parseCurrency(e.argentFeeInCurrency),r.parseCurrency(e.providerFeeInCurrency)),a=r.formatCurrency(n.value),c=e.argentFeePercentage+e.providerFeePercentage;return{totalFee:t.toString(),totalFeePercentage:c,totalFeeInCurrency:a}}exports.calculateTotalFee=l;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { add as o } from "../../../bigdecimal/lib.js";
|
|
2
|
+
import { parseCurrency as r, formatCurrency as F } from "../../../bigdecimal/utils.js";
|
|
3
|
+
function l(e) {
|
|
4
|
+
const t = BigInt(e.providerFee) + BigInt(e.argentFee), n = o(r(e.argentFeeInCurrency), r(e.providerFeeInCurrency)), a = F(n.value), c = e.argentFeePercentage + e.providerFeePercentage;
|
|
5
|
+
return {
|
|
6
|
+
totalFee: t.toString(),
|
|
7
|
+
totalFeePercentage: c,
|
|
8
|
+
totalFeeInCurrency: a
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
l as calculateTotalFee
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class s{constructor(t,e){this.httpService=t,this.baseUrl=e,this.offsetInS=0,this.syncIntervalInMs=60*1e3,this.initialSync=this.syncWithServer(),setInterval(()=>void this.syncWithServer(),this.syncIntervalInMs)}async now(){return await this.initialSync,new Date(Date.now()+this.offsetInS*1e3)}async syncWithServer(){if(typeof window>"u")return;const{time:t}=await this.httpService.get(`${this.baseUrl}/time`),e=Math.floor(Date.now()/1e3),i=t-e;this.offsetInS=i}}exports.DateService=s;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
class n {
|
|
2
|
+
constructor(t, e) {
|
|
3
|
+
this.httpService = t, this.baseUrl = e, this.offsetInS = 0, this.syncIntervalInMs = 60 * 1e3, this.initialSync = this.syncWithServer(), setInterval(() => void this.syncWithServer(), this.syncIntervalInMs);
|
|
4
|
+
}
|
|
5
|
+
async now() {
|
|
6
|
+
return await this.initialSync, new Date(Date.now() + this.offsetInS * 1e3);
|
|
7
|
+
}
|
|
8
|
+
async syncWithServer() {
|
|
9
|
+
if (typeof window > "u")
|
|
10
|
+
return;
|
|
11
|
+
const { time: t } = await this.httpService.get(`${this.baseUrl}/time`), e = Math.floor(Date.now() / 1e3), i = t - e;
|
|
12
|
+
this.offsetInS = i;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
n as DateService
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class t extends Error{constructor(r,e,s){super(r),this.status=e,this.data=s,Object.setPrototypeOf(this,t.prototype)}}exports.HttpError=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("lodash-es"),a=require("./HttpError.cjs"),d=require("./IHttpService.cjs");class w{constructor(o,t="json"){this.requestInit=o,this.responseType=t}async get(o,t){const s=h.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"GET",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(o,r).catch(()=>{throw new a.HttpError(d.HTTP_ERROR_MESSAGE.FAILED_TO_FETCH_URL,0)});if(this.responseType==="json"){if(!e.ok)throw new a.HttpError(e.statusText,e.status);return await e.json()}return e}async post(o,t,s){const r=h.isFunction(this.requestInit)?await this.requestInit():this.requestInit,e={...r,...t,method:"POST",headers:{...r==null?void 0:r.headers,...t==null?void 0:t.headers}},n=await fetch(o,e).catch(()=>{throw new a.HttpError(d.HTTP_ERROR_MESSAGE.FAILED_TO_POST_URL,0)});if(!n.ok)throw new a.HttpError(n.statusText,n.status,await n.json());if(n.status===204)return{};const c=await n.json();if(s)try{return s.parse(c)}catch(i){throw new a.HttpError(i.message,0)}return c}async put(o,t){const s=h.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"PUT",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(o,r).catch(()=>{throw new a.HttpError("Failed to put url",0)});if(!e.ok)throw new a.HttpError(e.statusText,e.status);return await e.json()}async delete(o,t){const s=h.isFunction(this.requestInit)?await this.requestInit():this.requestInit,r={...s,...t,method:"DELETE",headers:{...s==null?void 0:s.headers,...t==null?void 0:t.headers}},e=await fetch(o,r).catch(()=>{throw new a.HttpError("Failed to delete url",0)});if(!e.ok)throw new a.HttpError(e.statusText,e.status)}}exports.HTTPService=w;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { isFunction as n } from "lodash-es";
|
|
2
|
+
import { HttpError as r } from "./HttpError.js";
|
|
3
|
+
import { HTTP_ERROR_MESSAGE as w } from "./IHttpService.js";
|
|
4
|
+
class m {
|
|
5
|
+
constructor(o, t = "json") {
|
|
6
|
+
this.requestInit = o, this.responseType = t;
|
|
7
|
+
}
|
|
8
|
+
async get(o, t) {
|
|
9
|
+
const s = n(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
|
|
10
|
+
...s,
|
|
11
|
+
...t,
|
|
12
|
+
method: "GET",
|
|
13
|
+
// merge headers
|
|
14
|
+
headers: {
|
|
15
|
+
...s == null ? void 0 : s.headers,
|
|
16
|
+
...t == null ? void 0 : t.headers
|
|
17
|
+
}
|
|
18
|
+
}, e = await fetch(o, a).catch(() => {
|
|
19
|
+
throw new r(w.FAILED_TO_FETCH_URL, 0);
|
|
20
|
+
});
|
|
21
|
+
if (this.responseType === "json") {
|
|
22
|
+
if (!e.ok)
|
|
23
|
+
throw new r(e.statusText, e.status);
|
|
24
|
+
return await e.json();
|
|
25
|
+
}
|
|
26
|
+
return e;
|
|
27
|
+
}
|
|
28
|
+
async post(o, t, s) {
|
|
29
|
+
const a = n(this.requestInit) ? await this.requestInit() : this.requestInit, e = {
|
|
30
|
+
...a,
|
|
31
|
+
...t,
|
|
32
|
+
method: "POST",
|
|
33
|
+
// merge headers
|
|
34
|
+
headers: {
|
|
35
|
+
...a == null ? void 0 : a.headers,
|
|
36
|
+
...t == null ? void 0 : t.headers
|
|
37
|
+
}
|
|
38
|
+
}, h = await fetch(o, e).catch(() => {
|
|
39
|
+
throw new r(w.FAILED_TO_POST_URL, 0);
|
|
40
|
+
});
|
|
41
|
+
if (!h.ok)
|
|
42
|
+
throw new r(h.statusText, h.status, await h.json());
|
|
43
|
+
if (h.status === 204)
|
|
44
|
+
return {};
|
|
45
|
+
const c = await h.json();
|
|
46
|
+
if (s)
|
|
47
|
+
try {
|
|
48
|
+
return s.parse(c);
|
|
49
|
+
} catch (i) {
|
|
50
|
+
throw new r(i.message, 0);
|
|
51
|
+
}
|
|
52
|
+
return c;
|
|
53
|
+
}
|
|
54
|
+
async put(o, t) {
|
|
55
|
+
const s = n(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
|
|
56
|
+
...s,
|
|
57
|
+
...t,
|
|
58
|
+
method: "PUT",
|
|
59
|
+
// merge headers
|
|
60
|
+
headers: {
|
|
61
|
+
...s == null ? void 0 : s.headers,
|
|
62
|
+
...t == null ? void 0 : t.headers
|
|
63
|
+
}
|
|
64
|
+
}, e = await fetch(o, a).catch(() => {
|
|
65
|
+
throw new r("Failed to put url", 0);
|
|
66
|
+
});
|
|
67
|
+
if (!e.ok)
|
|
68
|
+
throw new r(e.statusText, e.status);
|
|
69
|
+
return await e.json();
|
|
70
|
+
}
|
|
71
|
+
async delete(o, t) {
|
|
72
|
+
const s = n(this.requestInit) ? await this.requestInit() : this.requestInit, a = {
|
|
73
|
+
...s,
|
|
74
|
+
...t,
|
|
75
|
+
method: "DELETE",
|
|
76
|
+
// merge headers
|
|
77
|
+
headers: {
|
|
78
|
+
...s == null ? void 0 : s.headers,
|
|
79
|
+
...t == null ? void 0 : t.headers
|
|
80
|
+
}
|
|
81
|
+
}, e = await fetch(o, a).catch(() => {
|
|
82
|
+
throw new r("Failed to delete url", 0);
|
|
83
|
+
});
|
|
84
|
+
if (!e.ok)
|
|
85
|
+
throw new r(e.statusText, e.status);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export {
|
|
89
|
+
m as HTTPService
|
|
90
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.HTTP_ERROR_MESSAGE=void 0;(function(t){t.FAILED_TO_FETCH_URL="Failed to fetch url",t.FAILED_TO_POST_URL="Failed to post url"})(exports.HTTP_ERROR_MESSAGE||(exports.HTTP_ERROR_MESSAGE={}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./HttpError.cjs"),o=c=>{process.env.NODE_ENV};function h(c,e){const s=c.clone(),t=new Headers(s.headers);for(const[n,i]of Object.entries(e))t.set(n,i);return new Response(s.body,{status:s.status,statusText:c.statusText,headers:t})}class d{constructor(e,s,t,n){this.dateService=e,this.cacheService=s,this.httpService=t,this.options=n,this.inFlightRequests=new Map}async rawGet(e,s){try{const t=await this.cacheService.get(e),n=await this.dateService.now(),i=new Date(t.headers.get("date")||""),a=n.getTime()-i.getTime();if(a<this.options.freshFor)return o("🟢 [SWR] Using fresh cache"),t;if(a<this.options.staleFor)return this.fetchAndCache(e,s),o("🟠 [SWR] Revalidating cache"),t;throw new Error("Cache too old")}catch(t){if(t instanceof r.HttpError)throw t;return o(),await this.fetchAndCache(e,s)}}async get(e,s){const t=await this.rawGet(e,s);return this.parseResponse(t)}async fetchAndCache(e,s){const t=this.inFlightRequests.get(e);if(!t){const n=this.httpService.get(e,s).then(async i=>{const a=await this.dateService.now();return await this.cacheService.set(e,h(i,{date:a.toUTCString()})),i}).finally(()=>{this.inFlightRequests.delete(e)});return this.inFlightRequests.set(e,n),n}return o(),t}parseResponse(e){if(e.ok)return e.json();throw new r.HttpError(e.statusText,e.status)}}exports.SWRService=d;
|