@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
package/dist/index.mjs
DELETED
|
@@ -1,4466 +0,0 @@
|
|
|
1
|
-
import F, { z as f } from "zod";
|
|
2
|
-
import { O as Or, a as kr, b as Pr, c as Rr, d as $r, e as Fr, f as Ur, g as jr, h as _e, i as Lr, j as Dr, l as Hr, k as Vr, m as Mr, n as Gr, o as qr, p as On, q as Wr, r as zr, s as Kr, t as Yr, u as Zr, v as Xr, D as Jr, w as Qr } from "./bips-DKbEGvGl.mjs";
|
|
3
|
-
import { x as Cd } from "./bips-DKbEGvGl.mjs";
|
|
4
|
-
import { p as Qt, H as K, a as ze, u as P, N as kn, c as ts, C as Pn, A as St, i as es, b as ns, n as Rn, d as rs, e as ss, f as os, g as as, s as Q, h as nt, j as Ke, k as is, l as Ye, M as Ze, m as cs, o as ls, q as Ne, r as us, t as te, B as Xe, v as kt, w as ds, x as fs, y as hs, z as ps, D as ms, E as gs, F as ws, G as Ce } from "./webToken.model-CpudLBp0.mjs";
|
|
5
|
-
import { a8 as kd, bk as Pd, a$ as Rd, b7 as $d, aP as Fd, aT as Ud, $ as jd, a0 as Ld, X as Dd, W as Hd, P as Vd, K as Md, L as Gd, O as qd, am as Wd, ah as zd, ai as Kd, ad as Yd, ae as Zd, ak as Xd, aj as Jd, al as Qd, ac as tf, ab as ef, aa as nf, af as rf, ag as sf, a9 as of, an as af, a5 as cf, a1 as lf, ay as uf, aD as df, aA as ff, aW as hf, b9 as pf, b4 as mf, bf as gf, a4 as wf, aL as yf, aF as bf, aN as Sf, aS as Ef, bh as Af, bg as xf, bd as vf, aZ as Tf, aX as If, aC as Bf, ao as _f, aY as Nf, aO as Cf, b6 as Of, b2 as kf, aV as Pf, aM as Rf, R as $f, Q as Ff, T as Uf, U as jf, b1 as Lf, b0 as Df, az as Hf, S as Vf, a2 as Mf, Z as Gf, a6 as qf, Y as Wf, b8 as zf, b3 as Kf, aK as Yf, aH as Zf, _ as Xf, a3 as Jf, a7 as Qf, a_ as th, be as eh, aG as nh, aI as rh, aJ as sh, aQ as oh, aU as ah, aR as ih, bb as ch, bc as lh, ba as uh, V as dh, aB as fh, b5 as hh, aE as ph, bm as mh, bl as gh, bi as wh, bn as yh, bj as bh, I as Sh, J as Eh, ap as Ah, aq as xh, ax as vh, aw as Th, ar as Ih, au as Bh, as as _h, at as Nh, av as Ch } from "./webToken.model-CpudLBp0.mjs";
|
|
6
|
-
import { S as ys, r as bs, a as Oe, E as $n, f as fe, b as Ss, c as Es, s as As, i as xs, R as Bt } from "./transactionVersion-Cjoucwcx.mjs";
|
|
7
|
-
import { G as kh, I as Ph, F as Rh, h as $h, T as Fh, e as Uh, d as jh, g as Lh, j as Dh, w as Hh, m as Vh, n as Mh, o as Gh, k as qh, l as Wh, v as zh, p as Kh, t as Yh, u as Zh, N as Xh, J as Jh, C as Qh, K as tp, z as ep, A as np, D as rp, y as sp, q as op, H as ap, L as ip, B as cp, M as lp, x as up } from "./transactionVersion-Cjoucwcx.mjs";
|
|
8
|
-
import { constants as Y, starknetId as Fn, CallData as mt, CairoOption as Je, CairoOptionVariant as Qe, hash as Un, num as O, encode as Rt, uint256 as Dt, ec as vs, isSierra as Ts, TransactionType as tn } from "starknet";
|
|
9
|
-
import { useEffect as $t, useRef as en, useState as jn, useMemo as xt, useCallback as Ln, createContext as Is } from "react";
|
|
10
|
-
import { isFunction as Vt, isString as Dn, upperCase as ke, isNil as Bs, upperFirst as _s, lowerCase as Hn, isUndefined as Ns, isEmpty as nn, isArray as Cs } from "lodash-es";
|
|
11
|
-
import ee, { useSWRConfig as Os } from "swr";
|
|
12
|
-
import { hex as Vn, base58 as Mn, stringToBytes as ks } from "@scure/base";
|
|
13
|
-
import { UAParser as Ps } from "ua-parser-js";
|
|
14
|
-
import { validateMnemonic as Rs } from "@scure/bip39";
|
|
15
|
-
import { wordlist as $s } from "@scure/bip39/wordlists/english";
|
|
16
|
-
import Fs from "object-hash";
|
|
17
|
-
import { jsx as Us } from "react/jsx-runtime";
|
|
18
|
-
const js = f.object({
|
|
19
|
-
name: f.string().optional(),
|
|
20
|
-
address: f.string(),
|
|
21
|
-
ownerAddress: f.string(),
|
|
22
|
-
chain: f.enum(["ethereum", "zksync", "zksync2", "starknet"]),
|
|
23
|
-
deploymentStatus: f.enum([
|
|
24
|
-
"notDeployed",
|
|
25
|
-
"deploying",
|
|
26
|
-
"deployed",
|
|
27
|
-
"deployError"
|
|
28
|
-
]),
|
|
29
|
-
application: f.enum(["mobile", "webwallet", "argentx"]),
|
|
30
|
-
guardianAddresses: f.array(f.string()).optional(),
|
|
31
|
-
enabledGuardianAddresses: f.array(f.string()).optional(),
|
|
32
|
-
implClassHash: f.string().optional(),
|
|
33
|
-
proxyClassHash: f.string().optional(),
|
|
34
|
-
salt: f.string().optional(),
|
|
35
|
-
created: f.string().optional(),
|
|
36
|
-
contractVersion: f.string().optional(),
|
|
37
|
-
contractName: f.string().optional(),
|
|
38
|
-
version: f.number().optional(),
|
|
39
|
-
owner: f.object({
|
|
40
|
-
guid: f.string().optional(),
|
|
41
|
-
signerType: f.enum(["StarknetKey", "EthereumKey"]).optional()
|
|
42
|
-
}).optional()
|
|
43
|
-
}), Ol = f.object({
|
|
44
|
-
address: f.string(),
|
|
45
|
-
guardianAddress: f.string().optional(),
|
|
46
|
-
account: js
|
|
47
|
-
}), kl = f.object({
|
|
48
|
-
ownerAddress: f.string(),
|
|
49
|
-
signature: f.object({
|
|
50
|
-
r: f.string(),
|
|
51
|
-
s: f.string()
|
|
52
|
-
}),
|
|
53
|
-
implClassHash: f.string().optional(),
|
|
54
|
-
name: f.string().optional(),
|
|
55
|
-
icon: f.string().optional()
|
|
56
|
-
});
|
|
57
|
-
function Pl(t) {
|
|
58
|
-
return "transactionVersion" in t;
|
|
59
|
-
}
|
|
60
|
-
function Rl(t) {
|
|
61
|
-
return "simulateTransaction" in t;
|
|
62
|
-
}
|
|
63
|
-
function $l(t) {
|
|
64
|
-
return !("simulateTransaction" in t);
|
|
65
|
-
}
|
|
66
|
-
const Ls = f.object({
|
|
67
|
-
value: f.string(),
|
|
68
|
-
platform: f.enum(["ios", "argentx", "android", "webwallet"]).nullable()
|
|
69
|
-
}), Fl = f.object({
|
|
70
|
-
preferences: f.record(Ls)
|
|
71
|
-
}), Ds = f.enum(["mainnet-alpha", "sepolia-alpha"]), Hs = f.enum(["mainnet", "sepolia"]);
|
|
72
|
-
function Ul(t) {
|
|
73
|
-
return Ds.safeParse(t).success;
|
|
74
|
-
}
|
|
75
|
-
function jl(t) {
|
|
76
|
-
return Hs.safeParse(t).success;
|
|
77
|
-
}
|
|
78
|
-
function Vs(t) {
|
|
79
|
-
return f.string().refine((e) => /^-?\d+(\.\d+)?$/.test(e), { message: "Invalid number format" }).transform((e) => Qt(e, t));
|
|
80
|
-
}
|
|
81
|
-
const Ll = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
82
|
-
__proto__: null,
|
|
83
|
-
ONE: Or,
|
|
84
|
-
abs: kr,
|
|
85
|
-
absBigInt: Pr,
|
|
86
|
-
add: Rr,
|
|
87
|
-
createUnitsSchema: Vs,
|
|
88
|
-
div: $r,
|
|
89
|
-
eq: Fr,
|
|
90
|
-
formatCurrency: Ur,
|
|
91
|
-
formatEther: jr,
|
|
92
|
-
formatUnits: _e,
|
|
93
|
-
gt: Lr,
|
|
94
|
-
gte: Dr,
|
|
95
|
-
lt: Hr,
|
|
96
|
-
lte: Vr,
|
|
97
|
-
mod: Mr,
|
|
98
|
-
mul: Gr,
|
|
99
|
-
not: qr,
|
|
100
|
-
parseCurrency: On,
|
|
101
|
-
parseCurrencyAbs: Wr,
|
|
102
|
-
parseEther: zr,
|
|
103
|
-
parseUnits: Qt,
|
|
104
|
-
sub: Kr,
|
|
105
|
-
toBigDecimal: Yr,
|
|
106
|
-
toFixedDecimals: Zr,
|
|
107
|
-
toTiniestPossibleDecimal: Xr
|
|
108
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
109
|
-
class Dl {
|
|
110
|
-
constructor(e, n) {
|
|
111
|
-
this.cachePromise = n.open(e).catch((r) => (console.error(new Error("Failed to open cache", { cause: r })), null));
|
|
112
|
-
}
|
|
113
|
-
async get(e) {
|
|
114
|
-
const n = await this.cachePromise;
|
|
115
|
-
if (!n)
|
|
116
|
-
throw new Error("No cache available");
|
|
117
|
-
const r = await n.match(e).catch(() => {
|
|
118
|
-
throw new Error("Failed to match cache");
|
|
119
|
-
});
|
|
120
|
-
if (!r)
|
|
121
|
-
throw new Error("Failed to match cache");
|
|
122
|
-
return r.clone();
|
|
123
|
-
}
|
|
124
|
-
async set(e, n) {
|
|
125
|
-
const r = await this.cachePromise;
|
|
126
|
-
r && await r.put(e, n).catch(() => {
|
|
127
|
-
throw new Error("Failed to match cache");
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async delete(e) {
|
|
131
|
-
const n = await this.cachePromise;
|
|
132
|
-
return n ? n.delete(e) : !1;
|
|
133
|
-
}
|
|
134
|
-
// should be called on logout
|
|
135
|
-
async flush() {
|
|
136
|
-
const e = await this.cachePromise;
|
|
137
|
-
if (!e)
|
|
138
|
-
return;
|
|
139
|
-
const n = await e.keys();
|
|
140
|
-
await Promise.allSettled(n.map((r) => e.delete(r)));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
class Hl {
|
|
144
|
-
constructor(e, n) {
|
|
145
|
-
this.httpService = e, this.baseUrl = n, this.offsetInS = 0, this.syncIntervalInMs = 60 * 1e3, this.initialSync = this.syncWithServer(), setInterval(() => void this.syncWithServer(), this.syncIntervalInMs);
|
|
146
|
-
}
|
|
147
|
-
async now() {
|
|
148
|
-
return await this.initialSync, new Date(Date.now() + this.offsetInS * 1e3);
|
|
149
|
-
}
|
|
150
|
-
async syncWithServer() {
|
|
151
|
-
if (typeof window > "u")
|
|
152
|
-
return;
|
|
153
|
-
const { time: e } = await this.httpService.get(`${this.baseUrl}/time`), n = Math.floor(Date.now() / 1e3), r = e - n;
|
|
154
|
-
this.offsetInS = r;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
class Gn {
|
|
158
|
-
constructor(e, n = "json") {
|
|
159
|
-
this.requestInit = e, this.responseType = n;
|
|
160
|
-
}
|
|
161
|
-
async get(e, n) {
|
|
162
|
-
const r = Vt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
163
|
-
...r,
|
|
164
|
-
...n,
|
|
165
|
-
method: "GET",
|
|
166
|
-
// merge headers
|
|
167
|
-
headers: {
|
|
168
|
-
...r == null ? void 0 : r.headers,
|
|
169
|
-
...n == null ? void 0 : n.headers
|
|
170
|
-
}
|
|
171
|
-
}, o = await fetch(e, s).catch(() => {
|
|
172
|
-
throw new K(ze.FAILED_TO_FETCH_URL, 0);
|
|
173
|
-
});
|
|
174
|
-
if (this.responseType === "json") {
|
|
175
|
-
if (!o.ok)
|
|
176
|
-
throw new K(o.statusText, o.status);
|
|
177
|
-
return await o.json();
|
|
178
|
-
}
|
|
179
|
-
return o;
|
|
180
|
-
}
|
|
181
|
-
async post(e, n, r) {
|
|
182
|
-
const s = Vt(this.requestInit) ? await this.requestInit() : this.requestInit, o = {
|
|
183
|
-
...s,
|
|
184
|
-
...n,
|
|
185
|
-
method: "POST",
|
|
186
|
-
// merge headers
|
|
187
|
-
headers: {
|
|
188
|
-
...s == null ? void 0 : s.headers,
|
|
189
|
-
...n == null ? void 0 : n.headers
|
|
190
|
-
}
|
|
191
|
-
}, a = await fetch(e, o).catch(() => {
|
|
192
|
-
throw new K(ze.FAILED_TO_POST_URL, 0);
|
|
193
|
-
});
|
|
194
|
-
if (!a.ok)
|
|
195
|
-
throw new K(a.statusText, a.status, await a.json());
|
|
196
|
-
if (a.status === 204)
|
|
197
|
-
return {};
|
|
198
|
-
const i = await a.json();
|
|
199
|
-
if (r)
|
|
200
|
-
try {
|
|
201
|
-
return r.parse(i);
|
|
202
|
-
} catch (c) {
|
|
203
|
-
throw new K(c.message, 0);
|
|
204
|
-
}
|
|
205
|
-
return i;
|
|
206
|
-
}
|
|
207
|
-
async put(e, n) {
|
|
208
|
-
const r = Vt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
209
|
-
...r,
|
|
210
|
-
...n,
|
|
211
|
-
method: "PUT",
|
|
212
|
-
// merge headers
|
|
213
|
-
headers: {
|
|
214
|
-
...r == null ? void 0 : r.headers,
|
|
215
|
-
...n == null ? void 0 : n.headers
|
|
216
|
-
}
|
|
217
|
-
}, o = await fetch(e, s).catch(() => {
|
|
218
|
-
throw new K("Failed to put url", 0);
|
|
219
|
-
});
|
|
220
|
-
if (!o.ok)
|
|
221
|
-
throw new K(o.statusText, o.status);
|
|
222
|
-
return await o.json();
|
|
223
|
-
}
|
|
224
|
-
async delete(e, n) {
|
|
225
|
-
const r = Vt(this.requestInit) ? await this.requestInit() : this.requestInit, s = {
|
|
226
|
-
...r,
|
|
227
|
-
...n,
|
|
228
|
-
method: "DELETE",
|
|
229
|
-
// merge headers
|
|
230
|
-
headers: {
|
|
231
|
-
...r == null ? void 0 : r.headers,
|
|
232
|
-
...n == null ? void 0 : n.headers
|
|
233
|
-
}
|
|
234
|
-
}, o = await fetch(e, s).catch(() => {
|
|
235
|
-
throw new K("Failed to delete url", 0);
|
|
236
|
-
});
|
|
237
|
-
if (!o.ok)
|
|
238
|
-
throw new K(o.statusText, o.status);
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
const Mt = (t) => {
|
|
242
|
-
process.env.NODE_ENV;
|
|
243
|
-
};
|
|
244
|
-
function Ms(t, e) {
|
|
245
|
-
const n = t.clone(), r = new Headers(n.headers);
|
|
246
|
-
for (const [s, o] of Object.entries(e))
|
|
247
|
-
r.set(s, o);
|
|
248
|
-
return new Response(n.body, {
|
|
249
|
-
status: n.status,
|
|
250
|
-
statusText: t.statusText,
|
|
251
|
-
headers: r
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
class Vl {
|
|
255
|
-
constructor(e, n, r, s) {
|
|
256
|
-
this.dateService = e, this.cacheService = n, this.httpService = r, this.options = s, this.inFlightRequests = /* @__PURE__ */ new Map();
|
|
257
|
-
}
|
|
258
|
-
async rawGet(e, n) {
|
|
259
|
-
try {
|
|
260
|
-
const r = await this.cacheService.get(e), s = await this.dateService.now(), o = new Date(r.headers.get("date") || ""), a = s.getTime() - o.getTime();
|
|
261
|
-
if (a < this.options.freshFor)
|
|
262
|
-
return Mt("🟢 [SWR] Using fresh cache"), r;
|
|
263
|
-
if (a < this.options.staleFor)
|
|
264
|
-
return this.fetchAndCache(e, n), Mt("🟠 [SWR] Revalidating cache"), r;
|
|
265
|
-
throw new Error("Cache too old");
|
|
266
|
-
} catch (r) {
|
|
267
|
-
if (r instanceof K)
|
|
268
|
-
throw r;
|
|
269
|
-
return Mt(), await this.fetchAndCache(e, n);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
async get(e, n) {
|
|
273
|
-
const r = await this.rawGet(e, n);
|
|
274
|
-
return this.parseResponse(r);
|
|
275
|
-
}
|
|
276
|
-
async fetchAndCache(e, n) {
|
|
277
|
-
const r = this.inFlightRequests.get(e);
|
|
278
|
-
if (!r) {
|
|
279
|
-
const s = this.httpService.get(e, n).then(async (o) => {
|
|
280
|
-
const a = await this.dateService.now();
|
|
281
|
-
return await this.cacheService.set(e, Ms(o, {
|
|
282
|
-
date: a.toUTCString()
|
|
283
|
-
})), o;
|
|
284
|
-
}).finally(() => {
|
|
285
|
-
this.inFlightRequests.delete(e);
|
|
286
|
-
});
|
|
287
|
-
return this.inFlightRequests.set(e, s), s;
|
|
288
|
-
}
|
|
289
|
-
return Mt(), r;
|
|
290
|
-
}
|
|
291
|
-
parseResponse(e) {
|
|
292
|
-
if (e.ok)
|
|
293
|
-
return e.json();
|
|
294
|
-
throw new K(e.statusText, e.status);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
const zt = (t, e, n) => {
|
|
298
|
-
const r = new Error(t);
|
|
299
|
-
r.name = "FetcherError", r.url = e.url, r.status = e.status, r.statusText = e.statusText, r.responseText = n;
|
|
300
|
-
try {
|
|
301
|
-
const s = JSON.parse(n);
|
|
302
|
-
r.responseJson = s;
|
|
303
|
-
} catch {
|
|
304
|
-
}
|
|
305
|
-
return r;
|
|
306
|
-
}, qn = async (t, e) => {
|
|
307
|
-
const n = await fetch(t, e), r = await n.text();
|
|
308
|
-
if (!n.ok)
|
|
309
|
-
throw zt("An error occurred while fetching", n, r);
|
|
310
|
-
try {
|
|
311
|
-
return JSON.parse(r);
|
|
312
|
-
} catch {
|
|
313
|
-
throw zt("An error occurred while parsing", n, r);
|
|
314
|
-
}
|
|
315
|
-
}, Ml = async (t, e) => {
|
|
316
|
-
const n = await fetch(t, {
|
|
317
|
-
method: "POST",
|
|
318
|
-
...e
|
|
319
|
-
}), r = await n.text();
|
|
320
|
-
if (!n.ok)
|
|
321
|
-
throw zt("An error occurred while fetching", n, r);
|
|
322
|
-
try {
|
|
323
|
-
return JSON.parse(r);
|
|
324
|
-
} catch {
|
|
325
|
-
throw zt("An error occurred while parsing", n, r);
|
|
326
|
-
}
|
|
327
|
-
}, Gl = (t) => ({
|
|
328
|
-
refreshInterval: t,
|
|
329
|
-
dedupingInterval: t
|
|
330
|
-
}), ql = (t) => `${t.networkId}::${t.address}`, Gs = () => {
|
|
331
|
-
};
|
|
332
|
-
function qs(t, e, n, r) {
|
|
333
|
-
const { cache: s } = Os(), o = ee(t && e, t ? n : Gs, r);
|
|
334
|
-
return $t(() => {
|
|
335
|
-
t || (o.mutate(), s.delete(e));
|
|
336
|
-
}, [t]), o;
|
|
337
|
-
}
|
|
338
|
-
const Wl = {
|
|
339
|
-
revalidateOnFocus: !1,
|
|
340
|
-
revalidateOnMount: !0,
|
|
341
|
-
revalidateOnReconnect: !1,
|
|
342
|
-
refreshWhenOffline: !1,
|
|
343
|
-
refreshWhenHidden: !1,
|
|
344
|
-
refreshInterval: 0
|
|
345
|
-
}, Ws = async (t, e) => {
|
|
346
|
-
try {
|
|
347
|
-
const { time: n } = await qn(P(t, "time"), {
|
|
348
|
-
headers: e
|
|
349
|
-
});
|
|
350
|
-
return n;
|
|
351
|
-
} catch {
|
|
352
|
-
throw new Error("failed to request time");
|
|
353
|
-
}
|
|
354
|
-
}, zl = async (t, e) => {
|
|
355
|
-
const n = await Ws(t, e);
|
|
356
|
-
return Math.floor(n);
|
|
357
|
-
};
|
|
358
|
-
function zs(t) {
|
|
359
|
-
switch (t) {
|
|
360
|
-
case "mainnet-alpha":
|
|
361
|
-
case Y.NetworkName.SN_MAIN:
|
|
362
|
-
return Y.StarknetChainId.SN_MAIN;
|
|
363
|
-
case "sepolia-alpha":
|
|
364
|
-
case Y.NetworkName.SN_SEPOLIA:
|
|
365
|
-
return Y.StarknetChainId.SN_SEPOLIA;
|
|
366
|
-
default:
|
|
367
|
-
throw new kn({
|
|
368
|
-
code: "NOT_FOUND",
|
|
369
|
-
message: `Unknown networkId: ${t}`
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
function Ks(t) {
|
|
374
|
-
return t.replace(".stark", "").split(".").map((r) => Fn.useEncoded(r).toString(10));
|
|
375
|
-
}
|
|
376
|
-
function Ys(t) {
|
|
377
|
-
const e = zs(t);
|
|
378
|
-
return Fn.getStarknetIdContract(e);
|
|
379
|
-
}
|
|
380
|
-
function Zs(t, e) {
|
|
381
|
-
const n = Ys(e), r = Ks(t);
|
|
382
|
-
try {
|
|
383
|
-
const o = { domain: r, hint: [] };
|
|
384
|
-
return ts.parse({
|
|
385
|
-
contractAddress: n,
|
|
386
|
-
entrypoint: "domain_to_address",
|
|
387
|
-
calldata: o
|
|
388
|
-
});
|
|
389
|
-
} catch (s) {
|
|
390
|
-
throw new Pn({
|
|
391
|
-
code: "NOT_VALID",
|
|
392
|
-
options: { error: s }
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
async function Xs(t, e, n) {
|
|
397
|
-
if (!e || !n)
|
|
398
|
-
throw new kn({
|
|
399
|
-
code: "NO_NETWORK_OR_MULTICALL"
|
|
400
|
-
});
|
|
401
|
-
let r = null;
|
|
402
|
-
try {
|
|
403
|
-
r = Zs(t, e);
|
|
404
|
-
} catch (i) {
|
|
405
|
-
throw new Pn({
|
|
406
|
-
code: "NOT_VALID",
|
|
407
|
-
options: { error: i }
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
let s, o;
|
|
411
|
-
try {
|
|
412
|
-
s = await n.callContract(r), o = s[0];
|
|
413
|
-
} catch {
|
|
414
|
-
throw new St({
|
|
415
|
-
code: "STARKNAME_ERROR"
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
if (es(o))
|
|
419
|
-
throw new St({
|
|
420
|
-
code: "STARKNAME_NOT_FOUND",
|
|
421
|
-
message: `${t} not found`
|
|
422
|
-
});
|
|
423
|
-
if (!ns(o))
|
|
424
|
-
throw new St({
|
|
425
|
-
code: "STARKNAME_INVALID_ADDRESS",
|
|
426
|
-
message: `${t} resolved to an invalid address (${o})`
|
|
427
|
-
});
|
|
428
|
-
return Rn(o);
|
|
429
|
-
}
|
|
430
|
-
class Kl {
|
|
431
|
-
constructor(e, n, r) {
|
|
432
|
-
this.httpService = e, this.baseUrl = n, this.allowedArgentNameNetworkId = r;
|
|
433
|
-
}
|
|
434
|
-
async parseAddressOrDomain(e, n, r) {
|
|
435
|
-
if (rs(e))
|
|
436
|
-
return Rn(e);
|
|
437
|
-
try {
|
|
438
|
-
return await this.getAddressFromDomainName(e, n, r);
|
|
439
|
-
} catch {
|
|
440
|
-
throw new St({ code: "NOT_VALID" });
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
async getAddressFromDomainName(e, n, r) {
|
|
444
|
-
if (ss(e))
|
|
445
|
-
return Xs(e, n, r);
|
|
446
|
-
if (os(e)) {
|
|
447
|
-
if (n !== this.allowedArgentNameNetworkId)
|
|
448
|
-
throw new St({
|
|
449
|
-
code: "ARGENT_NAME_INVALID_NETWORK",
|
|
450
|
-
message: `Argent name is only enabled on "${this.allowedArgentNameNetworkId}"`
|
|
451
|
-
});
|
|
452
|
-
return as(e, this.httpService, this.baseUrl);
|
|
453
|
-
}
|
|
454
|
-
throw new St({
|
|
455
|
-
code: "NO_ADDRESS_FROM_DOMAIN"
|
|
456
|
-
});
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
const Js = [
|
|
460
|
-
"0x25ec026985a3bf9d0cc1fe17326b245dfdc3ff89b8fde106542a3ea56c5a918"
|
|
461
|
-
], tt = {
|
|
462
|
-
// CAIRO_0
|
|
463
|
-
// NOTE: 0.2.4 is actually defined as 0.2.3.1 but it's not supported by semver
|
|
464
|
-
"0.2.4": "0x033434ad846cdd5f23eb73ff09fe6fddd568284a0fb7d1be20ee482f044dabe2",
|
|
465
|
-
"0.2.3": "0x1a7820094feaf82d53f53f214b81292d717e7bb9a92bb2488092cd306f3993f",
|
|
466
|
-
"0.2.2": "0x3e327de1c40540b98d05cbcb13552008e36f0ec8d61d46956d2f9752c294328",
|
|
467
|
-
"0.2.1": "0x7e28fb0161d10d1cf7fe1f13e7ca57bce062731a3bd04494dfd2d0412699727",
|
|
468
|
-
// CAIRO_1
|
|
469
|
-
"0.4.0": "0x036078334509b514626504edc9fb252328d1a240e4e948bef8d0c08dff45927f",
|
|
470
|
-
"0.3.1": "0x29927c8af6bccf3f6fda035981e765a7bdbf18a2dc0d630494f8758aa908e2b",
|
|
471
|
-
"0.3.0": "0x1a736d6ed154502257f02b1ccdf4d9d1089f80811cd6acad48e6b6a9d1f2003"
|
|
472
|
-
}, Kt = {
|
|
473
|
-
"0.1.1": "0x6e150953b26271a740bf2b6e9bca17cc52c68d765f761295de51ceb8526ee72",
|
|
474
|
-
"0.1.0": "0x737ee2f87ce571a58c6c8da558ec18a07ceb64a6172d5ec46171fbc80077a48"
|
|
475
|
-
};
|
|
476
|
-
var Qs = typeof global == "object" && global && global.Object === Object && global, to = typeof self == "object" && self && self.Object === Object && self, ne = Qs || to || Function("return this")(), Yt = ne.Symbol, Wn = Object.prototype, eo = Wn.hasOwnProperty, no = Wn.toString, _t = Yt ? Yt.toStringTag : void 0;
|
|
477
|
-
function ro(t) {
|
|
478
|
-
var e = eo.call(t, _t), n = t[_t];
|
|
479
|
-
try {
|
|
480
|
-
t[_t] = void 0;
|
|
481
|
-
var r = !0;
|
|
482
|
-
} catch {
|
|
483
|
-
}
|
|
484
|
-
var s = no.call(t);
|
|
485
|
-
return r && (e ? t[_t] = n : delete t[_t]), s;
|
|
486
|
-
}
|
|
487
|
-
var so = Object.prototype, oo = so.toString;
|
|
488
|
-
function ao(t) {
|
|
489
|
-
return oo.call(t);
|
|
490
|
-
}
|
|
491
|
-
var io = "[object Null]", co = "[object Undefined]", rn = Yt ? Yt.toStringTag : void 0;
|
|
492
|
-
function lo(t) {
|
|
493
|
-
return t == null ? t === void 0 ? co : io : rn && rn in Object(t) ? ro(t) : ao(t);
|
|
494
|
-
}
|
|
495
|
-
function zn(t) {
|
|
496
|
-
var e = typeof t;
|
|
497
|
-
return t != null && (e == "object" || e == "function");
|
|
498
|
-
}
|
|
499
|
-
var uo = "[object AsyncFunction]", fo = "[object Function]", ho = "[object GeneratorFunction]", po = "[object Proxy]";
|
|
500
|
-
function mo(t) {
|
|
501
|
-
if (!zn(t))
|
|
502
|
-
return !1;
|
|
503
|
-
var e = lo(t);
|
|
504
|
-
return e == fo || e == ho || e == uo || e == po;
|
|
505
|
-
}
|
|
506
|
-
var he = ne["__core-js_shared__"], sn = function() {
|
|
507
|
-
var t = /[^.]+$/.exec(he && he.keys && he.keys.IE_PROTO || "");
|
|
508
|
-
return t ? "Symbol(src)_1." + t : "";
|
|
509
|
-
}();
|
|
510
|
-
function go(t) {
|
|
511
|
-
return !!sn && sn in t;
|
|
512
|
-
}
|
|
513
|
-
var wo = Function.prototype, yo = wo.toString;
|
|
514
|
-
function bo(t) {
|
|
515
|
-
if (t != null) {
|
|
516
|
-
try {
|
|
517
|
-
return yo.call(t);
|
|
518
|
-
} catch {
|
|
519
|
-
}
|
|
520
|
-
try {
|
|
521
|
-
return t + "";
|
|
522
|
-
} catch {
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
return "";
|
|
526
|
-
}
|
|
527
|
-
var So = /[\\^$.*+?()[\]{}|]/g, Eo = /^\[object .+?Constructor\]$/, Ao = Function.prototype, xo = Object.prototype, vo = Ao.toString, To = xo.hasOwnProperty, Io = RegExp(
|
|
528
|
-
"^" + vo.call(To).replace(So, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
529
|
-
);
|
|
530
|
-
function Bo(t) {
|
|
531
|
-
if (!zn(t) || go(t))
|
|
532
|
-
return !1;
|
|
533
|
-
var e = mo(t) ? Io : Eo;
|
|
534
|
-
return e.test(bo(t));
|
|
535
|
-
}
|
|
536
|
-
function _o(t, e) {
|
|
537
|
-
return t == null ? void 0 : t[e];
|
|
538
|
-
}
|
|
539
|
-
function Pe(t, e) {
|
|
540
|
-
var n = _o(t, e);
|
|
541
|
-
return Bo(n) ? n : void 0;
|
|
542
|
-
}
|
|
543
|
-
var Ft = Pe(Object, "create");
|
|
544
|
-
function No() {
|
|
545
|
-
this.__data__ = Ft ? Ft(null) : {}, this.size = 0;
|
|
546
|
-
}
|
|
547
|
-
function Co(t) {
|
|
548
|
-
var e = this.has(t) && delete this.__data__[t];
|
|
549
|
-
return this.size -= e ? 1 : 0, e;
|
|
550
|
-
}
|
|
551
|
-
var Oo = "__lodash_hash_undefined__", ko = Object.prototype, Po = ko.hasOwnProperty;
|
|
552
|
-
function Ro(t) {
|
|
553
|
-
var e = this.__data__;
|
|
554
|
-
if (Ft) {
|
|
555
|
-
var n = e[t];
|
|
556
|
-
return n === Oo ? void 0 : n;
|
|
557
|
-
}
|
|
558
|
-
return Po.call(e, t) ? e[t] : void 0;
|
|
559
|
-
}
|
|
560
|
-
var $o = Object.prototype, Fo = $o.hasOwnProperty;
|
|
561
|
-
function Uo(t) {
|
|
562
|
-
var e = this.__data__;
|
|
563
|
-
return Ft ? e[t] !== void 0 : Fo.call(e, t);
|
|
564
|
-
}
|
|
565
|
-
var jo = "__lodash_hash_undefined__";
|
|
566
|
-
function Lo(t, e) {
|
|
567
|
-
var n = this.__data__;
|
|
568
|
-
return this.size += this.has(t) ? 0 : 1, n[t] = Ft && e === void 0 ? jo : e, this;
|
|
569
|
-
}
|
|
570
|
-
function ft(t) {
|
|
571
|
-
var e = -1, n = t == null ? 0 : t.length;
|
|
572
|
-
for (this.clear(); ++e < n; ) {
|
|
573
|
-
var r = t[e];
|
|
574
|
-
this.set(r[0], r[1]);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
ft.prototype.clear = No;
|
|
578
|
-
ft.prototype.delete = Co;
|
|
579
|
-
ft.prototype.get = Ro;
|
|
580
|
-
ft.prototype.has = Uo;
|
|
581
|
-
ft.prototype.set = Lo;
|
|
582
|
-
function Do() {
|
|
583
|
-
this.__data__ = [], this.size = 0;
|
|
584
|
-
}
|
|
585
|
-
function Ho(t, e) {
|
|
586
|
-
return t === e || t !== t && e !== e;
|
|
587
|
-
}
|
|
588
|
-
function re(t, e) {
|
|
589
|
-
for (var n = t.length; n--; )
|
|
590
|
-
if (Ho(t[n][0], e))
|
|
591
|
-
return n;
|
|
592
|
-
return -1;
|
|
593
|
-
}
|
|
594
|
-
var Vo = Array.prototype, Mo = Vo.splice;
|
|
595
|
-
function Go(t) {
|
|
596
|
-
var e = this.__data__, n = re(e, t);
|
|
597
|
-
if (n < 0)
|
|
598
|
-
return !1;
|
|
599
|
-
var r = e.length - 1;
|
|
600
|
-
return n == r ? e.pop() : Mo.call(e, n, 1), --this.size, !0;
|
|
601
|
-
}
|
|
602
|
-
function qo(t) {
|
|
603
|
-
var e = this.__data__, n = re(e, t);
|
|
604
|
-
return n < 0 ? void 0 : e[n][1];
|
|
605
|
-
}
|
|
606
|
-
function Wo(t) {
|
|
607
|
-
return re(this.__data__, t) > -1;
|
|
608
|
-
}
|
|
609
|
-
function zo(t, e) {
|
|
610
|
-
var n = this.__data__, r = re(n, t);
|
|
611
|
-
return r < 0 ? (++this.size, n.push([t, e])) : n[r][1] = e, this;
|
|
612
|
-
}
|
|
613
|
-
function vt(t) {
|
|
614
|
-
var e = -1, n = t == null ? 0 : t.length;
|
|
615
|
-
for (this.clear(); ++e < n; ) {
|
|
616
|
-
var r = t[e];
|
|
617
|
-
this.set(r[0], r[1]);
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
vt.prototype.clear = Do;
|
|
621
|
-
vt.prototype.delete = Go;
|
|
622
|
-
vt.prototype.get = qo;
|
|
623
|
-
vt.prototype.has = Wo;
|
|
624
|
-
vt.prototype.set = zo;
|
|
625
|
-
var Ko = Pe(ne, "Map");
|
|
626
|
-
function Yo() {
|
|
627
|
-
this.size = 0, this.__data__ = {
|
|
628
|
-
hash: new ft(),
|
|
629
|
-
map: new (Ko || vt)(),
|
|
630
|
-
string: new ft()
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
function Zo(t) {
|
|
634
|
-
var e = typeof t;
|
|
635
|
-
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
636
|
-
}
|
|
637
|
-
function se(t, e) {
|
|
638
|
-
var n = t.__data__;
|
|
639
|
-
return Zo(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
640
|
-
}
|
|
641
|
-
function Xo(t) {
|
|
642
|
-
var e = se(this, t).delete(t);
|
|
643
|
-
return this.size -= e ? 1 : 0, e;
|
|
644
|
-
}
|
|
645
|
-
function Jo(t) {
|
|
646
|
-
return se(this, t).get(t);
|
|
647
|
-
}
|
|
648
|
-
function Qo(t) {
|
|
649
|
-
return se(this, t).has(t);
|
|
650
|
-
}
|
|
651
|
-
function ta(t, e) {
|
|
652
|
-
var n = se(this, t), r = n.size;
|
|
653
|
-
return n.set(t, e), this.size += n.size == r ? 0 : 1, this;
|
|
654
|
-
}
|
|
655
|
-
function Tt(t) {
|
|
656
|
-
var e = -1, n = t == null ? 0 : t.length;
|
|
657
|
-
for (this.clear(); ++e < n; ) {
|
|
658
|
-
var r = t[e];
|
|
659
|
-
this.set(r[0], r[1]);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
Tt.prototype.clear = Yo;
|
|
663
|
-
Tt.prototype.delete = Xo;
|
|
664
|
-
Tt.prototype.get = Jo;
|
|
665
|
-
Tt.prototype.has = Qo;
|
|
666
|
-
Tt.prototype.set = ta;
|
|
667
|
-
var ea = "__lodash_hash_undefined__";
|
|
668
|
-
function na(t) {
|
|
669
|
-
return this.__data__.set(t, ea), this;
|
|
670
|
-
}
|
|
671
|
-
function ra(t) {
|
|
672
|
-
return this.__data__.has(t);
|
|
673
|
-
}
|
|
674
|
-
function Zt(t) {
|
|
675
|
-
var e = -1, n = t == null ? 0 : t.length;
|
|
676
|
-
for (this.__data__ = new Tt(); ++e < n; )
|
|
677
|
-
this.add(t[e]);
|
|
678
|
-
}
|
|
679
|
-
Zt.prototype.add = Zt.prototype.push = na;
|
|
680
|
-
Zt.prototype.has = ra;
|
|
681
|
-
function sa(t, e, n, r) {
|
|
682
|
-
for (var s = t.length, o = n + -1; ++o < s; )
|
|
683
|
-
if (e(t[o], o, t))
|
|
684
|
-
return o;
|
|
685
|
-
return -1;
|
|
686
|
-
}
|
|
687
|
-
function oa(t) {
|
|
688
|
-
return t !== t;
|
|
689
|
-
}
|
|
690
|
-
function aa(t, e, n) {
|
|
691
|
-
for (var r = n - 1, s = t.length; ++r < s; )
|
|
692
|
-
if (t[r] === e)
|
|
693
|
-
return r;
|
|
694
|
-
return -1;
|
|
695
|
-
}
|
|
696
|
-
function ia(t, e, n) {
|
|
697
|
-
return e === e ? aa(t, e, n) : sa(t, oa, n);
|
|
698
|
-
}
|
|
699
|
-
function ca(t, e) {
|
|
700
|
-
var n = t == null ? 0 : t.length;
|
|
701
|
-
return !!n && ia(t, e, 0) > -1;
|
|
702
|
-
}
|
|
703
|
-
function la(t, e, n) {
|
|
704
|
-
for (var r = -1, s = t == null ? 0 : t.length; ++r < s; )
|
|
705
|
-
if (n(e, t[r]))
|
|
706
|
-
return !0;
|
|
707
|
-
return !1;
|
|
708
|
-
}
|
|
709
|
-
function ua(t, e) {
|
|
710
|
-
return t.has(e);
|
|
711
|
-
}
|
|
712
|
-
var pe = Pe(ne, "Set");
|
|
713
|
-
function da() {
|
|
714
|
-
}
|
|
715
|
-
function Kn(t) {
|
|
716
|
-
var e = -1, n = Array(t.size);
|
|
717
|
-
return t.forEach(function(r) {
|
|
718
|
-
n[++e] = r;
|
|
719
|
-
}), n;
|
|
720
|
-
}
|
|
721
|
-
var fa = 1 / 0, ha = pe && 1 / Kn(new pe([, -0]))[1] == fa ? function(t) {
|
|
722
|
-
return new pe(t);
|
|
723
|
-
} : da, pa = 200;
|
|
724
|
-
function ma(t, e, n) {
|
|
725
|
-
var r = -1, s = ca, o = t.length, a = !0, i = [], c = i;
|
|
726
|
-
if (n)
|
|
727
|
-
a = !1, s = la;
|
|
728
|
-
else if (o >= pa) {
|
|
729
|
-
var l = ha(t);
|
|
730
|
-
if (l)
|
|
731
|
-
return Kn(l);
|
|
732
|
-
a = !1, s = ua, c = new Zt();
|
|
733
|
-
} else
|
|
734
|
-
c = i;
|
|
735
|
-
t:
|
|
736
|
-
for (; ++r < o; ) {
|
|
737
|
-
var d = t[r], u = d;
|
|
738
|
-
if (d = n || d !== 0 ? d : 0, a && u === u) {
|
|
739
|
-
for (var y = c.length; y--; )
|
|
740
|
-
if (c[y] === u)
|
|
741
|
-
continue t;
|
|
742
|
-
i.push(d);
|
|
743
|
-
} else s(c, u, n) || (c !== i && c.push(u), i.push(d));
|
|
744
|
-
}
|
|
745
|
-
return i;
|
|
746
|
-
}
|
|
747
|
-
function ga(t, e) {
|
|
748
|
-
return e = typeof e == "function" ? e : void 0, t && t.length ? ma(t, void 0, e) : [];
|
|
749
|
-
}
|
|
750
|
-
function on(t) {
|
|
751
|
-
const e = Object.entries(tt), n = Object.entries(Kt);
|
|
752
|
-
switch (t) {
|
|
753
|
-
case "cairo0":
|
|
754
|
-
return e.filter(([r]) => Q.lt(r, "0.3.0")).map(([, r]) => r);
|
|
755
|
-
case "cairo1":
|
|
756
|
-
return e.filter(([r]) => Q.gte(r, "0.3.0")).map(([, r]) => r);
|
|
757
|
-
case "multisig":
|
|
758
|
-
return n.map(([, r]) => r);
|
|
759
|
-
default:
|
|
760
|
-
return e.map(([, r]) => r);
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
function wa() {
|
|
764
|
-
const t = Q.maxSatisfying(Object.keys(tt), "*");
|
|
765
|
-
if (!t)
|
|
766
|
-
throw new Error(`No argent account contract found: v${t} `);
|
|
767
|
-
return tt[t];
|
|
768
|
-
}
|
|
769
|
-
function Yl() {
|
|
770
|
-
const t = Q.maxSatisfying(Object.keys(Kt), "*");
|
|
771
|
-
if (!t)
|
|
772
|
-
throw new Error(`No argent multisig contract found: v${t} `);
|
|
773
|
-
return Kt[t];
|
|
774
|
-
}
|
|
775
|
-
function ya() {
|
|
776
|
-
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
777
|
-
}
|
|
778
|
-
function Zl() {
|
|
779
|
-
const t = Q.maxSatisfying(Object.keys(tt), "<0.3.0");
|
|
780
|
-
if (!t)
|
|
781
|
-
throw new Error(`No argent account contract found: v${t} `);
|
|
782
|
-
return tt[t];
|
|
783
|
-
}
|
|
784
|
-
function ba() {
|
|
785
|
-
const t = Object.entries(tt).filter(([n]) => Q.gte(n, "0.3.1")).map(([, n]) => n), e = Object.entries(Kt).filter(([n]) => Q.gte(n, "0.1.1")).map(([, n]) => n);
|
|
786
|
-
return [...t, ...e];
|
|
787
|
-
}
|
|
788
|
-
function Xl() {
|
|
789
|
-
return Object.entries(tt).filter(([t]) => Q.gte(t, "0.4.0")).map(([, t]) => t);
|
|
790
|
-
}
|
|
791
|
-
function Jl() {
|
|
792
|
-
const t = Q.maxSatisfying(Object.keys(tt), ">=0.4.0");
|
|
793
|
-
if (!t)
|
|
794
|
-
throw new Error(`No ledger account contract found: v${t}`);
|
|
795
|
-
return tt[t];
|
|
796
|
-
}
|
|
797
|
-
const Sa = (t, e) => t.cairoVersion === e.cairoVersion && nt(t.accountClassHash, e.accountClassHash);
|
|
798
|
-
function Ql(t, e, n = []) {
|
|
799
|
-
if (e.type === "imported")
|
|
800
|
-
throw new Error("Cannot find implementation for imported account");
|
|
801
|
-
const r = Ke.parse({
|
|
802
|
-
cairoVersion: e.cairoVersion ?? "1",
|
|
803
|
-
accountClassHash: e.classHash ?? wa()
|
|
804
|
-
}), s = f.array(Ke).parse(n), o = [
|
|
805
|
-
...on("cairo0").map((l) => ({ cairoVersion: "0", accountClassHash: l })),
|
|
806
|
-
...on("cairo1").map((l) => ({ cairoVersion: "1", accountClassHash: l }))
|
|
807
|
-
], c = ga([
|
|
808
|
-
r,
|
|
809
|
-
...s,
|
|
810
|
-
...o
|
|
811
|
-
], Sa).map((l) => ({
|
|
812
|
-
implementation: l,
|
|
813
|
-
address: xa(l.cairoVersion, l.accountClassHash, t, e.guardian, e.salt)
|
|
814
|
-
})).find((l) => nt(l.address, e.address));
|
|
815
|
-
if (!c)
|
|
816
|
-
throw new is({ code: "CALCULATED_ADDRESS_NO_MATCH" });
|
|
817
|
-
return c.implementation;
|
|
818
|
-
}
|
|
819
|
-
function Ea(t, e, n, r, s, o = Js[0]) {
|
|
820
|
-
const a = Aa(t, e, n, r);
|
|
821
|
-
return {
|
|
822
|
-
classHash: t === "0" ? o : e,
|
|
823
|
-
constructorCalldata: mt.compile(a),
|
|
824
|
-
addressSalt: s || n
|
|
825
|
-
};
|
|
826
|
-
}
|
|
827
|
-
function Aa(t, e, n, r) {
|
|
828
|
-
const s = t !== "0" && nt(ys, e), o = {
|
|
829
|
-
pubkey: n,
|
|
830
|
-
...s ? {} : { guardian: r || "0" }
|
|
831
|
-
};
|
|
832
|
-
if (ya().some((i) => nt(i, e))) {
|
|
833
|
-
const i = Ye(n, Ze.Starknet), c = r ? new Je(Qe.Some, Ye(r, Ze.Starknet)) : new Je(Qe.None, null);
|
|
834
|
-
return { ownerSigner: i, guardianAsOption: c };
|
|
835
|
-
}
|
|
836
|
-
return t === "0" ? cs.parse({
|
|
837
|
-
implementation: e,
|
|
838
|
-
selector: Un.getSelectorFromName("initialize"),
|
|
839
|
-
calldata: mt.compile(o)
|
|
840
|
-
}) : ls.parse({
|
|
841
|
-
owner: n,
|
|
842
|
-
guardian: r
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
function xa(t, e, n, r, s) {
|
|
846
|
-
const o = Ea(t, e, n, r, s);
|
|
847
|
-
return Un.calculateContractAddressFromHash(o.addressSalt, o.classHash, o.constructorCalldata, 0);
|
|
848
|
-
}
|
|
849
|
-
function tu(t, e) {
|
|
850
|
-
const n = en(t), r = en();
|
|
851
|
-
return $t(() => {
|
|
852
|
-
n.current = t;
|
|
853
|
-
}, [t]), $t(() => () => {
|
|
854
|
-
r.current && clearTimeout(r.current);
|
|
855
|
-
}, []), (...s) => {
|
|
856
|
-
r.current && clearTimeout(r.current), r.current = setTimeout(() => n.current(...s), e);
|
|
857
|
-
};
|
|
858
|
-
}
|
|
859
|
-
function eu(t, e) {
|
|
860
|
-
const [n, r] = jn(t);
|
|
861
|
-
return $t(() => {
|
|
862
|
-
const s = setTimeout(() => {
|
|
863
|
-
r(t);
|
|
864
|
-
}, e);
|
|
865
|
-
return () => {
|
|
866
|
-
clearTimeout(s);
|
|
867
|
-
};
|
|
868
|
-
}, [t, e]), n;
|
|
869
|
-
}
|
|
870
|
-
const va = f.object({
|
|
871
|
-
name: f.enum([
|
|
872
|
-
"dappland",
|
|
873
|
-
"discord",
|
|
874
|
-
"github",
|
|
875
|
-
"telegram",
|
|
876
|
-
"twitter",
|
|
877
|
-
"website"
|
|
878
|
-
]),
|
|
879
|
-
url: f.string(),
|
|
880
|
-
position: f.number()
|
|
881
|
-
}), Ta = f.object({
|
|
882
|
-
address: Ne,
|
|
883
|
-
chain: f.enum(["ethereum", "starknet"])
|
|
884
|
-
}), Ia = f.object({
|
|
885
|
-
maxExpiryDays: f.number().positive(),
|
|
886
|
-
allowList: f.array(f.object({
|
|
887
|
-
contractAddress: Ne,
|
|
888
|
-
methods: f.array(f.string())
|
|
889
|
-
}))
|
|
890
|
-
}), Ba = f.object({
|
|
891
|
-
dappId: f.string(),
|
|
892
|
-
name: f.string(),
|
|
893
|
-
description: f.string().optional(),
|
|
894
|
-
logoUrl: f.string().optional(),
|
|
895
|
-
dappUrl: f.string().optional(),
|
|
896
|
-
inAppBrowserCompatible: f.boolean(),
|
|
897
|
-
argentVerified: f.boolean(),
|
|
898
|
-
links: f.array(va).optional(),
|
|
899
|
-
contracts: f.array(Ta).optional(),
|
|
900
|
-
categories: f.array(f.string()).optional(),
|
|
901
|
-
supportedApps: f.array(f.string()).optional(),
|
|
902
|
-
brandColor: f.string().optional(),
|
|
903
|
-
executeFromOutsideAllowed: f.boolean().default(!1).optional(),
|
|
904
|
-
sessionConfig: f.union([Ia, f.object({})]).nullable().optional()
|
|
905
|
-
}), _a = f.array(Ba);
|
|
906
|
-
class nu {
|
|
907
|
-
constructor(e, n) {
|
|
908
|
-
this.apiBase = e, this.httpService = new Gn(n, "json");
|
|
909
|
-
}
|
|
910
|
-
async getAll() {
|
|
911
|
-
const e = await this.httpService.get(`${this.apiBase}/tokens/dapps`), n = _a.safeParse(e);
|
|
912
|
-
if (!n.success)
|
|
913
|
-
throw new Error("Failed to parse known dapps");
|
|
914
|
-
return n.data;
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
function Na(t) {
|
|
918
|
-
var e;
|
|
919
|
-
return (e = t == null ? void 0 : t.links) == null ? void 0 : e.find((n) => n.name === "dappland");
|
|
920
|
-
}
|
|
921
|
-
function ru(t) {
|
|
922
|
-
var e;
|
|
923
|
-
return (e = Na(t)) == null ? void 0 : e.url;
|
|
924
|
-
}
|
|
925
|
-
const Yn = F.object({
|
|
926
|
-
domain: us,
|
|
927
|
-
address: te.optional(),
|
|
928
|
-
avatar: F.string().optional(),
|
|
929
|
-
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")])
|
|
930
|
-
}), Ca = F.array(Yn), Oa = F.object({
|
|
931
|
-
provider: F.string(),
|
|
932
|
-
name: F.string(),
|
|
933
|
-
avatar: F.string().optional()
|
|
934
|
-
}), ka = F.object({
|
|
935
|
-
address: te,
|
|
936
|
-
status: F.union([F.literal("KNOWN"), F.literal("UNKNOWN")]),
|
|
937
|
-
resolutions: F.array(Oa).optional()
|
|
938
|
-
}), Pa = F.array(F.string()), Ra = ka.array();
|
|
939
|
-
class su {
|
|
940
|
-
constructor(e, n) {
|
|
941
|
-
this.apiBase = e, this.headers = n, this.httpService = new Gn(this.headers, "json");
|
|
942
|
-
}
|
|
943
|
-
async getAddressFromMultipleStarknetId(e, n, r) {
|
|
944
|
-
const s = new URLSearchParams(n.map((c) => ["domain", c]));
|
|
945
|
-
r && s.set("includeAvatar", "true");
|
|
946
|
-
const o = P(this.apiBase, e, "starknet.id", `?${s}`), a = await this.httpService.get(o), i = Ca.safeParse(a);
|
|
947
|
-
if (!i.success)
|
|
948
|
-
throw new Error("Failed to parse name resolution");
|
|
949
|
-
return i.data;
|
|
950
|
-
}
|
|
951
|
-
async getAddressFromStarknetId(e, n, r) {
|
|
952
|
-
const s = P(this.apiBase, e, "starknet.id", n, r ? "?includeAvatar=true" : ""), o = await this.httpService.get(s), a = Yn.safeParse(o);
|
|
953
|
-
if (!a.success)
|
|
954
|
-
throw new Error("Failed to parse name resolution");
|
|
955
|
-
return a.data;
|
|
956
|
-
}
|
|
957
|
-
/**
|
|
958
|
-
* getAddressFromStarknetId: retrieve address from starknetId
|
|
959
|
-
*/
|
|
960
|
-
async getStarknetIdFromAddress(e, n, r) {
|
|
961
|
-
const s = new URLSearchParams(n.map((c) => ["address", c]));
|
|
962
|
-
r && s.set("includeAvatar", "true");
|
|
963
|
-
const o = P(this.apiBase, e, "addresses", `?${s}`), a = await this.httpService.get(o), i = Ra.safeParse(a);
|
|
964
|
-
if (!i.success)
|
|
965
|
-
throw new Error("Failed to parse name resolution");
|
|
966
|
-
return i.data;
|
|
967
|
-
}
|
|
968
|
-
async getProvidersNames(e) {
|
|
969
|
-
const n = P(this.apiBase, e, "providers", "name"), r = await this.httpService.get(n), s = Pa.safeParse(r);
|
|
970
|
-
if (!s.success)
|
|
971
|
-
throw new Error("Failed to parse name resolution");
|
|
972
|
-
return s.data;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
const Zn = (t) => t.slice(0, 6) + "..." + t.slice(-4);
|
|
976
|
-
function an(t) {
|
|
977
|
-
if (!Number.isSafeInteger(t) || t < 0)
|
|
978
|
-
throw new Error(`positive integer expected, not ${t}`);
|
|
979
|
-
}
|
|
980
|
-
function $a(t) {
|
|
981
|
-
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
982
|
-
}
|
|
983
|
-
function oe(t, ...e) {
|
|
984
|
-
if (!$a(t))
|
|
985
|
-
throw new Error("Uint8Array expected");
|
|
986
|
-
if (e.length > 0 && !e.includes(t.length))
|
|
987
|
-
throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`);
|
|
988
|
-
}
|
|
989
|
-
function cn(t, e = !0) {
|
|
990
|
-
if (t.destroyed)
|
|
991
|
-
throw new Error("Hash instance has been destroyed");
|
|
992
|
-
if (e && t.finished)
|
|
993
|
-
throw new Error("Hash#digest() has already been called");
|
|
994
|
-
}
|
|
995
|
-
function Fa(t, e) {
|
|
996
|
-
oe(t);
|
|
997
|
-
const n = e.outputLen;
|
|
998
|
-
if (t.length < n)
|
|
999
|
-
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1000
|
-
}
|
|
1001
|
-
const Gt = /* @__PURE__ */ BigInt(2 ** 32 - 1), ln = /* @__PURE__ */ BigInt(32);
|
|
1002
|
-
function Ua(t, e = !1) {
|
|
1003
|
-
return e ? { h: Number(t & Gt), l: Number(t >> ln & Gt) } : { h: Number(t >> ln & Gt) | 0, l: Number(t & Gt) | 0 };
|
|
1004
|
-
}
|
|
1005
|
-
function ja(t, e = !1) {
|
|
1006
|
-
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1007
|
-
for (let s = 0; s < t.length; s++) {
|
|
1008
|
-
const { h: o, l: a } = Ua(t[s], e);
|
|
1009
|
-
[n[s], r[s]] = [o, a];
|
|
1010
|
-
}
|
|
1011
|
-
return [n, r];
|
|
1012
|
-
}
|
|
1013
|
-
const La = (t, e, n) => t << n | e >>> 32 - n, Da = (t, e, n) => e << n | t >>> 32 - n, Ha = (t, e, n) => e << n - 32 | t >>> 64 - n, Va = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1014
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1015
|
-
const Ma = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), un = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, Ga = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
1016
|
-
function dn(t) {
|
|
1017
|
-
for (let e = 0; e < t.length; e++)
|
|
1018
|
-
t[e] = Ga(t[e]);
|
|
1019
|
-
}
|
|
1020
|
-
const qa = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1021
|
-
function Wa(t) {
|
|
1022
|
-
oe(t);
|
|
1023
|
-
let e = "";
|
|
1024
|
-
for (let n = 0; n < t.length; n++)
|
|
1025
|
-
e += qa[t[n]];
|
|
1026
|
-
return e;
|
|
1027
|
-
}
|
|
1028
|
-
function Xn(t) {
|
|
1029
|
-
if (typeof t != "string")
|
|
1030
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1031
|
-
return new Uint8Array(new TextEncoder().encode(t));
|
|
1032
|
-
}
|
|
1033
|
-
function Jn(t) {
|
|
1034
|
-
return typeof t == "string" && (t = Xn(t)), oe(t), t;
|
|
1035
|
-
}
|
|
1036
|
-
let za = class {
|
|
1037
|
-
// Safe version that clones internal state
|
|
1038
|
-
clone() {
|
|
1039
|
-
return this._cloneInto();
|
|
1040
|
-
}
|
|
1041
|
-
};
|
|
1042
|
-
function Ka(t) {
|
|
1043
|
-
const e = (r) => t().update(Jn(r)).digest(), n = t();
|
|
1044
|
-
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1045
|
-
}
|
|
1046
|
-
const Qn = [], tr = [], er = [], Ya = /* @__PURE__ */ BigInt(0), Nt = /* @__PURE__ */ BigInt(1), Za = /* @__PURE__ */ BigInt(2), Xa = /* @__PURE__ */ BigInt(7), Ja = /* @__PURE__ */ BigInt(256), Qa = /* @__PURE__ */ BigInt(113);
|
|
1047
|
-
for (let t = 0, e = Nt, n = 1, r = 0; t < 24; t++) {
|
|
1048
|
-
[n, r] = [r, (2 * n + 3 * r) % 5], Qn.push(2 * (5 * r + n)), tr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1049
|
-
let s = Ya;
|
|
1050
|
-
for (let o = 0; o < 7; o++)
|
|
1051
|
-
e = (e << Nt ^ (e >> Xa) * Qa) % Ja, e & Za && (s ^= Nt << (Nt << /* @__PURE__ */ BigInt(o)) - Nt);
|
|
1052
|
-
er.push(s);
|
|
1053
|
-
}
|
|
1054
|
-
const [ti, ei] = /* @__PURE__ */ ja(er, !0), fn = (t, e, n) => n > 32 ? Ha(t, e, n) : La(t, e, n), hn = (t, e, n) => n > 32 ? Va(t, e, n) : Da(t, e, n);
|
|
1055
|
-
function ni(t, e = 24) {
|
|
1056
|
-
const n = new Uint32Array(10);
|
|
1057
|
-
for (let r = 24 - e; r < 24; r++) {
|
|
1058
|
-
for (let a = 0; a < 10; a++)
|
|
1059
|
-
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1060
|
-
for (let a = 0; a < 10; a += 2) {
|
|
1061
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = fn(l, d, 1) ^ n[i], y = hn(l, d, 1) ^ n[i + 1];
|
|
1062
|
-
for (let m = 0; m < 50; m += 10)
|
|
1063
|
-
t[a + m] ^= u, t[a + m + 1] ^= y;
|
|
1064
|
-
}
|
|
1065
|
-
let s = t[2], o = t[3];
|
|
1066
|
-
for (let a = 0; a < 24; a++) {
|
|
1067
|
-
const i = tr[a], c = fn(s, o, i), l = hn(s, o, i), d = Qn[a];
|
|
1068
|
-
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1069
|
-
}
|
|
1070
|
-
for (let a = 0; a < 50; a += 10) {
|
|
1071
|
-
for (let i = 0; i < 10; i++)
|
|
1072
|
-
n[i] = t[a + i];
|
|
1073
|
-
for (let i = 0; i < 10; i++)
|
|
1074
|
-
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1075
|
-
}
|
|
1076
|
-
t[0] ^= ti[r], t[1] ^= ei[r];
|
|
1077
|
-
}
|
|
1078
|
-
n.fill(0);
|
|
1079
|
-
}
|
|
1080
|
-
let ri = class nr extends za {
|
|
1081
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1082
|
-
constructor(e, n, r, s = !1, o = 24) {
|
|
1083
|
-
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, an(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1084
|
-
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1085
|
-
this.state = new Uint8Array(200), this.state32 = Ma(this.state);
|
|
1086
|
-
}
|
|
1087
|
-
keccak() {
|
|
1088
|
-
un || dn(this.state32), ni(this.state32, this.rounds), un || dn(this.state32), this.posOut = 0, this.pos = 0;
|
|
1089
|
-
}
|
|
1090
|
-
update(e) {
|
|
1091
|
-
cn(this);
|
|
1092
|
-
const { blockLen: n, state: r } = this;
|
|
1093
|
-
e = Jn(e);
|
|
1094
|
-
const s = e.length;
|
|
1095
|
-
for (let o = 0; o < s; ) {
|
|
1096
|
-
const a = Math.min(n - this.pos, s - o);
|
|
1097
|
-
for (let i = 0; i < a; i++)
|
|
1098
|
-
r[this.pos++] ^= e[o++];
|
|
1099
|
-
this.pos === n && this.keccak();
|
|
1100
|
-
}
|
|
1101
|
-
return this;
|
|
1102
|
-
}
|
|
1103
|
-
finish() {
|
|
1104
|
-
if (this.finished)
|
|
1105
|
-
return;
|
|
1106
|
-
this.finished = !0;
|
|
1107
|
-
const { state: e, suffix: n, pos: r, blockLen: s } = this;
|
|
1108
|
-
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1109
|
-
}
|
|
1110
|
-
writeInto(e) {
|
|
1111
|
-
cn(this, !1), oe(e), this.finish();
|
|
1112
|
-
const n = this.state, { blockLen: r } = this;
|
|
1113
|
-
for (let s = 0, o = e.length; s < o; ) {
|
|
1114
|
-
this.posOut >= r && this.keccak();
|
|
1115
|
-
const a = Math.min(r - this.posOut, o - s);
|
|
1116
|
-
e.set(n.subarray(this.posOut, this.posOut + a), s), this.posOut += a, s += a;
|
|
1117
|
-
}
|
|
1118
|
-
return e;
|
|
1119
|
-
}
|
|
1120
|
-
xofInto(e) {
|
|
1121
|
-
if (!this.enableXOF)
|
|
1122
|
-
throw new Error("XOF is not possible for this instance");
|
|
1123
|
-
return this.writeInto(e);
|
|
1124
|
-
}
|
|
1125
|
-
xof(e) {
|
|
1126
|
-
return an(e), this.xofInto(new Uint8Array(e));
|
|
1127
|
-
}
|
|
1128
|
-
digestInto(e) {
|
|
1129
|
-
if (Fa(e, this), this.finished)
|
|
1130
|
-
throw new Error("digest() was already called");
|
|
1131
|
-
return this.writeInto(e), this.destroy(), e;
|
|
1132
|
-
}
|
|
1133
|
-
digest() {
|
|
1134
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
1135
|
-
}
|
|
1136
|
-
destroy() {
|
|
1137
|
-
this.destroyed = !0, this.state.fill(0);
|
|
1138
|
-
}
|
|
1139
|
-
_cloneInto(e) {
|
|
1140
|
-
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1141
|
-
return e || (e = new nr(n, r, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = r, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
1142
|
-
}
|
|
1143
|
-
};
|
|
1144
|
-
const si = (t, e, n) => Ka(() => new ri(e, t, n)), oi = /* @__PURE__ */ si(1, 136, 256 / 8);
|
|
1145
|
-
function ai(t) {
|
|
1146
|
-
return `0x${Wa(oi(Xn(t)))}`;
|
|
1147
|
-
}
|
|
1148
|
-
const ii = (t) => {
|
|
1149
|
-
if (!Dn(t))
|
|
1150
|
-
return;
|
|
1151
|
-
const e = /(\d+)$/, n = t.match(e);
|
|
1152
|
-
if (n)
|
|
1153
|
-
return n[1];
|
|
1154
|
-
}, ci = (t, e = !1) => {
|
|
1155
|
-
if (!Dn(t))
|
|
1156
|
-
return "";
|
|
1157
|
-
const n = e ? t.replace(/[^0-9a-z ]/gi, "") : t, s = ke(n).split(" "), o = ii(n), a = s.map((i) => i[0]);
|
|
1158
|
-
return o && o.length > 1 && o.length < n.length ? [a[0], o.substring(0, 2)].join("") : s.length === 1 ? s[0].substring(0, 2) : [a[0], a[a.length - 1]].join("");
|
|
1159
|
-
}, { toBigInt: li } = O, pn = (t) => {
|
|
1160
|
-
const e = t.replace("#", "");
|
|
1161
|
-
if (!/^[0-9A-F]{6}$/i.test(e))
|
|
1162
|
-
throw new Error(`Invalid color ${t}`);
|
|
1163
|
-
return `#${e}`;
|
|
1164
|
-
}, ui = (t, e) => {
|
|
1165
|
-
const n = pn(e.background), r = pn(e.color ?? "#ffffff"), s = ci(t, !0), o = `<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
|
|
1166
|
-
<rect width="48" height="48" fill="${n}" />
|
|
1167
|
-
<text x="50%" y="54%" dominant-baseline="middle" text-anchor="middle" font-size="16" font-family="Barlow, Helvetica, Arial, sans-serif" fill="${r}">${s}</text>
|
|
1168
|
-
</svg>`;
|
|
1169
|
-
return `data:image/svg+xml;base64,${btoa(o)}`;
|
|
1170
|
-
}, mn = [
|
|
1171
|
-
"02BBA8",
|
|
1172
|
-
"29C5FF",
|
|
1173
|
-
"0078A4",
|
|
1174
|
-
"FFBF3D",
|
|
1175
|
-
"FFA85C",
|
|
1176
|
-
"FF875B",
|
|
1177
|
-
"FF675C",
|
|
1178
|
-
"FF5C72"
|
|
1179
|
-
], di = (t) => {
|
|
1180
|
-
const e = ai(t).slice(-2), n = parseInt(e, 16) % mn.length;
|
|
1181
|
-
return mn[n];
|
|
1182
|
-
}, fi = (t) => {
|
|
1183
|
-
try {
|
|
1184
|
-
return O.toHex(li(O.hexToDecimalString(t)));
|
|
1185
|
-
} catch {
|
|
1186
|
-
}
|
|
1187
|
-
return "";
|
|
1188
|
-
}, au = ({ accountName: t, networkId: e, accountAddress: n, backgroundColor: r }) => {
|
|
1189
|
-
const s = fi(n), o = `${e}::${s}`, a = r || di(o);
|
|
1190
|
-
return ui(t, { background: a });
|
|
1191
|
-
}, hi = (t) => {
|
|
1192
|
-
const e = Rt.removeHexPrefix(Rt.sanitizeHex(O.toHex(t))), n = Vn.decode(e);
|
|
1193
|
-
return Mn.encode(n);
|
|
1194
|
-
}, iu = (t) => t.map(hi), pi = (t) => {
|
|
1195
|
-
const e = Mn.decode(t);
|
|
1196
|
-
return Rt.sanitizeHex(Vn.encode(e));
|
|
1197
|
-
}, cu = (t) => t.map(pi);
|
|
1198
|
-
function lu(t, e) {
|
|
1199
|
-
const n = t.getTime(), r = e.getTime(), s = Math.abs(n - r);
|
|
1200
|
-
return Math.floor(s / (1e3 * 60 * 60 * 24));
|
|
1201
|
-
}
|
|
1202
|
-
const uu = (t) => (t || "false") === "true", du = async (t, e) => {
|
|
1203
|
-
try {
|
|
1204
|
-
return await t.getClassHashAt(e), !0;
|
|
1205
|
-
} catch {
|
|
1206
|
-
return !1;
|
|
1207
|
-
}
|
|
1208
|
-
};
|
|
1209
|
-
function fu(t) {
|
|
1210
|
-
return !Bs(t);
|
|
1211
|
-
}
|
|
1212
|
-
const hu = (t) => {
|
|
1213
|
-
const e = /^(0|0x([a-f0-9A-F]+)?)$/;
|
|
1214
|
-
return !!(t === "" || e.test(t));
|
|
1215
|
-
}, Z = (t) => !isNaN(parseFloat(t)) && isFinite(Number(t)), pu = (t, e = 16) => {
|
|
1216
|
-
const n = new RegExp(`^[0-9]*.?[0-9]{0,${e}}$`);
|
|
1217
|
-
return t === "" ? !0 : Z(t) ? !!n.test(t) : !1;
|
|
1218
|
-
}, Re = {
|
|
1219
|
-
CURRENCY: {
|
|
1220
|
-
minDecimalPlaces: 2,
|
|
1221
|
-
maxDecimalPlaces: 10,
|
|
1222
|
-
minDecimalSignificantDigits: 2,
|
|
1223
|
-
decimalPlacesWhenZero: 2,
|
|
1224
|
-
allowLeadingZerosInDecimalPart: !0
|
|
1225
|
-
},
|
|
1226
|
-
TOKEN: {
|
|
1227
|
-
minDecimalPlaces: 4,
|
|
1228
|
-
maxDecimalPlaces: 16,
|
|
1229
|
-
minDecimalSignificantDigits: 2,
|
|
1230
|
-
decimalPlacesWhenZero: 1,
|
|
1231
|
-
allowLeadingZerosInDecimalPart: !0
|
|
1232
|
-
}
|
|
1233
|
-
}, mi = (t, e) => rr(t, {
|
|
1234
|
-
...Re.CURRENCY,
|
|
1235
|
-
...e || {}
|
|
1236
|
-
}), gi = (t, e) => rr(t, {
|
|
1237
|
-
...Re.TOKEN,
|
|
1238
|
-
...e || {}
|
|
1239
|
-
}), rr = (t, { minDecimalPlaces: e, maxDecimalPlaces: n, minDecimalSignificantDigits: r, decimalPlacesWhenZero: s, allowLeadingZerosInDecimalPart: o } = Re.CURRENCY) => {
|
|
1240
|
-
if (!Z(t))
|
|
1241
|
-
return null;
|
|
1242
|
-
const a = new Xe(typeof t == "bigint" ? t.toString() : t);
|
|
1243
|
-
let i;
|
|
1244
|
-
const c = `0.${"".padStart(s - 1, "0")}1`;
|
|
1245
|
-
if (a.lt(new Xe(c)) && !o)
|
|
1246
|
-
i = `0.${"".padStart(s, "0")}`;
|
|
1247
|
-
else if (a.gte(1))
|
|
1248
|
-
i = a.toFormat(e);
|
|
1249
|
-
else {
|
|
1250
|
-
const m = a.toFormat(n).split(".")[1].match(/^0+/), S = o && m && m.length ? m[0].length : 0, h = Math.max(S + r, e);
|
|
1251
|
-
i = a.toFormat(h);
|
|
1252
|
-
}
|
|
1253
|
-
let l = i.replace(/0+$/, "");
|
|
1254
|
-
const d = 1 + i.indexOf(".") + s;
|
|
1255
|
-
return l.length < d && (l = i.substring(0, d)), l;
|
|
1256
|
-
}, wi = (t, e = 18) => {
|
|
1257
|
-
const n = t.replace(",", ".");
|
|
1258
|
-
return !t || !Z(n) ? 0n : Qt(n, Number(e)).value;
|
|
1259
|
-
};
|
|
1260
|
-
function Ut(t) {
|
|
1261
|
-
return Dt.bnToUint256(t);
|
|
1262
|
-
}
|
|
1263
|
-
const mu = (t, e) => `${t} ${e}${t === 1 ? "" : "s"}`, gu = (t) => new Promise((e, n) => {
|
|
1264
|
-
const r = new FileReader();
|
|
1265
|
-
r.onload = () => {
|
|
1266
|
-
var s;
|
|
1267
|
-
return r.result ? e((s = r.result) == null ? void 0 : s.toString()) : n(new Error("Could not read file"));
|
|
1268
|
-
}, r.onerror = n, r.onabort = n.bind(null, new Error("User aborted")), r.readAsText(t);
|
|
1269
|
-
});
|
|
1270
|
-
function wu(t) {
|
|
1271
|
-
try {
|
|
1272
|
-
return _s(Hn(t));
|
|
1273
|
-
} catch {
|
|
1274
|
-
return t;
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
function yu(t) {
|
|
1278
|
-
return (...e) => {
|
|
1279
|
-
t(...e);
|
|
1280
|
-
};
|
|
1281
|
-
}
|
|
1282
|
-
class yi extends Error {
|
|
1283
|
-
constructor(e, n) {
|
|
1284
|
-
super(`${e}::${n}`), this.name = e, this.code = n, this.name = e;
|
|
1285
|
-
}
|
|
1286
|
-
}
|
|
1287
|
-
class gn extends yi {
|
|
1288
|
-
constructor(e) {
|
|
1289
|
-
super("BackendPaginationError", e);
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
const wn = 32;
|
|
1293
|
-
class bu {
|
|
1294
|
-
constructor(e, n) {
|
|
1295
|
-
this.apiBase = e, this.httpService = n;
|
|
1296
|
-
}
|
|
1297
|
-
async getNfts(e, n, r, s = 1) {
|
|
1298
|
-
const o = this.normalizeAddress(r), a = P(this.apiBase, "pandora", e, n), i = this.pageToPageIndex(s), l = `${P(a, "profile", o, "nfts")}?page=${i}&size=${wn}`, d = await this.httpService.get(l), u = d.content.map((y) => this.mapItem(y, r));
|
|
1299
|
-
return {
|
|
1300
|
-
totalPages: d.totalPages,
|
|
1301
|
-
page: d.number + 1,
|
|
1302
|
-
count: u.length,
|
|
1303
|
-
nfts: u
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
async getCollection(e, n, r) {
|
|
1307
|
-
const s = this.normalizeAddress(r), o = P(this.apiBase, "pandora", e, n), a = P(o, "collection", s), i = `${o}/collection/${s}`, [c, l] = await Promise.all([
|
|
1308
|
-
this.httpService.get(a),
|
|
1309
|
-
this.httpService.get(i)
|
|
1310
|
-
]), d = me(c), u = l.content.map((y) => this.mapItem(y));
|
|
1311
|
-
return {
|
|
1312
|
-
...d,
|
|
1313
|
-
nfts: {
|
|
1314
|
-
totalPages: l.totalPages,
|
|
1315
|
-
page: l.number,
|
|
1316
|
-
count: u.length,
|
|
1317
|
-
data: u
|
|
1318
|
-
}
|
|
1319
|
-
};
|
|
1320
|
-
}
|
|
1321
|
-
async getNft(e, n, r, s) {
|
|
1322
|
-
const o = this.normalizeAddress(r), a = P(this.apiBase, "pandora", e, n), i = P(a, "nft", o, s), c = await this.httpService.get(i);
|
|
1323
|
-
return this.mapItem(c);
|
|
1324
|
-
}
|
|
1325
|
-
async getProfileCollections(e, n, r, s = 1, o = !1) {
|
|
1326
|
-
const a = this.pageToPageIndex(s), i = this.normalizeAddress(r), c = P(this.apiBase, "pandora", e, n), l = P(c, "profile", i, "collections", `?page=${a}&size=${wn}`), d = await this.httpService.get(l), u = [];
|
|
1327
|
-
for (const y of d.content)
|
|
1328
|
-
if (o) {
|
|
1329
|
-
const m = await this.getCollectionMetrics(e, n, y.contractAddress);
|
|
1330
|
-
u.push(me(y, m));
|
|
1331
|
-
} else
|
|
1332
|
-
u.push(me(y));
|
|
1333
|
-
return {
|
|
1334
|
-
totalPages: d.totalPages,
|
|
1335
|
-
page: d.number + 1,
|
|
1336
|
-
count: u.length,
|
|
1337
|
-
collections: u
|
|
1338
|
-
};
|
|
1339
|
-
}
|
|
1340
|
-
async getCollectionMetrics(e, n, r) {
|
|
1341
|
-
const s = this.normalizeAddress(r), o = P(this.apiBase, "pandora", e, n), a = P(o, "collection", s, "metrics");
|
|
1342
|
-
return this.httpService.get(a);
|
|
1343
|
-
}
|
|
1344
|
-
normalizeAddress(e) {
|
|
1345
|
-
return Ne.parse(e);
|
|
1346
|
-
}
|
|
1347
|
-
pageToPageIndex(e) {
|
|
1348
|
-
if (!Number.isInteger(e))
|
|
1349
|
-
throw new gn("notANumber");
|
|
1350
|
-
const n = e - 1;
|
|
1351
|
-
if (n < 0)
|
|
1352
|
-
throw new gn("tooLow");
|
|
1353
|
-
return n;
|
|
1354
|
-
}
|
|
1355
|
-
mapItem(e, n) {
|
|
1356
|
-
var s;
|
|
1357
|
-
const r = e.name ?? e.tokenId;
|
|
1358
|
-
return {
|
|
1359
|
-
token_id: e.tokenId,
|
|
1360
|
-
contract_address: e.contractAddress,
|
|
1361
|
-
name: r,
|
|
1362
|
-
spec: "spec" in e ? bi(e.spec) : void 0,
|
|
1363
|
-
description: "",
|
|
1364
|
-
best_bid_order: {
|
|
1365
|
-
payment_amount: "bestListPrice" in e ? BigInt(e.bestListPrice) : void 0
|
|
1366
|
-
},
|
|
1367
|
-
properties: "properties" in e && e.properties.map((o) => ({ key: o.key, value: o.value })) || [],
|
|
1368
|
-
image_uri: e.imageUrls.preview,
|
|
1369
|
-
image_url_copy: e.imageUrls.full,
|
|
1370
|
-
owner: {
|
|
1371
|
-
account_address: ((s = e.owner) == null ? void 0 : s.address) || n
|
|
1372
|
-
},
|
|
1373
|
-
contract_name: Zn(e.contractAddress)
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
function bi(t) {
|
|
1378
|
-
switch (t) {
|
|
1379
|
-
case "erc721":
|
|
1380
|
-
case "starknetErc721":
|
|
1381
|
-
return "ERC721";
|
|
1382
|
-
case "erc1155":
|
|
1383
|
-
case "starknetErc1155":
|
|
1384
|
-
return "ERC1155";
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
function me(t, e) {
|
|
1388
|
-
return {
|
|
1389
|
-
contractAddress: te.parse(t.contractAddress),
|
|
1390
|
-
name: t.name || Zn(t.contractAddress),
|
|
1391
|
-
description: t.description ?? "",
|
|
1392
|
-
imageUri: t.imageUrls.preview,
|
|
1393
|
-
...e && {
|
|
1394
|
-
owners: {
|
|
1395
|
-
total: e.numberOfItems,
|
|
1396
|
-
unique: e.uniqueOwners
|
|
1397
|
-
},
|
|
1398
|
-
...e.floorPrice && {
|
|
1399
|
-
floorPrice: BigInt(e.floorPrice)
|
|
1400
|
-
}
|
|
1401
|
-
}
|
|
1402
|
-
};
|
|
1403
|
-
}
|
|
1404
|
-
const sr = async (t, e, n, r, s = 1) => {
|
|
1405
|
-
const o = await t.getNfts(e, n, r, s);
|
|
1406
|
-
if (s < o.totalPages) {
|
|
1407
|
-
const a = await sr(t, e, n, r, o.page + 1);
|
|
1408
|
-
return {
|
|
1409
|
-
...o,
|
|
1410
|
-
nfts: o.nfts.concat(a.nfts)
|
|
1411
|
-
};
|
|
1412
|
-
}
|
|
1413
|
-
return o;
|
|
1414
|
-
}, Su = (t, e, n, r, s) => {
|
|
1415
|
-
const { data: o, ...a } = ee(r && [r, "nfts"], () => r && sr(t, e, n, r), {
|
|
1416
|
-
refreshInterval: 3e5,
|
|
1417
|
-
...s
|
|
1418
|
-
});
|
|
1419
|
-
return { nfts: o == null ? void 0 : o.nfts, ...a };
|
|
1420
|
-
}, Eu = (t, e, n, r, s) => {
|
|
1421
|
-
const { data: o, ...a } = ee(r && [`${r}`, "nfts-collection"], () => r && t.getCollection(e, n, r), {
|
|
1422
|
-
refreshInterval: 6e4,
|
|
1423
|
-
...s
|
|
1424
|
-
});
|
|
1425
|
-
return { collection: o, ...a };
|
|
1426
|
-
}, Au = (t, e, n, r, s, o) => {
|
|
1427
|
-
const { data: a, ...i } = ee(s && r && [`${r}:${s}`, "nft"], () => s && r ? t.getNft(e, n, r, s) : void 0, {
|
|
1428
|
-
refreshInterval: 6e4,
|
|
1429
|
-
revalidateOnFocus: !1,
|
|
1430
|
-
revalidateOnMount: !1,
|
|
1431
|
-
...o
|
|
1432
|
-
});
|
|
1433
|
-
return { nft: a, ...i };
|
|
1434
|
-
}, xu = ({ image_uri: t, image_url_copy: e }) => {
|
|
1435
|
-
if (t && e) {
|
|
1436
|
-
if (!e.startsWith("ipfs://"))
|
|
1437
|
-
return e;
|
|
1438
|
-
if (!t.startsWith("ipfs://"))
|
|
1439
|
-
return t;
|
|
1440
|
-
}
|
|
1441
|
-
return e || t;
|
|
1442
|
-
}, vu = (t, e) => t.token_id === e.token_id && nt(t.contract_address, e.contract_address);
|
|
1443
|
-
function yn(t) {
|
|
1444
|
-
if (!Number.isSafeInteger(t) || t < 0)
|
|
1445
|
-
throw new Error(`Wrong positive integer: ${t}`);
|
|
1446
|
-
}
|
|
1447
|
-
function Si(t) {
|
|
1448
|
-
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1449
|
-
}
|
|
1450
|
-
function or(t, ...e) {
|
|
1451
|
-
if (!Si(t))
|
|
1452
|
-
throw new Error("Expected Uint8Array");
|
|
1453
|
-
if (e.length > 0 && !e.includes(t.length))
|
|
1454
|
-
throw new Error(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
1455
|
-
}
|
|
1456
|
-
function Xt(t, e = !0) {
|
|
1457
|
-
if (t.destroyed)
|
|
1458
|
-
throw new Error("Hash instance has been destroyed");
|
|
1459
|
-
if (e && t.finished)
|
|
1460
|
-
throw new Error("Hash#digest() has already been called");
|
|
1461
|
-
}
|
|
1462
|
-
function ar(t, e) {
|
|
1463
|
-
or(t);
|
|
1464
|
-
const n = e.outputLen;
|
|
1465
|
-
if (t.length < n)
|
|
1466
|
-
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
1467
|
-
}
|
|
1468
|
-
const qt = /* @__PURE__ */ BigInt(2 ** 32 - 1), bn = /* @__PURE__ */ BigInt(32);
|
|
1469
|
-
function Ei(t, e = !1) {
|
|
1470
|
-
return e ? { h: Number(t & qt), l: Number(t >> bn & qt) } : { h: Number(t >> bn & qt) | 0, l: Number(t & qt) | 0 };
|
|
1471
|
-
}
|
|
1472
|
-
function Ai(t, e = !1) {
|
|
1473
|
-
let n = new Uint32Array(t.length), r = new Uint32Array(t.length);
|
|
1474
|
-
for (let s = 0; s < t.length; s++) {
|
|
1475
|
-
const { h: o, l: a } = Ei(t[s], e);
|
|
1476
|
-
[n[s], r[s]] = [o, a];
|
|
1477
|
-
}
|
|
1478
|
-
return [n, r];
|
|
1479
|
-
}
|
|
1480
|
-
const xi = (t, e, n) => t << n | e >>> 32 - n, vi = (t, e, n) => e << n | t >>> 32 - n, Ti = (t, e, n) => e << n - 32 | t >>> 64 - n, Ii = (t, e, n) => t << n - 32 | e >>> 64 - n;
|
|
1481
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1482
|
-
const Bi = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4));
|
|
1483
|
-
function _i(t) {
|
|
1484
|
-
return t instanceof Uint8Array || t != null && typeof t == "object" && t.constructor.name === "Uint8Array";
|
|
1485
|
-
}
|
|
1486
|
-
const ge = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), J = (t, e) => t << 32 - e | t >>> e, Ni = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1487
|
-
if (!Ni)
|
|
1488
|
-
throw new Error("Non little-endian hardware is not supported");
|
|
1489
|
-
function ir(t) {
|
|
1490
|
-
if (typeof t != "string")
|
|
1491
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1492
|
-
return new Uint8Array(new TextEncoder().encode(t));
|
|
1493
|
-
}
|
|
1494
|
-
function $e(t) {
|
|
1495
|
-
if (typeof t == "string" && (t = ir(t)), !_i(t))
|
|
1496
|
-
throw new Error(`expected Uint8Array, got ${typeof t}`);
|
|
1497
|
-
return t;
|
|
1498
|
-
}
|
|
1499
|
-
let cr = class {
|
|
1500
|
-
// Safe version that clones internal state
|
|
1501
|
-
clone() {
|
|
1502
|
-
return this._cloneInto();
|
|
1503
|
-
}
|
|
1504
|
-
};
|
|
1505
|
-
function lr(t) {
|
|
1506
|
-
const e = (r) => t().update($e(r)).digest(), n = t();
|
|
1507
|
-
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
1508
|
-
}
|
|
1509
|
-
const [ur, dr, fr] = [[], [], []], Ci = /* @__PURE__ */ BigInt(0), Ct = /* @__PURE__ */ BigInt(1), Oi = /* @__PURE__ */ BigInt(2), ki = /* @__PURE__ */ BigInt(7), Pi = /* @__PURE__ */ BigInt(256), Ri = /* @__PURE__ */ BigInt(113);
|
|
1510
|
-
for (let t = 0, e = Ct, n = 1, r = 0; t < 24; t++) {
|
|
1511
|
-
[n, r] = [r, (2 * n + 3 * r) % 5], ur.push(2 * (5 * r + n)), dr.push((t + 1) * (t + 2) / 2 % 64);
|
|
1512
|
-
let s = Ci;
|
|
1513
|
-
for (let o = 0; o < 7; o++)
|
|
1514
|
-
e = (e << Ct ^ (e >> ki) * Ri) % Pi, e & Oi && (s ^= Ct << (Ct << /* @__PURE__ */ BigInt(o)) - Ct);
|
|
1515
|
-
fr.push(s);
|
|
1516
|
-
}
|
|
1517
|
-
const [$i, Fi] = /* @__PURE__ */ Ai(fr, !0), Sn = (t, e, n) => n > 32 ? Ti(t, e, n) : xi(t, e, n), En = (t, e, n) => n > 32 ? Ii(t, e, n) : vi(t, e, n);
|
|
1518
|
-
function Ui(t, e = 24) {
|
|
1519
|
-
const n = new Uint32Array(10);
|
|
1520
|
-
for (let r = 24 - e; r < 24; r++) {
|
|
1521
|
-
for (let a = 0; a < 10; a++)
|
|
1522
|
-
n[a] = t[a] ^ t[a + 10] ^ t[a + 20] ^ t[a + 30] ^ t[a + 40];
|
|
1523
|
-
for (let a = 0; a < 10; a += 2) {
|
|
1524
|
-
const i = (a + 8) % 10, c = (a + 2) % 10, l = n[c], d = n[c + 1], u = Sn(l, d, 1) ^ n[i], y = En(l, d, 1) ^ n[i + 1];
|
|
1525
|
-
for (let m = 0; m < 50; m += 10)
|
|
1526
|
-
t[a + m] ^= u, t[a + m + 1] ^= y;
|
|
1527
|
-
}
|
|
1528
|
-
let s = t[2], o = t[3];
|
|
1529
|
-
for (let a = 0; a < 24; a++) {
|
|
1530
|
-
const i = dr[a], c = Sn(s, o, i), l = En(s, o, i), d = ur[a];
|
|
1531
|
-
s = t[d], o = t[d + 1], t[d] = c, t[d + 1] = l;
|
|
1532
|
-
}
|
|
1533
|
-
for (let a = 0; a < 50; a += 10) {
|
|
1534
|
-
for (let i = 0; i < 10; i++)
|
|
1535
|
-
n[i] = t[a + i];
|
|
1536
|
-
for (let i = 0; i < 10; i++)
|
|
1537
|
-
t[a + i] ^= ~n[(i + 2) % 10] & n[(i + 4) % 10];
|
|
1538
|
-
}
|
|
1539
|
-
t[0] ^= $i[r], t[1] ^= Fi[r];
|
|
1540
|
-
}
|
|
1541
|
-
n.fill(0);
|
|
1542
|
-
}
|
|
1543
|
-
class Fe extends cr {
|
|
1544
|
-
// NOTE: we accept arguments in bytes instead of bits here.
|
|
1545
|
-
constructor(e, n, r, s = !1, o = 24) {
|
|
1546
|
-
if (super(), this.blockLen = e, this.suffix = n, this.outputLen = r, this.enableXOF = s, this.rounds = o, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, yn(r), 0 >= this.blockLen || this.blockLen >= 200)
|
|
1547
|
-
throw new Error("Sha3 supports only keccak-f1600 function");
|
|
1548
|
-
this.state = new Uint8Array(200), this.state32 = Bi(this.state);
|
|
1549
|
-
}
|
|
1550
|
-
keccak() {
|
|
1551
|
-
Ui(this.state32, this.rounds), this.posOut = 0, this.pos = 0;
|
|
1552
|
-
}
|
|
1553
|
-
update(e) {
|
|
1554
|
-
Xt(this);
|
|
1555
|
-
const { blockLen: n, state: r } = this;
|
|
1556
|
-
e = $e(e);
|
|
1557
|
-
const s = e.length;
|
|
1558
|
-
for (let o = 0; o < s; ) {
|
|
1559
|
-
const a = Math.min(n - this.pos, s - o);
|
|
1560
|
-
for (let i = 0; i < a; i++)
|
|
1561
|
-
r[this.pos++] ^= e[o++];
|
|
1562
|
-
this.pos === n && this.keccak();
|
|
1563
|
-
}
|
|
1564
|
-
return this;
|
|
1565
|
-
}
|
|
1566
|
-
finish() {
|
|
1567
|
-
if (this.finished)
|
|
1568
|
-
return;
|
|
1569
|
-
this.finished = !0;
|
|
1570
|
-
const { state: e, suffix: n, pos: r, blockLen: s } = this;
|
|
1571
|
-
e[r] ^= n, n & 128 && r === s - 1 && this.keccak(), e[s - 1] ^= 128, this.keccak();
|
|
1572
|
-
}
|
|
1573
|
-
writeInto(e) {
|
|
1574
|
-
Xt(this, !1), or(e), this.finish();
|
|
1575
|
-
const n = this.state, { blockLen: r } = this;
|
|
1576
|
-
for (let s = 0, o = e.length; s < o; ) {
|
|
1577
|
-
this.posOut >= r && this.keccak();
|
|
1578
|
-
const a = Math.min(r - this.posOut, o - s);
|
|
1579
|
-
e.set(n.subarray(this.posOut, this.posOut + a), s), this.posOut += a, s += a;
|
|
1580
|
-
}
|
|
1581
|
-
return e;
|
|
1582
|
-
}
|
|
1583
|
-
xofInto(e) {
|
|
1584
|
-
if (!this.enableXOF)
|
|
1585
|
-
throw new Error("XOF is not possible for this instance");
|
|
1586
|
-
return this.writeInto(e);
|
|
1587
|
-
}
|
|
1588
|
-
xof(e) {
|
|
1589
|
-
return yn(e), this.xofInto(new Uint8Array(e));
|
|
1590
|
-
}
|
|
1591
|
-
digestInto(e) {
|
|
1592
|
-
if (ar(e, this), this.finished)
|
|
1593
|
-
throw new Error("digest() was already called");
|
|
1594
|
-
return this.writeInto(e), this.destroy(), e;
|
|
1595
|
-
}
|
|
1596
|
-
digest() {
|
|
1597
|
-
return this.digestInto(new Uint8Array(this.outputLen));
|
|
1598
|
-
}
|
|
1599
|
-
destroy() {
|
|
1600
|
-
this.destroyed = !0, this.state.fill(0);
|
|
1601
|
-
}
|
|
1602
|
-
_cloneInto(e) {
|
|
1603
|
-
const { blockLen: n, suffix: r, outputLen: s, rounds: o, enableXOF: a } = this;
|
|
1604
|
-
return e || (e = new Fe(n, r, s, a, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = r, e.outputLen = s, e.enableXOF = a, e.destroyed = this.destroyed, e;
|
|
1605
|
-
}
|
|
1606
|
-
}
|
|
1607
|
-
const ji = (t, e, n) => lr(() => new Fe(e, t, n)), Li = /* @__PURE__ */ ji(1, 136, 256 / 8);
|
|
1608
|
-
function Di(t, e, n, r) {
|
|
1609
|
-
if (typeof t.setBigUint64 == "function")
|
|
1610
|
-
return t.setBigUint64(e, n, r);
|
|
1611
|
-
const s = BigInt(32), o = BigInt(4294967295), a = Number(n >> s & o), i = Number(n & o), c = r ? 4 : 0, l = r ? 0 : 4;
|
|
1612
|
-
t.setUint32(e + c, a, r), t.setUint32(e + l, i, r);
|
|
1613
|
-
}
|
|
1614
|
-
class Hi extends cr {
|
|
1615
|
-
constructor(e, n, r, s) {
|
|
1616
|
-
super(), this.blockLen = e, this.outputLen = n, this.padOffset = r, this.isLE = s, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(e), this.view = ge(this.buffer);
|
|
1617
|
-
}
|
|
1618
|
-
update(e) {
|
|
1619
|
-
Xt(this);
|
|
1620
|
-
const { view: n, buffer: r, blockLen: s } = this;
|
|
1621
|
-
e = $e(e);
|
|
1622
|
-
const o = e.length;
|
|
1623
|
-
for (let a = 0; a < o; ) {
|
|
1624
|
-
const i = Math.min(s - this.pos, o - a);
|
|
1625
|
-
if (i === s) {
|
|
1626
|
-
const c = ge(e);
|
|
1627
|
-
for (; s <= o - a; a += s)
|
|
1628
|
-
this.process(c, a);
|
|
1629
|
-
continue;
|
|
1630
|
-
}
|
|
1631
|
-
r.set(e.subarray(a, a + i), this.pos), this.pos += i, a += i, this.pos === s && (this.process(n, 0), this.pos = 0);
|
|
1632
|
-
}
|
|
1633
|
-
return this.length += e.length, this.roundClean(), this;
|
|
1634
|
-
}
|
|
1635
|
-
digestInto(e) {
|
|
1636
|
-
Xt(this), ar(e, this), this.finished = !0;
|
|
1637
|
-
const { buffer: n, view: r, blockLen: s, isLE: o } = this;
|
|
1638
|
-
let { pos: a } = this;
|
|
1639
|
-
n[a++] = 128, this.buffer.subarray(a).fill(0), this.padOffset > s - a && (this.process(r, 0), a = 0);
|
|
1640
|
-
for (let u = a; u < s; u++)
|
|
1641
|
-
n[u] = 0;
|
|
1642
|
-
Di(r, s - 8, BigInt(this.length * 8), o), this.process(r, 0);
|
|
1643
|
-
const i = ge(e), c = this.outputLen;
|
|
1644
|
-
if (c % 4)
|
|
1645
|
-
throw new Error("_sha2: outputLen should be aligned to 32bit");
|
|
1646
|
-
const l = c / 4, d = this.get();
|
|
1647
|
-
if (l > d.length)
|
|
1648
|
-
throw new Error("_sha2: outputLen bigger than state");
|
|
1649
|
-
for (let u = 0; u < l; u++)
|
|
1650
|
-
i.setUint32(4 * u, d[u], o);
|
|
1651
|
-
}
|
|
1652
|
-
digest() {
|
|
1653
|
-
const { buffer: e, outputLen: n } = this;
|
|
1654
|
-
this.digestInto(e);
|
|
1655
|
-
const r = e.slice(0, n);
|
|
1656
|
-
return this.destroy(), r;
|
|
1657
|
-
}
|
|
1658
|
-
_cloneInto(e) {
|
|
1659
|
-
e || (e = new this.constructor()), e.set(...this.get());
|
|
1660
|
-
const { blockLen: n, buffer: r, length: s, finished: o, destroyed: a, pos: i } = this;
|
|
1661
|
-
return e.length = s, e.pos = i, e.finished = o, e.destroyed = a, s % n && e.buffer.set(r), e;
|
|
1662
|
-
}
|
|
1663
|
-
}
|
|
1664
|
-
const Vi = (t, e, n) => t & e ^ ~t & n, Mi = (t, e, n) => t & e ^ t & n ^ e & n, Gi = /* @__PURE__ */ new Uint32Array([
|
|
1665
|
-
1116352408,
|
|
1666
|
-
1899447441,
|
|
1667
|
-
3049323471,
|
|
1668
|
-
3921009573,
|
|
1669
|
-
961987163,
|
|
1670
|
-
1508970993,
|
|
1671
|
-
2453635748,
|
|
1672
|
-
2870763221,
|
|
1673
|
-
3624381080,
|
|
1674
|
-
310598401,
|
|
1675
|
-
607225278,
|
|
1676
|
-
1426881987,
|
|
1677
|
-
1925078388,
|
|
1678
|
-
2162078206,
|
|
1679
|
-
2614888103,
|
|
1680
|
-
3248222580,
|
|
1681
|
-
3835390401,
|
|
1682
|
-
4022224774,
|
|
1683
|
-
264347078,
|
|
1684
|
-
604807628,
|
|
1685
|
-
770255983,
|
|
1686
|
-
1249150122,
|
|
1687
|
-
1555081692,
|
|
1688
|
-
1996064986,
|
|
1689
|
-
2554220882,
|
|
1690
|
-
2821834349,
|
|
1691
|
-
2952996808,
|
|
1692
|
-
3210313671,
|
|
1693
|
-
3336571891,
|
|
1694
|
-
3584528711,
|
|
1695
|
-
113926993,
|
|
1696
|
-
338241895,
|
|
1697
|
-
666307205,
|
|
1698
|
-
773529912,
|
|
1699
|
-
1294757372,
|
|
1700
|
-
1396182291,
|
|
1701
|
-
1695183700,
|
|
1702
|
-
1986661051,
|
|
1703
|
-
2177026350,
|
|
1704
|
-
2456956037,
|
|
1705
|
-
2730485921,
|
|
1706
|
-
2820302411,
|
|
1707
|
-
3259730800,
|
|
1708
|
-
3345764771,
|
|
1709
|
-
3516065817,
|
|
1710
|
-
3600352804,
|
|
1711
|
-
4094571909,
|
|
1712
|
-
275423344,
|
|
1713
|
-
430227734,
|
|
1714
|
-
506948616,
|
|
1715
|
-
659060556,
|
|
1716
|
-
883997877,
|
|
1717
|
-
958139571,
|
|
1718
|
-
1322822218,
|
|
1719
|
-
1537002063,
|
|
1720
|
-
1747873779,
|
|
1721
|
-
1955562222,
|
|
1722
|
-
2024104815,
|
|
1723
|
-
2227730452,
|
|
1724
|
-
2361852424,
|
|
1725
|
-
2428436474,
|
|
1726
|
-
2756734187,
|
|
1727
|
-
3204031479,
|
|
1728
|
-
3329325298
|
|
1729
|
-
]), it = /* @__PURE__ */ new Uint32Array([
|
|
1730
|
-
1779033703,
|
|
1731
|
-
3144134277,
|
|
1732
|
-
1013904242,
|
|
1733
|
-
2773480762,
|
|
1734
|
-
1359893119,
|
|
1735
|
-
2600822924,
|
|
1736
|
-
528734635,
|
|
1737
|
-
1541459225
|
|
1738
|
-
]), ct = /* @__PURE__ */ new Uint32Array(64);
|
|
1739
|
-
class qi extends Hi {
|
|
1740
|
-
constructor() {
|
|
1741
|
-
super(64, 32, 8, !1), this.A = it[0] | 0, this.B = it[1] | 0, this.C = it[2] | 0, this.D = it[3] | 0, this.E = it[4] | 0, this.F = it[5] | 0, this.G = it[6] | 0, this.H = it[7] | 0;
|
|
1742
|
-
}
|
|
1743
|
-
get() {
|
|
1744
|
-
const { A: e, B: n, C: r, D: s, E: o, F: a, G: i, H: c } = this;
|
|
1745
|
-
return [e, n, r, s, o, a, i, c];
|
|
1746
|
-
}
|
|
1747
|
-
// prettier-ignore
|
|
1748
|
-
set(e, n, r, s, o, a, i, c) {
|
|
1749
|
-
this.A = e | 0, this.B = n | 0, this.C = r | 0, this.D = s | 0, this.E = o | 0, this.F = a | 0, this.G = i | 0, this.H = c | 0;
|
|
1750
|
-
}
|
|
1751
|
-
process(e, n) {
|
|
1752
|
-
for (let u = 0; u < 16; u++, n += 4)
|
|
1753
|
-
ct[u] = e.getUint32(n, !1);
|
|
1754
|
-
for (let u = 16; u < 64; u++) {
|
|
1755
|
-
const y = ct[u - 15], m = ct[u - 2], S = J(y, 7) ^ J(y, 18) ^ y >>> 3, h = J(m, 17) ^ J(m, 19) ^ m >>> 10;
|
|
1756
|
-
ct[u] = h + ct[u - 7] + S + ct[u - 16] | 0;
|
|
1757
|
-
}
|
|
1758
|
-
let { A: r, B: s, C: o, D: a, E: i, F: c, G: l, H: d } = this;
|
|
1759
|
-
for (let u = 0; u < 64; u++) {
|
|
1760
|
-
const y = J(i, 6) ^ J(i, 11) ^ J(i, 25), m = d + y + Vi(i, c, l) + Gi[u] + ct[u] | 0, h = (J(r, 2) ^ J(r, 13) ^ J(r, 22)) + Mi(r, s, o) | 0;
|
|
1761
|
-
d = l, l = c, c = i, i = a + m | 0, a = o, o = s, s = r, r = m + h | 0;
|
|
1762
|
-
}
|
|
1763
|
-
r = r + this.A | 0, s = s + this.B | 0, o = o + this.C | 0, a = a + this.D | 0, i = i + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(r, s, o, a, i, c, l, d);
|
|
1764
|
-
}
|
|
1765
|
-
roundClean() {
|
|
1766
|
-
ct.fill(0);
|
|
1767
|
-
}
|
|
1768
|
-
destroy() {
|
|
1769
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
const hr = /* @__PURE__ */ lr(() => new qi());
|
|
1773
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1774
|
-
const pr = BigInt(0), ae = BigInt(1), Wi = BigInt(2), ie = (t) => t instanceof Uint8Array, zi = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
1775
|
-
function ht(t) {
|
|
1776
|
-
if (!ie(t))
|
|
1777
|
-
throw new Error("Uint8Array expected");
|
|
1778
|
-
let e = "";
|
|
1779
|
-
for (let n = 0; n < t.length; n++)
|
|
1780
|
-
e += zi[t[n]];
|
|
1781
|
-
return e;
|
|
1782
|
-
}
|
|
1783
|
-
function mr(t) {
|
|
1784
|
-
const e = t.toString(16);
|
|
1785
|
-
return e.length & 1 ? `0${e}` : e;
|
|
1786
|
-
}
|
|
1787
|
-
function Ue(t) {
|
|
1788
|
-
if (typeof t != "string")
|
|
1789
|
-
throw new Error("hex string expected, got " + typeof t);
|
|
1790
|
-
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
1791
|
-
}
|
|
1792
|
-
function pt(t) {
|
|
1793
|
-
if (typeof t != "string")
|
|
1794
|
-
throw new Error("hex string expected, got " + typeof t);
|
|
1795
|
-
if (t.length % 2)
|
|
1796
|
-
throw new Error("hex string is invalid: unpadded " + t.length);
|
|
1797
|
-
const e = new Uint8Array(t.length / 2);
|
|
1798
|
-
for (let n = 0; n < e.length; n++) {
|
|
1799
|
-
const r = n * 2, s = t.slice(r, r + 2), o = Number.parseInt(s, 16);
|
|
1800
|
-
if (Number.isNaN(o) || o < 0)
|
|
1801
|
-
throw new Error("invalid byte sequence");
|
|
1802
|
-
e[n] = o;
|
|
1803
|
-
}
|
|
1804
|
-
return e;
|
|
1805
|
-
}
|
|
1806
|
-
function X(t) {
|
|
1807
|
-
return Ue(ht(t));
|
|
1808
|
-
}
|
|
1809
|
-
function je(t) {
|
|
1810
|
-
if (!ie(t))
|
|
1811
|
-
throw new Error("Uint8Array expected");
|
|
1812
|
-
return Ue(ht(Uint8Array.from(t).reverse()));
|
|
1813
|
-
}
|
|
1814
|
-
const Et = (t, e) => pt(t.toString(16).padStart(e * 2, "0")), gr = (t, e) => Et(t, e).reverse(), Ki = (t) => pt(mr(t));
|
|
1815
|
-
function V(t, e, n) {
|
|
1816
|
-
let r;
|
|
1817
|
-
if (typeof e == "string")
|
|
1818
|
-
try {
|
|
1819
|
-
r = pt(e);
|
|
1820
|
-
} catch (o) {
|
|
1821
|
-
throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${o}`);
|
|
1822
|
-
}
|
|
1823
|
-
else if (ie(e))
|
|
1824
|
-
r = Uint8Array.from(e);
|
|
1825
|
-
else
|
|
1826
|
-
throw new Error(`${t} must be hex string or Uint8Array`);
|
|
1827
|
-
const s = r.length;
|
|
1828
|
-
if (typeof n == "number" && s !== n)
|
|
1829
|
-
throw new Error(`${t} expected ${n} bytes, got ${s}`);
|
|
1830
|
-
return r;
|
|
1831
|
-
}
|
|
1832
|
-
function jt(...t) {
|
|
1833
|
-
const e = new Uint8Array(t.reduce((r, s) => r + s.length, 0));
|
|
1834
|
-
let n = 0;
|
|
1835
|
-
return t.forEach((r) => {
|
|
1836
|
-
if (!ie(r))
|
|
1837
|
-
throw new Error("Uint8Array expected");
|
|
1838
|
-
e.set(r, n), n += r.length;
|
|
1839
|
-
}), e;
|
|
1840
|
-
}
|
|
1841
|
-
function Yi(t, e) {
|
|
1842
|
-
if (t.length !== e.length)
|
|
1843
|
-
return !1;
|
|
1844
|
-
for (let n = 0; n < t.length; n++)
|
|
1845
|
-
if (t[n] !== e[n])
|
|
1846
|
-
return !1;
|
|
1847
|
-
return !0;
|
|
1848
|
-
}
|
|
1849
|
-
function Zi(t) {
|
|
1850
|
-
if (typeof t != "string")
|
|
1851
|
-
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
1852
|
-
return new TextEncoder().encode(t);
|
|
1853
|
-
}
|
|
1854
|
-
function Xi(t) {
|
|
1855
|
-
let e;
|
|
1856
|
-
for (e = 0; t > pr; t >>= ae, e += 1)
|
|
1857
|
-
;
|
|
1858
|
-
return e;
|
|
1859
|
-
}
|
|
1860
|
-
const Ji = (t, e) => t >> BigInt(e) & ae, Qi = (t, e, n) => t | (n ? ae : pr) << BigInt(e), ce = (t) => (Wi << BigInt(t - 1)) - ae, we = (t) => new Uint8Array(t), An = (t) => Uint8Array.from(t);
|
|
1861
|
-
function wr(t, e, n) {
|
|
1862
|
-
if (typeof t != "number" || t < 2)
|
|
1863
|
-
throw new Error("hashLen must be a number");
|
|
1864
|
-
if (typeof e != "number" || e < 2)
|
|
1865
|
-
throw new Error("qByteLen must be a number");
|
|
1866
|
-
if (typeof n != "function")
|
|
1867
|
-
throw new Error("hmacFn must be a function");
|
|
1868
|
-
let r = we(t), s = we(t), o = 0;
|
|
1869
|
-
const a = () => {
|
|
1870
|
-
r.fill(1), s.fill(0), o = 0;
|
|
1871
|
-
}, i = (...u) => n(s, r, ...u), c = (u = we()) => {
|
|
1872
|
-
s = i(An([0]), u), r = i(), u.length !== 0 && (s = i(An([1]), u), r = i());
|
|
1873
|
-
}, l = () => {
|
|
1874
|
-
if (o++ >= 1e3)
|
|
1875
|
-
throw new Error("drbg: tried 1000 values");
|
|
1876
|
-
let u = 0;
|
|
1877
|
-
const y = [];
|
|
1878
|
-
for (; u < e; ) {
|
|
1879
|
-
r = i();
|
|
1880
|
-
const m = r.slice();
|
|
1881
|
-
y.push(m), u += r.length;
|
|
1882
|
-
}
|
|
1883
|
-
return jt(...y);
|
|
1884
|
-
};
|
|
1885
|
-
return (u, y) => {
|
|
1886
|
-
a(), c(u);
|
|
1887
|
-
let m;
|
|
1888
|
-
for (; !(m = y(l())); )
|
|
1889
|
-
c();
|
|
1890
|
-
return a(), m;
|
|
1891
|
-
};
|
|
1892
|
-
}
|
|
1893
|
-
const tc = {
|
|
1894
|
-
bigint: (t) => typeof t == "bigint",
|
|
1895
|
-
function: (t) => typeof t == "function",
|
|
1896
|
-
boolean: (t) => typeof t == "boolean",
|
|
1897
|
-
string: (t) => typeof t == "string",
|
|
1898
|
-
isSafeInteger: (t) => Number.isSafeInteger(t),
|
|
1899
|
-
array: (t) => Array.isArray(t),
|
|
1900
|
-
field: (t, e) => e.Fp.isValid(t),
|
|
1901
|
-
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
1902
|
-
};
|
|
1903
|
-
function Ht(t, e, n = {}) {
|
|
1904
|
-
const r = (s, o, a) => {
|
|
1905
|
-
const i = tc[o];
|
|
1906
|
-
if (typeof i != "function")
|
|
1907
|
-
throw new Error(`Invalid validator "${o}", expected function`);
|
|
1908
|
-
const c = t[s];
|
|
1909
|
-
if (!(a && c === void 0) && !i(c, t))
|
|
1910
|
-
throw new Error(`Invalid param ${String(s)}=${c} (${typeof c}), expected ${o}`);
|
|
1911
|
-
};
|
|
1912
|
-
for (const [s, o] of Object.entries(e))
|
|
1913
|
-
r(s, o, !1);
|
|
1914
|
-
for (const [s, o] of Object.entries(n))
|
|
1915
|
-
r(s, o, !0);
|
|
1916
|
-
return t;
|
|
1917
|
-
}
|
|
1918
|
-
const ec = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1919
|
-
__proto__: null,
|
|
1920
|
-
bitGet: Ji,
|
|
1921
|
-
bitLen: Xi,
|
|
1922
|
-
bitMask: ce,
|
|
1923
|
-
bitSet: Qi,
|
|
1924
|
-
bytesToHex: ht,
|
|
1925
|
-
bytesToNumberBE: X,
|
|
1926
|
-
bytesToNumberLE: je,
|
|
1927
|
-
concatBytes: jt,
|
|
1928
|
-
createHmacDrbg: wr,
|
|
1929
|
-
ensureBytes: V,
|
|
1930
|
-
equalBytes: Yi,
|
|
1931
|
-
hexToBytes: pt,
|
|
1932
|
-
hexToNumber: Ue,
|
|
1933
|
-
numberToBytesBE: Et,
|
|
1934
|
-
numberToBytesLE: gr,
|
|
1935
|
-
numberToHexUnpadded: mr,
|
|
1936
|
-
numberToVarBytesBE: Ki,
|
|
1937
|
-
utf8ToBytes: Zi,
|
|
1938
|
-
validateObject: Ht
|
|
1939
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
1940
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
1941
|
-
const U = BigInt(0), $ = BigInt(1), ut = BigInt(2), nc = BigInt(3), Ae = BigInt(4), xn = BigInt(5), vn = BigInt(8);
|
|
1942
|
-
BigInt(9);
|
|
1943
|
-
BigInt(16);
|
|
1944
|
-
function M(t, e) {
|
|
1945
|
-
const n = t % e;
|
|
1946
|
-
return n >= U ? n : e + n;
|
|
1947
|
-
}
|
|
1948
|
-
function rc(t, e, n) {
|
|
1949
|
-
if (n <= U || e < U)
|
|
1950
|
-
throw new Error("Expected power/modulo > 0");
|
|
1951
|
-
if (n === $)
|
|
1952
|
-
return U;
|
|
1953
|
-
let r = $;
|
|
1954
|
-
for (; e > U; )
|
|
1955
|
-
e & $ && (r = r * t % n), t = t * t % n, e >>= $;
|
|
1956
|
-
return r;
|
|
1957
|
-
}
|
|
1958
|
-
function xe(t, e) {
|
|
1959
|
-
if (t === U || e <= U)
|
|
1960
|
-
throw new Error(`invert: expected positive integers, got n=${t} mod=${e}`);
|
|
1961
|
-
let n = M(t, e), r = e, s = U, o = $;
|
|
1962
|
-
for (; n !== U; ) {
|
|
1963
|
-
const i = r / n, c = r % n, l = s - o * i;
|
|
1964
|
-
r = n, n = c, s = o, o = l;
|
|
1965
|
-
}
|
|
1966
|
-
if (r !== $)
|
|
1967
|
-
throw new Error("invert: does not exist");
|
|
1968
|
-
return M(s, e);
|
|
1969
|
-
}
|
|
1970
|
-
function sc(t) {
|
|
1971
|
-
const e = (t - $) / ut;
|
|
1972
|
-
let n, r, s;
|
|
1973
|
-
for (n = t - $, r = 0; n % ut === U; n /= ut, r++)
|
|
1974
|
-
;
|
|
1975
|
-
for (s = ut; s < t && rc(s, e, t) !== t - $; s++)
|
|
1976
|
-
;
|
|
1977
|
-
if (r === 1) {
|
|
1978
|
-
const a = (t + $) / Ae;
|
|
1979
|
-
return function(c, l) {
|
|
1980
|
-
const d = c.pow(l, a);
|
|
1981
|
-
if (!c.eql(c.sqr(d), l))
|
|
1982
|
-
throw new Error("Cannot find square root");
|
|
1983
|
-
return d;
|
|
1984
|
-
};
|
|
1985
|
-
}
|
|
1986
|
-
const o = (n + $) / ut;
|
|
1987
|
-
return function(i, c) {
|
|
1988
|
-
if (i.pow(c, e) === i.neg(i.ONE))
|
|
1989
|
-
throw new Error("Cannot find square root");
|
|
1990
|
-
let l = r, d = i.pow(i.mul(i.ONE, s), n), u = i.pow(c, o), y = i.pow(c, n);
|
|
1991
|
-
for (; !i.eql(y, i.ONE); ) {
|
|
1992
|
-
if (i.eql(y, i.ZERO))
|
|
1993
|
-
return i.ZERO;
|
|
1994
|
-
let m = 1;
|
|
1995
|
-
for (let h = i.sqr(y); m < l && !i.eql(h, i.ONE); m++)
|
|
1996
|
-
h = i.sqr(h);
|
|
1997
|
-
const S = i.pow(d, $ << BigInt(l - m - 1));
|
|
1998
|
-
d = i.sqr(S), u = i.mul(u, S), y = i.mul(y, d), l = m;
|
|
1999
|
-
}
|
|
2000
|
-
return u;
|
|
2001
|
-
};
|
|
2002
|
-
}
|
|
2003
|
-
function oc(t) {
|
|
2004
|
-
if (t % Ae === nc) {
|
|
2005
|
-
const e = (t + $) / Ae;
|
|
2006
|
-
return function(r, s) {
|
|
2007
|
-
const o = r.pow(s, e);
|
|
2008
|
-
if (!r.eql(r.sqr(o), s))
|
|
2009
|
-
throw new Error("Cannot find square root");
|
|
2010
|
-
return o;
|
|
2011
|
-
};
|
|
2012
|
-
}
|
|
2013
|
-
if (t % vn === xn) {
|
|
2014
|
-
const e = (t - xn) / vn;
|
|
2015
|
-
return function(r, s) {
|
|
2016
|
-
const o = r.mul(s, ut), a = r.pow(o, e), i = r.mul(s, a), c = r.mul(r.mul(i, ut), a), l = r.mul(i, r.sub(c, r.ONE));
|
|
2017
|
-
if (!r.eql(r.sqr(l), s))
|
|
2018
|
-
throw new Error("Cannot find square root");
|
|
2019
|
-
return l;
|
|
2020
|
-
};
|
|
2021
|
-
}
|
|
2022
|
-
return sc(t);
|
|
2023
|
-
}
|
|
2024
|
-
const ac = [
|
|
2025
|
-
"create",
|
|
2026
|
-
"isValid",
|
|
2027
|
-
"is0",
|
|
2028
|
-
"neg",
|
|
2029
|
-
"inv",
|
|
2030
|
-
"sqrt",
|
|
2031
|
-
"sqr",
|
|
2032
|
-
"eql",
|
|
2033
|
-
"add",
|
|
2034
|
-
"sub",
|
|
2035
|
-
"mul",
|
|
2036
|
-
"pow",
|
|
2037
|
-
"div",
|
|
2038
|
-
"addN",
|
|
2039
|
-
"subN",
|
|
2040
|
-
"mulN",
|
|
2041
|
-
"sqrN"
|
|
2042
|
-
];
|
|
2043
|
-
function Le(t) {
|
|
2044
|
-
const e = {
|
|
2045
|
-
ORDER: "bigint",
|
|
2046
|
-
MASK: "bigint",
|
|
2047
|
-
BYTES: "isSafeInteger",
|
|
2048
|
-
BITS: "isSafeInteger"
|
|
2049
|
-
}, n = ac.reduce((r, s) => (r[s] = "function", r), e);
|
|
2050
|
-
return Ht(t, n);
|
|
2051
|
-
}
|
|
2052
|
-
function yr(t, e, n) {
|
|
2053
|
-
if (n < U)
|
|
2054
|
-
throw new Error("Expected power > 0");
|
|
2055
|
-
if (n === U)
|
|
2056
|
-
return t.ONE;
|
|
2057
|
-
if (n === $)
|
|
2058
|
-
return e;
|
|
2059
|
-
let r = t.ONE, s = e;
|
|
2060
|
-
for (; n > U; )
|
|
2061
|
-
n & $ && (r = t.mul(r, s)), s = t.sqr(s), n >>= $;
|
|
2062
|
-
return r;
|
|
2063
|
-
}
|
|
2064
|
-
function ic(t, e) {
|
|
2065
|
-
const n = new Array(e.length), r = e.reduce((o, a, i) => t.is0(a) ? o : (n[i] = o, t.mul(o, a)), t.ONE), s = t.inv(r);
|
|
2066
|
-
return e.reduceRight((o, a, i) => t.is0(a) ? o : (n[i] = t.mul(o, n[i]), t.mul(o, a)), s), n;
|
|
2067
|
-
}
|
|
2068
|
-
function De(t, e) {
|
|
2069
|
-
const n = e !== void 0 ? e : t.toString(2).length, r = Math.ceil(n / 8);
|
|
2070
|
-
return { nBitLength: n, nByteLength: r };
|
|
2071
|
-
}
|
|
2072
|
-
function He(t, e, n = !1, r = {}) {
|
|
2073
|
-
if (t <= U)
|
|
2074
|
-
throw new Error(`Expected Fp ORDER > 0, got ${t}`);
|
|
2075
|
-
const { nBitLength: s, nByteLength: o } = De(t, e);
|
|
2076
|
-
if (o > 2048)
|
|
2077
|
-
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
2078
|
-
const a = oc(t), i = Object.freeze({
|
|
2079
|
-
ORDER: t,
|
|
2080
|
-
BITS: s,
|
|
2081
|
-
BYTES: o,
|
|
2082
|
-
MASK: ce(s),
|
|
2083
|
-
ZERO: U,
|
|
2084
|
-
ONE: $,
|
|
2085
|
-
create: (c) => M(c, t),
|
|
2086
|
-
isValid: (c) => {
|
|
2087
|
-
if (typeof c != "bigint")
|
|
2088
|
-
throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);
|
|
2089
|
-
return U <= c && c < t;
|
|
2090
|
-
},
|
|
2091
|
-
is0: (c) => c === U,
|
|
2092
|
-
isOdd: (c) => (c & $) === $,
|
|
2093
|
-
neg: (c) => M(-c, t),
|
|
2094
|
-
eql: (c, l) => c === l,
|
|
2095
|
-
sqr: (c) => M(c * c, t),
|
|
2096
|
-
add: (c, l) => M(c + l, t),
|
|
2097
|
-
sub: (c, l) => M(c - l, t),
|
|
2098
|
-
mul: (c, l) => M(c * l, t),
|
|
2099
|
-
pow: (c, l) => yr(i, c, l),
|
|
2100
|
-
div: (c, l) => M(c * xe(l, t), t),
|
|
2101
|
-
// Same as above, but doesn't normalize
|
|
2102
|
-
sqrN: (c) => c * c,
|
|
2103
|
-
addN: (c, l) => c + l,
|
|
2104
|
-
subN: (c, l) => c - l,
|
|
2105
|
-
mulN: (c, l) => c * l,
|
|
2106
|
-
inv: (c) => xe(c, t),
|
|
2107
|
-
sqrt: r.sqrt || ((c) => a(i, c)),
|
|
2108
|
-
invertBatch: (c) => ic(i, c),
|
|
2109
|
-
// TODO: do we really need constant cmov?
|
|
2110
|
-
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
2111
|
-
cmov: (c, l, d) => d ? l : c,
|
|
2112
|
-
toBytes: (c) => n ? gr(c, o) : Et(c, o),
|
|
2113
|
-
fromBytes: (c) => {
|
|
2114
|
-
if (c.length !== o)
|
|
2115
|
-
throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);
|
|
2116
|
-
return n ? je(c) : X(c);
|
|
2117
|
-
}
|
|
2118
|
-
});
|
|
2119
|
-
return Object.freeze(i);
|
|
2120
|
-
}
|
|
2121
|
-
function cc(t, e, n = !1) {
|
|
2122
|
-
t = V("privateHash", t);
|
|
2123
|
-
const r = t.length, s = De(e).nByteLength + 8;
|
|
2124
|
-
if (s < 24 || r < s || r > 1024)
|
|
2125
|
-
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
2126
|
-
const o = n ? je(t) : X(t);
|
|
2127
|
-
return M(o, e - $) + $;
|
|
2128
|
-
}
|
|
2129
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2130
|
-
function lc(t) {
|
|
2131
|
-
const { Fp: e } = t;
|
|
2132
|
-
Le(e);
|
|
2133
|
-
for (const c of ["t", "roundsFull", "roundsPartial"])
|
|
2134
|
-
if (typeof t[c] != "number" || !Number.isSafeInteger(t[c]))
|
|
2135
|
-
throw new Error(`Poseidon: invalid param ${c}=${t[c]} (${typeof t[c]})`);
|
|
2136
|
-
if (t.reversePartialPowIdx !== void 0 && typeof t.reversePartialPowIdx != "boolean")
|
|
2137
|
-
throw new Error(`Poseidon: invalid param reversePartialPowIdx=${t.reversePartialPowIdx}`);
|
|
2138
|
-
let n = t.sboxPower;
|
|
2139
|
-
if (n === void 0 && (n = 5), typeof n != "number" || !Number.isSafeInteger(n))
|
|
2140
|
-
throw new Error(`Poseidon wrong sboxPower=${n}`);
|
|
2141
|
-
const r = BigInt(n);
|
|
2142
|
-
let s = (c) => yr(e, c, r);
|
|
2143
|
-
if (n === 3 ? s = (c) => e.mul(e.sqrN(c), c) : n === 5 && (s = (c) => e.mul(e.sqrN(e.sqrN(c)), c)), t.roundsFull % 2 !== 0)
|
|
2144
|
-
throw new Error(`Poseidon roundsFull is not even: ${t.roundsFull}`);
|
|
2145
|
-
const o = t.roundsFull + t.roundsPartial;
|
|
2146
|
-
if (!Array.isArray(t.roundConstants) || t.roundConstants.length !== o)
|
|
2147
|
-
throw new Error("Poseidon: wrong round constants");
|
|
2148
|
-
const a = t.roundConstants.map((c) => {
|
|
2149
|
-
if (!Array.isArray(c) || c.length !== t.t)
|
|
2150
|
-
throw new Error(`Poseidon wrong round constants: ${c}`);
|
|
2151
|
-
return c.map((l) => {
|
|
2152
|
-
if (typeof l != "bigint" || !e.isValid(l))
|
|
2153
|
-
throw new Error(`Poseidon wrong round constant=${l}`);
|
|
2154
|
-
return e.create(l);
|
|
2155
|
-
});
|
|
2156
|
-
});
|
|
2157
|
-
if (!Array.isArray(t.mds) || t.mds.length !== t.t)
|
|
2158
|
-
throw new Error("Poseidon: wrong MDS matrix");
|
|
2159
|
-
const i = t.mds.map((c) => {
|
|
2160
|
-
if (!Array.isArray(c) || c.length !== t.t)
|
|
2161
|
-
throw new Error(`Poseidon MDS matrix row: ${c}`);
|
|
2162
|
-
return c.map((l) => {
|
|
2163
|
-
if (typeof l != "bigint")
|
|
2164
|
-
throw new Error(`Poseidon MDS matrix value=${l}`);
|
|
2165
|
-
return e.create(l);
|
|
2166
|
-
});
|
|
2167
|
-
});
|
|
2168
|
-
return Object.freeze({ ...t, rounds: o, sboxFn: s, roundConstants: a, mds: i });
|
|
2169
|
-
}
|
|
2170
|
-
function uc(t) {
|
|
2171
|
-
const { t: e, Fp: n, rounds: r, sboxFn: s, reversePartialPowIdx: o } = lc(t), a = Math.floor(t.roundsFull / 2), i = o ? e - 1 : 0, c = (d, u, y) => (d = d.map((m, S) => n.add(m, t.roundConstants[y][S])), u ? d = d.map((m) => s(m)) : d[i] = s(d[i]), d = t.mds.map((m) => m.reduce((S, h, g) => n.add(S, n.mulN(h, d[g])), n.ZERO)), d), l = function(u) {
|
|
2172
|
-
if (!Array.isArray(u) || u.length !== e)
|
|
2173
|
-
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
2174
|
-
u = u.map((m) => {
|
|
2175
|
-
if (typeof m != "bigint")
|
|
2176
|
-
throw new Error(`Poseidon: wrong value=${m} (${typeof m})`);
|
|
2177
|
-
return n.create(m);
|
|
2178
|
-
});
|
|
2179
|
-
let y = 0;
|
|
2180
|
-
for (let m = 0; m < a; m++)
|
|
2181
|
-
u = c(u, !0, y++);
|
|
2182
|
-
for (let m = 0; m < t.roundsPartial; m++)
|
|
2183
|
-
u = c(u, !1, y++);
|
|
2184
|
-
for (let m = 0; m < a; m++)
|
|
2185
|
-
u = c(u, !0, y++);
|
|
2186
|
-
if (y !== r)
|
|
2187
|
-
throw new Error(`Poseidon: wrong number of rounds: last round=${y}, total=${r}`);
|
|
2188
|
-
return u;
|
|
2189
|
-
};
|
|
2190
|
-
return l.roundConstants = t.roundConstants, l;
|
|
2191
|
-
}
|
|
2192
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2193
|
-
const dc = BigInt(0), ye = BigInt(1);
|
|
2194
|
-
function fc(t, e) {
|
|
2195
|
-
const n = (s, o) => {
|
|
2196
|
-
const a = o.negate();
|
|
2197
|
-
return s ? a : o;
|
|
2198
|
-
}, r = (s) => {
|
|
2199
|
-
const o = Math.ceil(e / s) + 1, a = 2 ** (s - 1);
|
|
2200
|
-
return { windows: o, windowSize: a };
|
|
2201
|
-
};
|
|
2202
|
-
return {
|
|
2203
|
-
constTimeNegate: n,
|
|
2204
|
-
// non-const time multiplication ladder
|
|
2205
|
-
unsafeLadder(s, o) {
|
|
2206
|
-
let a = t.ZERO, i = s;
|
|
2207
|
-
for (; o > dc; )
|
|
2208
|
-
o & ye && (a = a.add(i)), i = i.double(), o >>= ye;
|
|
2209
|
-
return a;
|
|
2210
|
-
},
|
|
2211
|
-
/**
|
|
2212
|
-
* Creates a wNAF precomputation window. Used for caching.
|
|
2213
|
-
* Default window size is set by `utils.precompute()` and is equal to 8.
|
|
2214
|
-
* Number of precomputed points depends on the curve size:
|
|
2215
|
-
* 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
|
|
2216
|
-
* - 𝑊 is the window size
|
|
2217
|
-
* - 𝑛 is the bitlength of the curve order.
|
|
2218
|
-
* For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
|
|
2219
|
-
* @returns precomputed point tables flattened to a single array
|
|
2220
|
-
*/
|
|
2221
|
-
precomputeWindow(s, o) {
|
|
2222
|
-
const { windows: a, windowSize: i } = r(o), c = [];
|
|
2223
|
-
let l = s, d = l;
|
|
2224
|
-
for (let u = 0; u < a; u++) {
|
|
2225
|
-
d = l, c.push(d);
|
|
2226
|
-
for (let y = 1; y < i; y++)
|
|
2227
|
-
d = d.add(l), c.push(d);
|
|
2228
|
-
l = d.double();
|
|
2229
|
-
}
|
|
2230
|
-
return c;
|
|
2231
|
-
},
|
|
2232
|
-
/**
|
|
2233
|
-
* Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
|
|
2234
|
-
* @param W window size
|
|
2235
|
-
* @param precomputes precomputed tables
|
|
2236
|
-
* @param n scalar (we don't check here, but should be less than curve order)
|
|
2237
|
-
* @returns real and fake (for const-time) points
|
|
2238
|
-
*/
|
|
2239
|
-
wNAF(s, o, a) {
|
|
2240
|
-
const { windows: i, windowSize: c } = r(s);
|
|
2241
|
-
let l = t.ZERO, d = t.BASE;
|
|
2242
|
-
const u = BigInt(2 ** s - 1), y = 2 ** s, m = BigInt(s);
|
|
2243
|
-
for (let S = 0; S < i; S++) {
|
|
2244
|
-
const h = S * c;
|
|
2245
|
-
let g = Number(a & u);
|
|
2246
|
-
a >>= m, g > c && (g -= y, a += ye);
|
|
2247
|
-
const w = h, E = h + Math.abs(g) - 1, x = S % 2 !== 0, _ = g < 0;
|
|
2248
|
-
g === 0 ? d = d.add(n(x, o[w])) : l = l.add(n(_, o[E]));
|
|
2249
|
-
}
|
|
2250
|
-
return { p: l, f: d };
|
|
2251
|
-
},
|
|
2252
|
-
wNAFCached(s, o, a, i) {
|
|
2253
|
-
const c = s._WINDOW_SIZE || 1;
|
|
2254
|
-
let l = o.get(s);
|
|
2255
|
-
return l || (l = this.precomputeWindow(s, c), c !== 1 && o.set(s, i(l))), this.wNAF(c, l, a);
|
|
2256
|
-
}
|
|
2257
|
-
};
|
|
2258
|
-
}
|
|
2259
|
-
function br(t) {
|
|
2260
|
-
return Le(t.Fp), Ht(t, {
|
|
2261
|
-
n: "bigint",
|
|
2262
|
-
h: "bigint",
|
|
2263
|
-
Gx: "field",
|
|
2264
|
-
Gy: "field"
|
|
2265
|
-
}, {
|
|
2266
|
-
nBitLength: "isSafeInteger",
|
|
2267
|
-
nByteLength: "isSafeInteger"
|
|
2268
|
-
}), Object.freeze({
|
|
2269
|
-
...De(t.n, t.nBitLength),
|
|
2270
|
-
...t,
|
|
2271
|
-
p: t.Fp.ORDER
|
|
2272
|
-
});
|
|
2273
|
-
}
|
|
2274
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2275
|
-
function hc(t) {
|
|
2276
|
-
const e = br(t);
|
|
2277
|
-
Ht(e, {
|
|
2278
|
-
a: "field",
|
|
2279
|
-
b: "field"
|
|
2280
|
-
}, {
|
|
2281
|
-
allowedPrivateKeyLengths: "array",
|
|
2282
|
-
wrapPrivateKey: "boolean",
|
|
2283
|
-
isTorsionFree: "function",
|
|
2284
|
-
clearCofactor: "function",
|
|
2285
|
-
allowInfinityPoint: "boolean",
|
|
2286
|
-
fromBytes: "function",
|
|
2287
|
-
toBytes: "function"
|
|
2288
|
-
});
|
|
2289
|
-
const { endo: n, Fp: r, a: s } = e;
|
|
2290
|
-
if (n) {
|
|
2291
|
-
if (!r.eql(s, r.ZERO))
|
|
2292
|
-
throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
|
|
2293
|
-
if (typeof n != "object" || typeof n.beta != "bigint" || typeof n.splitScalar != "function")
|
|
2294
|
-
throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
|
|
2295
|
-
}
|
|
2296
|
-
return Object.freeze({ ...e });
|
|
2297
|
-
}
|
|
2298
|
-
const { bytesToNumberBE: pc, hexToBytes: mc } = ec, dt = {
|
|
2299
|
-
// asn.1 DER encoding utils
|
|
2300
|
-
Err: class extends Error {
|
|
2301
|
-
constructor(e = "") {
|
|
2302
|
-
super(e);
|
|
2303
|
-
}
|
|
2304
|
-
},
|
|
2305
|
-
_parseInt(t) {
|
|
2306
|
-
const { Err: e } = dt;
|
|
2307
|
-
if (t.length < 2 || t[0] !== 2)
|
|
2308
|
-
throw new e("Invalid signature integer tag");
|
|
2309
|
-
const n = t[1], r = t.subarray(2, n + 2);
|
|
2310
|
-
if (!n || r.length !== n)
|
|
2311
|
-
throw new e("Invalid signature integer: wrong length");
|
|
2312
|
-
if (r[0] & 128)
|
|
2313
|
-
throw new e("Invalid signature integer: negative");
|
|
2314
|
-
if (r[0] === 0 && !(r[1] & 128))
|
|
2315
|
-
throw new e("Invalid signature integer: unnecessary leading zero");
|
|
2316
|
-
return { d: pc(r), l: t.subarray(n + 2) };
|
|
2317
|
-
},
|
|
2318
|
-
toSig(t) {
|
|
2319
|
-
const { Err: e } = dt, n = typeof t == "string" ? mc(t) : t;
|
|
2320
|
-
if (!(n instanceof Uint8Array))
|
|
2321
|
-
throw new Error("ui8a expected");
|
|
2322
|
-
let r = n.length;
|
|
2323
|
-
if (r < 2 || n[0] != 48)
|
|
2324
|
-
throw new e("Invalid signature tag");
|
|
2325
|
-
if (n[1] !== r - 2)
|
|
2326
|
-
throw new e("Invalid signature: incorrect length");
|
|
2327
|
-
const { d: s, l: o } = dt._parseInt(n.subarray(2)), { d: a, l: i } = dt._parseInt(o);
|
|
2328
|
-
if (i.length)
|
|
2329
|
-
throw new e("Invalid signature: left bytes after parsing");
|
|
2330
|
-
return { r: s, s: a };
|
|
2331
|
-
},
|
|
2332
|
-
hexFromSig(t) {
|
|
2333
|
-
const e = (l) => Number.parseInt(l[0], 16) & 8 ? "00" + l : l, n = (l) => {
|
|
2334
|
-
const d = l.toString(16);
|
|
2335
|
-
return d.length & 1 ? `0${d}` : d;
|
|
2336
|
-
}, r = e(n(t.s)), s = e(n(t.r)), o = r.length / 2, a = s.length / 2, i = n(o), c = n(a);
|
|
2337
|
-
return `30${n(a + o + 4)}02${c}${s}02${i}${r}`;
|
|
2338
|
-
}
|
|
2339
|
-
}, et = BigInt(0), W = BigInt(1);
|
|
2340
|
-
BigInt(2);
|
|
2341
|
-
const Tn = BigInt(3);
|
|
2342
|
-
BigInt(4);
|
|
2343
|
-
function gc(t) {
|
|
2344
|
-
const e = hc(t), { Fp: n } = e, r = e.toBytes || ((S, h, g) => {
|
|
2345
|
-
const w = h.toAffine();
|
|
2346
|
-
return jt(Uint8Array.from([4]), n.toBytes(w.x), n.toBytes(w.y));
|
|
2347
|
-
}), s = e.fromBytes || ((S) => {
|
|
2348
|
-
const h = S.subarray(1), g = n.fromBytes(h.subarray(0, n.BYTES)), w = n.fromBytes(h.subarray(n.BYTES, 2 * n.BYTES));
|
|
2349
|
-
return { x: g, y: w };
|
|
2350
|
-
});
|
|
2351
|
-
function o(S) {
|
|
2352
|
-
const { a: h, b: g } = e, w = n.sqr(S), E = n.mul(w, S);
|
|
2353
|
-
return n.add(n.add(E, n.mul(S, h)), g);
|
|
2354
|
-
}
|
|
2355
|
-
if (!n.eql(n.sqr(e.Gy), o(e.Gx)))
|
|
2356
|
-
throw new Error("bad generator point: equation left != right");
|
|
2357
|
-
function a(S) {
|
|
2358
|
-
return typeof S == "bigint" && et < S && S < e.n;
|
|
2359
|
-
}
|
|
2360
|
-
function i(S) {
|
|
2361
|
-
if (!a(S))
|
|
2362
|
-
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
|
|
2363
|
-
}
|
|
2364
|
-
function c(S) {
|
|
2365
|
-
const { allowedPrivateKeyLengths: h, nByteLength: g, wrapPrivateKey: w, n: E } = e;
|
|
2366
|
-
if (h && typeof S != "bigint") {
|
|
2367
|
-
if (S instanceof Uint8Array && (S = ht(S)), typeof S != "string" || !h.includes(S.length))
|
|
2368
|
-
throw new Error("Invalid key");
|
|
2369
|
-
S = S.padStart(g * 2, "0");
|
|
2370
|
-
}
|
|
2371
|
-
let x;
|
|
2372
|
-
try {
|
|
2373
|
-
x = typeof S == "bigint" ? S : X(V("private key", S, g));
|
|
2374
|
-
} catch {
|
|
2375
|
-
throw new Error(`private key must be ${g} bytes, hex or bigint, not ${typeof S}`);
|
|
2376
|
-
}
|
|
2377
|
-
return w && (x = M(x, E)), i(x), x;
|
|
2378
|
-
}
|
|
2379
|
-
const l = /* @__PURE__ */ new Map();
|
|
2380
|
-
function d(S) {
|
|
2381
|
-
if (!(S instanceof u))
|
|
2382
|
-
throw new Error("ProjectivePoint expected");
|
|
2383
|
-
}
|
|
2384
|
-
class u {
|
|
2385
|
-
constructor(h, g, w) {
|
|
2386
|
-
if (this.px = h, this.py = g, this.pz = w, h == null || !n.isValid(h))
|
|
2387
|
-
throw new Error("x required");
|
|
2388
|
-
if (g == null || !n.isValid(g))
|
|
2389
|
-
throw new Error("y required");
|
|
2390
|
-
if (w == null || !n.isValid(w))
|
|
2391
|
-
throw new Error("z required");
|
|
2392
|
-
}
|
|
2393
|
-
// Does not validate if the point is on-curve.
|
|
2394
|
-
// Use fromHex instead, or call assertValidity() later.
|
|
2395
|
-
static fromAffine(h) {
|
|
2396
|
-
const { x: g, y: w } = h || {};
|
|
2397
|
-
if (!h || !n.isValid(g) || !n.isValid(w))
|
|
2398
|
-
throw new Error("invalid affine point");
|
|
2399
|
-
if (h instanceof u)
|
|
2400
|
-
throw new Error("projective point not allowed");
|
|
2401
|
-
const E = (x) => n.eql(x, n.ZERO);
|
|
2402
|
-
return E(g) && E(w) ? u.ZERO : new u(g, w, n.ONE);
|
|
2403
|
-
}
|
|
2404
|
-
get x() {
|
|
2405
|
-
return this.toAffine().x;
|
|
2406
|
-
}
|
|
2407
|
-
get y() {
|
|
2408
|
-
return this.toAffine().y;
|
|
2409
|
-
}
|
|
2410
|
-
/**
|
|
2411
|
-
* Takes a bunch of Projective Points but executes only one
|
|
2412
|
-
* inversion on all of them. Inversion is very slow operation,
|
|
2413
|
-
* so this improves performance massively.
|
|
2414
|
-
* Optimization: converts a list of projective points to a list of identical points with Z=1.
|
|
2415
|
-
*/
|
|
2416
|
-
static normalizeZ(h) {
|
|
2417
|
-
const g = n.invertBatch(h.map((w) => w.pz));
|
|
2418
|
-
return h.map((w, E) => w.toAffine(g[E])).map(u.fromAffine);
|
|
2419
|
-
}
|
|
2420
|
-
/**
|
|
2421
|
-
* Converts hash string or Uint8Array to Point.
|
|
2422
|
-
* @param hex short/long ECDSA hex
|
|
2423
|
-
*/
|
|
2424
|
-
static fromHex(h) {
|
|
2425
|
-
const g = u.fromAffine(s(V("pointHex", h)));
|
|
2426
|
-
return g.assertValidity(), g;
|
|
2427
|
-
}
|
|
2428
|
-
// Multiplies generator point by privateKey.
|
|
2429
|
-
static fromPrivateKey(h) {
|
|
2430
|
-
return u.BASE.multiply(c(h));
|
|
2431
|
-
}
|
|
2432
|
-
// "Private method", don't use it directly
|
|
2433
|
-
_setWindowSize(h) {
|
|
2434
|
-
this._WINDOW_SIZE = h, l.delete(this);
|
|
2435
|
-
}
|
|
2436
|
-
// A point on curve is valid if it conforms to equation.
|
|
2437
|
-
assertValidity() {
|
|
2438
|
-
if (this.is0()) {
|
|
2439
|
-
if (e.allowInfinityPoint)
|
|
2440
|
-
return;
|
|
2441
|
-
throw new Error("bad point: ZERO");
|
|
2442
|
-
}
|
|
2443
|
-
const { x: h, y: g } = this.toAffine();
|
|
2444
|
-
if (!n.isValid(h) || !n.isValid(g))
|
|
2445
|
-
throw new Error("bad point: x or y not FE");
|
|
2446
|
-
const w = n.sqr(g), E = o(h);
|
|
2447
|
-
if (!n.eql(w, E))
|
|
2448
|
-
throw new Error("bad point: equation left != right");
|
|
2449
|
-
if (!this.isTorsionFree())
|
|
2450
|
-
throw new Error("bad point: not in prime-order subgroup");
|
|
2451
|
-
}
|
|
2452
|
-
hasEvenY() {
|
|
2453
|
-
const { y: h } = this.toAffine();
|
|
2454
|
-
if (n.isOdd)
|
|
2455
|
-
return !n.isOdd(h);
|
|
2456
|
-
throw new Error("Field doesn't support isOdd");
|
|
2457
|
-
}
|
|
2458
|
-
/**
|
|
2459
|
-
* Compare one point to another.
|
|
2460
|
-
*/
|
|
2461
|
-
equals(h) {
|
|
2462
|
-
d(h);
|
|
2463
|
-
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } = h, A = n.eql(n.mul(g, B), n.mul(x, E)), v = n.eql(n.mul(w, B), n.mul(_, E));
|
|
2464
|
-
return A && v;
|
|
2465
|
-
}
|
|
2466
|
-
/**
|
|
2467
|
-
* Flips point to one corresponding to (x, -y) in Affine coordinates.
|
|
2468
|
-
*/
|
|
2469
|
-
negate() {
|
|
2470
|
-
return new u(this.px, n.neg(this.py), this.pz);
|
|
2471
|
-
}
|
|
2472
|
-
// Renes-Costello-Batina exception-free doubling formula.
|
|
2473
|
-
// There is 30% faster Jacobian formula, but it is not complete.
|
|
2474
|
-
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
2475
|
-
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
2476
|
-
double() {
|
|
2477
|
-
const { a: h, b: g } = e, w = n.mul(g, Tn), { px: E, py: x, pz: _ } = this;
|
|
2478
|
-
let B = n.ZERO, A = n.ZERO, v = n.ZERO, I = n.mul(E, E), G = n.mul(x, x), R = n.mul(_, _), N = n.mul(E, x);
|
|
2479
|
-
return N = n.add(N, N), v = n.mul(E, _), v = n.add(v, v), B = n.mul(h, v), A = n.mul(w, R), A = n.add(B, A), B = n.sub(G, A), A = n.add(G, A), A = n.mul(B, A), B = n.mul(N, B), v = n.mul(w, v), R = n.mul(h, R), N = n.sub(I, R), N = n.mul(h, N), N = n.add(N, v), v = n.add(I, I), I = n.add(v, I), I = n.add(I, R), I = n.mul(I, N), A = n.add(A, I), R = n.mul(x, _), R = n.add(R, R), I = n.mul(R, N), B = n.sub(B, I), v = n.mul(R, G), v = n.add(v, v), v = n.add(v, v), new u(B, A, v);
|
|
2480
|
-
}
|
|
2481
|
-
// Renes-Costello-Batina exception-free addition formula.
|
|
2482
|
-
// There is 30% faster Jacobian formula, but it is not complete.
|
|
2483
|
-
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
2484
|
-
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
2485
|
-
add(h) {
|
|
2486
|
-
d(h);
|
|
2487
|
-
const { px: g, py: w, pz: E } = this, { px: x, py: _, pz: B } = h;
|
|
2488
|
-
let A = n.ZERO, v = n.ZERO, I = n.ZERO;
|
|
2489
|
-
const G = e.a, R = n.mul(e.b, Tn);
|
|
2490
|
-
let N = n.mul(g, x), L = n.mul(w, _), D = n.mul(E, B), rt = n.add(g, w), p = n.add(x, _);
|
|
2491
|
-
rt = n.mul(rt, p), p = n.add(N, L), rt = n.sub(rt, p), p = n.add(g, E);
|
|
2492
|
-
let b = n.add(x, B);
|
|
2493
|
-
return p = n.mul(p, b), b = n.add(N, D), p = n.sub(p, b), b = n.add(w, E), A = n.add(_, B), b = n.mul(b, A), A = n.add(L, D), b = n.sub(b, A), I = n.mul(G, p), A = n.mul(R, D), I = n.add(A, I), A = n.sub(L, I), I = n.add(L, I), v = n.mul(A, I), L = n.add(N, N), L = n.add(L, N), D = n.mul(G, D), p = n.mul(R, p), L = n.add(L, D), D = n.sub(N, D), D = n.mul(G, D), p = n.add(p, D), N = n.mul(L, p), v = n.add(v, N), N = n.mul(b, p), A = n.mul(rt, A), A = n.sub(A, N), N = n.mul(rt, L), I = n.mul(b, I), I = n.add(I, N), new u(A, v, I);
|
|
2494
|
-
}
|
|
2495
|
-
subtract(h) {
|
|
2496
|
-
return this.add(h.negate());
|
|
2497
|
-
}
|
|
2498
|
-
is0() {
|
|
2499
|
-
return this.equals(u.ZERO);
|
|
2500
|
-
}
|
|
2501
|
-
wNAF(h) {
|
|
2502
|
-
return m.wNAFCached(this, l, h, (g) => {
|
|
2503
|
-
const w = n.invertBatch(g.map((E) => E.pz));
|
|
2504
|
-
return g.map((E, x) => E.toAffine(w[x])).map(u.fromAffine);
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
/**
|
|
2508
|
-
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
2509
|
-
* It's faster, but should only be used when you don't care about
|
|
2510
|
-
* an exposed private key e.g. sig verification, which works over *public* keys.
|
|
2511
|
-
*/
|
|
2512
|
-
multiplyUnsafe(h) {
|
|
2513
|
-
const g = u.ZERO;
|
|
2514
|
-
if (h === et)
|
|
2515
|
-
return g;
|
|
2516
|
-
if (i(h), h === W)
|
|
2517
|
-
return this;
|
|
2518
|
-
const { endo: w } = e;
|
|
2519
|
-
if (!w)
|
|
2520
|
-
return m.unsafeLadder(this, h);
|
|
2521
|
-
let { k1neg: E, k1: x, k2neg: _, k2: B } = w.splitScalar(h), A = g, v = g, I = this;
|
|
2522
|
-
for (; x > et || B > et; )
|
|
2523
|
-
x & W && (A = A.add(I)), B & W && (v = v.add(I)), I = I.double(), x >>= W, B >>= W;
|
|
2524
|
-
return E && (A = A.negate()), _ && (v = v.negate()), v = new u(n.mul(v.px, w.beta), v.py, v.pz), A.add(v);
|
|
2525
|
-
}
|
|
2526
|
-
/**
|
|
2527
|
-
* Constant time multiplication.
|
|
2528
|
-
* Uses wNAF method. Windowed method may be 10% faster,
|
|
2529
|
-
* but takes 2x longer to generate and consumes 2x memory.
|
|
2530
|
-
* Uses precomputes when available.
|
|
2531
|
-
* Uses endomorphism for Koblitz curves.
|
|
2532
|
-
* @param scalar by which the point would be multiplied
|
|
2533
|
-
* @returns New point
|
|
2534
|
-
*/
|
|
2535
|
-
multiply(h) {
|
|
2536
|
-
i(h);
|
|
2537
|
-
let g = h, w, E;
|
|
2538
|
-
const { endo: x } = e;
|
|
2539
|
-
if (x) {
|
|
2540
|
-
const { k1neg: _, k1: B, k2neg: A, k2: v } = x.splitScalar(g);
|
|
2541
|
-
let { p: I, f: G } = this.wNAF(B), { p: R, f: N } = this.wNAF(v);
|
|
2542
|
-
I = m.constTimeNegate(_, I), R = m.constTimeNegate(A, R), R = new u(n.mul(R.px, x.beta), R.py, R.pz), w = I.add(R), E = G.add(N);
|
|
2543
|
-
} else {
|
|
2544
|
-
const { p: _, f: B } = this.wNAF(g);
|
|
2545
|
-
w = _, E = B;
|
|
2546
|
-
}
|
|
2547
|
-
return u.normalizeZ([w, E])[0];
|
|
2548
|
-
}
|
|
2549
|
-
/**
|
|
2550
|
-
* Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
|
|
2551
|
-
* Not using Strauss-Shamir trick: precomputation tables are faster.
|
|
2552
|
-
* The trick could be useful if both P and Q are not G (not in our case).
|
|
2553
|
-
* @returns non-zero affine point
|
|
2554
|
-
*/
|
|
2555
|
-
multiplyAndAddUnsafe(h, g, w) {
|
|
2556
|
-
const E = u.BASE, x = (B, A) => A === et || A === W || !B.equals(E) ? B.multiplyUnsafe(A) : B.multiply(A), _ = x(this, g).add(x(h, w));
|
|
2557
|
-
return _.is0() ? void 0 : _;
|
|
2558
|
-
}
|
|
2559
|
-
// Converts Projective point to affine (x, y) coordinates.
|
|
2560
|
-
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
2561
|
-
// (x, y, z) ∋ (x=x/z, y=y/z)
|
|
2562
|
-
toAffine(h) {
|
|
2563
|
-
const { px: g, py: w, pz: E } = this, x = this.is0();
|
|
2564
|
-
h == null && (h = x ? n.ONE : n.inv(E));
|
|
2565
|
-
const _ = n.mul(g, h), B = n.mul(w, h), A = n.mul(E, h);
|
|
2566
|
-
if (x)
|
|
2567
|
-
return { x: n.ZERO, y: n.ZERO };
|
|
2568
|
-
if (!n.eql(A, n.ONE))
|
|
2569
|
-
throw new Error("invZ was invalid");
|
|
2570
|
-
return { x: _, y: B };
|
|
2571
|
-
}
|
|
2572
|
-
isTorsionFree() {
|
|
2573
|
-
const { h, isTorsionFree: g } = e;
|
|
2574
|
-
if (h === W)
|
|
2575
|
-
return !0;
|
|
2576
|
-
if (g)
|
|
2577
|
-
return g(u, this);
|
|
2578
|
-
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
2579
|
-
}
|
|
2580
|
-
clearCofactor() {
|
|
2581
|
-
const { h, clearCofactor: g } = e;
|
|
2582
|
-
return h === W ? this : g ? g(u, this) : this.multiplyUnsafe(e.h);
|
|
2583
|
-
}
|
|
2584
|
-
toRawBytes(h = !0) {
|
|
2585
|
-
return this.assertValidity(), r(u, this, h);
|
|
2586
|
-
}
|
|
2587
|
-
toHex(h = !0) {
|
|
2588
|
-
return ht(this.toRawBytes(h));
|
|
2589
|
-
}
|
|
2590
|
-
}
|
|
2591
|
-
u.BASE = new u(e.Gx, e.Gy, n.ONE), u.ZERO = new u(n.ZERO, n.ONE, n.ZERO);
|
|
2592
|
-
const y = e.nBitLength, m = fc(u, e.endo ? Math.ceil(y / 2) : y);
|
|
2593
|
-
return {
|
|
2594
|
-
CURVE: e,
|
|
2595
|
-
ProjectivePoint: u,
|
|
2596
|
-
normPrivateKeyToScalar: c,
|
|
2597
|
-
weierstrassEquation: o,
|
|
2598
|
-
isWithinCurveOrder: a
|
|
2599
|
-
};
|
|
2600
|
-
}
|
|
2601
|
-
function wc(t) {
|
|
2602
|
-
const e = br(t);
|
|
2603
|
-
return Ht(e, {
|
|
2604
|
-
hash: "hash",
|
|
2605
|
-
hmac: "function",
|
|
2606
|
-
randomBytes: "function"
|
|
2607
|
-
}, {
|
|
2608
|
-
bits2int: "function",
|
|
2609
|
-
bits2int_modN: "function",
|
|
2610
|
-
lowS: "boolean"
|
|
2611
|
-
}), Object.freeze({ lowS: !0, ...e });
|
|
2612
|
-
}
|
|
2613
|
-
function yc(t) {
|
|
2614
|
-
const e = wc(t), { Fp: n, n: r } = e, s = n.BYTES + 1, o = 2 * n.BYTES + 1;
|
|
2615
|
-
function a(p) {
|
|
2616
|
-
return et < p && p < n.ORDER;
|
|
2617
|
-
}
|
|
2618
|
-
function i(p) {
|
|
2619
|
-
return M(p, r);
|
|
2620
|
-
}
|
|
2621
|
-
function c(p) {
|
|
2622
|
-
return xe(p, r);
|
|
2623
|
-
}
|
|
2624
|
-
const { ProjectivePoint: l, normPrivateKeyToScalar: d, weierstrassEquation: u, isWithinCurveOrder: y } = gc({
|
|
2625
|
-
...e,
|
|
2626
|
-
toBytes(p, b, T) {
|
|
2627
|
-
const k = b.toAffine(), C = n.toBytes(k.x), j = jt;
|
|
2628
|
-
return T ? j(Uint8Array.from([b.hasEvenY() ? 2 : 3]), C) : j(Uint8Array.from([4]), C, n.toBytes(k.y));
|
|
2629
|
-
},
|
|
2630
|
-
fromBytes(p) {
|
|
2631
|
-
const b = p.length, T = p[0], k = p.subarray(1);
|
|
2632
|
-
if (b === s && (T === 2 || T === 3)) {
|
|
2633
|
-
const C = X(k);
|
|
2634
|
-
if (!a(C))
|
|
2635
|
-
throw new Error("Point is not on curve");
|
|
2636
|
-
const j = u(C);
|
|
2637
|
-
let q = n.sqrt(j);
|
|
2638
|
-
const H = (q & W) === W;
|
|
2639
|
-
return (T & 1) === 1 !== H && (q = n.neg(q)), { x: C, y: q };
|
|
2640
|
-
} else if (b === o && T === 4) {
|
|
2641
|
-
const C = n.fromBytes(k.subarray(0, n.BYTES)), j = n.fromBytes(k.subarray(n.BYTES, 2 * n.BYTES));
|
|
2642
|
-
return { x: C, y: j };
|
|
2643
|
-
} else
|
|
2644
|
-
throw new Error(`Point of length ${b} was invalid. Expected ${s} compressed bytes or ${o} uncompressed bytes`);
|
|
2645
|
-
}
|
|
2646
|
-
}), m = (p) => ht(Et(p, e.nByteLength));
|
|
2647
|
-
function S(p) {
|
|
2648
|
-
const b = r >> W;
|
|
2649
|
-
return p > b;
|
|
2650
|
-
}
|
|
2651
|
-
function h(p) {
|
|
2652
|
-
return S(p) ? i(-p) : p;
|
|
2653
|
-
}
|
|
2654
|
-
const g = (p, b, T) => X(p.slice(b, T));
|
|
2655
|
-
class w {
|
|
2656
|
-
constructor(b, T, k) {
|
|
2657
|
-
this.r = b, this.s = T, this.recovery = k, this.assertValidity();
|
|
2658
|
-
}
|
|
2659
|
-
// pair (bytes of r, bytes of s)
|
|
2660
|
-
static fromCompact(b) {
|
|
2661
|
-
const T = e.nByteLength;
|
|
2662
|
-
return b = V("compactSignature", b, T * 2), new w(g(b, 0, T), g(b, T, 2 * T));
|
|
2663
|
-
}
|
|
2664
|
-
// DER encoded ECDSA signature
|
|
2665
|
-
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
2666
|
-
static fromDER(b) {
|
|
2667
|
-
const { r: T, s: k } = dt.toSig(V("DER", b));
|
|
2668
|
-
return new w(T, k);
|
|
2669
|
-
}
|
|
2670
|
-
assertValidity() {
|
|
2671
|
-
if (!y(this.r))
|
|
2672
|
-
throw new Error("r must be 0 < r < CURVE.n");
|
|
2673
|
-
if (!y(this.s))
|
|
2674
|
-
throw new Error("s must be 0 < s < CURVE.n");
|
|
2675
|
-
}
|
|
2676
|
-
addRecoveryBit(b) {
|
|
2677
|
-
return new w(this.r, this.s, b);
|
|
2678
|
-
}
|
|
2679
|
-
recoverPublicKey(b) {
|
|
2680
|
-
const { r: T, s: k, recovery: C } = this, j = v(V("msgHash", b));
|
|
2681
|
-
if (C == null || ![0, 1, 2, 3].includes(C))
|
|
2682
|
-
throw new Error("recovery id invalid");
|
|
2683
|
-
const q = C === 2 || C === 3 ? T + e.n : T;
|
|
2684
|
-
if (q >= n.ORDER)
|
|
2685
|
-
throw new Error("recovery id 2 or 3 invalid");
|
|
2686
|
-
const H = C & 1 ? "03" : "02", st = l.fromHex(H + m(q)), ot = c(q), gt = i(-j * ot), It = i(k * ot), at = l.BASE.multiplyAndAddUnsafe(st, gt, It);
|
|
2687
|
-
if (!at)
|
|
2688
|
-
throw new Error("point at infinify");
|
|
2689
|
-
return at.assertValidity(), at;
|
|
2690
|
-
}
|
|
2691
|
-
// Signatures should be low-s, to prevent malleability.
|
|
2692
|
-
hasHighS() {
|
|
2693
|
-
return S(this.s);
|
|
2694
|
-
}
|
|
2695
|
-
normalizeS() {
|
|
2696
|
-
return this.hasHighS() ? new w(this.r, i(-this.s), this.recovery) : this;
|
|
2697
|
-
}
|
|
2698
|
-
// DER-encoded
|
|
2699
|
-
toDERRawBytes() {
|
|
2700
|
-
return pt(this.toDERHex());
|
|
2701
|
-
}
|
|
2702
|
-
toDERHex() {
|
|
2703
|
-
return dt.hexFromSig({ r: this.r, s: this.s });
|
|
2704
|
-
}
|
|
2705
|
-
// padded bytes of r, then padded bytes of s
|
|
2706
|
-
toCompactRawBytes() {
|
|
2707
|
-
return pt(this.toCompactHex());
|
|
2708
|
-
}
|
|
2709
|
-
toCompactHex() {
|
|
2710
|
-
return m(this.r) + m(this.s);
|
|
2711
|
-
}
|
|
2712
|
-
}
|
|
2713
|
-
const E = {
|
|
2714
|
-
isValidPrivateKey(p) {
|
|
2715
|
-
try {
|
|
2716
|
-
return d(p), !0;
|
|
2717
|
-
} catch {
|
|
2718
|
-
return !1;
|
|
2719
|
-
}
|
|
2720
|
-
},
|
|
2721
|
-
normPrivateKeyToScalar: d,
|
|
2722
|
-
/**
|
|
2723
|
-
* Produces cryptographically secure private key from random of size (nBitLength+64)
|
|
2724
|
-
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
2725
|
-
*/
|
|
2726
|
-
randomPrivateKey: () => {
|
|
2727
|
-
const p = e.randomBytes(n.BYTES + 8), b = cc(p, r);
|
|
2728
|
-
return Et(b, e.nByteLength);
|
|
2729
|
-
},
|
|
2730
|
-
/**
|
|
2731
|
-
* Creates precompute table for an arbitrary EC point. Makes point "cached".
|
|
2732
|
-
* Allows to massively speed-up `point.multiply(scalar)`.
|
|
2733
|
-
* @returns cached point
|
|
2734
|
-
* @example
|
|
2735
|
-
* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
|
|
2736
|
-
* fast.multiply(privKey); // much faster ECDH now
|
|
2737
|
-
*/
|
|
2738
|
-
precompute(p = 8, b = l.BASE) {
|
|
2739
|
-
return b._setWindowSize(p), b.multiply(BigInt(3)), b;
|
|
2740
|
-
}
|
|
2741
|
-
};
|
|
2742
|
-
function x(p, b = !0) {
|
|
2743
|
-
return l.fromPrivateKey(p).toRawBytes(b);
|
|
2744
|
-
}
|
|
2745
|
-
function _(p) {
|
|
2746
|
-
const b = p instanceof Uint8Array, T = typeof p == "string", k = (b || T) && p.length;
|
|
2747
|
-
return b ? k === s || k === o : T ? k === 2 * s || k === 2 * o : p instanceof l;
|
|
2748
|
-
}
|
|
2749
|
-
function B(p, b, T = !0) {
|
|
2750
|
-
if (_(p))
|
|
2751
|
-
throw new Error("first arg must be private key");
|
|
2752
|
-
if (!_(b))
|
|
2753
|
-
throw new Error("second arg must be public key");
|
|
2754
|
-
return l.fromHex(b).multiply(d(p)).toRawBytes(T);
|
|
2755
|
-
}
|
|
2756
|
-
const A = e.bits2int || function(p) {
|
|
2757
|
-
const b = X(p), T = p.length * 8 - e.nBitLength;
|
|
2758
|
-
return T > 0 ? b >> BigInt(T) : b;
|
|
2759
|
-
}, v = e.bits2int_modN || function(p) {
|
|
2760
|
-
return i(A(p));
|
|
2761
|
-
}, I = ce(e.nBitLength);
|
|
2762
|
-
function G(p) {
|
|
2763
|
-
if (typeof p != "bigint")
|
|
2764
|
-
throw new Error("bigint expected");
|
|
2765
|
-
if (!(et <= p && p < I))
|
|
2766
|
-
throw new Error(`bigint expected < 2^${e.nBitLength}`);
|
|
2767
|
-
return Et(p, e.nByteLength);
|
|
2768
|
-
}
|
|
2769
|
-
function R(p, b, T = N) {
|
|
2770
|
-
if (["recovered", "canonical"].some((lt) => lt in T))
|
|
2771
|
-
throw new Error("sign() legacy options not supported");
|
|
2772
|
-
const { hash: k, randomBytes: C } = e;
|
|
2773
|
-
let { lowS: j, prehash: q, extraEntropy: H } = T;
|
|
2774
|
-
j == null && (j = !0), p = V("msgHash", p), q && (p = V("prehashed msgHash", k(p)));
|
|
2775
|
-
const st = v(p), ot = d(b), gt = [G(ot), G(st)];
|
|
2776
|
-
if (H != null) {
|
|
2777
|
-
const lt = H === !0 ? C(n.BYTES) : H;
|
|
2778
|
-
gt.push(V("extraEntropy", lt, n.BYTES));
|
|
2779
|
-
}
|
|
2780
|
-
const It = jt(...gt), at = st;
|
|
2781
|
-
function de(lt) {
|
|
2782
|
-
const wt = A(lt);
|
|
2783
|
-
if (!y(wt))
|
|
2784
|
-
return;
|
|
2785
|
-
const Ge = c(wt), yt = l.BASE.multiply(wt).toAffine(), z = i(yt.x);
|
|
2786
|
-
if (z === et)
|
|
2787
|
-
return;
|
|
2788
|
-
const bt = i(Ge * i(at + z * ot));
|
|
2789
|
-
if (bt === et)
|
|
2790
|
-
return;
|
|
2791
|
-
let qe = (yt.x === z ? 0 : 2) | Number(yt.y & W), We = bt;
|
|
2792
|
-
return j && S(bt) && (We = h(bt), qe ^= 1), new w(z, We, qe);
|
|
2793
|
-
}
|
|
2794
|
-
return { seed: It, k2sig: de };
|
|
2795
|
-
}
|
|
2796
|
-
const N = { lowS: e.lowS, prehash: !1 }, L = { lowS: e.lowS, prehash: !1 };
|
|
2797
|
-
function D(p, b, T = N) {
|
|
2798
|
-
const { seed: k, k2sig: C } = R(p, b, T);
|
|
2799
|
-
return wr(e.hash.outputLen, e.nByteLength, e.hmac)(k, C);
|
|
2800
|
-
}
|
|
2801
|
-
l.BASE._setWindowSize(8);
|
|
2802
|
-
function rt(p, b, T, k = L) {
|
|
2803
|
-
var yt;
|
|
2804
|
-
const C = p;
|
|
2805
|
-
if (b = V("msgHash", b), T = V("publicKey", T), "strict" in k)
|
|
2806
|
-
throw new Error("options.strict was renamed to lowS");
|
|
2807
|
-
const { lowS: j, prehash: q } = k;
|
|
2808
|
-
let H, st;
|
|
2809
|
-
try {
|
|
2810
|
-
if (typeof C == "string" || C instanceof Uint8Array)
|
|
2811
|
-
try {
|
|
2812
|
-
H = w.fromDER(C);
|
|
2813
|
-
} catch (z) {
|
|
2814
|
-
if (!(z instanceof dt.Err))
|
|
2815
|
-
throw z;
|
|
2816
|
-
H = w.fromCompact(C);
|
|
2817
|
-
}
|
|
2818
|
-
else if (typeof C == "object" && typeof C.r == "bigint" && typeof C.s == "bigint") {
|
|
2819
|
-
const { r: z, s: bt } = C;
|
|
2820
|
-
H = new w(z, bt);
|
|
2821
|
-
} else
|
|
2822
|
-
throw new Error("PARSE");
|
|
2823
|
-
st = l.fromHex(T);
|
|
2824
|
-
} catch (z) {
|
|
2825
|
-
if (z.message === "PARSE")
|
|
2826
|
-
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
2827
|
-
return !1;
|
|
2828
|
-
}
|
|
2829
|
-
if (j && H.hasHighS())
|
|
2830
|
-
return !1;
|
|
2831
|
-
q && (b = e.hash(b));
|
|
2832
|
-
const { r: ot, s: gt } = H, It = v(b), at = c(gt), de = i(It * at), lt = i(ot * at), wt = (yt = l.BASE.multiplyAndAddUnsafe(st, de, lt)) == null ? void 0 : yt.toAffine();
|
|
2833
|
-
return wt ? i(wt.x) === ot : !1;
|
|
2834
|
-
}
|
|
2835
|
-
return {
|
|
2836
|
-
CURVE: e,
|
|
2837
|
-
getPublicKey: x,
|
|
2838
|
-
getSharedSecret: B,
|
|
2839
|
-
sign: D,
|
|
2840
|
-
verify: rt,
|
|
2841
|
-
ProjectivePoint: l,
|
|
2842
|
-
Signature: w,
|
|
2843
|
-
utils: E
|
|
2844
|
-
};
|
|
2845
|
-
}
|
|
2846
|
-
function ve(t) {
|
|
2847
|
-
if (!Number.isSafeInteger(t) || t < 0)
|
|
2848
|
-
throw new Error(`Wrong positive integer: ${t}`);
|
|
2849
|
-
}
|
|
2850
|
-
function bc(t) {
|
|
2851
|
-
if (typeof t != "boolean")
|
|
2852
|
-
throw new Error(`Expected boolean, not ${t}`);
|
|
2853
|
-
}
|
|
2854
|
-
function Sr(t, ...e) {
|
|
2855
|
-
if (!(t instanceof Uint8Array))
|
|
2856
|
-
throw new TypeError("Expected Uint8Array");
|
|
2857
|
-
if (e.length > 0 && !e.includes(t.length))
|
|
2858
|
-
throw new TypeError(`Expected Uint8Array of length ${e}, not of length=${t.length}`);
|
|
2859
|
-
}
|
|
2860
|
-
function Sc(t) {
|
|
2861
|
-
if (typeof t != "function" || typeof t.create != "function")
|
|
2862
|
-
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
2863
|
-
ve(t.outputLen), ve(t.blockLen);
|
|
2864
|
-
}
|
|
2865
|
-
function Ec(t, e = !0) {
|
|
2866
|
-
if (t.destroyed)
|
|
2867
|
-
throw new Error("Hash instance has been destroyed");
|
|
2868
|
-
if (e && t.finished)
|
|
2869
|
-
throw new Error("Hash#digest() has already been called");
|
|
2870
|
-
}
|
|
2871
|
-
function Ac(t, e) {
|
|
2872
|
-
Sr(t);
|
|
2873
|
-
const n = e.outputLen;
|
|
2874
|
-
if (t.length < n)
|
|
2875
|
-
throw new Error(`digestInto() expects output buffer of length at least ${n}`);
|
|
2876
|
-
}
|
|
2877
|
-
const Wt = {
|
|
2878
|
-
number: ve,
|
|
2879
|
-
bool: bc,
|
|
2880
|
-
bytes: Sr,
|
|
2881
|
-
hash: Sc,
|
|
2882
|
-
exists: Ec,
|
|
2883
|
-
output: Ac
|
|
2884
|
-
}, be = typeof globalThis == "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
|
|
2885
|
-
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2886
|
-
const xc = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
2887
|
-
if (!xc)
|
|
2888
|
-
throw new Error("Non little-endian hardware is not supported");
|
|
2889
|
-
Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
2890
|
-
function vc(t) {
|
|
2891
|
-
if (typeof t != "string")
|
|
2892
|
-
throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);
|
|
2893
|
-
return new TextEncoder().encode(t);
|
|
2894
|
-
}
|
|
2895
|
-
function Tc(t) {
|
|
2896
|
-
if (typeof t == "string" && (t = vc(t)), !(t instanceof Uint8Array))
|
|
2897
|
-
throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);
|
|
2898
|
-
return t;
|
|
2899
|
-
}
|
|
2900
|
-
function Ic(...t) {
|
|
2901
|
-
if (!t.every((r) => r instanceof Uint8Array))
|
|
2902
|
-
throw new Error("Uint8Array list expected");
|
|
2903
|
-
if (t.length === 1)
|
|
2904
|
-
return t[0];
|
|
2905
|
-
const e = t.reduce((r, s) => r + s.length, 0), n = new Uint8Array(e);
|
|
2906
|
-
for (let r = 0, s = 0; r < t.length; r++) {
|
|
2907
|
-
const o = t[r];
|
|
2908
|
-
n.set(o, s), s += o.length;
|
|
2909
|
-
}
|
|
2910
|
-
return n;
|
|
2911
|
-
}
|
|
2912
|
-
class Bc {
|
|
2913
|
-
// Safe version that clones internal state
|
|
2914
|
-
clone() {
|
|
2915
|
-
return this._cloneInto();
|
|
2916
|
-
}
|
|
2917
|
-
}
|
|
2918
|
-
function _c(t = 32) {
|
|
2919
|
-
if (be && typeof be.getRandomValues == "function")
|
|
2920
|
-
return be.getRandomValues(new Uint8Array(t));
|
|
2921
|
-
throw new Error("crypto.getRandomValues must be defined");
|
|
2922
|
-
}
|
|
2923
|
-
class Er extends Bc {
|
|
2924
|
-
constructor(e, n) {
|
|
2925
|
-
super(), this.finished = !1, this.destroyed = !1, Wt.hash(e);
|
|
2926
|
-
const r = Tc(n);
|
|
2927
|
-
if (this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
2928
|
-
throw new TypeError("Expected instance of class which extends utils.Hash");
|
|
2929
|
-
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
2930
|
-
const s = this.blockLen, o = new Uint8Array(s);
|
|
2931
|
-
o.set(r.length > s ? e.create().update(r).digest() : r);
|
|
2932
|
-
for (let a = 0; a < o.length; a++)
|
|
2933
|
-
o[a] ^= 54;
|
|
2934
|
-
this.iHash.update(o), this.oHash = e.create();
|
|
2935
|
-
for (let a = 0; a < o.length; a++)
|
|
2936
|
-
o[a] ^= 106;
|
|
2937
|
-
this.oHash.update(o), o.fill(0);
|
|
2938
|
-
}
|
|
2939
|
-
update(e) {
|
|
2940
|
-
return Wt.exists(this), this.iHash.update(e), this;
|
|
2941
|
-
}
|
|
2942
|
-
digestInto(e) {
|
|
2943
|
-
Wt.exists(this), Wt.bytes(e, this.outputLen), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
|
|
2944
|
-
}
|
|
2945
|
-
digest() {
|
|
2946
|
-
const e = new Uint8Array(this.oHash.outputLen);
|
|
2947
|
-
return this.digestInto(e), e;
|
|
2948
|
-
}
|
|
2949
|
-
_cloneInto(e) {
|
|
2950
|
-
e || (e = Object.create(Object.getPrototypeOf(this), {}));
|
|
2951
|
-
const { oHash: n, iHash: r, finished: s, destroyed: o, blockLen: a, outputLen: i } = this;
|
|
2952
|
-
return e = e, e.finished = s, e.destroyed = o, e.blockLen = a, e.outputLen = i, e.oHash = n._cloneInto(e.oHash), e.iHash = r._cloneInto(e.iHash), e;
|
|
2953
|
-
}
|
|
2954
|
-
destroy() {
|
|
2955
|
-
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
2956
|
-
}
|
|
2957
|
-
}
|
|
2958
|
-
const Ar = (t, e, n) => new Er(t, e).update(n).digest();
|
|
2959
|
-
Ar.create = (t, e) => new Er(t, e);
|
|
2960
|
-
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2961
|
-
function Nc(t) {
|
|
2962
|
-
return {
|
|
2963
|
-
hash: t,
|
|
2964
|
-
hmac: (e, ...n) => Ar(t, e, Ic(...n)),
|
|
2965
|
-
randomBytes: _c
|
|
2966
|
-
};
|
|
2967
|
-
}
|
|
2968
|
-
const In = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), xr = 252;
|
|
2969
|
-
function Bn(t) {
|
|
2970
|
-
for (; t[0] === 0; )
|
|
2971
|
-
t = t.subarray(1);
|
|
2972
|
-
const e = t.length * 8 - xr, n = X(t);
|
|
2973
|
-
return e > 0 ? n >> BigInt(e) : n;
|
|
2974
|
-
}
|
|
2975
|
-
function vr(t) {
|
|
2976
|
-
return typeof t == "string" && (t = kc(t), t.length & 1 && (t = "0" + t)), pt(t);
|
|
2977
|
-
}
|
|
2978
|
-
const Tr = yc({
|
|
2979
|
-
a: BigInt(1),
|
|
2980
|
-
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
2981
|
-
Fp: He(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
2982
|
-
n: In,
|
|
2983
|
-
nBitLength: xr,
|
|
2984
|
-
Gx: BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),
|
|
2985
|
-
Gy: BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),
|
|
2986
|
-
h: BigInt(1),
|
|
2987
|
-
lowS: !1,
|
|
2988
|
-
...Nc(hr),
|
|
2989
|
-
bits2int: Bn,
|
|
2990
|
-
bits2int_modN: (t) => {
|
|
2991
|
-
const e = X(t).toString(16);
|
|
2992
|
-
return e.length === 63 && (t = vr(e + "0")), M(Bn(t), In);
|
|
2993
|
-
}
|
|
2994
|
-
});
|
|
2995
|
-
function Cc(t) {
|
|
2996
|
-
return V("", typeof t == "string" ? vr(t) : t);
|
|
2997
|
-
}
|
|
2998
|
-
const { CURVE: Bu, ProjectivePoint: Ot, Signature: _u, utils: Nu } = Tr;
|
|
2999
|
-
function Oc(t) {
|
|
3000
|
-
return `0x${ht(t.subarray(1)).replace(/^0+/gm, "")}`;
|
|
3001
|
-
}
|
|
3002
|
-
function kc(t) {
|
|
3003
|
-
return t.replace(/^0x/i, "");
|
|
3004
|
-
}
|
|
3005
|
-
const Lt = [
|
|
3006
|
-
new Ot(2089986280348253421170679821480865132823066470938446095505822317253594081284n, 1713931329540660377023406109199410414810705867260802078187082345529207694986n, 1n),
|
|
3007
|
-
new Ot(996781205833008774514500082376783249102396023663454813447423147977397232763n, 1668503676786377725805489344771023921079126552019160156920634619255970485781n, 1n),
|
|
3008
|
-
new Ot(2251563274489750535117886426533222435294046428347329203627021249169616184184n, 1798716007562728905295480679789526322175868328062420237419143593021674992973n, 1n),
|
|
3009
|
-
new Ot(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
|
|
3010
|
-
new Ot(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n)
|
|
3011
|
-
];
|
|
3012
|
-
function Ir(t, e) {
|
|
3013
|
-
const n = [];
|
|
3014
|
-
let r = t;
|
|
3015
|
-
for (let s = 0; s < 248; s++)
|
|
3016
|
-
n.push(r), r = r.double();
|
|
3017
|
-
r = e;
|
|
3018
|
-
for (let s = 0; s < 4; s++)
|
|
3019
|
-
n.push(r), r = r.double();
|
|
3020
|
-
return n;
|
|
3021
|
-
}
|
|
3022
|
-
const Pc = Ir(Lt[1], Lt[2]), Rc = Ir(Lt[3], Lt[4]);
|
|
3023
|
-
function $c(t) {
|
|
3024
|
-
let e;
|
|
3025
|
-
if (typeof t == "bigint")
|
|
3026
|
-
e = t;
|
|
3027
|
-
else if (typeof t == "number") {
|
|
3028
|
-
if (!Number.isSafeInteger(t))
|
|
3029
|
-
throw new Error(`Invalid pedersenArg: ${t}`);
|
|
3030
|
-
e = BigInt(t);
|
|
3031
|
-
} else
|
|
3032
|
-
e = X(Cc(t));
|
|
3033
|
-
if (!(0n <= e && e < Tr.CURVE.Fp.ORDER))
|
|
3034
|
-
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
3035
|
-
return e;
|
|
3036
|
-
}
|
|
3037
|
-
function _n(t, e, n) {
|
|
3038
|
-
let r = $c(e);
|
|
3039
|
-
for (let s = 0; s < 252; s++) {
|
|
3040
|
-
const o = n[s];
|
|
3041
|
-
if (o.equals(t))
|
|
3042
|
-
throw new Error("Same point");
|
|
3043
|
-
(r & 1n) !== 0n && (t = t.add(o)), r >>= 1n;
|
|
3044
|
-
}
|
|
3045
|
-
return t;
|
|
3046
|
-
}
|
|
3047
|
-
function Fc(t, e) {
|
|
3048
|
-
let n = Lt[0];
|
|
3049
|
-
return n = _n(n, t, Pc), n = _n(n, e, Rc), Oc(n.toRawBytes(!0));
|
|
3050
|
-
}
|
|
3051
|
-
const Uc = ce(250), jc = (t) => X(Li(t)) & Uc;
|
|
3052
|
-
He(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
|
|
3053
|
-
const Lc = He(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
3054
|
-
function Dc(t, e, n) {
|
|
3055
|
-
const r = t.fromBytes(hr(ir(`${e}${n}`)));
|
|
3056
|
-
return t.create(r);
|
|
3057
|
-
}
|
|
3058
|
-
const Hc = [
|
|
3059
|
-
[3, 1, 1],
|
|
3060
|
-
[1, -1, 1],
|
|
3061
|
-
[1, 1, -2]
|
|
3062
|
-
].map((t) => t.map(BigInt));
|
|
3063
|
-
function Vc(t, e) {
|
|
3064
|
-
if (Le(t.Fp), !Number.isSafeInteger(t.rate) || !Number.isSafeInteger(t.capacity))
|
|
3065
|
-
throw new Error(`Wrong poseidon opts: ${t}`);
|
|
3066
|
-
const n = t.rate + t.capacity, r = t.roundsFull + t.roundsPartial, s = [];
|
|
3067
|
-
for (let a = 0; a < r; a++) {
|
|
3068
|
-
const i = [];
|
|
3069
|
-
for (let c = 0; c < n; c++)
|
|
3070
|
-
i.push(Dc(t.Fp, "Hades", n * a + c));
|
|
3071
|
-
s.push(i);
|
|
3072
|
-
}
|
|
3073
|
-
const o = uc({
|
|
3074
|
-
...t,
|
|
3075
|
-
t: n,
|
|
3076
|
-
sboxPower: 3,
|
|
3077
|
-
reversePartialPowIdx: !0,
|
|
3078
|
-
mds: e,
|
|
3079
|
-
roundConstants: s
|
|
3080
|
-
});
|
|
3081
|
-
return o.m = n, o.rate = t.rate, o.capacity = t.capacity, o;
|
|
3082
|
-
}
|
|
3083
|
-
Vc({ Fp: Lc, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, Hc);
|
|
3084
|
-
var Te;
|
|
3085
|
-
(function(t) {
|
|
3086
|
-
t.NOT_STARTED = "NOT_STARTED", t.ONGOING = "ONGOING", t.AWAITING_FUNDS = "AWAITING_FUNDS", t.AWAITING_COMPLETION = "AWAITING_COMPLETION", t.COMPLETED = "COMPLETED", t.CANCELLED = "CANCELLED", t.ERROR = "ERROR";
|
|
3087
|
-
})(Te || (Te = {}));
|
|
3088
|
-
const Mc = f.object({
|
|
3089
|
-
recoveryId: f.number()
|
|
3090
|
-
}), Cu = f.object({
|
|
3091
|
-
feeToken: te,
|
|
3092
|
-
signerSignature: f.object({
|
|
3093
|
-
type: f.literal("StarknetKey"),
|
|
3094
|
-
signer: f.object({
|
|
3095
|
-
publicKey: kt,
|
|
3096
|
-
r: kt,
|
|
3097
|
-
s: kt
|
|
3098
|
-
})
|
|
3099
|
-
})
|
|
3100
|
-
}), Gc = f.nativeEnum(Te), Br = f.object({
|
|
3101
|
-
recoveryId: f.number(),
|
|
3102
|
-
status: Gc,
|
|
3103
|
-
completionTime: f.array(f.number()).optional()
|
|
3104
|
-
}), qc = f.object({
|
|
3105
|
-
activeRecovery: Br.optional().or(f.null()).optional(),
|
|
3106
|
-
minFees: f.record(f.number()).optional()
|
|
3107
|
-
}), Wc = f.object({
|
|
3108
|
-
recovery: Br.optional().or(f.null()).optional(),
|
|
3109
|
-
minFees: f.record(f.number()).optional()
|
|
3110
|
-
});
|
|
3111
|
-
var Ie;
|
|
3112
|
-
(function(t) {
|
|
3113
|
-
t.UNDEPLOYED_ACCOUNT = "undeployedAccount", t.NOT_ENOUGH_TO_PAY_FEES = "notEnoughToPayFees", t.RECOVERY_ALREADY_EXISTS = "recoveryAlreadyExists";
|
|
3114
|
-
})(Ie || (Ie = {}));
|
|
3115
|
-
const zc = f.nativeEnum(Ie), Ou = f.object({
|
|
3116
|
-
status: zc
|
|
3117
|
-
});
|
|
3118
|
-
class ku {
|
|
3119
|
-
constructor(e, n) {
|
|
3120
|
-
this.apiBase = e, this.httpService = n;
|
|
3121
|
-
}
|
|
3122
|
-
/**
|
|
3123
|
-
* Retrieves the on-chain recovery details for a given address and recovery ID.
|
|
3124
|
-
* If no recovery ID is provided, it retrieves the latest recovery details.
|
|
3125
|
-
* @param address - The address to retrieve the recovery details.
|
|
3126
|
-
* @param recoveryId - The recovery ID to retrieve the details.
|
|
3127
|
-
* @returns A promise that resolves to the on-chain recovery details.
|
|
3128
|
-
*/
|
|
3129
|
-
async getRecovery(e, n) {
|
|
3130
|
-
const r = P(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`), s = await this.httpService.get(r), o = Wc.safeParse(s);
|
|
3131
|
-
return o.error ? null : o.data;
|
|
3132
|
-
}
|
|
3133
|
-
/**
|
|
3134
|
-
* Retrieves the on-chain recovery details for a given address and recovery ID.
|
|
3135
|
-
* If no recovery ID is provided, it retrieves the latest recovery details.
|
|
3136
|
-
* @param address - The address to retrieve the current active recovery details.
|
|
3137
|
-
* @returns A promise that resolves to the on-chain recovery details.
|
|
3138
|
-
*/
|
|
3139
|
-
async getActiveRecovery(e) {
|
|
3140
|
-
const n = P(this.apiBase, "accounts", "starknet", e, "recovery"), r = await this.httpService.get(n), s = qc.safeParse(r);
|
|
3141
|
-
return s.error ? null : s.data;
|
|
3142
|
-
}
|
|
3143
|
-
/**
|
|
3144
|
-
* Starts the recovery process for a given address.
|
|
3145
|
-
* @param address - The address to recover.
|
|
3146
|
-
* @param feeToken - The token to be used for the recovery fee.
|
|
3147
|
-
* @param publicKey - The public key of the signer.
|
|
3148
|
-
* @param privateKey - The private key of the signer.
|
|
3149
|
-
* @returns A promise that resolves to the recovery details.
|
|
3150
|
-
*/
|
|
3151
|
-
async startRecovery(e, n, r, s) {
|
|
3152
|
-
const { r: o, s: a } = vs.starkCurve.sign(Fc(jc(ks("utf8", "starknet:recovery")), r), s), i = {
|
|
3153
|
-
feeToken: n,
|
|
3154
|
-
signerSignature: {
|
|
3155
|
-
type: "StarknetKey",
|
|
3156
|
-
signer: {
|
|
3157
|
-
publicKey: r,
|
|
3158
|
-
r: Rt.addHexPrefix(o.toString(16)),
|
|
3159
|
-
s: Rt.addHexPrefix(a.toString(16))
|
|
3160
|
-
}
|
|
3161
|
-
}
|
|
3162
|
-
};
|
|
3163
|
-
return await this.httpService.post(`${this.apiBase}/accounts/starknet/${e}/recovery`, {
|
|
3164
|
-
body: JSON.stringify(i)
|
|
3165
|
-
}, Mc);
|
|
3166
|
-
}
|
|
3167
|
-
/**
|
|
3168
|
-
* Completes the recovery process for a given address and recovery ID.
|
|
3169
|
-
* @param address - The address to recover.
|
|
3170
|
-
* @param recoveryId - The recovery ID to complete.
|
|
3171
|
-
* @returns A promise that resolves to the recovery details
|
|
3172
|
-
*
|
|
3173
|
-
*/
|
|
3174
|
-
async completeRecovery(e, n) {
|
|
3175
|
-
const r = P(this.apiBase, "accounts", "starknet", e, "recovery", `${n}`, "complete");
|
|
3176
|
-
return await this.httpService.post(r);
|
|
3177
|
-
}
|
|
3178
|
-
}
|
|
3179
|
-
async function Pu() {
|
|
3180
|
-
if ("brave" in navigator)
|
|
3181
|
-
try {
|
|
3182
|
-
return await navigator.brave.isBrave();
|
|
3183
|
-
} catch {
|
|
3184
|
-
}
|
|
3185
|
-
return !1;
|
|
3186
|
-
}
|
|
3187
|
-
let Se;
|
|
3188
|
-
function Kc() {
|
|
3189
|
-
return Se || (Se = new Ps(navigator.userAgent).getResult()), Se;
|
|
3190
|
-
}
|
|
3191
|
-
function le(t) {
|
|
3192
|
-
return Kc().browser.name === t;
|
|
3193
|
-
}
|
|
3194
|
-
function Ru() {
|
|
3195
|
-
return le("Firefox");
|
|
3196
|
-
}
|
|
3197
|
-
function $u() {
|
|
3198
|
-
return le("Chrome");
|
|
3199
|
-
}
|
|
3200
|
-
function Fu() {
|
|
3201
|
-
return le("Safari");
|
|
3202
|
-
}
|
|
3203
|
-
function Uu() {
|
|
3204
|
-
return le("Edge");
|
|
3205
|
-
}
|
|
3206
|
-
const ju = f.string().refine((t) => Rs(t, $s), "Invalid seedphrase"), Ve = [
|
|
3207
|
-
{
|
|
3208
|
-
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3209
|
-
name: "Ether",
|
|
3210
|
-
symbol: "ETH",
|
|
3211
|
-
decimals: 18,
|
|
3212
|
-
networkId: "mainnet-alpha",
|
|
3213
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/eth.png"
|
|
3214
|
-
},
|
|
3215
|
-
{
|
|
3216
|
-
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3217
|
-
name: "Ether",
|
|
3218
|
-
symbol: "ETH",
|
|
3219
|
-
decimals: 18,
|
|
3220
|
-
networkId: "sepolia-alpha",
|
|
3221
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/eth.png"
|
|
3222
|
-
},
|
|
3223
|
-
{
|
|
3224
|
-
address: "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
|
|
3225
|
-
name: "Ether",
|
|
3226
|
-
symbol: "ETH",
|
|
3227
|
-
decimals: 18,
|
|
3228
|
-
networkId: "localhost",
|
|
3229
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/eth.png"
|
|
3230
|
-
},
|
|
3231
|
-
{
|
|
3232
|
-
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
3233
|
-
name: "Starknet",
|
|
3234
|
-
symbol: "STRK",
|
|
3235
|
-
decimals: "18",
|
|
3236
|
-
networkId: "mainnet-alpha",
|
|
3237
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/strk.png"
|
|
3238
|
-
},
|
|
3239
|
-
{
|
|
3240
|
-
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
3241
|
-
name: "Starknet",
|
|
3242
|
-
symbol: "STRK",
|
|
3243
|
-
decimals: "18",
|
|
3244
|
-
networkId: "integration",
|
|
3245
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/strk.png"
|
|
3246
|
-
},
|
|
3247
|
-
{
|
|
3248
|
-
address: "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
|
|
3249
|
-
name: "Starknet",
|
|
3250
|
-
symbol: "STRK",
|
|
3251
|
-
decimals: "18",
|
|
3252
|
-
networkId: "sepolia-alpha",
|
|
3253
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/strk.png"
|
|
3254
|
-
},
|
|
3255
|
-
{
|
|
3256
|
-
address: "0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3",
|
|
3257
|
-
name: "DAI",
|
|
3258
|
-
symbol: "DAI",
|
|
3259
|
-
decimals: 18,
|
|
3260
|
-
networkId: "mainnet-alpha",
|
|
3261
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/dai.png"
|
|
3262
|
-
},
|
|
3263
|
-
{
|
|
3264
|
-
address: "0x03e85bfbb8e2a42b7bead9e88e9a1b19dbccf661471061807292120462396ec9",
|
|
3265
|
-
name: "DAI",
|
|
3266
|
-
symbol: "DAI",
|
|
3267
|
-
decimals: 18,
|
|
3268
|
-
networkId: "sepolia-alpha",
|
|
3269
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/dai.png"
|
|
3270
|
-
},
|
|
3271
|
-
{
|
|
3272
|
-
address: "0x06f2a0dfeff180133de890ad69c6ba294574c5f34a67890fd22464f348c4d03c",
|
|
3273
|
-
name: "DAI",
|
|
3274
|
-
symbol: "DAI",
|
|
3275
|
-
decimals: 18,
|
|
3276
|
-
networkId: "sepolia-alpha",
|
|
3277
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/dai.png"
|
|
3278
|
-
},
|
|
3279
|
-
{
|
|
3280
|
-
address: "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
|
|
3281
|
-
name: "Wrapped BTC",
|
|
3282
|
-
symbol: "WBTC",
|
|
3283
|
-
decimals: 8,
|
|
3284
|
-
networkId: "mainnet-alpha",
|
|
3285
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/wbtc.png"
|
|
3286
|
-
},
|
|
3287
|
-
{
|
|
3288
|
-
address: "0x12d537dc323c439dc65c976fad242d5610d27cfb5f31689a0a319b8be7f3d56",
|
|
3289
|
-
name: "Wrapped BTC",
|
|
3290
|
-
symbol: "WBTC",
|
|
3291
|
-
decimals: 8,
|
|
3292
|
-
networkId: "sepolia-alpha",
|
|
3293
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/wbtc.png"
|
|
3294
|
-
},
|
|
3295
|
-
{
|
|
3296
|
-
address: "0x020d208b9e57a7f92bfa9f61135446e0961afc340378be97dbd317453c0950ae",
|
|
3297
|
-
name: "Wrapped BTC",
|
|
3298
|
-
symbol: "WBTC",
|
|
3299
|
-
decimals: 8,
|
|
3300
|
-
networkId: "sepolia-alpha",
|
|
3301
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/wbtc.png"
|
|
3302
|
-
},
|
|
3303
|
-
{
|
|
3304
|
-
address: "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
|
|
3305
|
-
name: "USD Coin",
|
|
3306
|
-
symbol: "USDC",
|
|
3307
|
-
decimals: 6,
|
|
3308
|
-
networkId: "mainnet-alpha",
|
|
3309
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/usdc.png"
|
|
3310
|
-
},
|
|
3311
|
-
{
|
|
3312
|
-
address: "0x005a643907b9a4bc6a55e9069c4fd5fd1f5c79a22470690f75556c4736e34426",
|
|
3313
|
-
name: "USD Coin",
|
|
3314
|
-
symbol: "USDC",
|
|
3315
|
-
decimals: 6,
|
|
3316
|
-
networkId: "sepolia-alpha",
|
|
3317
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/usdc.png"
|
|
3318
|
-
},
|
|
3319
|
-
{
|
|
3320
|
-
address: "0x07ab0b8855a61f480b4423c46c32fa7c553f0aac3531bbddaa282d86244f7a23",
|
|
3321
|
-
name: "USD Coin",
|
|
3322
|
-
symbol: "USDC",
|
|
3323
|
-
decimals: 6,
|
|
3324
|
-
networkId: "sepolia-alpha",
|
|
3325
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/usdc.png"
|
|
3326
|
-
},
|
|
3327
|
-
{
|
|
3328
|
-
address: "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
|
|
3329
|
-
name: "Tether USD",
|
|
3330
|
-
symbol: "USDT",
|
|
3331
|
-
decimals: 6,
|
|
3332
|
-
networkId: "mainnet-alpha",
|
|
3333
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/usdt.png"
|
|
3334
|
-
},
|
|
3335
|
-
{
|
|
3336
|
-
address: "0x386e8d061177f19b3b485c20e31137e6f6bc497cc635ccdfcab96fadf5add6a",
|
|
3337
|
-
name: "Tether USD",
|
|
3338
|
-
symbol: "USDT",
|
|
3339
|
-
decimals: 6,
|
|
3340
|
-
networkId: "sepolia-alpha",
|
|
3341
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/usdt.png"
|
|
3342
|
-
},
|
|
3343
|
-
{
|
|
3344
|
-
address: "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34",
|
|
3345
|
-
name: "zkLend Token",
|
|
3346
|
-
symbol: "ZEND",
|
|
3347
|
-
decimals: 18,
|
|
3348
|
-
networkId: "mainnet-alpha",
|
|
3349
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/zend.png"
|
|
3350
|
-
},
|
|
3351
|
-
{
|
|
3352
|
-
address: "0x06ea04cd7e40bfef07c3625e2b3472839093d966bf601568128436466f962fcf",
|
|
3353
|
-
name: "Baby Laika",
|
|
3354
|
-
symbol: "BABYLAIKA",
|
|
3355
|
-
decimals: 18,
|
|
3356
|
-
networkId: "mainnet-alpha",
|
|
3357
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/babylaika.png"
|
|
3358
|
-
},
|
|
3359
|
-
{
|
|
3360
|
-
address: "0x004a8ff6a7b121c55d5e21af478265c5798f574abaa41efadf569d6939705896",
|
|
3361
|
-
name: "Baby Laika",
|
|
3362
|
-
symbol: "BABYLAIKA",
|
|
3363
|
-
decimals: 18,
|
|
3364
|
-
networkId: "sepolia-alpha",
|
|
3365
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/babylaika.png"
|
|
3366
|
-
},
|
|
3367
|
-
{
|
|
3368
|
-
address: "0x0782f0ddca11d9950bc3220e35ac82cf868778edb67a5e58b39838544bc4cd0f",
|
|
3369
|
-
name: "Starknet Voting Token",
|
|
3370
|
-
symbol: "vSTRK",
|
|
3371
|
-
decimals: 18,
|
|
3372
|
-
networkId: "mainnet-alpha",
|
|
3373
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/vstrk.png"
|
|
3374
|
-
},
|
|
3375
|
-
{
|
|
3376
|
-
address: "0x075afe6402ad5a5c20dd25e10ec3b3986acaa647b77e4ae24b0cbc9a54a27a87",
|
|
3377
|
-
name: "Ekubo Protocol",
|
|
3378
|
-
symbol: "EKUBO",
|
|
3379
|
-
decimals: 18,
|
|
3380
|
-
networkId: "mainnet-alpha",
|
|
3381
|
-
image: "https://dv3jj1unlp2jl.cloudfront.net/128/color/ekubo.png"
|
|
3382
|
-
}
|
|
3383
|
-
], Yc = async (t, e, n) => {
|
|
3384
|
-
const r = await n.callContract({
|
|
3385
|
-
contractAddress: t,
|
|
3386
|
-
entrypoint: "balanceOf",
|
|
3387
|
-
calldata: [e]
|
|
3388
|
-
});
|
|
3389
|
-
return BigInt(O.toHex(Dt.uint256ToBN({
|
|
3390
|
-
low: r[0],
|
|
3391
|
-
high: r[1]
|
|
3392
|
-
})));
|
|
3393
|
-
}, Lu = async (t, e, n) => {
|
|
3394
|
-
const r = Ve.filter((o) => o.networkId === t);
|
|
3395
|
-
return (await Promise.allSettled(r.map((o) => e.callContract({
|
|
3396
|
-
contractAddress: o.address,
|
|
3397
|
-
entrypoint: "balanceOf",
|
|
3398
|
-
calldata: [n]
|
|
3399
|
-
})))).reduce((o, a, i) => {
|
|
3400
|
-
if (a.status === "fulfilled" && Ns(a.value) || a.status === "rejected" || a.value[0] === "0x0" && a.value[1] === "0x0")
|
|
3401
|
-
return o;
|
|
3402
|
-
const c = BigInt(O.toHex(Dt.uint256ToBN({
|
|
3403
|
-
low: a.value[0],
|
|
3404
|
-
high: a.value[1]
|
|
3405
|
-
}))), l = {
|
|
3406
|
-
...r[i],
|
|
3407
|
-
balance: c
|
|
3408
|
-
};
|
|
3409
|
-
return o.push(l), o;
|
|
3410
|
-
}, []);
|
|
3411
|
-
}, Du = async () => Ve, Hu = ({ address: t, networkId: e }) => Ve.find((r) => r.address === t && r.networkId === e), Vu = ({ amount: t, decimals: e, unitCurrencyValue: n }) => {
|
|
3412
|
-
if (!Z(t) || !Z(e) || !Z(n))
|
|
3413
|
-
return;
|
|
3414
|
-
const r = Number(e), s = BigInt(t) * On(n.toString()).value;
|
|
3415
|
-
return _e({
|
|
3416
|
-
value: s,
|
|
3417
|
-
decimals: r + Jr
|
|
3418
|
-
});
|
|
3419
|
-
}, Mu = ({ unitAmount: t, decimals: e }) => {
|
|
3420
|
-
if (t === void 0 || !Z(t) || e === void 0 || !Z(e))
|
|
3421
|
-
return;
|
|
3422
|
-
const n = Number(e);
|
|
3423
|
-
return Qt(t.toString(), n).value.toString();
|
|
3424
|
-
}, Gu = (t) => Z(t) ? Number(t) : 18, { UINT_256_MAX: Zc } = Dt, Xc = (t) => String(t) === String(Zc), qu = (t, e = "$", n) => {
|
|
3425
|
-
if (t === void 0 || !Z(t))
|
|
3426
|
-
return null;
|
|
3427
|
-
const r = mi(t, n);
|
|
3428
|
-
return [e, r].filter(Boolean).join("");
|
|
3429
|
-
}, Jc = "Unlimited", Wu = ({ amount: t, decimals: e, symbol: n, showPlusSign: r = !1, withSymbol: s = !0, unlimitedText: o = Jc, prettyConfigOverrides: a }) => {
|
|
3430
|
-
if (!Z(t))
|
|
3431
|
-
return null;
|
|
3432
|
-
let i, c = !1;
|
|
3433
|
-
if (Xc(t))
|
|
3434
|
-
i = o;
|
|
3435
|
-
else {
|
|
3436
|
-
const d = Number(e), u = BigInt(t);
|
|
3437
|
-
c = u > 0n;
|
|
3438
|
-
const y = d > 0 ? _e({ value: u, decimals: d }) : u.toString();
|
|
3439
|
-
i = d > 0 ? gi(y, a) : y;
|
|
3440
|
-
}
|
|
3441
|
-
const l = [i, s && n].filter(Boolean).join(" ");
|
|
3442
|
-
return r && c ? `+${l}` : l;
|
|
3443
|
-
};
|
|
3444
|
-
function zu(t) {
|
|
3445
|
-
return {
|
|
3446
|
-
USD: "$",
|
|
3447
|
-
EUR: "€",
|
|
3448
|
-
GBP: "£",
|
|
3449
|
-
JPY: "¥",
|
|
3450
|
-
CAD: "C$",
|
|
3451
|
-
AUD: "A$",
|
|
3452
|
-
CHF: "CHF",
|
|
3453
|
-
CNY: "CN¥"
|
|
3454
|
-
}[t.toUpperCase()] || "$";
|
|
3455
|
-
}
|
|
3456
|
-
var Qc = bs, tl = Qc;
|
|
3457
|
-
function el(t, e) {
|
|
3458
|
-
function n(r, s) {
|
|
3459
|
-
var o = e || {}, a;
|
|
3460
|
-
"randomize" in o || (o.randomize = !0), a = tl.operation(o);
|
|
3461
|
-
function i(d) {
|
|
3462
|
-
s(d || new Error("Aborted"));
|
|
3463
|
-
}
|
|
3464
|
-
function c(d, u) {
|
|
3465
|
-
if (d.bail) {
|
|
3466
|
-
i(d);
|
|
3467
|
-
return;
|
|
3468
|
-
}
|
|
3469
|
-
a.retry(d) ? o.onRetry && o.onRetry(d, u) : s(a.mainError());
|
|
3470
|
-
}
|
|
3471
|
-
function l(d) {
|
|
3472
|
-
var u;
|
|
3473
|
-
try {
|
|
3474
|
-
u = t(i, d);
|
|
3475
|
-
} catch (y) {
|
|
3476
|
-
c(y, d);
|
|
3477
|
-
return;
|
|
3478
|
-
}
|
|
3479
|
-
Promise.resolve(u).then(r).catch(function(m) {
|
|
3480
|
-
c(m, d);
|
|
3481
|
-
});
|
|
3482
|
-
}
|
|
3483
|
-
a.attempt(l);
|
|
3484
|
-
}
|
|
3485
|
-
return new Promise(n);
|
|
3486
|
-
}
|
|
3487
|
-
var nl = el;
|
|
3488
|
-
const rl = /* @__PURE__ */ ds(nl);
|
|
3489
|
-
class Ku {
|
|
3490
|
-
constructor(e, n) {
|
|
3491
|
-
this.apiBase = e, this.httpService = n, this.TOKENS_INFO_URL = "/tokens/info", this.TOKENS_DEFI_DECOMPOSITION_URL = "/tokens/defi/decomposition";
|
|
3492
|
-
}
|
|
3493
|
-
/**
|
|
3494
|
-
* Fetch tokens info from backend
|
|
3495
|
-
* @param {Address} tokenAddress - The token address.
|
|
3496
|
-
* @returns {Promise<ApiTokenInfo[]>} - The fetched tokens or undefined if there was an error or not default network
|
|
3497
|
-
*/
|
|
3498
|
-
async fetchTokensInfoFromBackend(e) {
|
|
3499
|
-
const n = P(this.apiBase, this.TOKENS_INFO_URL, e ?? "", "?chain=starknet"), r = await this.httpService.get(n), s = fs.safeParse(r);
|
|
3500
|
-
if (s.success)
|
|
3501
|
-
return s.data.tokens;
|
|
3502
|
-
const o = hs.safeParse(r);
|
|
3503
|
-
if (o.success)
|
|
3504
|
-
return [o.data];
|
|
3505
|
-
}
|
|
3506
|
-
/**
|
|
3507
|
-
* Fetch list of tokens and balances for given account from backend
|
|
3508
|
-
* @param {Address} address - The account address.
|
|
3509
|
-
* @returns {Promise<WebBaseTokenWithBalance[]>} - The fetched balances for the account address.
|
|
3510
|
-
*/
|
|
3511
|
-
async fetchAddressTokenBalancesFromBackend(e, n, r) {
|
|
3512
|
-
const s = P(this.apiBase, "activity", "starknet", n, "account", e, "balance");
|
|
3513
|
-
return (await rl(
|
|
3514
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
3515
|
-
async (i) => {
|
|
3516
|
-
let c;
|
|
3517
|
-
try {
|
|
3518
|
-
c = await this.httpService.get(s);
|
|
3519
|
-
} catch {
|
|
3520
|
-
return i(new Error("Error fetching")), [];
|
|
3521
|
-
}
|
|
3522
|
-
const l = ps.safeParse(c);
|
|
3523
|
-
if (!l.success)
|
|
3524
|
-
return i(new Error("Error parsing response")), [];
|
|
3525
|
-
if (l.data.status !== "initialised")
|
|
3526
|
-
throw new Error("Not initialised yet");
|
|
3527
|
-
return l.data.balances;
|
|
3528
|
-
},
|
|
3529
|
-
{
|
|
3530
|
-
/** seems to take 5-10 sec for initialised state */
|
|
3531
|
-
retries: 5,
|
|
3532
|
-
minTimeout: 5e3,
|
|
3533
|
-
...r
|
|
3534
|
-
}
|
|
3535
|
-
)).map((i) => ({
|
|
3536
|
-
address: i.tokenAddress,
|
|
3537
|
-
balance: i.tokenBalance,
|
|
3538
|
-
networkId: n
|
|
3539
|
-
}));
|
|
3540
|
-
}
|
|
3541
|
-
async fetchDefiDecomposition(e) {
|
|
3542
|
-
const n = P(this.apiBase, this.TOKENS_DEFI_DECOMPOSITION_URL, e, "?chain=starknet"), r = await this.httpService.get(n);
|
|
3543
|
-
return ms(gs, r).success || console.error("Backend schema has changed. Make the changes to the models to prevent unknown/unhandled errors."), r.dapps;
|
|
3544
|
-
}
|
|
3545
|
-
}
|
|
3546
|
-
const Yu = (t, e, n, r) => ({
|
|
3547
|
-
contractAddress: t,
|
|
3548
|
-
entrypoint: "transfer",
|
|
3549
|
-
calldata: mt.compile({
|
|
3550
|
-
recipient: e,
|
|
3551
|
-
amount: Ut(wi(n, r))
|
|
3552
|
-
})
|
|
3553
|
-
}), Zu = (t, e, n, r) => ({
|
|
3554
|
-
contractAddress: t,
|
|
3555
|
-
entrypoint: "transferFrom",
|
|
3556
|
-
calldata: mt.compile({
|
|
3557
|
-
from_: e,
|
|
3558
|
-
to: n,
|
|
3559
|
-
tokenId: Ut(r)
|
|
3560
|
-
// OZ specs need a uint256 as tokenId
|
|
3561
|
-
})
|
|
3562
|
-
}), Xu = (t, e, n, r) => ({
|
|
3563
|
-
contractAddress: t,
|
|
3564
|
-
entrypoint: "safeTransferFrom",
|
|
3565
|
-
calldata: mt.compile({
|
|
3566
|
-
from_: e,
|
|
3567
|
-
to: n,
|
|
3568
|
-
tokenId: Ut(r),
|
|
3569
|
-
amount: Ut(1),
|
|
3570
|
-
data_len: "0"
|
|
3571
|
-
})
|
|
3572
|
-
});
|
|
3573
|
-
function _r(t) {
|
|
3574
|
-
return ke(t.unit) === "WEI";
|
|
3575
|
-
}
|
|
3576
|
-
function sl(t) {
|
|
3577
|
-
return ke(t.unit) === "FRI";
|
|
3578
|
-
}
|
|
3579
|
-
function At(t, e) {
|
|
3580
|
-
return _r(t) ? {
|
|
3581
|
-
...t,
|
|
3582
|
-
maxFee: e(t.maxFee),
|
|
3583
|
-
overallFee: e(t.overallFee),
|
|
3584
|
-
gasPrice: e(t.gasPrice),
|
|
3585
|
-
gasUsage: e(t.gasUsage)
|
|
3586
|
-
} : {
|
|
3587
|
-
...t,
|
|
3588
|
-
overallFee: e(t.overallFee),
|
|
3589
|
-
gasPrice: e(t.gasPrice),
|
|
3590
|
-
gasUsage: e(t.gasUsage),
|
|
3591
|
-
maxAmount: e(t.maxAmount),
|
|
3592
|
-
maxPricePerUnit: e(t.maxPricePerUnit)
|
|
3593
|
-
};
|
|
3594
|
-
}
|
|
3595
|
-
function Pt(t) {
|
|
3596
|
-
return _r(t) ? {
|
|
3597
|
-
maxFee: t.maxFee
|
|
3598
|
-
} : {
|
|
3599
|
-
amount: t.maxAmount,
|
|
3600
|
-
pricePerUnit: t.maxPricePerUnit
|
|
3601
|
-
};
|
|
3602
|
-
}
|
|
3603
|
-
function Ee(t) {
|
|
3604
|
-
return sl({ unit: t }) ? Oe : $n;
|
|
3605
|
-
}
|
|
3606
|
-
function Ju(t, e, n = 2) {
|
|
3607
|
-
const r = BigInt(10 ** n), s = BigInt(Math.round(e * 10 ** n));
|
|
3608
|
-
return t * s / r;
|
|
3609
|
-
}
|
|
3610
|
-
const Qu = [Oe], Nr = (t, e = ll) => {
|
|
3611
|
-
if (t.max && "amount" in t.max)
|
|
3612
|
-
return {
|
|
3613
|
-
...t,
|
|
3614
|
-
...t.max
|
|
3615
|
-
};
|
|
3616
|
-
const n = 10000n, { amount: r, pricePerUnit: s, dataGasConsumed: o = 0n, dataGasPrice: a = 0n } = t, i = r * s + o * a;
|
|
3617
|
-
if (i < 0)
|
|
3618
|
-
throw Error("Cannot calculate max fee for negative fee");
|
|
3619
|
-
const c = O.toBigInt(Es({ estimatedFee: i })), l = Number(c) / Number(i), d = e(l), u = BigInt(Math.trunc(d * Number(n)));
|
|
3620
|
-
return {
|
|
3621
|
-
...t,
|
|
3622
|
-
amount: r * u / n,
|
|
3623
|
-
pricePerUnit: s * u / n,
|
|
3624
|
-
dataGasConsumed: o * u / n,
|
|
3625
|
-
dataGasPrice: a * u / n
|
|
3626
|
-
};
|
|
3627
|
-
}, Jt = (t) => {
|
|
3628
|
-
const { amount: e, pricePerUnit: n, dataGasConsumed: r = 0n, dataGasPrice: s = 0n } = t;
|
|
3629
|
-
return e * n + r * s;
|
|
3630
|
-
}, ol = (t) => {
|
|
3631
|
-
if (t.max)
|
|
3632
|
-
return "maxFee" in t.max ? t.max.maxFee : Jt(t.max);
|
|
3633
|
-
}, Be = (t) => {
|
|
3634
|
-
const e = ol(t);
|
|
3635
|
-
return e || Jt(Nr(t));
|
|
3636
|
-
}, td = (t) => {
|
|
3637
|
-
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3638
|
-
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3639
|
-
const e = Jt(t.transactions), n = t.deployment ? Jt(t.deployment) : 0n;
|
|
3640
|
-
return e + n;
|
|
3641
|
-
}, ed = (t) => {
|
|
3642
|
-
if (t.deployment && !nt(t.deployment.feeTokenAddress, t.transactions.feeTokenAddress))
|
|
3643
|
-
throw Error("Cannot calculate estimated fees for different tokens");
|
|
3644
|
-
const e = t.deployment ? Be(t.deployment) : 0n, n = Be(t.transactions);
|
|
3645
|
-
return e + n;
|
|
3646
|
-
}, nd = (t, e) => [
|
|
3647
|
-
{
|
|
3648
|
-
contractAddress: t,
|
|
3649
|
-
entrypoint: "transfer",
|
|
3650
|
-
calldata: mt.compile(ws.parse({
|
|
3651
|
-
// We are using a dummy address (ETH here) as recipient to estimate the fee given we don't have a receipient yet
|
|
3652
|
-
recipient: e,
|
|
3653
|
-
// We are using the smallest possible amount to make sure this doesn't throw an error
|
|
3654
|
-
amount: Dt.bnToUint256(BigInt(1))
|
|
3655
|
-
}))
|
|
3656
|
-
}
|
|
3657
|
-
], al = (t, e) => {
|
|
3658
|
-
if (!t)
|
|
3659
|
-
return {
|
|
3660
|
-
transactions: {
|
|
3661
|
-
feeTokenAddress: e ?? $n,
|
|
3662
|
-
amount: 0n,
|
|
3663
|
-
pricePerUnit: 0n,
|
|
3664
|
-
dataGasConsumed: 0n,
|
|
3665
|
-
dataGasPrice: 0n
|
|
3666
|
-
}
|
|
3667
|
-
};
|
|
3668
|
-
if (!Array.isArray(t))
|
|
3669
|
-
throw Error(`Unexpected simulation response. Expected array. Got ${typeof t}`);
|
|
3670
|
-
if (t.length === 1) {
|
|
3671
|
-
const n = fe.parse(t[0].feeEstimation);
|
|
3672
|
-
return {
|
|
3673
|
-
transactions: {
|
|
3674
|
-
feeTokenAddress: Ee(n.unit),
|
|
3675
|
-
amount: O.toBigInt(n.gasUsage),
|
|
3676
|
-
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3677
|
-
max: Pt(At(n, O.toBigInt)),
|
|
3678
|
-
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3679
|
-
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3680
|
-
}
|
|
3681
|
-
};
|
|
3682
|
-
}
|
|
3683
|
-
if (t.length === 2) {
|
|
3684
|
-
const n = fe.parse(t[0].feeEstimation), r = fe.parse(t[1].feeEstimation);
|
|
3685
|
-
return {
|
|
3686
|
-
deployment: {
|
|
3687
|
-
feeTokenAddress: Ee(n.unit),
|
|
3688
|
-
amount: O.toBigInt(n.gasUsage),
|
|
3689
|
-
pricePerUnit: O.toBigInt(n.gasPrice),
|
|
3690
|
-
max: Pt(At(n, O.toBigInt)),
|
|
3691
|
-
dataGasConsumed: n.dataGasConsumed ? O.toBigInt(n.dataGasConsumed) : 0n,
|
|
3692
|
-
dataGasPrice: n.dataGasPrice ? O.toBigInt(n.dataGasPrice) : 0n
|
|
3693
|
-
},
|
|
3694
|
-
transactions: {
|
|
3695
|
-
feeTokenAddress: Ee(r.unit),
|
|
3696
|
-
amount: O.toBigInt(r.gasUsage),
|
|
3697
|
-
pricePerUnit: O.toBigInt(r.gasPrice),
|
|
3698
|
-
max: Pt(At(r, O.toBigInt)),
|
|
3699
|
-
dataGasConsumed: r.dataGasConsumed ? O.toBigInt(r.dataGasConsumed) : 0n,
|
|
3700
|
-
dataGasPrice: r.dataGasPrice ? O.toBigInt(r.dataGasPrice) : 0n
|
|
3701
|
-
}
|
|
3702
|
-
};
|
|
3703
|
-
}
|
|
3704
|
-
throw Error("Unexpected simulation response length");
|
|
3705
|
-
}, il = ({ transaction: t, nonce: e, chainId: n, version: r, isDeploymentTransaction: s, cairoVersion: o, address: a, appDomain: i }) => {
|
|
3706
|
-
let c = e;
|
|
3707
|
-
s && t.type !== "DEPLOY_ACCOUNT" && (c = O.toHex(1));
|
|
3708
|
-
const l = Ce(t.calls);
|
|
3709
|
-
return {
|
|
3710
|
-
type: t.type,
|
|
3711
|
-
chainId: n,
|
|
3712
|
-
cairoVersion: o,
|
|
3713
|
-
nonce: c,
|
|
3714
|
-
version: r,
|
|
3715
|
-
account: a,
|
|
3716
|
-
calls: l,
|
|
3717
|
-
calldata: t.calldata,
|
|
3718
|
-
salt: t.salt,
|
|
3719
|
-
signature: t.signature,
|
|
3720
|
-
classHash: t.classHash,
|
|
3721
|
-
appDomain: i
|
|
3722
|
-
// appDomain: "https://starknetkit-blacked-listed.vercel.app", // to simulate blacklisted domain
|
|
3723
|
-
};
|
|
3724
|
-
}, cl = (t, e) => {
|
|
3725
|
-
const { transactions: n } = t, r = n.map((c) => {
|
|
3726
|
-
if (!c.simulation)
|
|
3727
|
-
throw new Ss({ code: "SIMULATE_AND_REVIEW_FAILED" });
|
|
3728
|
-
return c;
|
|
3729
|
-
}), s = r.map((c) => ({
|
|
3730
|
-
...c.simulation,
|
|
3731
|
-
feeEstimation: At(c.simulation.feeEstimation, Number)
|
|
3732
|
-
})), o = al(s, e), [a, i] = r.length === 1 ? [r[0], void 0] : [r[1], r[0]];
|
|
3733
|
-
return {
|
|
3734
|
-
...o,
|
|
3735
|
-
transactions: {
|
|
3736
|
-
...o.transactions,
|
|
3737
|
-
dataGasConsumed: o.transactions.dataGasConsumed ?? 0n,
|
|
3738
|
-
dataGasPrice: o.transactions.dataGasPrice ?? 0n,
|
|
3739
|
-
max: Pt(At(a.simulation.feeEstimation, O.toBigInt))
|
|
3740
|
-
},
|
|
3741
|
-
deployment: o.deployment && i ? {
|
|
3742
|
-
...o.deployment,
|
|
3743
|
-
dataGasConsumed: o.deployment.dataGasConsumed ?? 0n,
|
|
3744
|
-
dataGasPrice: o.deployment.dataGasPrice ?? 0n,
|
|
3745
|
-
max: Pt(At(i.simulation.feeEstimation, O.toBigInt))
|
|
3746
|
-
} : void 0
|
|
3747
|
-
};
|
|
3748
|
-
}, rd = (t) => {
|
|
3749
|
-
const e = Nr(t), n = Be(t);
|
|
3750
|
-
return {
|
|
3751
|
-
// for v1 transactions
|
|
3752
|
-
maxFee: n,
|
|
3753
|
-
// for v3 transactions
|
|
3754
|
-
resourceBounds: {
|
|
3755
|
-
l1_gas: {
|
|
3756
|
-
// (overall_fee / gas_price) × gas_safety_margin
|
|
3757
|
-
max_amount: O.toHex(n / t.pricePerUnit),
|
|
3758
|
-
// max_price_per_unit: gas_price × fee_safety_margin
|
|
3759
|
-
max_price_per_unit: O.toHex(e.pricePerUnit)
|
|
3760
|
-
},
|
|
3761
|
-
l2_gas: {
|
|
3762
|
-
max_amount: "0x0",
|
|
3763
|
-
max_price_per_unit: "0x0"
|
|
3764
|
-
}
|
|
3765
|
-
}
|
|
3766
|
-
};
|
|
3767
|
-
}, sd = (t) => {
|
|
3768
|
-
const e = Math.sqrt(t);
|
|
3769
|
-
return isNaN(e) ? Math.sqrt(2) : e;
|
|
3770
|
-
}, ll = (t) => {
|
|
3771
|
-
const e = Math.cbrt(t);
|
|
3772
|
-
return isNaN(e) ? Math.cbrt(2) : e;
|
|
3773
|
-
}, od = (t) => t < 1 || isNaN(t) ? 1.1 : Math.log(t + 1) + 1, ul = [Oe];
|
|
3774
|
-
function Me({ address: t }) {
|
|
3775
|
-
return ul.some((e) => nt(t, e));
|
|
3776
|
-
}
|
|
3777
|
-
function ad(t) {
|
|
3778
|
-
return t ? ba().some((e) => nt(e, t)) : !1;
|
|
3779
|
-
}
|
|
3780
|
-
function Nn(t) {
|
|
3781
|
-
return Me({
|
|
3782
|
-
address: t
|
|
3783
|
-
}) ? Y.TRANSACTION_VERSION.V3 : Y.TRANSACTION_VERSION.V1;
|
|
3784
|
-
}
|
|
3785
|
-
function id(t) {
|
|
3786
|
-
return Me({ address: t }) ? Y.TRANSACTION_VERSION.F3 : Y.TRANSACTION_VERSION.F1;
|
|
3787
|
-
}
|
|
3788
|
-
function cd(t, e) {
|
|
3789
|
-
return Ts(e.contract) ? Me({ address: t }) ? Y.TRANSACTION_VERSION.V3 : Y.TRANSACTION_VERSION.V2 : Y.TRANSACTION_VERSION.V1;
|
|
3790
|
-
}
|
|
3791
|
-
class ld {
|
|
3792
|
-
constructor(e, n) {
|
|
3793
|
-
this.apiBase = e, this.httpService = n;
|
|
3794
|
-
}
|
|
3795
|
-
/**
|
|
3796
|
-
* Fetch transaction review labels
|
|
3797
|
-
* @returns {Promise<TransactionReviewLabel[] | undefined>} The account activities.
|
|
3798
|
-
*/
|
|
3799
|
-
async getLabels() {
|
|
3800
|
-
const e = P(this.apiBase, "reviewer", "labels");
|
|
3801
|
-
return await this.httpService.get(e);
|
|
3802
|
-
}
|
|
3803
|
-
/**
|
|
3804
|
-
* Fetch transaction review warnings.
|
|
3805
|
-
* @returns {Promise<TransactionReviewWarning[] | undefined>} The account activities.
|
|
3806
|
-
*/
|
|
3807
|
-
async getWarnings() {
|
|
3808
|
-
const e = P(this.apiBase, "reviewer", "warnings/reasons");
|
|
3809
|
-
return await this.httpService.get(e);
|
|
3810
|
-
}
|
|
3811
|
-
async simulateAndReview(e, n, r, s, o, a) {
|
|
3812
|
-
const i = n.some((c) => c.type === "DEPLOY_ACCOUNT");
|
|
3813
|
-
try {
|
|
3814
|
-
if (!("getChainId" in e))
|
|
3815
|
-
throw new Error("MISSING_METHOD");
|
|
3816
|
-
const c = Nn(r), l = i ? "0x0" : await e.getNonce(), d = await e.getChainId(), u = {
|
|
3817
|
-
transactions: n.map((w) => ({
|
|
3818
|
-
...il({
|
|
3819
|
-
transaction: w,
|
|
3820
|
-
nonce: l,
|
|
3821
|
-
version: c,
|
|
3822
|
-
chainId: d,
|
|
3823
|
-
isDeploymentTransaction: i,
|
|
3824
|
-
appDomain: s,
|
|
3825
|
-
cairoVersion: e.cairoVersion,
|
|
3826
|
-
address: e.address
|
|
3827
|
-
}),
|
|
3828
|
-
type: w.type
|
|
3829
|
-
}))
|
|
3830
|
-
}, y = P(this.apiBase, "reviewer", "transactions", "v2", "review", "starknet"), m = a ? Qr(y, { delayedTransactions: "true" }) : y, S = await this.httpService.post(m, {
|
|
3831
|
-
headers: {
|
|
3832
|
-
Accept: "application/json",
|
|
3833
|
-
"Content-Type": "application/json"
|
|
3834
|
-
},
|
|
3835
|
-
body: JSON.stringify(u)
|
|
3836
|
-
}, As);
|
|
3837
|
-
if (S.transactions.some((w) => xs(w)))
|
|
3838
|
-
return S;
|
|
3839
|
-
const g = cl(S, r);
|
|
3840
|
-
return {
|
|
3841
|
-
...S,
|
|
3842
|
-
enrichedFeeEstimation: g
|
|
3843
|
-
};
|
|
3844
|
-
} catch (c) {
|
|
3845
|
-
return console.error(c), this.fallbackToOnchainFeeEstimation({
|
|
3846
|
-
transactions: n,
|
|
3847
|
-
account: e,
|
|
3848
|
-
isDeploymentTransaction: i,
|
|
3849
|
-
feeTokenAddress: r,
|
|
3850
|
-
accountDeployTransaction: o
|
|
3851
|
-
});
|
|
3852
|
-
}
|
|
3853
|
-
}
|
|
3854
|
-
getCallsFromTx(e) {
|
|
3855
|
-
let n;
|
|
3856
|
-
return e.calls && (n = Ce(e.calls)), n;
|
|
3857
|
-
}
|
|
3858
|
-
async fallbackToOnchainFeeEstimation({ transactions: e, account: n, isDeploymentTransaction: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3859
|
-
try {
|
|
3860
|
-
const a = r ? this.getCallsFromTx(e[1]) : this.getCallsFromTx(e[0]);
|
|
3861
|
-
if (!a)
|
|
3862
|
-
throw new Bt({
|
|
3863
|
-
code: "NO_CALLS_FOUND"
|
|
3864
|
-
});
|
|
3865
|
-
const i = await this.fetchFeesOnchain({
|
|
3866
|
-
starknetAccount: n,
|
|
3867
|
-
calls: a,
|
|
3868
|
-
isDeployed: !r,
|
|
3869
|
-
feeTokenAddress: s,
|
|
3870
|
-
accountDeployTransaction: o
|
|
3871
|
-
});
|
|
3872
|
-
return {
|
|
3873
|
-
transactions: [],
|
|
3874
|
-
enrichedFeeEstimation: i,
|
|
3875
|
-
isBackendDown: !0
|
|
3876
|
-
};
|
|
3877
|
-
} catch (a) {
|
|
3878
|
-
throw console.error(a), new Bt({
|
|
3879
|
-
message: `${a}`,
|
|
3880
|
-
code: "SIMULATE_AND_REVIEW_FAILED"
|
|
3881
|
-
});
|
|
3882
|
-
}
|
|
3883
|
-
}
|
|
3884
|
-
async fetchFeesOnchain({ starknetAccount: e, calls: n, isDeployed: r, feeTokenAddress: s, accountDeployTransaction: o }) {
|
|
3885
|
-
try {
|
|
3886
|
-
const a = Nn(s), i = {
|
|
3887
|
-
transactions: {
|
|
3888
|
-
feeTokenAddress: s,
|
|
3889
|
-
amount: 0n,
|
|
3890
|
-
pricePerUnit: 0n,
|
|
3891
|
-
dataGasConsumed: 0n,
|
|
3892
|
-
dataGasPrice: 0n
|
|
3893
|
-
}
|
|
3894
|
-
};
|
|
3895
|
-
if (!r && o) {
|
|
3896
|
-
if ("estimateFeeBulk" in e) {
|
|
3897
|
-
const c = [
|
|
3898
|
-
{
|
|
3899
|
-
type: tn.DEPLOY_ACCOUNT,
|
|
3900
|
-
payload: {
|
|
3901
|
-
classHash: o.classHash,
|
|
3902
|
-
addressSalt: o.salt,
|
|
3903
|
-
constructorCalldata: o.calldata,
|
|
3904
|
-
contractAddress: e.address
|
|
3905
|
-
}
|
|
3906
|
-
},
|
|
3907
|
-
{
|
|
3908
|
-
type: tn.INVOKE,
|
|
3909
|
-
payload: n
|
|
3910
|
-
}
|
|
3911
|
-
], [l, d] = await e.estimateFeeBulk(c, {
|
|
3912
|
-
version: a
|
|
3913
|
-
}).catch((u) => {
|
|
3914
|
-
throw console.error(u), u;
|
|
3915
|
-
});
|
|
3916
|
-
if (!l.gas_consumed || !l.gas_price || !d.gas_consumed || !d.gas_price)
|
|
3917
|
-
throw new Bt({
|
|
3918
|
-
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
3919
|
-
message: "Missing gas_consumed or gas_price"
|
|
3920
|
-
});
|
|
3921
|
-
i.deployment = {
|
|
3922
|
-
feeTokenAddress: s,
|
|
3923
|
-
amount: l.gas_consumed,
|
|
3924
|
-
pricePerUnit: l.gas_price,
|
|
3925
|
-
dataGasConsumed: l.data_gas_consumed,
|
|
3926
|
-
dataGasPrice: l.data_gas_price
|
|
3927
|
-
}, i.transactions = {
|
|
3928
|
-
feeTokenAddress: s,
|
|
3929
|
-
amount: d.gas_consumed,
|
|
3930
|
-
pricePerUnit: d.gas_price,
|
|
3931
|
-
dataGasConsumed: d.data_gas_consumed,
|
|
3932
|
-
dataGasPrice: d.data_gas_price
|
|
3933
|
-
};
|
|
3934
|
-
}
|
|
3935
|
-
} else {
|
|
3936
|
-
const { gas_consumed: c, gas_price: l, data_gas_consumed: d, data_gas_price: u } = await e.estimateFee(n, {
|
|
3937
|
-
skipValidate: !0,
|
|
3938
|
-
version: a
|
|
3939
|
-
});
|
|
3940
|
-
if (!c || !l)
|
|
3941
|
-
throw new Bt({
|
|
3942
|
-
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
3943
|
-
message: "Missing gas_consumed or gas_price"
|
|
3944
|
-
});
|
|
3945
|
-
i.transactions = {
|
|
3946
|
-
feeTokenAddress: s,
|
|
3947
|
-
amount: c,
|
|
3948
|
-
pricePerUnit: l,
|
|
3949
|
-
dataGasConsumed: d,
|
|
3950
|
-
dataGasPrice: u
|
|
3951
|
-
};
|
|
3952
|
-
}
|
|
3953
|
-
return i;
|
|
3954
|
-
} catch (a) {
|
|
3955
|
-
throw new Bt({
|
|
3956
|
-
code: "ONCHAIN_FEE_ESTIMATION_FAILED",
|
|
3957
|
-
message: `${a}`
|
|
3958
|
-
});
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
}
|
|
3962
|
-
const ud = [
|
|
3963
|
-
"account-upgrade",
|
|
3964
|
-
"approve",
|
|
3965
|
-
"set-approval-for-all",
|
|
3966
|
-
"swap",
|
|
3967
|
-
"transfer"
|
|
3968
|
-
], dd = (t) => ({ showBalanceChange: xt(() => {
|
|
3969
|
-
const n = t == null ? void 0 : t.some((s) => !nn(s.transfers)), r = t == null ? void 0 : t.some((s) => !nn(s.approvals));
|
|
3970
|
-
return t && (n || r);
|
|
3971
|
-
}, [t]) }), ue = (t) => t ? t.filter((e) => e.token.type === "erc20") : [], fd = (t) => xt(() => ue(t), [t]), hd = (t) => ue(t).length > 0, pd = (t) => ue(t).some((n) => n.amount > 0n), md = (t) => ue(t).some((n) => n.amount < 0n), Cr = (t) => t ? t.filter((e) => e.token.type === "erc721") : [], gd = (t) => xt(() => Cr(t), [t]), dl = (t) => Cr(t).length > 0, wd = (t) => xt(() => dl(t), [t]), yd = (t, e) => xt(() => t && e ? [
|
|
3972
|
-
{
|
|
3973
|
-
contractAddress: t.address,
|
|
3974
|
-
entrypoint: "transfer",
|
|
3975
|
-
calldata: mt.compile({
|
|
3976
|
-
recipient: e,
|
|
3977
|
-
amount: Ut(t.balance)
|
|
3978
|
-
})
|
|
3979
|
-
}
|
|
3980
|
-
] : [], [t, e]), bd = ({ apiData: { apiBaseUrl: t, apiHeaders: e }, address: n, network: r, transactionReviewEnabled: s = !0, transactions: o }) => {
|
|
3981
|
-
const a = Ln(async () => {
|
|
3982
|
-
if (!n || !r)
|
|
3983
|
-
return;
|
|
3984
|
-
if (!t)
|
|
3985
|
-
throw "Transaction review endpoint is not defined";
|
|
3986
|
-
const c = P(t, "reviewer/transactions/review/starknet"), l = Cs(o) ? o : [o], d = {
|
|
3987
|
-
network: r,
|
|
3988
|
-
account: n,
|
|
3989
|
-
calls: l
|
|
3990
|
-
};
|
|
3991
|
-
return qn(c, {
|
|
3992
|
-
method: "POST",
|
|
3993
|
-
headers: {
|
|
3994
|
-
"Content-Type": "application/json",
|
|
3995
|
-
...e
|
|
3996
|
-
},
|
|
3997
|
-
body: JSON.stringify(d)
|
|
3998
|
-
});
|
|
3999
|
-
}, [n, r, o]), i = xt(() => Fs({ transactions: o, address: n, network: r }), [o, n, r]);
|
|
4000
|
-
return qs(!!s, [i, "transactionReview"], a);
|
|
4001
|
-
}, Sd = (t) => {
|
|
4002
|
-
if (!t)
|
|
4003
|
-
return {};
|
|
4004
|
-
const e = t.assessment === "warn" && t.reason !== "contract_is_not_verified", n = t.reason ? ` (Reason: ${Hn(t.reason)})` : "", r = e ? t.reason === "recipient_is_token_address" ? "You are sending tokens to their own address. This is likely to burn them." : `This transaction has been flagged as dangerous. We recommend you reject this transaction unless you are sure.${n}` : void 0;
|
|
4005
|
-
return {
|
|
4006
|
-
warn: e,
|
|
4007
|
-
reason: r
|
|
4008
|
-
};
|
|
4009
|
-
}, fl = (t) => {
|
|
4010
|
-
var e;
|
|
4011
|
-
if (t) {
|
|
4012
|
-
for (const n of t.reviews)
|
|
4013
|
-
if (((e = n.activity) == null ? void 0 : e.type) === "swap")
|
|
4014
|
-
return n;
|
|
4015
|
-
}
|
|
4016
|
-
}, Ed = (t) => {
|
|
4017
|
-
}, Ad = (t, e) => {
|
|
4018
|
-
var n;
|
|
4019
|
-
if (e) {
|
|
4020
|
-
for (const r of e.reviews)
|
|
4021
|
-
if (((n = r.activity) == null ? void 0 : n.type) === t)
|
|
4022
|
-
return r.activity;
|
|
4023
|
-
}
|
|
4024
|
-
}, xd = (t) => !!fl(t), vd = (t) => {
|
|
4025
|
-
var e, n;
|
|
4026
|
-
if (t) {
|
|
4027
|
-
for (const r of t.reviews)
|
|
4028
|
-
if ((e = r.activity) != null && e.type)
|
|
4029
|
-
return {
|
|
4030
|
-
...r,
|
|
4031
|
-
type: (n = r.activity) == null ? void 0 : n.type
|
|
4032
|
-
};
|
|
4033
|
-
}
|
|
4034
|
-
}, hl = async ({ feeTokenAddress: t, calls: e, selectedAccount: n, transactionReviewService: r, appDomain: s, accountDeployTransaction: o, isDelayedTransaction: a }) => {
|
|
4035
|
-
const i = {
|
|
4036
|
-
type: "INVOKE",
|
|
4037
|
-
calls: Ce(e)
|
|
4038
|
-
};
|
|
4039
|
-
if (!n || !t)
|
|
4040
|
-
return;
|
|
4041
|
-
const c = o ? [o, i] : [i];
|
|
4042
|
-
return { result: await r.simulateAndReview(n, c, t, s, o, a) };
|
|
4043
|
-
}, pl = async (t, e, n, r) => {
|
|
4044
|
-
var y, m, S, h, g, w;
|
|
4045
|
-
let s = !1;
|
|
4046
|
-
const o = e.transactions.find((E) => {
|
|
4047
|
-
var x, _;
|
|
4048
|
-
return (_ = (x = E == null ? void 0 : E.simulation) == null ? void 0 : x.summary) == null ? void 0 : _.find((B) => B.sent);
|
|
4049
|
-
});
|
|
4050
|
-
if (!o || !((y = o.simulation) != null && y.summary))
|
|
4051
|
-
return s;
|
|
4052
|
-
const a = o.simulation.summary.filter((E) => E.sent).map((E) => E.token.address);
|
|
4053
|
-
if (!(((m = e.enrichedFeeEstimation) == null ? void 0 : m.transactions.feeTokenAddress) && a.includes((S = e.enrichedFeeEstimation) == null ? void 0 : S.transactions.feeTokenAddress)) || !((g = (h = e.enrichedFeeEstimation) == null ? void 0 : h.transactions) != null && g.max))
|
|
4054
|
-
return s;
|
|
4055
|
-
const c = "amount" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.amount * e.enrichedFeeEstimation.transactions.max.pricePerUnit : "maxFee" in e.enrichedFeeEstimation.transactions.max ? e.enrichedFeeEstimation.transactions.max.maxFee : void 0, l = (w = o.simulation.summary.find((E) => E.sent && E.token.address === n)) == null ? void 0 : w.value;
|
|
4056
|
-
if (!c || !l)
|
|
4057
|
-
return s;
|
|
4058
|
-
const d = await Yc(n, t, r) ?? 0n;
|
|
4059
|
-
return BigInt(d) > c + BigInt(l) || (s = !0), s;
|
|
4060
|
-
}, Td = () => Ln(async ({ feeTokenAddress: e, calls: n, selectedAccount: r, transactionReviewService: s, appDomain: o, accountDeployPayload: a, provider: i, isDelayedTransaction: c }) => {
|
|
4061
|
-
if (!r)
|
|
4062
|
-
return;
|
|
4063
|
-
const l = await hl({
|
|
4064
|
-
feeTokenAddress: e,
|
|
4065
|
-
calls: n,
|
|
4066
|
-
selectedAccount: r,
|
|
4067
|
-
transactionReviewService: s,
|
|
4068
|
-
appDomain: o,
|
|
4069
|
-
accountDeployTransaction: ml(a),
|
|
4070
|
-
isDelayedTransaction: c
|
|
4071
|
-
});
|
|
4072
|
-
if (!l || !l.result || !e)
|
|
4073
|
-
return;
|
|
4074
|
-
const d = await pl(r.address, l.result, e, i);
|
|
4075
|
-
return { ...l.result, isSendingMoreThanBalanceAndGas: d };
|
|
4076
|
-
}, []), ml = (t) => t ? {
|
|
4077
|
-
type: "DEPLOY_ACCOUNT",
|
|
4078
|
-
calldata: t.calldata,
|
|
4079
|
-
classHash: kt.parse(t.class_hash),
|
|
4080
|
-
salt: kt.parse(t.salt),
|
|
4081
|
-
signature: []
|
|
4082
|
-
} : void 0;
|
|
4083
|
-
function Cn() {
|
|
4084
|
-
return { promise: Promise.resolve() };
|
|
4085
|
-
}
|
|
4086
|
-
function Id(t) {
|
|
4087
|
-
return class extends t {
|
|
4088
|
-
constructor({ enabled: e, appVersion: n }) {
|
|
4089
|
-
super(), this.enabled = e, this.appVersion = n;
|
|
4090
|
-
}
|
|
4091
|
-
track(e, n) {
|
|
4092
|
-
return !this.enabled || !super.isLoaded ? Cn() : {
|
|
4093
|
-
promise: super.track(e, {
|
|
4094
|
-
app_version: this.appVersion,
|
|
4095
|
-
...n
|
|
4096
|
-
}).promise
|
|
4097
|
-
};
|
|
4098
|
-
}
|
|
4099
|
-
};
|
|
4100
|
-
}
|
|
4101
|
-
const gl = Is({}), Bd = ({ enabled: t, initialize: e, children: n }) => {
|
|
4102
|
-
const [r, s] = jn(!1);
|
|
4103
|
-
return $t(() => {
|
|
4104
|
-
!r && t && e().then(() => s(!0));
|
|
4105
|
-
}, [r, t, e]), /* @__PURE__ */ Us(gl.Provider, { value: {}, children: n });
|
|
4106
|
-
};
|
|
4107
|
-
export {
|
|
4108
|
-
tt as ARGENT_ACCOUNT_CONTRACT_CLASS_HASHES,
|
|
4109
|
-
Kt as ARGENT_MULTISIG_CONTRACT_CLASS_HASHES,
|
|
4110
|
-
Ol as AddSmartAccountResponseSchema,
|
|
4111
|
-
kl as AddSmartAcountRequestSchema,
|
|
4112
|
-
js as BackendAccountSchema,
|
|
4113
|
-
bu as BackendNftService,
|
|
4114
|
-
kd as BaseError,
|
|
4115
|
-
Js as C0_PROXY_CONTRACT_CLASS_HASHES,
|
|
4116
|
-
Dl as CacheService,
|
|
4117
|
-
Jr as DEFAULT_TOKEN_DECIMALS,
|
|
4118
|
-
Hl as DateService,
|
|
4119
|
-
kh as ESTIMATE_ERROR_MESSAGES,
|
|
4120
|
-
$n as ETH_TOKEN_ADDRESS,
|
|
4121
|
-
Ss as EstimateError,
|
|
4122
|
-
Pd as EventEmitterProvider,
|
|
4123
|
-
Ph as EventsBySelector,
|
|
4124
|
-
Rh as FEE_OVERHEAD,
|
|
4125
|
-
Gn as HTTPService,
|
|
4126
|
-
ze as HTTP_ERROR_MESSAGE,
|
|
4127
|
-
K as HttpError,
|
|
4128
|
-
nu as KnownDappsBackendService,
|
|
4129
|
-
Ze as MultiSigner,
|
|
4130
|
-
ku as OnchainRecoveryService,
|
|
4131
|
-
Jc as PRETTY_UNLIMITED,
|
|
4132
|
-
Te as RecoveryStatusEnum,
|
|
4133
|
-
su as ResolveNameService,
|
|
4134
|
-
ys as STANDARD_DEVNET_ACCOUNT_CLASS_HASH,
|
|
4135
|
-
Oe as STRK_TOKEN_ADDRESS,
|
|
4136
|
-
Vl as SWRService,
|
|
4137
|
-
Kl as StarknetAddressService,
|
|
4138
|
-
Ie as StartOnchainRecoveryErrorStatusEnum,
|
|
4139
|
-
$h as TOKEN_ERROR_MESSAGES,
|
|
4140
|
-
Fh as TXV1_ACCOUNT_CLASS_HASH,
|
|
4141
|
-
Uh as TXV1_MULTISIG_CLASS_HASH,
|
|
4142
|
-
jh as TXV3_ACCOUNT_CLASS_HASH,
|
|
4143
|
-
Lh as TXV3_MULTISIG_CLASS_HASH,
|
|
4144
|
-
Dh as TokenError,
|
|
4145
|
-
Ku as TokenServiceWeb,
|
|
4146
|
-
ld as TransactionReviewServiceWeb,
|
|
4147
|
-
Bd as WebAmplitudeProvider,
|
|
4148
|
-
Id as WebAnalyticsServiceFactory,
|
|
4149
|
-
Rd as abiEntrySchema,
|
|
4150
|
-
$d as abiSchema,
|
|
4151
|
-
qc as activeOnchainRecoverySchema,
|
|
4152
|
-
Fd as addOwnersCalldataSchema,
|
|
4153
|
-
Ud as addPluginCalldataSchema,
|
|
4154
|
-
jd as addressInputCharactersAndLengthSchema,
|
|
4155
|
-
Ld as addressInputSchema,
|
|
4156
|
-
Dd as addressOrDomainInputSchema,
|
|
4157
|
-
Hd as addressOrDomainSchema,
|
|
4158
|
-
Vd as addressOrEmptyUndefinedSchema,
|
|
4159
|
-
te as addressSchema,
|
|
4160
|
-
Ne as addressSchemaArgentBackend,
|
|
4161
|
-
Md as addressSchemaBase,
|
|
4162
|
-
Gd as addressSchemaLooseLength,
|
|
4163
|
-
qd as addressSchemaStrictLength,
|
|
4164
|
-
Hh as airdropSchema,
|
|
4165
|
-
ps as apiAccountTokenBalancesSchema,
|
|
4166
|
-
Wd as apiAirdropSchema,
|
|
4167
|
-
zd as apiCollateralizedDebtPositionSchema,
|
|
4168
|
-
Kd as apiCollateralizedDebtPositionsSchema,
|
|
4169
|
-
Yd as apiConcentratedLiquidityPositionSchema,
|
|
4170
|
-
Zd as apiConcentratedLiquidityPositionsSchema,
|
|
4171
|
-
Xd as apiDefiDecompositionProduct,
|
|
4172
|
-
Jd as apiDefiDecompositionProducts,
|
|
4173
|
-
Qd as apiDefiDecompositionSchema,
|
|
4174
|
-
tf as apiDefiDecompositionToken,
|
|
4175
|
-
gs as apiDefiPositionsSchema,
|
|
4176
|
-
ef as apiPriceDataResponseSchema,
|
|
4177
|
-
nf as apiPriceDetailsSchema,
|
|
4178
|
-
rf as apiStakingPositionSchema,
|
|
4179
|
-
sf as apiStakingPositionsSchema,
|
|
4180
|
-
hs as apiTokenInfoResponseSchema,
|
|
4181
|
-
of as apiTokenInfoSchema,
|
|
4182
|
-
fs as apiTokensInfoResponseSchema,
|
|
4183
|
-
ud as apiTransactionReviewActivityType,
|
|
4184
|
-
af as apiUnclaimedRewardsSchema,
|
|
4185
|
-
cf as apiWalletResponseSchema,
|
|
4186
|
-
Hs as argentBackendNetworkIdSchema,
|
|
4187
|
-
Es as argentMaxFee,
|
|
4188
|
-
lf as argentNameSchema,
|
|
4189
|
-
Ds as argentNetworkIdSchema,
|
|
4190
|
-
Ll as bigDecimal,
|
|
4191
|
-
uf as bigNumberSchema,
|
|
4192
|
-
df as bigNumberishSchema,
|
|
4193
|
-
Cd as bipsToPercent,
|
|
4194
|
-
ff as booleanToStringSchema,
|
|
4195
|
-
ml as buildAccountDeployTransaction,
|
|
4196
|
-
Aa as buildConstructorCalldata,
|
|
4197
|
-
nd as buildDummyTx,
|
|
4198
|
-
hf as builtinsSchema,
|
|
4199
|
-
pf as byteCodeSchema,
|
|
4200
|
-
mf as cairo1EventSchema,
|
|
4201
|
-
gf as cairoAssemblySchema,
|
|
4202
|
-
wf as cairoVersionSchema,
|
|
4203
|
-
ll as calculateCubeRootAdjustment,
|
|
4204
|
-
od as calculateNonLinearAdjustment,
|
|
4205
|
-
sd as calculateSqrtAdjustment,
|
|
4206
|
-
yf as callDetailsSchema,
|
|
4207
|
-
ts as callSchema,
|
|
4208
|
-
bf as calldataSchema,
|
|
4209
|
-
At as castFeeEstimation,
|
|
4210
|
-
Sf as changeGuardianCalldataSchema,
|
|
4211
|
-
Ef as changeThresholdCalldataSchema,
|
|
4212
|
-
pl as checkGasFeeBalance,
|
|
4213
|
-
ad as classHashSupportsTxV3,
|
|
4214
|
-
Vh as collateralizedDebtGroupSchema,
|
|
4215
|
-
Mh as collateralizedDebtPositionSchema,
|
|
4216
|
-
Gh as collateralizedDebtPositionsSchema,
|
|
4217
|
-
Af as compiledContractClassSchema,
|
|
4218
|
-
xf as compiledSierraCasmSchema,
|
|
4219
|
-
vf as compiledSierraSchema,
|
|
4220
|
-
Tf as compressedProgramSchema,
|
|
4221
|
-
qh as concentratedLiquidityPositionSchema,
|
|
4222
|
-
Wh as concentratedLiquidityPositionsSchema,
|
|
4223
|
-
cs as constructorCallDataSchemaC0,
|
|
4224
|
-
ls as constructorCallDataSchemaC1V1,
|
|
4225
|
-
If as contractEntryPointFieldsSchema,
|
|
4226
|
-
Vu as convertTokenAmountToCurrencyValue,
|
|
4227
|
-
Mu as convertTokenUnitAmountWithDecimals,
|
|
4228
|
-
Bf as createSchemaWithWarnings,
|
|
4229
|
-
Ta as dappContractSchema,
|
|
4230
|
-
va as dappLinkSchema,
|
|
4231
|
-
lu as daysBetween,
|
|
4232
|
-
pi as decodeBase58,
|
|
4233
|
-
cu as decodeBase58Array,
|
|
4234
|
-
zh as defiDappsProductsSchema,
|
|
4235
|
-
Kh as defiPositionSchema,
|
|
4236
|
-
_f as defiPositionTypeSchema,
|
|
4237
|
-
Yh as defiProductSchema,
|
|
4238
|
-
Zh as defiProductsSchema,
|
|
4239
|
-
Xh as denyTxV3,
|
|
4240
|
-
hi as encodeBase58,
|
|
4241
|
-
iu as encodeBase58Array,
|
|
4242
|
-
Ce as ensureArray,
|
|
4243
|
-
Gu as ensureDecimals,
|
|
4244
|
-
wu as entryPointToHumanReadable,
|
|
4245
|
-
Nf as entryPointsByTypeSchema,
|
|
4246
|
-
vu as equalNft,
|
|
4247
|
-
Yu as erc20TransferTransaction,
|
|
4248
|
-
Xu as erc721SafeTransferFromTransaction,
|
|
4249
|
-
Zu as erc721TransferFromTransaction,
|
|
4250
|
-
Cf as escapeGuardianCalldataSchema,
|
|
4251
|
-
Be as estimatedFeeToMaxFeeTotal,
|
|
4252
|
-
rd as estimatedFeeToMaxResourceBounds,
|
|
4253
|
-
Jt as estimatedFeeToTotal,
|
|
4254
|
-
ed as estimatedFeesToMaxFeeTotal,
|
|
4255
|
-
td as estimatedFeesToTotal,
|
|
4256
|
-
Of as eventAbiSchema,
|
|
4257
|
-
kf as eventEntrySchema,
|
|
4258
|
-
Pf as executeOnPluginCalldataSchema,
|
|
4259
|
-
Me as feeTokenNeedsTxV3Support,
|
|
4260
|
-
Rf as feltSchema,
|
|
4261
|
-
qn as fetchData,
|
|
4262
|
-
zt as fetcherError,
|
|
4263
|
-
Ql as findImplementationForAccount,
|
|
4264
|
-
Jh as findTransfersAndApprovals,
|
|
4265
|
-
Zn as formatAddress,
|
|
4266
|
-
$f as formatFullAddress,
|
|
4267
|
-
Ff as formatTruncatedAddress,
|
|
4268
|
-
Uf as formatTruncatedSignerKey,
|
|
4269
|
-
jf as formatTruncatedString,
|
|
4270
|
-
Lf as functionAbiSchema,
|
|
4271
|
-
Df as functionAbiTypeSchema,
|
|
4272
|
-
ui as generateAvatarImage,
|
|
4273
|
-
xa as getAccountContractAddress,
|
|
4274
|
-
Ea as getAccountDeploymentPayload,
|
|
4275
|
-
ql as getAccountIdentifier,
|
|
4276
|
-
as as getAddressFromArgentName,
|
|
4277
|
-
Xs as getAddressFromStarkName,
|
|
4278
|
-
on as getArgentAccountClassHashes,
|
|
4279
|
-
ba as getArgentAccountClassHashesWithTxV3Support,
|
|
4280
|
-
ya as getArgentAccountWithMultiSignerClassHashes,
|
|
4281
|
-
zl as getBackendTimeNowSeconds,
|
|
4282
|
-
Ws as getBackendTimeSeconds,
|
|
4283
|
-
Zs as getCallFromStarkName,
|
|
4284
|
-
zs as getChainIdFromNetworkId,
|
|
4285
|
-
di as getColor,
|
|
4286
|
-
zu as getCurrencySymbol,
|
|
4287
|
-
Na as getDapplandLinkForDapp,
|
|
4288
|
-
ru as getDapplandUrlForDapp,
|
|
4289
|
-
Sd as getDisplayWarnAndReasonForTransactionReview,
|
|
4290
|
-
ue as getERC20Transactions,
|
|
4291
|
-
Cr as getERC721Transactions,
|
|
4292
|
-
al as getEstimatedFeeFromBulkSimulation,
|
|
4293
|
-
cl as getEstimatedFeeFromSimulationAndRespectWatermarkFee,
|
|
4294
|
-
ci as getInitials,
|
|
4295
|
-
Zl as getLastCairo0ArgentAccountClassHash,
|
|
4296
|
-
wa as getLatestArgentAccountClassHash,
|
|
4297
|
-
Yl as getLatestArgentMultisigClassHash,
|
|
4298
|
-
Jl as getLatestLedgerAccountClassHash,
|
|
4299
|
-
Xl as getLedgerAccountClassHashes,
|
|
4300
|
-
Qh as getMessageFromTrpcError,
|
|
4301
|
-
Ed as getNFTTransferActivity,
|
|
4302
|
-
au as getNetworkAccountImageUrl,
|
|
4303
|
-
xu as getNftPicture,
|
|
4304
|
-
il as getPayloadFromTransaction,
|
|
4305
|
-
tp as getPrettyRpcError,
|
|
4306
|
-
hl as getReviewForTransactions,
|
|
4307
|
-
Ye as getSignerForMultiSigner,
|
|
4308
|
-
id as getSimulationTxVersionFromFeeToken,
|
|
4309
|
-
Ys as getStarknetIdContractAddressFromNetworkId,
|
|
4310
|
-
Yc as getTokenBalance,
|
|
4311
|
-
Du as getTokens,
|
|
4312
|
-
Lu as getTokensBalances,
|
|
4313
|
-
Ad as getTransactionReviewActivityOfType,
|
|
4314
|
-
xd as getTransactionReviewHasSwap,
|
|
4315
|
-
fl as getTransactionReviewSwap,
|
|
4316
|
-
vd as getTransactionReviewWithType,
|
|
4317
|
-
Nn as getTxVersionFromFeeToken,
|
|
4318
|
-
cd as getTxVersionFromFeeTokenForDeclareContract,
|
|
4319
|
-
Kc as getUAParserResult,
|
|
4320
|
-
Ut as getUint256CalldataFromBN,
|
|
4321
|
-
ol as getWatermarkedMaxFeeTotal,
|
|
4322
|
-
hd as hasERC20Transactions,
|
|
4323
|
-
dl as hasERC721Transactions,
|
|
4324
|
-
pd as hasIncomingERC20Transactions,
|
|
4325
|
-
md as hasOutgoingERC20Transactions,
|
|
4326
|
-
kt as hexSchema,
|
|
4327
|
-
Hf as hexSchemaBase,
|
|
4328
|
-
ai as id,
|
|
4329
|
-
Ke as implementationSchema,
|
|
4330
|
-
Vf as includesAddress,
|
|
4331
|
-
ep as inputAmountSchema,
|
|
4332
|
-
$l as isAccountV4,
|
|
4333
|
-
Rl as isAccountV5,
|
|
4334
|
-
Pl as isAccountV6,
|
|
4335
|
-
rs as isAddress,
|
|
4336
|
-
hu as isAllowedAddressHexInputValue,
|
|
4337
|
-
pu as isAllowedNumericInputValue,
|
|
4338
|
-
jl as isArgentBackendNetworkId,
|
|
4339
|
-
os as isArgentName,
|
|
4340
|
-
Ul as isArgentNetworkId,
|
|
4341
|
-
Pu as isBraveBrowser,
|
|
4342
|
-
le as isBrowser,
|
|
4343
|
-
$u as isChromeBrowser,
|
|
4344
|
-
du as isContractDeployed,
|
|
4345
|
-
Uu as isEdgeBrowser,
|
|
4346
|
-
nt as isEqualAddress,
|
|
4347
|
-
Mf as isEqualArgentName,
|
|
4348
|
-
Sa as isEqualImplementation,
|
|
4349
|
-
Gf as isEqualStarknetDomainName,
|
|
4350
|
-
qf as isEqualStarknetId,
|
|
4351
|
-
sl as isFRI,
|
|
4352
|
-
uu as isFeatureEnabled,
|
|
4353
|
-
Ru as isFirefoxBrowser,
|
|
4354
|
-
Z as isNumeric,
|
|
4355
|
-
Fu as isSafariBrowser,
|
|
4356
|
-
Wf as isStarknetDomainName,
|
|
4357
|
-
ss as isStarknetId,
|
|
4358
|
-
Xc as isUnlimitedAmount,
|
|
4359
|
-
ns as isValidAddress,
|
|
4360
|
-
np as isValidInputAmount,
|
|
4361
|
-
_r as isWEI,
|
|
4362
|
-
es as isZeroAddress,
|
|
4363
|
-
Ba as knownDappSchema,
|
|
4364
|
-
_a as knownDappsSchema,
|
|
4365
|
-
zf as legacyContractClassSchema,
|
|
4366
|
-
Kf as legacyEventSchema,
|
|
4367
|
-
Yf as looseCalldataSchema,
|
|
4368
|
-
rp as modifySnjsFeeOverhead,
|
|
4369
|
-
Zf as multiTypeSchema,
|
|
4370
|
-
Ju as multiplyBigIntByFloat,
|
|
4371
|
-
Oa as nameProviderResolutionSchema,
|
|
4372
|
-
ka as nameResolutionAddressSchema,
|
|
4373
|
-
Ra as nameResolutionAddressesSchema,
|
|
4374
|
-
Yn as nameResolutionStarknetIdSchema,
|
|
4375
|
-
Ca as nameResolutionStarknetIdsSchema,
|
|
4376
|
-
fu as nonNullable,
|
|
4377
|
-
Rn as normalizeAddress,
|
|
4378
|
-
Xf as normalizeAddressOrDomain,
|
|
4379
|
-
Jf as normalizeArgentName,
|
|
4380
|
-
Qf as normalizeStarknetId,
|
|
4381
|
-
Wc as onchainRecoverySchema,
|
|
4382
|
-
sp as parseAmount,
|
|
4383
|
-
wi as parseAmountValue,
|
|
4384
|
-
mu as pluralise,
|
|
4385
|
-
Ml as postData,
|
|
4386
|
-
Fl as preferencesEndpointPayload,
|
|
4387
|
-
Ls as preferencesSchema,
|
|
4388
|
-
mi as prettifyCurrencyNumber,
|
|
4389
|
-
qu as prettifyCurrencyValue,
|
|
4390
|
-
rr as prettifyNumber,
|
|
4391
|
-
Re as prettifyNumberConfig,
|
|
4392
|
-
Wu as prettifyTokenAmount,
|
|
4393
|
-
gi as prettifyTokenNumber,
|
|
4394
|
-
op as productGroupsSchema,
|
|
4395
|
-
th as programSchema,
|
|
4396
|
-
Pa as providersNamesSchema,
|
|
4397
|
-
eh as pythonicHintsSchema,
|
|
4398
|
-
nh as rawArgsArraySchema,
|
|
4399
|
-
rh as rawArgsObjectSchema,
|
|
4400
|
-
sh as rawArgsSchema,
|
|
4401
|
-
gu as readFileAsString,
|
|
4402
|
-
Br as recoveryBaseSchema,
|
|
4403
|
-
Cu as recoveryBodySchema,
|
|
4404
|
-
Gc as recoveryStatusSchema,
|
|
4405
|
-
oh as removeOwnersCalldataSchema,
|
|
4406
|
-
ah as removePluginCalldataSchema,
|
|
4407
|
-
ih as replaceSignerCalldataSchema,
|
|
4408
|
-
ms as safeParseAndWarn,
|
|
4409
|
-
ju as seedphraseSchema,
|
|
4410
|
-
ch as sierraContractEntryPointFieldsSchema,
|
|
4411
|
-
lh as sierraEntryPointsByTypeSchema,
|
|
4412
|
-
uh as sierraProgramDebugInfoSchema,
|
|
4413
|
-
Ks as starkNameToCallDataDomain,
|
|
4414
|
-
dh as starknetDomainNameSchema,
|
|
4415
|
-
us as starknetIdSchema,
|
|
4416
|
-
Ou as startOnchainRecoveryErrorSchema,
|
|
4417
|
-
zc as startOnchainRecoveryErrorStatusSchema,
|
|
4418
|
-
Mc as startOnchainRecoverySchema,
|
|
4419
|
-
fh as stringToBooleanSchema,
|
|
4420
|
-
fi as stripAddressZeroPadding,
|
|
4421
|
-
hh as structAbiSchema,
|
|
4422
|
-
Wl as swrRefetchDisabledConfig,
|
|
4423
|
-
Pt as toMax,
|
|
4424
|
-
Qu as tokensRequireTxV3Support,
|
|
4425
|
-
ap as transactionReviewTransactionsSchema,
|
|
4426
|
-
ip as transactionReviewWarningSchema,
|
|
4427
|
-
ws as transferCalldataSchema,
|
|
4428
|
-
cp as trpcErrorSchema,
|
|
4429
|
-
lp as txVersionSchema,
|
|
4430
|
-
ph as uint256Schema,
|
|
4431
|
-
up as unclaimedRewardsSchema,
|
|
4432
|
-
Ee as unitToFeeTokenAddress,
|
|
4433
|
-
Qr as urlWithQuery,
|
|
4434
|
-
dd as useBalanceChange,
|
|
4435
|
-
Eu as useCollection,
|
|
4436
|
-
qs as useConditionallyEnabledSWR,
|
|
4437
|
-
tu as useDebounce,
|
|
4438
|
-
eu as useDebouncedValue,
|
|
4439
|
-
fd as useERC20Transactions,
|
|
4440
|
-
gd as useERC721Transactions,
|
|
4441
|
-
mh as useEmitEvent,
|
|
4442
|
-
gh as useEventEmitter,
|
|
4443
|
-
wh as useEventEmitterContext,
|
|
4444
|
-
yh as useEventListener,
|
|
4445
|
-
wd as useHasERC721Transaction,
|
|
4446
|
-
bh as useIsEventEmitterEnabled,
|
|
4447
|
-
yd as useMaxAmountTransaction,
|
|
4448
|
-
Au as useNft,
|
|
4449
|
-
Su as useNfts,
|
|
4450
|
-
Hu as useToken,
|
|
4451
|
-
bd as useTransactionReview,
|
|
4452
|
-
Td as useTransactionReviewV2webFetcher,
|
|
4453
|
-
Sh as validChecksumAddressSchema,
|
|
4454
|
-
Eh as validateAddressRangeSchema,
|
|
4455
|
-
yu as voidify,
|
|
4456
|
-
Ah as webBaseTokenSchema,
|
|
4457
|
-
xh as webBaseTokenWithBalanceSchema,
|
|
4458
|
-
vh as webTokenInfoDetailsSchema,
|
|
4459
|
-
Th as webTokenPriceDetailsSchema,
|
|
4460
|
-
Ih as webTokenSchema,
|
|
4461
|
-
Bh as webTokenWithBalanceAndPriceSchema,
|
|
4462
|
-
_h as webTokenWithBalanceSchema,
|
|
4463
|
-
Nh as webTokenWithPriceSchema,
|
|
4464
|
-
Ch as webTokensWithBalanceAndPriceSchema,
|
|
4465
|
-
Gl as withPolling
|
|
4466
|
-
};
|