@argent/x-shared 1.78.12 → 1.79.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/.ts-temp/tsconfig.tsbuildinfo +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/_virtual/_rolldown/runtime.js +20 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +112 -488
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +11 -11
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/curve.js +62 -85
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +153 -190
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js +56 -65
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js +125 -151
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +470 -575
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/_assert.js +26 -40
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/crypto.js +4 -4
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js +38 -42
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js +28 -42
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_assert.js +17 -26
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_sha2.js +52 -59
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/_u64.js +20 -19
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js +118 -113
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +95 -105
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js +26 -32
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_md.js +71 -82
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/_u64.js +20 -20
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha2.js +125 -124
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/sha3.js +102 -116
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@2.0.0/node_modules/@noble/hashes/utils.js +62 -76
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.cjs +1 -1
- package/dist/node_modules/.pnpm/bignumber.js@9.1.2/node_modules/bignumber.js/bignumber.js +519 -614
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Hash.js +15 -19
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_ListCache.js +15 -19
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Map.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_MapCache.js +15 -19
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Set.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_SetCache.js +10 -12
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_Symbol.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludes.js +6 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_arrayIncludesWith.js +6 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_assocIndexOf.js +7 -9
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseFindIndex.js +6 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseGetTag.js +9 -9
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIndexOf.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNaN.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsNative.js +10 -15
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseUniq.js +26 -32
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_cacheHas.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_coreJsData.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_createSet.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js +4 -4
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getMapData.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getNative.js +8 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getRawTag.js +12 -13
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_getValue.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashClear.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashDelete.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashGet.js +11 -11
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashHas.js +8 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_hashSet.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isKeyable.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_isMasked.js +9 -9
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheClear.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheDelete.js +8 -11
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheGet.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheHas.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_listCacheSet.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheClear.js +11 -11
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheDelete.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheGet.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheHas.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_mapCacheSet.js +7 -7
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_nativeCreate.js +4 -4
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_objectToString.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_root.js +4 -4
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheAdd.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setCacheHas.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js +8 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_strictIndexOf.js +6 -8
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_toSource.js +14 -16
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/eq.js +5 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isFunction.js +10 -11
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isObject.js +6 -6
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/noop.js +4 -5
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.cjs +1 -1
- package/dist/node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/uniqWith.js +6 -6
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -1
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +121 -118
- package/dist/node_modules/.pnpm/numeral@2.0.6/node_modules/numeral/numeral.cjs +1 -1
- package/dist/node_modules/.pnpm/numeral@2.0.6/node_modules/numeral/numeral.js +377 -417
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.cjs +1 -1
- package/dist/node_modules/.pnpm/semver@6.3.1/node_modules/semver/semver.js +546 -635
- package/dist/paymaster.cjs +1 -1
- package/dist/paymaster.js +3 -9
- package/dist/simulation.cjs +1 -1
- package/dist/simulation.js +22 -90
- package/dist/src/account/account.model.cjs +1 -1
- package/dist/src/account/account.model.js +58 -52
- package/dist/src/account/accountv4.cjs +1 -1
- package/dist/src/account/accountv4.js +9 -11
- package/dist/src/account/preferences.model.cjs +1 -1
- package/dist/src/account/preferences.model.js +12 -10
- package/dist/src/accountNameGenerator/colors.cjs +1 -1
- package/dist/src/accountNameGenerator/colors.js +24 -24
- package/dist/src/accountNameGenerator/index.cjs +1 -1
- package/dist/src/accountNameGenerator/index.js +23 -23
- package/dist/src/accountNameGenerator/x-names.json.cjs +1 -1
- package/dist/src/accountNameGenerator/x-names.json.js +1922 -7
- package/dist/src/assets/tokens.json.cjs +1 -1
- package/dist/src/assets/tokens.json.js +180 -180
- package/dist/src/backend/schema.cjs +1 -1
- package/dist/src/backend/schema.js +9 -12
- package/dist/src/backend/sessionKeys/schema.cjs +1 -1
- package/dist/src/backend/sessionKeys/schema.js +27 -30
- package/dist/src/bigdecimal/constants.cjs +1 -1
- package/dist/src/bigdecimal/constants.js +6 -3
- package/dist/src/bigdecimal/createUnitsSchema.cjs +1 -1
- package/dist/src/bigdecimal/createUnitsSchema.js +7 -7
- package/dist/src/bigdecimal/formatUnits.cjs +1 -1
- package/dist/src/bigdecimal/formatUnits.js +9 -10
- package/dist/src/bigdecimal/index.cjs +1 -1
- package/dist/src/bigdecimal/index.js +45 -41
- package/dist/src/bigdecimal/lib.cjs +1 -1
- package/dist/src/bigdecimal/lib.js +105 -117
- package/dist/src/bigdecimal/parseUnits.cjs +1 -1
- package/dist/src/bigdecimal/parseUnits.js +18 -21
- package/dist/src/bigdecimal/utils.cjs +1 -1
- package/dist/src/bigdecimal/utils.js +33 -30
- package/dist/src/cache/CacheService.cjs +1 -1
- package/dist/src/cache/CacheService.js +32 -36
- package/dist/src/chains/starknet/address.cjs +1 -1
- package/dist/src/chains/starknet/address.js +73 -117
- package/dist/src/chains/starknet/addressDomain.cjs +1 -1
- package/dist/src/chains/starknet/addressDomain.js +14 -29
- package/dist/src/chains/starknet/addressInput.cjs +1 -1
- package/dist/src/chains/starknet/addressInput.js +6 -7
- package/dist/src/chains/starknet/argentName.cjs +1 -1
- package/dist/src/chains/starknet/argentName.js +10 -14
- package/dist/src/chains/starknet/cairoVersionSchema.cjs +1 -1
- package/dist/src/chains/starknet/cairoVersionSchema.js +5 -5
- package/dist/src/chains/starknet/constants.cjs +1 -1
- package/dist/src/chains/starknet/constants.js +4 -10
- package/dist/src/chains/starknet/getAddressFromArgentName.cjs +1 -1
- package/dist/src/chains/starknet/getAddressFromArgentName.js +38 -46
- package/dist/src/chains/starknet/getAddressFromStarkName.cjs +1 -1
- package/dist/src/chains/starknet/getAddressFromStarkName.js +59 -66
- package/dist/src/chains/starknet/network.cjs +1 -1
- package/dist/src/chains/starknet/network.js +20 -26
- package/dist/src/chains/starknet/services/address/StarknetAddressService.cjs +1 -1
- package/dist/src/chains/starknet/services/address/StarknetAddressService.js +31 -36
- package/dist/src/chains/starknet/services/deploymentData/constants.cjs +1 -1
- package/dist/src/chains/starknet/services/deploymentData/constants.js +14 -21
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.cjs +1 -1
- package/dist/src/chains/starknet/services/deploymentData/deploymentData.schema.js +15 -17
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.cjs +1 -1
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +61 -65
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.cjs +1 -1
- package/dist/src/chains/starknet/services/deploymentData/getAccountClassHash.js +46 -65
- package/dist/src/chains/starknet/starknetId.cjs +1 -1
- package/dist/src/chains/starknet/starknetId.js +10 -14
- package/dist/src/currencyFetchService/CurrencyFetchService.cjs +1 -1
- package/dist/src/currencyFetchService/CurrencyFetchService.js +13 -18
- package/dist/src/currencyFetchService/types.ts.cjs +1 -1
- package/dist/src/currencyFetchService/types.ts.js +9 -12
- package/dist/src/errors/account.cjs +1 -1
- package/dist/src/errors/account.js +12 -13
- package/dist/src/errors/address.cjs +1 -1
- package/dist/src/errors/address.js +11 -12
- package/dist/src/errors/baseErrors.cjs +1 -1
- package/dist/src/errors/baseErrors.js +14 -14
- package/dist/src/errors/call.cjs +1 -1
- package/dist/src/errors/call.js +12 -13
- package/dist/src/errors/network.cjs +1 -1
- package/dist/src/errors/network.js +11 -12
- package/dist/src/errors/review.cjs +1 -1
- package/dist/src/errors/review.js +11 -12
- package/dist/src/errors/swap.cjs +1 -1
- package/dist/src/errors/swap.js +12 -13
- package/dist/src/features/paymaster/IPaymasterService.d.ts +2 -1
- package/dist/src/features/paymaster/PaymasterService.cjs +1 -1
- package/dist/src/features/paymaster/PaymasterService.d.ts +3 -1
- package/dist/src/features/paymaster/PaymasterService.js +73 -86
- package/dist/src/features/paymaster/types.cjs +1 -1
- package/dist/src/features/paymaster/types.d.ts +20 -2
- package/dist/src/features/paymaster/types.js +41 -39
- package/dist/src/features/simulation/activity/normalize.cjs +1 -1
- package/dist/src/features/simulation/activity/normalize.js +36 -38
- package/dist/src/features/simulation/activity/schema.cjs +1 -1
- package/dist/src/features/simulation/activity/schema.js +224 -250
- package/dist/src/features/simulation/activity/utils/createNativeActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/createNativeActivity.js +23 -27
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/getAnyActivityTitle.js +14 -21
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/getOverallLastModified.js +5 -5
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/hasDelegationActivity.js +4 -4
- package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isAddMultisigSignersActivity.js +15 -19
- package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isChangeMultisigThresholdActivity.js +15 -19
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isMulticallWithDeploymentActivity.js +5 -5
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isRejectOnChainActivity.js +19 -21
- package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isRemoveMultisigSignersActivity.js +15 -19
- package/dist/src/features/simulation/activity/utils/isSwapActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isSwapActivity.js +17 -18
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/isUpgradeActivity.js +15 -19
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/parseAccountActivities.js +12 -12
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.cjs +1 -1
- package/dist/src/features/simulation/activity/utils/parseFinanceActivities.js +32 -32
- package/dist/src/features/simulation/fees/schema.cjs +1 -1
- package/dist/src/features/simulation/fees/schema.js +33 -47
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/getErrorMessageAndLabelFromSimulation.js +15 -17
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/getMessageFromSimulationError.js +5 -5
- package/dist/src/features/simulation/transactionReview/schema.cjs +1 -1
- package/dist/src/features/simulation/transactionReview/schema.js +221 -242
- package/dist/src/features/simulation/warning/helper.cjs +1 -1
- package/dist/src/features/simulation/warning/helper.js +12 -11
- package/dist/src/features/simulation/warning/schema.cjs +1 -1
- package/dist/src/features/simulation/warning/schema.js +10 -11
- package/dist/src/features/swap/models/order.model.cjs +1 -1
- package/dist/src/features/swap/models/order.model.js +16 -19
- package/dist/src/features/swap/models/quote.model.cjs +1 -1
- package/dist/src/features/swap/models/quote.model.js +31 -35
- package/dist/src/features/swap/models/trade.model.cjs +1 -1
- package/dist/src/features/swap/models/trade.model.js +25 -27
- package/dist/src/features/swap/services/SwapSharedService.cjs +1 -1
- package/dist/src/features/swap/services/SwapSharedService.js +71 -75
- package/dist/src/features/swap/services/SwapTransactionService.cjs +1 -1
- package/dist/src/features/swap/services/SwapTransactionService.js +57 -63
- package/dist/src/features/swap/utils/slippage.cjs +1 -1
- package/dist/src/features/swap/utils/slippage.js +18 -25
- package/dist/src/features/swap/utils/totalFee.cjs +1 -1
- package/dist/src/features/swap/utils/totalFee.js +12 -12
- package/dist/src/http/DateService.cjs +1 -1
- package/dist/src/http/DateService.js +15 -18
- package/dist/src/http/HttpError.cjs +1 -1
- package/dist/src/http/HttpError.js +7 -7
- package/dist/src/http/HttpService.cjs +1 -1
- package/dist/src/http/HttpService.js +117 -134
- package/dist/src/http/IHttpService.cjs +1 -1
- package/dist/src/http/IHttpService.js +6 -6
- package/dist/src/http/SWRService.cjs +1 -1
- package/dist/src/http/SWRService.js +50 -57
- package/dist/src/http/fetcher.cjs +1 -1
- package/dist/src/http/fetcher.js +29 -35
- package/dist/src/http/time.cjs +1 -1
- package/dist/src/http/time.js +15 -18
- package/dist/src/knownDapps/KnownDappsBackendService.cjs +1 -1
- package/dist/src/knownDapps/KnownDappsBackendService.js +13 -14
- package/dist/src/knownDapps/schema.cjs +1 -1
- package/dist/src/knownDapps/schema.js +41 -44
- package/dist/src/knownDapps/utils/getDapplandUrl.cjs +1 -1
- package/dist/src/knownDapps/utils/getDapplandUrl.js +7 -8
- package/dist/src/nameResolution/ResolveNameService.cjs +1 -1
- package/dist/src/nameResolution/ResolveNameService.js +34 -41
- package/dist/src/nameResolution/schema.cjs +1 -1
- package/dist/src/nameResolution/schema.js +20 -25
- package/dist/src/nfts/BackendNftService.cjs +1 -1
- package/dist/src/nfts/BackendNftService.js +103 -116
- package/dist/src/nfts/BackendPaginationError.cjs +1 -1
- package/dist/src/nfts/BackendPaginationError.js +11 -12
- package/dist/src/nfts/utils.cjs +1 -1
- package/dist/src/nfts/utils.js +11 -14
- package/dist/src/onchainRecovery/OnchainRecoveryService.cjs +1 -1
- package/dist/src/onchainRecovery/OnchainRecoveryService.js +38 -68
- package/dist/src/onchainRecovery/schema.cjs +1 -1
- package/dist/src/onchainRecovery/schema.js +35 -49
- package/dist/src/platform/isBraveBrowser.cjs +1 -1
- package/dist/src/platform/isBraveBrowser.js +8 -10
- package/dist/src/platform/isBrowser.cjs +1 -1
- package/dist/src/platform/isBrowser.js +17 -22
- package/dist/src/signer/mergeOwnerGuardianSignatures.cjs +1 -1
- package/dist/src/signer/mergeOwnerGuardianSignatures.js +28 -30
- package/dist/src/signer/multisigner.cjs +1 -1
- package/dist/src/signer/multisigner.js +16 -17
- package/dist/src/signer/seedphrase.cjs +1 -1
- package/dist/src/signer/seedphrase.js +7 -7
- package/dist/src/staking/schema.cjs +1 -1
- package/dist/src/staking/schema.js +146 -162
- package/dist/src/storage/base.cjs +1 -1
- package/dist/src/storage/base.js +33 -34
- package/dist/src/storage/utils.cjs +1 -1
- package/dist/src/storage/utils.js +19 -28
- package/dist/src/tokens/balances.cjs +1 -1
- package/dist/src/tokens/balances.js +34 -38
- package/dist/src/tokens/constants.cjs +1 -1
- package/dist/src/tokens/constants.js +4 -4
- package/dist/src/tokens/convertCurrencyValueToTokenAmount.cjs +1 -1
- package/dist/src/tokens/convertCurrencyValueToTokenAmount.js +8 -9
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.cjs +1 -1
- package/dist/src/tokens/convertTokenAmountToCurrencyValue.js +14 -15
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.cjs +1 -1
- package/dist/src/tokens/convertTokenUnitAmountWithDecimals.js +8 -9
- package/dist/src/tokens/ensureDecimals.cjs +1 -1
- package/dist/src/tokens/ensureDecimals.js +4 -4
- package/dist/src/tokens/getCurrencySymbol.cjs +1 -1
- package/dist/src/tokens/getCurrencySymbol.js +14 -14
- package/dist/src/tokens/isUnlimitedAmount.cjs +1 -1
- package/dist/src/tokens/isUnlimitedAmount.js +5 -5
- package/dist/src/tokens/prettifyCurrencyValue.cjs +1 -1
- package/dist/src/tokens/prettifyCurrencyValue.js +13 -14
- package/dist/src/tokens/prettifyTokenAmount.cjs +1 -1
- package/dist/src/tokens/prettifyTokenAmount.js +22 -22
- package/dist/src/tokens/service/implementation.cjs +1 -1
- package/dist/src/tokens/service/implementation.js +28 -40
- package/dist/src/tokens/service/tokenError.cjs +1 -1
- package/dist/src/tokens/service/tokenError.js +11 -12
- package/dist/src/tokens/service/types/backend.model.cjs +1 -1
- package/dist/src/tokens/service/types/backend.model.js +128 -163
- package/dist/src/tokens/service/types/defiPosition.model.cjs +1 -1
- package/dist/src/tokens/service/types/defiPosition.model.js +83 -99
- package/dist/src/tokens/service/types/defiPositionType.model.cjs +1 -1
- package/dist/src/tokens/service/types/defiPositionType.model.js +9 -9
- package/dist/src/tokens/service/types/unclaimedRewards.model.cjs +1 -1
- package/dist/src/tokens/service/types/unclaimedRewards.model.js +15 -16
- package/dist/src/tokens/service/types/webToken.model.cjs +1 -1
- package/dist/src/tokens/service/types/webToken.model.js +28 -51
- package/dist/src/tokens/utils.cjs +1 -1
- package/dist/src/tokens/utils.js +5 -9
- package/dist/src/transactions/amount.cjs +1 -1
- package/dist/src/transactions/amount.js +17 -24
- package/dist/src/transactions/buildTransactions.cjs +1 -1
- package/dist/src/transactions/buildTransactions.js +30 -33
- package/dist/src/transactions/errors.cjs +1 -1
- package/dist/src/transactions/errors.js +11 -18
- package/dist/src/transactions/estimate/adjustment.cjs +1 -1
- package/dist/src/transactions/estimate/adjustment.js +6 -6
- package/dist/src/transactions/estimate/argentMaxFee.cjs +1 -1
- package/dist/src/transactions/estimate/argentMaxFee.js +10 -13
- package/dist/src/transactions/estimate/error.cjs +1 -1
- package/dist/src/transactions/estimate/error.js +12 -13
- package/dist/src/transactions/estimate/model.cjs +1 -1
- package/dist/src/transactions/estimate/model.js +18 -13
- package/dist/src/transactions/estimate/utils.cjs +1 -1
- package/dist/src/transactions/estimate/utils.js +139 -172
- package/dist/src/transactions/findTransfersAndApprovals.cjs +1 -1
- package/dist/src/transactions/findTransfersAndApprovals.js +34 -30
- package/dist/src/transactions/getPrettyRcpError.cjs +1 -1
- package/dist/src/transactions/getPrettyRcpError.js +8 -10
- package/dist/src/transactions/service/implementation.cjs +1 -1
- package/dist/src/transactions/service/implementation.js +187 -208
- package/dist/src/transactions/service/types.cjs +1 -1
- package/dist/src/transactions/service/types.js +9 -9
- package/dist/src/transactions/service/utils.cjs +1 -1
- package/dist/src/transactions/service/utils.js +24 -25
- package/dist/src/transactions/transactionExecuteTypes.cjs +1 -1
- package/dist/src/transactions/transactionExecuteTypes.js +8 -9
- package/dist/src/transactions/transactionReviewTypes.cjs +1 -1
- package/dist/src/transactions/transactionReviewTypes.js +9 -9
- package/dist/src/transactions/transactionVersion.cjs +1 -1
- package/dist/src/transactions/transactionVersion.js +8 -13
- package/dist/src/transactions/txv3.cjs +1 -1
- package/dist/src/transactions/txv3.js +10 -11
- package/dist/src/utils/address.cjs +1 -1
- package/dist/src/utils/address.js +4 -4
- package/dist/src/utils/arrays.cjs +1 -1
- package/dist/src/utils/arrays.js +4 -4
- package/dist/src/utils/avatarImage.cjs +4 -4
- package/dist/src/utils/avatarImage.js +35 -40
- package/dist/src/utils/base58.cjs +1 -1
- package/dist/src/utils/base58.js +12 -15
- package/dist/src/utils/bigNumber.cjs +1 -1
- package/dist/src/utils/bigNumber.d.ts +1 -1
- package/dist/src/utils/bigNumber.js +5 -7
- package/dist/src/utils/bips.cjs +1 -1
- package/dist/src/utils/bips.js +12 -10
- package/dist/src/utils/daysBetween.cjs +1 -1
- package/dist/src/utils/daysBetween.js +6 -6
- package/dist/src/utils/env.cjs +1 -1
- package/dist/src/utils/env.js +4 -4
- package/dist/src/utils/hex.cjs +1 -1
- package/dist/src/utils/hex.js +7 -8
- package/dist/src/utils/id.cjs +1 -1
- package/dist/src/utils/id.js +7 -7
- package/dist/src/utils/initials.cjs +1 -1
- package/dist/src/utils/initials.js +12 -15
- package/dist/src/utils/isContractDeployed.cjs +1 -1
- package/dist/src/utils/isContractDeployed.js +9 -9
- package/dist/src/utils/nonNullable.cjs +1 -1
- package/dist/src/utils/nonNullable.js +6 -6
- package/dist/src/utils/number/abbreviateNumber.cjs +1 -1
- package/dist/src/utils/number/abbreviateNumber.js +13 -14
- package/dist/src/utils/number/isAllowedAddressHexInputValue.cjs +1 -1
- package/dist/src/utils/number/isAllowedAddressHexInputValue.js +4 -7
- package/dist/src/utils/number/isAllowedNumericInputValue.cjs +1 -1
- package/dist/src/utils/number/isAllowedNumericInputValue.js +5 -5
- package/dist/src/utils/number/isNumeric.cjs +1 -1
- package/dist/src/utils/number/isNumeric.js +4 -4
- package/dist/src/utils/number/prettifyNumber.cjs +1 -1
- package/dist/src/utils/number/prettifyNumber.js +65 -75
- package/dist/src/utils/parseAmount.cjs +1 -1
- package/dist/src/utils/parseAmount.js +10 -11
- package/dist/src/utils/pluralise.cjs +1 -1
- package/dist/src/utils/pluralise.js +4 -4
- package/dist/src/utils/readFileAsString.cjs +1 -1
- package/dist/src/utils/readFileAsString.js +6 -6
- package/dist/src/utils/retryUntilInitialised.cjs +1 -1
- package/dist/src/utils/retryUntilInitialised.js +21 -20
- package/dist/src/utils/schemas.cjs +1 -1
- package/dist/src/utils/schemas.js +29 -26
- package/dist/src/utils/starknet/starknet.cjs +1 -1
- package/dist/src/utils/starknet/starknet.js +64 -77
- package/dist/src/utils/starknet/starknetLibTypes.cjs +1 -1
- package/dist/src/utils/starknet/starknetLibTypes.js +7 -7
- package/dist/src/utils/starknet/starknetSchemas.cjs +1 -1
- package/dist/src/utils/starknet/starknetSchemas.js +84 -99
- package/dist/src/utils/transactions.cjs +1 -1
- package/dist/src/utils/transactions.js +10 -10
- package/dist/src/utils/url/urlWithQuery.cjs +1 -1
- package/dist/src/utils/url/urlWithQuery.js +8 -8
- package/dist/src/utils/voidify.cjs +1 -1
- package/dist/src/utils/voidify.js +7 -7
- package/dist/swap.cjs +1 -1
- package/dist/swap.js +8 -22
- package/package.json +15 -15
- package/dist/_virtual/_commonjsHelpers.cjs +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/numeral.cjs +0 -1
- package/dist/_virtual/numeral.js +0 -7
- package/dist/_virtual/numeral2.cjs +0 -1
- package/dist/_virtual/numeral2.js +0 -4
- package/dist/_virtual/semver.cjs +0 -1
- package/dist/_virtual/semver.js +0 -7
- package/dist/_virtual/semver2.cjs +0 -1
- package/dist/_virtual/semver2.js +0 -4
|
@@ -1,579 +1,474 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
return Object.freeze({ ...n });
|
|
1
|
+
import { bitMask as e, bytesToHex as t, bytesToNumberBE as n, concatBytes as r, createHmacDrbg as i, ensureBytes as a, hexToBytes as o, numberToBytesBE as s, utils_exports as c, validateObject as l } from "./utils.js";
|
|
2
|
+
import { hashToPrivateScalar as u, invert as d, mod as f } from "./modular.js";
|
|
3
|
+
import { validateBasic as p, wNAF as m } from "./curve.js";
|
|
4
|
+
//#region node_modules/.pnpm/@noble+curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js
|
|
5
|
+
function h(e) {
|
|
6
|
+
let t = p(e);
|
|
7
|
+
l(t, {
|
|
8
|
+
a: "field",
|
|
9
|
+
b: "field"
|
|
10
|
+
}, {
|
|
11
|
+
allowedPrivateKeyLengths: "array",
|
|
12
|
+
wrapPrivateKey: "boolean",
|
|
13
|
+
isTorsionFree: "function",
|
|
14
|
+
clearCofactor: "function",
|
|
15
|
+
allowInfinityPoint: "boolean",
|
|
16
|
+
fromBytes: "function",
|
|
17
|
+
toBytes: "function"
|
|
18
|
+
});
|
|
19
|
+
let { endo: n, Fp: r, a: i } = t;
|
|
20
|
+
if (n) {
|
|
21
|
+
if (!r.eql(i, r.ZERO)) throw Error("Endomorphism can only be defined for Koblitz curves that have a=0");
|
|
22
|
+
if (typeof n != "object" || typeof n.beta != "bigint" || typeof n.splitScalar != "function") throw Error("Expected endomorphism with beta: bigint and splitScalar: function");
|
|
23
|
+
}
|
|
24
|
+
return Object.freeze({ ...t });
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
f & z && (a = a.add(d)), h & z && (c = c.add(d)), d = d.double(), f >>= z, h >>= z;
|
|
254
|
-
return u && (a = a.negate()), E && (c = c.negate()), c = new y(t.mul(c.px, s.beta), c.py, c.pz), a.add(c);
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Constant time multiplication.
|
|
258
|
-
* Uses wNAF method. Windowed method may be 10% faster,
|
|
259
|
-
* but takes 2x longer to generate and consumes 2x memory.
|
|
260
|
-
* Uses precomputes when available.
|
|
261
|
-
* Uses endomorphism for Koblitz curves.
|
|
262
|
-
* @param scalar by which the point would be multiplied
|
|
263
|
-
* @returns New point
|
|
264
|
-
*/
|
|
265
|
-
multiply(e) {
|
|
266
|
-
S(e);
|
|
267
|
-
let i = e, s, u;
|
|
268
|
-
const { endo: f } = n;
|
|
269
|
-
if (f) {
|
|
270
|
-
const { k1neg: E, k1: h, k2neg: a, k2: c } = f.splitScalar(i);
|
|
271
|
-
let { p: d, f: N } = this.wNAF(h), { p: b, f: p } = this.wNAF(c);
|
|
272
|
-
d = C.constTimeNegate(E, d), b = C.constTimeNegate(a, b), b = new y(t.mul(b.px, f.beta), b.py, b.pz), s = d.add(b), u = N.add(p);
|
|
273
|
-
} else {
|
|
274
|
-
const { p: E, f: h } = this.wNAF(i);
|
|
275
|
-
s = E, u = h;
|
|
276
|
-
}
|
|
277
|
-
return y.normalizeZ([s, u])[0];
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly.
|
|
281
|
-
* Not using Strauss-Shamir trick: precomputation tables are faster.
|
|
282
|
-
* The trick could be useful if both P and Q are not G (not in our case).
|
|
283
|
-
* @returns non-zero affine point
|
|
284
|
-
*/
|
|
285
|
-
multiplyAndAddUnsafe(e, i, s) {
|
|
286
|
-
const u = y.BASE, f = (h, a) => a === L || a === z || !h.equals(u) ? h.multiplyUnsafe(a) : h.multiply(a), E = f(this, i).add(f(e, s));
|
|
287
|
-
return E.is0() ? void 0 : E;
|
|
288
|
-
}
|
|
289
|
-
// Converts Projective point to affine (x, y) coordinates.
|
|
290
|
-
// Can accept precomputed Z^-1 - for example, from invertBatch.
|
|
291
|
-
// (x, y, z) ∋ (x=x/z, y=y/z)
|
|
292
|
-
toAffine(e) {
|
|
293
|
-
const { px: i, py: s, pz: u } = this, f = this.is0();
|
|
294
|
-
e == null && (e = f ? t.ONE : t.inv(u));
|
|
295
|
-
const E = t.mul(i, e), h = t.mul(s, e), a = t.mul(u, e);
|
|
296
|
-
if (f)
|
|
297
|
-
return { x: t.ZERO, y: t.ZERO };
|
|
298
|
-
if (!t.eql(a, t.ONE))
|
|
299
|
-
throw new Error("invZ was invalid");
|
|
300
|
-
return { x: E, y: h };
|
|
301
|
-
}
|
|
302
|
-
isTorsionFree() {
|
|
303
|
-
const { h: e, isTorsionFree: i } = n;
|
|
304
|
-
if (e === z)
|
|
305
|
-
return !0;
|
|
306
|
-
if (i)
|
|
307
|
-
return i(y, this);
|
|
308
|
-
throw new Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
309
|
-
}
|
|
310
|
-
clearCofactor() {
|
|
311
|
-
const { h: e, clearCofactor: i } = n;
|
|
312
|
-
return e === z ? this : i ? i(y, this) : this.multiplyUnsafe(n.h);
|
|
313
|
-
}
|
|
314
|
-
toRawBytes(e = !0) {
|
|
315
|
-
return this.assertValidity(), v(y, this, e);
|
|
316
|
-
}
|
|
317
|
-
toHex(e = !0) {
|
|
318
|
-
return nt(this.toRawBytes(e));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
y.BASE = new y(n.Gx, n.Gy, t.ONE), y.ZERO = new y(t.ZERO, t.ONE, t.ZERO);
|
|
322
|
-
const W = n.nBitLength, C = wt(y, n.endo ? Math.ceil(W / 2) : W);
|
|
323
|
-
return {
|
|
324
|
-
CURVE: n,
|
|
325
|
-
ProjectivePoint: y,
|
|
326
|
-
normPrivateKeyToScalar: P,
|
|
327
|
-
weierstrassEquation: O,
|
|
328
|
-
isWithinCurveOrder: F
|
|
329
|
-
};
|
|
26
|
+
var { bytesToNumberBE: g, hexToBytes: _ } = c, v = {
|
|
27
|
+
Err: class extends Error {
|
|
28
|
+
constructor(e = "") {
|
|
29
|
+
super(e);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
_parseInt(e) {
|
|
33
|
+
let { Err: t } = v;
|
|
34
|
+
if (e.length < 2 || e[0] !== 2) throw new t("Invalid signature integer tag");
|
|
35
|
+
let n = e[1], r = e.subarray(2, n + 2);
|
|
36
|
+
if (!n || r.length !== n) throw new t("Invalid signature integer: wrong length");
|
|
37
|
+
if (r[0] & 128) throw new t("Invalid signature integer: negative");
|
|
38
|
+
if (r[0] === 0 && !(r[1] & 128)) throw new t("Invalid signature integer: unnecessary leading zero");
|
|
39
|
+
return {
|
|
40
|
+
d: g(r),
|
|
41
|
+
l: e.subarray(n + 2)
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
toSig(e) {
|
|
45
|
+
let { Err: t } = v, n = typeof e == "string" ? _(e) : e;
|
|
46
|
+
if (!(n instanceof Uint8Array)) throw Error("ui8a expected");
|
|
47
|
+
let r = n.length;
|
|
48
|
+
if (r < 2 || n[0] != 48) throw new t("Invalid signature tag");
|
|
49
|
+
if (n[1] !== r - 2) throw new t("Invalid signature: incorrect length");
|
|
50
|
+
let { d: i, l: a } = v._parseInt(n.subarray(2)), { d: o, l: s } = v._parseInt(a);
|
|
51
|
+
if (s.length) throw new t("Invalid signature: left bytes after parsing");
|
|
52
|
+
return {
|
|
53
|
+
r: i,
|
|
54
|
+
s: o
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
hexFromSig(e) {
|
|
58
|
+
let t = (e) => Number.parseInt(e[0], 16) & 8 ? "00" + e : e, n = (e) => {
|
|
59
|
+
let t = e.toString(16);
|
|
60
|
+
return t.length & 1 ? `0${t}` : t;
|
|
61
|
+
}, r = t(n(e.s)), i = t(n(e.r)), a = r.length / 2, o = i.length / 2, s = n(a), c = n(o);
|
|
62
|
+
return `30${n(o + a + 4)}02${c}${i}02${s}${r}`;
|
|
63
|
+
}
|
|
64
|
+
}, y = BigInt(0), b = BigInt(1), x = BigInt(3);
|
|
65
|
+
function S(e) {
|
|
66
|
+
let i = h(e), { Fp: o } = i, s = i.toBytes || ((e, t, n) => {
|
|
67
|
+
let i = t.toAffine();
|
|
68
|
+
return r(Uint8Array.from([4]), o.toBytes(i.x), o.toBytes(i.y));
|
|
69
|
+
}), c = i.fromBytes || ((e) => {
|
|
70
|
+
let t = e.subarray(1);
|
|
71
|
+
return {
|
|
72
|
+
x: o.fromBytes(t.subarray(0, o.BYTES)),
|
|
73
|
+
y: o.fromBytes(t.subarray(o.BYTES, 2 * o.BYTES))
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
function l(e) {
|
|
77
|
+
let { a: t, b: n } = i, r = o.sqr(e), a = o.mul(r, e);
|
|
78
|
+
return o.add(o.add(a, o.mul(e, t)), n);
|
|
79
|
+
}
|
|
80
|
+
if (!o.eql(o.sqr(i.Gy), l(i.Gx))) throw Error("bad generator point: equation left != right");
|
|
81
|
+
function u(e) {
|
|
82
|
+
return typeof e == "bigint" && y < e && e < i.n;
|
|
83
|
+
}
|
|
84
|
+
function d(e) {
|
|
85
|
+
if (!u(e)) throw Error("Expected valid bigint: 0 < bigint < curve.n");
|
|
86
|
+
}
|
|
87
|
+
function p(e) {
|
|
88
|
+
let { allowedPrivateKeyLengths: r, nByteLength: o, wrapPrivateKey: s, n: c } = i;
|
|
89
|
+
if (r && typeof e != "bigint") {
|
|
90
|
+
if (e instanceof Uint8Array && (e = t(e)), typeof e != "string" || !r.includes(e.length)) throw Error("Invalid key");
|
|
91
|
+
e = e.padStart(o * 2, "0");
|
|
92
|
+
}
|
|
93
|
+
let l;
|
|
94
|
+
try {
|
|
95
|
+
l = typeof e == "bigint" ? e : n(a("private key", e, o));
|
|
96
|
+
} catch {
|
|
97
|
+
throw Error(`private key must be ${o} bytes, hex or bigint, not ${typeof e}`);
|
|
98
|
+
}
|
|
99
|
+
return s && (l = f(l, c)), d(l), l;
|
|
100
|
+
}
|
|
101
|
+
let g = /* @__PURE__ */ new Map();
|
|
102
|
+
function _(e) {
|
|
103
|
+
if (!(e instanceof v)) throw Error("ProjectivePoint expected");
|
|
104
|
+
}
|
|
105
|
+
class v {
|
|
106
|
+
constructor(e, t, n) {
|
|
107
|
+
if (this.px = e, this.py = t, this.pz = n, e == null || !o.isValid(e)) throw Error("x required");
|
|
108
|
+
if (t == null || !o.isValid(t)) throw Error("y required");
|
|
109
|
+
if (n == null || !o.isValid(n)) throw Error("z required");
|
|
110
|
+
}
|
|
111
|
+
static fromAffine(e) {
|
|
112
|
+
let { x: t, y: n } = e || {};
|
|
113
|
+
if (!e || !o.isValid(t) || !o.isValid(n)) throw Error("invalid affine point");
|
|
114
|
+
if (e instanceof v) throw Error("projective point not allowed");
|
|
115
|
+
let r = (e) => o.eql(e, o.ZERO);
|
|
116
|
+
return r(t) && r(n) ? v.ZERO : new v(t, n, o.ONE);
|
|
117
|
+
}
|
|
118
|
+
get x() {
|
|
119
|
+
return this.toAffine().x;
|
|
120
|
+
}
|
|
121
|
+
get y() {
|
|
122
|
+
return this.toAffine().y;
|
|
123
|
+
}
|
|
124
|
+
static normalizeZ(e) {
|
|
125
|
+
let t = o.invertBatch(e.map((e) => e.pz));
|
|
126
|
+
return e.map((e, n) => e.toAffine(t[n])).map(v.fromAffine);
|
|
127
|
+
}
|
|
128
|
+
static fromHex(e) {
|
|
129
|
+
let t = v.fromAffine(c(a("pointHex", e)));
|
|
130
|
+
return t.assertValidity(), t;
|
|
131
|
+
}
|
|
132
|
+
static fromPrivateKey(e) {
|
|
133
|
+
return v.BASE.multiply(p(e));
|
|
134
|
+
}
|
|
135
|
+
_setWindowSize(e) {
|
|
136
|
+
this._WINDOW_SIZE = e, g.delete(this);
|
|
137
|
+
}
|
|
138
|
+
assertValidity() {
|
|
139
|
+
if (this.is0()) {
|
|
140
|
+
if (i.allowInfinityPoint) return;
|
|
141
|
+
throw Error("bad point: ZERO");
|
|
142
|
+
}
|
|
143
|
+
let { x: e, y: t } = this.toAffine();
|
|
144
|
+
if (!o.isValid(e) || !o.isValid(t)) throw Error("bad point: x or y not FE");
|
|
145
|
+
let n = o.sqr(t), r = l(e);
|
|
146
|
+
if (!o.eql(n, r)) throw Error("bad point: equation left != right");
|
|
147
|
+
if (!this.isTorsionFree()) throw Error("bad point: not in prime-order subgroup");
|
|
148
|
+
}
|
|
149
|
+
hasEvenY() {
|
|
150
|
+
let { y: e } = this.toAffine();
|
|
151
|
+
if (o.isOdd) return !o.isOdd(e);
|
|
152
|
+
throw Error("Field doesn't support isOdd");
|
|
153
|
+
}
|
|
154
|
+
equals(e) {
|
|
155
|
+
_(e);
|
|
156
|
+
let { px: t, py: n, pz: r } = this, { px: i, py: a, pz: s } = e, c = o.eql(o.mul(t, s), o.mul(i, r)), l = o.eql(o.mul(n, s), o.mul(a, r));
|
|
157
|
+
return c && l;
|
|
158
|
+
}
|
|
159
|
+
negate() {
|
|
160
|
+
return new v(this.px, o.neg(this.py), this.pz);
|
|
161
|
+
}
|
|
162
|
+
double() {
|
|
163
|
+
let { a: e, b: t } = i, n = o.mul(t, x), { px: r, py: a, pz: s } = this, c = o.ZERO, l = o.ZERO, u = o.ZERO, d = o.mul(r, r), f = o.mul(a, a), p = o.mul(s, s), m = o.mul(r, a);
|
|
164
|
+
return m = o.add(m, m), u = o.mul(r, s), u = o.add(u, u), c = o.mul(e, u), l = o.mul(n, p), l = o.add(c, l), c = o.sub(f, l), l = o.add(f, l), l = o.mul(c, l), c = o.mul(m, c), u = o.mul(n, u), p = o.mul(e, p), m = o.sub(d, p), m = o.mul(e, m), m = o.add(m, u), u = o.add(d, d), d = o.add(u, d), d = o.add(d, p), d = o.mul(d, m), l = o.add(l, d), p = o.mul(a, s), p = o.add(p, p), d = o.mul(p, m), c = o.sub(c, d), u = o.mul(p, f), u = o.add(u, u), u = o.add(u, u), new v(c, l, u);
|
|
165
|
+
}
|
|
166
|
+
add(e) {
|
|
167
|
+
_(e);
|
|
168
|
+
let { px: t, py: n, pz: r } = this, { px: a, py: s, pz: c } = e, l = o.ZERO, u = o.ZERO, d = o.ZERO, f = i.a, p = o.mul(i.b, x), m = o.mul(t, a), h = o.mul(n, s), g = o.mul(r, c), y = o.add(t, n), b = o.add(a, s);
|
|
169
|
+
y = o.mul(y, b), b = o.add(m, h), y = o.sub(y, b), b = o.add(t, r);
|
|
170
|
+
let S = o.add(a, c);
|
|
171
|
+
return b = o.mul(b, S), S = o.add(m, g), b = o.sub(b, S), S = o.add(n, r), l = o.add(s, c), S = o.mul(S, l), l = o.add(h, g), S = o.sub(S, l), d = o.mul(f, b), l = o.mul(p, g), d = o.add(l, d), l = o.sub(h, d), d = o.add(h, d), u = o.mul(l, d), h = o.add(m, m), h = o.add(h, m), g = o.mul(f, g), b = o.mul(p, b), h = o.add(h, g), g = o.sub(m, g), g = o.mul(f, g), b = o.add(b, g), m = o.mul(h, b), u = o.add(u, m), m = o.mul(S, b), l = o.mul(y, l), l = o.sub(l, m), m = o.mul(y, h), d = o.mul(S, d), d = o.add(d, m), new v(l, u, d);
|
|
172
|
+
}
|
|
173
|
+
subtract(e) {
|
|
174
|
+
return this.add(e.negate());
|
|
175
|
+
}
|
|
176
|
+
is0() {
|
|
177
|
+
return this.equals(v.ZERO);
|
|
178
|
+
}
|
|
179
|
+
wNAF(e) {
|
|
180
|
+
return C.wNAFCached(this, g, e, (e) => {
|
|
181
|
+
let t = o.invertBatch(e.map((e) => e.pz));
|
|
182
|
+
return e.map((e, n) => e.toAffine(t[n])).map(v.fromAffine);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
multiplyUnsafe(e) {
|
|
186
|
+
let t = v.ZERO;
|
|
187
|
+
if (e === y) return t;
|
|
188
|
+
if (d(e), e === b) return this;
|
|
189
|
+
let { endo: n } = i;
|
|
190
|
+
if (!n) return C.unsafeLadder(this, e);
|
|
191
|
+
let { k1neg: r, k1: a, k2neg: s, k2: c } = n.splitScalar(e), l = t, u = t, f = this;
|
|
192
|
+
for (; a > y || c > y;) a & b && (l = l.add(f)), c & b && (u = u.add(f)), f = f.double(), a >>= b, c >>= b;
|
|
193
|
+
return r && (l = l.negate()), s && (u = u.negate()), u = new v(o.mul(u.px, n.beta), u.py, u.pz), l.add(u);
|
|
194
|
+
}
|
|
195
|
+
multiply(e) {
|
|
196
|
+
d(e);
|
|
197
|
+
let t = e, n, r, { endo: a } = i;
|
|
198
|
+
if (a) {
|
|
199
|
+
let { k1neg: e, k1: i, k2neg: s, k2: c } = a.splitScalar(t), { p: l, f: u } = this.wNAF(i), { p: d, f } = this.wNAF(c);
|
|
200
|
+
l = C.constTimeNegate(e, l), d = C.constTimeNegate(s, d), d = new v(o.mul(d.px, a.beta), d.py, d.pz), n = l.add(d), r = u.add(f);
|
|
201
|
+
} else {
|
|
202
|
+
let { p: e, f: i } = this.wNAF(t);
|
|
203
|
+
n = e, r = i;
|
|
204
|
+
}
|
|
205
|
+
return v.normalizeZ([n, r])[0];
|
|
206
|
+
}
|
|
207
|
+
multiplyAndAddUnsafe(e, t, n) {
|
|
208
|
+
let r = v.BASE, i = (e, t) => t === y || t === b || !e.equals(r) ? e.multiplyUnsafe(t) : e.multiply(t), a = i(this, t).add(i(e, n));
|
|
209
|
+
return a.is0() ? void 0 : a;
|
|
210
|
+
}
|
|
211
|
+
toAffine(e) {
|
|
212
|
+
let { px: t, py: n, pz: r } = this, i = this.is0();
|
|
213
|
+
e ??= i ? o.ONE : o.inv(r);
|
|
214
|
+
let a = o.mul(t, e), s = o.mul(n, e), c = o.mul(r, e);
|
|
215
|
+
if (i) return {
|
|
216
|
+
x: o.ZERO,
|
|
217
|
+
y: o.ZERO
|
|
218
|
+
};
|
|
219
|
+
if (!o.eql(c, o.ONE)) throw Error("invZ was invalid");
|
|
220
|
+
return {
|
|
221
|
+
x: a,
|
|
222
|
+
y: s
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
isTorsionFree() {
|
|
226
|
+
let { h: e, isTorsionFree: t } = i;
|
|
227
|
+
if (e === b) return !0;
|
|
228
|
+
if (t) return t(v, this);
|
|
229
|
+
throw Error("isTorsionFree() has not been declared for the elliptic curve");
|
|
230
|
+
}
|
|
231
|
+
clearCofactor() {
|
|
232
|
+
let { h: e, clearCofactor: t } = i;
|
|
233
|
+
return e === b ? this : t ? t(v, this) : this.multiplyUnsafe(i.h);
|
|
234
|
+
}
|
|
235
|
+
toRawBytes(e = !0) {
|
|
236
|
+
return this.assertValidity(), s(v, this, e);
|
|
237
|
+
}
|
|
238
|
+
toHex(e = !0) {
|
|
239
|
+
return t(this.toRawBytes(e));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
v.BASE = new v(i.Gx, i.Gy, o.ONE), v.ZERO = new v(o.ZERO, o.ONE, o.ZERO);
|
|
243
|
+
let S = i.nBitLength, C = m(v, i.endo ? Math.ceil(S / 2) : S);
|
|
244
|
+
return {
|
|
245
|
+
CURVE: i,
|
|
246
|
+
ProjectivePoint: v,
|
|
247
|
+
normPrivateKeyToScalar: p,
|
|
248
|
+
weierstrassEquation: l,
|
|
249
|
+
isWithinCurveOrder: u
|
|
250
|
+
};
|
|
330
251
|
}
|
|
331
|
-
function
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
252
|
+
function C(e) {
|
|
253
|
+
let t = p(e);
|
|
254
|
+
return l(t, {
|
|
255
|
+
hash: "hash",
|
|
256
|
+
hmac: "function",
|
|
257
|
+
randomBytes: "function"
|
|
258
|
+
}, {
|
|
259
|
+
bits2int: "function",
|
|
260
|
+
bits2int_modN: "function",
|
|
261
|
+
lowS: "boolean"
|
|
262
|
+
}), Object.freeze({
|
|
263
|
+
lowS: !0,
|
|
264
|
+
...t
|
|
265
|
+
});
|
|
342
266
|
}
|
|
343
|
-
function
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
const { r: V, s: M } = w;
|
|
549
|
-
I = new s(V, M);
|
|
550
|
-
} else
|
|
551
|
-
throw new Error("PARSE");
|
|
552
|
-
D = x.fromHex(l);
|
|
553
|
-
} catch (V) {
|
|
554
|
-
if (V.message === "PARSE")
|
|
555
|
-
throw new Error("signature must be Signature instance, Uint8Array or hex string");
|
|
556
|
-
return !1;
|
|
557
|
-
}
|
|
558
|
-
if (R && I.hasHighS())
|
|
559
|
-
return !1;
|
|
560
|
-
q && (o = n.hash(o));
|
|
561
|
-
const { r: K, s: X } = I, Q = c(o), $ = P(X), tt = S(Q * $), j = S(K * $), G = x.BASE.multiplyAndAddUnsafe(D, tt, j)?.toAffine();
|
|
562
|
-
return G ? S(G.x) === K : !1;
|
|
563
|
-
}
|
|
564
|
-
return {
|
|
565
|
-
CURVE: n,
|
|
566
|
-
getPublicKey: f,
|
|
567
|
-
getSharedSecret: h,
|
|
568
|
-
sign: Z,
|
|
569
|
-
verify: H,
|
|
570
|
-
ProjectivePoint: x,
|
|
571
|
-
Signature: s,
|
|
572
|
-
utils: u
|
|
573
|
-
};
|
|
267
|
+
function w(c) {
|
|
268
|
+
let l = C(c), { Fp: p, n: m } = l, h = p.BYTES + 1, g = 2 * p.BYTES + 1;
|
|
269
|
+
function _(e) {
|
|
270
|
+
return y < e && e < p.ORDER;
|
|
271
|
+
}
|
|
272
|
+
function x(e) {
|
|
273
|
+
return f(e, m);
|
|
274
|
+
}
|
|
275
|
+
function w(e) {
|
|
276
|
+
return d(e, m);
|
|
277
|
+
}
|
|
278
|
+
let { ProjectivePoint: T, normPrivateKeyToScalar: E, weierstrassEquation: D, isWithinCurveOrder: O } = S({
|
|
279
|
+
...l,
|
|
280
|
+
toBytes(e, t, n) {
|
|
281
|
+
let i = t.toAffine(), a = p.toBytes(i.x), o = r;
|
|
282
|
+
return n ? o(Uint8Array.from([t.hasEvenY() ? 2 : 3]), a) : o(Uint8Array.from([4]), a, p.toBytes(i.y));
|
|
283
|
+
},
|
|
284
|
+
fromBytes(e) {
|
|
285
|
+
let t = e.length, r = e[0], i = e.subarray(1);
|
|
286
|
+
if (t === h && (r === 2 || r === 3)) {
|
|
287
|
+
let e = n(i);
|
|
288
|
+
if (!_(e)) throw Error("Point is not on curve");
|
|
289
|
+
let t = D(e), a = p.sqrt(t), o = (a & b) === b;
|
|
290
|
+
return (r & 1) == 1 !== o && (a = p.neg(a)), {
|
|
291
|
+
x: e,
|
|
292
|
+
y: a
|
|
293
|
+
};
|
|
294
|
+
} else if (t === g && r === 4) return {
|
|
295
|
+
x: p.fromBytes(i.subarray(0, p.BYTES)),
|
|
296
|
+
y: p.fromBytes(i.subarray(p.BYTES, 2 * p.BYTES))
|
|
297
|
+
};
|
|
298
|
+
else throw Error(`Point of length ${t} was invalid. Expected ${h} compressed bytes or ${g} uncompressed bytes`);
|
|
299
|
+
}
|
|
300
|
+
}), k = (e) => t(s(e, l.nByteLength));
|
|
301
|
+
function A(e) {
|
|
302
|
+
return e > m >> b;
|
|
303
|
+
}
|
|
304
|
+
function j(e) {
|
|
305
|
+
return A(e) ? x(-e) : e;
|
|
306
|
+
}
|
|
307
|
+
let M = (e, t, r) => n(e.slice(t, r));
|
|
308
|
+
class N {
|
|
309
|
+
constructor(e, t, n) {
|
|
310
|
+
this.r = e, this.s = t, this.recovery = n, this.assertValidity();
|
|
311
|
+
}
|
|
312
|
+
static fromCompact(e) {
|
|
313
|
+
let t = l.nByteLength;
|
|
314
|
+
return e = a("compactSignature", e, t * 2), new N(M(e, 0, t), M(e, t, 2 * t));
|
|
315
|
+
}
|
|
316
|
+
static fromDER(e) {
|
|
317
|
+
let { r: t, s: n } = v.toSig(a("DER", e));
|
|
318
|
+
return new N(t, n);
|
|
319
|
+
}
|
|
320
|
+
assertValidity() {
|
|
321
|
+
if (!O(this.r)) throw Error("r must be 0 < r < CURVE.n");
|
|
322
|
+
if (!O(this.s)) throw Error("s must be 0 < s < CURVE.n");
|
|
323
|
+
}
|
|
324
|
+
addRecoveryBit(e) {
|
|
325
|
+
return new N(this.r, this.s, e);
|
|
326
|
+
}
|
|
327
|
+
recoverPublicKey(e) {
|
|
328
|
+
let { r: t, s: n, recovery: r } = this, i = z(a("msgHash", e));
|
|
329
|
+
if (r == null || ![
|
|
330
|
+
0,
|
|
331
|
+
1,
|
|
332
|
+
2,
|
|
333
|
+
3
|
|
334
|
+
].includes(r)) throw Error("recovery id invalid");
|
|
335
|
+
let o = r === 2 || r === 3 ? t + l.n : t;
|
|
336
|
+
if (o >= p.ORDER) throw Error("recovery id 2 or 3 invalid");
|
|
337
|
+
let s = r & 1 ? "03" : "02", c = T.fromHex(s + k(o)), u = w(o), d = x(-i * u), f = x(n * u), m = T.BASE.multiplyAndAddUnsafe(c, d, f);
|
|
338
|
+
if (!m) throw Error("point at infinify");
|
|
339
|
+
return m.assertValidity(), m;
|
|
340
|
+
}
|
|
341
|
+
hasHighS() {
|
|
342
|
+
return A(this.s);
|
|
343
|
+
}
|
|
344
|
+
normalizeS() {
|
|
345
|
+
return this.hasHighS() ? new N(this.r, x(-this.s), this.recovery) : this;
|
|
346
|
+
}
|
|
347
|
+
toDERRawBytes() {
|
|
348
|
+
return o(this.toDERHex());
|
|
349
|
+
}
|
|
350
|
+
toDERHex() {
|
|
351
|
+
return v.hexFromSig({
|
|
352
|
+
r: this.r,
|
|
353
|
+
s: this.s
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
toCompactRawBytes() {
|
|
357
|
+
return o(this.toCompactHex());
|
|
358
|
+
}
|
|
359
|
+
toCompactHex() {
|
|
360
|
+
return k(this.r) + k(this.s);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
let P = {
|
|
364
|
+
isValidPrivateKey(e) {
|
|
365
|
+
try {
|
|
366
|
+
return E(e), !0;
|
|
367
|
+
} catch {
|
|
368
|
+
return !1;
|
|
369
|
+
}
|
|
370
|
+
},
|
|
371
|
+
normPrivateKeyToScalar: E,
|
|
372
|
+
randomPrivateKey: () => s(u(l.randomBytes(p.BYTES + 8), m), l.nByteLength),
|
|
373
|
+
precompute(e = 8, t = T.BASE) {
|
|
374
|
+
return t._setWindowSize(e), t.multiply(BigInt(3)), t;
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
function F(e, t = !0) {
|
|
378
|
+
return T.fromPrivateKey(e).toRawBytes(t);
|
|
379
|
+
}
|
|
380
|
+
function I(e) {
|
|
381
|
+
let t = e instanceof Uint8Array, n = typeof e == "string", r = (t || n) && e.length;
|
|
382
|
+
return t ? r === h || r === g : n ? r === 2 * h || r === 2 * g : e instanceof T;
|
|
383
|
+
}
|
|
384
|
+
function L(e, t, n = !0) {
|
|
385
|
+
if (I(e)) throw Error("first arg must be private key");
|
|
386
|
+
if (!I(t)) throw Error("second arg must be public key");
|
|
387
|
+
return T.fromHex(t).multiply(E(e)).toRawBytes(n);
|
|
388
|
+
}
|
|
389
|
+
let R = l.bits2int || function(e) {
|
|
390
|
+
let t = n(e), r = e.length * 8 - l.nBitLength;
|
|
391
|
+
return r > 0 ? t >> BigInt(r) : t;
|
|
392
|
+
}, z = l.bits2int_modN || function(e) {
|
|
393
|
+
return x(R(e));
|
|
394
|
+
}, B = e(l.nBitLength);
|
|
395
|
+
function V(e) {
|
|
396
|
+
if (typeof e != "bigint") throw Error("bigint expected");
|
|
397
|
+
if (!(y <= e && e < B)) throw Error(`bigint expected < 2^${l.nBitLength}`);
|
|
398
|
+
return s(e, l.nByteLength);
|
|
399
|
+
}
|
|
400
|
+
function H(e, t, n = U) {
|
|
401
|
+
if (["recovered", "canonical"].some((e) => e in n)) throw Error("sign() legacy options not supported");
|
|
402
|
+
let { hash: i, randomBytes: o } = l, { lowS: s, prehash: c, extraEntropy: u } = n;
|
|
403
|
+
s ??= !0, e = a("msgHash", e), c && (e = a("prehashed msgHash", i(e)));
|
|
404
|
+
let d = z(e), f = E(t), m = [V(f), V(d)];
|
|
405
|
+
if (u != null) {
|
|
406
|
+
let e = u === !0 ? o(p.BYTES) : u;
|
|
407
|
+
m.push(a("extraEntropy", e, p.BYTES));
|
|
408
|
+
}
|
|
409
|
+
let h = r(...m), g = d;
|
|
410
|
+
function _(e) {
|
|
411
|
+
let t = R(e);
|
|
412
|
+
if (!O(t)) return;
|
|
413
|
+
let n = w(t), r = T.BASE.multiply(t).toAffine(), i = x(r.x);
|
|
414
|
+
if (i === y) return;
|
|
415
|
+
let a = x(n * x(g + i * f));
|
|
416
|
+
if (a === y) return;
|
|
417
|
+
let o = (r.x === i ? 0 : 2) | Number(r.y & b), c = a;
|
|
418
|
+
return s && A(a) && (c = j(a), o ^= 1), new N(i, c, o);
|
|
419
|
+
}
|
|
420
|
+
return {
|
|
421
|
+
seed: h,
|
|
422
|
+
k2sig: _
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
let U = {
|
|
426
|
+
lowS: l.lowS,
|
|
427
|
+
prehash: !1
|
|
428
|
+
}, W = {
|
|
429
|
+
lowS: l.lowS,
|
|
430
|
+
prehash: !1
|
|
431
|
+
};
|
|
432
|
+
function G(e, t, n = U) {
|
|
433
|
+
let { seed: r, k2sig: a } = H(e, t, n);
|
|
434
|
+
return i(l.hash.outputLen, l.nByteLength, l.hmac)(r, a);
|
|
435
|
+
}
|
|
436
|
+
T.BASE._setWindowSize(8);
|
|
437
|
+
function K(e, t, n, r = W) {
|
|
438
|
+
let i = e;
|
|
439
|
+
if (t = a("msgHash", t), n = a("publicKey", n), "strict" in r) throw Error("options.strict was renamed to lowS");
|
|
440
|
+
let { lowS: o, prehash: s } = r, c, u;
|
|
441
|
+
try {
|
|
442
|
+
if (typeof i == "string" || i instanceof Uint8Array) try {
|
|
443
|
+
c = N.fromDER(i);
|
|
444
|
+
} catch (e) {
|
|
445
|
+
if (!(e instanceof v.Err)) throw e;
|
|
446
|
+
c = N.fromCompact(i);
|
|
447
|
+
}
|
|
448
|
+
else if (typeof i == "object" && typeof i.r == "bigint" && typeof i.s == "bigint") {
|
|
449
|
+
let { r: e, s: t } = i;
|
|
450
|
+
c = new N(e, t);
|
|
451
|
+
} else throw Error("PARSE");
|
|
452
|
+
u = T.fromHex(n);
|
|
453
|
+
} catch (e) {
|
|
454
|
+
if (e.message === "PARSE") throw Error("signature must be Signature instance, Uint8Array or hex string");
|
|
455
|
+
return !1;
|
|
456
|
+
}
|
|
457
|
+
if (o && c.hasHighS()) return !1;
|
|
458
|
+
s && (t = l.hash(t));
|
|
459
|
+
let { r: d, s: f } = c, p = z(t), m = w(f), h = x(p * m), g = x(d * m), _ = T.BASE.multiplyAndAddUnsafe(u, h, g)?.toAffine();
|
|
460
|
+
return _ ? x(_.x) === d : !1;
|
|
461
|
+
}
|
|
462
|
+
return {
|
|
463
|
+
CURVE: l,
|
|
464
|
+
getPublicKey: F,
|
|
465
|
+
getSharedSecret: L,
|
|
466
|
+
sign: G,
|
|
467
|
+
verify: K,
|
|
468
|
+
ProjectivePoint: T,
|
|
469
|
+
Signature: N,
|
|
470
|
+
utils: P
|
|
471
|
+
};
|
|
574
472
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
Ot as weierstrass,
|
|
578
|
-
Bt as weierstrassPoints
|
|
579
|
-
};
|
|
473
|
+
//#endregion
|
|
474
|
+
export { w as weierstrass };
|