@argent/x-shared 1.37.0 → 1.38.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.eslintrc.d.cts +45 -0
- package/dist/_virtual/_commonjsHelpers.cjs +1 -0
- package/dist/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/semver.cjs +1 -0
- package/dist/_virtual/semver.js +4 -0
- package/dist/commitlint.config.d.cts +2 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +2 -19
- package/dist/index.js +424 -4
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +14 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.js +88 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +203 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js +68 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js +166 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +581 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.js +48 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.js +4 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js +42 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js +47 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js +31 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js +61 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js +21 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js +114 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +107 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js +38 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_assert.js +32 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_u64.js +21 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +107 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js +44 -0
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -0
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +622 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js +20 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js +10 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +10 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js +16 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.js +33 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +15 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js +11 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js +12 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js +13 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js +8 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.js +9 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js +17 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js +6 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js +12 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +7 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js +5 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.cjs +1 -0
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js +7 -0
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -0
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +134 -0
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs +1 -0
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js +629 -0
- package/dist/simulation.cjs +1 -0
- package/dist/simulation.d.ts +1 -1
- package/dist/simulation.js +69 -1
- package/dist/src/account/account.model.cjs +1 -0
- package/dist/src/account/account.model.js +45 -0
- package/dist/src/account/accountv4.cjs +1 -0
- package/dist/src/account/accountv4.js +14 -0
- package/dist/src/account/preferences.model.cjs +1 -0
- package/dist/src/account/preferences.model.js +11 -0
- package/dist/src/assets/tokens.json.cjs +1 -0
- package/dist/src/assets/tokens.json.js +181 -0
- package/dist/src/backend/schema.cjs +1 -0
- package/dist/src/backend/schema.js +14 -0
- package/dist/src/bigdecimal/constants.cjs +1 -0
- package/dist/src/bigdecimal/constants.js +4 -0
- package/dist/src/bigdecimal/createUnitsSchema.cjs +1 -0
- package/dist/src/bigdecimal/createUnitsSchema.js +8 -0
- package/dist/src/bigdecimal/formatUnits.cjs +1 -0
- package/dist/src/bigdecimal/formatUnits.js +11 -0
- package/dist/src/bigdecimal/index.cjs +1 -0
- package/dist/src/bigdecimal/index.js +33 -0
- package/dist/src/bigdecimal/lib.cjs +1 -0
- package/dist/src/bigdecimal/lib.js +53 -0
- package/dist/src/bigdecimal/parseUnits.cjs +1 -0
- package/dist/src/bigdecimal/parseUnits.js +11 -0
- package/dist/src/bigdecimal/utils.cjs +1 -0
- package/dist/src/bigdecimal/utils.js +37 -0
- package/dist/src/cache/CacheService.cjs +1 -0
- package/dist/src/cache/CacheService.js +37 -0
- package/dist/src/chains/starknet/address.cjs +1 -0
- package/dist/src/chains/starknet/address.js +64 -0
- package/dist/src/chains/starknet/addressDomain.cjs +1 -0
- package/dist/src/chains/starknet/addressDomain.js +29 -0
- package/dist/src/chains/starknet/addressInput.cjs +1 -0
- package/dist/src/chains/starknet/addressInput.js +7 -0
- package/dist/src/chains/starknet/argentName.cjs +1 -0
- package/dist/src/chains/starknet/argentName.js +14 -0
- package/dist/src/chains/starknet/cairoVersionSchema.cjs +1 -0
- package/dist/src/chains/starknet/cairoVersionSchema.js +5 -0
- package/dist/src/chains/starknet/constants.cjs +1 -0
- package/dist/src/chains/starknet/constants.js +10 -0
- package/dist/src/chains/starknet/getAddressFromArgentName.cjs +1 -0
- package/dist/src/chains/starknet/getAddressFromArgentName.js +48 -0
- package/dist/src/chains/starknet/getAddressFromStarkName.cjs +1 -0
- package/dist/src/chains/starknet/getAddressFromStarkName.js +70 -0
- package/dist/src/chains/starknet/network.cjs +1 -0
- package/dist/src/chains/starknet/network.js +20 -0
- package/dist/src/chains/starknet/services/address/StarknetAddressService.cjs +1 -0
- package/dist/src/chains/starknet/services/address/StarknetAddressService.js +38 -0
- package/dist/src/chains/starknet/services/deploymentData/constants.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/constants.js +22 -0
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.js +19 -0
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +69 -0
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.cjs +1 -0
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +59 -0
- package/dist/src/chains/starknet/starknetId.cjs +1 -0
- package/dist/src/chains/starknet/starknetId.js +14 -0
- package/dist/src/errors/account.cjs +1 -0
- package/dist/src/errors/account.js +14 -0
- package/dist/src/errors/address.cjs +1 -0
- package/dist/src/errors/address.js +14 -0
- package/dist/src/errors/baseErrors.cjs +1 -0
- package/dist/src/errors/baseErrors.js +15 -0
- package/dist/src/errors/call.cjs +1 -0
- package/dist/src/errors/call.js +14 -0
- package/dist/src/errors/network.cjs +1 -0
- package/dist/src/errors/network.js +14 -0
- package/dist/src/errors/review.cjs +1 -0
- package/dist/src/errors/review.js +14 -0
- package/dist/src/errors/swap.cjs +1 -0
- package/dist/src/errors/swap.js +14 -0
- package/dist/src/features/simulation/activity/normalize.cjs +1 -0
- package/dist/src/features/simulation/activity/normalize.js +40 -0
- package/dist/src/features/simulation/activity/schema.cjs +1 -0
- package/dist/src/features/simulation/activity/schema.js +236 -0
- package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/createNativeActivity.js +31 -0
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +24 -0
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.js +6 -0
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +10 -0
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +11 -0
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +26 -0
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +22 -0
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.js +13 -0
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.cjs +1 -0
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.js +33 -0
- package/dist/src/features/simulation/fees/schema.cjs +1 -0
- package/dist/src/features/simulation/fees/schema.js +20 -0
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +18 -0
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.js +6 -0
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -0
- package/dist/src/features/simulation/transactionReview/schema.js +215 -0
- package/dist/src/features/simulation/warning/helper.cjs +1 -0
- package/dist/src/features/simulation/warning/helper.js +12 -0
- package/dist/src/features/simulation/warning/schema.cjs +1 -0
- package/dist/src/features/simulation/warning/schema.js +11 -0
- package/dist/src/features/swap/models/order.model.cjs +1 -0
- package/dist/src/features/swap/models/order.model.js +20 -0
- package/dist/src/features/swap/models/quote.model.cjs +1 -0
- package/dist/src/features/swap/models/quote.model.js +36 -0
- package/dist/src/features/swap/models/trade.model.cjs +1 -0
- package/dist/src/features/swap/models/trade.model.js +28 -0
- package/dist/src/features/swap/services/implementation.cjs +1 -0
- package/dist/src/features/swap/services/implementation.js +76 -0
- package/dist/src/features/swap/utils/slippage.cjs +1 -0
- package/dist/src/features/swap/utils/slippage.js +28 -0
- package/dist/src/features/swap/utils/totalFee.cjs +1 -0
- package/dist/src/features/swap/utils/totalFee.js +13 -0
- package/dist/src/http/DateService.cjs +1 -0
- package/dist/src/http/DateService.js +17 -0
- package/dist/src/http/HttpError.cjs +1 -0
- package/dist/src/http/HttpError.js +8 -0
- package/dist/src/http/HttpService.cjs +1 -0
- package/dist/src/http/HttpService.js +90 -0
- package/dist/src/http/IHttpService.cjs +1 -0
- package/dist/src/http/IHttpService.js +7 -0
- package/dist/src/http/SWRService.cjs +1 -0
- package/dist/src/http/SWRService.js +60 -0
- package/dist/src/http/fetcher.cjs +1 -0
- package/dist/src/http/fetcher.js +36 -0
- package/dist/{http → src/http}/index.d.ts +0 -1
- package/dist/src/http/time.cjs +1 -0
- package/dist/src/http/time.js +19 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/knownDapps/KnownDappsBackendService.cjs +1 -0
- package/dist/src/knownDapps/KnownDappsBackendService.js +16 -0
- package/dist/src/knownDapps/schema.cjs +1 -0
- package/dist/src/knownDapps/schema.js +44 -0
- package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -0
- package/dist/src/knownDapps/utils/getDapplandUrl.js +12 -0
- package/dist/src/nameResolution/ResolveNameService.cjs +1 -0
- package/dist/src/nameResolution/ResolveNameService.js +42 -0
- package/dist/src/nameResolution/schema.cjs +1 -0
- package/dist/src/nameResolution/schema.js +25 -0
- package/dist/src/nfts/BackendNftService.cjs +1 -0
- package/dist/src/nfts/BackendNftService.js +119 -0
- package/dist/src/nfts/BackendPaginationError.cjs +1 -0
- package/dist/src/nfts/BackendPaginationError.js +13 -0
- package/dist/{nfts → src/nfts}/index.d.ts +0 -1
- package/dist/src/nfts/utils.cjs +1 -0
- package/dist/src/nfts/utils.js +14 -0
- package/dist/src/onchainRecovery/OnchainRecoveryService.cjs +1 -0
- package/dist/src/onchainRecovery/OnchainRecoveryService.js +69 -0
- package/dist/src/onchainRecovery/schema.cjs +1 -0
- package/dist/src/onchainRecovery/schema.js +49 -0
- package/dist/src/platform/isBraveBrowser.cjs +1 -0
- package/dist/src/platform/isBraveBrowser.js +11 -0
- package/dist/src/platform/isBrowser.cjs +1 -0
- package/dist/src/platform/isBrowser.js +28 -0
- package/dist/src/signer/multisigner.cjs +1 -0
- package/dist/src/signer/multisigner.js +19 -0
- package/dist/src/signer/seedphrase.cjs +1 -0
- package/dist/src/signer/seedphrase.js +7 -0
- package/dist/src/tokens/balances.cjs +1 -0
- package/dist/src/tokens/balances.js +38 -0
- package/dist/src/tokens/constants.cjs +1 -0
- package/dist/src/tokens/constants.js +4 -0
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.cjs +1 -0
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.js +16 -0
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.cjs +1 -0
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.js +11 -0
- package/dist/src/tokens/ensureDecimals.cjs +1 -0
- package/dist/src/tokens/ensureDecimals.js +5 -0
- package/dist/src/tokens/getCurrencySymbol.cjs +1 -0
- package/dist/src/tokens/getCurrencySymbol.js +15 -0
- package/dist/src/tokens/isUnlimitedAmount.cjs +1 -0
- package/dist/src/tokens/isUnlimitedAmount.js +5 -0
- package/dist/src/tokens/prettifyCurrencyValue.cjs +1 -0
- package/dist/src/tokens/prettifyCurrencyValue.js +11 -0
- package/dist/src/tokens/prettifyTokenAmount.cjs +1 -0
- package/dist/src/tokens/prettifyTokenAmount.js +23 -0
- package/dist/src/tokens/service/implementation.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/implementation.d.ts +21 -2
- package/dist/src/tokens/service/implementation.js +64 -0
- package/dist/src/tokens/service/tokenError.cjs +1 -0
- package/dist/src/tokens/service/tokenError.js +14 -0
- package/dist/src/tokens/service/types/backend.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/backend.model.d.ts +818 -73
- package/dist/src/tokens/service/types/backend.model.js +134 -0
- package/dist/src/tokens/service/types/defiPosition.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/defiPosition.model.d.ts +1024 -64
- package/dist/src/tokens/service/types/defiPosition.model.js +75 -0
- package/dist/src/tokens/service/types/defiPositionType.model.cjs +1 -0
- package/dist/{tokens → src/tokens}/service/types/defiPositionType.model.d.ts +1 -1
- package/dist/src/tokens/service/types/defiPositionType.model.js +10 -0
- package/dist/src/tokens/service/types/unclaimedRewards.model.cjs +1 -0
- package/dist/src/tokens/service/types/unclaimedRewards.model.js +16 -0
- package/dist/src/tokens/service/types/webToken.model.cjs +1 -0
- package/dist/src/tokens/service/types/webToken.model.js +45 -0
- package/dist/src/transactions/amount.cjs +1 -0
- package/dist/src/transactions/amount.js +24 -0
- package/dist/src/transactions/buildTransactions.cjs +1 -0
- package/dist/src/transactions/buildTransactions.js +34 -0
- package/dist/src/transactions/errors.cjs +1 -0
- package/dist/src/transactions/errors.js +19 -0
- package/dist/src/transactions/estimate/argentMaxFee.cjs +1 -0
- package/dist/src/transactions/estimate/argentMaxFee.js +13 -0
- package/dist/src/transactions/estimate/error.cjs +1 -0
- package/dist/src/transactions/estimate/error.js +14 -0
- package/dist/src/transactions/estimate/model.cjs +1 -0
- package/dist/src/transactions/estimate/model.js +14 -0
- package/dist/src/transactions/estimate/utils.cjs +1 -0
- package/dist/src/transactions/estimate/utils.js +232 -0
- package/dist/src/transactions/findTransfersAndApprovals.cjs +1 -0
- package/dist/src/transactions/findTransfersAndApprovals.js +31 -0
- package/dist/src/transactions/getPrettyRcpError.cjs +1 -0
- package/dist/src/transactions/getPrettyRcpError.js +11 -0
- package/dist/src/transactions/getTransactionVersion.cjs +1 -0
- package/dist/src/transactions/getTransactionVersion.js +18 -0
- package/dist/{transactions → src/transactions}/index.d.ts +0 -6
- package/dist/src/transactions/service/implementation.cjs +1 -0
- package/dist/src/transactions/service/implementation.js +182 -0
- package/dist/src/transactions/service/types.cjs +1 -0
- package/dist/src/transactions/service/types.js +10 -0
- package/dist/src/transactions/transactionReviewTypes.cjs +1 -0
- package/dist/src/transactions/transactionReviewTypes.js +10 -0
- package/dist/src/transactions/transactionVersion.cjs +1 -0
- package/dist/src/transactions/transactionVersion.js +14 -0
- package/dist/src/transactions/txv3.cjs +1 -0
- package/dist/src/transactions/txv3.js +14 -0
- package/dist/src/utils/address.cjs +1 -0
- package/dist/src/utils/address.js +4 -0
- package/dist/src/utils/arrays.cjs +1 -0
- package/dist/src/utils/arrays.js +4 -0
- package/dist/src/utils/avatarImage.cjs +4 -0
- package/dist/src/utils/avatarImage.js +42 -0
- package/dist/src/utils/base58.cjs +1 -0
- package/dist/src/utils/base58.js +15 -0
- package/dist/src/utils/bigNumber.cjs +1 -0
- package/dist/src/utils/bigNumber.js +7 -0
- package/dist/src/utils/bips.cjs +1 -0
- package/dist/src/utils/bips.js +11 -0
- package/dist/src/utils/daysBetween.cjs +1 -0
- package/dist/src/utils/daysBetween.js +7 -0
- package/dist/src/utils/env.cjs +1 -0
- package/dist/src/utils/env.js +4 -0
- package/dist/src/utils/hex.cjs +1 -0
- package/dist/src/utils/hex.js +9 -0
- package/dist/src/utils/id.cjs +1 -0
- package/dist/src/utils/id.js +8 -0
- package/dist/{utils → src/utils}/index.d.ts +0 -1
- package/dist/src/utils/initials.cjs +1 -0
- package/dist/src/utils/initials.js +16 -0
- package/dist/src/utils/isContractDeployed.cjs +1 -0
- package/dist/src/utils/isContractDeployed.js +10 -0
- package/dist/src/utils/nonNullable.cjs +1 -0
- package/dist/src/utils/nonNullable.js +7 -0
- package/dist/src/utils/number/isAllowedAddressHexInputValue.cjs +1 -0
- package/dist/src/utils/number/isAllowedAddressHexInputValue.js +7 -0
- package/dist/src/utils/number/isAllowedNumericInputValue.cjs +1 -0
- package/dist/src/utils/number/isAllowedNumericInputValue.js +8 -0
- package/dist/src/utils/number/isNumeric.cjs +1 -0
- package/dist/src/utils/number/isNumeric.js +4 -0
- package/dist/src/utils/number/prettifyNumber.cjs +1 -0
- package/dist/src/utils/number/prettifyNumber.js +47 -0
- package/dist/src/utils/parseAmount.cjs +1 -0
- package/dist/src/utils/parseAmount.js +14 -0
- package/dist/src/utils/pluralise.cjs +1 -0
- package/dist/src/utils/pluralise.js +4 -0
- package/dist/src/utils/readFileAsString.cjs +1 -0
- package/dist/src/utils/readFileAsString.js +10 -0
- package/dist/src/utils/schemas.cjs +1 -0
- package/dist/src/utils/schemas.js +29 -0
- package/dist/src/utils/starknet/starknet.cjs +1 -0
- package/dist/src/utils/starknet/starknet.js +57 -0
- package/dist/src/utils/starknet/starknetLibTypes.cjs +1 -0
- package/dist/src/utils/starknet/starknetLibTypes.js +7 -0
- package/dist/src/utils/starknet/starknetSchemas.cjs +1 -0
- package/dist/src/utils/starknet/starknetSchemas.js +102 -0
- package/dist/src/utils/transactions.cjs +1 -0
- package/dist/src/utils/transactions.js +11 -0
- package/dist/src/utils/url/urlWithQuery.cjs +1 -0
- package/dist/src/utils/url/urlWithQuery.js +9 -0
- package/dist/src/utils/voidify.cjs +1 -0
- package/dist/src/utils/voidify.js +8 -0
- package/dist/swap.cjs +1 -0
- package/dist/swap.d.ts +1 -1
- package/dist/swap.js +20 -1
- package/package.json +14 -28
- package/dist/bips-DKbEGvGl.mjs +0 -114
- package/dist/bips-DxN0hSiY.js +0 -1
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/useDebounce.d.ts +0 -1
- package/dist/hooks/useDebouncedValue.d.ts +0 -1
- package/dist/http/swr.d.ts +0 -21
- package/dist/index.mjs +0 -4466
- package/dist/nfts/useNfts.d.ts +0 -23
- package/dist/providers/WebAmplitude/WebAmplitudeProvider.d.ts +0 -7
- package/dist/providers/WebAmplitude/index.d.ts +0 -2
- package/dist/providers/WebAmplitude/service.d.ts +0 -7
- package/dist/providers/WebAmplitude/types.d.ts +0 -6
- package/dist/providers/WebAmplitude/utils.d.ts +0 -2
- package/dist/providers/index.d.ts +0 -1
- package/dist/simulation.mjs +0 -255
- package/dist/swap.mjs +0 -183
- package/dist/transactionVersion-C7p_qk9x.js +0 -1
- package/dist/transactionVersion-Cjoucwcx.mjs +0 -793
- package/dist/transactions/useBalanceChange.d.ts +0 -5
- package/dist/transactions/useErc20Transactions.d.ts +0 -6
- package/dist/transactions/useErc721Transactions.d.ts +0 -5
- package/dist/transactions/useErc721Transfers.d.ts +0 -5
- package/dist/transactions/useMaxAmountTransaction.d.ts +0 -7
- package/dist/transactions/useTransactionReview.d.ts +0 -15
- package/dist/transactions/useTransactionReviewV2web.d.ts +0 -1004
- package/dist/utils/useEventEmitter.d.ts +0 -67
- package/dist/webToken.model-5HUiR8ER.js +0 -1
- package/dist/webToken.model-CpudLBp0.mjs +0 -1913
- package/dist/{account → src/account}/account.model.d.ts +0 -0
- package/dist/{account → src/account}/accountv4.d.ts +0 -0
- package/dist/{account → src/account}/index.d.ts +0 -0
- package/dist/{account → src/account}/preferences.model.d.ts +0 -0
- package/dist/{backend → src/backend}/index.d.ts +0 -0
- package/dist/{backend → src/backend}/schema.d.ts +0 -0
- package/dist/{backend → src/backend}/types.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/constants.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/createUnitsSchema.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/formatUnits.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/index.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/lib.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/parseUnits.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/type.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/types.d.ts +0 -0
- package/dist/{bigdecimal → src/bigdecimal}/utils.d.ts +0 -0
- package/dist/{cache → src/cache}/CacheService.d.ts +0 -0
- package/dist/{cache → src/cache}/ICacheService.d.ts +0 -0
- package/dist/{cache → src/cache}/index.d.ts +0 -0
- package/dist/{chains → src/chains}/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/address.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/addressDomain.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/addressInput.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/argentName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/cairoVersionSchema.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/constants.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/getAddressFromArgentName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/getAddressFromStarkName.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/network.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/IStarknetAddressService.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/StarknetAddressService.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/address/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/constants.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/deploymentData.schema.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/findImplementationForAccount.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/getAccountClassHash.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/deploymentData/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/services/index.d.ts +0 -0
- package/dist/{chains → src/chains}/starknet/starknetId.d.ts +0 -0
- package/dist/{errors → src/errors}/account.d.ts +0 -0
- package/dist/{errors → src/errors}/address.d.ts +0 -0
- package/dist/{errors → src/errors}/baseErrors.d.ts +0 -0
- package/dist/{errors → src/errors}/call.d.ts +0 -0
- package/dist/{errors → src/errors}/network.d.ts +0 -0
- package/dist/{errors → src/errors}/review.d.ts +0 -0
- package/dist/{errors → src/errors}/swap.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/normalize.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/schema.d.ts +200 -200
- package/dist/{features → src/features}/simulation/activity/utils/createNativeActivity.d.ts +6 -6
- package/dist/{features → src/features}/simulation/activity/utils/getAnyActivityTitle.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/getOverallLastModified.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/hasDelegationActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isMulticallWithDeploymentActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isRejectOnChainActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/isUpgradeActivity.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/parseAccountActivities.d.ts +0 -0
- package/dist/{features → src/features}/simulation/activity/utils/parseFinanceActivities.d.ts +0 -0
- package/dist/{features → src/features}/simulation/fees/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/fees/schema.d.ts +0 -0
- package/dist/{features → src/features}/simulation/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/getMessageFromSimulationError.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/transactionReview/schema.d.ts +1324 -1324
- package/dist/{features → src/features}/simulation/warning/helper.d.ts +0 -0
- package/dist/{features → src/features}/simulation/warning/index.d.ts +0 -0
- package/dist/{features → src/features}/simulation/warning/schema.d.ts +0 -0
- package/dist/{features → src/features}/swap/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/order.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/quote.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/models/trade.model.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/implementation.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/interface.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/order.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/services/quote.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/token.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/trade.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/tests/walletAccount.mock.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/index.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/slippage.d.ts +0 -0
- package/dist/{features → src/features}/swap/utils/totalFee.d.ts +0 -0
- package/dist/{http → src/http}/DateService.d.ts +0 -0
- package/dist/{http → src/http}/HttpError.d.ts +0 -0
- package/dist/{http → src/http}/HttpService.d.ts +0 -0
- package/dist/{http → src/http}/IDateService.d.ts +0 -0
- package/dist/{http → src/http}/IHttpService.d.ts +0 -0
- package/dist/{http → src/http}/SWRService.d.ts +0 -0
- package/dist/{http → src/http}/apiData.d.ts +0 -0
- package/dist/{http → src/http}/fetcher.d.ts +0 -0
- package/dist/{http → src/http}/time.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/IKnownDappsBackendService.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/KnownDappsBackendService.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/index.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/schema.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/utils/getDapplandUrl.d.ts +0 -0
- package/dist/{knownDapps → src/knownDapps}/utils/index.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/IResolveNameService.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/ResolveNameService.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/index.d.ts +0 -0
- package/dist/{nameResolution → src/nameResolution}/schema.d.ts +0 -0
- package/dist/{nfts → src/nfts}/BackendNftService.d.ts +0 -0
- package/dist/{nfts → src/nfts}/BackendPaginationError.d.ts +0 -0
- package/dist/{nfts → src/nfts}/INFTService.d.ts +0 -0
- package/dist/{nfts → src/nfts}/utils.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/IOnchainRecoveryService.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/OnchainRecoveryService.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/index.d.ts +0 -0
- package/dist/{onchainRecovery → src/onchainRecovery}/schema.d.ts +0 -0
- package/dist/{platform → src/platform}/index.d.ts +0 -0
- package/dist/{platform → src/platform}/isBraveBrowser.d.ts +0 -0
- package/dist/{platform → src/platform}/isBrowser.d.ts +0 -0
- package/dist/{signer → src/signer}/index.d.ts +0 -0
- package/dist/{signer → src/signer}/multisigner.d.ts +0 -0
- package/dist/{signer → src/signer}/seedphrase.d.ts +0 -0
- package/dist/{tokens → src/tokens}/balances.d.ts +0 -0
- package/dist/{tokens → src/tokens}/constants.d.ts +0 -0
- package/dist/{tokens → src/tokens}/convertTokenAmountToCurrencyValue.d.ts +0 -0
- package/dist/{tokens → src/tokens}/convertTokenUnitAmountWithDecimals.d.ts +0 -0
- package/dist/{tokens → src/tokens}/ensureDecimals.d.ts +0 -0
- package/dist/{tokens → src/tokens}/getCurrencySymbol.d.ts +0 -0
- package/dist/{tokens → src/tokens}/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/isUnlimitedAmount.d.ts +0 -0
- package/dist/{tokens → src/tokens}/prettifyCurrencyValue.d.ts +0 -0
- package/dist/{tokens → src/tokens}/prettifyTokenAmount.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/interface.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/tokenError.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/index.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/unclaimedRewards.model.d.ts +0 -0
- package/dist/{tokens → src/tokens}/service/types/webToken.model.d.ts +0 -0
- package/dist/{tokens → src/tokens}/token.d.ts +0 -0
- package/dist/{transactions → src/transactions}/aggregatedSimDataTypes.d.ts +0 -0
- package/dist/{transactions → src/transactions}/amount.d.ts +0 -0
- package/dist/{transactions → src/transactions}/buildTransactions.d.ts +0 -0
- package/dist/{transactions → src/transactions}/deployAccountTypes.d.ts +0 -0
- package/dist/{transactions → src/transactions}/errors.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/argentMaxFee.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/error.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/index.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/model.d.ts +0 -0
- package/dist/{transactions → src/transactions}/estimate/utils.d.ts +0 -0
- package/dist/{transactions → src/transactions}/findTransfersAndApprovals.d.ts +0 -0
- package/dist/{transactions → src/transactions}/getPrettyRcpError.d.ts +0 -0
- package/dist/{transactions → src/transactions}/getTransactionVersion.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/implementation.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/index.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/interface.d.ts +0 -0
- package/dist/{transactions → src/transactions}/service/types.d.ts +2 -2
- /package/dist/{transactions → src/transactions}/transactionAction.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionReviewTypes.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionSimulationTypes.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/transactionVersion.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/txv3.d.ts +0 -0
- /package/dist/{transactions → src/transactions}/types.d.ts +0 -0
- /package/dist/{utils → src/utils}/address.d.ts +0 -0
- /package/dist/{utils → src/utils}/arrays.d.ts +0 -0
- /package/dist/{utils → src/utils}/avatarImage.d.ts +0 -0
- /package/dist/{utils → src/utils}/base58.d.ts +0 -0
- /package/dist/{utils → src/utils}/bigNumber.d.ts +0 -0
- /package/dist/{utils → src/utils}/bips.d.ts +0 -0
- /package/dist/{utils → src/utils}/daysBetween.d.ts +0 -0
- /package/dist/{utils → src/utils}/env.d.ts +0 -0
- /package/dist/{utils → src/utils}/hex.d.ts +0 -0
- /package/dist/{utils → src/utils}/id.d.ts +0 -0
- /package/dist/{utils → src/utils}/initials.d.ts +0 -0
- /package/dist/{utils → src/utils}/isContractDeployed.d.ts +0 -0
- /package/dist/{utils → src/utils}/nonNullable.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isAllowedAddressHexInputValue.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isAllowedNumericInputValue.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/isNumeric.d.ts +0 -0
- /package/dist/{utils → src/utils}/number/prettifyNumber.d.ts +0 -0
- /package/dist/{utils → src/utils}/parseAmount.d.ts +0 -0
- /package/dist/{utils → src/utils}/pluralise.d.ts +0 -0
- /package/dist/{utils → src/utils}/readFileAsString.d.ts +0 -0
- /package/dist/{utils → src/utils}/schemas.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknet.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknetLibTypes.d.ts +0 -0
- /package/dist/{utils → src/utils}/starknet/starknetSchemas.d.ts +0 -0
- /package/dist/{utils → src/utils}/transactions.d.ts +0 -0
- /package/dist/{utils → src/utils}/url/index.d.ts +0 -0
- /package/dist/{utils → src/utils}/url/urlWithQuery.d.ts +0 -0
- /package/dist/{utils → src/utils}/voidify.d.ts +0 -0
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
import { mod as ut, hashToPrivateScalar as dt, invert as ht } from "./modular.js";
|
|
2
|
+
import * as mt from "./utils.js";
|
|
3
|
+
import { bytesToNumberBE as _, bitMask as yt, concatBytes as et, validateObject as lt, ensureBytes as Y, hexToBytes as at, numberToBytesBE as rt, createHmacDrbg as pt, bytesToHex as nt } from "./utils.js";
|
|
4
|
+
import { wNAF as wt, validateBasic as ft } from "./curve.js";
|
|
5
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
|
+
function Et(B) {
|
|
7
|
+
const n = ft(B);
|
|
8
|
+
lt(n, {
|
|
9
|
+
a: "field",
|
|
10
|
+
b: "field"
|
|
11
|
+
}, {
|
|
12
|
+
allowedPrivateKeyLengths: "array",
|
|
13
|
+
wrapPrivateKey: "boolean",
|
|
14
|
+
isTorsionFree: "function",
|
|
15
|
+
clearCofactor: "function",
|
|
16
|
+
allowInfinityPoint: "boolean",
|
|
17
|
+
fromBytes: "function",
|
|
18
|
+
toBytes: "function"
|
|
19
|
+
});
|
|
20
|
+
const { endo: t, Fp: v, a: A } = n;
|
|
21
|
+
if (t) {
|
|
22
|
+
if (!v.eql(A, v.ZERO))
|
|
23
|
+
throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");
|
|
24
|
+
if (typeof t != "object" || typeof t.beta != "bigint" || typeof t.splitScalar != "function")
|
|
25
|
+
throw new Error("Expected endomorphism with beta: bigint and splitScalar: function");
|
|
26
|
+
}
|
|
27
|
+
return Object.freeze({ ...n });
|
|
28
|
+
}
|
|
29
|
+
const { bytesToNumberBE: gt, hexToBytes: bt } = mt, k = {
|
|
30
|
+
// asn.1 DER encoding utils
|
|
31
|
+
Err: class extends Error {
|
|
32
|
+
constructor(n = "") {
|
|
33
|
+
super(n);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
_parseInt(B) {
|
|
37
|
+
const { Err: n } = k;
|
|
38
|
+
if (B.length < 2 || B[0] !== 2)
|
|
39
|
+
throw new n("Invalid signature integer tag");
|
|
40
|
+
const t = B[1], v = B.subarray(2, t + 2);
|
|
41
|
+
if (!t || v.length !== t)
|
|
42
|
+
throw new n("Invalid signature integer: wrong length");
|
|
43
|
+
if (v[0] & 128)
|
|
44
|
+
throw new n("Invalid signature integer: negative");
|
|
45
|
+
if (v[0] === 0 && !(v[1] & 128))
|
|
46
|
+
throw new n("Invalid signature integer: unnecessary leading zero");
|
|
47
|
+
return { d: gt(v), l: B.subarray(t + 2) };
|
|
48
|
+
},
|
|
49
|
+
toSig(B) {
|
|
50
|
+
const { Err: n } = k, t = typeof B == "string" ? bt(B) : B;
|
|
51
|
+
if (!(t instanceof Uint8Array))
|
|
52
|
+
throw new Error("ui8a expected");
|
|
53
|
+
let v = t.length;
|
|
54
|
+
if (v < 2 || t[0] != 48)
|
|
55
|
+
throw new n("Invalid signature tag");
|
|
56
|
+
if (t[1] !== v - 2)
|
|
57
|
+
throw new n("Invalid signature: incorrect length");
|
|
58
|
+
const { d: A, l: O } = k._parseInt(t.subarray(2)), { d: F, l: S } = k._parseInt(O);
|
|
59
|
+
if (S.length)
|
|
60
|
+
throw new n("Invalid signature: left bytes after parsing");
|
|
61
|
+
return { r: A, s: F };
|
|
62
|
+
},
|
|
63
|
+
hexFromSig(B) {
|
|
64
|
+
const n = (x) => Number.parseInt(x[0], 16) & 8 ? "00" + x : x, t = (x) => {
|
|
65
|
+
const U = x.toString(16);
|
|
66
|
+
return U.length & 1 ? `0${U}` : U;
|
|
67
|
+
}, v = n(t(B.s)), A = n(t(B.r)), O = v.length / 2, F = A.length / 2, S = t(O), P = t(F);
|
|
68
|
+
return `30${t(F + O + 4)}02${P}${A}02${S}${v}`;
|
|
69
|
+
}
|
|
70
|
+
}, L = BigInt(0), z = BigInt(1);
|
|
71
|
+
BigInt(2);
|
|
72
|
+
const ct = BigInt(3);
|
|
73
|
+
BigInt(4);
|
|
74
|
+
function Bt(B) {
|
|
75
|
+
const n = Et(B), { Fp: t } = n, v = n.toBytes || ((m, e, i) => {
|
|
76
|
+
const s = e.toAffine();
|
|
77
|
+
return et(Uint8Array.from([4]), t.toBytes(s.x), t.toBytes(s.y));
|
|
78
|
+
}), A = n.fromBytes || ((m) => {
|
|
79
|
+
const e = m.subarray(1), i = t.fromBytes(e.subarray(0, t.BYTES)), s = t.fromBytes(e.subarray(t.BYTES, 2 * t.BYTES));
|
|
80
|
+
return { x: i, y: s };
|
|
81
|
+
});
|
|
82
|
+
function O(m) {
|
|
83
|
+
const { a: e, b: i } = n, s = t.sqr(m), u = t.mul(s, m);
|
|
84
|
+
return t.add(t.add(u, t.mul(m, e)), i);
|
|
85
|
+
}
|
|
86
|
+
if (!t.eql(t.sqr(n.Gy), O(n.Gx)))
|
|
87
|
+
throw new Error("bad generator point: equation left != right");
|
|
88
|
+
function F(m) {
|
|
89
|
+
return typeof m == "bigint" && L < m && m < n.n;
|
|
90
|
+
}
|
|
91
|
+
function S(m) {
|
|
92
|
+
if (!F(m))
|
|
93
|
+
throw new Error("Expected valid bigint: 0 < bigint < curve.n");
|
|
94
|
+
}
|
|
95
|
+
function P(m) {
|
|
96
|
+
const { allowedPrivateKeyLengths: e, nByteLength: i, wrapPrivateKey: s, n: u } = n;
|
|
97
|
+
if (e && typeof m != "bigint") {
|
|
98
|
+
if (m instanceof Uint8Array && (m = nt(m)), typeof m != "string" || !e.includes(m.length))
|
|
99
|
+
throw new Error("Invalid key");
|
|
100
|
+
m = m.padStart(i * 2, "0");
|
|
101
|
+
}
|
|
102
|
+
let f;
|
|
103
|
+
try {
|
|
104
|
+
f = typeof m == "bigint" ? m : _(Y("private key", m, i));
|
|
105
|
+
} catch {
|
|
106
|
+
throw new Error(`private key must be ${i} bytes, hex or bigint, not ${typeof m}`);
|
|
107
|
+
}
|
|
108
|
+
return s && (f = ut(f, u)), S(f), f;
|
|
109
|
+
}
|
|
110
|
+
const x = /* @__PURE__ */ new Map();
|
|
111
|
+
function U(m) {
|
|
112
|
+
if (!(m instanceof y))
|
|
113
|
+
throw new Error("ProjectivePoint expected");
|
|
114
|
+
}
|
|
115
|
+
class y {
|
|
116
|
+
constructor(e, i, s) {
|
|
117
|
+
if (this.px = e, this.py = i, this.pz = s, e == null || !t.isValid(e))
|
|
118
|
+
throw new Error("x required");
|
|
119
|
+
if (i == null || !t.isValid(i))
|
|
120
|
+
throw new Error("y required");
|
|
121
|
+
if (s == null || !t.isValid(s))
|
|
122
|
+
throw new Error("z required");
|
|
123
|
+
}
|
|
124
|
+
// Does not validate if the point is on-curve.
|
|
125
|
+
// Use fromHex instead, or call assertValidity() later.
|
|
126
|
+
static fromAffine(e) {
|
|
127
|
+
const { x: i, y: s } = e || {};
|
|
128
|
+
if (!e || !t.isValid(i) || !t.isValid(s))
|
|
129
|
+
throw new Error("invalid affine point");
|
|
130
|
+
if (e instanceof y)
|
|
131
|
+
throw new Error("projective point not allowed");
|
|
132
|
+
const u = (f) => t.eql(f, t.ZERO);
|
|
133
|
+
return u(i) && u(s) ? y.ZERO : new y(i, s, t.ONE);
|
|
134
|
+
}
|
|
135
|
+
get x() {
|
|
136
|
+
return this.toAffine().x;
|
|
137
|
+
}
|
|
138
|
+
get y() {
|
|
139
|
+
return this.toAffine().y;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Takes a bunch of Projective Points but executes only one
|
|
143
|
+
* inversion on all of them. Inversion is very slow operation,
|
|
144
|
+
* so this improves performance massively.
|
|
145
|
+
* Optimization: converts a list of projective points to a list of identical points with Z=1.
|
|
146
|
+
*/
|
|
147
|
+
static normalizeZ(e) {
|
|
148
|
+
const i = t.invertBatch(e.map((s) => s.pz));
|
|
149
|
+
return e.map((s, u) => s.toAffine(i[u])).map(y.fromAffine);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Converts hash string or Uint8Array to Point.
|
|
153
|
+
* @param hex short/long ECDSA hex
|
|
154
|
+
*/
|
|
155
|
+
static fromHex(e) {
|
|
156
|
+
const i = y.fromAffine(A(Y("pointHex", e)));
|
|
157
|
+
return i.assertValidity(), i;
|
|
158
|
+
}
|
|
159
|
+
// Multiplies generator point by privateKey.
|
|
160
|
+
static fromPrivateKey(e) {
|
|
161
|
+
return y.BASE.multiply(P(e));
|
|
162
|
+
}
|
|
163
|
+
// "Private method", don't use it directly
|
|
164
|
+
_setWindowSize(e) {
|
|
165
|
+
this._WINDOW_SIZE = e, x.delete(this);
|
|
166
|
+
}
|
|
167
|
+
// A point on curve is valid if it conforms to equation.
|
|
168
|
+
assertValidity() {
|
|
169
|
+
if (this.is0()) {
|
|
170
|
+
if (n.allowInfinityPoint)
|
|
171
|
+
return;
|
|
172
|
+
throw new Error("bad point: ZERO");
|
|
173
|
+
}
|
|
174
|
+
const { x: e, y: i } = this.toAffine();
|
|
175
|
+
if (!t.isValid(e) || !t.isValid(i))
|
|
176
|
+
throw new Error("bad point: x or y not FE");
|
|
177
|
+
const s = t.sqr(i), u = O(e);
|
|
178
|
+
if (!t.eql(s, u))
|
|
179
|
+
throw new Error("bad point: equation left != right");
|
|
180
|
+
if (!this.isTorsionFree())
|
|
181
|
+
throw new Error("bad point: not in prime-order subgroup");
|
|
182
|
+
}
|
|
183
|
+
hasEvenY() {
|
|
184
|
+
const { y: e } = this.toAffine();
|
|
185
|
+
if (t.isOdd)
|
|
186
|
+
return !t.isOdd(e);
|
|
187
|
+
throw new Error("Field doesn't support isOdd");
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Compare one point to another.
|
|
191
|
+
*/
|
|
192
|
+
equals(e) {
|
|
193
|
+
U(e);
|
|
194
|
+
const { px: i, py: s, pz: u } = this, { px: f, py: E, pz: h } = e, a = t.eql(t.mul(i, h), t.mul(f, u)), c = t.eql(t.mul(s, h), t.mul(E, u));
|
|
195
|
+
return a && c;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Flips point to one corresponding to (x, -y) in Affine coordinates.
|
|
199
|
+
*/
|
|
200
|
+
negate() {
|
|
201
|
+
return new y(this.px, t.neg(this.py), this.pz);
|
|
202
|
+
}
|
|
203
|
+
// Renes-Costello-Batina exception-free doubling formula.
|
|
204
|
+
// There is 30% faster Jacobian formula, but it is not complete.
|
|
205
|
+
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
206
|
+
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
207
|
+
double() {
|
|
208
|
+
const { a: e, b: i } = n, s = t.mul(i, ct), { px: u, py: f, pz: E } = this;
|
|
209
|
+
let h = t.ZERO, a = t.ZERO, c = t.ZERO, d = t.mul(u, u), N = t.mul(f, f), b = t.mul(E, E), p = t.mul(u, f);
|
|
210
|
+
return p = t.add(p, p), c = t.mul(u, E), c = t.add(c, c), h = t.mul(e, c), a = t.mul(s, b), a = t.add(h, a), h = t.sub(N, a), a = t.add(N, a), a = t.mul(h, a), h = t.mul(p, h), c = t.mul(s, c), b = t.mul(e, b), p = t.sub(d, b), p = t.mul(e, p), p = t.add(p, c), c = t.add(d, d), d = t.add(c, d), d = t.add(d, b), d = t.mul(d, p), a = t.add(a, d), b = t.mul(f, E), b = t.add(b, b), d = t.mul(b, p), h = t.sub(h, d), c = t.mul(b, N), c = t.add(c, c), c = t.add(c, c), new y(h, a, c);
|
|
211
|
+
}
|
|
212
|
+
// Renes-Costello-Batina exception-free addition formula.
|
|
213
|
+
// There is 30% faster Jacobian formula, but it is not complete.
|
|
214
|
+
// https://eprint.iacr.org/2015/1060, algorithm 1
|
|
215
|
+
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
216
|
+
add(e) {
|
|
217
|
+
U(e);
|
|
218
|
+
const { px: i, py: s, pz: u } = this, { px: f, py: E, pz: h } = e;
|
|
219
|
+
let a = t.ZERO, c = t.ZERO, d = t.ZERO;
|
|
220
|
+
const N = n.a, b = t.mul(n.b, ct);
|
|
221
|
+
let p = t.mul(i, f), T = t.mul(s, E), Z = t.mul(u, h), H = t.add(i, s), r = t.add(f, E);
|
|
222
|
+
H = t.mul(H, r), r = t.add(p, T), H = t.sub(H, r), r = t.add(i, u);
|
|
223
|
+
let o = t.add(f, h);
|
|
224
|
+
return r = t.mul(r, o), o = t.add(p, Z), r = t.sub(r, o), o = t.add(s, u), a = t.add(E, h), o = t.mul(o, a), a = t.add(T, Z), o = t.sub(o, a), d = t.mul(N, r), a = t.mul(b, Z), d = t.add(a, d), a = t.sub(T, d), d = t.add(T, d), c = t.mul(a, d), T = t.add(p, p), T = t.add(T, p), Z = t.mul(N, Z), r = t.mul(b, r), T = t.add(T, Z), Z = t.sub(p, Z), Z = t.mul(N, Z), r = t.add(r, Z), p = t.mul(T, r), c = t.add(c, p), p = t.mul(o, r), a = t.mul(H, a), a = t.sub(a, p), p = t.mul(H, T), d = t.mul(o, d), d = t.add(d, p), new y(a, c, d);
|
|
225
|
+
}
|
|
226
|
+
subtract(e) {
|
|
227
|
+
return this.add(e.negate());
|
|
228
|
+
}
|
|
229
|
+
is0() {
|
|
230
|
+
return this.equals(y.ZERO);
|
|
231
|
+
}
|
|
232
|
+
wNAF(e) {
|
|
233
|
+
return C.wNAFCached(this, x, e, (i) => {
|
|
234
|
+
const s = t.invertBatch(i.map((u) => u.pz));
|
|
235
|
+
return i.map((u, f) => u.toAffine(s[f])).map(y.fromAffine);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
240
|
+
* It's faster, but should only be used when you don't care about
|
|
241
|
+
* an exposed private key e.g. sig verification, which works over *public* keys.
|
|
242
|
+
*/
|
|
243
|
+
multiplyUnsafe(e) {
|
|
244
|
+
const i = y.ZERO;
|
|
245
|
+
if (e === L)
|
|
246
|
+
return i;
|
|
247
|
+
if (S(e), e === z)
|
|
248
|
+
return this;
|
|
249
|
+
const { endo: s } = n;
|
|
250
|
+
if (!s)
|
|
251
|
+
return C.unsafeLadder(this, e);
|
|
252
|
+
let { k1neg: u, k1: f, k2neg: E, k2: h } = s.splitScalar(e), a = i, c = i, d = this;
|
|
253
|
+
for (; f > L || h > L; )
|
|
254
|
+
f & z && (a = a.add(d)), h & z && (c = c.add(d)), d = d.double(), f >>= z, h >>= z;
|
|
255
|
+
return u && (a = a.negate()), E && (c = c.negate()), c = new y(t.mul(c.px, s.beta), c.py, c.pz), a.add(c);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Constant time multiplication.
|
|
259
|
+
* Uses wNAF method. Windowed method may be 10% faster,
|
|
260
|
+
* but takes 2x longer to generate and consumes 2x memory.
|
|
261
|
+
* Uses precomputes when available.
|
|
262
|
+
* Uses endomorphism for Koblitz curves.
|
|
263
|
+
* @param scalar by which the point would be multiplied
|
|
264
|
+
* @returns New point
|
|
265
|
+
*/
|
|
266
|
+
multiply(e) {
|
|
267
|
+
S(e);
|
|
268
|
+
let i = e, s, u;
|
|
269
|
+
const { endo: f } = n;
|
|
270
|
+
if (f) {
|
|
271
|
+
const { k1neg: E, k1: h, k2neg: a, k2: c } = f.splitScalar(i);
|
|
272
|
+
let { p: d, f: N } = this.wNAF(h), { p: b, f: p } = this.wNAF(c);
|
|
273
|
+
d = C.constTimeNegate(E, d), b = C.constTimeNegate(a, b), b = new y(t.mul(b.px, f.beta), b.py, b.pz), s = d.add(b), u = N.add(p);
|
|
274
|
+
} else {
|
|
275
|
+
const { p: E, f: h } = this.wNAF(i);
|
|
276
|
+
s = E, u = h;
|
|
277
|
+
}
|
|
278
|
+
return y.normalizeZ([s, u])[0];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
|
|
282
|
+
* Not using Strauss-Shamir trick: precomputation tables are faster.
|
|
283
|
+
* The trick could be useful if both P and Q are not G (not in our case).
|
|
284
|
+
* @returns non-zero affine point
|
|
285
|
+
*/
|
|
286
|
+
multiplyAndAddUnsafe(e, i, s) {
|
|
287
|
+
const u = y.BASE, f = (h, a) => a === L || a === z || !h.equals(u) ? h.multiplyUnsafe(a) : h.multiply(a), E = f(this, i).add(f(e, s));
|
|
288
|
+
return E.is0() ? void 0 : E;
|
|
289
|
+
}
|
|
290
|
+
// Converts Projective point to affine (x, y) coordinates.
|
|
291
|
+
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
292
|
+
// (x, y, z) ∋ (x=x/z, y=y/z)
|
|
293
|
+
toAffine(e) {
|
|
294
|
+
const { px: i, py: s, pz: u } = this, f = this.is0();
|
|
295
|
+
e == null && (e = f ? t.ONE : t.inv(u));
|
|
296
|
+
const E = t.mul(i, e), h = t.mul(s, e), a = t.mul(u, e);
|
|
297
|
+
if (f)
|
|
298
|
+
return { x: t.ZERO, y: t.ZERO };
|
|
299
|
+
if (!t.eql(a, t.ONE))
|
|
300
|
+
throw new Error("invZ was invalid");
|
|
301
|
+
return { x: E, y: h };
|
|
302
|
+
}
|
|
303
|
+
isTorsionFree() {
|
|
304
|
+
const { h: e, isTorsionFree: i } = n;
|
|
305
|
+
if (e === z)
|
|
306
|
+
return !0;
|
|
307
|
+
if (i)
|
|
308
|
+
return i(y, this);
|
|
309
|
+
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
310
|
+
}
|
|
311
|
+
clearCofactor() {
|
|
312
|
+
const { h: e, clearCofactor: i } = n;
|
|
313
|
+
return e === z ? this : i ? i(y, this) : this.multiplyUnsafe(n.h);
|
|
314
|
+
}
|
|
315
|
+
toRawBytes(e = !0) {
|
|
316
|
+
return this.assertValidity(), v(y, this, e);
|
|
317
|
+
}
|
|
318
|
+
toHex(e = !0) {
|
|
319
|
+
return nt(this.toRawBytes(e));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
y.BASE = new y(n.Gx, n.Gy, t.ONE), y.ZERO = new y(t.ZERO, t.ONE, t.ZERO);
|
|
323
|
+
const W = n.nBitLength, C = wt(y, n.endo ? Math.ceil(W / 2) : W);
|
|
324
|
+
return {
|
|
325
|
+
CURVE: n,
|
|
326
|
+
ProjectivePoint: y,
|
|
327
|
+
normPrivateKeyToScalar: P,
|
|
328
|
+
weierstrassEquation: O,
|
|
329
|
+
isWithinCurveOrder: F
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
function vt(B) {
|
|
333
|
+
const n = ft(B);
|
|
334
|
+
return lt(n, {
|
|
335
|
+
hash: "hash",
|
|
336
|
+
hmac: "function",
|
|
337
|
+
randomBytes: "function"
|
|
338
|
+
}, {
|
|
339
|
+
bits2int: "function",
|
|
340
|
+
bits2int_modN: "function",
|
|
341
|
+
lowS: "boolean"
|
|
342
|
+
}), Object.freeze({ lowS: !0, ...n });
|
|
343
|
+
}
|
|
344
|
+
function Ot(B) {
|
|
345
|
+
const n = vt(B), { Fp: t, n: v } = n, A = t.BYTES + 1, O = 2 * t.BYTES + 1;
|
|
346
|
+
function F(r) {
|
|
347
|
+
return L < r && r < t.ORDER;
|
|
348
|
+
}
|
|
349
|
+
function S(r) {
|
|
350
|
+
return ut(r, v);
|
|
351
|
+
}
|
|
352
|
+
function P(r) {
|
|
353
|
+
return ht(r, v);
|
|
354
|
+
}
|
|
355
|
+
const { ProjectivePoint: x, normPrivateKeyToScalar: U, weierstrassEquation: y, isWithinCurveOrder: W } = Bt({
|
|
356
|
+
...n,
|
|
357
|
+
toBytes(r, o, l) {
|
|
358
|
+
const g = o.toAffine(), w = t.toBytes(g.x), R = et;
|
|
359
|
+
return l ? R(Uint8Array.from([o.hasEvenY() ? 2 : 3]), w) : R(Uint8Array.from([4]), w, t.toBytes(g.y));
|
|
360
|
+
},
|
|
361
|
+
fromBytes(r) {
|
|
362
|
+
const o = r.length, l = r[0], g = r.subarray(1);
|
|
363
|
+
if (o === A && (l === 2 || l === 3)) {
|
|
364
|
+
const w = _(g);
|
|
365
|
+
if (!F(w))
|
|
366
|
+
throw new Error("Point is not on curve");
|
|
367
|
+
const R = y(w);
|
|
368
|
+
let q = t.sqrt(R);
|
|
369
|
+
const I = (q & z) === z;
|
|
370
|
+
return (l & 1) === 1 !== I && (q = t.neg(q)), { x: w, y: q };
|
|
371
|
+
} else if (o === O && l === 4) {
|
|
372
|
+
const w = t.fromBytes(g.subarray(0, t.BYTES)), R = t.fromBytes(g.subarray(t.BYTES, 2 * t.BYTES));
|
|
373
|
+
return { x: w, y: R };
|
|
374
|
+
} else
|
|
375
|
+
throw new Error(`Point of length ${o} was invalid. Expected ${A} compressed bytes or ${O} uncompressed bytes`);
|
|
376
|
+
}
|
|
377
|
+
}), C = (r) => nt(rt(r, n.nByteLength));
|
|
378
|
+
function m(r) {
|
|
379
|
+
const o = v >> z;
|
|
380
|
+
return r > o;
|
|
381
|
+
}
|
|
382
|
+
function e(r) {
|
|
383
|
+
return m(r) ? S(-r) : r;
|
|
384
|
+
}
|
|
385
|
+
const i = (r, o, l) => _(r.slice(o, l));
|
|
386
|
+
class s {
|
|
387
|
+
constructor(o, l, g) {
|
|
388
|
+
this.r = o, this.s = l, this.recovery = g, this.assertValidity();
|
|
389
|
+
}
|
|
390
|
+
// pair (bytes of r, bytes of s)
|
|
391
|
+
static fromCompact(o) {
|
|
392
|
+
const l = n.nByteLength;
|
|
393
|
+
return o = Y("compactSignature", o, l * 2), new s(i(o, 0, l), i(o, l, 2 * l));
|
|
394
|
+
}
|
|
395
|
+
// DER encoded ECDSA signature
|
|
396
|
+
// https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script
|
|
397
|
+
static fromDER(o) {
|
|
398
|
+
const { r: l, s: g } = k.toSig(Y("DER", o));
|
|
399
|
+
return new s(l, g);
|
|
400
|
+
}
|
|
401
|
+
assertValidity() {
|
|
402
|
+
if (!W(this.r))
|
|
403
|
+
throw new Error("r must be 0 < r < CURVE.n");
|
|
404
|
+
if (!W(this.s))
|
|
405
|
+
throw new Error("s must be 0 < s < CURVE.n");
|
|
406
|
+
}
|
|
407
|
+
addRecoveryBit(o) {
|
|
408
|
+
return new s(this.r, this.s, o);
|
|
409
|
+
}
|
|
410
|
+
recoverPublicKey(o) {
|
|
411
|
+
const { r: l, s: g, recovery: w } = this, R = c(Y("msgHash", o));
|
|
412
|
+
if (w == null || ![0, 1, 2, 3].includes(w))
|
|
413
|
+
throw new Error("recovery id invalid");
|
|
414
|
+
const q = w === 2 || w === 3 ? l + n.n : l;
|
|
415
|
+
if (q >= t.ORDER)
|
|
416
|
+
throw new Error("recovery id 2 or 3 invalid");
|
|
417
|
+
const I = w & 1 ? "03" : "02", D = x.fromHex(I + C(q)), K = P(q), X = S(-R * K), J = S(g * K), $ = x.BASE.multiplyAndAddUnsafe(D, X, J);
|
|
418
|
+
if (!$)
|
|
419
|
+
throw new Error("point at infinify");
|
|
420
|
+
return $.assertValidity(), $;
|
|
421
|
+
}
|
|
422
|
+
// Signatures should be low-s, to prevent malleability.
|
|
423
|
+
hasHighS() {
|
|
424
|
+
return m(this.s);
|
|
425
|
+
}
|
|
426
|
+
normalizeS() {
|
|
427
|
+
return this.hasHighS() ? new s(this.r, S(-this.s), this.recovery) : this;
|
|
428
|
+
}
|
|
429
|
+
// DER-encoded
|
|
430
|
+
toDERRawBytes() {
|
|
431
|
+
return at(this.toDERHex());
|
|
432
|
+
}
|
|
433
|
+
toDERHex() {
|
|
434
|
+
return k.hexFromSig({ r: this.r, s: this.s });
|
|
435
|
+
}
|
|
436
|
+
// padded bytes of r, then padded bytes of s
|
|
437
|
+
toCompactRawBytes() {
|
|
438
|
+
return at(this.toCompactHex());
|
|
439
|
+
}
|
|
440
|
+
toCompactHex() {
|
|
441
|
+
return C(this.r) + C(this.s);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
const u = {
|
|
445
|
+
isValidPrivateKey(r) {
|
|
446
|
+
try {
|
|
447
|
+
return U(r), !0;
|
|
448
|
+
} catch {
|
|
449
|
+
return !1;
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
normPrivateKeyToScalar: U,
|
|
453
|
+
/**
|
|
454
|
+
* Produces cryptographically secure private key from random of size (nBitLength+64)
|
|
455
|
+
* as per FIPS 186 B.4.1 with modulo bias being neglible.
|
|
456
|
+
*/
|
|
457
|
+
randomPrivateKey: () => {
|
|
458
|
+
const r = n.randomBytes(t.BYTES + 8), o = dt(r, v);
|
|
459
|
+
return rt(o, n.nByteLength);
|
|
460
|
+
},
|
|
461
|
+
/**
|
|
462
|
+
* Creates precompute table for an arbitrary EC point. Makes point "cached".
|
|
463
|
+
* Allows to massively speed-up `point.multiply(scalar)`.
|
|
464
|
+
* @returns cached point
|
|
465
|
+
* @example
|
|
466
|
+
* const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey));
|
|
467
|
+
* fast.multiply(privKey); // much faster ECDH now
|
|
468
|
+
*/
|
|
469
|
+
precompute(r = 8, o = x.BASE) {
|
|
470
|
+
return o._setWindowSize(r), o.multiply(BigInt(3)), o;
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
function f(r, o = !0) {
|
|
474
|
+
return x.fromPrivateKey(r).toRawBytes(o);
|
|
475
|
+
}
|
|
476
|
+
function E(r) {
|
|
477
|
+
const o = r instanceof Uint8Array, l = typeof r == "string", g = (o || l) && r.length;
|
|
478
|
+
return o ? g === A || g === O : l ? g === 2 * A || g === 2 * O : r instanceof x;
|
|
479
|
+
}
|
|
480
|
+
function h(r, o, l = !0) {
|
|
481
|
+
if (E(r))
|
|
482
|
+
throw new Error("first arg must be private key");
|
|
483
|
+
if (!E(o))
|
|
484
|
+
throw new Error("second arg must be public key");
|
|
485
|
+
return x.fromHex(o).multiply(U(r)).toRawBytes(l);
|
|
486
|
+
}
|
|
487
|
+
const a = n.bits2int || function(r) {
|
|
488
|
+
const o = _(r), l = r.length * 8 - n.nBitLength;
|
|
489
|
+
return l > 0 ? o >> BigInt(l) : o;
|
|
490
|
+
}, c = n.bits2int_modN || function(r) {
|
|
491
|
+
return S(a(r));
|
|
492
|
+
}, d = yt(n.nBitLength);
|
|
493
|
+
function N(r) {
|
|
494
|
+
if (typeof r != "bigint")
|
|
495
|
+
throw new Error("bigint expected");
|
|
496
|
+
if (!(L <= r && r < d))
|
|
497
|
+
throw new Error(`bigint expected < 2^${n.nBitLength}`);
|
|
498
|
+
return rt(r, n.nByteLength);
|
|
499
|
+
}
|
|
500
|
+
function b(r, o, l = p) {
|
|
501
|
+
if (["recovered", "canonical"].some((j) => j in l))
|
|
502
|
+
throw new Error("sign() legacy options not supported");
|
|
503
|
+
const { hash: g, randomBytes: w } = n;
|
|
504
|
+
let { lowS: R, prehash: q, extraEntropy: I } = l;
|
|
505
|
+
R == null && (R = !0), r = Y("msgHash", r), q && (r = Y("prehashed msgHash", g(r)));
|
|
506
|
+
const D = c(r), K = U(o), X = [N(K), N(D)];
|
|
507
|
+
if (I != null) {
|
|
508
|
+
const j = I === !0 ? w(t.BYTES) : I;
|
|
509
|
+
X.push(Y("extraEntropy", j, t.BYTES));
|
|
510
|
+
}
|
|
511
|
+
const J = et(...X), $ = D;
|
|
512
|
+
function tt(j) {
|
|
513
|
+
const G = a(j);
|
|
514
|
+
if (!W(G))
|
|
515
|
+
return;
|
|
516
|
+
const ot = P(G), M = x.BASE.multiply(G).toAffine(), V = S(M.x);
|
|
517
|
+
if (V === L)
|
|
518
|
+
return;
|
|
519
|
+
const Q = S(ot * S($ + V * K));
|
|
520
|
+
if (Q === L)
|
|
521
|
+
return;
|
|
522
|
+
let st = (M.x === V ? 0 : 2) | Number(M.y & z), it = Q;
|
|
523
|
+
return R && m(Q) && (it = e(Q), st ^= 1), new s(V, it, st);
|
|
524
|
+
}
|
|
525
|
+
return { seed: J, k2sig: tt };
|
|
526
|
+
}
|
|
527
|
+
const p = { lowS: n.lowS, prehash: !1 }, T = { lowS: n.lowS, prehash: !1 };
|
|
528
|
+
function Z(r, o, l = p) {
|
|
529
|
+
const { seed: g, k2sig: w } = b(r, o, l);
|
|
530
|
+
return pt(n.hash.outputLen, n.nByteLength, n.hmac)(g, w);
|
|
531
|
+
}
|
|
532
|
+
x.BASE._setWindowSize(8);
|
|
533
|
+
function H(r, o, l, g = T) {
|
|
534
|
+
var M;
|
|
535
|
+
const w = r;
|
|
536
|
+
if (o = Y("msgHash", o), l = Y("publicKey", l), "strict" in g)
|
|
537
|
+
throw new Error("options.strict was renamed to lowS");
|
|
538
|
+
const { lowS: R, prehash: q } = g;
|
|
539
|
+
let I, D;
|
|
540
|
+
try {
|
|
541
|
+
if (typeof w == "string" || w instanceof Uint8Array)
|
|
542
|
+
try {
|
|
543
|
+
I = s.fromDER(w);
|
|
544
|
+
} catch (V) {
|
|
545
|
+
if (!(V instanceof k.Err))
|
|
546
|
+
throw V;
|
|
547
|
+
I = s.fromCompact(w);
|
|
548
|
+
}
|
|
549
|
+
else if (typeof w == "object" && typeof w.r == "bigint" && typeof w.s == "bigint") {
|
|
550
|
+
const { r: V, s: Q } = w;
|
|
551
|
+
I = new s(V, Q);
|
|
552
|
+
} else
|
|
553
|
+
throw new Error("PARSE");
|
|
554
|
+
D = x.fromHex(l);
|
|
555
|
+
} catch (V) {
|
|
556
|
+
if (V.message === "PARSE")
|
|
557
|
+
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
558
|
+
return !1;
|
|
559
|
+
}
|
|
560
|
+
if (R && I.hasHighS())
|
|
561
|
+
return !1;
|
|
562
|
+
q && (o = n.hash(o));
|
|
563
|
+
const { r: K, s: X } = I, J = c(o), $ = P(X), tt = S(J * $), j = S(K * $), G = (M = x.BASE.multiplyAndAddUnsafe(D, tt, j)) == null ? void 0 : M.toAffine();
|
|
564
|
+
return G ? S(G.x) === K : !1;
|
|
565
|
+
}
|
|
566
|
+
return {
|
|
567
|
+
CURVE: n,
|
|
568
|
+
getPublicKey: f,
|
|
569
|
+
getSharedSecret: h,
|
|
570
|
+
sign: Z,
|
|
571
|
+
verify: H,
|
|
572
|
+
ProjectivePoint: x,
|
|
573
|
+
Signature: s,
|
|
574
|
+
utils: u
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
export {
|
|
578
|
+
k as DER,
|
|
579
|
+
Ot as weierstrass,
|
|
580
|
+
Bt as weierstrassPoints
|
|
581
|
+
};
|
package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function o(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function i(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function r(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function u(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");o(e.outputLen),o(e.blockLen)}function s(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function f(e,t){r(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const a={number:o,bool:i,bytes:r,hash:u,exists:s,output:f};exports.bool=i;exports.bytes=r;exports.default=a;exports.exists=s;exports.hash=u;exports.number=o;exports.output=f;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
function r(e) {
|
|
2
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
3
|
+
throw new Error(`Wrong positive integer: ${e}`);
|
|
4
|
+
}
|
|
5
|
+
function i(e) {
|
|
6
|
+
if (typeof e != "boolean")
|
|
7
|
+
throw new Error(`Expected boolean, not ${e}`);
|
|
8
|
+
}
|
|
9
|
+
function n(e, ...t) {
|
|
10
|
+
if (!(e instanceof Uint8Array))
|
|
11
|
+
throw new TypeError("Expected Uint8Array");
|
|
12
|
+
if (t.length > 0 && !t.includes(e.length))
|
|
13
|
+
throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`);
|
|
14
|
+
}
|
|
15
|
+
function f(e) {
|
|
16
|
+
if (typeof e != "function" || typeof e.create != "function")
|
|
17
|
+
throw new Error("Hash should be wrapped by utils.wrapConstructor");
|
|
18
|
+
r(e.outputLen), r(e.blockLen);
|
|
19
|
+
}
|
|
20
|
+
function u(e, t = !0) {
|
|
21
|
+
if (e.destroyed)
|
|
22
|
+
throw new Error("Hash instance has been destroyed");
|
|
23
|
+
if (t && e.finished)
|
|
24
|
+
throw new Error("Hash#digest() has already been called");
|
|
25
|
+
}
|
|
26
|
+
function s(e, t) {
|
|
27
|
+
n(e);
|
|
28
|
+
const o = t.outputLen;
|
|
29
|
+
if (e.length < o)
|
|
30
|
+
throw new Error(`digestInto() expects output buffer of length at least ${o}`);
|
|
31
|
+
}
|
|
32
|
+
const a = {
|
|
33
|
+
number: r,
|
|
34
|
+
bool: i,
|
|
35
|
+
bytes: n,
|
|
36
|
+
hash: f,
|
|
37
|
+
exists: u,
|
|
38
|
+
output: s
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
i as bool,
|
|
42
|
+
n as bytes,
|
|
43
|
+
a as default,
|
|
44
|
+
u as exists,
|
|
45
|
+
f as hash,
|
|
46
|
+
r as number,
|
|
47
|
+
s as output
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;exports.crypto=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./_assert.cjs"),r=require("./utils.cjs");class d extends r.Hash{constructor(t,i){super(),this.finished=!1,this.destroyed=!1,o.default.hash(t);const h=r.toBytes(i);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new TypeError("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,e=new Uint8Array(a);e.set(h.length>a?t.create().update(h).digest():h);for(let s=0;s<e.length;s++)e[s]^=54;this.iHash.update(e),this.oHash=t.create();for(let s=0;s<e.length;s++)e[s]^=106;this.oHash.update(e),e.fill(0)}update(t){return o.default.exists(this),this.iHash.update(t),this}digestInto(t){o.default.exists(this),o.default.bytes(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:i,iHash:h,finished:a,destroyed:e,blockLen:s,outputLen:u}=this;return t=t,t.finished=a,t.destroyed=e,t.blockLen=s,t.outputLen=u,t.oHash=i._cloneInto(t.oHash),t.iHash=h._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const c=(n,t,i)=>new d(n,t).update(i).digest();c.create=(n,t)=>new d(n,t);exports.hmac=c;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import a from "./_assert.js";
|
|
2
|
+
import { Hash as c, toBytes as u } from "./utils.js";
|
|
3
|
+
class r extends c {
|
|
4
|
+
constructor(t, i) {
|
|
5
|
+
super(), this.finished = !1, this.destroyed = !1, a.hash(t);
|
|
6
|
+
const h = u(i);
|
|
7
|
+
if (this.iHash = t.create(), typeof this.iHash.update != "function")
|
|
8
|
+
throw new TypeError("Expected instance of class which extends utils.Hash");
|
|
9
|
+
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
10
|
+
const o = this.blockLen, e = new Uint8Array(o);
|
|
11
|
+
e.set(h.length > o ? t.create().update(h).digest() : h);
|
|
12
|
+
for (let s = 0; s < e.length; s++)
|
|
13
|
+
e[s] ^= 54;
|
|
14
|
+
this.iHash.update(e), this.oHash = t.create();
|
|
15
|
+
for (let s = 0; s < e.length; s++)
|
|
16
|
+
e[s] ^= 106;
|
|
17
|
+
this.oHash.update(e), e.fill(0);
|
|
18
|
+
}
|
|
19
|
+
update(t) {
|
|
20
|
+
return a.exists(this), this.iHash.update(t), this;
|
|
21
|
+
}
|
|
22
|
+
digestInto(t) {
|
|
23
|
+
a.exists(this), a.bytes(t, this.outputLen), this.finished = !0, this.iHash.digestInto(t), this.oHash.update(t), this.oHash.digestInto(t), this.destroy();
|
|
24
|
+
}
|
|
25
|
+
digest() {
|
|
26
|
+
const t = new Uint8Array(this.oHash.outputLen);
|
|
27
|
+
return this.digestInto(t), t;
|
|
28
|
+
}
|
|
29
|
+
_cloneInto(t) {
|
|
30
|
+
t || (t = Object.create(Object.getPrototypeOf(this), {}));
|
|
31
|
+
const { oHash: i, iHash: h, finished: o, destroyed: e, blockLen: s, outputLen: d } = this;
|
|
32
|
+
return t = t, t.finished = o, t.destroyed = e, t.blockLen = s, t.outputLen = d, t.oHash = i._cloneInto(t.oHash), t.iHash = h._cloneInto(t.iHash), t;
|
|
33
|
+
}
|
|
34
|
+
destroy() {
|
|
35
|
+
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const p = (n, t, i) => new r(n, t).update(i).digest();
|
|
39
|
+
p.create = (n, t) => new r(n, t);
|
|
40
|
+
export {
|
|
41
|
+
p as hmac
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./crypto.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const s=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!s)throw new Error("Non little-endian hardware is not supported");Array.from({length:256},(t,r)=>r.toString(16).padStart(2,"0"));function y(t){if(typeof t!="string")throw new TypeError(`utf8ToBytes expected string, got ${typeof t}`);return new TextEncoder().encode(t)}function f(t){if(typeof t=="string"&&(t=y(t)),!(t instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof t})`);return t}function u(...t){if(!t.every(e=>e instanceof Uint8Array))throw new Error("Uint8Array list expected");if(t.length===1)return t[0];const r=t.reduce((e,n)=>e+n.length,0),i=new Uint8Array(r);for(let e=0,n=0;e<t.length;e++){const c=t[e];i.set(c,n),n+=c.length}return i}class p{clone(){return this._cloneInto()}}function l(t=32){if(o.crypto&&typeof o.crypto.getRandomValues=="function")return o.crypto.getRandomValues(new Uint8Array(t));throw new Error("crypto.getRandomValues must be defined")}exports.Hash=p;exports.concatBytes=u;exports.isLE=s;exports.randomBytes=l;exports.toBytes=f;exports.utf8ToBytes=y;
|