@crossmint/wallets-sdk 1.15.0 → 1.17.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/README.md +17 -15
- package/dist/api/__tests__/constants.d.cts +1 -1
- package/dist/api/__tests__/constants.d.ts +1 -1
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.d.cts +1 -1
- package/dist/api/__tests__/test-utils.d.ts +1 -1
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.d.cts +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/gen/types.gen.d.cts +66 -22
- package/dist/api/gen/types.gen.d.ts +66 -22
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/types.d.cts +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/chains/adapters/evm.cjs +1 -1
- package/dist/chains/adapters/evm.d.cts +1 -1
- package/dist/chains/adapters/evm.d.ts +1 -1
- package/dist/chains/adapters/evm.js +1 -1
- package/dist/chains/adapters/solana.cjs +1 -1
- package/dist/chains/adapters/solana.d.cts +1 -1
- package/dist/chains/adapters/solana.d.ts +1 -1
- package/dist/chains/adapters/solana.js +1 -1
- package/dist/chains/adapters/stellar.cjs +1 -1
- package/dist/chains/adapters/stellar.d.cts +1 -1
- package/dist/chains/adapters/stellar.d.ts +1 -1
- package/dist/chains/adapters/stellar.js +1 -1
- package/dist/chains/chain-adapter.cjs +1 -1
- package/dist/chains/chain-adapter.d.cts +4 -2
- package/dist/chains/chain-adapter.d.ts +4 -2
- package/dist/chains/chain-adapter.js +1 -1
- package/dist/chains/chains.cjs +1 -1
- package/dist/chains/chains.d.cts +2 -2
- package/dist/chains/chains.d.ts +2 -2
- package/dist/chains/chains.js +1 -1
- package/dist/chains/definitions/arc.cjs +1 -0
- package/dist/chains/definitions/arc.d.cts +44 -0
- package/dist/chains/definitions/arc.d.ts +44 -0
- package/dist/chains/definitions/arc.js +1 -0
- package/dist/chains/definitions/celoSepolia.cjs +1 -0
- package/dist/chains/definitions/celoSepolia.d.cts +44 -0
- package/dist/chains/definitions/celoSepolia.d.ts +44 -0
- package/dist/chains/definitions/celoSepolia.js +1 -0
- package/dist/chains/definitions/robinhoodChain.cjs +1 -0
- package/dist/chains/definitions/robinhoodChain.d.cts +44 -0
- package/dist/chains/definitions/robinhoodChain.d.ts +44 -0
- package/dist/chains/definitions/robinhoodChain.js +1 -0
- package/dist/chains/definitions/robinhoodChainTestnet.cjs +1 -0
- package/dist/chains/definitions/robinhoodChainTestnet.d.cts +44 -0
- package/dist/chains/definitions/robinhoodChainTestnet.d.ts +44 -0
- package/dist/chains/definitions/robinhoodChainTestnet.js +1 -0
- package/dist/{chunk-YFRKZGZ4.js → chunk-2KMXYKU6.js} +1 -1
- package/dist/{chunk-4I5SLLAX.cjs → chunk-2QCYHRPX.cjs} +1 -1
- package/dist/chunk-3NAV25KH.js +1 -0
- package/dist/{chunk-W7IPXUD5.cjs → chunk-4HOB7SBT.cjs} +1 -1
- package/dist/{chunk-N3HRM33G.cjs → chunk-4JR5AF3R.cjs} +1 -1
- package/dist/{chunk-MXY4ZKZJ.cjs → chunk-52EJ53LP.cjs} +1 -1
- package/dist/chunk-5X66U2JL.cjs +1 -0
- package/dist/{chunk-RMILQMLJ.cjs → chunk-6BNGRRNH.cjs} +1 -1
- package/dist/{chunk-MFCNJSCL.js → chunk-6M2N2ULU.js} +1 -1
- package/dist/{chunk-GVRXRDGC.js → chunk-7ER4XMKQ.js} +1 -1
- package/dist/{chunk-O2BU2KJD.cjs → chunk-7FIAYQ4O.cjs} +1 -1
- package/dist/chunk-7RC4ESQH.cjs +1 -0
- package/dist/{chunk-4L7JP2WL.cjs → chunk-7SRQ77HY.cjs} +1 -1
- package/dist/chunk-A3NUC7CS.js +1 -0
- package/dist/chunk-AA2XAWEU.cjs +1 -0
- package/dist/chunk-ABOMDBIJ.js +1 -0
- package/dist/chunk-AF6NBGQT.js +1 -0
- package/dist/chunk-AUO6R32H.cjs +1 -0
- package/dist/chunk-AXFHMPWT.cjs +1 -0
- package/dist/{chunk-HJH2S644.cjs → chunk-BIL7GVBL.cjs} +1 -1
- package/dist/chunk-BK4RGDMJ.cjs +1 -0
- package/dist/{chunk-K55HJTOE.js → chunk-BTTVP3MP.js} +1 -1
- package/dist/chunk-BZYYVTXK.js +1 -0
- package/dist/{chunk-KYR4ZYRD.js → chunk-C2LINO2L.js} +1 -1
- package/dist/chunk-C2QJ3WKC.js +1 -0
- package/dist/chunk-C6E6WC4P.js +1 -0
- package/dist/chunk-CGQCRDG7.js +1 -0
- package/dist/{chunk-IZVYNUFO.cjs → chunk-DWUBPIYD.cjs} +1 -1
- package/dist/{chunk-BSZJJNA7.js → chunk-F7ERKXXH.js} +1 -1
- package/dist/chunk-HCV4M7X2.cjs +1 -0
- package/dist/chunk-HGH3VTQM.cjs +1 -0
- package/dist/{chunk-6OUANX4J.js → chunk-HHIMK2FC.js} +1 -1
- package/dist/chunk-HXNRP6QX.js +1 -0
- package/dist/{chunk-JNGPW247.js → chunk-INUEMQPG.js} +1 -1
- package/dist/{chunk-I76IKSS4.js → chunk-IQARABFX.js} +1 -1
- package/dist/chunk-JAXFDUNN.js +1 -0
- package/dist/chunk-JGLNAY5C.js +1 -0
- package/dist/chunk-JY4KRKZ6.js +1 -0
- package/dist/chunk-K4KSI3GM.js +1 -0
- package/dist/{chunk-RNQMEZIV.js → chunk-L7DGQX3V.js} +1 -1
- package/dist/{chunk-QP5JU7UO.cjs → chunk-LJRWHLTK.cjs} +1 -1
- package/dist/{chunk-3TPBVNNF.cjs → chunk-M42AKAZK.cjs} +1 -1
- package/dist/chunk-MDAPK5FG.js +1 -0
- package/dist/chunk-NB6EQOHP.cjs +1 -0
- package/dist/{chunk-GD5GDQXC.js → chunk-NUCKXAQL.js} +1 -1
- package/dist/chunk-NWFQRNBN.cjs +1 -0
- package/dist/chunk-NZHMWFOO.js +1 -0
- package/dist/chunk-OQFZL5LI.cjs +1 -0
- package/dist/chunk-P3P5Q5XX.js +1 -0
- package/dist/{chunk-OQFOUCTW.js → chunk-PCRZWMYM.js} +1 -1
- package/dist/{chunk-YHCEO3GD.cjs → chunk-PZRFDTBH.cjs} +1 -1
- package/dist/chunk-QLOW4D2N.js +1 -0
- package/dist/chunk-STB2VIIK.cjs +1 -0
- package/dist/chunk-TA5VIPMH.cjs +1 -0
- package/dist/chunk-TCDH5Q6Q.cjs +1 -0
- package/dist/{chunk-2VMMA4Y6.cjs → chunk-TDI66D63.cjs} +1 -1
- package/dist/{chunk-W4DR7B3L.cjs → chunk-TLCSIHPP.cjs} +1 -1
- package/dist/chunk-TWYVUVLB.js +1 -0
- package/dist/chunk-UY7L4D4M.cjs +1 -0
- package/dist/{chunk-WEWCIFFY.js → chunk-V5D6CUMS.js} +1 -1
- package/dist/chunk-V5NY4W5H.js +1 -0
- package/dist/{chunk-CEP5E7JG.cjs → chunk-W222P6C6.cjs} +1 -1
- package/dist/{chunk-WIAIJCQ2.cjs → chunk-W3BYSI7F.cjs} +1 -1
- package/dist/{chunk-JMVDYHTG.cjs → chunk-WIKKXJH7.cjs} +1 -1
- package/dist/chunk-WP4GRRR2.js +1 -0
- package/dist/{chunk-U5DLRN5U.cjs → chunk-WY5KEIIJ.cjs} +1 -1
- package/dist/{chunk-VHSQUXJK.js → chunk-X7V2C53V.js} +1 -1
- package/dist/{chunk-T7DD437D.cjs → chunk-XFUCYR24.cjs} +2 -2
- package/dist/{chunk-IXNKZURT.js → chunk-YKRLB374.js} +1 -1
- package/dist/chunk-ZATY4PKV.cjs +1 -0
- package/dist/{chunk-IX4EJZH5.js → chunk-ZMU6KU3L.js} +1 -1
- package/dist/chunk-ZPO3XSWU.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/logger/index.cjs +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/init.cjs +1 -1
- package/dist/logger/init.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.d.cts +3 -3
- package/dist/sdk.d.ts +3 -3
- package/dist/sdk.js +1 -1
- package/dist/signers/descriptors/api-key.d.cts +1 -1
- package/dist/signers/descriptors/api-key.d.ts +1 -1
- package/dist/signers/descriptors/device.d.cts +1 -1
- package/dist/signers/descriptors/device.d.ts +1 -1
- package/dist/signers/descriptors/email.d.cts +1 -1
- package/dist/signers/descriptors/email.d.ts +1 -1
- package/dist/signers/descriptors/external-wallet.d.cts +1 -1
- package/dist/signers/descriptors/external-wallet.d.ts +1 -1
- package/dist/signers/descriptors/index.cjs +1 -1
- package/dist/signers/descriptors/index.d.cts +1 -1
- package/dist/signers/descriptors/index.d.ts +1 -1
- package/dist/signers/descriptors/index.js +1 -1
- package/dist/signers/descriptors/passkey.d.cts +1 -1
- package/dist/signers/descriptors/passkey.d.ts +1 -1
- package/dist/signers/descriptors/phone.d.cts +1 -1
- package/dist/signers/descriptors/phone.d.ts +1 -1
- package/dist/signers/descriptors/server.cjs +1 -1
- package/dist/signers/descriptors/server.d.cts +1 -1
- package/dist/signers/descriptors/server.d.ts +1 -1
- package/dist/signers/descriptors/server.js +1 -1
- package/dist/signers/descriptors/types.d.cts +1 -1
- package/dist/signers/descriptors/types.d.ts +1 -1
- package/dist/signers/device.d.cts +1 -1
- package/dist/signers/device.d.ts +1 -1
- package/dist/signers/evm-api-key.d.cts +1 -1
- package/dist/signers/evm-api-key.d.ts +1 -1
- package/dist/signers/evm-external-wallet.d.cts +1 -1
- package/dist/signers/evm-external-wallet.d.ts +1 -1
- package/dist/signers/external-wallet-signer.d.cts +1 -1
- package/dist/signers/external-wallet-signer.d.ts +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.d.cts +2 -2
- package/dist/signers/non-custodial/index.d.ts +2 -2
- package/dist/signers/non-custodial/index.js +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.cts +5 -2
- package/dist/signers/non-custodial/ncs-signer.d.ts +5 -2
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.cts +2 -2
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +2 -2
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/passkey.d.cts +1 -1
- package/dist/signers/passkey.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.cjs +1 -1
- package/dist/signers/server/assemble-server-signer.d.cts +1 -1
- package/dist/signers/server/assemble-server-signer.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.js +1 -1
- package/dist/signers/server/evm-server-signer.d.cts +1 -1
- package/dist/signers/server/evm-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/index.d.cts +1 -1
- package/dist/signers/server/helpers/index.d.ts +1 -1
- package/dist/signers/server/index.cjs +1 -1
- package/dist/signers/server/index.d.cts +1 -1
- package/dist/signers/server/index.d.ts +1 -1
- package/dist/signers/server/index.js +1 -1
- package/dist/signers/server/resolver.cjs +1 -1
- package/dist/signers/server/resolver.d.cts +1 -1
- package/dist/signers/server/resolver.d.ts +1 -1
- package/dist/signers/server/resolver.js +1 -1
- package/dist/signers/server/solana-server-signer.cjs +1 -1
- package/dist/signers/server/solana-server-signer.d.cts +2 -2
- package/dist/signers/server/solana-server-signer.d.ts +2 -2
- package/dist/signers/server/solana-server-signer.js +1 -1
- package/dist/signers/server/stellar-server-signer.d.cts +1 -1
- package/dist/signers/server/stellar-server-signer.d.ts +1 -1
- package/dist/signers/solana-api-key.d.cts +1 -1
- package/dist/signers/solana-api-key.d.ts +1 -1
- package/dist/signers/solana-external-wallet.cjs +1 -1
- package/dist/signers/solana-external-wallet.d.cts +5 -2
- package/dist/signers/solana-external-wallet.d.ts +5 -2
- package/dist/signers/solana-external-wallet.js +1 -1
- package/dist/signers/solana-version-1.fixture.cjs +1 -0
- package/dist/signers/solana-version-1.fixture.d.cts +4 -0
- package/dist/signers/solana-version-1.fixture.d.ts +4 -0
- package/dist/signers/solana-version-1.fixture.js +1 -0
- package/dist/signers/stellar-external-wallet.d.cts +1 -1
- package/dist/signers/stellar-external-wallet.d.ts +1 -1
- package/dist/signers/types.cjs +1 -1
- package/dist/signers/types.d.cts +1 -1
- package/dist/signers/types.d.ts +1 -1
- package/dist/signers/types.js +1 -1
- package/dist/{types-r_5ltlhH.d.cts → types-B4kzDRWb.d.cts} +20 -9
- package/dist/{types-D2ugRtLo.d.ts → types-Bxb54lGe.d.ts} +20 -9
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.cts +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.ts +1 -1
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.d.cts +1 -1
- package/dist/utils/device-signers/index.d.ts +1 -1
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/utils/locators.d.cts +1 -1
- package/dist/utils/locators.d.ts +1 -1
- package/dist/utils/recovery.cjs +1 -1
- package/dist/utils/recovery.d.cts +11 -4
- package/dist/utils/recovery.d.ts +11 -4
- package/dist/utils/recovery.js +1 -1
- package/dist/utils/signer-locator.d.cts +1 -1
- package/dist/utils/signer-locator.d.ts +1 -1
- package/dist/utils/signer-mapping.d.cts +1 -1
- package/dist/utils/signer-mapping.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.d.cts +1 -1
- package/dist/wallets/evm.d.ts +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/services/balance-formatter.cjs +1 -1
- package/dist/wallets/services/balance-formatter.d.cts +1 -1
- package/dist/wallets/services/balance-formatter.d.ts +1 -1
- package/dist/wallets/services/balance-formatter.js +1 -1
- package/dist/wallets/services/device-recovery-service.cjs +1 -1
- package/dist/wallets/services/device-recovery-service.d.cts +1 -1
- package/dist/wallets/services/device-recovery-service.d.ts +1 -1
- package/dist/wallets/services/device-recovery-service.js +1 -1
- package/dist/wallets/services/operation-poller.cjs +1 -1
- package/dist/wallets/services/operation-poller.d.cts +1 -1
- package/dist/wallets/services/operation-poller.d.ts +1 -1
- package/dist/wallets/services/operation-poller.js +1 -1
- package/dist/wallets/services/signer-manager.cjs +1 -1
- package/dist/wallets/services/signer-manager.d.cts +1 -1
- package/dist/wallets/services/signer-manager.d.ts +1 -1
- package/dist/wallets/services/signer-manager.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.d.cts +2 -5
- package/dist/wallets/wallet-factory.d.ts +2 -5
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +1 -1
- package/dist/wallets/wallet.d.ts +1 -1
- package/dist/wallets/wallet.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-3DK46BDI.cjs +0 -1
- package/dist/chunk-3KAXLLXJ.js +0 -1
- package/dist/chunk-3L3U3TID.cjs +0 -1
- package/dist/chunk-3TJEBF5U.cjs +0 -1
- package/dist/chunk-4IIZO5PI.cjs +0 -1
- package/dist/chunk-4MNSKZHW.cjs +0 -1
- package/dist/chunk-6KW2HYAX.js +0 -1
- package/dist/chunk-7KKHT5PF.js +0 -1
- package/dist/chunk-BEGVH4DX.js +0 -1
- package/dist/chunk-BXEH6VXA.js +0 -1
- package/dist/chunk-CTCUJBU2.js +0 -1
- package/dist/chunk-D6BFMPZA.cjs +0 -1
- package/dist/chunk-DCKFFFPG.js +0 -1
- package/dist/chunk-EH75GTUJ.js +0 -1
- package/dist/chunk-GAACIEE2.cjs +0 -1
- package/dist/chunk-HOQ2JQHJ.cjs +0 -1
- package/dist/chunk-IQ3QQ4M6.js +0 -1
- package/dist/chunk-L7RATGRO.js +0 -1
- package/dist/chunk-LXAEBSEY.cjs +0 -1
- package/dist/chunk-NYGW4HYK.js +0 -1
- package/dist/chunk-OVUX5RFT.js +0 -1
- package/dist/chunk-P22QL24A.js +0 -1
- package/dist/chunk-Q3JQUVKI.js +0 -1
- package/dist/chunk-QPCZFIUV.cjs +0 -1
- package/dist/chunk-QU5AAJAW.js +0 -1
- package/dist/chunk-S6MOVJXB.js +0 -1
- package/dist/chunk-VPDZLVMK.cjs +0 -1
- package/dist/chunk-YJLJ2IHS.cjs +0 -1
- package/dist/chunk-ZEGNY3K3.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkOQFZL5LIcjs = require('./chunk-OQFZL5LI.cjs');var _chunkAUO6R32Hcjs = require('./chunk-AUO6R32H.cjs');var _chunkZPO3XSWUcjs = require('./chunk-ZPO3XSWU.cjs');var _chunkIR5WN6FQcjs = require('./chunk-IR5WN6FQ.cjs');var _chunkGEY574THcjs = require('./chunk-GEY574TH.cjs');var _chunkUE3WVHTMcjs = require('./chunk-UE3WVHTM.cjs');var _chunk5X4EOJFGcjs = require('./chunk-5X4EOJFG.cjs');var _chunkTCDH5Q6Qcjs = require('./chunk-TCDH5Q6Q.cjs');var _chunkHRUMWG2Fcjs = require('./chunk-HRUMWG2F.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _chains = require('viem/chains');var Z=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.CURTIS,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET],k=[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,_commonsdkbase.BlockchainIncludingTestnet.ARC,_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE,_commonsdkbase.BlockchainIncludingTestnet.BASE,_commonsdkbase.BlockchainIncludingTestnet.BSC,_commonsdkbase.BlockchainIncludingTestnet.CELO,_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM,_commonsdkbase.BlockchainIncludingTestnet.FLOW,_commonsdkbase.BlockchainIncludingTestnet.MANTLE,_commonsdkbase.BlockchainIncludingTestnet.MODE,_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,_commonsdkbase.BlockchainIncludingTestnet.PLUME,_commonsdkbase.BlockchainIncludingTestnet.POLYGON,_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN,_commonsdkbase.BlockchainIncludingTestnet.SCROLL,_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,_commonsdkbase.BlockchainIncludingTestnet.SHAPE,_commonsdkbase.BlockchainIncludingTestnet.STORY,_commonsdkbase.BlockchainIncludingTestnet.TEMPO,_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,_commonsdkbase.BlockchainIncludingTestnet.ZORA];function se(t){switch(t){case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:return _chains.baseSepolia;case _commonsdkbase.BlockchainIncludingTestnet.BASE:return _chains.base;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:return _chains.polygonAmoy;case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:return _chains.polygon;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:return _chains.optimismSepolia;case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:return _chains.optimism;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:return _chains.arbitrumSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:return _chains.arbitrum;case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:return _chains.arbitrumNova;case _commonsdkbase.BlockchainIncludingTestnet.AVALANCHE:return _chains.avalanche;case _commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI:return _chains.avalancheFuji;case _commonsdkbase.BlockchainIncludingTestnet.CELO:return _chains.celo;case _commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA:return _chunkOQFZL5LIcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN:return _chunkAUO6R32Hcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET:return _chunkZPO3XSWUcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:return _chunkGEY574THcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.STORY:return _chunkIR5WN6FQcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:return _chains.modeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.MODE:return _chains.mode;case _commonsdkbase.BlockchainIncludingTestnet.BSC:return _chains.bsc;case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:return _chains.shape;case _commonsdkbase.BlockchainIncludingTestnet.ZORA:return _chains.zora;case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:return _chains.zoraSepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:return _chains.sepolia;case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM:return _chains.mainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW:return _chains.flowMainnet;case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:return _chains.flowTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:return _chains.plumeTestnet;case _commonsdkbase.BlockchainIncludingTestnet.PLUME:return _chains.plume;case _commonsdkbase.BlockchainIncludingTestnet.ARC:return _chunkTCDH5Q6Qcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:return _chunkHRUMWG2Fcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:return _chunkUE3WVHTMcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:return _chunk5X4EOJFGcjs.a;case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function m(t){return Z.includes(t)}function M(t){return k.includes(t)}var J={[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]:_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]:_commonsdkbase.BlockchainIncludingTestnet.CURTIS,[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE]:_commonsdkbase.BlockchainIncludingTestnet.AVALANCHE_FUJI,[_commonsdkbase.BlockchainIncludingTestnet.BASE]:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.CELO]:_commonsdkbase.BlockchainIncludingTestnet.CELO_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM]:_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.FLOW]:_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]:_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.MODE]:_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.PLUME]:_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,[_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN]:_commonsdkbase.BlockchainIncludingTestnet.ROBINHOOD_CHAIN_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]:_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]:_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.STORY]:_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]:_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.ZORA]:_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]:_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET,[_commonsdkbase.BlockchainIncludingTestnet.ARC]:_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET};function q(t){return J[t]}function z(t){return t==="solana"||t==="stellar"||m(t)||M(t)}function Se(t,a){if(!z(t))throw new (0, _chunkVS6I4S7Xcjs.c)(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===_commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;if(T&&m(r))throw new (0, _chunkVS6I4S7Xcjs.b)(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&M(r)){let n=q(r);if(n!=null)return _chunkW3BYSI7Fcjs.a.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;_chunkW3BYSI7Fcjs.a.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}exports.a = se; exports.b = m; exports.c = M; exports.d = q; exports.e = z; exports.f = Se;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBK4RGDMJcjs = require('./chunk-BK4RGDMJ.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var a=class g extends _chunkBK4RGDMJcjs.a{constructor(n){super(n)}signMessage(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();_chunkW3BYSI7Fcjs.a.info("sign: sending request",{keyType:"ed25519"});let d=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:_chunkBK4RGDMJcjs.b});if(_chunkW3BYSI7Fcjs.a.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-d}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};exports.a = a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-3NAV25KH.js";import{a as W}from"./chunk-JGLNAY5C.js";import{C as f,H as w,y as l}from"./chunk-KOHPRJDP.js";import{a as n}from"./chunk-INUEMQPG.js";import{c as u,h as p}from"./chunk-NU7VF7MC.js";import{createPublicClient as O,encodeFunctionData as x,http as E}from"viem";import{isValidEvmAddress as A,WithLoggerContext as h}from"@crossmint/common-sdk-base";var c=class c extends o{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:o.getOptions(e),alias:e.alias,recovery:o.getRecoverySigners(e),apiRecoveryServerSignerAddresses:o.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:o.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:o.getInitialSigners(e)},o.getApiClient(e))}static from(e){if(!A(e.address))throw new Error("Wallet is not an EVM wallet");return new c(e)}sendTransaction(e){return p(this,null,function*(){var i;n.info("evmWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let t=this.buildTransaction(e),r=yield this.createTransaction(t,e.options);if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a=yield this.approveTransactionAndWait(r.id);return n.info("evmWallet.sendTransaction.success",{transactionId:r.id,hash:a.hash}),a})}signMessage(e){return p(this,null,function*(){var i;n.info("evmWallet.signMessage.start"),yield this.preAuthIfNeeded();let t=this.signerManager.require(),r=yield this.apiClient.createSignature(this.walletLocator,{type:"message",params:{message:e.message,signer:t.locator(),chain:this.chain}});if("error"in r)throw n.error("evmWallet.signMessage.error",{error:r}),new f(JSON.stringify(r));if((i=e.options)!=null&&i.prepareOnly)return n.info("evmWallet.signMessage.prepared",{signatureId:r.id}),{signature:void 0,signatureId:r.id};let a=yield this.approveSignatureAndWait(r.id);return n.info("evmWallet.signMessage.success",{signatureId:r.id}),a})}signTypedData(e){return p(this,null,function*(){var C;n.info("evmWallet.signTypedData.start"),yield this.preAuthIfNeeded();let t=this.signerManager.require(),{domain:r,message:a,primaryType:i,types:g,chain:T}=e;if(!r||!a||!g||!T)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data"}),new l("Invalid typed data");let{name:m,version:v,chainId:S,verifyingContract:I,salt:b}=r;if(!m||!v||!S||!I)throw n.error("evmWallet.signTypedData.error",{error:"Invalid typed data domain"}),new l("Invalid typed data domain");let d=yield this.apiClient.createSignature(this.walletLocator,{type:"typed-data",params:{typedData:{domain:{name:m,version:v,chainId:Number(S),verifyingContract:I,salt:b},message:y(a),primaryType:i,types:g},signer:t.locator(),chain:T}});if("error"in d)throw n.error("evmWallet.signTypedData.error",{error:d}),new f(JSON.stringify(d));if((C=e.options)!=null&&C.prepareOnly)return n.info("evmWallet.signTypedData.prepared",{signatureId:d.id}),{signature:void 0,signatureId:d.id};let D=yield this.approveSignatureAndWait(d.id);return n.info("evmWallet.signTypedData.success",{signatureId:d.id}),D})}getViemClient(e){var t;return O({transport:(t=e==null?void 0:e.transport)!=null?t:E(),chain:W(this.chain)})}createTransaction(e,t){return p(this,null,function*(){let r;(t==null?void 0:t.signer)==null?r=this.signerManager.require().locator():typeof t.signer=="string"?r=t.signer:r=this.resolveServerSignerApiLocator(t.signer);let a=yield this.apiClient.createTransaction(this.walletLocator,{params:{signer:r,chain:this.chain,calls:[e]}});if("error"in a)throw new w(JSON.stringify(a));return a})}buildTransaction(e){var t,r,a,i,g;if("transaction"in e)return{transaction:e.transaction};if(e.abi==null)return{to:e.to,value:(r=(t=e.value)==null?void 0:t.toString())!=null?r:"0",data:(a=e.data)!=null?a:"0x"};if(!e.functionName)throw new Error("Function name is required");return{to:e.to,value:(g=(i=e.value)==null?void 0:i.toString())!=null?g:"0",data:x({abi:e.abi,functionName:e.functionName,args:e.args})}}};u([h({logger:n,methodName:"evmWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1),u([h({logger:n,methodName:"evmWallet.signMessage",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signMessage",1),u([h({logger:n,methodName:"evmWallet.signTypedData",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"signTypedData",1);var M=c;function y(s){return typeof s=="bigint"?s.toString():Array.isArray(s)?s.map(y):s!==null&&typeof s=="object"?Object.fromEntries(Object.entries(s).map(([e,t])=>[e,y(t)])):s}export{M as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as g}from"./chunk-
|
|
1
|
+
import{a,b as g}from"./chunk-K4KSI3GM.js";import{a as s}from"./chunk-INUEMQPG.js";import{h as t}from"./chunk-NU7VF7MC.js";import{PersonalMessage as u}from"ox";import{isHex as h,toHex as l}from"viem";var c=class p extends a{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){let i=h(e)?e:l(e),r=u.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return t(this,null,function*(){return yield this.sign(e)})}sign(e){return t(this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");s.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:g});if(s.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};export{c as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBIL7GVBLcjs = require('./chunk-BIL7GVBL.cjs');var _chunk2D6B7AZ6cjs = require('./chunk-2D6B7AZ6.cjs');var _chunkVMDJJX7Pcjs = require('./chunk-VMDJJX7P.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');function l(a,e){switch(_chunkENU3EKBGcjs.a.call(void 0, a)){case"evm":return new (0, _chunkVMDJJX7Pcjs.a)(e);case"solana":return new (0, _chunkBIL7GVBLcjs.a)(e);case"stellar":return new (0, _chunk2D6B7AZ6cjs.a)(e)}}exports.a = l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkUY7L4D4Mcjs = require('./chunk-UY7L4D4M.cjs');var _chunkSTB2VIIKcjs = require('./chunk-STB2VIIK.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class c extends _chunkUY7L4D4Mcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkUY7L4D4Mcjs.a.getOptions(e),alias:e.alias,recovery:_chunkUY7L4D4Mcjs.a.getRecoverySigners(e),apiRecoveryServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkUY7L4D4Mcjs.a.getInitialSigners(e)},_chunkUY7L4D4Mcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidSolanaAddress.call(void 0, e.address))throw new Error("Wallet is not a Solana wallet");return new c(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var g,S;_chunkW3BYSI7Fcjs.a.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((g=e.options)!=null&&g.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(S=e.additionalSigners)==null?void 0:S.map(o=>new (0, _chunkSTB2VIIKcjs.a)({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSign:d=>(d.sign([o]),Promise.resolve(d)),onSignBytes:d=>Promise.resolve(_bs582.default.encode(_tweetnacl2.default.sign.detached(_bs582.default.decode(d),o.secretKey)))}))},a=yield this.approveTransactionAndWait(n.id,i);return _chunkW3BYSI7Fcjs.a.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.signerManager.require().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=_bs582.default.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new (0, _chunkVS6I4S7Xcjs.H)(JSON.stringify(i));return i})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1);var T=c;exports.a = T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBK4RGDMJcjs = require('./chunk-BK4RGDMJ.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _ox = require('ox');var _viem = require('viem');var c=class p extends _chunkBK4RGDMJcjs.a{constructor(e){super(e)}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=_viem.isHex.call(void 0, e)?e:_viem.toHex.call(void 0, e),r=_ox.PersonalMessage.getSignPayload(i);return yield this.sign(r)})}signTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.sign(e)})}sign(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var o;yield this.handleAuthRequired();let i=this.getJwtOrThrow(),r=e.replace("0x","");_chunkW3BYSI7Fcjs.a.info("sign: sending request",{keyType:"secp256k1"});let y=Date.now(),n=yield(o=this.config.clientTEEConnection)==null?void 0:o.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:i,apiKey:this.config.crossmint.apiKey},data:{keyType:"secp256k1",bytes:r,encoding:"hex"}},options:_chunkBK4RGDMJcjs.b});if(_chunkW3BYSI7Fcjs.a.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign transaction");return p.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="hex"||e.keyType!=="secp256k1"||e.bytes==null)throw new Error("Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"secp256k1",encoding:"hex"}}};exports.a = c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as W,b as I}from"./chunk-NZHMWFOO.js";import{a as N}from"./chunk-3NAV25KH.js";import{a as L}from"./chunk-5LNDUSMZ.js";import{b as w}from"./chunk-BV6IQIQK.js";import{b as u,c as E}from"./chunk-JLWNRQ4S.js";import{b as x,c as b}from"./chunk-TSJUK3ED.js";import{f as k}from"./chunk-JGLNAY5C.js";import{R as K,e as $,g as h,l as M,o as P,t as q}from"./chunk-KOHPRJDP.js";import{a as C}from"./chunk-INUEMQPG.js";import{a as f,b as S,c as F,h as y}from"./chunk-NU7VF7MC.js";import{WithLoggerContext as O}from"@crossmint/common-sdk-base";import{WebAuthnP256 as _}from"ox";var j="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R=class{constructor(e){this.apiClient=e}getWallet(e,r){return y(this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new h("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new h("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new h("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=S(f({},i),{chain:k(i.chain,this.apiClient.environment)});C.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(n);if("error"in a)throw C.warn("walletFactory.getWallet.notFound",{error:a.error}),new $(JSON.stringify(a));return C.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,t)})}createWallet(e){return y(this,null,function*(){var p,c,v,m,D,T;let r=S(f({},e),{chain:k(e.chain,this.apiClient.environment)}),n=W(r);if(n.length===0)throw new P(I(r)?"At least one recovery method is required":"A recovery method is required");if(yield(v=(c=(p=r.options)==null?void 0:p.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:v.call(c),C.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw C.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new h("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let i=(m=r.signers)!=null?m:[],t=((D=r.options)==null?void 0:D.deviceSignerKeyStorage)!=null&&!i.some(A=>A.type==="device"),a=t?[...i,{type:"device"}]:i,l=yield this.registerSigners(a,r.chain,(T=r.options)==null?void 0:T.deviceSignerKeyStorage),s=this.validatedRecoverySignerList(n,r.chain),o=[];for(let A of s)o.push(yield this.resolveRecoverySigner(A,r.chain));let d=this.buildRecoveryRequestConfig(r,o),g=yield this.createSmartWallet(r,d,l,t);if("error"in g)throw C.error("walletFactory.createWallet.error",{error:g.error}),K(g),new h(JSON.stringify(g));return C.info("walletFactory.createWallet.success",{address:g.address}),yield this.createWalletInstance(g,r)})}createSmartWallet(e,r,n,i){return y(this,null,function*(){let t=o=>{var d,g;return{type:"smart",chainType:this.getChainType(e.chain),config:f(f(f({},r),e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(d=e.owner)!=null?d:void 0,alias:(g=e.alias)!=null?g:void 0}},a=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in a&&a.code===M))return a;C.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let s=n.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(t(s))})}buildRecoveryRequestConfig(e,r){return I(e)&&(e.chain==="solana"||e.chain==="stellar")?{recoveryMethods:r}:{adminSigner:r[0]}}validatedRecoverySignerList(e,r){if(e.length===0)throw new P("At least one recovery method is required");if(e.length>1&&r!=="solana"&&r!=="stellar")throw new q(`Multiple recovery methods are not supported on ${r} yet. Pass a single recovery method.`);return e}resolveRecoverySigner(e,r){return y(this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=x(e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:S(f({},e),{channel:r.channel})}createWalletInstance(e,r){return y(this,null,function*(){var p;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(p=i.recoveryMethods)!=null?p:[i.adminSigner],a=this.mergeRecoverySigners(t,W(n),r.chain),l=i.delegatedSigners,s=l;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=n.signers;else if(s!=null){let c=n.signers;s=s.map(v=>this.mergePhoneChannel(v,c==null?void 0:c.find(m=>m.type==="phone"&&v.type==="phone"&&w(m)===v.locator)))}let o=t.filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),d=(l!=null?l:[]).filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),g=new N({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:a,apiRecoveryServerSignerAddresses:o,apiDelegatedServerSignerAddresses:d,signers:s!=null?s:[]},this.apiClient);return yield g.waitForInit(),g})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,a=[(l,s)=>this.matchesRecoverySigner(l,s,n),(l,s)=>l.type===s.type];for(let l of a)e.forEach((s,o)=>{if(t.has(o))return;let d=i.findIndex(g=>l(g,s));d!==-1&&t.set(o,i.splice(d,1)[0])});return e.map((l,s)=>{let o=t.get(s);return o==null?l:o.type==="server"||o.type==="external-wallet"?o:this.mergePhoneChannel(l,o)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return u(e.email)===u(r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=b(e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return y(this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var t;if(r.owner!=null&&e.owner!=null&&u(r.owner)!==u(e.owner))throw new h("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new h(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r,i=W(n);if(n.recovery!=null||n.recoveryMethods!=null||n.signers!=null){let a=e.config,l=(t=a==null?void 0:a.recoveryMethods)!=null?t:(a==null?void 0:a.adminSigner)!=null?[a.adminSigner]:[],s=[...l];for(let d of i){if(l.length===0)break;let g=s.findIndex(c=>this.matchesRecoverySigner(d,c,r.chain)),p=g===-1?s.find(c=>c.type===d.type):s[g];if(p==null)throw new h("The wallet recovery signer type does not match the existing wallet's recovery signer type");E(d,p),g!==-1&&s.splice(g,1)}let o=n.signers;o!=null&&this.validateSigners(e,o,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new h(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${j}`);for(let a of r){let l=t.find(s=>{if(this.isMatchingPasskeySigner(a,s,i)||s.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:d}=b(a,n,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${o.derivedAddress}`||d!=null&&s.locator===`server:${d.derivedAddress}`}return s.locator===w(a)});if(l==null){let s=t.map(o=>o.locator).join(", ");throw new h(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${s}. ${j}`)}E(a,l)}}}isMatchingPasskeySigner(e,r,n){var t,a;let i=((a=(t=n.delegatedSigners)==null?void 0:t.filter(l=>l.type==="passkey").length)!=null?a:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new h("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return y(this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>y(this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new h("Device signer key storage is required for device signers");let a=yield L(n);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:a}=x(t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:w(t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};F([O({logger:C,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),F([O({logger:C,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);export{R as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk52EJ53LPcjs = require('./chunk-52EJ53LP.cjs');var _chunkTA5VIPMHcjs = require('./chunk-TA5VIPMH.cjs');var _chunk2QCYHRPXcjs = require('./chunk-2QCYHRPX.cjs');var _chunkENU3EKBGcjs = require('./chunk-ENU3EKBG.cjs');var n={evm:_chunk52EJ53LPcjs.a,solana:_chunkTA5VIPMHcjs.a,stellar:_chunk2QCYHRPXcjs.a};function h(e){return n[_chunkENU3EKBGcjs.a.call(void 0, e)]}function p(e){return Object.prototype.hasOwnProperty.call(n,e)}function m(e,o){return p(e)?n[e]:o}exports.a = h; exports.b = p; exports.c = m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as g}from"./chunk-B4GYB3XY.js";import{j as d}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-INUEMQPG.js";var m={nativeToken:"eth",walletLocatorPrefix:"me:evm:smart",supportsSignatures:!0,addSignerChain(e){return e},extractAddSignerOperation(e,r,n){var t,a,o,s;if(!("chains"in e))throw i.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");if(((a=(t=e.chains)==null?void 0:t[r])==null?void 0:a.status)==="failed")throw i.error("wallet.addSigner.failed",{chain:r,signerType:n.type,signerLocator:n.locator,chainStatus:(o=e.chains)==null?void 0:o[r]}),new d(`Signer registration failed for chain ${r} (signer: ${n.locator})`,JSON.stringify((s=e.chains)==null?void 0:s[r]));return g(e,r)},balanceTokenFields(e){return e!=null&&"contractAddress"in e?{contractAddress:e.contractAddress}:{}},emptyBalanceTokenFields(){return{contractAddress:void 0}},signApproval(e,r,n){return e.signTransaction(n)}};export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as s,b as o}from"./chunk-K4KSI3GM.js";import{a as i}from"./chunk-INUEMQPG.js";import{h as t}from"./chunk-NU7VF7MC.js";import a from"bs58";var g=class c extends s{constructor(e){super(e)}signMessage(e){return t(this,null,function*(){return yield this.sign(a.decode(e))})}signTransaction(e){return t(this,null,function*(){return yield this.signMessage(e)})}sign(e){return t(this,null,function*(){var r;yield this.handleAuthRequired();let d=this.getJwtOrThrow();i.info("sign: sending request",{keyType:"ed25519"});let y=Date.now(),n=yield(r=this.config.clientTEEConnection)==null?void 0:r.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:d,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:a.encode(new Uint8Array(e)),encoding:"base58"}},options:o});if(i.info("sign: response received",{status:n==null?void 0:n.status,durationMs:Date.now()-y}),(n==null?void 0:n.status)==="error")throw new Error(n.error);if((n==null?void 0:n.signature)==null)throw new Error("Failed to sign payload");return c.verifyPublicKeyFormat(n.publicKey),{signature:n.signature.bytes}})}static verifyPublicKeyFormat(e){if(e==null)throw new Error("No public key found");if(e.encoding!=="base58"||e.keyType!=="ed25519"||e.bytes==null)throw new Error("Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: "+JSON.stringify(e))}getChainKeyParams(){return{scheme:"ed25519",encoding:"base58"}}};export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var t=_viem.defineChain.call(void 0, {id:4663,name:"Robinhood Chain",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.mainnet.chain.robinhood.com"]}},blockExplorers:{default:{name:"Robinhood Chain Explorer",url:"https://robinhoodchain.blockscout.com",apiUrl:"https://robinhoodchain.blockscout.com/api"}},testnet:!1});exports.a = t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQ6EAHDUcjs = require('./chunk-IQ6EAHDU.cjs');var _chunkP5VJ455Gcjs = require('./chunk-P5VJ455G.cjs');var _chunkT5LUBX5Jcjs = require('./chunk-T5LUBX5J.cjs');var _chunk3RVLLQ4Mcjs = require('./chunk-3RVLLQ4M.cjs');var _chunkD6UK5JAAcjs = require('./chunk-D6UK5JAA.cjs');var _chunkXFUCYR24cjs = require('./chunk-XFUCYR24.cjs');var _chunkKQIDRPABcjs = require('./chunk-KQIDRPAB.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');function u(r){switch(r){case"email":return _chunkP5VJ455Gcjs.a;case"phone":return _chunkD6UK5JAAcjs.a;case"passkey":return _chunk3RVLLQ4Mcjs.a;case"device":return _chunkIQ6EAHDUcjs.a;case"api-key":return _chunkKQIDRPABcjs.a;case"server":return _chunkXFUCYR24cjs.a;case"external-wallet":return _chunkT5LUBX5Jcjs.b;default:throw new (0, _chunkVS6I4S7Xcjs.k)(`Unknown signer type: ${r}`)}}exports.a = u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkLWA3SX6Zcjs = require('./chunk-LWA3SX6Z.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _chunkLWA3SX6Zcjs = require('./chunk-LWA3SX6Z.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _web3js = require('@solana/web3.js');var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var i=class{constructor(e){this.type="server";this.keypair=_web3js.Keypair.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator,_chunkLWA3SX6Zcjs.a.call(void 0, e.derivedKeyBytes)}address(){return this._address}locator(){return this._locator}signMessage(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=_bs582.default.decode(e),o=_tweetnacl2.default.sign.detached(a,this.keypair.secretKey);return{signature:_bs582.default.encode(o)}})}signTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.signMessage(e)})}};exports.a = i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkATIC4ENGcjs = require('./chunk-ATIC4ENG.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var p=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("TEE connection not initialized, initializing now");let i=_commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new (0, _chunkATIC4ENGcjs.a)({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");_chunkW3BYSI7Fcjs.a.info("TEE connection initialized successfully")})}handleAuthRequired(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);_chunkW3BYSI7Fcjs.a.info("get-status: sending request");let h=Date.now(),r=yield t.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:i},options:f}),a=Date.now()-h;if((r==null?void 0:r.status)!=="success"){let o=(r==null?void 0:r.status)==="error"&&r.error||"Failed to retrieve signer status",l=(r==null?void 0:r.status)==="error"?r.code:void 0;throw _chunkW3BYSI7Fcjs.a.error("get-status: failed",{status:r==null?void 0:r.status,error:(r==null?void 0:r.status)==="error"?r.error:void 0,code:l,durationMs:a}),O(o,l)?new (0, _chunkHCV4M7X2cjs.c)(o,l):new (0, _chunkHCV4M7X2cjs.d)(o,l)}if(_chunkW3BYSI7Fcjs.a.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:a}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;_chunkW3BYSI7Fcjs.a.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:e,resolve:c,reject:d}=this.createAuthPromise();if(this._authPromise={promise:e,resolve:c,reject:d},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>{var o;return(o=this._authPromise)==null?void 0:o.reject(new _chunkHCV4M7X2cjs.a)})),d(new _chunkHCV4M7X2cjs.a)}))}catch(o){_chunkW3BYSI7Fcjs.a.error("handleAuthRequired error",{error:o}),d(o)}try{yield e}catch(o){throw _chunkW3BYSI7Fcjs.a.error("handleAuthRequired promise error",{error:o}),o}})}ensureAuthenticated(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){this.getJwtOrThrow(),this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null||i.trim()==="")throw new (0, _chunkHCV4M7X2cjs.c)(`${this.type} signer requires a valid Crossmint JWT. The user's session is missing or has expired: re-authenticate the user and refresh the JWT before retrying.`,C);return i}getAuthDataOrThrow(){return{jwt:this.getJwtOrThrow(),apiKey:this.config.crossmint.apiKey}}createAuthPromise(){let i,t;return{promise:new Promise((r,a)=>{i=r,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;try{yield this.startOnboarding()}catch(t){throw t instanceof _chunkHCV4M7X2cjs.c&&((i=this._authPromise)==null||i.reject(t)),t}})}startOnboarding(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection(),h=this.getAuthId();_chunkW3BYSI7Fcjs.a.info("start-onboarding: sending request");let r=Date.now(),a=this.config.type==="phone"?this.config.channel:void 0,e=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:i,data:_chunkDSIFRRBScjs.a.call(void 0, {authId:h},a!=null?{channel:a}:{})},options:f}),c=Date.now()-r;if(this._onboardingConnectionGeneration=t.connectionGeneration,_chunkW3BYSI7Fcjs.a.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:c}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}if((e==null?void 0:e.status)==="error"){_chunkW3BYSI7Fcjs.a.error("start-onboarding: failed",{error:e.error,code:e.code});let d=e.error||"Failed to initiate OTP process.";throw O(d,e.code)?new (0, _chunkHCV4M7X2cjs.c)(d,e.code):new (0, _chunkHCV4M7X2cjs.b)(d,e.code)}})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var a;let t;try{let e=yield this.getTEEConnection();_chunkW3BYSI7Fcjs.a.info("complete-onboarding: sending request");let c=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:this.getAuthDataOrThrow(),data:{onboardingAuthentication:{encryptedOtp:i}}},options:f}),_chunkW3BYSI7Fcjs.a.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-c})}catch(e){return _chunkW3BYSI7Fcjs.a.error("complete-onboarding: error",{error:e}),yield this.handleOnboardingVerificationFailure(e)}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new _chunkHCV4M7X2cjs.a)})),(a=this._authPromise)==null||a.resolve();return}_chunkW3BYSI7Fcjs.a.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let h=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",r=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new (0, _chunkHCV4M7X2cjs.b)(h,r))})}handleOnboardingVerificationFailure(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var r,a,e;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){_chunkW3BYSI7Fcjs.a.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(c){throw(r=this._authPromise)==null||r.reject(c),c}if(!this._needsAuth){(a=this._authPromise)==null||a.resolve();return}throw new _chunkHCV4M7X2cjs.f}throw(e=this._authPromise)==null||e.reject(i),i})}_exportPrivateKey(i,t){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){yield this.ensureAuthenticated();let h=this.getJwtOrThrow(),{scheme:r,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",d=>{i.off(c),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let e=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:h,apiKey:this.config.crossmint.apiKey},data:{scheme:r,encoding:a,walletAddress:this.config.address,authId:this.getAuthId()}},options:f});if((e==null?void 0:e.status)==="error")throw _chunkW3BYSI7Fcjs.a.error("export-signer: failed",{error:e.error,code:e.code}),new (0, _chunkHCV4M7X2cjs.e)(e.error||"Failed to export private key",e.code)})}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"handleAuthRequired"})],p.prototype,"handleAuthRequired",1);var f={timeoutMs:3e4},C= exports.c ="jwt-required",S=new Set(["unauthorized","unauthenticated"]);function O(E,i){return i!=null&&S.has(i.toLowerCase())?!0:/\bHTTP 401\b/.test(E)}exports.a = p; exports.b = f; exports.c = C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-
|
|
1
|
+
import{a as o}from"./chunk-KOHPRJDP.js";import{a as i}from"./chunk-INUEMQPG.js";import{b as c,c as l}from"./chunk-MDAPK5FG.js";import{h as n}from"./chunk-NU7VF7MC.js";import{APIKeyEnvironmentPrefix as d,APIKeyUsageOrigin as g,ApiClientError as u,CrossmintApiClient as P}from"@crossmint/common-sdk-base";var h=class extends P{constructor(e){super(e,{internalConfig:{sdkMetadata:{name:l,version:c}}});this.apiPrefix="api/2025-06-09/wallets";this.unstableApiPrefix="api/unstable/wallets"}createWallet(e){return n(this,null,function*(){let s=this.isServerSide?`${this.apiPrefix}`:`${this.apiPrefix}/me`;i.info("wallets.api.createWallet",{chainType:e.chainType,walletType:e.type});let t=yield(yield this.post(s,{body:JSON.stringify(e),headers:this.headers})).json();return"error"in t?i.error("wallets.api.createWallet.error",{error:t.error,chainType:e.chainType}):"address"in t&&i.info("wallets.api.createWallet.success",{address:t.address,chainType:e.chainType}),t})}getWallet(e){return n(this,null,function*(){i.info("wallets.api.getWallet",{locator:e});let r=yield(yield this.get(`${this.apiPrefix}/${e}`,{headers:this.headers})).json();return"error"in r?i.warn("wallets.api.getWallet.error",{locator:e,error:r.error}):"address"in r&&i.info("wallets.api.getWallet.success",{address:r.address,locator:e}),r})}createTransaction(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveTransaction(e,s,r){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/transactions/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers})).json()})}getTransaction(e,s){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions/${s}`,{headers:this.headers})).json()})}createSignature(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signatures`,{body:JSON.stringify(s),headers:this.headers})).json()})}approveSignature(e,s,r){return n(this,null,function*(){let t=yield this.post(`${this.apiPrefix}/${e}/signatures/${s}/approvals`,{body:JSON.stringify(r),headers:this.headers});return t.status===422?this.getSignature(e,s):t.json()})}getSignature(e,s){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/signatures/${s}`,{headers:this.headers})).json()})}getTransactions(e){return n(this,null,function*(){return(yield this.get(`${this.apiPrefix}/${e}/transactions`,{headers:this.headers})).json()})}getNfts(e){return n(this,null,function*(){let s=new URLSearchParams;s.append("page",e.page.toString()),s.append("perPage",e.perPage.toString());let r=`${e.chain}:${e.address}`;return(yield this.get(`${this.apiPrefix}/${r}/nfts?${s.toString()}`,{headers:this.headers})).json()})}getTransfers(e,s){return n(this,null,function*(){let r=new URLSearchParams;return r.append("chain",s.chain.toString()),s.tokens!=null&&r.append("tokens",s.tokens),r.append("status",s.status),(yield this.get(`${this.unstableApiPrefix}/${e}/transfers?${r.toString()}`,{headers:this.headers})).json()})}getBalance(e,s){return n(this,null,function*(){let r=new URLSearchParams;return r.append("tokens",s.tokens.join(",")),r.append("chains",s.chains.join(",")),(yield this.get(`${this.apiPrefix}/${e}/balances?${r.toString()}`,{headers:this.headers})).json()})}fundWallet(e,s){return n(this,null,function*(){if(this.environment===d.PRODUCTION)throw new Error("Funding wallets is only supported in staging environment");return(yield this.post(`api/v1-alpha2/wallets/${e}/balances`,{body:JSON.stringify(s),headers:this.headers})).json()})}registerSigner(e,s){return n(this,null,function*(){return(yield this.post(`${this.apiPrefix}/${e}/signers`,{body:JSON.stringify(s),headers:this.headers})).json()})}removeSigner(e,s,r){return n(this,null,function*(){let t=encodeURIComponent(s),a=new URLSearchParams;r.chain&&a.append("chain",r.chain),r.approver!=null&&a.append("approver",r.approver);let p=`${this.apiPrefix}/${e}/signers/${t}${a.size>0?`?${a.toString()}`:""}`;return(yield this.delete(p,{headers:this.headers})).json()})}getSigner(e,s){return n(this,null,function*(){let r=encodeURIComponent(s),t=yield this.get(`${this.apiPrefix}/${e}/signers/${r}`,{headers:this.headers});if(!t.ok){let a=null;try{a=yield t.text()}catch(p){}throw new u(`API request failed: ${t.status} ${t.statusText}`,t.status,t.statusText,a)}return t.json()})}send(e,s,r){return n(this,null,function*(){i.info("wallets.api.send",{walletLocator:e,tokenLocator:s,recipient:r.recipient});let a=yield(yield this.post(`${this.apiPrefix}/${e}/tokens/${s}/transfers`,{body:JSON.stringify(r),headers:this.headers})).json();return"error"in a?i.error("wallets.api.send.error",{walletLocator:e,tokenLocator:s,error:a.error}):"id"in a&&i.info("wallets.api.send.success",{walletLocator:e,transactionId:a.id}),a})}get isServerSide(){return this.parsedAPIKey.usageOrigin===g.SERVER}get environment(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.environment}get projectId(){if(!this.parsedAPIKey.isValid)throw new o("Invalid API key");return this.parsedAPIKey.projectId}get headers(){return{"Content-Type":"application/json"}}};export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-3UROOLIH.js";import{a as o}from"./chunk-25TINDQ4.js";import{b as n}from"./chunk-SWQSW2AD.js";import{a as s}from"./chunk-WVKODEVW.js";import{a as p}from"./chunk-AEO4REZV.js";import{a as c}from"./chunk-X7V2C53V.js";import{a as i}from"./chunk-PKFCOQOM.js";import{k as e}from"./chunk-KOHPRJDP.js";function h(r){switch(r){case"email":return o;case"phone":return p;case"passkey":return s;case"device":return t;case"api-key":return i;case"server":return c;case"external-wallet":return n;default:throw new e(`Unknown signer type: ${r}`)}}export{h as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{w}from"./chunk-KOHPRJDP.js";import{a as l}from"./chunk-
|
|
1
|
+
import{a as P}from"./chunk-NZXYWQE5.js";import{a as v}from"./chunk-IOSADDL5.js";import{w}from"./chunk-KOHPRJDP.js";import{a as l}from"./chunk-INUEMQPG.js";import{c as m,h as n}from"./chunk-NU7VF7MC.js";import{getEnvironmentForKey as K,APIKeyEnvironmentPrefix as h,WithLoggerContext as u}from"@crossmint/common-sdk-base";import{WebAuthnP256 as b}from"ox";var R={[h.DEVELOPMENT]:"https://development.devicekey.store",[h.STAGING]:"https://staging.devicekey.store",[h.PRODUCTION]:"https://devicekey.store"},E=6e4,L="indexeddb-fatal",c=class extends v{constructor(e){super(e);this.iframePromise=null;this.reloading=null;this.biometricRequestHandler=null;this.biometricListener=null;if(typeof window!="undefined"&&!P())throw new w("Device signer requires a browser with third-party storage partitioning (Chrome \u2265 115, Firefox \u2265 103, or Safari). Without storage partitioning, different embedders of the same iframe can share IndexedDB, allowing cross-site key access. See https://developer.chrome.com/blog/storage-partitioning");let r=K(e);if(r==null)throw new Error("Unable to determine environment from API key");this.iframeUrl=R[r]}setBiometricRequestHandler(e){this.biometricRequestHandler=e}generateKey(){return n(this,arguments,function*(e={biometricPolicy:"none"}){return(yield this.rpc("generateKey",e)).publicKeyBase64})}mapAddressToKey(e,r){return n(this,null,function*(){yield this.rpc("mapAddressToKey",{address:e,publicKeyBase64:r})})}getKey(e){return n(this,null,function*(){return(yield this.rpc("getKey",{address:e})).publicKeyBase64})}hasKey(e){return n(this,null,function*(){return(yield this.rpc("hasKey",{publicKeyBase64:e})).hasKey})}signMessage(e,r){return n(this,null,function*(){return yield this.rpc("signMessage",{address:e,message:r})})}deleteKey(e){return n(this,null,function*(){yield this.rpc("deleteKey",{address:e})})}destroy(){this.biometricListener!=null&&(window.removeEventListener("message",this.biometricListener),this.biometricListener=null),this.iframePromise!=null&&(this.iframePromise.then(e=>e.remove()).catch(()=>{}),this.iframePromise=null)}rpc(e,r){return n(this,null,function*(){let i=yield this.sendRpc(e,r);if(i.fatal){l.warn(`[IframeDeviceSignerKeyStorage] Recoverable IDB error on "${e}", reloading iframe and retrying`),yield this.reloadIframe();let t=yield this.sendRpc(e,r);if(t.fatal)throw new Error(`Device signer IDB fatal error on "${e}" persisted after iframe reload`);return t.value}return i.value})}sendRpc(e,r){return n(this,null,function*(){let t=(yield this.getIframe()).contentWindow;if(t==null)throw new Error("Device signer iframe has no contentWindow");let g=crypto.randomUUID(),a=new URL(this.iframeUrl).origin;return new Promise((s,o)=>{let f=setTimeout(()=>{window.removeEventListener("message",p),o(new Error(`Device signer RPC "${e}" timed out after ${E}ms`))},E);function p(y){let d=y.data;d==null||d.id!==g||y.origin===a&&(clearTimeout(f),window.removeEventListener("message",p),d.type==="error"&&d.code===L?s({fatal:!0}):d.type==="error"?o(new Error(d.error)):s({value:d.result,fatal:!1}))}window.addEventListener("message",p),t.postMessage({type:e,id:g,payload:r},this.iframeUrl)})})}reloadIframe(){return n(this,null,function*(){if(this.reloading!=null)return this.reloading;let e=n(this,null,function*(){try{this.destroy(),yield this.getIframe()}finally{this.reloading=null}});return this.reloading=e,e})}setupBiometricListener(e){let r=new URL(this.iframeUrl).origin;this.biometricListener=i=>n(this,null,function*(){if(i.origin!==r)return;let t=i.data;if((t==null?void 0:t.type)!=="biometric-request")return;let g=e.contentWindow;if(g!=null)try{this.biometricRequestHandler!=null&&(yield this.biometricRequestHandler(t.action));let a=null;if(t.action==="createCredential"){let s=t.payload,o=yield b.createCredential({name:s.name});a={id:o.id,publicKey:{x:`0x${o.publicKey.x.toString(16)}`,y:`0x${o.publicKey.y.toString(16)}`}}}else if(t.action==="sign"){let s=t.payload,{signature:o,metadata:f}=yield b.sign({credentialId:s.credentialId,challenge:s.challenge});a={signature:{r:`0x${o.r.toString(16)}`,s:`0x${o.s.toString(16)}`},metadata:f}}g.postMessage({type:"biometric-response",id:t.id,result:a},this.iframeUrl)}catch(a){let s=a instanceof Error?a.message:"Unknown biometric error";g.postMessage({type:"biometric-response",id:t.id,error:s},this.iframeUrl)}}),window.addEventListener("message",this.biometricListener)}getIframe(){return this.iframePromise==null&&(this.iframePromise=this.createIframe().catch(e=>{throw this.iframePromise=null,e})),this.iframePromise}createIframe(){let e=document.createElement("iframe");return e.src=this.iframeUrl,Object.assign(e.style,{position:"absolute",opacity:"0",pointerEvents:"none",width:"0",height:"0",border:"none",top:"-9999px",left:"-9999px"}),new Promise((r,i)=>{e.onload=()=>{this.setupBiometricListener(e),r(e)},e.onerror=()=>i(new Error("Failed to load device signer iframe")),document.body.appendChild(e)})}getDeviceName(){var t;if(typeof navigator=="undefined")return"Unknown Device";let e=navigator.userAgent,r=this.parseDevice(e),i=this.parseBrowser(e);return r!=null&&i!=null?`${i} on ${r}`:(t=r!=null?r:i)!=null?t:"Unknown Device"}parseDevice(e){return/iPad/.test(e)?"iPad":/iPhone/.test(e)?"iPhone":/Macintosh|Mac OS X/.test(e)?"Mac":/Windows/.test(e)?"Windows":/Android/.test(e)?"Android":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"ChromeOS":null}parseBrowser(e){return/Edg\//.test(e)?"Edge":/OPR\/|Opera/.test(e)?"Opera":typeof navigator!="undefined"&&"brave"in navigator?"Brave":/Chrome\//.test(e)?"Chrome":/Safari\//.test(e)&&!/Chrome\//.test(e)?"Safari":/Firefox\//.test(e)?"Firefox":null}};m([u({logger:l,methodName:"deviceSignerKeyStorage.generateKey"})],c.prototype,"generateKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.mapAddressToKey"})],c.prototype,"mapAddressToKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.getKey"})],c.prototype,"getKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.hasKey"})],c.prototype,"hasKey",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.signMessage"})],c.prototype,"signMessage",1),m([u({logger:l,methodName:"deviceSignerKeyStorage.deleteKey"})],c.prototype,"deleteKey",1);export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-ABOMDBIJ.js";import{a}from"./chunk-TWYVUVLB.js";import{a as i}from"./chunk-L7DGQX3V.js";import{a as r}from"./chunk-OQZTL6ZG.js";var n={evm:t,solana:a,stellar:i};function m(e){return n[r(e)]}function p(e){return Object.prototype.hasOwnProperty.call(n,e)}function A(e,o){return p(e)?n[e]:o}export{m as a,p as b,A as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineChain as o}from"viem";var c=o({id:11142220,name:"Celo Sepolia",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo-sepolia.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Sepolia Blockscout",url:"https://celo-sepolia.blockscout.com",apiUrl:"https://celo-sepolia.blockscout.com/api"}},testnet:!0});export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{defineChain as t}from"viem";var r=t({id:46630,name:"Robinhood Chain Testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.testnet.chain.robinhood.com"]}},blockExplorers:{default:{name:"Robinhood Chain Testnet Explorer",url:"https://explorer.testnet.chain.robinhood.com",apiUrl:"https://explorer.testnet.chain.robinhood.com/api"}},testnet:!0});export{r as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkM42AKAZKcjs = require('./chunk-M42AKAZK.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');function R(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h,d;let{timeoutMs:e=6e4,initialBackoffMs:u=500,backoffMultiplier:n=1.5,maxBackoffMs:f=2e3,fastWindowMs:L=5e3}=r!=null?r:{};_chunkW3BYSI7Fcjs.a.info("wallet.approve: waiting for transaction confirmation",{transactionId:a,timeoutMs:e});let p=Date.now(),c=u,t;do{if(Date.now()-p>e)throw new (0, _chunkVS6I4S7Xcjs.J)("Transaction confirmation timeout");let s=Date.now();if(t=yield i.getTransaction(o,a),t.error)throw _chunkVS6I4S7Xcjs.Q.call(void 0, t),new (0, _chunkVS6I4S7Xcjs.I)(JSON.stringify(t));if(t.status!=="pending")break;let T=Date.now()-p;T>L&&(c=Math.min(Math.round(c*n),f));let v=Date.now()-s;yield D(Math.max(1,Math.min(c-v,e-T)))}while(!0);if(t.status==="failed")throw new (0, _chunkVS6I4S7Xcjs.K)(`Transaction sending failed: ${JSON.stringify(t)}`);if(t.status==="awaiting-approval")throw new (0, _chunkVS6I4S7Xcjs.L)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let P="txHash"in t.onChain&&typeof t.onChain.txHash=="string"?t.onChain.txHash:void 0,g=(h=t.onChain.txId)!=null?h:P;if(g==null)throw new (0, _chunkVS6I4S7Xcjs.M)("Transaction hash not found on transaction response");return{hash:g,explorerLink:(d=t.onChain.explorerLink)!=null?d:"",transactionId:t.id}})}function W(i,o,a,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{timeoutMs:e=6e4}=r!=null?r:{},u=Date.now(),n=null;do{if(Date.now()-u>e)throw new (0, _chunkVS6I4S7Xcjs.F)("Signature confirmation timeout");if(yield new Promise(f=>setTimeout(f,_chunkM42AKAZKcjs.d)),n=yield i.getSignature(o,a),"error"in n)throw _chunkVS6I4S7Xcjs.Q.call(void 0, n),new (0, _chunkVS6I4S7Xcjs.D)(JSON.stringify(n))}while(n===null||n.status==="pending");if(n.status==="failed")throw new (0, _chunkVS6I4S7Xcjs.A)("Signature signing failed");if(!n.outputSignature)throw new (0, _chunkVS6I4S7Xcjs.D)("Signature not available");return{signature:n.outputSignature,signatureId:a}})}function D(i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return new Promise(o=>setTimeout(o,i))})}exports.a = R; exports.b = W;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as i}from"./chunk-
|
|
1
|
+
import{a as i}from"./chunk-3NAV25KH.js";import{H as u}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-INUEMQPG.js";import{a as f,c,h as s}from"./chunk-NU7VF7MC.js";import{isValidStellarAddress as T,WithLoggerContext as g}from"@crossmint/common-sdk-base";var m=409,l=class l extends i{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:i.getOptions(e),alias:e.alias,recovery:i.getRecoverySigners(e),apiRecoveryServerSignerAddresses:i.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:i.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:i.getInitialSigners(e)},i.getApiClient(e))}static from(e){if(!T(e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return s(this,null,function*(){var d;t.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return t.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return t.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return s(this,null,function*(){t.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return t.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),t.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else t.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return t.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return s(this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return s(this,null,function*(){t.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new u("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return t.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return t.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return s(this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new u(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return s(this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:f({transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new u(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};c([g({logger:t,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),c([g({logger:t,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),c([g({logger:t,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}export{h as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var t=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}},i= exports.b =class extends Error{constructor(n,r){super(n),this.name="OtpValidationError",this.code=r}},o= exports.c =class extends Error{constructor(n,r){super(n),this.name="SignerAuthenticationError",this.code=r}},a= exports.d =class extends Error{constructor(n,r){super(n),this.name="SignerStatusError",this.code=r}},s= exports.e =class extends Error{constructor(n,r){super(n),this.name="KeyExportError",this.code=r}},g= exports.f =class extends Error{constructor(n="The signer session expired before the code could be verified. A new code has been sent."){super(n),this.name="OnboardingSessionExpiredError"}};function p(e){return e.type==="server"&&!("secret"in e)}function S(e){return e._exportPrivateKey!==void 0}exports.a = t; exports.b = i; exports.c = o; exports.d = a; exports.e = s; exports.f = g; exports.g = p; exports.h = S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkAXFHMPWTcjs = require('./chunk-AXFHMPWT.cjs');var _chunk4JR5AF3Rcjs = require('./chunk-4JR5AF3R.cjs');var _chunkHCV4M7X2cjs = require('./chunk-HCV4M7X2.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var l,m,C,S,y,o,b,A,k,L,K,P,u,q,I,B,$,z,V= exports.a =class{constructor(r){_chunkDSIFRRBScjs.e.call(void 0, this,u);_chunkDSIFRRBScjs.e.call(void 0, this,l,"unknown");_chunkDSIFRRBScjs.e.call(void 0, this,m,!1);_chunkDSIFRRBScjs.e.call(void 0, this,C);_chunkDSIFRRBScjs.e.call(void 0, this,S);_chunkDSIFRRBScjs.e.call(void 0, this,y);_chunkDSIFRRBScjs.e.call(void 0, this,o);_chunkDSIFRRBScjs.e.call(void 0, this,b);_chunkDSIFRRBScjs.e.call(void 0, this,A);_chunkDSIFRRBScjs.e.call(void 0, this,k);_chunkDSIFRRBScjs.e.call(void 0, this,L);_chunkDSIFRRBScjs.e.call(void 0, this,K);_chunkDSIFRRBScjs.e.call(void 0, this,P);_chunkDSIFRRBScjs.f.call(void 0, this,C,r.chain),_chunkDSIFRRBScjs.f.call(void 0, this,S,r.walletAddress),_chunkDSIFRRBScjs.f.call(void 0, this,y,r.options),_chunkDSIFRRBScjs.f.call(void 0, this,o,r.signerManager),_chunkDSIFRRBScjs.f.call(void 0, this,b,r.serverSignerResolver),_chunkDSIFRRBScjs.f.call(void 0, this,A,r.signers),_chunkDSIFRRBScjs.f.call(void 0, this,k,r.addSigner),_chunkDSIFRRBScjs.f.call(void 0, this,L,r.removeSigner),_chunkDSIFRRBScjs.f.call(void 0, this,K,r.approveSignature),_chunkDSIFRRBScjs.f.call(void 0, this,P,r.approveTransaction)}get needsRecovery(){return _chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"}onSignerSelected(){_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery"&&_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown")}initDeviceSigner(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var g;if(((g=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:g.deviceSignerKeyStorage)==null||_chunkDSIFRRBScjs.d.call(void 0, this,m))return;let i={type:"device"};try{yield this.resolveAvailability(i)}catch(h){_chunkW3BYSI7Fcjs.a.error("wallet.initDeviceSigner.error",{error:h}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery");return}if(_chunkDSIFRRBScjs.d.call(void 0, this,l)==="needs-recovery")return;let c=_chunkAXFHMPWTcjs.a.call(void 0, i.type).buildInternalConfig(i,_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext()),t=yield _chunkDSIFRRBScjs.d.call(void 0, this,o).assemble(c);_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(t),_chunkDSIFRRBScjs.d.call(void 0, this,o).isApprovedSignerStatus(t.status)||(_chunkW3BYSI7Fcjs.a.info("wallet.initDeviceSigner.pendingApproval",{signerLocator:t.locator(),status:t.status}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery"))})}recover(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var D;if(_chunkW3BYSI7Fcjs.a.info("wallet.recover.start"),_chunkDSIFRRBScjs.d.call(void 0, this,l)==="resolved"){_chunkW3BYSI7Fcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}if(_chunkDSIFRRBScjs.d.call(void 0, this,m)){_chunkW3BYSI7Fcjs.a.info("wallet.recover.skipped",{reason:"device signer not supported (cached)"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}let r=_chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner;if((r==null?void 0:r.type)==="device"&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,I).call(this,r))){_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");return}if(r!=null&&r.type!=="device"){_chunkW3BYSI7Fcjs.a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let i=(D=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:D.deviceSignerKeyStorage;if(i==null){if(_chunkDSIFRRBScjs.d.call(void 0, this,l)!=="needs-recovery")return;throw new Error("Device signer key storage is required to recover a device signer")}let c=yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this),t=yield _chunkDSIFRRBScjs.g.call(void 0, this,u,$).call(this,i,c);if(t!=null&&(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,I).call(this,t))){_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(t),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved");let n=t.locator().replace("device:","");try{yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,S),n)}catch(G){_chunkW3BYSI7Fcjs.a.warn("wallet.recover.mapAddressToKey.error",{error:G})}return}let g=c.filter(n=>n.type==="device"),h=_chunkDSIFRRBScjs.g.call(void 0, this,u,q).call(this,g,i),v=yield _chunkGMU3ZYLScjs.a.call(void 0, i,_chunkDSIFRRBScjs.d.call(void 0, this,S));try{yield _chunkDSIFRRBScjs.d.call(void 0, this,k).call(this,v)}catch(n){if(n instanceof _chunkVS6I4S7Xcjs.m){_chunkW3BYSI7Fcjs.a.info("wallet.recover.device.unsupportedFallback",{signerLocator:v.locator}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,S)),_chunkDSIFRRBScjs.f.call(void 0, this,m,!0),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),yield _chunkDSIFRRBScjs.g.call(void 0, this,u,z).call(this);return}else if(H(n))_chunkW3BYSI7Fcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved",signerLocator:v.locator});else throw n instanceof _chunkHCV4M7X2cjs.a||n instanceof Error&&n.name==="AuthRejectedError"?(_chunkW3BYSI7Fcjs.a.info("wallet.recover.device.authRejected",{signerLocator:v.locator}),n):n instanceof _chunkHCV4M7X2cjs.c||n instanceof Error&&n.name==="SignerAuthenticationError"?(_chunkW3BYSI7Fcjs.a.warn("wallet.recover.device.authenticationFailed",{signerLocator:v.locator,code:n instanceof _chunkHCV4M7X2cjs.c?n.code:void 0}),n):n instanceof _chunkHCV4M7X2cjs.b||n instanceof Error&&n.name==="OtpValidationError"?(_chunkW3BYSI7Fcjs.a.warn("wallet.recover.device.otpValidationFailed",{signerLocator:v.locator,code:n instanceof _chunkHCV4M7X2cjs.b?n.code:void 0}),n):(_chunkW3BYSI7Fcjs.a.error("wallet.recover.device.error",{error:n}),yield i.deleteKey(_chunkDSIFRRBScjs.d.call(void 0, this,S)),n)}let p=yield _chunkDSIFRRBScjs.d.call(void 0, this,o).assemble({type:"device",locator:v.locator,address:_chunkDSIFRRBScjs.d.call(void 0, this,S)});if(_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(p),p.type==="device"&&(p.status="success"),_chunkW3BYSI7Fcjs.a.info("wallet.recover.device.success",{signerLocator:v.locator}),_chunkDSIFRRBScjs.f.call(void 0, this,l,"resolved"),h!=null)try{yield _chunkDSIFRRBScjs.d.call(void 0, this,L).call(this,h),_chunkW3BYSI7Fcjs.a.info("wallet.recover.staleSignerRemoved",{signerLocator:h})}catch(n){_chunkW3BYSI7Fcjs.a.warn("wallet.recover.staleSignerRemovalFailed",{signerLocator:h,error:n})}})}resolveAvailability(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var h;let i=(h=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:h.deviceSignerKeyStorage;if(i==null)throw new Error("Device signer key storage is required for device signers");let c=yield i.getKey(_chunkDSIFRRBScjs.d.call(void 0, this,S));if(c!=null){r.locator=`device:${c}`,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}let g=(yield _chunkDSIFRRBScjs.d.call(void 0, this,A).call(this)).filter(v=>v.locator.startsWith("device:"));for(let v of g){let p=v.locator.replace("device:","");if(yield i.hasKey(p)){yield i.mapAddressToKey(_chunkDSIFRRBScjs.d.call(void 0, this,S),p),r.locator=v.locator,_chunkDSIFRRBScjs.f.call(void 0, this,l,"unknown");return}}_chunkDSIFRRBScjs.f.call(void 0, this,l,"needs-recovery")})}tryResolveLocallyAvailableSigner(t){return _chunkDSIFRRBScjs.h.call(void 0, this,arguments,function*(r,i=(c=>(c=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:c.deviceSignerKeyStorage)()){if(i==null)return null;try{return yield _chunk4JR5AF3Rcjs.b.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),r,_chunkDSIFRRBScjs.d.call(void 0, this,S),i)}catch(g){return _chunkW3BYSI7Fcjs.a.warn("wallet.deviceRecovery.tryResolveLocallyAvailableSigner.failed",{signerLocator:r,error:g}),null}})}};l=new WeakMap,m=new WeakMap,C=new WeakMap,S=new WeakMap,y=new WeakMap,o=new WeakMap,b=new WeakMap,A=new WeakMap,k=new WeakMap,L=new WeakMap,K=new WeakMap,P=new WeakMap,u=new WeakSet,q=function(r,i){if(r.length===0)return;if(r.length===1)return r[0].locator;let c=i.getDeviceName(),t=r.filter(g=>g.name===c);return t.length===1?t[0].locator:void 0},I=function(r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var c;if(_chunkDSIFRRBScjs.d.call(void 0, this,o).isApprovedSignerStatus(r.status))return _chunkW3BYSI7Fcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0;let i=yield _chunkDSIFRRBScjs.d.call(void 0, this,o).getSignerState(r.locator());return r.status=(c=i.signer)==null?void 0:c.status,i.pendingOperation!=null?(yield _chunkDSIFRRBScjs.g.call(void 0, this,u,B).call(this,r,i.pendingOperation),!0):_chunkDSIFRRBScjs.d.call(void 0, this,o).isApprovedSignerStatus(r.status)?(_chunkW3BYSI7Fcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),!0):!1})},B=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p;let c=_chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner,t=_chunkDSIFRRBScjs.d.call(void 0, this,o).recovery;if(_chunkHCV4M7X2cjs.g.call(void 0, t)&&!_chunkDSIFRRBScjs.d.call(void 0, this,b).hasRecoveryResolutionFor(t.address))throw new Error('Cannot resume pending approval: no secret available. Call wallet.useSigner({ type: "server", secret: ... }) first with the recovery server secret.');let g=_chunkAXFHMPWTcjs.a.call(void 0, t.type),h=_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext();if(t.type==="external-wallet"&&!g.canAutoAssemble(t,h))throw new Error('Cannot resume pending approval: no onSign callback available. Call wallet.useSigner({ type: "external-wallet", address: "0x...", onSign: async (tx) => ... }) first.');let v=g.buildInternalConfig(t,h);_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(_chunk4JR5AF3Rcjs.a.call(void 0, _chunkDSIFRRBScjs.d.call(void 0, this,C),v,(p=_chunkDSIFRRBScjs.d.call(void 0, this,y))==null?void 0:p.deviceSignerKeyStorage));try{i.type==="signature"?yield _chunkDSIFRRBScjs.d.call(void 0, this,K).call(this,i.id):yield _chunkDSIFRRBScjs.d.call(void 0, this,P).call(this,i.id)}catch(D){throw _chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(r),D}finally{_chunkDSIFRRBScjs.d.call(void 0, this,o).activeSigner!==r&&_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(c)}r.status="success",_chunkW3BYSI7Fcjs.a.info("wallet.recover.device.success",{signerLocator:r.locator(),resumed:!0})})},$=function(r,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let c=i.filter(t=>t.locator.startsWith("device:"));for(let t of c){let g=yield this.tryResolveLocallyAvailableSigner(t.locator,r);if(g!=null)return _chunkW3BYSI7Fcjs.a.info("wallet.recover.foundLocalDeviceSigner",{signerLocator:t.locator}),g}return null})},z=function(){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let r=_chunkDSIFRRBScjs.d.call(void 0, this,o).recovery,i=_chunkAXFHMPWTcjs.a.call(void 0, r.type),c=_chunkDSIFRRBScjs.d.call(void 0, this,o).descriptorContext();if(i.canAutoAssemble(r,c))try{let t=i.buildInternalConfig(r,c);_chunkDSIFRRBScjs.d.call(void 0, this,o).setActiveSigner(yield _chunkDSIFRRBScjs.d.call(void 0, this,o).assemble(t,{isAdminSigner:!0}))}catch(t){_chunkW3BYSI7Fcjs.a.warn("wallet.recover.device.unsupportedFallback.autoAssemblyFailed",{recoveryType:r.type,error:t})}})};function H(x){if(!(x instanceof Error))return!1;let r=x.message.toLowerCase();return r.includes("delegated signer")&&r.includes("already")&&r.includes("approved")}exports.a = V;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as s}from"./chunk-7ER4XMKQ.js";import{a as l}from"./chunk-AF6NBGQT.js";import{a as o}from"./chunk-NUCKXAQL.js";import{a as S}from"./chunk-IQARABFX.js";import{a as g}from"./chunk-JAXFDUNN.js";import{a as y}from"./chunk-K7BPGUFU.js";import{a as f}from"./chunk-MN2BGRRJ.js";import{a as C}from"./chunk-FQ5F3VYJ.js";import{a as m}from"./chunk-HAQMNZO5.js";import{a as p}from"./chunk-AB2JJTW4.js";import{a as u}from"./chunk-MLROTECD.js";import{g as i}from"./chunk-KOHPRJDP.js";import{h as t}from"./chunk-NU7VF7MC.js";function c(r,e,n){switch(e.type){case"email":case"phone":return r==="solana"?new l(e):r==="stellar"?new o(e):new s(e);case"api-key":return r==="solana"?new u(e):new C(e);case"external-wallet":return r==="solana"?new g(e):r==="stellar"?new y(e):new m(e);case"server":return S(r,e);case"passkey":return new p(e);case"device":if(n==null)throw new i("Device signer key storage is required for device signers");return new f(e,n)}}function k(r,e,n,a){return t(this,null,function*(){if(!e.startsWith("device:"))return null;let w=e.replace("device:","");return(yield a.hasKey(w))?c(r,{type:"device",locator:e,address:n},a):null})}export{c as a,k as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as r}from"./chunk-3NAV25KH.js";import{a as f}from"./chunk-JAXFDUNN.js";import{H as h}from"./chunk-KOHPRJDP.js";import{a as t}from"./chunk-INUEMQPG.js";import{c as u,h as l}from"./chunk-NU7VF7MC.js";import p from"bs58";import m from"tweetnacl";import{isValidSolanaAddress as y,WithLoggerContext as v}from"@crossmint/common-sdk-base";var c=class c extends r{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:r.getOptions(e),alias:e.alias,recovery:r.getRecoverySigners(e),apiRecoveryServerSignerAddresses:r.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:r.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:r.getInitialSigners(e)},r.getApiClient(e))}static from(e){if(!y(e.address))throw new Error("Wallet is not a Solana wallet");return new c(e)}sendTransaction(e){return l(this,null,function*(){var g,S;t.info("solanaWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let n=yield this.createTransaction(e);if((g=e.options)!=null&&g.prepareOnly)return t.info("solanaWallet.sendTransaction.prepared",{transactionId:n.id}),{hash:void 0,explorerLink:void 0,transactionId:n.id};let i={additionalSigners:(S=e.additionalSigners)==null?void 0:S.map(o=>new f({type:"external-wallet",address:o.publicKey.toString(),locator:`external-wallet:${o.publicKey.toString()}`,onSign:d=>(d.sign([o]),Promise.resolve(d)),onSignBytes:d=>Promise.resolve(p.encode(m.sign.detached(p.decode(d),o.secretKey)))}))},a=yield this.approveTransactionAndWait(n.id,i);return t.info("solanaWallet.sendTransaction.success",{transactionId:n.id,hash:a.hash}),a})}createTransaction(e){return l(this,null,function*(){var a;let n;((a=e.options)==null?void 0:a.signer)==null?n=this.signerManager.require().locator():typeof e.options.signer=="string"?n=e.options.signer:n=this.resolveServerSignerApiLocator(e.options.signer);let s;"serializedTransaction"in e?s=e.serializedTransaction:s=p.encode(e.transaction.serialize());let i=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:s,signer:n}});if("error"in i)throw new h(JSON.stringify(i));return i})}};u([v({logger:t,methodName:"solanaWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],c.prototype,"sendTransaction",1);var T=c;export{T as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as n,c as i}from"./chunk-
|
|
1
|
+
import{b as n,c as i}from"./chunk-MDAPK5FG.js";import{SdkLogger as d,BrowserDatadogSink as k,detectPlatform as g,validateAPIKey as l,ServerDatadogSink as m}from"@crossmint/common-sdk-base";var t=new d;function f(s){let o=g(),e=l(s);if(!e.isValid)throw new Error(`Invalid API key: ${e.message}`);let{environment:a,projectId:c}=e;switch(t.init({packageName:i,packageVersion:n,environment:a,projectId:c,platform:o}),o){case"browser":{let r=new k(a);t.addSink(r);break}case"react-native":break;case"server":{let r=new m(a);t.addSink(r);break}default:break}}export{t as a,f as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as i}from"./chunk-JY4KRKZ6.js";import{a as t}from"./chunk-GXUPHO44.js";import{a as n}from"./chunk-277G6KNG.js";import{a as r}from"./chunk-OQZTL6ZG.js";function c(a,e){switch(r(a)){case"evm":return new n(e);case"solana":return new i(e);case"stellar":return new t(e)}}export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"./chunk-2YLRFJ66.js";import{N as t}from"./chunk-KOHPRJDP.js";import{h as i}from"./chunk-NU7VF7MC.js";import{PublicKey as h,VersionedTransaction as y}from"@solana/web3.js";import l from"bs58";var g=class extends o{constructor(n){super(n),this.onSign=n.onSign,this.onSignBytes=n.onSignBytes}signMessage(n){return i(this,null,function*(){if(this.onSignBytes==null)throw new Error("[SolanaExternalWalletSigner] No onSignBytes callback provided. Pass an onSignBytes callback when configuring the external wallet signer.");let e=yield this.onSignBytes(n);if(e==null)throw new t("[SolanaExternalWalletSigner] onSignBytes returned no signature");return{signature:e}})}signTransaction(n){return i(this,null,function*(){if(this.onSign==null)throw new Error("[SolanaExternalWalletSigner] No onSign callback provided. Pass an onSign callback when configuring the external wallet signer.");let e=l.decode(n),c=y.deserialize(e),a=yield this.onSign(c),d=new h(this._address),r=a.message.staticAccountKeys.findIndex(S=>S.equals(d));if(r===-1)throw new t("Wallet public key not found in transaction signers");let s=a.signatures[r];if(s==null)throw new t("No valid signature found in the transaction");let u=new Uint8Array(Object.values(s));return{signature:l.encode(u)}})}};export{g as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-C6E6WC4P.js";import{a as O}from"./chunk-V5NY4W5H.js";import{a as C}from"./chunk-CGQCRDG7.js";import{a as I}from"./chunk-KKQBZXFE.js";import{a as l}from"./chunk-S3DYQVRD.js";import{a as _}from"./chunk-KUP7H7X2.js";import{a as L}from"./chunk-FT5EVMLB.js";import{a as A}from"./chunk-QLOW4D2N.js";import{a as s}from"./chunk-SVIKBM3S.js";import{b as o,c as i}from"./chunk-KOHPRJDP.js";import{a as E}from"./chunk-INUEMQPG.js";import{APIKeyEnvironmentPrefix as N,BlockchainIncludingTestnet as e}from"@crossmint/common-sdk-base";import{baseSepolia as c,base as u,polygonAmoy as P,polygon as R,optimismSepolia as p,optimism as h,arbitrumSepolia as d,arbitrum as H,arbitrumNova as f,avalanche as V,avalancheFuji as U,celo as B,modeTestnet as W,mode as v,mainnet as y,bsc as D,shape as b,zora as x,zoraSepolia as F,sepolia as w,flowMainnet as Y,flowTestnet as g,plume as $,plumeTestnet as G}from"viem/chains";var Z=[e.ABSTRACT_TESTNET,e.ARBITRUM_SEPOLIA,e.AVALANCHE_FUJI,e.BASE_SEPOLIA,e.CELO_SEPOLIA,e.CURTIS,e.ETHEREUM_SEPOLIA,e.FLOW_TESTNET,e.MANTLE_SEPOLIA,e.MODE_SEPOLIA,e.OPTIMISM_SEPOLIA,e.PLUME_TESTNET,e.POLYGON_AMOY,e.ROBINHOOD_CHAIN_TESTNET,e.SCROLL_SEPOLIA,e.SEI_ATLANTIC_2_TESTNET,e.STORY_TESTNET,e.WORLD_CHAIN_SEPOLIA,e.ZORA_SEPOLIA,e.ARC_TESTNET,e.TEMPO_TESTNET],k=[e.ABSTRACT,e.APECHAIN,e.ARBITRUM,e.ARBITRUMNOVA,e.ARC,e.AVALANCHE,e.BASE,e.BSC,e.CELO,e.ETHEREUM,e.FLOW,e.MANTLE,e.MODE,e.OPTIMISM,e.PLUME,e.POLYGON,e.ROBINHOOD_CHAIN,e.SCROLL,e.SEI_PACIFIC_1,e.SHAPE,e.STORY,e.TEMPO,e.WORLDCHAIN,e.ZORA];function Se(t){switch(t){case e.BASE_SEPOLIA:return c;case e.BASE:return u;case e.POLYGON_AMOY:return P;case e.POLYGON:return R;case e.OPTIMISM_SEPOLIA:return p;case e.OPTIMISM:return h;case e.ARBITRUM_SEPOLIA:return d;case e.ARBITRUM:return H;case e.ARBITRUMNOVA:return f;case e.AVALANCHE:return V;case e.AVALANCHE_FUJI:return U;case e.CELO:return B;case e.CELO_SEPOLIA:return S;case e.ROBINHOOD_CHAIN:return O;case e.ROBINHOOD_CHAIN_TESTNET:return C;case e.STORY_TESTNET:return l;case e.STORY:return I;case e.MODE_SEPOLIA:return W;case e.MODE:return v;case e.BSC:return D;case e.SHAPE:return b;case e.ZORA:return x;case e.ZORA_SEPOLIA:return F;case e.ETHEREUM_SEPOLIA:return w;case e.ETHEREUM:return y;case e.FLOW:return Y;case e.FLOW_TESTNET:return g;case e.PLUME_TESTNET:return G;case e.PLUME:return $;case e.ARC:return A;case e.ARC_TESTNET:return s;case e.TEMPO:return _;case e.TEMPO_TESTNET:return L;case e.ABSTRACT:case e.ABSTRACT_TESTNET:case e.APECHAIN:case e.MANTLE:case e.MANTLE_SEPOLIA:case e.SCROLL:case e.SCROLL_SEPOLIA:case e.SEI_PACIFIC_1:case e.SEI_ATLANTIC_2_TESTNET:case e.CURTIS:case e.WORLDCHAIN:case e.WORLD_CHAIN_SEPOLIA:throw new Error(`Chain ${t} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`);default:throw new Error(`Unknown chain: ${t}`)}}function m(t){return Z.includes(t)}function M(t){return k.includes(t)}var J={[e.ABSTRACT]:e.ABSTRACT_TESTNET,[e.APECHAIN]:e.CURTIS,[e.ARBITRUM]:e.ARBITRUM_SEPOLIA,[e.AVALANCHE]:e.AVALANCHE_FUJI,[e.BASE]:e.BASE_SEPOLIA,[e.CELO]:e.CELO_SEPOLIA,[e.ETHEREUM]:e.ETHEREUM_SEPOLIA,[e.FLOW]:e.FLOW_TESTNET,[e.MANTLE]:e.MANTLE_SEPOLIA,[e.MODE]:e.MODE_SEPOLIA,[e.OPTIMISM]:e.OPTIMISM_SEPOLIA,[e.PLUME]:e.PLUME_TESTNET,[e.POLYGON]:e.POLYGON_AMOY,[e.ROBINHOOD_CHAIN]:e.ROBINHOOD_CHAIN_TESTNET,[e.SCROLL]:e.SCROLL_SEPOLIA,[e.SEI_PACIFIC_1]:e.SEI_ATLANTIC_2_TESTNET,[e.STORY]:e.STORY_TESTNET,[e.WORLDCHAIN]:e.WORLD_CHAIN_SEPOLIA,[e.ZORA]:e.ZORA_SEPOLIA,[e.TEMPO]:e.TEMPO_TESTNET,[e.ARC]:e.ARC_TESTNET};function q(t){return J[t]}function z(t){return t==="solana"||t==="stellar"||m(t)||M(t)}function Oe(t,a){if(!z(t))throw new i(`Unknown chain "${t}". Please use a supported chain name (e.g. "base-sepolia", "polygon", "solana", "stellar").`);if(t==="solana"||t==="stellar")return t;let r=t,T=a===N.PRODUCTION;if(T&&m(r))throw new o(`Chain "${t}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`);if(!T&&M(r)){let n=q(r);if(n!=null)return E.debug("validateChainForEnvironment.autoConverted",{chain:t,convertedTo:n,environment:a,message:`Chain "${t}" is a mainnet chain and cannot be used in ${a} environment. Automatically converted to "${n}".`}),n;E.debug("validateChainForEnvironment.mismatch",{chain:t,environment:a,message:`Chain "${t}" is a mainnet chain and should not be used in ${a} environment. No testnet equivalent is available. Please use a testnet chain instead.`})}return t}export{Se as a,m as b,M as c,q as d,z as e,Oe as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./chunk-FJPAMX7L.js";import{h as r}from"./chunk-NU7VF7MC.js";import{Keypair as n}from"@solana/web3.js";import s from"bs58";import p from"tweetnacl";var i=class{constructor(e){this.type="server";this.keypair=n.fromSeed(e.derivedKeyBytes),this._address=this.keypair.publicKey.toBase58(),this._locator=e.locator,t(e.derivedKeyBytes)}address(){return this._address}locator(){return this._locator}signMessage(e){return r(this,null,function*(){let a=s.decode(e),o=p.sign.detached(a,this.keypair.secretKey);return{signature:s.encode(o)}})}signTransaction(e){return r(this,null,function*(){return yield this.signMessage(e)})}};export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as w}from"./chunk-IHMMTMFG.js";import{a as g,b as m,c as u,d as A,e as P,f as T}from"./chunk-P3P5Q5XX.js";import{a as n}from"./chunk-INUEMQPG.js";import{a as v,c as y,h as s}from"./chunk-NU7VF7MC.js";import{validateAPIKey as b,WithLoggerContext as _}from"@crossmint/common-sdk-base";var p=class{constructor(i){this.config=i;this._needsAuth=!0;this._authPromise=null;this._initializationPromise=null;this._onboardingConnectionGeneration=null;typeof window!="undefined"&&(this._initializationPromise=this.initialize()),this.type=this.config.type}locator(){return this.config.locator}address(){return this.config.address}initialize(){return s(this,null,function*(){try{if(this.config.clientTEEConnection==null){let i=b(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new w({environment:i.environment});this.config.clientTEEConnection=yield t.initialize()}}finally{this._initializationPromise=null}})}getTEEConnection(){return s(this,null,function*(){if(this.config.clientTEEConnection==null){if(this._initializationPromise){if(yield this._initializationPromise,this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");return this.config.clientTEEConnection}this._initializationPromise=this.initializeTEEConnection();try{yield this._initializationPromise}finally{this._initializationPromise=null}}if(this.config.clientTEEConnection==null)throw new Error("TEE connection is not initialized");return this.config.clientTEEConnection})}initializeTEEConnection(){return s(this,null,function*(){n.info("TEE connection not initialized, initializing now");let i=b(this.config.crossmint.apiKey);if(!i.isValid)throw new Error("Invalid API key");let t=new w({environment:i.environment});if(this.config.clientTEEConnection=yield t.initialize(),this.config.clientTEEConnection==null)throw new Error("Failed to initialize TEE connection");n.info("TEE connection initialized successfully")})}handleAuthRequired(){return s(this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection();if(this.config.onAuthRequired==null)throw new Error(`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendOtp, verifyOtp, reject) => { /* your UI logic */ }`);n.info("get-status: sending request");let h=Date.now(),r=yield t.sendAction({event:"request:get-status",responseEvent:"response:get-status",data:{authData:i},options:f}),a=Date.now()-h;if((r==null?void 0:r.status)!=="success"){let o=(r==null?void 0:r.status)==="error"&&r.error||"Failed to retrieve signer status",l=(r==null?void 0:r.status)==="error"?r.code:void 0;throw n.error("get-status: failed",{status:r==null?void 0:r.status,error:(r==null?void 0:r.status)==="error"?r.error:void 0,code:l,durationMs:a}),O(o,l)?new u(o,l):new A(o,l)}if(n.info("get-status: response received",{signerStatus:r.signerStatus,durationMs:a}),r.signerStatus==="ready"){this._needsAuth=!1;return}else this._needsAuth=!0;n.info("Auth required, initiating OTP flow",{needsAuth:this._needsAuth});let{promise:e,resolve:c,reject:d}=this.createAuthPromise();if(this._authPromise={promise:e,resolve:c,reject:d},this.config.onAuthRequired)try{yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>s(this,null,function*(){n.info("Auth rejected",{authRejected:!0}),this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),o=>this.verifyOtp(o),()=>{var o;return(o=this._authPromise)==null?void 0:o.reject(new g)})),d(new g)}))}catch(o){n.error("handleAuthRequired error",{error:o}),d(o)}try{yield e}catch(o){throw n.error("handleAuthRequired promise error",{error:o}),o}})}ensureAuthenticated(){return s(this,null,function*(){this.getJwtOrThrow(),this.config.resetSignerFrame!=null&&(yield this.config.resetSignerFrame()),yield this.handleAuthRequired()})}getJwtOrThrow(){let i=this.config.crossmint.jwt;if(i==null||i.trim()==="")throw new u(`${this.type} signer requires a valid Crossmint JWT. The user's session is missing or has expired: re-authenticate the user and refresh the JWT before retrying.`,C);return i}getAuthDataOrThrow(){return{jwt:this.getJwtOrThrow(),apiKey:this.config.crossmint.apiKey}}createAuthPromise(){let i,t;return{promise:new Promise((r,a)=>{i=r,t=a}),resolve:i,reject:t}}sendMessageWithOtp(){return s(this,null,function*(){var i;try{yield this.startOnboarding()}catch(t){throw t instanceof u&&((i=this._authPromise)==null||i.reject(t)),t}})}startOnboarding(){return s(this,null,function*(){let i=this.getAuthDataOrThrow(),t=yield this.getTEEConnection(),h=this.getAuthId();n.info("start-onboarding: sending request");let r=Date.now(),a=this.config.type==="phone"?this.config.channel:void 0,e=yield t.sendAction({event:"request:start-onboarding",responseEvent:"response:start-onboarding",data:{authData:i,data:v({authId:h},a!=null?{channel:a}:{})},options:f}),c=Date.now()-r;if(this._onboardingConnectionGeneration=t.connectionGeneration,n.info("start-onboarding: response received",{status:e==null?void 0:e.status,durationMs:c}),(e==null?void 0:e.status)==="success"&&e.signerStatus==="ready"){this._needsAuth=!1;return}if((e==null?void 0:e.status)==="error"){n.error("start-onboarding: failed",{error:e.error,code:e.code});let d=e.error||"Failed to initiate OTP process.";throw O(d,e.code)?new u(d,e.code):new m(d,e.code)}})}getAuthId(){return this.config.type==="email"?`email:${this.config.email}`:`phone:${this.config.phone}`}verifyOtp(i){return s(this,null,function*(){var a;let t;try{let e=yield this.getTEEConnection();n.info("complete-onboarding: sending request");let c=Date.now();t=yield e.sendAction({event:"request:complete-onboarding",responseEvent:"response:complete-onboarding",data:{authData:this.getAuthDataOrThrow(),data:{onboardingAuthentication:{encryptedOtp:i}}},options:f}),n.info("complete-onboarding: response received",{status:t==null?void 0:t.status,durationMs:Date.now()-c})}catch(e){return n.error("complete-onboarding: error",{error:e}),yield this.handleOnboardingVerificationFailure(e)}if((t==null?void 0:t.status)==="success"){this._needsAuth=!1,this.config.onAuthRequired!=null&&(yield this.config.onAuthRequired(this.config.type,this.locator(),this._needsAuth,()=>this.sendMessageWithOtp(),e=>this.verifyOtp(e),()=>{var e;return(e=this._authPromise)==null?void 0:e.reject(new g)})),(a=this._authPromise)==null||a.resolve();return}n.error("complete-onboarding: OTP validation failed",{status:t==null?void 0:t.status,error:(t==null?void 0:t.status)==="error"?t.error:void 0,code:(t==null?void 0:t.status)==="error"?t.code:void 0});let h=(t==null?void 0:t.status)==="error"&&t.error||"Failed to validate encrypted OTP",r=(t==null?void 0:t.status)==="error"?t.code:void 0;return yield this.handleOnboardingVerificationFailure(new m(h,r))})}handleOnboardingVerificationFailure(i){return s(this,null,function*(){var r,a,e;this._needsAuth=!0;let t=this.config.clientTEEConnection;if(this._onboardingConnectionGeneration!=null&&t!=null&&t.connectionGeneration!==this._onboardingConnectionGeneration){n.warn("tee.signer.onboarding.reissued",{reason:"signer frame reloaded mid-onboarding, re-issuing OTP",onboardingGeneration:this._onboardingConnectionGeneration,currentGeneration:t==null?void 0:t.connectionGeneration});try{yield this.sendMessageWithOtp()}catch(c){throw(r=this._authPromise)==null||r.reject(c),c}if(!this._needsAuth){(a=this._authPromise)==null||a.resolve();return}throw new T}throw(e=this._authPromise)==null||e.reject(i),i})}_exportPrivateKey(i,t){return s(this,null,function*(){yield this.ensureAuthenticated();let h=this.getJwtOrThrow(),{scheme:r,encoding:a}=this.getChainKeyParams();if(t!=null){let c=i.on("event:key-exported",d=>{i.off(c),d.status==="success"&&Promise.resolve().then(()=>t()).catch(()=>{console.error("[NCS Signer] onExport callback error")})})}let e=yield i.sendAction({event:"request:export-signer",responseEvent:"response:export-signer",data:{authData:{jwt:h,apiKey:this.config.crossmint.apiKey},data:{scheme:r,encoding:a,walletAddress:this.config.address,authId:this.getAuthId()}},options:f});if((e==null?void 0:e.status)==="error")throw n.error("export-signer: failed",{error:e.error,code:e.code}),new P(e.error||"Failed to export private key",e.code)})}};y([_({logger:n,methodName:"handleAuthRequired"})],p.prototype,"handleAuthRequired",1);var f={timeoutMs:3e4},C="jwt-required",S=new Set(["unauthorized","unauthenticated"]);function O(E,i){return i!=null&&S.has(i.toLowerCase())?!0:/\bHTTP 401\b/.test(E)}export{p as a,f as b,C as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-
|
|
1
|
+
import{a as e}from"./chunk-INUEMQPG.js";var s={nativeToken:"xlm",walletLocatorPrefix:"me:stellar:smart",supportsSignatures:!1,addSignerChain(n){},extractAddSignerOperation(n,t,r){if(!("transaction"in n)||n.transaction==null)throw e.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");return{type:"transaction",id:n.transaction.id}},balanceTokenFields(n){return n!=null&&"contractId"in n?{contractId:n.contractId}:n!=null&&"contractAddress"in n?{contractAddress:n.contractAddress}:{}},emptyBalanceTokenFields(){return{contractId:void 0}},signApproval(n,t,r){return n.signTransaction(r)}};export{s as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkUY7L4D4Mcjs = require('./chunk-UY7L4D4M.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var m=409,l=class l extends _chunkUY7L4D4Mcjs.a{constructor(e){super({chain:e.chain,address:e.address,owner:e.owner,options:_chunkUY7L4D4Mcjs.a.getOptions(e),alias:e.alias,recovery:_chunkUY7L4D4Mcjs.a.getRecoverySigners(e),apiRecoveryServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiRecoveryServerSignerAddresses(e),apiDelegatedServerSignerAddresses:_chunkUY7L4D4Mcjs.a.getApiDelegatedServerSignerAddresses(e),signer:e.signer,signers:_chunkUY7L4D4Mcjs.a.getInitialSigners(e)},_chunkUY7L4D4Mcjs.a.getApiClient(e))}static from(e){if(!_commonsdkbase.isValidStellarAddress.call(void 0, e.address))throw new Error("Wallet is not a Stellar wallet");return new l(e)}sendTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var d;_chunkW3BYSI7Fcjs.a.info("stellarWallet.sendTransaction.start"),yield this.preAuthIfNeeded();let r=yield this.createTransaction(e);if((d=e.options)!=null&&d.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("stellarWallet.sendTransaction.prepared",{transactionId:r.id}),{hash:void 0,explorerLink:void 0,transactionId:r.id};let a={},n=yield this.approveTransactionAndWait(r.id,a);return _chunkW3BYSI7Fcjs.a.info("stellarWallet.sendTransaction.success",{transactionId:r.id,hash:n.hash}),n})}upgrade(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.start"),yield this.preAuthIfNeeded();let r=yield this.createWalletLifecycleTransaction("upgrade-wallet",e);if(r!=null){if(e!=null&&e.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};yield this.approveTransactionAndWait(r),_chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.phase1.success",{transactionId:r})}else _chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.phase1.skipped",{reason:"wallet already locked from a prior upgrade"});let a=yield this.migrateInternal({signer:e==null?void 0:e.signer,prepareOnly:e==null?void 0:e.prepareOnly});return _chunkW3BYSI7Fcjs.a.info("stellarWallet.upgrade.success",{transactionId:a.transactionId,hash:a.hash}),a})}migrate(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){return yield this.preAuthIfNeeded(),yield this.migrateInternal(e)})}migrateInternal(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){_chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.start");let r=yield this.createWalletLifecycleTransaction("migrate-wallet",e);if(r==null)throw new (0, _chunkVS6I4S7Xcjs.H)("Failed to create migrate-wallet transaction");if(e!=null&&e.prepareOnly)return _chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.prepared",{transactionId:r}),{hash:void 0,explorerLink:void 0,transactionId:r};let a=yield this.approveTransactionAndWait(r);return _chunkW3BYSI7Fcjs.a.info("stellarWallet.migrate.success",{transactionId:r,hash:a.hash}),a})}createTransaction(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let{contractId:r,options:a}=e,n=this.resolveStellarSigner(a==null?void 0:a.signer),d="transaction"in e?{type:"serialized-transaction",serializedTransaction:e.transaction,contractId:r}:{type:"contract-call",contractId:r,method:e.method,memo:e.memo!=null?{type:"text",value:e.memo}:void 0,args:e.args},p=yield this.apiClient.createTransaction(this.walletLocator,{params:{transaction:d,signer:n}});if("error"in p)throw new (0, _chunkVS6I4S7Xcjs.H)(JSON.stringify(p));return p})}createWalletLifecycleTransaction(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let a=(r==null?void 0:r.signer)!=null?this.resolveStellarSigner(r.signer):void 0,n=yield this.apiClient.createTransaction(this.walletLocator,{params:_chunkDSIFRRBScjs.a.call(void 0, {transaction:{type:e}},a!=null?{signer:a}:{})});if("error"in n){if(e==="upgrade-wallet"&&y(n))return null;throw new (0, _chunkVS6I4S7Xcjs.H)(JSON.stringify(n))}return n.id})}resolveStellarSigner(e){return e==null?this.signerManager.require().locator():typeof e=="string"?e:this.resolveServerSignerApiLocator(e)}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"stellarWallet.sendTransaction",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"sendTransaction",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"stellarWallet.upgrade",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"upgrade",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"stellarWallet.migrate",buildContext(e){return{chain:e.chain,address:e.address}}})],l.prototype,"migrate",1);var h=l;function y(o){return typeof o=="object"&&o!==null&&"statusCode"in o&&o.statusCode===m}exports.a = h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var s="@crossmint/wallets-sdk",t="1.17.0";var p="WALLETS_SDK",c= exports.b =t,r= exports.c =s,a= exports.d =200;exports.a = p; exports.b = c; exports.c = r; exports.d = a;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s="@crossmint/wallets-sdk",t="1.17.0";var c="WALLETS_SDK",r=t,a=s,d=200;export{c as a,r as b,a as c,d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNWFQRNBNcjs = require('./chunk-NWFQRNBN.cjs');var _chunkUY7L4D4Mcjs = require('./chunk-UY7L4D4M.cjs');var _chunkGMU3ZYLScjs = require('./chunk-GMU3ZYLS.cjs');var _chunkCZC2MNVKcjs = require('./chunk-CZC2MNVK.cjs');var _chunkPHIW7FUJcjs = require('./chunk-PHIW7FUJ.cjs');var _chunkQ66YRLSWcjs = require('./chunk-Q66YRLSW.cjs');var _chunk5X66U2JLcjs = require('./chunk-5X66U2JL.cjs');var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');var _chunkDSIFRRBScjs = require('./chunk-DSIFRRBS.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var _ox = require('ox');var j="When 'signers' is provided to a method that may fetch an existing wallet, each specified signer must exist in that wallet's configuration.",R= exports.a =class{constructor(e){this.apiClient=e}getWallet(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let n,i;if(typeof e=="string"){if(!this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet with walletLocator is only available on the server side. Use getWallet(args) instead.");if(r==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet configuration is required when using walletLocator: https://docs.crossmint.com/sdk-reference/wallets/type-aliases/WalletArgsFor");n=e,i=r}else{if(this.apiClient.isServerSide)throw new (0, _chunkVS6I4S7Xcjs.g)("getWallet on server side requires a walletLocator parameter. Use getWallet(walletLocator, args) instead.");i=e,n=this.getWalletLocator(i)}let t=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},i),{chain:_chunk5X66U2JLcjs.f.call(void 0, i.chain,this.apiClient.environment)});_chunkW3BYSI7Fcjs.a.info("walletFactory.getWallet.start");let a=yield this.apiClient.getWallet(n);if("error"in a)throw _chunkW3BYSI7Fcjs.a.warn("walletFactory.getWallet.notFound",{error:a.error}),new (0, _chunkVS6I4S7Xcjs.e)(JSON.stringify(a));return _chunkW3BYSI7Fcjs.a.info("walletFactory.getWallet.success",{address:a.address}),yield this.createWalletInstance(a,t)})}createWallet(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p,c,v,m,D,T;let r=_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{chain:_chunk5X66U2JLcjs.f.call(void 0, e.chain,this.apiClient.environment)}),n=_chunkNWFQRNBNcjs.a.call(void 0, r);if(n.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)(_chunkNWFQRNBNcjs.b.call(void 0, r)?"At least one recovery method is required":"A recovery method is required");if(yield(v=(c=(p=r.options)==null?void 0:p.callbacks)==null?void 0:c.onWalletCreationStart)==null?void 0:v.call(c),_chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.start"),!this.apiClient.isServerSide&&r.owner!=null)throw _chunkW3BYSI7Fcjs.a.error("walletFactory.createWallet.error",{error:"Owner field cannot be specified in client-side createWallet calls"}),new (0, _chunkVS6I4S7Xcjs.g)("Owner field cannot be specified in client-side createWallet calls. Owner is determined from JWT authentication.");let i=(m=r.signers)!=null?m:[],t=((D=r.options)==null?void 0:D.deviceSignerKeyStorage)!=null&&!i.some(A=>A.type==="device"),a=t?[...i,{type:"device"}]:i,l=yield this.registerSigners(a,r.chain,(T=r.options)==null?void 0:T.deviceSignerKeyStorage),s=this.validatedRecoverySignerList(n,r.chain),o=[];for(let A of s)o.push(yield this.resolveRecoverySigner(A,r.chain));let d=this.buildRecoveryRequestConfig(r,o),g=yield this.createSmartWallet(r,d,l,t);if("error"in g)throw _chunkW3BYSI7Fcjs.a.error("walletFactory.createWallet.error",{error:g.error}),_chunkVS6I4S7Xcjs.R.call(void 0, g),new (0, _chunkVS6I4S7Xcjs.g)(JSON.stringify(g));return _chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.success",{address:g.address}),yield this.createWalletInstance(g,r)})}createSmartWallet(e,r,n,i){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){let t=o=>{var d,g;return{type:"smart",chainType:this.getChainType(e.chain),config:_chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},r),e.plugins?{plugins:e.plugins}:{}),o!=null?{delegatedSigners:o}:{}),owner:(d=e.owner)!=null?d:void 0,alias:(g=e.alias)!=null?g:void 0}},a=yield this.apiClient.createWallet(t(n));if(!(i&&"error"in a&&a.code===_chunkVS6I4S7Xcjs.l))return a;_chunkW3BYSI7Fcjs.a.info("walletFactory.createWallet.deviceSignerUnsupported.retryWithoutDeviceSigner",{chain:e.chain});let s=n.filter(o=>!this.isBuiltDeviceSigner(o));return yield this.apiClient.createWallet(t(s))})}buildRecoveryRequestConfig(e,r){return _chunkNWFQRNBNcjs.b.call(void 0, e)&&(e.chain==="solana"||e.chain==="stellar")?{recoveryMethods:r}:{adminSigner:r[0]}}validatedRecoverySignerList(e,r){if(e.length===0)throw new (0, _chunkVS6I4S7Xcjs.o)("At least one recovery method is required");if(e.length>1&&r!=="solana"&&r!=="stellar")throw new (0, _chunkVS6I4S7Xcjs.t)(`Multiple recovery methods are not supported on ${r} yet. Pass a single recovery method.`);return e}resolveRecoverySigner(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(e.type==="passkey"&&e.id==null)return yield this.createPasskeySigner(e);if(e.type==="server"){let{derivedAddress:n}=_chunkQ66YRLSWcjs.b.call(void 0, e,r,this.apiClient.projectId,this.apiClient.environment);return{type:"server",address:n}}return e})}isBuiltDeviceSigner(e){let r=e.signer;return typeof r=="object"&&r!=null&&r.type==="device"}mergePhoneChannel(e,r){return e.type!=="phone"||(r==null?void 0:r.type)!=="phone"||r.channel==null?e:_chunkDSIFRRBScjs.b.call(void 0, _chunkDSIFRRBScjs.a.call(void 0, {},e),{channel:r.channel})}createWalletInstance(e,r){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var p;this.validateExistingWalletConfig(e,r);let n=r,i=e.config,t=(p=i.recoveryMethods)!=null?p:[i.adminSigner],a=this.mergeRecoverySigners(t,_chunkNWFQRNBNcjs.a.call(void 0, n),r.chain),l=i.delegatedSigners,s=l;if(s!=null&&s.length===1&&(s[0].type==="server"||s[0].type==="external-wallet"))s=n.signers;else if(s!=null){let c=n.signers;s=s.map(v=>this.mergePhoneChannel(v,c==null?void 0:c.find(m=>m.type==="phone"&&v.type==="phone"&&_chunkCZC2MNVKcjs.b.call(void 0, m)===v.locator)))}let o=t.filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),d=(l!=null?l:[]).filter(c=>c.type==="server"&&"address"in c&&!("secret"in c)).map(c=>c.address),g=new (0, _chunkUY7L4D4Mcjs.a)({chain:r.chain,address:e.address,owner:e.owner,options:r.options,alias:r.alias,recovery:a,apiRecoveryServerSignerAddresses:o,apiDelegatedServerSignerAddresses:d,signers:s!=null?s:[]},this.apiClient);return yield g.waitForInit(),g})}mergeRecoverySigners(e,r,n){let i=[...r],t=new Map,a=[(l,s)=>this.matchesRecoverySigner(l,s,n),(l,s)=>l.type===s.type];for(let l of a)e.forEach((s,o)=>{if(t.has(o))return;let d=i.findIndex(g=>l(g,s));d!==-1&&t.set(o,i.splice(d,1)[0])});return e.map((l,s)=>{let o=t.get(s);return o==null?l:o.type==="server"||o.type==="external-wallet"?o:this.mergePhoneChannel(l,o)})}matchesRecoverySigner(e,r,n){if(e.type!==r.type)return!1;if(e.type==="email"&&"email"in r)return _chunkPHIW7FUJcjs.b.call(void 0, e.email)===_chunkPHIW7FUJcjs.b.call(void 0, r.email);if(e.type==="phone"&&"phone"in r)return e.phone===r.phone;if(e.type==="external-wallet"&&"address"in r)return e.address===r.address;if(e.type==="server"&&"address"in r){if(!("secret"in e))return e.address===r.address;let{primary:i,legacy:t}=_chunkQ66YRLSWcjs.c.call(void 0, e,n,this.apiClient.projectId,this.apiClient.environment);return i.derivedAddress===r.address||(t==null?void 0:t.derivedAddress)===r.address}return!0}getWalletLocator(e){return`me:${this.getChainType(e.chain)}:smart`+(e.alias!=null?`:alias:${e.alias}`:"")}createPasskeySigner(e){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;if(e.type!=="passkey")throw new Error("Signer is not a passkey");let r=(i=e.name)!=null?i:`Crossmint Wallet ${Date.now()}`,n=e.onCreatePasskey?yield e.onCreatePasskey(r):yield _ox.WebAuthnP256.createCredential({name:r});return{type:"passkey",id:n.id,name:r,publicKey:{x:n.publicKey.x.toString(),y:n.publicKey.y.toString()}}})}validateExistingWalletConfig(e,r){var t;if(r.owner!=null&&e.owner!=null&&_chunkPHIW7FUJcjs.b.call(void 0, r.owner)!==_chunkPHIW7FUJcjs.b.call(void 0, e.owner))throw new (0, _chunkVS6I4S7Xcjs.g)("Wallet owner does not match existing wallet's linked user");if(r.chain==="solana"&&e.chainType!=="solana"||r.chain!=="solana"&&e.chainType==="solana"||r.chain==="stellar"&&e.chainType!=="stellar"||r.chain!=="stellar"&&e.chainType==="stellar")throw new (0, _chunkVS6I4S7Xcjs.g)(`Wallet chain does not match existing wallet's chain. You must use chain: ${e.chainType}.`);if(e.type!=="smart")return;let n=r,i=_chunkNWFQRNBNcjs.a.call(void 0, n);if(n.recovery!=null||n.recoveryMethods!=null||n.signers!=null){let a=e.config,l=(t=a==null?void 0:a.recoveryMethods)!=null?t:(a==null?void 0:a.adminSigner)!=null?[a.adminSigner]:[],s=[...l];for(let d of i){if(l.length===0)break;let g=s.findIndex(c=>this.matchesRecoverySigner(d,c,r.chain)),p=g===-1?s.find(c=>c.type===d.type):s[g];if(p==null)throw new (0, _chunkVS6I4S7Xcjs.g)("The wallet recovery signer type does not match the existing wallet's recovery signer type");_chunkPHIW7FUJcjs.c.call(void 0, d,p),g!==-1&&s.splice(g,1)}let o=n.signers;o!=null&&this.validateSigners(e,o,r.chain)}}validateSigners(e,r,n){let i=e.config,t=i==null?void 0:i.delegatedSigners;if(r.length!==0){if(t==null||t.length===0)throw new (0, _chunkVS6I4S7Xcjs.g)(`${r.length} signer(s) specified, but wallet "${e.address}" has no signers. ${j}`);for(let a of r){let l=t.find(s=>{if(this.isMatchingPasskeySigner(a,s,i)||s.type==="device"&&a.type==="device")return!0;if(a.type==="server"){let{primary:o,legacy:d}=_chunkQ66YRLSWcjs.c.call(void 0, a,n,this.apiClient.projectId,this.apiClient.environment);return s.locator===`server:${o.derivedAddress}`||d!=null&&s.locator===`server:${d.derivedAddress}`}return s.locator===_chunkCZC2MNVKcjs.b.call(void 0, a)});if(l==null){let s=t.map(o=>o.locator).join(", ");throw new (0, _chunkVS6I4S7Xcjs.g)(`Signer '${a.type}' does not exist in wallet "${e.address}". Available signers: ${s}. ${j}`)}_chunkPHIW7FUJcjs.c.call(void 0, a,l)}}}isMatchingPasskeySigner(e,r,n){var t,a;let i=((a=(t=n.delegatedSigners)==null?void 0:t.filter(l=>l.type==="passkey").length)!=null?a:0)+(n.adminSigner.type==="passkey"?1:0);if(e.type==="passkey"){if(e.id==null&&i===1)return r.type==="passkey";if(e.id==null&&i>1)throw new (0, _chunkVS6I4S7Xcjs.g)("When creating a wallet with multiple passkeys, you must provide the passkey ID for each passkey.")}return!1}registerSigners(e,r,n){return _chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){var i;return yield Promise.all((i=e==null?void 0:e.map(t=>_chunkDSIFRRBScjs.h.call(void 0, this,null,function*(){if(t.type==="passkey")return t.id==null?{signer:yield this.createPasskeySigner(t)}:{signer:t};if(t.type==="device"){if(t.publicKey!=null)return{signer:{type:"device",publicKey:t.publicKey,name:t.name}};if(t.locator!=null)return{signer:t.locator};if(n==null)throw new (0, _chunkVS6I4S7Xcjs.g)("Device signer key storage is required for device signers");let a=yield _chunkGMU3ZYLScjs.a.call(void 0, n);return{signer:{type:"device",publicKey:a.publicKey,name:a.name}}}if(t.type==="server"&&r!=null){let{derivedAddress:a}=_chunkQ66YRLSWcjs.b.call(void 0, t,r,this.apiClient.projectId,this.apiClient.environment);return{signer:`server:${a}`}}return{signer:_chunkCZC2MNVKcjs.b.call(void 0, t)}})))!=null?i:[])})}getChainType(e){return e==="solana"?"solana":e==="stellar"?"stellar":"evm"}};_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"walletFactory.getWallet",buildContext(e,r){if(typeof r[0]=="string"){let i=r[1];return{walletLocator:r[0],chain:i==null?void 0:i.chain}}let n=r[0];return{chain:n==null?void 0:n.chain}}})],R.prototype,"getWallet",1),_chunkDSIFRRBScjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkW3BYSI7Fcjs.a,methodName:"walletFactory.createWallet",buildContext(e,r){return{chain:r[0].chain}}})],R.prototype,"createWallet",1);exports.a = R;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as s,b as o}from"./chunk-
|
|
1
|
+
import{a as s,b as o}from"./chunk-K4KSI3GM.js";import{a as r}from"./chunk-INUEMQPG.js";import{h as t}from"./chunk-NU7VF7MC.js";var a=class g extends s{constructor(n){super(n)}signMessage(){return t(this,null,function*(){return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"))})}signTransaction(n){return t(this,null,function*(){var i;yield this.handleAuthRequired();let c=this.getJwtOrThrow();r.info("sign: sending request",{keyType:"ed25519"});let d=Date.now(),e=yield(i=this.config.clientTEEConnection)==null?void 0:i.sendAction({event:"request:sign",responseEvent:"response:sign",data:{authData:{jwt:c,apiKey:this.config.crossmint.apiKey},data:{keyType:"ed25519",bytes:n,encoding:"base64"}},options:o});if(r.info("sign: response received",{status:e==null?void 0:e.status,durationMs:Date.now()-d}),(e==null?void 0:e.status)==="error")throw new Error(e.error);if((e==null?void 0:e.signature)==null)throw new Error("Failed to sign transaction");if(g.verifyPublicKeyFormat(e.publicKey),e.signature.encoding!=="base64")throw new Error("Wrong encoding for signature. Expected base64, got "+e.signature.encoding);return{signature:e.signature.bytes}})}static verifyPublicKeyFormat(n){if(n==null)throw new Error("No public key found");if(n.encoding!=="base64"||n.keyType!=="ed25519"||n.bytes==null)throw new Error("Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: "+JSON.stringify(n))}getChainKeyParams(){return{scheme:"ed25519",encoding:"strkey"}}};export{a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkVS6I4S7Xcjs = require('./chunk-VS6I4S7X.cjs');var _chunkW3BYSI7Fcjs = require('./chunk-W3BYSI7F.cjs');function n(e){if(e.recoveryMethods!=null&&e.recovery!=null)throw new (0, _chunkVS6I4S7Xcjs.o)("Pass either `recovery` or `recoveryMethods`, not both");if(e.recoveryMethods!=null){if(!Array.isArray(e.recoveryMethods))throw new (0, _chunkVS6I4S7Xcjs.o)("`recoveryMethods` must be an array of recovery methods. To pass a single recovery method, use `recovery`");return e.recoveryMethods}return e.recovery==null?[]:Array.isArray(e.recovery)?(_chunkW3BYSI7Fcjs.a.warn("wallet.create.recovery.deprecatedListForm",{message:"Passing a list to `recovery` is deprecated. Use `recoveryMethods` instead.",count:e.recovery.length}),e.recovery):[e.recovery]}function i(e){return e.recoveryMethods!=null||Array.isArray(e.recovery)}exports.a = n; exports.b = i;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as r}from"./chunk-KOHPRJDP.js";import{a as o}from"./chunk-INUEMQPG.js";function i(e){if(e.recoveryMethods!=null&&e.recovery!=null)throw new r("Pass either `recovery` or `recoveryMethods`, not both");if(e.recoveryMethods!=null){if(!Array.isArray(e.recoveryMethods))throw new r("`recoveryMethods` must be an array of recovery methods. To pass a single recovery method, use `recovery`");return e.recoveryMethods}return e.recovery==null?[]:Array.isArray(e.recovery)?(o.warn("wallet.create.recovery.deprecatedListForm",{message:"Passing a list to `recovery` is deprecated. Use `recoveryMethods` instead.",count:e.recovery.length}),e.recovery):[e.recovery]}function s(e){return e.recoveryMethods!=null||Array.isArray(e.recovery)}export{i as a,s as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var t=_viem.defineChain.call(void 0, {id:11142220,name:"Celo Sepolia",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo-sepolia.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Sepolia Blockscout",url:"https://celo-sepolia.blockscout.com",apiUrl:"https://celo-sepolia.blockscout.com/api"}},testnet:!0});exports.a = t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=class extends Error{constructor(){super("Authentication was rejected by the user"),this.name="AuthRejectedError"}},i=class extends Error{constructor(n,r){super(n),this.name="OtpValidationError",this.code=r}},o=class extends Error{constructor(n,r){super(n),this.name="SignerAuthenticationError",this.code=r}},a=class extends Error{constructor(n,r){super(n),this.name="SignerStatusError",this.code=r}},s=class extends Error{constructor(n,r){super(n),this.name="KeyExportError",this.code=r}},g=class extends Error{constructor(n="The signer session expired before the code could be verified. A new code has been sent."){super(n),this.name="OnboardingSessionExpiredError"}};function S(e){return e.type==="server"&&!("secret"in e)}function c(e){return e._exportPrivateKey!==void 0}export{t as a,i as b,o as c,a as d,s as e,g as f,S as g,c as h};
|