@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/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.cjs"),t=require("../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.cjs");require("./abstract/weierstrass.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function o(e){return{hash:e,hmac:(r,...c)=>n.hmac(e,r,t.concatBytes(...c)),randomBytes:t.randomBytes}}exports.getHash=o;
|
package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { hmac as m } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js";
|
|
2
|
+
import { concatBytes as c, randomBytes as e } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js";
|
|
3
|
+
import "./abstract/weierstrass.js";
|
|
4
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5
|
+
function p(t) {
|
|
6
|
+
return {
|
|
7
|
+
hash: t,
|
|
8
|
+
hmac: (o, ...r) => m(t, o, c(...r)),
|
|
9
|
+
randomBytes: e
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
p as getHash
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./modular.cjs"),m=require("./utils.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const O=BigInt(0),u=BigInt(1);function A(o,p){const w=(t,e)=>{const n=e.negate();return t?n:e},g=t=>{const e=Math.ceil(p/t)+1,n=2**(t-1);return{windows:e,windowSize:n}};return{constTimeNegate:w,unsafeLadder(t,e){let n=o.ZERO,a=t;for(;e>O;)e&u&&(n=n.add(a)),a=a.double(),e>>=u;return n},precomputeWindow(t,e){const{windows:n,windowSize:a}=g(e),s=[];let i=t,d=i;for(let c=0;c<n;c++){d=i,s.push(d);for(let l=1;l<a;l++)d=d.add(i),s.push(d);i=d.double()}return s},wNAF(t,e,n){const{windows:a,windowSize:s}=g(t);let i=o.ZERO,d=o.BASE;const c=BigInt(2**t-1),l=2**t,B=BigInt(t);for(let f=0;f<a;f++){const h=f*s;let r=Number(n&c);n>>=B,r>s&&(r-=l,n+=u);const N=h,S=h+Math.abs(r)-1,F=f%2!==0,I=r<0;r===0?d=d.add(w(F,e[N])):i=i.add(w(I,e[S]))}return{p:i,f:d}},wNAFCached(t,e,n,a){const s=t._WINDOW_SIZE||1;let i=e.get(t);return i||(i=this.precomputeWindow(t,s),s!==1&&e.set(t,a(i))),this.wNAF(s,i,n)}}}function y(o){return b.validateField(o.Fp),m.validateObject(o,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...b.nLength(o.n,o.nBitLength),...o,p:o.Fp.ORDER})}exports.validateBasic=y;exports.wNAF=A;
|
package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { validateField as F, nLength as S } from "./modular.js";
|
|
2
|
+
import { validateObject as O } from "./utils.js";
|
|
3
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4
|
+
const A = BigInt(0), g = BigInt(1);
|
|
5
|
+
function z(i, u) {
|
|
6
|
+
const l = (t, n) => {
|
|
7
|
+
const e = n.negate();
|
|
8
|
+
return t ? e : n;
|
|
9
|
+
}, h = (t) => {
|
|
10
|
+
const n = Math.ceil(u / t) + 1, e = 2 ** (t - 1);
|
|
11
|
+
return { windows: n, windowSize: e };
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
constTimeNegate: l,
|
|
15
|
+
// non-const time multiplication ladder
|
|
16
|
+
unsafeLadder(t, n) {
|
|
17
|
+
let e = i.ZERO, f = t;
|
|
18
|
+
for (; n > A; )
|
|
19
|
+
n & g && (e = e.add(f)), f = f.double(), n >>= g;
|
|
20
|
+
return e;
|
|
21
|
+
},
|
|
22
|
+
/**
|
|
23
|
+
* Creates a wNAF precomputation window. Used for caching.
|
|
24
|
+
* Default window size is set by `utils.precompute()` and is equal to 8.
|
|
25
|
+
* Number of precomputed points depends on the curve size:
|
|
26
|
+
* 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
|
|
27
|
+
* - 𝑊 is the window size
|
|
28
|
+
* - 𝑛 is the bitlength of the curve order.
|
|
29
|
+
* For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
|
|
30
|
+
* @returns precomputed point tables flattened to a single array
|
|
31
|
+
*/
|
|
32
|
+
precomputeWindow(t, n) {
|
|
33
|
+
const { windows: e, windowSize: f } = h(n), s = [];
|
|
34
|
+
let o = t, d = o;
|
|
35
|
+
for (let w = 0; w < e; w++) {
|
|
36
|
+
d = o, s.push(d);
|
|
37
|
+
for (let a = 1; a < f; a++)
|
|
38
|
+
d = d.add(o), s.push(d);
|
|
39
|
+
o = d.double();
|
|
40
|
+
}
|
|
41
|
+
return s;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
|
|
45
|
+
* @param W window size
|
|
46
|
+
* @param precomputes precomputed tables
|
|
47
|
+
* @param n scalar (we don't check here, but should be less than curve order)
|
|
48
|
+
* @returns real and fake (for const-time) points
|
|
49
|
+
*/
|
|
50
|
+
wNAF(t, n, e) {
|
|
51
|
+
const { windows: f, windowSize: s } = h(t);
|
|
52
|
+
let o = i.ZERO, d = i.BASE;
|
|
53
|
+
const w = BigInt(2 ** t - 1), a = 2 ** t, b = BigInt(t);
|
|
54
|
+
for (let c = 0; c < f; c++) {
|
|
55
|
+
const p = c * s;
|
|
56
|
+
let r = Number(e & w);
|
|
57
|
+
e >>= b, r > s && (r -= a, e += g);
|
|
58
|
+
const B = p, m = p + Math.abs(r) - 1, I = c % 2 !== 0, N = r < 0;
|
|
59
|
+
r === 0 ? d = d.add(l(I, n[B])) : o = o.add(l(N, n[m]));
|
|
60
|
+
}
|
|
61
|
+
return { p: o, f: d };
|
|
62
|
+
},
|
|
63
|
+
wNAFCached(t, n, e, f) {
|
|
64
|
+
const s = t._WINDOW_SIZE || 1;
|
|
65
|
+
let o = n.get(t);
|
|
66
|
+
return o || (o = this.precomputeWindow(t, s), s !== 1 && n.set(t, f(o))), this.wNAF(s, o, e);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function R(i) {
|
|
71
|
+
return F(i.Fp), O(i, {
|
|
72
|
+
n: "bigint",
|
|
73
|
+
h: "bigint",
|
|
74
|
+
Gx: "field",
|
|
75
|
+
Gy: "field"
|
|
76
|
+
}, {
|
|
77
|
+
nBitLength: "isSafeInteger",
|
|
78
|
+
nByteLength: "isSafeInteger"
|
|
79
|
+
}), Object.freeze({
|
|
80
|
+
...S(i.n, i.nBitLength),
|
|
81
|
+
...i,
|
|
82
|
+
p: i.Fp.ORDER
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
R as validateBasic,
|
|
87
|
+
z as wNAF
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./utils.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const f=BigInt(0),u=BigInt(1),h=BigInt(2),M=BigInt(3),b=BigInt(4),y=BigInt(5),m=BigInt(8);BigInt(9);BigInt(16);function a(e,o){const n=e%o;return n>=f?n:o+n}function T(e,o,n){if(n<=f||o<f)throw new Error("Expected power/modulo > 0");if(n===u)return f;let r=u;for(;o>f;)o&u&&(r=r*e%n),e=e*e%n,o>>=u;return r}function N(e,o){if(e===f||o<=f)throw new Error(`invert: expected positive integers, got n=${e} mod=${o}`);let n=a(e,o),r=o,s=f,c=u;for(;n!==f;){const i=r/n,t=r%n,l=s-c*i;r=n,n=t,s=c,c=l}if(r!==u)throw new Error("invert: does not exist");return a(s,o)}function L(e){const o=(e-u)/h;let n,r,s;for(n=e-u,r=0;n%h===f;n/=h,r++);for(s=h;s<e&&T(s,o,e)!==e-u;s++);if(r===1){const d=(e+u)/b;return function(t,l){const w=t.pow(l,d);if(!t.eql(t.sqr(w),l))throw new Error("Cannot find square root");return w}}const c=(n+u)/h;return function(i,t){if(i.pow(t,o)===i.neg(i.ONE))throw new Error("Cannot find square root");let l=r,w=i.pow(i.mul(i.ONE,s),n),v=i.pow(t,c),q=i.pow(t,n);for(;!i.eql(q,i.ONE);){if(i.eql(q,i.ZERO))return i.ZERO;let B=1;for(let E=i.sqr(q);B<l&&!i.eql(E,i.ONE);B++)E=i.sqr(E);const I=i.pow(w,u<<BigInt(l-B-1));w=i.sqr(I),v=i.mul(v,I),q=i.mul(q,w),l=B}return v}}function x(e){if(e%b===M){const o=(e+u)/b;return function(r,s){const c=r.pow(s,o);if(!r.eql(r.sqr(c),s))throw new Error("Cannot find square root");return c}}if(e%m===y){const o=(e-y)/m;return function(r,s){const c=r.mul(s,h),d=r.pow(c,o),i=r.mul(s,d),t=r.mul(r.mul(i,h),d),l=r.mul(i,r.sub(t,r.ONE));if(!r.eql(r.sqr(l),s))throw new Error("Cannot find square root");return l}}return L(e)}const C=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function j(e){const o={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=C.reduce((r,s)=>(r[s]="function",r),o);return g.validateObject(e,n)}function _(e,o,n){if(n<f)throw new Error("Expected power > 0");if(n===f)return e.ONE;if(n===u)return o;let r=e.ONE,s=o;for(;n>f;)n&u&&(r=e.mul(r,s)),s=e.sqr(s),n>>=u;return r}function $(e,o){const n=new Array(o.length),r=o.reduce((c,d,i)=>e.is0(d)?c:(n[i]=c,e.mul(c,d)),e.ONE),s=e.inv(r);return o.reduceRight((c,d,i)=>e.is0(d)?c:(n[i]=e.mul(c,n[i]),e.mul(c,d)),s),n}function S(e,o){const n=o!==void 0?o:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function k(e,o,n=!1,r={}){if(e<=f)throw new Error(`Expected Fp ORDER > 0, got ${e}`);const{nBitLength:s,nByteLength:c}=S(e,o);if(c>2048)throw new Error("Field lengths over 2048 bytes are not supported");const d=x(e),i=Object.freeze({ORDER:e,BITS:s,BYTES:c,MASK:g.bitMask(s),ZERO:f,ONE:u,create:t=>a(t,e),isValid:t=>{if(typeof t!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof t}`);return f<=t&&t<e},is0:t=>t===f,isOdd:t=>(t&u)===u,neg:t=>a(-t,e),eql:(t,l)=>t===l,sqr:t=>a(t*t,e),add:(t,l)=>a(t+l,e),sub:(t,l)=>a(t-l,e),mul:(t,l)=>a(t*l,e),pow:(t,l)=>_(i,t,l),div:(t,l)=>a(t*N(l,e),e),sqrN:t=>t*t,addN:(t,l)=>t+l,subN:(t,l)=>t-l,mulN:(t,l)=>t*l,inv:t=>N(t,e),sqrt:r.sqrt||(t=>d(i,t)),invertBatch:t=>$(i,t),cmov:(t,l,w)=>w?l:t,toBytes:t=>n?g.numberToBytesLE(t,c):g.numberToBytesBE(t,c),fromBytes:t=>{if(t.length!==c)throw new Error(`Fp.fromBytes: expected ${c}, got ${t.length}`);return n?g.bytesToNumberLE(t):g.bytesToNumberBE(t)}});return Object.freeze(i)}function O(e,o,n=!1){e=g.ensureBytes("privateHash",e);const r=e.length,s=S(o).nByteLength+8;if(s<24||r<s||r>1024)throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);const c=n?g.bytesToNumberLE(e):g.bytesToNumberBE(e);return a(c,o-u)+u}exports.Field=k;exports.FpInvertBatch=$;exports.FpPow=_;exports.FpSqrt=x;exports.hashToPrivateScalar=O;exports.invert=N;exports.mod=a;exports.nLength=S;exports.pow=T;exports.tonelliShanks=L;exports.validateField=j;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { bitMask as L, numberToBytesLE as T, numberToBytesBE as _, bytesToNumberLE as y, bytesToNumberBE as m, validateObject as $, ensureBytes as C } from "./utils.js";
|
|
2
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
+
const f = BigInt(0), u = BigInt(1), w = BigInt(2), M = BigInt(3), E = BigInt(4), b = BigInt(5), I = BigInt(8);
|
|
4
|
+
BigInt(9);
|
|
5
|
+
BigInt(16);
|
|
6
|
+
function g(e, o) {
|
|
7
|
+
const n = e % o;
|
|
8
|
+
return n >= f ? n : o + n;
|
|
9
|
+
}
|
|
10
|
+
function Z(e, o, n) {
|
|
11
|
+
if (n <= f || o < f)
|
|
12
|
+
throw new Error("Expected power/modulo > 0");
|
|
13
|
+
if (n === u)
|
|
14
|
+
return f;
|
|
15
|
+
let r = u;
|
|
16
|
+
for (; o > f; )
|
|
17
|
+
o & u && (r = r * e % n), e = e * e % n, o >>= u;
|
|
18
|
+
return r;
|
|
19
|
+
}
|
|
20
|
+
function S(e, o) {
|
|
21
|
+
if (e === f || o <= f)
|
|
22
|
+
throw new Error(`invert: expected positive integers, got n=${e} mod=${o}`);
|
|
23
|
+
let n = g(e, o), r = o, s = f, c = u;
|
|
24
|
+
for (; n !== f; ) {
|
|
25
|
+
const i = r / n, t = r % n, l = s - c * i;
|
|
26
|
+
r = n, n = t, s = c, c = l;
|
|
27
|
+
}
|
|
28
|
+
if (r !== u)
|
|
29
|
+
throw new Error("invert: does not exist");
|
|
30
|
+
return g(s, o);
|
|
31
|
+
}
|
|
32
|
+
function j(e) {
|
|
33
|
+
const o = (e - u) / w;
|
|
34
|
+
let n, r, s;
|
|
35
|
+
for (n = e - u, r = 0; n % w === f; n /= w, r++)
|
|
36
|
+
;
|
|
37
|
+
for (s = w; s < e && Z(s, o, e) !== e - u; s++)
|
|
38
|
+
;
|
|
39
|
+
if (r === 1) {
|
|
40
|
+
const d = (e + u) / E;
|
|
41
|
+
return function(t, l) {
|
|
42
|
+
const a = t.pow(l, d);
|
|
43
|
+
if (!t.eql(t.sqr(a), l))
|
|
44
|
+
throw new Error("Cannot find square root");
|
|
45
|
+
return a;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const c = (n + u) / w;
|
|
49
|
+
return function(i, t) {
|
|
50
|
+
if (i.pow(t, o) === i.neg(i.ONE))
|
|
51
|
+
throw new Error("Cannot find square root");
|
|
52
|
+
let l = r, a = i.pow(i.mul(i.ONE, s), n), B = i.pow(t, c), h = i.pow(t, n);
|
|
53
|
+
for (; !i.eql(h, i.ONE); ) {
|
|
54
|
+
if (i.eql(h, i.ZERO))
|
|
55
|
+
return i.ZERO;
|
|
56
|
+
let q = 1;
|
|
57
|
+
for (let v = i.sqr(h); q < l && !i.eql(v, i.ONE); q++)
|
|
58
|
+
v = i.sqr(v);
|
|
59
|
+
const N = i.pow(a, u << BigInt(l - q - 1));
|
|
60
|
+
a = i.sqr(N), B = i.mul(B, N), h = i.mul(h, a), l = q;
|
|
61
|
+
}
|
|
62
|
+
return B;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function k(e) {
|
|
66
|
+
if (e % E === M) {
|
|
67
|
+
const o = (e + u) / E;
|
|
68
|
+
return function(r, s) {
|
|
69
|
+
const c = r.pow(s, o);
|
|
70
|
+
if (!r.eql(r.sqr(c), s))
|
|
71
|
+
throw new Error("Cannot find square root");
|
|
72
|
+
return c;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (e % I === b) {
|
|
76
|
+
const o = (e - b) / I;
|
|
77
|
+
return function(r, s) {
|
|
78
|
+
const c = r.mul(s, w), d = r.pow(c, o), i = r.mul(s, d), t = r.mul(r.mul(i, w), d), l = r.mul(i, r.sub(t, r.ONE));
|
|
79
|
+
if (!r.eql(r.sqr(l), s))
|
|
80
|
+
throw new Error("Cannot find square root");
|
|
81
|
+
return l;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
return j(e);
|
|
85
|
+
}
|
|
86
|
+
const A = [
|
|
87
|
+
"create",
|
|
88
|
+
"isValid",
|
|
89
|
+
"is0",
|
|
90
|
+
"neg",
|
|
91
|
+
"inv",
|
|
92
|
+
"sqrt",
|
|
93
|
+
"sqr",
|
|
94
|
+
"eql",
|
|
95
|
+
"add",
|
|
96
|
+
"sub",
|
|
97
|
+
"mul",
|
|
98
|
+
"pow",
|
|
99
|
+
"div",
|
|
100
|
+
"addN",
|
|
101
|
+
"subN",
|
|
102
|
+
"mulN",
|
|
103
|
+
"sqrN"
|
|
104
|
+
];
|
|
105
|
+
function Q(e) {
|
|
106
|
+
const o = {
|
|
107
|
+
ORDER: "bigint",
|
|
108
|
+
MASK: "bigint",
|
|
109
|
+
BYTES: "isSafeInteger",
|
|
110
|
+
BITS: "isSafeInteger"
|
|
111
|
+
}, n = A.reduce((r, s) => (r[s] = "function", r), o);
|
|
112
|
+
return $(e, n);
|
|
113
|
+
}
|
|
114
|
+
function O(e, o, n) {
|
|
115
|
+
if (n < f)
|
|
116
|
+
throw new Error("Expected power > 0");
|
|
117
|
+
if (n === f)
|
|
118
|
+
return e.ONE;
|
|
119
|
+
if (n === u)
|
|
120
|
+
return o;
|
|
121
|
+
let r = e.ONE, s = o;
|
|
122
|
+
for (; n > f; )
|
|
123
|
+
n & u && (r = e.mul(r, s)), s = e.sqr(s), n >>= u;
|
|
124
|
+
return r;
|
|
125
|
+
}
|
|
126
|
+
function z(e, o) {
|
|
127
|
+
const n = new Array(o.length), r = o.reduce((c, d, i) => e.is0(d) ? c : (n[i] = c, e.mul(c, d)), e.ONE), s = e.inv(r);
|
|
128
|
+
return o.reduceRight((c, d, i) => e.is0(d) ? c : (n[i] = e.mul(c, n[i]), e.mul(c, d)), s), n;
|
|
129
|
+
}
|
|
130
|
+
function x(e, o) {
|
|
131
|
+
const n = o !== void 0 ? o : e.toString(2).length, r = Math.ceil(n / 8);
|
|
132
|
+
return { nBitLength: n, nByteLength: r };
|
|
133
|
+
}
|
|
134
|
+
function V(e, o, n = !1, r = {}) {
|
|
135
|
+
if (e <= f)
|
|
136
|
+
throw new Error(`Expected Fp ORDER > 0, got ${e}`);
|
|
137
|
+
const { nBitLength: s, nByteLength: c } = x(e, o);
|
|
138
|
+
if (c > 2048)
|
|
139
|
+
throw new Error("Field lengths over 2048 bytes are not supported");
|
|
140
|
+
const d = k(e), i = Object.freeze({
|
|
141
|
+
ORDER: e,
|
|
142
|
+
BITS: s,
|
|
143
|
+
BYTES: c,
|
|
144
|
+
MASK: L(s),
|
|
145
|
+
ZERO: f,
|
|
146
|
+
ONE: u,
|
|
147
|
+
create: (t) => g(t, e),
|
|
148
|
+
isValid: (t) => {
|
|
149
|
+
if (typeof t != "bigint")
|
|
150
|
+
throw new Error(`Invalid field element: expected bigint, got ${typeof t}`);
|
|
151
|
+
return f <= t && t < e;
|
|
152
|
+
},
|
|
153
|
+
is0: (t) => t === f,
|
|
154
|
+
isOdd: (t) => (t & u) === u,
|
|
155
|
+
neg: (t) => g(-t, e),
|
|
156
|
+
eql: (t, l) => t === l,
|
|
157
|
+
sqr: (t) => g(t * t, e),
|
|
158
|
+
add: (t, l) => g(t + l, e),
|
|
159
|
+
sub: (t, l) => g(t - l, e),
|
|
160
|
+
mul: (t, l) => g(t * l, e),
|
|
161
|
+
pow: (t, l) => O(i, t, l),
|
|
162
|
+
div: (t, l) => g(t * S(l, e), e),
|
|
163
|
+
// Same as above, but doesn't normalize
|
|
164
|
+
sqrN: (t) => t * t,
|
|
165
|
+
addN: (t, l) => t + l,
|
|
166
|
+
subN: (t, l) => t - l,
|
|
167
|
+
mulN: (t, l) => t * l,
|
|
168
|
+
inv: (t) => S(t, e),
|
|
169
|
+
sqrt: r.sqrt || ((t) => d(i, t)),
|
|
170
|
+
invertBatch: (t) => z(i, t),
|
|
171
|
+
// TODO: do we really need constant cmov?
|
|
172
|
+
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
173
|
+
cmov: (t, l, a) => a ? l : t,
|
|
174
|
+
toBytes: (t) => n ? T(t, c) : _(t, c),
|
|
175
|
+
fromBytes: (t) => {
|
|
176
|
+
if (t.length !== c)
|
|
177
|
+
throw new Error(`Fp.fromBytes: expected ${c}, got ${t.length}`);
|
|
178
|
+
return n ? y(t) : m(t);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return Object.freeze(i);
|
|
182
|
+
}
|
|
183
|
+
function Y(e, o, n = !1) {
|
|
184
|
+
e = C("privateHash", e);
|
|
185
|
+
const r = e.length, s = x(o).nByteLength + 8;
|
|
186
|
+
if (s < 24 || r < s || r > 1024)
|
|
187
|
+
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
188
|
+
const c = n ? y(e) : m(e);
|
|
189
|
+
return g(c, o - u) + u;
|
|
190
|
+
}
|
|
191
|
+
export {
|
|
192
|
+
V as Field,
|
|
193
|
+
z as FpInvertBatch,
|
|
194
|
+
O as FpPow,
|
|
195
|
+
k as FpSqrt,
|
|
196
|
+
Y as hashToPrivateScalar,
|
|
197
|
+
S as invert,
|
|
198
|
+
g as mod,
|
|
199
|
+
x as nLength,
|
|
200
|
+
Z as pow,
|
|
201
|
+
j as tonelliShanks,
|
|
202
|
+
Q as validateField
|
|
203
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./modular.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function c(r){const{Fp:e}=r;h.validateField(e);for(const n of["t","roundsFull","roundsPartial"])if(typeof r[n]!="number"||!Number.isSafeInteger(r[n]))throw new Error(`Poseidon: invalid param ${n}=${r[n]} (${typeof r[n]})`);if(r.reversePartialPowIdx!==void 0&&typeof r.reversePartialPowIdx!="boolean")throw new Error(`Poseidon: invalid param reversePartialPowIdx=${r.reversePartialPowIdx}`);let t=r.sboxPower;if(t===void 0&&(t=5),typeof t!="number"||!Number.isSafeInteger(t))throw new Error(`Poseidon wrong sboxPower=${t}`);const f=BigInt(t);let u=n=>h.FpPow(e,n,f);if(t===3?u=n=>e.mul(e.sqrN(n),n):t===5&&(u=n=>e.mul(e.sqrN(e.sqrN(n)),n)),r.roundsFull%2!==0)throw new Error(`Poseidon roundsFull is not even: ${r.roundsFull}`);const w=r.roundsFull+r.roundsPartial;if(!Array.isArray(r.roundConstants)||r.roundConstants.length!==w)throw new Error("Poseidon: wrong round constants");const l=r.roundConstants.map(n=>{if(!Array.isArray(n)||n.length!==r.t)throw new Error(`Poseidon wrong round constants: ${n}`);return n.map(d=>{if(typeof d!="bigint"||!e.isValid(d))throw new Error(`Poseidon wrong round constant=${d}`);return e.create(d)})});if(!Array.isArray(r.mds)||r.mds.length!==r.t)throw new Error("Poseidon: wrong MDS matrix");const P=r.mds.map(n=>{if(!Array.isArray(n)||n.length!==r.t)throw new Error(`Poseidon MDS matrix row: ${n}`);return n.map(d=>{if(typeof d!="bigint")throw new Error(`Poseidon MDS matrix value=${d}`);return e.create(d)})});return Object.freeze({...r,rounds:w,sboxFn:u,roundConstants:l,mds:P})}function b(r){const{t:e,Fp:t,rounds:f,sboxFn:u,reversePartialPowIdx:w}=c(r),l=Math.floor(r.roundsFull/2),P=w?e-1:0,n=(a,i,s)=>(a=a.map((o,m)=>t.add(o,r.roundConstants[s][m])),i?a=a.map(o=>u(o)):a[P]=u(a[P]),a=r.mds.map(o=>o.reduce((m,g,y)=>t.add(m,t.mulN(g,a[y])),t.ZERO)),a),d=function(i){if(!Array.isArray(i)||i.length!==e)throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);i=i.map(o=>{if(typeof o!="bigint")throw new Error(`Poseidon: wrong value=${o} (${typeof o})`);return t.create(o)});let s=0;for(let o=0;o<l;o++)i=n(i,!0,s++);for(let o=0;o<r.roundsPartial;o++)i=n(i,!1,s++);for(let o=0;o<l;o++)i=n(i,!0,s++);if(s!==f)throw new Error(`Poseidon: wrong number of rounds: last round=${s}, total=${f}`);return i};return d.roundConstants=r.roundConstants,d}exports.poseidon=b;exports.validateOpts=c;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { validateField as c, FpPow as y } from "./modular.js";
|
|
2
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
+
function b(r) {
|
|
4
|
+
const { Fp: e } = r;
|
|
5
|
+
c(e);
|
|
6
|
+
for (const n of ["t", "roundsFull", "roundsPartial"])
|
|
7
|
+
if (typeof r[n] != "number" || !Number.isSafeInteger(r[n]))
|
|
8
|
+
throw new Error(`Poseidon: invalid param ${n}=${r[n]} (${typeof r[n]})`);
|
|
9
|
+
if (r.reversePartialPowIdx !== void 0 && typeof r.reversePartialPowIdx != "boolean")
|
|
10
|
+
throw new Error(`Poseidon: invalid param reversePartialPowIdx=${r.reversePartialPowIdx}`);
|
|
11
|
+
let t = r.sboxPower;
|
|
12
|
+
if (t === void 0 && (t = 5), typeof t != "number" || !Number.isSafeInteger(t))
|
|
13
|
+
throw new Error(`Poseidon wrong sboxPower=${t}`);
|
|
14
|
+
const u = BigInt(t);
|
|
15
|
+
let f = (n) => y(e, n, u);
|
|
16
|
+
if (t === 3 ? f = (n) => e.mul(e.sqrN(n), n) : t === 5 && (f = (n) => e.mul(e.sqrN(e.sqrN(n)), n)), r.roundsFull % 2 !== 0)
|
|
17
|
+
throw new Error(`Poseidon roundsFull is not even: ${r.roundsFull}`);
|
|
18
|
+
const w = r.roundsFull + r.roundsPartial;
|
|
19
|
+
if (!Array.isArray(r.roundConstants) || r.roundConstants.length !== w)
|
|
20
|
+
throw new Error("Poseidon: wrong round constants");
|
|
21
|
+
const l = r.roundConstants.map((n) => {
|
|
22
|
+
if (!Array.isArray(n) || n.length !== r.t)
|
|
23
|
+
throw new Error(`Poseidon wrong round constants: ${n}`);
|
|
24
|
+
return n.map((d) => {
|
|
25
|
+
if (typeof d != "bigint" || !e.isValid(d))
|
|
26
|
+
throw new Error(`Poseidon wrong round constant=${d}`);
|
|
27
|
+
return e.create(d);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
if (!Array.isArray(r.mds) || r.mds.length !== r.t)
|
|
31
|
+
throw new Error("Poseidon: wrong MDS matrix");
|
|
32
|
+
const P = r.mds.map((n) => {
|
|
33
|
+
if (!Array.isArray(n) || n.length !== r.t)
|
|
34
|
+
throw new Error(`Poseidon MDS matrix row: ${n}`);
|
|
35
|
+
return n.map((d) => {
|
|
36
|
+
if (typeof d != "bigint")
|
|
37
|
+
throw new Error(`Poseidon MDS matrix value=${d}`);
|
|
38
|
+
return e.create(d);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
return Object.freeze({ ...r, rounds: w, sboxFn: f, roundConstants: l, mds: P });
|
|
42
|
+
}
|
|
43
|
+
function $(r) {
|
|
44
|
+
const { t: e, Fp: t, rounds: u, sboxFn: f, reversePartialPowIdx: w } = b(r), l = Math.floor(r.roundsFull / 2), P = w ? e - 1 : 0, n = (a, i, s) => (a = a.map((o, m) => t.add(o, r.roundConstants[s][m])), i ? a = a.map((o) => f(o)) : a[P] = f(a[P]), a = r.mds.map((o) => o.reduce((m, h, g) => t.add(m, t.mulN(h, a[g])), t.ZERO)), a), d = function(i) {
|
|
45
|
+
if (!Array.isArray(i) || i.length !== e)
|
|
46
|
+
throw new Error(`Poseidon: wrong values (expected array of bigints with length ${e})`);
|
|
47
|
+
i = i.map((o) => {
|
|
48
|
+
if (typeof o != "bigint")
|
|
49
|
+
throw new Error(`Poseidon: wrong value=${o} (${typeof o})`);
|
|
50
|
+
return t.create(o);
|
|
51
|
+
});
|
|
52
|
+
let s = 0;
|
|
53
|
+
for (let o = 0; o < l; o++)
|
|
54
|
+
i = n(i, !0, s++);
|
|
55
|
+
for (let o = 0; o < r.roundsPartial; o++)
|
|
56
|
+
i = n(i, !1, s++);
|
|
57
|
+
for (let o = 0; o < l; o++)
|
|
58
|
+
i = n(i, !0, s++);
|
|
59
|
+
if (s !== u)
|
|
60
|
+
throw new Error(`Poseidon: wrong number of rounds: last round=${s}, total=${u}`);
|
|
61
|
+
return i;
|
|
62
|
+
};
|
|
63
|
+
return d.roundConstants = r.roundConstants, d;
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
$ as poseidon,
|
|
67
|
+
b as validateOpts
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const p=BigInt(0),y=BigInt(1),v=BigInt(2),g=t=>t instanceof Uint8Array,U=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function w(t){if(!g(t))throw new Error("Uint8Array expected");let e="";for(let r=0;r<t.length;r++)e+=U[t[r]];return e}function B(t){const e=t.toString(16);return e.length&1?`0${e}`:e}function h(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return BigInt(t===""?"0":`0x${t}`)}function b(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(t.length%2)throw new Error("hex string is invalid: unpadded "+t.length);const e=new Uint8Array(t.length/2);for(let r=0;r<e.length;r++){const n=r*2,o=t.slice(n,n+2),i=Number.parseInt(o,16);if(Number.isNaN(i)||i<0)throw new Error("invalid byte sequence");e[r]=i}return e}function $(t){return h(w(t))}function A(t){if(!g(t))throw new Error("Uint8Array expected");return h(w(Uint8Array.from(t).reverse()))}const E=(t,e)=>b(t.toString(16).padStart(e*2,"0")),I=(t,e)=>E(t,e).reverse(),N=t=>b(B(t));function S(t,e,r){let n;if(typeof e=="string")try{n=b(e)}catch(i){throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`)}else if(g(e))n=Uint8Array.from(e);else throw new Error(`${t} must be hex string or Uint8Array`);const o=n.length;if(typeof r=="number"&&o!==r)throw new Error(`${t} expected ${r} bytes, got ${o}`);return n}function T(...t){const e=new Uint8Array(t.reduce((n,o)=>n+o.length,0));let r=0;return t.forEach(n=>{if(!g(n))throw new Error("Uint8Array expected");e.set(n,r),r+=n.length}),e}function H(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function k(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new TextEncoder().encode(t)}function O(t){let e;for(e=0;t>p;t>>=y,e+=1);return e}const j=(t,e)=>t>>BigInt(e)&y,V=(t,e,r)=>t|(r?y:p)<<BigInt(e),F=t=>(v<<BigInt(t-1))-y,d=t=>new Uint8Array(t),m=t=>Uint8Array.from(t);function M(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=d(t),o=d(t),i=0;const c=()=>{n.fill(1),o.fill(0),i=0},u=(...s)=>r(o,n,...s),f=(s=d())=>{o=u(m([0]),s),n=u(),s.length!==0&&(o=u(m([1]),s),n=u())},x=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let s=0;const a=[];for(;s<e;){n=u();const l=n.slice();a.push(l),s+=n.length}return T(...a)};return(s,a)=>{c(),f(s);let l;for(;!(l=a(x()));)f();return c(),l}}const _={bigint:t=>typeof t=="bigint",function:t=>typeof t=="function",boolean:t=>typeof t=="boolean",string:t=>typeof t=="string",isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>typeof t=="function"&&Number.isSafeInteger(t.outputLen)};function q(t,e,r={}){const n=(o,i,c)=>{const u=_[i];if(typeof u!="function")throw new Error(`Invalid validator "${i}", expected function`);const f=t[o];if(!(c&&f===void 0)&&!u(f,t))throw new Error(`Invalid param ${String(o)}=${f} (${typeof f}), expected ${i}`)};for(const[o,i]of Object.entries(e))n(o,i,!1);for(const[o,i]of Object.entries(r))n(o,i,!0);return t}exports.bitGet=j;exports.bitLen=O;exports.bitMask=F;exports.bitSet=V;exports.bytesToHex=w;exports.bytesToNumberBE=$;exports.bytesToNumberLE=A;exports.concatBytes=T;exports.createHmacDrbg=M;exports.ensureBytes=S;exports.equalBytes=H;exports.hexToBytes=b;exports.hexToNumber=h;exports.numberToBytesBE=E;exports.numberToBytesLE=I;exports.numberToHexUnpadded=B;exports.numberToVarBytesBE=N;exports.utf8ToBytes=k;exports.validateObject=q;
|
package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2
|
+
const h = BigInt(0), g = BigInt(1), B = BigInt(2), y = (t) => t instanceof Uint8Array, $ = Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
3
|
+
function b(t) {
|
|
4
|
+
if (!y(t))
|
|
5
|
+
throw new Error("Uint8Array expected");
|
|
6
|
+
let e = "";
|
|
7
|
+
for (let r = 0; r < t.length; r++)
|
|
8
|
+
e += $[t[r]];
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
function A(t) {
|
|
12
|
+
const e = t.toString(16);
|
|
13
|
+
return e.length & 1 ? `0${e}` : e;
|
|
14
|
+
}
|
|
15
|
+
function m(t) {
|
|
16
|
+
if (typeof t != "string")
|
|
17
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
18
|
+
return BigInt(t === "" ? "0" : `0x${t}`);
|
|
19
|
+
}
|
|
20
|
+
function d(t) {
|
|
21
|
+
if (typeof t != "string")
|
|
22
|
+
throw new Error("hex string expected, got " + typeof t);
|
|
23
|
+
if (t.length % 2)
|
|
24
|
+
throw new Error("hex string is invalid: unpadded " + t.length);
|
|
25
|
+
const e = new Uint8Array(t.length / 2);
|
|
26
|
+
for (let r = 0; r < e.length; r++) {
|
|
27
|
+
const n = r * 2, o = t.slice(n, n + 2), i = Number.parseInt(o, 16);
|
|
28
|
+
if (Number.isNaN(i) || i < 0)
|
|
29
|
+
throw new Error("invalid byte sequence");
|
|
30
|
+
e[r] = i;
|
|
31
|
+
}
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
function T(t) {
|
|
35
|
+
return m(b(t));
|
|
36
|
+
}
|
|
37
|
+
function N(t) {
|
|
38
|
+
if (!y(t))
|
|
39
|
+
throw new Error("Uint8Array expected");
|
|
40
|
+
return m(b(Uint8Array.from(t).reverse()));
|
|
41
|
+
}
|
|
42
|
+
const U = (t, e) => d(t.toString(16).padStart(e * 2, "0")), S = (t, e) => U(t, e).reverse(), k = (t) => d(A(t));
|
|
43
|
+
function F(t, e, r) {
|
|
44
|
+
let n;
|
|
45
|
+
if (typeof e == "string")
|
|
46
|
+
try {
|
|
47
|
+
n = d(e);
|
|
48
|
+
} catch (i) {
|
|
49
|
+
throw new Error(`${t} must be valid hex string, got "${e}". Cause: ${i}`);
|
|
50
|
+
}
|
|
51
|
+
else if (y(e))
|
|
52
|
+
n = Uint8Array.from(e);
|
|
53
|
+
else
|
|
54
|
+
throw new Error(`${t} must be hex string or Uint8Array`);
|
|
55
|
+
const o = n.length;
|
|
56
|
+
if (typeof r == "number" && o !== r)
|
|
57
|
+
throw new Error(`${t} expected ${r} bytes, got ${o}`);
|
|
58
|
+
return n;
|
|
59
|
+
}
|
|
60
|
+
function v(...t) {
|
|
61
|
+
const e = new Uint8Array(t.reduce((n, o) => n + o.length, 0));
|
|
62
|
+
let r = 0;
|
|
63
|
+
return t.forEach((n) => {
|
|
64
|
+
if (!y(n))
|
|
65
|
+
throw new Error("Uint8Array expected");
|
|
66
|
+
e.set(n, r), r += n.length;
|
|
67
|
+
}), e;
|
|
68
|
+
}
|
|
69
|
+
function H(t, e) {
|
|
70
|
+
if (t.length !== e.length)
|
|
71
|
+
return !1;
|
|
72
|
+
for (let r = 0; r < t.length; r++)
|
|
73
|
+
if (t[r] !== e[r])
|
|
74
|
+
return !1;
|
|
75
|
+
return !0;
|
|
76
|
+
}
|
|
77
|
+
function O(t) {
|
|
78
|
+
if (typeof t != "string")
|
|
79
|
+
throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
|
|
80
|
+
return new TextEncoder().encode(t);
|
|
81
|
+
}
|
|
82
|
+
function V(t) {
|
|
83
|
+
let e;
|
|
84
|
+
for (e = 0; t > h; t >>= g, e += 1)
|
|
85
|
+
;
|
|
86
|
+
return e;
|
|
87
|
+
}
|
|
88
|
+
const _ = (t, e) => t >> BigInt(e) & g, j = (t, e, r) => t | (r ? g : h) << BigInt(e), q = (t) => (B << BigInt(t - 1)) - g, w = (t) => new Uint8Array(t), p = (t) => Uint8Array.from(t);
|
|
89
|
+
function C(t, e, r) {
|
|
90
|
+
if (typeof t != "number" || t < 2)
|
|
91
|
+
throw new Error("hashLen must be a number");
|
|
92
|
+
if (typeof e != "number" || e < 2)
|
|
93
|
+
throw new Error("qByteLen must be a number");
|
|
94
|
+
if (typeof r != "function")
|
|
95
|
+
throw new Error("hmacFn must be a function");
|
|
96
|
+
let n = w(t), o = w(t), i = 0;
|
|
97
|
+
const c = () => {
|
|
98
|
+
n.fill(1), o.fill(0), i = 0;
|
|
99
|
+
}, s = (...f) => r(o, n, ...f), u = (f = w()) => {
|
|
100
|
+
o = s(p([0]), f), n = s(), f.length !== 0 && (o = s(p([1]), f), n = s());
|
|
101
|
+
}, E = () => {
|
|
102
|
+
if (i++ >= 1e3)
|
|
103
|
+
throw new Error("drbg: tried 1000 values");
|
|
104
|
+
let f = 0;
|
|
105
|
+
const a = [];
|
|
106
|
+
for (; f < e; ) {
|
|
107
|
+
n = s();
|
|
108
|
+
const l = n.slice();
|
|
109
|
+
a.push(l), f += n.length;
|
|
110
|
+
}
|
|
111
|
+
return v(...a);
|
|
112
|
+
};
|
|
113
|
+
return (f, a) => {
|
|
114
|
+
c(), u(f);
|
|
115
|
+
let l;
|
|
116
|
+
for (; !(l = a(E())); )
|
|
117
|
+
u();
|
|
118
|
+
return c(), l;
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const x = {
|
|
122
|
+
bigint: (t) => typeof t == "bigint",
|
|
123
|
+
function: (t) => typeof t == "function",
|
|
124
|
+
boolean: (t) => typeof t == "boolean",
|
|
125
|
+
string: (t) => typeof t == "string",
|
|
126
|
+
isSafeInteger: (t) => Number.isSafeInteger(t),
|
|
127
|
+
array: (t) => Array.isArray(t),
|
|
128
|
+
field: (t, e) => e.Fp.isValid(t),
|
|
129
|
+
hash: (t) => typeof t == "function" && Number.isSafeInteger(t.outputLen)
|
|
130
|
+
};
|
|
131
|
+
function D(t, e, r = {}) {
|
|
132
|
+
const n = (o, i, c) => {
|
|
133
|
+
const s = x[i];
|
|
134
|
+
if (typeof s != "function")
|
|
135
|
+
throw new Error(`Invalid validator "${i}", expected function`);
|
|
136
|
+
const u = t[o];
|
|
137
|
+
if (!(c && u === void 0) && !s(u, t))
|
|
138
|
+
throw new Error(`Invalid param ${String(o)}=${u} (${typeof u}), expected ${i}`);
|
|
139
|
+
};
|
|
140
|
+
for (const [o, i] of Object.entries(e))
|
|
141
|
+
n(o, i, !1);
|
|
142
|
+
for (const [o, i] of Object.entries(r))
|
|
143
|
+
n(o, i, !0);
|
|
144
|
+
return t;
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
_ as bitGet,
|
|
148
|
+
V as bitLen,
|
|
149
|
+
q as bitMask,
|
|
150
|
+
j as bitSet,
|
|
151
|
+
b as bytesToHex,
|
|
152
|
+
T as bytesToNumberBE,
|
|
153
|
+
N as bytesToNumberLE,
|
|
154
|
+
v as concatBytes,
|
|
155
|
+
C as createHmacDrbg,
|
|
156
|
+
F as ensureBytes,
|
|
157
|
+
H as equalBytes,
|
|
158
|
+
d as hexToBytes,
|
|
159
|
+
m as hexToNumber,
|
|
160
|
+
U as numberToBytesBE,
|
|
161
|
+
S as numberToBytesLE,
|
|
162
|
+
A as numberToHexUnpadded,
|
|
163
|
+
k as numberToVarBytesBE,
|
|
164
|
+
O as utf8ToBytes,
|
|
165
|
+
D as validateObject
|
|
166
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./modular.cjs"),m=require("./utils.cjs"),et=require("./curve.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function at(v){const n=et.validateBasic(v);m.validateObject(n,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:x,a:O}=n;if(t){if(!x.eql(O,x.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...n})}const{bytesToNumberBE:ct,hexToBytes:ut}=m,$={Err:class extends Error{constructor(n=""){super(n)}},_parseInt(v){const{Err:n}=$;if(v.length<2||v[0]!==2)throw new n("Invalid signature integer tag");const t=v[1],x=v.subarray(2,t+2);if(!t||x.length!==t)throw new n("Invalid signature integer: wrong length");if(x[0]&128)throw new n("Invalid signature integer: negative");if(x[0]===0&&!(x[1]&128))throw new n("Invalid signature integer: unnecessary leading zero");return{d:ct(x),l:v.subarray(t+2)}},toSig(v){const{Err:n}=$,t=typeof v=="string"?ut(v):v;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let x=t.length;if(x<2||t[0]!=48)throw new n("Invalid signature tag");if(t[1]!==x-2)throw new n("Invalid signature: incorrect length");const{d:O,l:T}=$._parseInt(t.subarray(2)),{d:F,l:R}=$._parseInt(T);if(R.length)throw new n("Invalid signature: left bytes after parsing");return{r:O,s:F}},hexFromSig(v){const n=S=>Number.parseInt(S[0],16)&8?"00"+S:S,t=S=>{const V=S.toString(16);return V.length&1?`0${V}`:V},x=n(t(v.s)),O=n(t(v.r)),T=x.length/2,F=O.length/2,R=t(T),L=t(F);return`30${t(F+T+4)}02${L}${O}02${R}${x}`}},P=BigInt(0),U=BigInt(1);BigInt(2);const ot=BigInt(3);BigInt(4);function it(v){const n=at(v),{Fp:t}=n,x=n.toBytes||((y,r,i)=>{const o=r.toAffine();return m.concatBytes(Uint8Array.from([4]),t.toBytes(o.x),t.toBytes(o.y))}),O=n.fromBytes||(y=>{const r=y.subarray(1),i=t.fromBytes(r.subarray(0,t.BYTES)),o=t.fromBytes(r.subarray(t.BYTES,2*t.BYTES));return{x:i,y:o}});function T(y){const{a:r,b:i}=n,o=t.sqr(y),u=t.mul(o,y);return t.add(t.add(u,t.mul(y,r)),i)}if(!t.eql(t.sqr(n.Gy),T(n.Gx)))throw new Error("bad generator point: equation left != right");function F(y){return typeof y=="bigint"&&P<y&&y<n.n}function R(y){if(!F(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function L(y){const{allowedPrivateKeyLengths:r,nByteLength:i,wrapPrivateKey:o,n:u}=n;if(r&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=m.bytesToHex(y)),typeof y!="string"||!r.includes(y.length))throw new Error("Invalid key");y=y.padStart(i*2,"0")}let f;try{f=typeof y=="bigint"?y:m.bytesToNumberBE(m.ensureBytes("private key",y,i))}catch{throw new Error(`private key must be ${i} bytes, hex or bigint, not ${typeof y}`)}return o&&(f=_.mod(f,u)),R(f),f}const S=new Map;function V(y){if(!(y instanceof w))throw new Error("ProjectivePoint expected")}class w{constructor(r,i,o){if(this.px=r,this.py=i,this.pz=o,r==null||!t.isValid(r))throw new Error("x required");if(i==null||!t.isValid(i))throw new Error("y required");if(o==null||!t.isValid(o))throw new Error("z required")}static fromAffine(r){const{x:i,y:o}=r||{};if(!r||!t.isValid(i)||!t.isValid(o))throw new Error("invalid affine point");if(r instanceof w)throw new Error("projective point not allowed");const u=f=>t.eql(f,t.ZERO);return u(i)&&u(o)?w.ZERO:new w(i,o,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(r){const i=t.invertBatch(r.map(o=>o.pz));return r.map((o,u)=>o.toAffine(i[u])).map(w.fromAffine)}static fromHex(r){const i=w.fromAffine(O(m.ensureBytes("pointHex",r)));return i.assertValidity(),i}static fromPrivateKey(r){return w.BASE.multiply(L(r))}_setWindowSize(r){this._WINDOW_SIZE=r,S.delete(this)}assertValidity(){if(this.is0()){if(n.allowInfinityPoint)return;throw new Error("bad point: ZERO")}const{x:r,y:i}=this.toAffine();if(!t.isValid(r)||!t.isValid(i))throw new Error("bad point: x or y not FE");const o=t.sqr(i),u=T(r);if(!t.eql(o,u))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:r}=this.toAffine();if(t.isOdd)return!t.isOdd(r);throw new Error("Field doesn't support isOdd")}equals(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r,a=t.eql(t.mul(i,h),t.mul(f,u)),c=t.eql(t.mul(o,h),t.mul(g,u));return a&&c}negate(){return new w(this.px,t.neg(this.py),this.pz)}double(){const{a:r,b:i}=n,o=t.mul(i,ot),{px:u,py:f,pz:g}=this;let h=t.ZERO,a=t.ZERO,c=t.ZERO,d=t.mul(u,u),q=t.mul(f,f),B=t.mul(g,g),p=t.mul(u,f);return p=t.add(p,p),c=t.mul(u,g),c=t.add(c,c),h=t.mul(r,c),a=t.mul(o,B),a=t.add(h,a),h=t.sub(q,a),a=t.add(q,a),a=t.mul(h,a),h=t.mul(p,h),c=t.mul(o,c),B=t.mul(r,B),p=t.sub(d,B),p=t.mul(r,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,g),B=t.add(B,B),d=t.mul(B,p),h=t.sub(h,d),c=t.mul(B,q),c=t.add(c,c),c=t.add(c,c),new w(h,a,c)}add(r){V(r);const{px:i,py:o,pz:u}=this,{px:f,py:g,pz:h}=r;let a=t.ZERO,c=t.ZERO,d=t.ZERO;const q=n.a,B=t.mul(n.b,ot);let p=t.mul(i,f),N=t.mul(o,g),Z=t.mul(u,h),H=t.add(i,o),e=t.add(f,g);H=t.mul(H,e),e=t.add(p,N),H=t.sub(H,e),e=t.add(i,u);let s=t.add(f,h);return e=t.mul(e,s),s=t.add(p,Z),e=t.sub(e,s),s=t.add(o,u),a=t.add(g,h),s=t.mul(s,a),a=t.add(N,Z),s=t.sub(s,a),d=t.mul(q,e),a=t.mul(B,Z),d=t.add(a,d),a=t.sub(N,d),d=t.add(N,d),c=t.mul(a,d),N=t.add(p,p),N=t.add(N,p),Z=t.mul(q,Z),e=t.mul(B,e),N=t.add(N,Z),Z=t.sub(p,Z),Z=t.mul(q,Z),e=t.add(e,Z),p=t.mul(N,e),c=t.add(c,p),p=t.mul(s,e),a=t.mul(H,a),a=t.sub(a,p),p=t.mul(H,N),d=t.mul(s,d),d=t.add(d,p),new w(a,c,d)}subtract(r){return this.add(r.negate())}is0(){return this.equals(w.ZERO)}wNAF(r){return C.wNAFCached(this,S,r,i=>{const o=t.invertBatch(i.map(u=>u.pz));return i.map((u,f)=>u.toAffine(o[f])).map(w.fromAffine)})}multiplyUnsafe(r){const i=w.ZERO;if(r===P)return i;if(R(r),r===U)return this;const{endo:o}=n;if(!o)return C.unsafeLadder(this,r);let{k1neg:u,k1:f,k2neg:g,k2:h}=o.splitScalar(r),a=i,c=i,d=this;for(;f>P||h>P;)f&U&&(a=a.add(d)),h&U&&(c=c.add(d)),d=d.double(),f>>=U,h>>=U;return u&&(a=a.negate()),g&&(c=c.negate()),c=new w(t.mul(c.px,o.beta),c.py,c.pz),a.add(c)}multiply(r){R(r);let i=r,o,u;const{endo:f}=n;if(f){const{k1neg:g,k1:h,k2neg:a,k2:c}=f.splitScalar(i);let{p:d,f:q}=this.wNAF(h),{p:B,f:p}=this.wNAF(c);d=C.constTimeNegate(g,d),B=C.constTimeNegate(a,B),B=new w(t.mul(B.px,f.beta),B.py,B.pz),o=d.add(B),u=q.add(p)}else{const{p:g,f:h}=this.wNAF(i);o=g,u=h}return w.normalizeZ([o,u])[0]}multiplyAndAddUnsafe(r,i,o){const u=w.BASE,f=(h,a)=>a===P||a===U||!h.equals(u)?h.multiplyUnsafe(a):h.multiply(a),g=f(this,i).add(f(r,o));return g.is0()?void 0:g}toAffine(r){const{px:i,py:o,pz:u}=this,f=this.is0();r==null&&(r=f?t.ONE:t.inv(u));const g=t.mul(i,r),h=t.mul(o,r),a=t.mul(u,r);if(f)return{x:t.ZERO,y:t.ZERO};if(!t.eql(a,t.ONE))throw new Error("invZ was invalid");return{x:g,y:h}}isTorsionFree(){const{h:r,isTorsionFree:i}=n;if(r===U)return!0;if(i)return i(w,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:r,clearCofactor:i}=n;return r===U?this:i?i(w,this):this.multiplyUnsafe(n.h)}toRawBytes(r=!0){return this.assertValidity(),x(w,this,r)}toHex(r=!0){return m.bytesToHex(this.toRawBytes(r))}}w.BASE=new w(n.Gx,n.Gy,t.ONE),w.ZERO=new w(t.ZERO,t.ONE,t.ZERO);const W=n.nBitLength,C=et.wNAF(w,n.endo?Math.ceil(W/2):W);return{CURVE:n,ProjectivePoint:w,normPrivateKeyToScalar:L,weierstrassEquation:T,isWithinCurveOrder:F}}function lt(v){const n=et.validateBasic(v);return m.validateObject(n,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...n})}function ft(v){const n=lt(v),{Fp:t,n:x}=n,O=t.BYTES+1,T=2*t.BYTES+1;function F(e){return P<e&&e<t.ORDER}function R(e){return _.mod(e,x)}function L(e){return _.invert(e,x)}const{ProjectivePoint:S,normPrivateKeyToScalar:V,weierstrassEquation:w,isWithinCurveOrder:W}=it({...n,toBytes(e,s,l){const b=s.toAffine(),E=t.toBytes(b.x),A=m.concatBytes;return l?A(Uint8Array.from([s.hasEvenY()?2:3]),E):A(Uint8Array.from([4]),E,t.toBytes(b.y))},fromBytes(e){const s=e.length,l=e[0],b=e.subarray(1);if(s===O&&(l===2||l===3)){const E=m.bytesToNumberBE(b);if(!F(E))throw new Error("Point is not on curve");const A=w(E);let z=t.sqrt(A);const I=(z&U)===U;return(l&1)===1!==I&&(z=t.neg(z)),{x:E,y:z}}else if(s===T&&l===4){const E=t.fromBytes(b.subarray(0,t.BYTES)),A=t.fromBytes(b.subarray(t.BYTES,2*t.BYTES));return{x:E,y:A}}else throw new Error(`Point of length ${s} was invalid. Expected ${O} compressed bytes or ${T} uncompressed bytes`)}}),C=e=>m.bytesToHex(m.numberToBytesBE(e,n.nByteLength));function y(e){const s=x>>U;return e>s}function r(e){return y(e)?R(-e):e}const i=(e,s,l)=>m.bytesToNumberBE(e.slice(s,l));class o{constructor(s,l,b){this.r=s,this.s=l,this.recovery=b,this.assertValidity()}static fromCompact(s){const l=n.nByteLength;return s=m.ensureBytes("compactSignature",s,l*2),new o(i(s,0,l),i(s,l,2*l))}static fromDER(s){const{r:l,s:b}=$.toSig(m.ensureBytes("DER",s));return new o(l,b)}assertValidity(){if(!W(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!W(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(s){return new o(this.r,this.s,s)}recoverPublicKey(s){const{r:l,s:b,recovery:E}=this,A=c(m.ensureBytes("msgHash",s));if(E==null||![0,1,2,3].includes(E))throw new Error("recovery id invalid");const z=E===2||E===3?l+n.n:l;if(z>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const I=E&1?"03":"02",D=S.fromHex(I+C(z)),j=L(z),X=R(-A*j),J=R(b*j),K=S.BASE.multiplyAndAddUnsafe(D,X,J);if(!K)throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new o(this.r,R(-this.s),this.recovery):this}toDERRawBytes(){return m.hexToBytes(this.toDERHex())}toDERHex(){return $.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return m.hexToBytes(this.toCompactHex())}toCompactHex(){return C(this.r)+C(this.s)}}const u={isValidPrivateKey(e){try{return V(e),!0}catch{return!1}},normPrivateKeyToScalar:V,randomPrivateKey:()=>{const e=n.randomBytes(t.BYTES+8),s=_.hashToPrivateScalar(e,x);return m.numberToBytesBE(s,n.nByteLength)},precompute(e=8,s=S.BASE){return s._setWindowSize(e),s.multiply(BigInt(3)),s}};function f(e,s=!0){return S.fromPrivateKey(e).toRawBytes(s)}function g(e){const s=e instanceof Uint8Array,l=typeof e=="string",b=(s||l)&&e.length;return s?b===O||b===T:l?b===2*O||b===2*T:e instanceof S}function h(e,s,l=!0){if(g(e))throw new Error("first arg must be private key");if(!g(s))throw new Error("second arg must be public key");return S.fromHex(s).multiply(V(e)).toRawBytes(l)}const a=n.bits2int||function(e){const s=m.bytesToNumberBE(e),l=e.length*8-n.nBitLength;return l>0?s>>BigInt(l):s},c=n.bits2int_modN||function(e){return R(a(e))},d=m.bitMask(n.nBitLength);function q(e){if(typeof e!="bigint")throw new Error("bigint expected");if(!(P<=e&&e<d))throw new Error(`bigint expected < 2^${n.nBitLength}`);return m.numberToBytesBE(e,n.nByteLength)}function B(e,s,l=p){if(["recovered","canonical"].some(k=>k in l))throw new Error("sign() legacy options not supported");const{hash:b,randomBytes:E}=n;let{lowS:A,prehash:z,extraEntropy:I}=l;A==null&&(A=!0),e=m.ensureBytes("msgHash",e),z&&(e=m.ensureBytes("prehashed msgHash",b(e)));const D=c(e),j=V(s),X=[q(j),q(D)];if(I!=null){const k=I===!0?E(t.BYTES):I;X.push(m.ensureBytes("extraEntropy",k,t.BYTES))}const J=m.concatBytes(...X),K=D;function tt(k){const G=a(k);if(!W(G))return;const rt=L(G),M=S.BASE.multiply(G).toAffine(),Y=R(M.x);if(Y===P)return;const Q=R(rt*R(K+Y*j));if(Q===P)return;let nt=(M.x===Y?0:2)|Number(M.y&U),st=Q;return A&&y(Q)&&(st=r(Q),nt^=1),new o(Y,st,nt)}return{seed:J,k2sig:tt}}const p={lowS:n.lowS,prehash:!1},N={lowS:n.lowS,prehash:!1};function Z(e,s,l=p){const{seed:b,k2sig:E}=B(e,s,l);return m.createHmacDrbg(n.hash.outputLen,n.nByteLength,n.hmac)(b,E)}S.BASE._setWindowSize(8);function H(e,s,l,b=N){var M;const E=e;if(s=m.ensureBytes("msgHash",s),l=m.ensureBytes("publicKey",l),"strict"in b)throw new Error("options.strict was renamed to lowS");const{lowS:A,prehash:z}=b;let I,D;try{if(typeof E=="string"||E instanceof Uint8Array)try{I=o.fromDER(E)}catch(Y){if(!(Y instanceof $.Err))throw Y;I=o.fromCompact(E)}else if(typeof E=="object"&&typeof E.r=="bigint"&&typeof E.s=="bigint"){const{r:Y,s:Q}=E;I=new o(Y,Q)}else throw new Error("PARSE");D=S.fromHex(l)}catch(Y){if(Y.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(A&&I.hasHighS())return!1;z&&(s=n.hash(s));const{r:j,s:X}=I,J=c(s),K=L(X),tt=R(J*K),k=R(j*K),G=(M=S.BASE.multiplyAndAddUnsafe(D,tt,k))==null?void 0:M.toAffine();return G?R(G.x)===j:!1}return{CURVE:n,getPublicKey:f,getSharedSecret:h,sign:Z,verify:H,ProjectivePoint:S,Signature:o,utils:u}}exports.DER=$;exports.weierstrass=ft;exports.weierstrassPoints=it;
|