wallaby-cash 3.19.0 → 3.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-41IbhfX7.cjs"),t=require("bip39"),r=require("uuid"),s=require("loglevel"),a=require("crypto-js"),n=require("jwt-decode"),i=require("@simplewebauthn/browser"),o=require("js-base64"),c=require("@truestamp/canonify"),d=require("scale-ts"),l=e=>e&&"object"==typeof e&&"default"in e?e:{default:e};function u(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const h=u(t),p=l(s),f=u(i);var y,g,w,m,v,S,b,A,E,_,I,k,T,P,C,x,O,K,N,R,D,L,B,U,q,M;exports.PasskeyChallengeType=void 0,(y=exports.PasskeyChallengeType||(exports.PasskeyChallengeType={})).REGISTRATION="webauthn.create",y.AUTHENTICATION="webauthn.get",exports.PublicKeyCredentialAlgorithm=void 0,(g=exports.PublicKeyCredentialAlgorithm||(exports.PublicKeyCredentialAlgorithm={}))[g.RS256=-257]="RS256",g[g.ES256=-7]="ES256",exports.TransportEnum=void 0,(w=exports.TransportEnum||(exports.TransportEnum={})).Usb="usb",w.Nfc="nfc",w.Ble="ble",w.Internal="internal",w.Hybrid="hybrid";class V extends Error{constructor(e){var t;const{message:r,statusCode:s,errorCode:a,kind:n,data:i,cause:o,onError:c}=e;super(r),this.name="WallabyError",this.status=s,this.errorCode=a,this.kind=null!=n?n:V.inferKind(s,a),this.cause=o,this.onError=c,this.data=i,Object.setPrototypeOf(this,new.target.prototype),null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,new.target)}static isWallabyError(e){return e instanceof V}static inferKind(e,t){return 0===e?"network":"device_storage_unsupported"===t||(null==t?void 0:t.startsWith("sdk_"))?"sdk":"api"}toJSON(){return{name:this.name,message:this.message,kind:this.kind,status:this.status,errorCode:this.errorCode,data:this.data}}}exports.UserAssetSource=void 0,(m=exports.UserAssetSource||(exports.UserAssetSource={})).Merchant="merchant",m.User="user",m.republic="republic",exports.AssetConfigStatus=void 0,(v=exports.AssetConfigStatus||(exports.AssetConfigStatus={})).Active="active",v.Inactive="inactive",exports.AssetType=void 0,(S=exports.AssetType||(exports.AssetType={})).Coin="COIN",S.Token="TOKEN",exports.OwnershipType=void 0,(b=exports.OwnershipType||(exports.OwnershipType={})).SingleOwner="SINGLE_OWNER",b.MultiSig="MULTI_SIG",exports.TokenStandard=void 0,(A=exports.TokenStandard||(exports.TokenStandard={})).Erc20="ERC_20",A.Erc1404="ERC_1404",A.Arc20="ARC_20",A.Arc1404="ARC_1404",A.Mrc20="MRC_20",A.Bep20="BEP_20",A.AlgoStandard="ALGO_STANDARD",A.AlgoApp="ALGO_APP",A.TokenFactory="TOKEN_FACTORY",A.SeiErc20="SEI_ERC_20",A.AptFA="APT_FUNGIBLE_ASSET",exports.AddressType=void 0,(E=exports.AddressType||(exports.AddressType={})).Segwit="SEGWIT",E.Legacy="LEGACY",E.Default="DEFAULT",exports.BlockchainStatus=void 0,(_=exports.BlockchainStatus||(exports.BlockchainStatus={})).Up="UP",_.Down="DOWN",exports.BlockchainSlip44=void 0,(I=exports.BlockchainSlip44||(exports.BlockchainSlip44={}))[I.BTC=0]="BTC",I[I.ETH=60]="ETH",I[I.ALGO=283]="ALGO",I[I.AVAX=9e3]="AVAX",I[I.MATIC=966]="MATIC",I[I.BSC=519]="BSC",I[I.BASE=8453]="BASE",I[I.SUI=784]="SUI",I[I.INJ=2525]="INJ",I[I.SEI=19000118]="SEI",I[I.APT=637]="APT",I[I.HBAR=3030]="HBAR",I[I.POLYX=595]="POLYX",exports.BlockchainName=void 0,(k=exports.BlockchainName||(exports.BlockchainName={})).Algorand="ALGORAND",k.Aptos="APTOS",k.Avalanche="AVALANCHE",k.Base="BASE",k.Bitcoin="BITCOIN",k.Bsc="BSC",k.Canton="CANTON",k.Ethereum="ETHEREUM",k.Hedera="HEDERA",k.Injective="INJECTIVE",k.Polygon="POLYGON",k.Polymesh="POLYMESH",k.Sei="SEI",k.Sui="SUI",k.Solana="SOLANA",exports.RequestMethod=void 0,(T=exports.RequestMethod||(exports.RequestMethod={})).Post="POST",T.Get="GET",T.Put="PUT",T.Delete="DELETE",exports.ApiKeyStatus=void 0,(P=exports.ApiKeyStatus||(exports.ApiKeyStatus={})).Active="active",P.Inactive="inactive",exports.TransactionEntryType=void 0,(C=exports.TransactionEntryType||(exports.TransactionEntryType={})).INCOMING="INCOMING",C.OUTGOING="OUTGOING",C.UNKNOWN="UNKNOWN",exports.KeyTypeName=void 0,(x=exports.KeyTypeName||(exports.KeyTypeName={})).WallabyShare="wallaby_share",x.OwnerMainDeviceShare="owner_main_device_share",x.OwnerBackupDeviceShare="owner_backup_device_share",exports.SeedPhraseType=void 0,(O=exports.SeedPhraseType||(exports.SeedPhraseType={})).Standard="standard",O.Algorand="algorand",exports.WalletAddressTypeName=void 0,(K=exports.WalletAddressTypeName||(exports.WalletAddressTypeName={})).BTC_MAINNET_SEGWIT="BTC:MAINNET:SEGWIT",K.BTC_MAINNET_LEGACY="BTC:MAINNET:LEGACY",K.BTC_TESTNET_SEGWIT="BTC:TESTNET:SEGWIT",K.BTC_TESTNET_LEGACY="BTC:TESTNET:LEGACY",K.ETH="ETH:ALL:DEFAULT",K.ALGO="ALGO:ALL:DEFAULT",K.SUI="SUI:ALL:DEFAULT",K.INJ="INJ:ALL:DEFAULT",K.APT="APT:ALL:DEFAULT",K.POLYX="POLYX:ALL:DEFAULT",K.BSC="BSC:ALL:DEFAULT",K.AVAX="AVAX:ALL:DEFAULT",K.MATIC="MATIC:ALL:DEFAULT",K.BASE="BASE:ALL:DEFAULT",K.SEI="SEI:ALL:DEFAULT",K.HBAR="HBAR:ALL:DEFAULT",K.CC="CC:ALL:DEFAULT",exports.ReturnWalletOption=void 0,(N=exports.ReturnWalletOption||(exports.ReturnWalletOption={})).ReturnOnlyEncryptedShares="RETURN_ONLY_ENCRYPTED_SHARES",N.ReturnOnlyEncryptedSeedPhrase="RETURN_ONLY_ENCRYPTED_SEED_PHRASE",N.ReturnBothEncryptedSharesAndSeed="RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED",exports.WalletOwnershipType=void 0,(R=exports.WalletOwnershipType||(exports.WalletOwnershipType={})).SingleOwner="SINGLE_OWNER",R.MultiOwner="MULTI_OWNER",exports.AuthType=void 0,(D=exports.AuthType||(exports.AuthType={})).Password="password",D.Passkey="passkey",exports.LocalStorageItems=void 0,(L=exports.LocalStorageItems||(exports.LocalStorageItems={})).AccessToken="access-token",L.RefreshToken="refresh-token",L.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",L.EncryptedKeyShares="encrypted-key-shares",L.PrimaryDeviceKeyShare="primary-device-key-share",L.BackupDeviceKeyShare="backup-device-key-share",L.EncryptedShare="encrypted-share",L.EncryptedAlgorandSeedPhrase="encrypted-algorand-seedPhrase",L.EncryptedDevicePrivateKey="encrypted-private-key",L.ClientAuthPublicKey="client-auth-pub-key",L.ClientAuthToken="republic-jwt",L.PasskeyCredential="pass-key-credential",L.PasskeyCredentialId="passkey-credential-id",L.Blob="blob",exports.LegacyKeyNames=void 0,(B=exports.LegacyKeyNames||(exports.LegacyKeyNames={})).EncryptedPrivateKey="encryptedPrivateKey",B.WallabyAuthPubKey="wallabyAuthPubKey",B.EncryptedAlgorandSeed="encryptedAlgorandSeed",B.EncryptedSeed="encryptedSeed",B.ClientAuthToken="republic_jwt",B.AccessToken="accessToken",exports.V1KeyNames=void 0,(U=exports.V1KeyNames||(exports.V1KeyNames={})).AccessToken="access-token",U.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",U.EncryptedAlgorandSeedPhrase="encrypted-algorand-seedPhrase",U.EncryptedDevicePrivateKey="encrypted-private-key",U.ClientAuthPublicKey="client-auth-pub-key",U.WallabyAuthPubKey="wallaby-auth-pub-key",U.ClientAuthToken="republic-jwt",exports.V2KeyNames=void 0,(q=exports.V2KeyNames||(exports.V2KeyNames={})).AccessToken="access-token",q.RefreshToken="refresh-token",q.BackupDeviceKeyShare="backup-device-key-share",q.ClientAuthPublicKey="client-auth-pub-key",q.ClientAuthToken="republic-jwt",q.EncryptedDevicePrivateKey="encrypted-private-key",q.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",q.PasskeyCredential="pass-key-credential",q.PrimaryDeviceKeyShare="primary-device-key-share",q.WallabyAuthPubKey="wallaby-auth-pub-key",q.MigrationVersion="wsdk_migrated_with_version",q.LastMigratedAt="wsdk_last_migrated_at",q.PasswordResetAttempts="wsdk_password_reset_attempts",q.MigrationAttempts="wsdk_migration_attempts",q.CredentialConversionInProgress="credential-conversion-in-progress",q.PendingCommit="pending-commit",q.LegacySeedClaimedWalletId="wsdk_legacy_seed_claimed_wallet_id",exports.ErrorResponseCodes=void 0,(M=exports.ErrorResponseCodes||(exports.ErrorResponseCodes={})).unknown_error="unknown_error",M.internal_server_error="internal_server_error",M.request_payload_missing="request_payload_missing",M.request_payload_wrong_format="request_payload_wrong_format",M.auth_api_key_invalid="auth_api_key_invalid",M.auth_api_key_not_active="auth_api_key_not_active",M.auth_api_key_pub_key_not_set="auth_api_key_pub_key_not_set",M.auth_api_key_pub_key_already_in_use="auth_api_key_pub_key_already_in_use",M.auth_api_key_not_provided="auth_api_key_not_provided",M.auth_api_key_not_found="auth_api_key_not_found",M.auth_origin_not_allowed="auth_origin_not_allowed",M.auth_api_jwt_invalid="auth_api_jwt_invalid",M.auth_api_jwt_not_active="auth_api_jwt_not_active",M.auth_api_jwt_not_provided="auth_api_jwt_not_provided",M.auth_api_jwt_expired="auth_api_jwt_expired",M.auth_api_unauthorized="auth_api_unauthorized",M.auth_client_jwt_invalid="auth_client_jwt_invalid",M.auth_client_jwt_missing_external_id_payload="auth_client_jwt_missing_external_id_payload",M.auth_client_jwt_missing_exp_payload="auth_client_jwt_missing_exp_payload",M.auth_client_jwt_external_id_not_match="auth_client_jwt_external_id_not_match",M.auth_client_jwt_expired="auth_client_jwt_expired",M.auth_client_jwt_not_provided="auth_client_jwt_not_provided",M.auth_client_jwt_invalid_auth_type="auth_client_jwt_invalid_auth_type",M.auth_client_jwt_invalid_passkey="auth_client_jwt_invalid_passkey",M.auth_client_pub_key_and_message_not_match="auth_client_pub_key_and_message_not_match",M.auth_client_pub_key_and_message_expired="auth_client_pub_key_and_message_expired",M.auth_client_pub_key_and_message_signature_failed="auth_client_pub_key_and_message_signature_failed",M.auth_client_pub_key_not_found="auth_client_pub_key_not_found",M.auth_client_pub_key_already_registered="auth_client_pub_key_already_registered",M.auth_user_not_allowed_to_perform_the_action="auth_user_not_allowed_to_perform_the_action",M.auth_upside_signature_not_provided="auth_upside_signature_not_provided",M.auth_upside_signature_invalid="auth_upside_signature_invalid",M.auth_upside_wrong_base64_signature="auth_upside_wrong_base64_signature",M.multisig_participant_not_found="multisig_participant_not_found",M.wallet_not_found="wallet_not_found",M.wallet_recovery_seed_mismatch="wallet_recovery_seed_mismatch",M.wallet_address_not_found="wallet_address_not_found",M.wallet_address_generation_failed="wallet_address_generation_failed",M.invalid_public_key="invalid_public_key",M.canton_registration_daily_limit_exceeded="canton_registration_daily_limit_exceeded",M.asset_not_found="asset_not_found",M.seedphrase_could_not_be_decrypted="seedphrase_could_not_be_decrypted",M.invalid_seed_phrase="invalid_seed_phrase",M.user_already_exists="user_already_exists",M.user_not_found="user_not_found",M.otp_code_invalid="otp_code_invalid",M.otp_code_expired="otp_code_expired",M.merchant_not_found="merchant_not_found",M.swap_provider_not_found="swap_provider_not_found",M.swap_chain_not_supported="swap_chain_not_supported",M.swap_asset_not_supported="swap_asset_not_supported",M.swap_quote_executing="swap_quote_executing",M.swap_quote_in_progress="swap_quote_in_progress",M.swap_quote_completed="swap_quote_completed",M.swap_quote_failed="swap_quote_failed",M.swap_quote_abandoned="swap_quote_abandoned",M.swap_quote_execution_failed="swap_quote_execution_failed",M.swap_quote_invalid="swap_quote_invalid",M.feature_not_enabled="feature_not_enabled",M.insufficient_balance="insufficient_balance",M.transaction_failed="transaction_failed",M.invalid_number_of_signatures="invalid_number_of_signatures",M.invalid_signature="invalid_signature",M.chain_adapter_not_found="chain_adapter_not_found",M.chain_not_found="chain_not_found",M.invalid_address="invalid_address",M.auth_refresh_token_not_found="auth_refresh_token_not_found",M.auth_refresh_token_expired="auth_refresh_token_expired",M.auth_refresh_token_reuse_detected="auth_refresh_token_reuse_detected",M.sdk_jwt_invalid="sdk_jwt_invalid",M.sdk_jwt_expired="sdk_jwt_expired",M.sdk_unknown_error="sdk_unknown_error",M.sdk_too_many_requests="sdk_too_many_requests",M.sdk_seed_phrase_decryption_failed="sdk_seed_phrase_decryption_failed",M.sdk_key_shares_not_found="sdk_key_shares_not_found",M.sdk_key_share_decryption_failed="sdk_key_share_decryption_failed",M.sdk_seed_phrase_not_found="sdk_seed_phrase_not_found",M.sdk_private_key_decryption_failed="sdk_private_key_decryption_failed",M.sdk_private_key_not_found="sdk_private_key_not_found",M.sdk_device_key_missing_with_existing_data="sdk_device_key_missing_with_existing_data",M.sdk_refresh_token_missing="sdk_refresh_token_missing",M.sdk_missing_parameter="sdk_missing_parameter",M.sdk_invalid_parameter="sdk_invalid_parameter",M.sdk_invalid_response="sdk_invalid_response",M.sdk_wrong_password="sdk_wrong_password",M.sdk_no_valid_seed_option="sdk_no_valid_seed_option",M.sdk_ambiguous_legacy_migration_data="sdk_ambiguous_legacy_migration_data",M.sdk_attestation_verification_failed="sdk_attestation_verification_failed",M.sdk_passkey_prf_not_available="sdk_passkey_prf_not_available",M.sdk_passkey_challenge_unavailable="sdk_passkey_challenge_unavailable",M.sdk_passkey_authentication_failed="sdk_passkey_authentication_failed",M.sdk_passkey_registration_failed="sdk_passkey_registration_failed",M.sdk_passkey_wrong_credential="sdk_passkey_wrong_credential";const $={error:"UnknownError",message:"An unknown error occurred"},F={error:"IOSVersionNotSupportedError",message:"Passkeys are not supported on this device. iOS 15 and above is required to use Passkeys"},j={error:"AndroidVersionNotSupportedError",message:"Passkeys are not supported on this device. Android 9 and above is required to use Passkeys"},W={error:"RequestFailed",message:"The request failed. No Credentials were returned."},G={error:"UserCancelled",message:"The user cancelled the request."},H={error:"InvalidChallenge",message:"The provided challenge was invalid"},Y={error:"InvalidUserId",message:"The provided userId was invalid"},z={error:"BadConfiguration",message:"Your app is not properly configured. Refer to the docs for help."},J={error:"NoCredentials",message:"No viable credential is available for the user."},X={error:"Interrupted",message:"The operation was interrupted and may be retried."},Z={error:"TimedOut",message:"The operation timed out."},Q={error:"CredentialAlreadyExists",message:"A passkey for this account already exists on this device."},ee={error:"NoCreateOption",message:"No passkey manager is available on this device to create a passkey."},te={error:"ERROR_CEREMONY_ABORTED",message:"User did not complete the request in time."},re={error:"ERROR_INVALID_DOMAIN",message:"Invalid domain."},se={error:"ERROR_INVALID_RP_ID",message:"Invalid Relying Party ID."},ae={error:"ERROR_INVALID_USER_ID_LENGTH",message:"Invalid user ID length."},ne={error:"ERROR_MALFORMED_PUBKEYCREDPARAMS",message:"Malformed public key credential parameters."},ie={error:"ERROR_AUTHENTICATOR_GENERAL_ERROR",message:"Authenticator encountered a general error."},oe={error:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",message:"Authenticator does not support discoverable credentials."},ce={error:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",message:"Authenticator does not support user verification."},de={error:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",message:"Authenticator was previously registered."},le={error:"InvalidStateError",message:"The authenticator was previously registered"},ue={error:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",message:"Authenticator does not support any of the provided public key credential parameters algorithms."},he={error:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",message:"User verification failed during auto-registration."},pe={error:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",message:"An error occurred. See the cause property for more details."},fe={error:"NotAllowedError",message:"No matching passkey was found on this device, or the request was cancelled."},ye=[$,F,j,W,G,H,Y,z,J,X,Z,Q,ee,te,re,se,ae,ne,ie,oe,ce,de,ue,he,pe,fe];let ge=!1;"undefined"!=typeof window&&window.localStorage&&(ge="true"===window.localStorage.getItem("wsdk:enable_logging")),ge&&p.default.setLevel("trace");const we=p.default;var me,ve=("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).performance||{};ve.now||ve.mozNow||ve.msNow||ve.oNow||ve.webkitNow;const Se=null!==(me={env:{}}.env.NODE_ENV)&&void 0!==me?me:"development",be="testnet",Ae="9fa9d3f3c77c20d3a50a08e5299644be29f6e6206ef3479fe75d907fe6db9e4c";exports.PublicKeyCredentialAlgorithm.RS256,exports.PublicKeyCredentialAlgorithm.ES256;const Ee="undefined"!=typeof window&&"undefined"!=typeof document,_e={platform:"web",isNative:!Ee,isWeb:Ee},Ie="3.19.0",ke="x-sdk-version",Te=`wallaby-cash/${Ie}`,Pe=e=>e.replace(/:/g,"_"),Ce="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function xe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Oe(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./r/oci-41IbhfX7.cjs"),t=require("bip39"),r=require("uuid"),s=require("loglevel"),a=require("crypto-js"),n=require("jwt-decode"),i=require("@simplewebauthn/browser"),o=require("js-base64"),c=require("@truestamp/canonify"),d=require("scale-ts"),l=e=>e&&"object"==typeof e&&"default"in e?e:{default:e};function u(e){if(e&&"object"==typeof e&&"default"in e)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e)for(const r in e)if("default"!==r){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,s.get?s:{enumerable:!0,get:()=>e[r]})}return t.default=e,Object.freeze(t)}const h=u(t),p=l(s),f=u(i);var y,g,w,m,v,S,b,A,E,_,I,k,T,P,C,x,O,K,N,R,D,L,B,U,q,M;exports.PasskeyChallengeType=void 0,(y=exports.PasskeyChallengeType||(exports.PasskeyChallengeType={})).REGISTRATION="webauthn.create",y.AUTHENTICATION="webauthn.get",exports.PublicKeyCredentialAlgorithm=void 0,(g=exports.PublicKeyCredentialAlgorithm||(exports.PublicKeyCredentialAlgorithm={}))[g.RS256=-257]="RS256",g[g.ES256=-7]="ES256",exports.TransportEnum=void 0,(w=exports.TransportEnum||(exports.TransportEnum={})).Usb="usb",w.Nfc="nfc",w.Ble="ble",w.Internal="internal",w.Hybrid="hybrid";class V extends Error{constructor(e){var t;const{message:r,statusCode:s,errorCode:a,kind:n,data:i,cause:o,onError:c}=e;super(r),this.name="WallabyError",this.status=s,this.errorCode=a,this.kind=null!=n?n:V.inferKind(s,a),this.cause=o,this.onError=c,this.data=i,Object.setPrototypeOf(this,new.target.prototype),null===(t=Error.captureStackTrace)||void 0===t||t.call(Error,this,new.target)}static isWallabyError(e){return e instanceof V}static inferKind(e,t){return 0===e?"network":"device_storage_unsupported"===t||(null==t?void 0:t.startsWith("sdk_"))?"sdk":"api"}toJSON(){return{name:this.name,message:this.message,kind:this.kind,status:this.status,errorCode:this.errorCode,data:this.data}}}exports.UserAssetSource=void 0,(m=exports.UserAssetSource||(exports.UserAssetSource={})).Merchant="merchant",m.User="user",m.republic="republic",exports.AssetConfigStatus=void 0,(v=exports.AssetConfigStatus||(exports.AssetConfigStatus={})).Active="active",v.Inactive="inactive",exports.AssetType=void 0,(S=exports.AssetType||(exports.AssetType={})).Coin="COIN",S.Token="TOKEN",exports.OwnershipType=void 0,(b=exports.OwnershipType||(exports.OwnershipType={})).SingleOwner="SINGLE_OWNER",b.MultiSig="MULTI_SIG",exports.TokenStandard=void 0,(A=exports.TokenStandard||(exports.TokenStandard={})).Erc20="ERC_20",A.Erc1404="ERC_1404",A.Arc20="ARC_20",A.Arc1404="ARC_1404",A.Mrc20="MRC_20",A.Bep20="BEP_20",A.AlgoStandard="ALGO_STANDARD",A.AlgoApp="ALGO_APP",A.TokenFactory="TOKEN_FACTORY",A.SeiErc20="SEI_ERC_20",A.AptFA="APT_FUNGIBLE_ASSET",exports.AddressType=void 0,(E=exports.AddressType||(exports.AddressType={})).Segwit="SEGWIT",E.Legacy="LEGACY",E.Default="DEFAULT",exports.BlockchainStatus=void 0,(_=exports.BlockchainStatus||(exports.BlockchainStatus={})).Up="UP",_.Down="DOWN",exports.BlockchainSlip44=void 0,(I=exports.BlockchainSlip44||(exports.BlockchainSlip44={}))[I.BTC=0]="BTC",I[I.ETH=60]="ETH",I[I.ALGO=283]="ALGO",I[I.AVAX=9e3]="AVAX",I[I.MATIC=966]="MATIC",I[I.BSC=519]="BSC",I[I.BASE=8453]="BASE",I[I.SUI=784]="SUI",I[I.INJ=2525]="INJ",I[I.SEI=19000118]="SEI",I[I.APT=637]="APT",I[I.HBAR=3030]="HBAR",I[I.POLYX=595]="POLYX",exports.BlockchainName=void 0,(k=exports.BlockchainName||(exports.BlockchainName={})).Algorand="ALGORAND",k.Aptos="APTOS",k.Avalanche="AVALANCHE",k.Base="BASE",k.Bitcoin="BITCOIN",k.Bsc="BSC",k.Canton="CANTON",k.Ethereum="ETHEREUM",k.Hedera="HEDERA",k.Injective="INJECTIVE",k.Polygon="POLYGON",k.Polymesh="POLYMESH",k.Sei="SEI",k.Sui="SUI",k.Solana="SOLANA",exports.RequestMethod=void 0,(T=exports.RequestMethod||(exports.RequestMethod={})).Post="POST",T.Get="GET",T.Put="PUT",T.Delete="DELETE",exports.ApiKeyStatus=void 0,(P=exports.ApiKeyStatus||(exports.ApiKeyStatus={})).Active="active",P.Inactive="inactive",exports.TransactionEntryType=void 0,(C=exports.TransactionEntryType||(exports.TransactionEntryType={})).INCOMING="INCOMING",C.OUTGOING="OUTGOING",C.UNKNOWN="UNKNOWN",exports.KeyTypeName=void 0,(x=exports.KeyTypeName||(exports.KeyTypeName={})).WallabyShare="wallaby_share",x.OwnerMainDeviceShare="owner_main_device_share",x.OwnerBackupDeviceShare="owner_backup_device_share",exports.SeedPhraseType=void 0,(O=exports.SeedPhraseType||(exports.SeedPhraseType={})).Standard="standard",O.Algorand="algorand",exports.WalletAddressTypeName=void 0,(K=exports.WalletAddressTypeName||(exports.WalletAddressTypeName={})).BTC_MAINNET_SEGWIT="BTC:MAINNET:SEGWIT",K.BTC_MAINNET_LEGACY="BTC:MAINNET:LEGACY",K.BTC_TESTNET_SEGWIT="BTC:TESTNET:SEGWIT",K.BTC_TESTNET_LEGACY="BTC:TESTNET:LEGACY",K.ETH="ETH:ALL:DEFAULT",K.ALGO="ALGO:ALL:DEFAULT",K.SUI="SUI:ALL:DEFAULT",K.INJ="INJ:ALL:DEFAULT",K.APT="APT:ALL:DEFAULT",K.POLYX="POLYX:ALL:DEFAULT",K.BSC="BSC:ALL:DEFAULT",K.AVAX="AVAX:ALL:DEFAULT",K.MATIC="MATIC:ALL:DEFAULT",K.BASE="BASE:ALL:DEFAULT",K.SEI="SEI:ALL:DEFAULT",K.HBAR="HBAR:ALL:DEFAULT",K.CC="CC:ALL:DEFAULT",exports.ReturnWalletOption=void 0,(N=exports.ReturnWalletOption||(exports.ReturnWalletOption={})).ReturnOnlyEncryptedShares="RETURN_ONLY_ENCRYPTED_SHARES",N.ReturnOnlyEncryptedSeedPhrase="RETURN_ONLY_ENCRYPTED_SEED_PHRASE",N.ReturnBothEncryptedSharesAndSeed="RETURN_BOTH_ENCRYPTED_SHARES_AND_SEED",exports.WalletOwnershipType=void 0,(R=exports.WalletOwnershipType||(exports.WalletOwnershipType={})).SingleOwner="SINGLE_OWNER",R.MultiOwner="MULTI_OWNER",exports.AuthType=void 0,(D=exports.AuthType||(exports.AuthType={})).Password="password",D.Passkey="passkey",exports.LocalStorageItems=void 0,(L=exports.LocalStorageItems||(exports.LocalStorageItems={})).AccessToken="access-token",L.RefreshToken="refresh-token",L.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",L.EncryptedKeyShares="encrypted-key-shares",L.PrimaryDeviceKeyShare="primary-device-key-share",L.BackupDeviceKeyShare="backup-device-key-share",L.EncryptedShare="encrypted-share",L.EncryptedAlgorandSeedPhrase="encrypted-algorand-seedPhrase",L.EncryptedDevicePrivateKey="encrypted-private-key",L.ClientAuthPublicKey="client-auth-pub-key",L.ClientAuthToken="republic-jwt",L.PasskeyCredential="pass-key-credential",L.PasskeyCredentialId="passkey-credential-id",L.Blob="blob",exports.LegacyKeyNames=void 0,(B=exports.LegacyKeyNames||(exports.LegacyKeyNames={})).EncryptedPrivateKey="encryptedPrivateKey",B.WallabyAuthPubKey="wallabyAuthPubKey",B.EncryptedAlgorandSeed="encryptedAlgorandSeed",B.EncryptedSeed="encryptedSeed",B.ClientAuthToken="republic_jwt",B.AccessToken="accessToken",exports.V1KeyNames=void 0,(U=exports.V1KeyNames||(exports.V1KeyNames={})).AccessToken="access-token",U.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",U.EncryptedAlgorandSeedPhrase="encrypted-algorand-seedPhrase",U.EncryptedDevicePrivateKey="encrypted-private-key",U.ClientAuthPublicKey="client-auth-pub-key",U.WallabyAuthPubKey="wallaby-auth-pub-key",U.ClientAuthToken="republic-jwt",exports.V2KeyNames=void 0,(q=exports.V2KeyNames||(exports.V2KeyNames={})).AccessToken="access-token",q.RefreshToken="refresh-token",q.BackupDeviceKeyShare="backup-device-key-share",q.ClientAuthPublicKey="client-auth-pub-key",q.ClientAuthToken="republic-jwt",q.EncryptedDevicePrivateKey="encrypted-private-key",q.EncryptedStandardSeedPhrase="encrypted-standard-seedPhrase",q.PasskeyCredential="pass-key-credential",q.PrimaryDeviceKeyShare="primary-device-key-share",q.WallabyAuthPubKey="wallaby-auth-pub-key",q.MigrationVersion="wsdk_migrated_with_version",q.LastMigratedAt="wsdk_last_migrated_at",q.PasswordResetAttempts="wsdk_password_reset_attempts",q.MigrationAttempts="wsdk_migration_attempts",q.CredentialConversionInProgress="credential-conversion-in-progress",q.PendingCommit="pending-commit",q.LegacySeedClaimedWalletId="wsdk_legacy_seed_claimed_wallet_id",exports.ErrorResponseCodes=void 0,(M=exports.ErrorResponseCodes||(exports.ErrorResponseCodes={})).unknown_error="unknown_error",M.internal_server_error="internal_server_error",M.request_payload_missing="request_payload_missing",M.request_payload_wrong_format="request_payload_wrong_format",M.auth_api_key_invalid="auth_api_key_invalid",M.auth_api_key_not_active="auth_api_key_not_active",M.auth_api_key_pub_key_not_set="auth_api_key_pub_key_not_set",M.auth_api_key_pub_key_already_in_use="auth_api_key_pub_key_already_in_use",M.auth_api_key_not_provided="auth_api_key_not_provided",M.auth_api_key_not_found="auth_api_key_not_found",M.auth_origin_not_allowed="auth_origin_not_allowed",M.auth_api_jwt_invalid="auth_api_jwt_invalid",M.auth_api_jwt_not_active="auth_api_jwt_not_active",M.auth_api_jwt_not_provided="auth_api_jwt_not_provided",M.auth_api_jwt_expired="auth_api_jwt_expired",M.auth_api_unauthorized="auth_api_unauthorized",M.auth_client_jwt_invalid="auth_client_jwt_invalid",M.auth_client_jwt_missing_external_id_payload="auth_client_jwt_missing_external_id_payload",M.auth_client_jwt_missing_exp_payload="auth_client_jwt_missing_exp_payload",M.auth_client_jwt_external_id_not_match="auth_client_jwt_external_id_not_match",M.auth_client_jwt_expired="auth_client_jwt_expired",M.auth_client_jwt_not_provided="auth_client_jwt_not_provided",M.auth_client_jwt_invalid_auth_type="auth_client_jwt_invalid_auth_type",M.auth_client_jwt_invalid_passkey="auth_client_jwt_invalid_passkey",M.auth_client_pub_key_and_message_not_match="auth_client_pub_key_and_message_not_match",M.auth_client_pub_key_and_message_expired="auth_client_pub_key_and_message_expired",M.auth_client_pub_key_and_message_signature_failed="auth_client_pub_key_and_message_signature_failed",M.auth_client_pub_key_not_found="auth_client_pub_key_not_found",M.auth_client_pub_key_already_registered="auth_client_pub_key_already_registered",M.auth_user_not_allowed_to_perform_the_action="auth_user_not_allowed_to_perform_the_action",M.auth_upside_signature_not_provided="auth_upside_signature_not_provided",M.auth_upside_signature_invalid="auth_upside_signature_invalid",M.auth_upside_wrong_base64_signature="auth_upside_wrong_base64_signature",M.multisig_participant_not_found="multisig_participant_not_found",M.wallet_not_found="wallet_not_found",M.wallet_recovery_seed_mismatch="wallet_recovery_seed_mismatch",M.wallet_address_not_found="wallet_address_not_found",M.wallet_address_generation_failed="wallet_address_generation_failed",M.invalid_public_key="invalid_public_key",M.canton_registration_daily_limit_exceeded="canton_registration_daily_limit_exceeded",M.asset_not_found="asset_not_found",M.seedphrase_could_not_be_decrypted="seedphrase_could_not_be_decrypted",M.invalid_seed_phrase="invalid_seed_phrase",M.user_already_exists="user_already_exists",M.user_not_found="user_not_found",M.otp_code_invalid="otp_code_invalid",M.otp_code_expired="otp_code_expired",M.merchant_not_found="merchant_not_found",M.swap_provider_not_found="swap_provider_not_found",M.swap_chain_not_supported="swap_chain_not_supported",M.swap_asset_not_supported="swap_asset_not_supported",M.swap_quote_executing="swap_quote_executing",M.swap_quote_in_progress="swap_quote_in_progress",M.swap_quote_completed="swap_quote_completed",M.swap_quote_failed="swap_quote_failed",M.swap_quote_abandoned="swap_quote_abandoned",M.swap_quote_execution_failed="swap_quote_execution_failed",M.swap_quote_invalid="swap_quote_invalid",M.feature_not_enabled="feature_not_enabled",M.insufficient_balance="insufficient_balance",M.transaction_failed="transaction_failed",M.invalid_number_of_signatures="invalid_number_of_signatures",M.invalid_signature="invalid_signature",M.chain_adapter_not_found="chain_adapter_not_found",M.chain_not_found="chain_not_found",M.invalid_address="invalid_address",M.auth_refresh_token_not_found="auth_refresh_token_not_found",M.auth_refresh_token_expired="auth_refresh_token_expired",M.auth_refresh_token_reuse_detected="auth_refresh_token_reuse_detected",M.sdk_jwt_invalid="sdk_jwt_invalid",M.sdk_jwt_expired="sdk_jwt_expired",M.sdk_unknown_error="sdk_unknown_error",M.sdk_too_many_requests="sdk_too_many_requests",M.sdk_seed_phrase_decryption_failed="sdk_seed_phrase_decryption_failed",M.sdk_key_shares_not_found="sdk_key_shares_not_found",M.sdk_key_share_decryption_failed="sdk_key_share_decryption_failed",M.sdk_seed_phrase_not_found="sdk_seed_phrase_not_found",M.sdk_private_key_decryption_failed="sdk_private_key_decryption_failed",M.sdk_private_key_not_found="sdk_private_key_not_found",M.sdk_device_key_missing_with_existing_data="sdk_device_key_missing_with_existing_data",M.sdk_refresh_token_missing="sdk_refresh_token_missing",M.sdk_missing_parameter="sdk_missing_parameter",M.sdk_invalid_parameter="sdk_invalid_parameter",M.sdk_invalid_response="sdk_invalid_response",M.sdk_wrong_password="sdk_wrong_password",M.sdk_no_valid_seed_option="sdk_no_valid_seed_option",M.sdk_ambiguous_legacy_migration_data="sdk_ambiguous_legacy_migration_data",M.sdk_attestation_verification_failed="sdk_attestation_verification_failed",M.sdk_passkey_prf_not_available="sdk_passkey_prf_not_available",M.sdk_passkey_challenge_unavailable="sdk_passkey_challenge_unavailable",M.sdk_passkey_authentication_failed="sdk_passkey_authentication_failed",M.sdk_passkey_registration_failed="sdk_passkey_registration_failed",M.sdk_passkey_wrong_credential="sdk_passkey_wrong_credential";const $={error:"UnknownError",message:"An unknown error occurred"},F={error:"IOSVersionNotSupportedError",message:"Passkeys are not supported on this device. iOS 15 and above is required to use Passkeys"},j={error:"AndroidVersionNotSupportedError",message:"Passkeys are not supported on this device. Android 9 and above is required to use Passkeys"},W={error:"RequestFailed",message:"The request failed. No Credentials were returned."},G={error:"UserCancelled",message:"The user cancelled the request."},H={error:"InvalidChallenge",message:"The provided challenge was invalid"},Y={error:"InvalidUserId",message:"The provided userId was invalid"},z={error:"BadConfiguration",message:"Your app is not properly configured. Refer to the docs for help."},J={error:"NoCredentials",message:"No viable credential is available for the user."},X={error:"Interrupted",message:"The operation was interrupted and may be retried."},Z={error:"TimedOut",message:"The operation timed out."},Q={error:"CredentialAlreadyExists",message:"A passkey for this account already exists on this device."},ee={error:"NoCreateOption",message:"No passkey manager is available on this device to create a passkey."},te={error:"ERROR_CEREMONY_ABORTED",message:"User did not complete the request in time."},re={error:"ERROR_INVALID_DOMAIN",message:"Invalid domain."},se={error:"ERROR_INVALID_RP_ID",message:"Invalid Relying Party ID."},ae={error:"ERROR_INVALID_USER_ID_LENGTH",message:"Invalid user ID length."},ne={error:"ERROR_MALFORMED_PUBKEYCREDPARAMS",message:"Malformed public key credential parameters."},ie={error:"ERROR_AUTHENTICATOR_GENERAL_ERROR",message:"Authenticator encountered a general error."},oe={error:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",message:"Authenticator does not support discoverable credentials."},ce={error:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",message:"Authenticator does not support user verification."},de={error:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",message:"Authenticator was previously registered."},le={error:"InvalidStateError",message:"The authenticator was previously registered"},ue={error:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",message:"Authenticator does not support any of the provided public key credential parameters algorithms."},he={error:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",message:"User verification failed during auto-registration."},pe={error:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",message:"An error occurred. See the cause property for more details."},fe={error:"NotAllowedError",message:"No matching passkey was found on this device, or the request was cancelled."},ye=[$,F,j,W,G,H,Y,z,J,X,Z,Q,ee,te,re,se,ae,ne,ie,oe,ce,de,ue,he,pe,fe];let ge=!1;"undefined"!=typeof window&&window.localStorage&&(ge="true"===window.localStorage.getItem("wsdk:enable_logging")),ge&&p.default.setLevel("trace");const we=p.default;var me,ve=("undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}).performance||{};ve.now||ve.mozNow||ve.msNow||ve.oNow||ve.webkitNow;const Se=null!==(me={env:{}}.env.NODE_ENV)&&void 0!==me?me:"development",be="testnet",Ae="9fa9d3f3c77c20d3a50a08e5299644be29f6e6206ef3479fe75d907fe6db9e4c";exports.PublicKeyCredentialAlgorithm.RS256,exports.PublicKeyCredentialAlgorithm.ES256;const Ee="undefined"!=typeof window&&"undefined"!=typeof document,_e={platform:"web",isNative:!Ee,isWeb:Ee},Ie="3.20.0",ke="x-sdk-version",Te=`wallaby-cash/${Ie}`,Pe=e=>e.replace(/:/g,"_"),Ce="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function xe(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Oe(e,...t){if(!((r=e)instanceof Uint8Array||ArrayBuffer.isView(r)&&"Uint8Array"===r.constructor.name))throw new Error("Uint8Array expected");
2
2
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
3
  var r;if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ke(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");xe(e.outputLen),xe(e.blockLen)}function Ne(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Re(e,t){Oe(e);const r=t.outputLen;if(e.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function De(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Le(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Be(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ue(e,t){return e<<32-t|e>>>t}const qe=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])();function Me(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const Ve=qe?e=>e:e=>Me(e);const $e=qe?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=Me(e[t]);return e},Fe=(()=>"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),je=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function We(e){if(Oe(e),Fe)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=je[e[r]];return t}const Ge=48,He=57,Ye=65,ze=70,Je=97,Xe=102;function Ze(e){return e>=Ge&&e<=He?e-Ge:e>=Ye&&e<=ze?e-(Ye-10):e>=Je&&e<=Xe?e-(Je-10):void 0}function Qe(e){if("string"!=typeof e)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(e))}function et(e){return"string"==typeof e&&(e=Qe(e)),Oe(e),e}function tt(e){return"string"==typeof e&&(e=Qe(e)),Oe(e),e}class rt{}function st(e){const t=t=>e().update(et(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function at(e){const t=(t,r)=>e(r).update(et(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}function nt(e=32){if(Ce&&"function"==typeof Ce.getRandomValues)return Ce.getRandomValues(new Uint8Array(e));if(Ce&&"function"==typeof Ce.randomBytes)return Uint8Array.from(Ce.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}function it(e){return nt(e)}
4
4
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ot=BigInt(0),ct=BigInt(1);function dt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function lt(e){if(!dt(e))throw new Error("Uint8Array expected")}function ut(e,t){if("boolean"!=typeof t)throw new Error(e+" boolean expected, got "+t)}function ht(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function pt(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?ot:BigInt("0x"+e)}const ft="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,yt=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function gt(e){if(lt(e),ft)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=yt[e[r]];return t}const wt=48,mt=57,vt=65,St=70,bt=97,At=102;function Et(e){return e>=wt&&e<=mt?e-wt:e>=vt&&e<=St?e-(vt-10):e>=bt&&e<=At?e-(bt-10):void 0}function _t(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(ft)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const s=new Uint8Array(r);for(let t=0,a=0;t<r;t++,a+=2){const r=Et(e.charCodeAt(a)),n=Et(e.charCodeAt(a+1));if(void 0===r||void 0===n){const t=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+a)}s[t]=16*r+n}return s}function It(e){return pt(gt(e))}function kt(e){return lt(e),pt(gt(Uint8Array.from(e).reverse()))}function Tt(e,t){return _t(e.toString(16).padStart(2*t,"0"))}function Pt(e,t){return Tt(e,t).reverse()}function Ct(e,t,r){let s;if("string"==typeof t)try{s=_t(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!dt(t))throw new Error(e+" must be hex string or Uint8Array");s=Uint8Array.from(t)}const a=s.length;if("number"==typeof r&&a!==r)throw new Error(e+" of length "+r+" expected, got "+a);return s}function xt(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];lt(s),t+=s.length}const r=new Uint8Array(t);for(let t=0,s=0;t<e.length;t++){const a=e[t];r.set(a,s),s+=a.length}return r}const Ot=e=>"bigint"==typeof e&&ot<=e;function Kt(e,t,r){return Ot(e)&&Ot(t)&&Ot(r)&&t<=e&&e<r}function Nt(e,t,r,s){if(!Kt(t,r,s))throw new Error("expected valid "+e+": "+r+" <= n < "+s+", got "+t)}const Rt=e=>(ct<<BigInt(e))-ct,Dt=e=>new Uint8Array(e),Lt=e=>Uint8Array.from(e);const Bt={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||dt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function Ut(e,t,r={}){const s=(t,r,s)=>{const a=Bt[r];if("function"!=typeof a)throw new Error("invalid validator function");const n=e[t];if(!(s&&void 0===n||a(n,e)))throw new Error("param "+String(t)+" is invalid. Expected "+r+", got "+n)};for(const[e,r]of Object.entries(t))s(e,r,!1);for(const[e,t]of Object.entries(r))s(e,t,!0);return e}function qt(e){const t=new WeakMap;return(r,...s)=>{const a=t.get(r);if(void 0!==a)return a;const n=e(r,...s);return t.set(r,n),n}}const Mt=Oe;function Vt(e){return function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(Fe)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const s=new Uint8Array(r);for(let t=0,a=0;t<r;t++,a+=2){const r=Ze(e.charCodeAt(a)),n=Ze(e.charCodeAt(a+1));if(void 0===r||void 0===n){const t=e[a]+e[a+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+a)}s[t]=16*r+n}return s}(e.startsWith("0x")?e.substring(2):e)}function $t(e){return t=>(Mt(t),e(t))}const Ft=e=>{if("string"!=typeof e)throw new Error("[isHexPrefixed] input must be type 'string', received type "+typeof e);return"0"===e[0]&&"x"===e[1]},jt=e=>{if("string"!=typeof e)throw new Error("[stripHexPrefix] input must be type 'string', received "+typeof e);return Ft(e)?e.slice(2):e},Wt=e=>Ft(e)?e.slice(2):e,Gt=e=>e.startsWith("0x")?e:"0x"+e,Ht=e=>{let t=e;return 64===Vt(e).length&&(t="04"+e),t.substring(2)},Yt=e=>{const t=e.reduce(((e,t)=>e+t.byteLength),0),r=new Uint8Array(t);let s=0;return e.forEach((e=>{r.set(e,s),s+=e.byteLength})),r},zt=e=>{if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);const t=[];for(let r=0;r<e.length;r++){const s=e.codePointAt(r);if(!s)throw new Error("Invalid code point");s<128?t.push(s):s<2048?t.push(192|s>>6,128|63&s):s<65536?t.push(224|s>>12,128|s>>6&63,128|63&s):(r++,t.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s))}return new Uint8Array(t)};function Jt(e,t,r){return e&t^e&r^t&r}class Xt extends rt{constructor(e,t,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=Be(this.buffer)}update(e){Ne(this),Oe(e=et(e));const{view:t,buffer:r,blockLen:s}=this,a=e.length;for(let n=0;n<a;){const i=Math.min(s-this.pos,a-n);if(i!==s)r.set(e.subarray(n,n+i),this.pos),this.pos+=i,n+=i,this.pos===s&&(this.process(t,0),this.pos=0);else{const t=Be(e);for(;s<=a-n;n+=s)this.process(t,n)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ne(this),Re(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:a}=this;let{pos:n}=this;t[n++]=128,Le(this.buffer.subarray(n)),this.padOffset>s-n&&(this.process(r,0),n=0);for(let e=n;e<s;e++)t[e]=0;!function(e,t,r,s){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,s);const a=BigInt(32),n=BigInt(4294967295),i=Number(r>>a&n),o=Number(r&n),c=s?4:0,d=s?0:4;e.setUint32(t+c,i,s),e.setUint32(t+d,o,s)}(r,s-8,BigInt(8*this.length),a),this.process(r,0);const i=Be(e),o=this.outputLen;if(o%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=o/4,d=this.get();if(c>d.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)i.setUint32(4*e,d[e],a)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:s,finished:a,destroyed:n,pos:i}=this;return e.destroyed=n,e.finished=a,e.length=s,e.pos=i,s%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Zt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Qt=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),er=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),tr=BigInt(2**32-1),rr=BigInt(32);function sr(e,t=!1){return t?{h:Number(e&tr),l:Number(e>>rr&tr)}:{h:0|Number(e>>rr&tr),l:0|Number(e&tr)}}function ar(e,t=!1){const r=e.length;let s=new Uint32Array(r),a=new Uint32Array(r);for(let n=0;n<r;n++){const{h:r,l:i}=sr(e[n],t);[s[n],a[n]]=[r,i]}return[s,a]}const nr=(e,t,r)=>e>>>r,ir=(e,t,r)=>e<<32-r|t>>>r,or=(e,t,r)=>e>>>r|t<<32-r,cr=(e,t,r)=>e<<32-r|t>>>r,dr=(e,t,r)=>e<<64-r|t>>>r-32,lr=(e,t,r)=>e>>>r-32|t<<64-r;function ur(e,t,r,s){const a=(t>>>0)+(s>>>0);return{h:e+r+(a/2**32|0)|0,l:0|a}}const hr=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),pr=(e,t,r,s)=>t+r+s+(e/2**32|0)|0,fr=(e,t,r,s)=>(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0),yr=(e,t,r,s,a)=>t+r+s+a+(e/2**32|0)|0,gr=(e,t,r,s,a)=>(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)+(a>>>0),wr=(e,t,r,s,a,n)=>t+r+s+a+n+(e/2**32|0)|0,mr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),vr=new Uint32Array(64);class Sr extends Xt{constructor(e=32){super(64,e,8,!1),this.A=0|Zt[0],this.B=0|Zt[1],this.C=0|Zt[2],this.D=0|Zt[3],this.E=0|Zt[4],this.F=0|Zt[5],this.G=0|Zt[6],this.H=0|Zt[7]}get(){const{A:e,B:t,C:r,D:s,E:a,F:n,G:i,H:o}=this;return[e,t,r,s,a,n,i,o]}set(e,t,r,s,a,n,i,o){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|s,this.E=0|a,this.F=0|n,this.G=0|i,this.H=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)vr[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=vr[e-15],r=vr[e-2],s=Ue(t,7)^Ue(t,18)^t>>>3,a=Ue(r,17)^Ue(r,19)^r>>>10;vr[e]=a+vr[e-7]+s+vr[e-16]|0}let{A:r,B:s,C:a,D:n,E:i,F:o,G:c,H:d}=this;for(let e=0;e<64;e++){const t=d+(Ue(i,6)^Ue(i,11)^Ue(i,25))+((l=i)&o^~l&c)+mr[e]+vr[e]|0,u=(Ue(r,2)^Ue(r,13)^Ue(r,22))+Jt(r,s,a)|0;d=c,c=o,o=i,i=n+t|0,n=a,a=s,s=r,r=t+u|0}var l;r=r+this.A|0,s=s+this.B|0,a=a+this.C|0,n=n+this.D|0,i=i+this.E|0,o=o+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,s,a,n,i,o,c,d)}roundClean(){Le(vr)}destroy(){this.set(0,0,0,0,0,0,0,0),Le(this.buffer)}}const br=(()=>ar(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),Ar=(()=>br[0])(),Er=(()=>br[1])(),_r=new Uint32Array(80),Ir=new Uint32Array(80);class kr extends Xt{constructor(e=64){super(128,e,16,!1),this.Ah=0|er[0],this.Al=0|er[1],this.Bh=0|er[2],this.Bl=0|er[3],this.Ch=0|er[4],this.Cl=0|er[5],this.Dh=0|er[6],this.Dl=0|er[7],this.Eh=0|er[8],this.El=0|er[9],this.Fh=0|er[10],this.Fl=0|er[11],this.Gh=0|er[12],this.Gl=0|er[13],this.Hh=0|er[14],this.Hl=0|er[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:s,Ch:a,Cl:n,Dh:i,Dl:o,Eh:c,El:d,Fh:l,Fl:u,Gh:h,Gl:p,Hh:f,Hl:y}=this;return[e,t,r,s,a,n,i,o,c,d,l,u,h,p,f,y]}set(e,t,r,s,a,n,i,o,c,d,l,u,h,p,f,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|s,this.Ch=0|a,this.Cl=0|n,this.Dh=0|i,this.Dl=0|o,this.Eh=0|c,this.El=0|d,this.Fh=0|l,this.Fl=0|u,this.Gh=0|h,this.Gl=0|p,this.Hh=0|f,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)_r[r]=e.getUint32(t),Ir[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|_r[e-15],r=0|Ir[e-15],s=or(t,r,1)^or(t,r,8)^nr(t,0,7),a=cr(t,r,1)^cr(t,r,8)^ir(t,r,7),n=0|_r[e-2],i=0|Ir[e-2],o=or(n,i,19)^dr(n,i,61)^nr(n,0,6),c=cr(n,i,19)^lr(n,i,61)^ir(n,i,6),d=fr(a,c,Ir[e-7],Ir[e-16]),l=yr(d,s,o,_r[e-7],_r[e-16]);_r[e]=0|l,Ir[e]=0|d}let{Ah:r,Al:s,Bh:a,Bl:n,Ch:i,Cl:o,Dh:c,Dl:d,Eh:l,El:u,Fh:h,Fl:p,Gh:f,Gl:y,Hh:g,Hl:w}=this;for(let e=0;e<80;e++){const t=or(l,u,14)^or(l,u,18)^dr(l,u,41),m=cr(l,u,14)^cr(l,u,18)^lr(l,u,41),v=l&h^~l&f,S=gr(w,m,u&p^~u&y,Er[e],Ir[e]),b=wr(S,g,t,v,Ar[e],_r[e]),A=0|S,E=or(r,s,28)^dr(r,s,34)^dr(r,s,39),_=cr(r,s,28)^lr(r,s,34)^lr(r,s,39),I=r&a^r&i^a&i,k=s&n^s&o^n&o;g=0|f,w=0|y,f=0|h,y=0|p,h=0|l,p=0|u,({h:l,l:u}=ur(0|c,0|d,0|b,0|A)),c=0|i,d=0|o,i=0|a,o=0|n,a=0|r,n=0|s;const T=hr(A,_,k);r=pr(T,b,E,I),s=0|T}({h:r,l:s}=ur(0|this.Ah,0|this.Al,0|r,0|s)),({h:a,l:n}=ur(0|this.Bh,0|this.Bl,0|a,0|n)),({h:i,l:o}=ur(0|this.Ch,0|this.Cl,0|i,0|o)),({h:c,l:d}=ur(0|this.Dh,0|this.Dl,0|c,0|d)),({h:l,l:u}=ur(0|this.Eh,0|this.El,0|l,0|u)),({h:h,l:p}=ur(0|this.Fh,0|this.Fl,0|h,0|p)),({h:f,l:y}=ur(0|this.Gh,0|this.Gl,0|f,0|y)),({h:g,l:w}=ur(0|this.Hh,0|this.Hl,0|g,0|w)),this.set(r,s,a,n,i,o,c,d,l,u,h,p,f,y,g,w)}roundClean(){Le(_r,Ir)}destroy(){Le(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Tr extends kr{constructor(){super(48),this.Ah=0|Qt[0],this.Al=0|Qt[1],this.Bh=0|Qt[2],this.Bl=0|Qt[3],this.Ch=0|Qt[4],this.Cl=0|Qt[5],this.Dh=0|Qt[6],this.Dl=0|Qt[7],this.Eh=0|Qt[8],this.El=0|Qt[9],this.Fh=0|Qt[10],this.Fl=0|Qt[11],this.Gh=0|Qt[12],this.Gl=0|Qt[13],this.Hh=0|Qt[14],this.Hl=0|Qt[15]}}const Pr=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Cr extends kr{constructor(){super(32),this.Ah=0|Pr[0],this.Al=0|Pr[1],this.Bh=0|Pr[2],this.Bl=0|Pr[3],this.Ch=0|Pr[4],this.Cl=0|Pr[5],this.Dh=0|Pr[6],this.Dl=0|Pr[7],this.Eh=0|Pr[8],this.El=0|Pr[9],this.Fh=0|Pr[10],this.Fl=0|Pr[11],this.Gh=0|Pr[12],this.Gl=0|Pr[13],this.Hh=0|Pr[14],this.Hl=0|Pr[15]}}const xr=st((()=>new Sr)),Or=st((()=>new kr)),Kr=st((()=>new Tr)),Nr=st((()=>new Cr));class Rr extends rt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Ke(e);const r=et(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,a=new Uint8Array(s);a.set(r.length>s?e.create().update(r).digest():r);for(let e=0;e<a.length;e++)a[e]^=54;this.iHash.update(a),this.oHash=e.create();for(let e=0;e<a.length;e++)a[e]^=106;this.oHash.update(a),Le(a)}update(e){return Ne(this),this.iHash.update(e),this}digestInto(e){Ne(this),Oe(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:s,destroyed:a,blockLen:n,outputLen:i}=this;return e.finished=s,e.destroyed=a,e.blockLen=n,e.outputLen=i,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Dr=(e,t,r)=>new Rr(e,t).update(r).digest();Dr.create=(e,t)=>new Rr(e,t)