@argent/x-shared 1.36.0 → 1.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.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 +420 -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/src/tokens/service/implementation.d.ts +256 -0
- 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/src/tokens/service/types/backend.model.d.ts +9185 -0
- package/dist/src/tokens/service/types/backend.model.js +127 -0
- package/dist/src/tokens/service/types/defiPosition.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/defiPosition.model.d.ts +11 -11
- package/dist/src/tokens/service/types/defiPosition.model.js +68 -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 +9 -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.d.ts +11 -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-CP71ZN9a.js +0 -1
- package/dist/bips-zBtnMbia.mjs +0 -114
- 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 -4464
- 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/tokens/service/implementation.d.ts +0 -76
- package/dist/tokens/service/types/backend.model.d.ts +0 -2178
- package/dist/transactionVersion-CACUj2ch.mjs +0 -793
- package/dist/transactionVersion-CaRQ5Df4.js +0 -1
- 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/schemas.d.ts +0 -3
- package/dist/utils/useEventEmitter.d.ts +0 -67
- package/dist/webToken.model-Cl4dvcmj.mjs +0 -1881
- package/dist/webToken.model-Dsd8Rd3e.js +0 -1
- 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}/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,232 @@
|
|
|
1
|
+
import { upperCase as G } from "lodash-es";
|
|
2
|
+
import { CallData as F, uint256 as U, num as r } from "starknet";
|
|
3
|
+
import { isEqualAddress as T } from "../../chains/starknet/address.js";
|
|
4
|
+
import { STRK_TOKEN_ADDRESS as y, ETH_TOKEN_ADDRESS as I } from "../../chains/starknet/constants.js";
|
|
5
|
+
import { argentMaxFee as E } from "./argentMaxFee.js";
|
|
6
|
+
import { EstimateError as h } from "./error.js";
|
|
7
|
+
import { transferCalldataSchema as _ } from "../../utils/starknet/starknet.js";
|
|
8
|
+
import { feeEstimationSchema as f } from "../../features/simulation/transactionReview/schema.js";
|
|
9
|
+
import { ensureArray as M } from "../../utils/arrays.js";
|
|
10
|
+
function A(t) {
|
|
11
|
+
return G(t.unit) === "WEI";
|
|
12
|
+
}
|
|
13
|
+
function k(t) {
|
|
14
|
+
return G(t.unit) === "FRI";
|
|
15
|
+
}
|
|
16
|
+
function u(t, n) {
|
|
17
|
+
return A(t) ? {
|
|
18
|
+
...t,
|
|
19
|
+
maxFee: n(t.maxFee),
|
|
20
|
+
overallFee: n(t.overallFee),
|
|
21
|
+
gasPrice: n(t.gasPrice),
|
|
22
|
+
gasUsage: n(t.gasUsage)
|
|
23
|
+
} : {
|
|
24
|
+
...t,
|
|
25
|
+
overallFee: n(t.overallFee),
|
|
26
|
+
gasPrice: n(t.gasPrice),
|
|
27
|
+
gasUsage: n(t.gasUsage),
|
|
28
|
+
maxAmount: n(t.maxAmount),
|
|
29
|
+
maxPricePerUnit: n(t.maxPricePerUnit)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function d(t) {
|
|
33
|
+
return A(t) ? {
|
|
34
|
+
maxFee: t.maxFee
|
|
35
|
+
} : {
|
|
36
|
+
amount: t.maxAmount,
|
|
37
|
+
pricePerUnit: t.maxPricePerUnit
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function x(t) {
|
|
41
|
+
return k({ unit: t }) ? y : I;
|
|
42
|
+
}
|
|
43
|
+
function L(t, n, e = 2) {
|
|
44
|
+
const a = BigInt(10 ** e), s = BigInt(Math.round(n * 10 ** e));
|
|
45
|
+
return t * s / a;
|
|
46
|
+
}
|
|
47
|
+
const K = [y], B = (t, n = R) => {
|
|
48
|
+
if (t.max && "amount" in t.max)
|
|
49
|
+
return {
|
|
50
|
+
...t,
|
|
51
|
+
...t.max
|
|
52
|
+
};
|
|
53
|
+
const e = 10000n, { amount: a, pricePerUnit: s, dataGasConsumed: o = 0n, dataGasPrice: m = 0n } = t, c = a * s + o * m;
|
|
54
|
+
if (c < 0)
|
|
55
|
+
throw Error("Cannot calculate max fee for negative fee");
|
|
56
|
+
const i = r.toBigInt(E({ estimatedFee: c })), g = Number(i) / Number(c), C = n(g), l = BigInt(Math.trunc(C * Number(e)));
|
|
57
|
+
return {
|
|
58
|
+
...t,
|
|
59
|
+
amount: a * l / e,
|
|
60
|
+
pricePerUnit: s * l / e,
|
|
61
|
+
dataGasConsumed: o * l / e,
|
|
62
|
+
dataGasPrice: m * l / e
|
|
63
|
+
};
|
|
64
|
+
}, p = (t) => {
|
|
65
|
+
const { amount: n, pricePerUnit: e, dataGasConsumed: a = 0n, dataGasPrice: s = 0n } = t;
|
|
66
|
+
return n * e + a * s;
|
|
67
|
+
}, N = (t) => {
|
|
68
|
+
if (t.max)
|
|
69
|
+
return "maxFee" in t.max ? t.max.maxFee : p(t.max);
|
|
70
|
+
}, P = (t) => {
|
|
71
|
+
const n = N(t);
|
|
72
|
+
return n || p(B(t));
|
|
73
|
+
}, V = (t) => {
|
|
74
|
+
if (t.deployment && !T(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
75
|
+
throw Error("Cannot calculate estimated fees for different tokens");
|
|
76
|
+
const n = p(t.transactions), e = t.deployment ? p(t.deployment) : 0n;
|
|
77
|
+
return n + e;
|
|
78
|
+
}, Y = (t) => {
|
|
79
|
+
if (t.deployment && !T(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
80
|
+
throw Error("Cannot calculate estimated fees for different tokens");
|
|
81
|
+
const n = t.deployment ? P(t.deployment) : 0n, e = P(t.transactions);
|
|
82
|
+
return n + e;
|
|
83
|
+
}, $ = (t, n) => [
|
|
84
|
+
{
|
|
85
|
+
contractAddress: t,
|
|
86
|
+
entrypoint: "transfer",
|
|
87
|
+
calldata: F.compile(_.parse({
|
|
88
|
+
// We are using a dummy address (ETH here) as recipient to estimate the fee given we don't have a receipient yet
|
|
89
|
+
recipient: n,
|
|
90
|
+
// We are using the smallest possible amount to make sure this doesn't throw an error
|
|
91
|
+
amount: U.bnToUint256(BigInt(1))
|
|
92
|
+
}))
|
|
93
|
+
}
|
|
94
|
+
], S = (t, n) => {
|
|
95
|
+
if (!t)
|
|
96
|
+
return {
|
|
97
|
+
transactions: {
|
|
98
|
+
feeTokenAddress: n ?? I,
|
|
99
|
+
amount: 0n,
|
|
100
|
+
pricePerUnit: 0n,
|
|
101
|
+
dataGasConsumed: 0n,
|
|
102
|
+
dataGasPrice: 0n
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
if (!Array.isArray(t))
|
|
106
|
+
throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
|
|
107
|
+
if (t.length === 1) {
|
|
108
|
+
const e = f.parse(t[0].feeEstimation);
|
|
109
|
+
return {
|
|
110
|
+
transactions: {
|
|
111
|
+
feeTokenAddress: x(e.unit),
|
|
112
|
+
amount: r.toBigInt(e.gasUsage),
|
|
113
|
+
pricePerUnit: r.toBigInt(e.gasPrice),
|
|
114
|
+
max: d(u(e, r.toBigInt)),
|
|
115
|
+
dataGasConsumed: e.dataGasConsumed ? r.toBigInt(e.dataGasConsumed) : 0n,
|
|
116
|
+
dataGasPrice: e.dataGasPrice ? r.toBigInt(e.dataGasPrice) : 0n
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
if (t.length === 2) {
|
|
121
|
+
const e = f.parse(t[0].feeEstimation), a = f.parse(t[1].feeEstimation);
|
|
122
|
+
return {
|
|
123
|
+
deployment: {
|
|
124
|
+
feeTokenAddress: x(e.unit),
|
|
125
|
+
amount: r.toBigInt(e.gasUsage),
|
|
126
|
+
pricePerUnit: r.toBigInt(e.gasPrice),
|
|
127
|
+
max: d(u(e, r.toBigInt)),
|
|
128
|
+
dataGasConsumed: e.dataGasConsumed ? r.toBigInt(e.dataGasConsumed) : 0n,
|
|
129
|
+
dataGasPrice: e.dataGasPrice ? r.toBigInt(e.dataGasPrice) : 0n
|
|
130
|
+
},
|
|
131
|
+
transactions: {
|
|
132
|
+
feeTokenAddress: x(a.unit),
|
|
133
|
+
amount: r.toBigInt(a.gasUsage),
|
|
134
|
+
pricePerUnit: r.toBigInt(a.gasPrice),
|
|
135
|
+
max: d(u(a, r.toBigInt)),
|
|
136
|
+
dataGasConsumed: a.dataGasConsumed ? r.toBigInt(a.dataGasConsumed) : 0n,
|
|
137
|
+
dataGasPrice: a.dataGasPrice ? r.toBigInt(a.dataGasPrice) : 0n
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
throw Error("Unexpected simulation response length");
|
|
142
|
+
}, z = ({ transaction: t, nonce: n, chainId: e, version: a, isDeploymentTransaction: s, cairoVersion: o, address: m, appDomain: c }) => {
|
|
143
|
+
let i = n;
|
|
144
|
+
s && t.type !== "DEPLOY_ACCOUNT" && (i = r.toHex(1));
|
|
145
|
+
const g = M(t.calls);
|
|
146
|
+
return {
|
|
147
|
+
type: t.type,
|
|
148
|
+
chainId: e,
|
|
149
|
+
cairoVersion: o,
|
|
150
|
+
nonce: i,
|
|
151
|
+
version: a,
|
|
152
|
+
account: m,
|
|
153
|
+
calls: g,
|
|
154
|
+
calldata: t.calldata,
|
|
155
|
+
salt: t.salt,
|
|
156
|
+
signature: t.signature,
|
|
157
|
+
classHash: t.classHash,
|
|
158
|
+
appDomain: c
|
|
159
|
+
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
160
|
+
};
|
|
161
|
+
}, J = (t, n) => {
|
|
162
|
+
const { transactions: e } = t, a = e.map((i) => {
|
|
163
|
+
if (!i.simulation)
|
|
164
|
+
throw new h({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
165
|
+
return i;
|
|
166
|
+
}), s = a.map((i) => ({
|
|
167
|
+
...i.simulation,
|
|
168
|
+
feeEstimation: u(i.simulation.feeEstimation, Number)
|
|
169
|
+
})), o = S(s, n), [m, c] = a.length === 1 ? [a[0], void 0] : [a[1], a[0]];
|
|
170
|
+
return {
|
|
171
|
+
...o,
|
|
172
|
+
transactions: {
|
|
173
|
+
...o.transactions,
|
|
174
|
+
dataGasConsumed: o.transactions.dataGasConsumed ?? 0n,
|
|
175
|
+
dataGasPrice: o.transactions.dataGasPrice ?? 0n,
|
|
176
|
+
max: d(u(m.simulation.feeEstimation, r.toBigInt))
|
|
177
|
+
},
|
|
178
|
+
deployment: o.deployment && c ? {
|
|
179
|
+
...o.deployment,
|
|
180
|
+
dataGasConsumed: o.deployment.dataGasConsumed ?? 0n,
|
|
181
|
+
dataGasPrice: o.deployment.dataGasPrice ?? 0n,
|
|
182
|
+
max: d(u(c.simulation.feeEstimation, r.toBigInt))
|
|
183
|
+
} : void 0
|
|
184
|
+
};
|
|
185
|
+
}, Q = (t) => {
|
|
186
|
+
const n = B(t), e = P(t);
|
|
187
|
+
return {
|
|
188
|
+
// for v1 transactions
|
|
189
|
+
maxFee: e,
|
|
190
|
+
// for v3 transactions
|
|
191
|
+
resourceBounds: {
|
|
192
|
+
l1_gas: {
|
|
193
|
+
// (overall_fee / gas_price) × gas_safety_margin
|
|
194
|
+
max_amount: r.toHex(e / t.pricePerUnit),
|
|
195
|
+
// max_price_per_unit: gas_price × fee_safety_margin
|
|
196
|
+
max_price_per_unit: r.toHex(n.pricePerUnit)
|
|
197
|
+
},
|
|
198
|
+
l2_gas: {
|
|
199
|
+
max_amount: "0x0",
|
|
200
|
+
max_price_per_unit: "0x0"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}, X = (t) => {
|
|
205
|
+
const n = Math.sqrt(t);
|
|
206
|
+
return isNaN(n) ? Math.sqrt(2) : n;
|
|
207
|
+
}, R = (t) => {
|
|
208
|
+
const n = Math.cbrt(t);
|
|
209
|
+
return isNaN(n) ? Math.cbrt(2) : n;
|
|
210
|
+
}, Z = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1;
|
|
211
|
+
export {
|
|
212
|
+
$ as buildDummyTx,
|
|
213
|
+
R as calculateCubeRootAdjustment,
|
|
214
|
+
Z as calculateNonLinearAdjustment,
|
|
215
|
+
X as calculateSqrtAdjustment,
|
|
216
|
+
u as castFeeEstimation,
|
|
217
|
+
P as estimatedFeeToMaxFeeTotal,
|
|
218
|
+
Q as estimatedFeeToMaxResourceBounds,
|
|
219
|
+
p as estimatedFeeToTotal,
|
|
220
|
+
Y as estimatedFeesToMaxFeeTotal,
|
|
221
|
+
V as estimatedFeesToTotal,
|
|
222
|
+
S as getEstimatedFeeFromBulkSimulation,
|
|
223
|
+
J as getEstimatedFeeFromSimulationAndRespectWatermarkFee,
|
|
224
|
+
z as getPayloadFromTransaction,
|
|
225
|
+
N as getWatermarkedMaxFeeTotal,
|
|
226
|
+
k as isFRI,
|
|
227
|
+
A as isWEI,
|
|
228
|
+
L as multiplyBigIntByFloat,
|
|
229
|
+
d as toMax,
|
|
230
|
+
K as tokensRequireTxV3Support,
|
|
231
|
+
x as unitToFeeTokenAddress
|
|
232
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("starknet"),c=require("../chains/starknet/address.cjs"),s={Transfer:t.hash.getSelectorFromName("Transfer"),Approval:t.hash.getSelectorFromName("Approval")},i=(l,r,a)=>{for(const o of l){const{events:f,internal_calls:n}=o;for(const e of f)for(const d of e.keys)d===s.Approval&&r.push({tokenAddress:c.addressSchema.parse(o.contract_address),owner:e.data[0],spender:e.data[1],value:t.uint256.uint256ToBN({low:e.data[2],high:e.data[3]}).toString()}),d===s.Transfer&&a.push({tokenAddress:c.addressSchema.parse(o.contract_address),from:e.data[0],to:e.data[1],value:t.uint256.uint256ToBN({low:e.data[2],high:e.data[3]}).toString()});n&&i(n,r,a)}return{approvals:r,transfers:a}};exports.EventsBySelector=s;exports.findTransfersAndApprovals=i;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { hash as s, uint256 as d } from "starknet";
|
|
2
|
+
import { addressSchema as c } from "../chains/starknet/address.js";
|
|
3
|
+
const f = {
|
|
4
|
+
Transfer: s.getSelectorFromName("Transfer"),
|
|
5
|
+
// 0x99cd8bde557814842a3121e8ddfd433a539b8c9f14bf31ebf108d12e6196e9
|
|
6
|
+
Approval: s.getSelectorFromName("Approval")
|
|
7
|
+
// 0x134692b230b9e1ffa39098904722134159652b09c5bc41d88d6698779d228ff
|
|
8
|
+
}, p = (i, e, o) => {
|
|
9
|
+
for (const r of i) {
|
|
10
|
+
const { events: l, internal_calls: a } = r;
|
|
11
|
+
for (const t of l)
|
|
12
|
+
for (const n of t.keys)
|
|
13
|
+
n === f.Approval && e.push({
|
|
14
|
+
tokenAddress: c.parse(r.contract_address),
|
|
15
|
+
owner: t.data[0],
|
|
16
|
+
spender: t.data[1],
|
|
17
|
+
value: d.uint256ToBN({ low: t.data[2], high: t.data[3] }).toString()
|
|
18
|
+
}), n === f.Transfer && o.push({
|
|
19
|
+
tokenAddress: c.parse(r.contract_address),
|
|
20
|
+
from: t.data[0],
|
|
21
|
+
to: t.data[1],
|
|
22
|
+
value: d.uint256ToBN({ low: t.data[2], high: t.data[3] }).toString()
|
|
23
|
+
});
|
|
24
|
+
a && p(a, e, o);
|
|
25
|
+
}
|
|
26
|
+
return { approvals: e, transfers: o };
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
f as EventsBySelector,
|
|
30
|
+
p as findTransfersAndApprovals
|
|
31
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("lodash-es"),c=/(0x[a-fA-F0-9]+)\s*\('(.*?)'\)/,o=r=>{if(!e.isString(r))return;const t=r.match(c);if(t&&!e.isEmpty(t[2]))return t[2]};exports.getPrettyRpcError=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("starknet"),t=require("./txv3.cjs");function r(n){return t.feeTokenNeedsTxV3Support({address:n})?e.constants.TRANSACTION_VERSION.V3:e.constants.TRANSACTION_VERSION.V1}function s(n){return t.feeTokenNeedsTxV3Support({address:n})?e.constants.TRANSACTION_VERSION.F3:e.constants.TRANSACTION_VERSION.F1}function T(n,o){return e.isSierra(o.contract)?t.feeTokenNeedsTxV3Support({address:n})?e.constants.TRANSACTION_VERSION.V3:e.constants.TRANSACTION_VERSION.V2:e.constants.TRANSACTION_VERSION.V1}exports.getSimulationTxVersionFromFeeToken=s;exports.getTxVersionFromFeeToken=r;exports.getTxVersionFromFeeTokenForDeclareContract=T;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { constants as e, isSierra as N } from "starknet";
|
|
2
|
+
import { feeTokenNeedsTxV3Support as o } from "./txv3.js";
|
|
3
|
+
function S(r) {
|
|
4
|
+
return o({
|
|
5
|
+
address: r
|
|
6
|
+
}) ? e.TRANSACTION_VERSION.V3 : e.TRANSACTION_VERSION.V1;
|
|
7
|
+
}
|
|
8
|
+
function V(r) {
|
|
9
|
+
return o({ address: r }) ? e.TRANSACTION_VERSION.F3 : e.TRANSACTION_VERSION.F1;
|
|
10
|
+
}
|
|
11
|
+
function A(r, n) {
|
|
12
|
+
return N(n.contract) ? o({ address: r }) ? e.TRANSACTION_VERSION.V3 : e.TRANSACTION_VERSION.V2 : e.TRANSACTION_VERSION.V1;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
V as getSimulationTxVersionFromFeeToken,
|
|
16
|
+
S as getTxVersionFromFeeToken,
|
|
17
|
+
A as getTxVersionFromFeeTokenForDeclareContract
|
|
18
|
+
};
|
|
@@ -14,9 +14,3 @@ export * from './transactionSimulationTypes';
|
|
|
14
14
|
export * from './transactionVersion';
|
|
15
15
|
export * from './txv3';
|
|
16
16
|
export * from './types';
|
|
17
|
-
export * from './useBalanceChange';
|
|
18
|
-
export * from './useErc20Transactions';
|
|
19
|
-
export * from './useErc721Transactions';
|
|
20
|
-
export * from './useMaxAmountTransaction';
|
|
21
|
-
export * from './useTransactionReview';
|
|
22
|
-
export * from './useTransactionReviewV2web';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("starknet"),h=require("url-join"),m=require("../../errors/review.cjs"),w=require("../getTransactionVersion.cjs"),E=require("../estimate/utils.cjs"),T=require("../../utils/url/urlWithQuery.cjs"),y=require("../../features/simulation/transactionReview/schema.cjs"),S=require("../../utils/arrays.cjs");class I{constructor(e,a){this.apiBase=e,this.httpService=a}async getLabels(){const e=h(this.apiBase,"reviewer","labels");return await this.httpService.get(e)}async getWarnings(){const e=h(this.apiBase,"reviewer","warnings/reasons");return await this.httpService.get(e)}async simulateAndReview(e,a,c,o,l,s){const r=a.some(i=>i.type==="DEPLOY_ACCOUNT");try{if(!("getChainId"in e))throw new Error("MISSING_METHOD");const i=w.getTxVersionFromFeeToken(c),t=r?"0x0":await e.getNonce(),n=await e.getChainId(),d={transactions:a.map(g=>({...E.getPayloadFromTransaction({transaction:g,nonce:t,version:i,chainId:n,isDeploymentTransaction:r,appDomain:o,cairoVersion:e.cairoVersion,address:e.address}),type:g.type}))},p=h(this.apiBase,"reviewer","transactions","v2","review","starknet"),F=s?T.urlWithQuery(p,{delayedTransactions:"true"}):p,u=await this.httpService.post(F,{headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(d)},y.simulateAndReviewSchema);if(u.transactions.some(g=>y.isTransactionSimulationError(g)))return u;const v=E.getEstimatedFeeFromSimulationAndRespectWatermarkFee(u,c);return{...u,enrichedFeeEstimation:v}}catch(i){return console.error(i),this.fallbackToOnchainFeeEstimation({transactions:a,account:e,isDeploymentTransaction:r,feeTokenAddress:c,accountDeployTransaction:l})}}getCallsFromTx(e){let a;return e.calls&&(a=S.ensureArray(e.calls)),a}async fallbackToOnchainFeeEstimation({transactions:e,account:a,isDeploymentTransaction:c,feeTokenAddress:o,accountDeployTransaction:l}){try{const s=c?this.getCallsFromTx(e[1]):this.getCallsFromTx(e[0]);if(!s)throw new m.ReviewError({code:"NO_CALLS_FOUND"});const r=await this.fetchFeesOnchain({starknetAccount:a,calls:s,isDeployed:!c,feeTokenAddress:o,accountDeployTransaction:l});return{transactions:[],enrichedFeeEstimation:r,isBackendDown:!0}}catch(s){throw console.error(s),new m.ReviewError({message:`${s}`,code:"SIMULATE_AND_REVIEW_FAILED"})}}async fetchFeesOnchain({starknetAccount:e,calls:a,isDeployed:c,feeTokenAddress:o,accountDeployTransaction:l}){try{const s=w.getTxVersionFromFeeToken(o),r={transactions:{feeTokenAddress:o,amount:0n,pricePerUnit:0n,dataGasConsumed:0n,dataGasPrice:0n}};if(!c&&l){if("estimateFeeBulk"in e){const i=[{type:_.TransactionType.DEPLOY_ACCOUNT,payload:{classHash:l.classHash,addressSalt:l.salt,constructorCalldata:l.calldata,contractAddress:e.address}},{type:_.TransactionType.INVOKE,payload:a}],[t,n]=await e.estimateFeeBulk(i,{version:s}).catch(d=>{throw console.error(d),d});if(!t.gas_consumed||!t.gas_price||!n.gas_consumed||!n.gas_price)throw new m.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});r.deployment={feeTokenAddress:o,amount:t.gas_consumed,pricePerUnit:t.gas_price,dataGasConsumed:t.data_gas_consumed,dataGasPrice:t.data_gas_price},r.transactions={feeTokenAddress:o,amount:n.gas_consumed,pricePerUnit:n.gas_price,dataGasConsumed:n.data_gas_consumed,dataGasPrice:n.data_gas_price}}}else{const{gas_consumed:i,gas_price:t,data_gas_consumed:n,data_gas_price:d}=await e.estimateFee(a,{skipValidate:!0,version:s});if(!i||!t)throw new m.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:"Missing gas_consumed or gas_price"});r.transactions={feeTokenAddress:o,amount:i,pricePerUnit:t,dataGasConsumed:n,dataGasPrice:d}}return r}catch(s){throw new m.ReviewError({code:"ONCHAIN_FEE_ESTIMATION_FAILED",message:`${s}`})}}}exports.TransactionReviewServiceWeb=I;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { TransactionType as u } from "starknet";
|
|
2
|
+
import g from "url-join";
|
|
3
|
+
import { ReviewError as d } from "../../errors/review.js";
|
|
4
|
+
import { getTxVersionFromFeeToken as E } from "../getTransactionVersion.js";
|
|
5
|
+
import { getPayloadFromTransaction as F, getEstimatedFeeFromSimulationAndRespectWatermarkFee as I } from "../estimate/utils.js";
|
|
6
|
+
import { urlWithQuery as C } from "../../utils/url/urlWithQuery.js";
|
|
7
|
+
import { simulateAndReviewSchema as O, isTransactionSimulationError as S } from "../../features/simulation/transactionReview/schema.js";
|
|
8
|
+
import { ensureArray as N } from "../../utils/arrays.js";
|
|
9
|
+
class B {
|
|
10
|
+
constructor(a, e) {
|
|
11
|
+
this.apiBase = a, this.httpService = e;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Fetch transaction review labels
|
|
15
|
+
* @returns {Promise<TransactionReviewLabel[] | undefined>} The account activities.
|
|
16
|
+
*/
|
|
17
|
+
async getLabels() {
|
|
18
|
+
const a = g(this.apiBase, "reviewer", "labels");
|
|
19
|
+
return await this.httpService.get(a);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Fetch transaction review warnings.
|
|
23
|
+
* @returns {Promise<TransactionReviewWarning[] | undefined>} The account activities.
|
|
24
|
+
*/
|
|
25
|
+
async getWarnings() {
|
|
26
|
+
const a = g(this.apiBase, "reviewer", "warnings/reasons");
|
|
27
|
+
return await this.httpService.get(a);
|
|
28
|
+
}
|
|
29
|
+
async simulateAndReview(a, e, c, o, m, t) {
|
|
30
|
+
const r = e.some((i) => i.type === "DEPLOY_ACCOUNT");
|
|
31
|
+
try {
|
|
32
|
+
if (!("getChainId" in a))
|
|
33
|
+
throw new Error("MISSING_METHOD");
|
|
34
|
+
const i = E(c), s = r ? "0x0" : await a.getNonce(), n = await a.getChainId(), l = {
|
|
35
|
+
transactions: e.map((h) => ({
|
|
36
|
+
...F({
|
|
37
|
+
transaction: h,
|
|
38
|
+
nonce: s,
|
|
39
|
+
version: i,
|
|
40
|
+
chainId: n,
|
|
41
|
+
isDeploymentTransaction: r,
|
|
42
|
+
appDomain: o,
|
|
43
|
+
cairoVersion: a.cairoVersion,
|
|
44
|
+
address: a.address
|
|
45
|
+
}),
|
|
46
|
+
type: h.type
|
|
47
|
+
}))
|
|
48
|
+
}, _ = g(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), w = t ? C(_, { delayedTransactions: "true" }) : _, p = await this.httpService.post(w, {
|
|
49
|
+
headers: {
|
|
50
|
+
Accept: "application/json",
|
|
51
|
+
"Content-Type": "application/json"
|
|
52
|
+
},
|
|
53
|
+
body: JSON.stringify(l)
|
|
54
|
+
}, O);
|
|
55
|
+
if (p.transactions.some((h) => S(h)))
|
|
56
|
+
return p;
|
|
57
|
+
const y = I(p, c);
|
|
58
|
+
return {
|
|
59
|
+
...p,
|
|
60
|
+
enrichedFeeEstimation: y
|
|
61
|
+
};
|
|
62
|
+
} catch (i) {
|
|
63
|
+
return console.error(i), this.fallbackToOnchainFeeEstimation({
|
|
64
|
+
transactions: e,
|
|
65
|
+
account: a,
|
|
66
|
+
isDeploymentTransaction: r,
|
|
67
|
+
feeTokenAddress: c,
|
|
68
|
+
accountDeployTransaction: m
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
getCallsFromTx(a) {
|
|
73
|
+
let e;
|
|
74
|
+
return a.calls && (e = N(a.calls)), e;
|
|
75
|
+
}
|
|
76
|
+
async fallbackToOnchainFeeEstimation({ transactions: a, account: e, isDeploymentTransaction: c, feeTokenAddress: o, accountDeployTransaction: m }) {
|
|
77
|
+
try {
|
|
78
|
+
const t = c ? this.getCallsFromTx(a[1]) : this.getCallsFromTx(a[0]);
|
|
79
|
+
if (!t)
|
|
80
|
+
throw new d({
|
|
81
|
+
code: "NO_CALLS_FOUND"
|
|
82
|
+
});
|
|
83
|
+
const r = await this.fetchFeesOnchain({
|
|
84
|
+
starknetAccount: e,
|
|
85
|
+
calls: t,
|
|
86
|
+
isDeployed: !c,
|
|
87
|
+
feeTokenAddress: o,
|
|
88
|
+
accountDeployTransaction: m
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
transactions: [],
|
|
92
|
+
enrichedFeeEstimation: r,
|
|
93
|
+
isBackendDown: !0
|
|
94
|
+
};
|
|
95
|
+
} catch (t) {
|
|
96
|
+
throw console.error(t), new d({
|
|
97
|
+
message: `${t}`,
|
|
98
|
+
code: "SIMULATE_AND_REVIEW_FAILED"
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async fetchFeesOnchain({ starknetAccount: a, calls: e, isDeployed: c, feeTokenAddress: o, accountDeployTransaction: m }) {
|
|
103
|
+
try {
|
|
104
|
+
const t = E(o), r = {
|
|
105
|
+
transactions: {
|
|
106
|
+
feeTokenAddress: o,
|
|
107
|
+
amount: 0n,
|
|
108
|
+
pricePerUnit: 0n,
|
|
109
|
+
dataGasConsumed: 0n,
|
|
110
|
+
dataGasPrice: 0n
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
if (!c && m) {
|
|
114
|
+
if ("estimateFeeBulk" in a) {
|
|
115
|
+
const i = [
|
|
116
|
+
{
|
|
117
|
+
type: u.DEPLOY_ACCOUNT,
|
|
118
|
+
payload: {
|
|
119
|
+
classHash: m.classHash,
|
|
120
|
+
addressSalt: m.salt,
|
|
121
|
+
constructorCalldata: m.calldata,
|
|
122
|
+
contractAddress: a.address
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: u.INVOKE,
|
|
127
|
+
payload: e
|
|
128
|
+
}
|
|
129
|
+
], [s, n] = await a.estimateFeeBulk(i, {
|
|
130
|
+
version: t
|
|
131
|
+
}).catch((l) => {
|
|
132
|
+
throw console.error(l), l;
|
|
133
|
+
});
|
|
134
|
+
if (!s.gas_consumed || !s.gas_price || !n.gas_consumed || !n.gas_price)
|
|
135
|
+
throw new d({
|
|
136
|
+
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
137
|
+
message: "Missing gas_consumed or gas_price"
|
|
138
|
+
});
|
|
139
|
+
r.deployment = {
|
|
140
|
+
feeTokenAddress: o,
|
|
141
|
+
amount: s.gas_consumed,
|
|
142
|
+
pricePerUnit: s.gas_price,
|
|
143
|
+
dataGasConsumed: s.data_gas_consumed,
|
|
144
|
+
dataGasPrice: s.data_gas_price
|
|
145
|
+
}, r.transactions = {
|
|
146
|
+
feeTokenAddress: o,
|
|
147
|
+
amount: n.gas_consumed,
|
|
148
|
+
pricePerUnit: n.gas_price,
|
|
149
|
+
dataGasConsumed: n.data_gas_consumed,
|
|
150
|
+
dataGasPrice: n.data_gas_price
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
const { gas_consumed: i, gas_price: s, data_gas_consumed: n, data_gas_price: l } = await a.estimateFee(e, {
|
|
155
|
+
skipValidate: !0,
|
|
156
|
+
version: t
|
|
157
|
+
});
|
|
158
|
+
if (!i || !s)
|
|
159
|
+
throw new d({
|
|
160
|
+
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
161
|
+
message: "Missing gas_consumed or gas_price"
|
|
162
|
+
});
|
|
163
|
+
r.transactions = {
|
|
164
|
+
feeTokenAddress: o,
|
|
165
|
+
amount: i,
|
|
166
|
+
pricePerUnit: s,
|
|
167
|
+
dataGasConsumed: n,
|
|
168
|
+
dataGasPrice: l
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return r;
|
|
172
|
+
} catch (t) {
|
|
173
|
+
throw new d({
|
|
174
|
+
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
175
|
+
message: `${t}`
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
B as TransactionReviewServiceWeb
|
|
182
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("zod"),e=t.z.object({reason:t.z.string(),severity:t.z.string().optional(),title:t.z.string(),description:t.z.string().optional()});exports.transactionReviewWarningSchema=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=["account-upgrade","approve","set-approval-for-all","swap","transfer"];exports.apiTransactionReviewActivityType=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("starknet"),s=require("zod"),o=Object.values(n.constants.TRANSACTION_VERSION),i=s.z.string().default("0x3").refine(t=>{const e=n.num.toBigInt(t);return o.map(r=>n.num.toBigInt(r)).includes(e)}).transform(t=>n.num.toHex(t));function c(t){if(t===n.constants.TRANSACTION_VERSION.V3||t===n.constants.TRANSACTION_VERSION.F3)throw Error("Only txv1 is supported")}exports.denyTxV3=c;exports.txVersionSchema=i;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { constants as r, num as n } from "starknet";
|
|
2
|
+
import { z as s } from "zod";
|
|
3
|
+
const i = Object.values(r.TRANSACTION_VERSION), m = s.string().default("0x3").refine((t) => {
|
|
4
|
+
const o = n.toBigInt(t);
|
|
5
|
+
return i.map((e) => n.toBigInt(e)).includes(o);
|
|
6
|
+
}).transform((t) => n.toHex(t));
|
|
7
|
+
function u(t) {
|
|
8
|
+
if (t === r.TRANSACTION_VERSION.V3 || t === r.TRANSACTION_VERSION.F3)
|
|
9
|
+
throw Error("Only txv1 is supported");
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
u as denyTxV3,
|
|
13
|
+
m as txVersionSchema
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chains/starknet/services/deploymentData/getAccountClassHash.cjs"),o=require("../chains/starknet/constants.cjs"),t=require("../chains/starknet/address.cjs"),u=[o.STRK_TOKEN_ADDRESS];function n({address:e}){return u.some(s=>t.isEqualAddress(e,s))}function a(e){return e?r.getArgentAccountClassHashesWithTxV3Support().some(s=>t.isEqualAddress(s,e)):!1}exports.classHashSupportsTxV3=a;exports.feeTokenNeedsTxV3Support=n;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getArgentAccountClassHashesWithTxV3Support as t } from "../chains/starknet/services/deploymentData/getAccountClassHash.js";
|
|
2
|
+
import { STRK_TOKEN_ADDRESS as s } from "../chains/starknet/constants.js";
|
|
3
|
+
import { isEqualAddress as o } from "../chains/starknet/address.js";
|
|
4
|
+
const n = [s];
|
|
5
|
+
function f({ address: r }) {
|
|
6
|
+
return n.some((e) => o(r, e));
|
|
7
|
+
}
|
|
8
|
+
function m(r) {
|
|
9
|
+
return r ? t().some((e) => o(e, r)) : !1;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
m as classHashSupportsTxV3,
|
|
13
|
+
f as feeTokenNeedsTxV3Support
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=e=>e.slice(0,6)+"..."+e.slice(-4);exports.formatAddress=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=r=>r==null?[]:Array.isArray(r)?r:[r];exports.ensureArray=e;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("starknet"),m=require("./id.cjs"),f=require("./initials.cjs"),{toBigInt:h}=i.num,a=t=>{const e=t.replace("#","");if(!/^[0-9A-F]{6}$/i.test(e))throw new Error(`Invalid color ${t}`);return`#${e}`},l=(t,e)=>{const r=a(e.background),n=a(e.color??"#ffffff"),o=f.getInitials(t,!0),s=`<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
2
|
+
<rect width="48" height="48" fill="${r}" />
|
|
3
|
+
<text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" font-size="16" font-family="Barlow, Helvetica, Arial, sans-serif" fill="${n}">${o}</text>
|
|
4
|
+
</svg>`;return`data:image/svg+xml;base64,${btoa(s)}`},c=["02BBA8","29C5FF","0078A4","FFBF3D","FFA85C","FF875B","FF675C","FF5C72"],d=t=>{const e=m.id(t).slice(-2),r=parseInt(e,16)%c.length;return c[r]},g=t=>{try{return i.num.toHex(h(i.num.hexToDecimalString(t)))}catch{}return""},F=({accountName:t,networkId:e,accountAddress:r,backgroundColor:n})=>{const o=g(r),s=`${e}::${o}`,u=n||d(s);return l(t,{background:u})};exports.generateAvatarImage=l;exports.getColor=d;exports.getNetworkAccountImageUrl=F;exports.stripAddressZeroPadding=g;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { num as i } from "starknet";
|
|
2
|
+
import { id as d } from "./id.js";
|
|
3
|
+
import { getInitials as g } from "./initials.js";
|
|
4
|
+
const { toBigInt: f } = i, a = (t) => {
|
|
5
|
+
const r = t.replace("#", "");
|
|
6
|
+
if (!/^[0-9A-F]{6}$/i.test(r))
|
|
7
|
+
throw new Error(`Invalid color ${t}`);
|
|
8
|
+
return `#${r}`;
|
|
9
|
+
}, m = (t, r) => {
|
|
10
|
+
const e = a(r.background), o = a(r.color ?? "#ffffff"), n = g(t, !0), s = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
11
|
+
<rect width="48" height="48" fill="${e}" />
|
|
12
|
+
<text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" font-size="16" font-family="Barlow, Helvetica, Arial, sans-serif" fill="${o}">${n}</text>
|
|
13
|
+
</svg>`;
|
|
14
|
+
return `data:image/svg+xml;base64,${btoa(s)}`;
|
|
15
|
+
}, c = [
|
|
16
|
+
"02BBA8",
|
|
17
|
+
"29C5FF",
|
|
18
|
+
"0078A4",
|
|
19
|
+
"FFBF3D",
|
|
20
|
+
"FFA85C",
|
|
21
|
+
"FF875B",
|
|
22
|
+
"FF675C",
|
|
23
|
+
"FF5C72"
|
|
24
|
+
], h = (t) => {
|
|
25
|
+
const r = d(t).slice(-2), e = parseInt(r, 16) % c.length;
|
|
26
|
+
return c[e];
|
|
27
|
+
}, u = (t) => {
|
|
28
|
+
try {
|
|
29
|
+
return i.toHex(f(i.hexToDecimalString(t)));
|
|
30
|
+
} catch {
|
|
31
|
+
}
|
|
32
|
+
return "";
|
|
33
|
+
}, A = ({ accountName: t, networkId: r, accountAddress: e, backgroundColor: o }) => {
|
|
34
|
+
const n = u(e), s = `${r}::${n}`, l = o || h(s);
|
|
35
|
+
return m(t, { background: l });
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
m as generateAvatarImage,
|
|
39
|
+
h as getColor,
|
|
40
|
+
A as getNetworkAccountImageUrl,
|
|
41
|
+
u as stripAddressZeroPadding
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@scure/base"),o=require("starknet"),c=e=>{const s=o.encode.removeHexPrefix(o.encode.sanitizeHex(o.num.toHex(e))),a=n.hex.decode(s);return n.base58.encode(a)},t=e=>e.map(c),r=e=>{const s=n.base58.decode(e);return o.encode.sanitizeHex(n.hex.encode(s))},d=e=>e.map(r);exports.decodeBase58=r;exports.decodeBase58Array=d;exports.encodeBase58=c;exports.encodeBase58Array=t;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { hex as r, base58 as c } from "@scure/base";
|
|
2
|
+
import { encode as n, num as s } from "starknet";
|
|
3
|
+
const a = (e) => {
|
|
4
|
+
const o = n.removeHexPrefix(n.sanitizeHex(s.toHex(e))), t = r.decode(o);
|
|
5
|
+
return c.encode(t);
|
|
6
|
+
}, m = (e) => e.map(a), d = (e) => {
|
|
7
|
+
const o = c.decode(e);
|
|
8
|
+
return n.sanitizeHex(r.encode(o));
|
|
9
|
+
}, i = (e) => e.map(d);
|
|
10
|
+
export {
|
|
11
|
+
d as decodeBase58,
|
|
12
|
+
i as decodeBase58Array,
|
|
13
|
+
a as encodeBase58,
|
|
14
|
+
m as encodeBase58Array
|
|
15
|
+
};
|