@crossmint/wallets-sdk 0.20.2 → 1.0.0-beta.2
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 +6 -6
- package/dist/api/__tests__/constants.cjs +1 -31
- package/dist/api/__tests__/constants.d.cts +9 -1
- package/dist/api/__tests__/constants.d.ts +9 -1
- package/dist/api/__tests__/constants.js +1 -31
- package/dist/api/__tests__/test-utils.cjs +1 -372
- package/dist/api/__tests__/test-utils.d.cts +10 -4
- package/dist/api/__tests__/test-utils.d.ts +10 -4
- package/dist/api/__tests__/test-utils.js +1 -372
- package/dist/api/client.cjs +1 -10
- package/dist/api/client.d.cts +15 -6
- package/dist/api/client.d.ts +15 -6
- package/dist/api/client.js +1 -10
- package/dist/api/gen/client.gen.cjs +1 -7
- package/dist/api/gen/client.gen.js +1 -7
- package/dist/api/gen/index.cjs +1 -179
- package/dist/api/gen/index.d.cts +2 -2
- package/dist/api/gen/index.d.ts +2 -2
- package/dist/api/gen/index.js +1 -179
- package/dist/api/gen/sdk.gen.cjs +1 -178
- package/dist/api/gen/sdk.gen.d.cts +18 -373
- package/dist/api/gen/sdk.gen.d.ts +18 -373
- package/dist/api/gen/sdk.gen.js +1 -178
- package/dist/api/gen/types.gen.d.cts +3125 -5778
- package/dist/api/gen/types.gen.d.ts +3125 -5778
- package/dist/api/gen/types.gen.js +1 -1
- package/dist/api/index.cjs +1 -12
- package/dist/api/index.d.cts +7 -1
- package/dist/api/index.d.ts +7 -1
- package/dist/api/index.js +1 -12
- package/dist/api/types.d.cts +11 -55
- package/dist/api/types.d.ts +11 -55
- package/dist/api/types.js +1 -1
- package/dist/chains/chains.cjs +1 -24
- package/dist/chains/chains.js +1 -24
- package/dist/chains/definitions/arcTestnet.cjs +1 -7
- package/dist/chains/definitions/arcTestnet.js +1 -7
- package/dist/chains/definitions/story.cjs +1 -7
- package/dist/chains/definitions/story.js +1 -7
- package/dist/chains/definitions/storyTestnet.cjs +1 -7
- package/dist/chains/definitions/storyTestnet.js +1 -7
- package/dist/chains/definitions/tempo.cjs +1 -7
- package/dist/chains/definitions/tempo.js +1 -7
- package/dist/chains/definitions/tempoTestnet.cjs +1 -7
- package/dist/chains/definitions/tempoTestnet.js +1 -7
- package/dist/chunk-2GKPWQBQ.cjs +1 -0
- package/dist/chunk-2YLRFJ66.js +1 -0
- package/dist/chunk-3HLCTEWX.js +1 -0
- package/dist/chunk-4ADZVYB5.cjs +1 -0
- package/dist/chunk-576HP23H.cjs +1 -0
- package/dist/chunk-5IC7UWND.cjs +1 -0
- package/dist/chunk-5M7IRODB.js +1 -0
- package/dist/chunk-5QIW67NU.cjs +1 -0
- package/dist/chunk-5X4EOJFG.cjs +1 -0
- package/dist/chunk-5YG5A77Q.js +1 -0
- package/dist/chunk-67Z4SJMH.js +1 -0
- package/dist/chunk-6MGMZ3SI.cjs +1 -0
- package/dist/chunk-6OXELDPD.js +1 -0
- package/dist/chunk-7VUOD7EI.cjs +1 -0
- package/dist/chunk-A33BEWR7.cjs +1 -0
- package/dist/chunk-BEW7JDW6.cjs +1 -0
- package/dist/chunk-BFIHTTMM.cjs +1 -0
- package/dist/chunk-BW27ZG6O.cjs +1 -0
- package/dist/chunk-CUHDOBKN.cjs +1 -0
- package/dist/chunk-D5YDWSO5.cjs +1 -0
- package/dist/chunk-DIGDDKSF.js +1 -0
- package/dist/chunk-EE4ITUGS.js +1 -0
- package/dist/chunk-EIHK5TYE.js +1 -0
- package/dist/chunk-ENU3EKBG.cjs +1 -0
- package/dist/chunk-F6PYIH4E.cjs +1 -0
- package/dist/chunk-FT5EVMLB.js +1 -0
- package/dist/chunk-G5R6VQGJ.js +1 -0
- package/dist/chunk-GDRKG42L.cjs +1 -0
- package/dist/chunk-GEY574TH.cjs +1 -0
- package/dist/chunk-GOXB2RBF.js +1 -0
- package/dist/chunk-HOWDLODW.cjs +1 -0
- package/dist/chunk-HRUMWG2F.cjs +1 -0
- package/dist/chunk-IFD3BVMM.js +1 -0
- package/dist/chunk-IGRPHTXZ.cjs +1 -0
- package/dist/chunk-IR5WN6FQ.cjs +1 -0
- package/dist/chunk-ISXH7QXG.cjs +1 -0
- package/dist/chunk-J33QM2ID.cjs +1 -0
- package/dist/chunk-J3R36SGJ.js +1 -0
- package/dist/chunk-JBP52JOH.cjs +1 -0
- package/dist/chunk-JINIR3YK.cjs +1 -0
- package/dist/chunk-JJMKQ5PK.cjs +1 -0
- package/dist/chunk-JLT4EA2Z.js +1 -0
- package/dist/chunk-JUKCHXJ6.cjs +1 -0
- package/dist/chunk-KKQBZXFE.js +1 -0
- package/dist/chunk-KUP7H7X2.js +1 -0
- package/dist/chunk-L52GDMSH.js +0 -0
- package/dist/chunk-LB4V5KKI.js +1 -0
- package/dist/chunk-MCBBBEJT.js +1 -0
- package/dist/chunk-MMFZP54X.js +1 -0
- package/dist/chunk-N5WVT7QE.js +1 -0
- package/dist/chunk-NCXMTHC4.js +1 -0
- package/dist/chunk-NF7KU2ML.cjs +1 -0
- package/dist/chunk-NJWSHT2H.cjs +1 -0
- package/dist/chunk-NKR3UAMA.cjs +1 -0
- package/dist/chunk-NPCKXKQ7.js +1 -0
- package/dist/chunk-NX256LAH.cjs +1 -0
- package/dist/chunk-O4FVTK7X.cjs +1 -0
- package/dist/chunk-O6VBO7KG.js +1 -0
- package/dist/chunk-OQZTL6ZG.js +1 -0
- package/dist/chunk-P6MB5P2F.js +1 -0
- package/dist/chunk-PDHWPAGW.js +1 -0
- package/dist/chunk-PHXT77LR.js +1 -0
- package/dist/chunk-PKYRYRX4.js +1 -0
- package/dist/chunk-PSXRNSOE.js +1 -0
- package/dist/chunk-QM3BB4E2.js +0 -0
- package/dist/chunk-R3EQXI46.js +1 -0
- package/dist/chunk-RC6KDONJ.cjs +1 -0
- package/dist/chunk-RLAW2ERD.js +1 -0
- package/dist/chunk-RN77IYDQ.js +1 -0
- package/dist/chunk-RXRRXB74.cjs +1 -0
- package/dist/chunk-S3DMYMEQ.js +1 -0
- package/dist/chunk-S3DYQVRD.js +1 -0
- package/dist/chunk-S4O54O4C.cjs +1 -0
- package/dist/chunk-S5KDZFZ7.cjs +1 -0
- package/dist/chunk-SCEPJO4Q.cjs +1 -0
- package/dist/chunk-SH7KRBXV.js +1 -0
- package/dist/chunk-SP2YD44M.js +1 -0
- package/dist/chunk-SPTXAOFR.cjs +1 -0
- package/dist/chunk-SPVAZXRY.js +1 -0
- package/dist/chunk-STYSP6KL.cjs +1 -0
- package/dist/chunk-SVIKBM3S.js +1 -0
- package/dist/chunk-TFMNBTFK.cjs +1 -0
- package/dist/chunk-TOAFCAVT.js +0 -0
- package/dist/chunk-TTSJFEM5.cjs +1 -0
- package/dist/chunk-TYFWX53A.js +1 -0
- package/dist/chunk-U7QSF6P7.cjs +1 -0
- package/dist/chunk-UE3WVHTM.cjs +1 -0
- package/dist/chunk-W5EH3HYF.cjs +1 -0
- package/dist/chunk-WBIKVPHW.js +1 -0
- package/dist/chunk-WCGUGIGJ.js +1 -0
- package/dist/chunk-WT5MDUZY.js +1 -0
- package/dist/chunk-WTVI4AL4.js +1 -0
- package/dist/chunk-WYMBO52A.js +1 -0
- package/dist/chunk-XNZLCUTY.js +1 -0
- package/dist/chunk-XS5B3TUE.js +1 -0
- package/dist/chunk-YFAJXQAM.cjs +1 -0
- package/dist/chunk-YGL4ITFK.cjs +1 -0
- package/dist/chunk-YLRD3ANZ.cjs +1 -0
- package/dist/chunk-YQQWKSNT.cjs +1 -0
- package/dist/chunk-ZACCKNGY.cjs +1 -0
- package/dist/chunk-ZE4NT3CJ.js +1 -0
- package/dist/chunk-ZKL4RO4I.cjs +1 -0
- package/dist/index.cjs +1 -60
- package/dist/index.d.cts +9 -7
- package/dist/index.d.ts +9 -7
- package/dist/index.js +1 -60
- package/dist/logger/index.cjs +1 -11
- package/dist/logger/index.js +1 -11
- package/dist/logger/init.cjs +1 -10
- package/dist/logger/init.js +1 -10
- package/dist/sdk.cjs +1 -39
- package/dist/sdk.d.cts +25 -23
- package/dist/sdk.d.ts +25 -23
- package/dist/sdk.js +1 -39
- package/dist/signers/device.cjs +1 -0
- package/dist/signers/device.d.cts +23 -0
- package/dist/signers/device.d.ts +23 -0
- package/dist/signers/device.js +1 -0
- package/dist/signers/evm-api-key.cjs +1 -7
- package/dist/signers/evm-api-key.d.cts +8 -4
- package/dist/signers/evm-api-key.d.ts +8 -4
- package/dist/signers/evm-api-key.js +1 -7
- package/dist/signers/evm-external-wallet.cjs +1 -7
- package/dist/signers/evm-external-wallet.d.cts +13 -14
- package/dist/signers/evm-external-wallet.d.ts +13 -14
- package/dist/signers/evm-external-wallet.js +1 -7
- package/dist/signers/external-wallet-signer.cjs +1 -0
- package/dist/signers/external-wallet-signer.d.cts +28 -0
- package/dist/signers/external-wallet-signer.d.ts +28 -0
- package/dist/signers/external-wallet-signer.js +1 -0
- package/dist/signers/index.cjs +1 -24
- package/dist/signers/index.d.cts +7 -3
- package/dist/signers/index.d.ts +7 -3
- package/dist/signers/index.js +1 -24
- package/dist/signers/non-custodial/index.cjs +1 -27
- package/dist/signers/non-custodial/index.d.cts +7 -3
- package/dist/signers/non-custodial/index.d.ts +7 -3
- package/dist/signers/non-custodial/index.js +1 -27
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -13
- package/dist/signers/non-custodial/ncs-evm-signer.d.cts +7 -3
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +7 -3
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -13
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +1 -7
- package/dist/signers/non-custodial/ncs-iframe-manager.js +1 -7
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -14
- package/dist/signers/non-custodial/ncs-signer.d.cts +8 -4
- package/dist/signers/non-custodial/ncs-signer.d.ts +8 -4
- package/dist/signers/non-custodial/ncs-signer.js +1 -14
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -13
- package/dist/signers/non-custodial/ncs-solana-signer.d.cts +7 -3
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +7 -3
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -13
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -13
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +7 -3
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +7 -3
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -13
- package/dist/signers/passkey.cjs +1 -7
- package/dist/signers/passkey.d.cts +8 -4
- package/dist/signers/passkey.d.ts +8 -4
- package/dist/signers/passkey.js +1 -7
- package/dist/signers/server/assemble-server-signer.cjs +1 -0
- package/dist/signers/server/assemble-server-signer.d.cts +15 -0
- package/dist/signers/server/assemble-server-signer.d.ts +15 -0
- package/dist/signers/server/assemble-server-signer.js +1 -0
- package/dist/signers/server/evm-server-signer.cjs +1 -0
- package/dist/signers/server/evm-server-signer.d.cts +29 -0
- package/dist/signers/server/evm-server-signer.d.ts +29 -0
- package/dist/signers/server/evm-server-signer.js +1 -0
- package/dist/signers/server/helpers/derive-server-signer.cjs +1 -0
- package/dist/signers/server/helpers/derive-server-signer.d.cts +19 -0
- package/dist/signers/server/helpers/derive-server-signer.d.ts +19 -0
- package/dist/signers/server/helpers/derive-server-signer.js +1 -0
- package/dist/signers/server/helpers/get-chain-type.cjs +1 -0
- package/dist/signers/server/helpers/get-chain-type.d.cts +7 -0
- package/dist/signers/server/helpers/get-chain-type.d.ts +7 -0
- package/dist/signers/server/helpers/get-chain-type.js +1 -0
- package/dist/signers/server/helpers/index.cjs +1 -0
- package/dist/signers/server/helpers/index.d.cts +13 -0
- package/dist/signers/server/helpers/index.d.ts +13 -0
- package/dist/signers/server/helpers/index.js +1 -0
- package/dist/signers/server/index.cjs +1 -0
- package/dist/signers/server/index.d.cts +16 -0
- package/dist/signers/server/index.d.ts +16 -0
- package/dist/signers/server/index.js +1 -0
- package/dist/signers/server/solana-server-signer.cjs +1 -0
- package/dist/signers/server/solana-server-signer.d.cts +29 -0
- package/dist/signers/server/solana-server-signer.d.ts +29 -0
- package/dist/signers/server/solana-server-signer.js +1 -0
- package/dist/signers/server/stellar-server-signer.cjs +1 -0
- package/dist/signers/server/stellar-server-signer.d.cts +29 -0
- package/dist/signers/server/stellar-server-signer.d.ts +29 -0
- package/dist/signers/server/stellar-server-signer.js +1 -0
- package/dist/signers/solana-api-key.cjs +1 -7
- package/dist/signers/solana-api-key.d.cts +8 -4
- package/dist/signers/solana-api-key.d.ts +8 -4
- package/dist/signers/solana-api-key.js +1 -7
- package/dist/signers/solana-external-wallet.cjs +1 -8
- package/dist/signers/solana-external-wallet.d.cts +10 -11
- package/dist/signers/solana-external-wallet.d.ts +10 -11
- package/dist/signers/solana-external-wallet.js +1 -8
- package/dist/signers/stellar-external-wallet.cjs +1 -7
- package/dist/signers/stellar-external-wallet.d.cts +10 -10
- package/dist/signers/stellar-external-wallet.d.ts +10 -10
- package/dist/signers/stellar-external-wallet.js +1 -7
- package/dist/signers/types.cjs +1 -9
- package/dist/signers/types.d.cts +10 -90
- package/dist/signers/types.d.ts +10 -90
- package/dist/signers/types.js +1 -9
- package/dist/types/base32.js.d.cjs +1 -0
- package/dist/types/base32.js.d.d.cts +4 -0
- package/dist/types/base32.js.d.d.ts +4 -0
- package/dist/types/base32.js.d.js +0 -0
- package/dist/types-BDRS_MOb.d.ts +425 -0
- package/dist/types-D-xASbms.d.cts +425 -0
- package/dist/utils/constants.cjs +1 -13
- package/dist/utils/constants.js +1 -13
- package/dist/utils/device-signers/DeviceSignerKeyStorage.cjs +1 -0
- package/dist/utils/device-signers/DeviceSignerKeyStorage.d.cts +66 -0
- package/dist/utils/device-signers/DeviceSignerKeyStorage.d.ts +66 -0
- package/dist/utils/device-signers/DeviceSignerKeyStorage.js +1 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.cts +48 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.d.ts +48 -0
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -0
- package/dist/utils/device-signers/createDeviceSigner.cjs +1 -0
- package/dist/utils/device-signers/createDeviceSigner.d.cts +27 -0
- package/dist/utils/device-signers/createDeviceSigner.d.ts +27 -0
- package/dist/utils/device-signers/createDeviceSigner.js +1 -0
- package/dist/utils/device-signers/index.cjs +1 -0
- package/dist/utils/device-signers/index.d.cts +13 -0
- package/dist/utils/device-signers/index.d.ts +13 -0
- package/dist/utils/device-signers/index.js +1 -0
- package/dist/utils/errors.cjs +1 -55
- package/dist/utils/errors.js +1 -55
- package/dist/utils/server-key-derivation.cjs +1 -0
- package/dist/utils/server-key-derivation.d.cts +20 -0
- package/dist/utils/server-key-derivation.d.ts +20 -0
- package/dist/utils/server-key-derivation.js +1 -0
- package/dist/utils/signer-locator.cjs +1 -0
- package/dist/utils/signer-locator.d.cts +26 -0
- package/dist/utils/signer-locator.d.ts +26 -0
- package/dist/utils/signer-locator.js +1 -0
- package/dist/utils/signer-mapping.cjs +1 -0
- package/dist/utils/signer-mapping.d.cts +32 -0
- package/dist/utils/signer-mapping.d.ts +32 -0
- package/dist/utils/signer-mapping.js +1 -0
- package/dist/utils/signer-validation.cjs +1 -10
- package/dist/utils/signer-validation.js +1 -10
- package/dist/wallets/__tests__/setup.cjs +1 -36
- package/dist/wallets/__tests__/setup.js +1 -36
- package/dist/wallets/__tests__/test-helpers.cjs +1 -93
- package/dist/wallets/__tests__/test-helpers.d.cts +6 -6
- package/dist/wallets/__tests__/test-helpers.d.ts +6 -6
- package/dist/wallets/__tests__/test-helpers.js +1 -93
- package/dist/wallets/evm.cjs +1 -25
- package/dist/wallets/evm.d.cts +2 -3
- package/dist/wallets/evm.d.ts +2 -3
- package/dist/wallets/evm.js +1 -25
- package/dist/wallets/solana.cjs +1 -26
- package/dist/wallets/solana.d.cts +5 -4
- package/dist/wallets/solana.d.ts +5 -4
- package/dist/wallets/solana.js +1 -26
- package/dist/wallets/stellar.cjs +1 -25
- package/dist/wallets/stellar.d.cts +2 -3
- package/dist/wallets/stellar.d.ts +2 -3
- package/dist/wallets/stellar.js +1 -25
- package/dist/wallets/types.d.cts +9 -168
- package/dist/wallets/types.d.ts +9 -168
- package/dist/wallets/wallet-factory.cjs +1 -33
- package/dist/wallets/wallet-factory.d.cts +17 -13
- package/dist/wallets/wallet-factory.d.ts +17 -13
- package/dist/wallets/wallet-factory.js +1 -33
- package/dist/wallets/wallet.cjs +1 -24
- package/dist/wallets/wallet.d.cts +97 -32
- package/dist/wallets/wallet.d.ts +97 -32
- package/dist/wallets/wallet.js +1 -24
- package/package.json +10 -5
- package/dist/chunk-2I2OFGNL.js +0 -36
- package/dist/chunk-2T5HHKUI.js +0 -19
- package/dist/chunk-2WBSPOWU.js +0 -223
- package/dist/chunk-3U6UAYOV.js +0 -25
- package/dist/chunk-47R3UV3J.cjs +0 -58
- package/dist/chunk-47WKYTRN.js +0 -63
- package/dist/chunk-4GFSUI2I.cjs +0 -66
- package/dist/chunk-55V4VMTX.cjs +0 -25
- package/dist/chunk-66UY53KP.cjs +0 -336
- package/dist/chunk-6FG5QXII.cjs +0 -110
- package/dist/chunk-6UMJYMAY.js +0 -82
- package/dist/chunk-7GOUUPS4.js +0 -36
- package/dist/chunk-7TT3VUDF.cjs +0 -84
- package/dist/chunk-7USEVMTW.cjs +0 -21
- package/dist/chunk-A6E67ZZP.js +0 -237
- package/dist/chunk-ABMZ3ZVN.js +0 -52
- package/dist/chunk-ASE2FXWP.js +0 -65
- package/dist/chunk-BMMZIPXT.js +0 -778
- package/dist/chunk-CMBFV325.js +0 -69
- package/dist/chunk-COR3CNRW.cjs +0 -778
- package/dist/chunk-F7L2TZ3I.cjs +0 -21
- package/dist/chunk-FHMKNG62.js +0 -741
- package/dist/chunk-FICVKSXZ.js +0 -84
- package/dist/chunk-FOOISYCJ.js +0 -66
- package/dist/chunk-G6QJHFSY.cjs +0 -74
- package/dist/chunk-HTSQPZHW.cjs +0 -25
- package/dist/chunk-HXJ3YPAN.js +0 -110
- package/dist/chunk-IDKGJO2G.cjs +0 -115
- package/dist/chunk-IOMKHF6R.cjs +0 -44
- package/dist/chunk-IPO25BCU.js +0 -43
- package/dist/chunk-JREZWZ2S.cjs +0 -52
- package/dist/chunk-JSWTGW46.cjs +0 -36
- package/dist/chunk-JWMQALLN.js +0 -21
- package/dist/chunk-KQH5ZXJ4.js +0 -336
- package/dist/chunk-KT3CVXFG.js +0 -9
- package/dist/chunk-MMISP35W.js +0 -21
- package/dist/chunk-MRZXYVQO.cjs +0 -82
- package/dist/chunk-NIBKCMQ2.cjs +0 -19
- package/dist/chunk-PIFD6KNH.js +0 -59
- package/dist/chunk-PJOJIRTY.js +0 -74
- package/dist/chunk-PK7J3Y3L.js +0 -44
- package/dist/chunk-PM7BGATN.cjs +0 -237
- package/dist/chunk-POG76HDD.cjs +0 -741
- package/dist/chunk-PUO4QNXH.js +0 -89
- package/dist/chunk-Q5KNPVYI.cjs +0 -59
- package/dist/chunk-R4AW5ADG.cjs +0 -16
- package/dist/chunk-R6DH4V7S.cjs +0 -69
- package/dist/chunk-RBHGZDDX.cjs +0 -58
- package/dist/chunk-RHR6P2KP.cjs +0 -15
- package/dist/chunk-RYQI3RXL.cjs +0 -247
- package/dist/chunk-SGINWAB6.js +0 -155
- package/dist/chunk-T2XUADHW.js +0 -58
- package/dist/chunk-TYQ4YIP7.js +0 -16
- package/dist/chunk-U3NV7UY7.js +0 -323
- package/dist/chunk-UO2J2ZB2.cjs +0 -65
- package/dist/chunk-W7K5E64Q.js +0 -247
- package/dist/chunk-WDZY4PP4.cjs +0 -223
- package/dist/chunk-WHTECI7J.cjs +0 -89
- package/dist/chunk-WJUPOCKJ.js +0 -15
- package/dist/chunk-WWW6IGZ7.js +0 -115
- package/dist/chunk-XC2V34TS.cjs +0 -155
- package/dist/chunk-XOCC3MPK.cjs +0 -36
- package/dist/chunk-ZAX22GSI.cjs +0 -323
- package/dist/chunk-ZBLW42YE.js +0 -25
- package/dist/chunk-ZNAGDENG.cjs +0 -43
- package/dist/chunk-ZP4ZZCIE.js +0 -58
- package/dist/chunk-ZT7EGOCI.cjs +0 -9
- package/dist/chunk-ZTEMOYS2.cjs +0 -63
package/README.md
CHANGED
|
@@ -27,9 +27,9 @@ const wallet = await crossmintWallets.getOrCreateWallet({
|
|
|
27
27
|
signer: {
|
|
28
28
|
type: "email",
|
|
29
29
|
email: "<your-email>",
|
|
30
|
-
onAuthRequired: async (needsAuth,
|
|
30
|
+
onAuthRequired: async (needsAuth, sendOtp, verifyOtp, reject) => {
|
|
31
31
|
if (needsAuth) {
|
|
32
|
-
await
|
|
32
|
+
await sendOtp();
|
|
33
33
|
// Prompt the user to check their email for the OTP code.
|
|
34
34
|
// Once the user provides the OTP, pass it to verifyOtp(otp).
|
|
35
35
|
// NOTE: If using our React/React Native SDK, this is handled automatically by the provider.
|
|
@@ -66,13 +66,13 @@ const activity = await wallet.experimental_activity();
|
|
|
66
66
|
console.log(activity.events);
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
###
|
|
69
|
+
### Signers
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
|
-
// Add a
|
|
73
|
-
await wallet.
|
|
72
|
+
// Add a signer
|
|
73
|
+
await wallet.addSigner({ signer: "<signer-address>" });
|
|
74
74
|
|
|
75
|
-
const signers = await wallet.
|
|
75
|
+
const signers = await wallet.signers();
|
|
76
76
|
|
|
77
77
|
console.log(signers);
|
|
78
78
|
```
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkG6QJHFSYcjs = require('../../chunk-G6QJHFSY.cjs');
|
|
16
|
-
require('../../chunk-UO2J2ZB2.cjs');
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
exports.DELAY_LONG = _chunkG6QJHFSYcjs.DELAY_LONG; exports.DELAY_MEDIUM = _chunkG6QJHFSYcjs.DELAY_MEDIUM; exports.DELAY_RATE_LIMIT_WINDOW = _chunkG6QJHFSYcjs.DELAY_RATE_LIMIT_WINDOW; exports.DELAY_SHORT = _chunkG6QJHFSYcjs.DELAY_SHORT; exports.HTTP_ERROR_STATUSES = _chunkG6QJHFSYcjs.HTTP_ERROR_STATUSES; exports.MOCK_API_KEY = _chunkG6QJHFSYcjs.MOCK_API_KEY; exports.TEST_ADDRESSES = _chunkG6QJHFSYcjs.TEST_ADDRESSES; exports.TEST_VALUES = _chunkG6QJHFSYcjs.TEST_VALUES; exports.TIMEOUT_LONG = _chunkG6QJHFSYcjs.TIMEOUT_LONG; exports.TIMEOUT_MEDIUM = _chunkG6QJHFSYcjs.TIMEOUT_MEDIUM; exports.TIMEOUT_SHORT = _chunkG6QJHFSYcjs.TIMEOUT_SHORT; exports.TOKEN_LOCATORS = _chunkG6QJHFSYcjs.TOKEN_LOCATORS; exports.WALLET_LOCATORS = _chunkG6QJHFSYcjs.WALLET_LOCATORS;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');require('../../chunk-2GKPWQBQ.cjs');exports.DELAY_LONG = _chunkJ33QM2IDcjs.i; exports.DELAY_MEDIUM = _chunkJ33QM2IDcjs.h; exports.DELAY_RATE_LIMIT_WINDOW = _chunkJ33QM2IDcjs.j; exports.DELAY_SHORT = _chunkJ33QM2IDcjs.g; exports.HTTP_ERROR_STATUSES = _chunkJ33QM2IDcjs.a; exports.MOCK_API_KEY = _chunkJ33QM2IDcjs.m; exports.TEST_ADDRESSES = _chunkJ33QM2IDcjs.k; exports.TEST_VALUES = _chunkJ33QM2IDcjs.l; exports.TIMEOUT_LONG = _chunkJ33QM2IDcjs.f; exports.TIMEOUT_MEDIUM = _chunkJ33QM2IDcjs.e; exports.TIMEOUT_SHORT = _chunkJ33QM2IDcjs.d; exports.TOKEN_LOCATORS = _chunkJ33QM2IDcjs.c; exports.WALLET_LOCATORS = _chunkJ33QM2IDcjs.b;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { WalletLocator } from '
|
|
1
|
+
import { U as WalletLocator } from '../../types-D-xASbms.cjs';
|
|
2
|
+
import '@solana/web3.js';
|
|
3
|
+
import '@crossmint/client-sdk-window';
|
|
4
|
+
import '@crossmint/client-signers';
|
|
2
5
|
import 'viem';
|
|
6
|
+
import 'abitype';
|
|
3
7
|
import '../gen/types.gen.cjs';
|
|
8
|
+
import 'ox';
|
|
9
|
+
import '@crossmint/common-sdk-base';
|
|
10
|
+
import '../../chains/chains.cjs';
|
|
11
|
+
import '../../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
4
12
|
|
|
5
13
|
declare const HTTP_ERROR_STATUSES: readonly [{
|
|
6
14
|
readonly status: 400;
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { WalletLocator } from '
|
|
1
|
+
import { U as WalletLocator } from '../../types-BDRS_MOb.js';
|
|
2
|
+
import '@solana/web3.js';
|
|
3
|
+
import '@crossmint/client-sdk-window';
|
|
4
|
+
import '@crossmint/client-signers';
|
|
2
5
|
import 'viem';
|
|
6
|
+
import 'abitype';
|
|
3
7
|
import '../gen/types.gen.js';
|
|
8
|
+
import 'ox';
|
|
9
|
+
import '@crossmint/common-sdk-base';
|
|
10
|
+
import '../../chains/chains.js';
|
|
11
|
+
import '../../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
4
12
|
|
|
5
13
|
declare const HTTP_ERROR_STATUSES: readonly [{
|
|
6
14
|
readonly status: 400;
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
DELAY_LONG,
|
|
3
|
-
DELAY_MEDIUM,
|
|
4
|
-
DELAY_RATE_LIMIT_WINDOW,
|
|
5
|
-
DELAY_SHORT,
|
|
6
|
-
HTTP_ERROR_STATUSES,
|
|
7
|
-
MOCK_API_KEY,
|
|
8
|
-
TEST_ADDRESSES,
|
|
9
|
-
TEST_VALUES,
|
|
10
|
-
TIMEOUT_LONG,
|
|
11
|
-
TIMEOUT_MEDIUM,
|
|
12
|
-
TIMEOUT_SHORT,
|
|
13
|
-
TOKEN_LOCATORS,
|
|
14
|
-
WALLET_LOCATORS
|
|
15
|
-
} from "../../chunk-PJOJIRTY.js";
|
|
16
|
-
import "../../chunk-ASE2FXWP.js";
|
|
17
|
-
export {
|
|
18
|
-
DELAY_LONG,
|
|
19
|
-
DELAY_MEDIUM,
|
|
20
|
-
DELAY_RATE_LIMIT_WINDOW,
|
|
21
|
-
DELAY_SHORT,
|
|
22
|
-
HTTP_ERROR_STATUSES,
|
|
23
|
-
MOCK_API_KEY,
|
|
24
|
-
TEST_ADDRESSES,
|
|
25
|
-
TEST_VALUES,
|
|
26
|
-
TIMEOUT_LONG,
|
|
27
|
-
TIMEOUT_MEDIUM,
|
|
28
|
-
TIMEOUT_SHORT,
|
|
29
|
-
TOKEN_LOCATORS,
|
|
30
|
-
WALLET_LOCATORS
|
|
31
|
-
};
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"../../chunk-DIGDDKSF.js";import"../../chunk-J3R36SGJ.js";export{i as DELAY_LONG,h as DELAY_MEDIUM,j as DELAY_RATE_LIMIT_WINDOW,g as DELAY_SHORT,a as HTTP_ERROR_STATUSES,m as MOCK_API_KEY,k as TEST_ADDRESSES,l as TEST_VALUES,f as TIMEOUT_LONG,e as TIMEOUT_MEDIUM,d as TIMEOUT_SHORT,c as TOKEN_LOCATORS,b as WALLET_LOCATORS};
|
|
@@ -1,372 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunkG6QJHFSYcjs = require('../../chunk-G6QJHFSY.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkRYQI3RXLcjs = require('../../chunk-RYQI3RXL.cjs');
|
|
13
|
-
require('../../chunk-XC2V34TS.cjs');
|
|
14
|
-
require('../../chunk-JREZWZ2S.cjs');
|
|
15
|
-
require('../../chunk-R4AW5ADG.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _chunkUO2J2ZB2cjs = require('../../chunk-UO2J2ZB2.cjs');
|
|
21
|
-
|
|
22
|
-
// src/api/__tests__/test-utils.ts
|
|
23
|
-
var _vitest = require('vitest');
|
|
24
|
-
var createMockResponse = ({
|
|
25
|
-
data,
|
|
26
|
-
status = 200,
|
|
27
|
-
ok = true,
|
|
28
|
-
statusText = "OK"
|
|
29
|
-
}) => {
|
|
30
|
-
return {
|
|
31
|
-
json: _vitest.vi.fn().mockResolvedValue(data),
|
|
32
|
-
ok,
|
|
33
|
-
status,
|
|
34
|
-
statusText
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
var createMockSuccessResponse = (data) => createMockResponse({ data });
|
|
38
|
-
var createMockErrorResponse = (data, status = 400, statusText = "Bad Request") => createMockResponse({ data, status, ok: false, statusText });
|
|
39
|
-
var createMockCrossmint = (overrides = {}) => {
|
|
40
|
-
const base = _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
41
|
-
apiKey: _chunkG6QJHFSYcjs.MOCK_API_KEY
|
|
42
|
-
}, overrides);
|
|
43
|
-
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, base), {
|
|
44
|
-
setJwt: _vitest.vi.fn().mockReturnThis(),
|
|
45
|
-
experimental_setCustomAuth: _vitest.vi.fn().mockReturnThis()
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
var createTestApiClient = (crossmint) => {
|
|
49
|
-
return new (0, _chunkRYQI3RXLcjs.ApiClient)(crossmint || createMockCrossmint());
|
|
50
|
-
};
|
|
51
|
-
var createServerSideApiClient = () => {
|
|
52
|
-
const apiClient = createTestApiClient();
|
|
53
|
-
Object.defineProperty(apiClient, "isServerSide", {
|
|
54
|
-
get: () => true,
|
|
55
|
-
configurable: true
|
|
56
|
-
});
|
|
57
|
-
return apiClient;
|
|
58
|
-
};
|
|
59
|
-
var extractFetchCall = (mockFn) => {
|
|
60
|
-
const calls = mockFn.mock.calls;
|
|
61
|
-
if (calls.length === 0) {
|
|
62
|
-
return void 0;
|
|
63
|
-
}
|
|
64
|
-
const lastCall = calls[calls.length - 1];
|
|
65
|
-
return {
|
|
66
|
-
path: lastCall[0],
|
|
67
|
-
options: lastCall[1]
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
var expectRequestPath = (call, expectedPath) => {
|
|
71
|
-
_vitest.expect.call(void 0, call == null ? void 0 : call.path).toBe(expectedPath);
|
|
72
|
-
};
|
|
73
|
-
var expectCommonHeaders = (headers) => {
|
|
74
|
-
const headerObj = headers;
|
|
75
|
-
_vitest.expect.call(void 0, headerObj["Content-Type"]).toBe("application/json");
|
|
76
|
-
};
|
|
77
|
-
var expectRequestBody = (options, expectedBody) => {
|
|
78
|
-
_vitest.expect.call(void 0, options.body).toBe(JSON.stringify(expectedBody));
|
|
79
|
-
};
|
|
80
|
-
var validateRequest = (call, expectedPath, expectedBody) => {
|
|
81
|
-
_vitest.expect.call(void 0, call).toBeDefined();
|
|
82
|
-
if (!call) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
expectRequestPath(call, expectedPath);
|
|
86
|
-
if (call.options.headers) {
|
|
87
|
-
expectCommonHeaders(call.options.headers);
|
|
88
|
-
}
|
|
89
|
-
if (expectedBody !== void 0 && call.options) {
|
|
90
|
-
expectRequestBody(call.options, expectedBody);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var testHttpErrorResponse = (apiCall, mockFn, errorData, statusCode) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
94
|
-
mockFn.mockResolvedValue(createMockErrorResponse(errorData, statusCode));
|
|
95
|
-
const result = yield apiCall();
|
|
96
|
-
_vitest.expect.call(void 0, isErrorResponse(result)).toBe(true);
|
|
97
|
-
if (isErrorResponse(result)) {
|
|
98
|
-
_vitest.expect.call(void 0, result.error).toBe(true);
|
|
99
|
-
if (errorData.message) {
|
|
100
|
-
_vitest.expect.call(void 0, result.message).toBe(errorData.message);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
var testCommonHttpErrors = (_0, _1, ..._2) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, [_0, _1, ..._2], function* (apiCall, mockFn, skipStatuses = []) {
|
|
105
|
-
for (const { status, message } of _chunkG6QJHFSYcjs.HTTP_ERROR_STATUSES) {
|
|
106
|
-
if (skipStatuses.includes(status)) {
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
const errorResponse = { error: true, message };
|
|
110
|
-
mockFn.mockResolvedValueOnce(createMockErrorResponse(errorResponse, status));
|
|
111
|
-
const result = yield apiCall();
|
|
112
|
-
_vitest.expect.call(void 0, isErrorResponse(result)).toBe(true);
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
var testNetworkError = (apiCall, mockFn) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
116
|
-
mockFn.mockRejectedValue(new Error("Network error"));
|
|
117
|
-
yield _vitest.expect.call(void 0, apiCall()).rejects.toThrow("Network error");
|
|
118
|
-
});
|
|
119
|
-
var testInvalidJsonResponse = (apiCall, mockFn) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
120
|
-
const mockResponse = {
|
|
121
|
-
json: _vitest.vi.fn().mockRejectedValue(new Error("Invalid JSON")),
|
|
122
|
-
ok: true,
|
|
123
|
-
status: 200
|
|
124
|
-
};
|
|
125
|
-
mockFn.mockResolvedValue(mockResponse);
|
|
126
|
-
yield _vitest.expect.call(void 0, apiCall()).rejects.toThrow();
|
|
127
|
-
});
|
|
128
|
-
var testTimeoutError = (apiCall, mockFn) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
129
|
-
mockFn.mockImplementation(
|
|
130
|
-
() => new Promise((_, reject) => setTimeout(() => reject(new Error("Request timeout")), 0))
|
|
131
|
-
);
|
|
132
|
-
yield _vitest.expect.call(void 0, apiCall()).rejects.toThrow("Request timeout");
|
|
133
|
-
});
|
|
134
|
-
var testMalformedResponse = (apiCall, mockFn, malformedData) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
135
|
-
mockFn.mockResolvedValue(createMockSuccessResponse(malformedData));
|
|
136
|
-
const result = yield apiCall();
|
|
137
|
-
_vitest.expect.call(void 0, result).toEqual(malformedData);
|
|
138
|
-
});
|
|
139
|
-
var createMockWalletResponse = (overrides = {}) => _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
140
|
-
address: _chunkG6QJHFSYcjs.WALLET_LOCATORS.evmAddress,
|
|
141
|
-
chainType: "evm",
|
|
142
|
-
type: "smart",
|
|
143
|
-
config: {
|
|
144
|
-
adminSigner: {
|
|
145
|
-
type: "external-wallet",
|
|
146
|
-
address: _chunkG6QJHFSYcjs.TEST_ADDRESSES.EVM_TEST
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}, overrides);
|
|
150
|
-
var createMockSendResponse = (overrides = {}) => _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
151
|
-
id: "txn-123",
|
|
152
|
-
status: "pending",
|
|
153
|
-
chainType: "evm",
|
|
154
|
-
walletType: "evm-smart-wallet",
|
|
155
|
-
params: {
|
|
156
|
-
transaction: "0x1234567890abcdef",
|
|
157
|
-
signer: "api-key:test"
|
|
158
|
-
},
|
|
159
|
-
onChain: {
|
|
160
|
-
txId: "0xabcdef1234567890abcdef1234567890abcdef12",
|
|
161
|
-
explorerLink: "https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"
|
|
162
|
-
},
|
|
163
|
-
createdAt: Date.now()
|
|
164
|
-
}, overrides);
|
|
165
|
-
function isErrorResponse(response) {
|
|
166
|
-
return typeof response === "object" && response !== null && "error" in response && response.error === true;
|
|
167
|
-
}
|
|
168
|
-
function isSuccessWalletResponse(response) {
|
|
169
|
-
return typeof response === "object" && response !== null && "address" in response && "chainType" in response && "type" in response;
|
|
170
|
-
}
|
|
171
|
-
function isSuccessTransactionResponse(response) {
|
|
172
|
-
return typeof response === "object" && response !== null && "id" in response && "status" in response && "chainType" in response;
|
|
173
|
-
}
|
|
174
|
-
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
175
|
-
var isValidEthereumAddress = (address) => {
|
|
176
|
-
return /^0x[a-fA-F0-9]{40}$/.test(address);
|
|
177
|
-
};
|
|
178
|
-
var isValidSolanaAddress = (address) => {
|
|
179
|
-
return /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
|
|
180
|
-
};
|
|
181
|
-
var createIntegrationApiClient = (apiKey, baseUrl, overrides = {}) => {
|
|
182
|
-
const base = _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
183
|
-
apiKey
|
|
184
|
-
}, baseUrl && { overrideBaseUrl: baseUrl }), overrides);
|
|
185
|
-
const crossmint = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, base), {
|
|
186
|
-
setJwt: () => crossmint,
|
|
187
|
-
experimental_setCustomAuth: () => crossmint
|
|
188
|
-
});
|
|
189
|
-
return new (0, _chunkRYQI3RXLcjs.ApiClient)(crossmint);
|
|
190
|
-
};
|
|
191
|
-
var TestDataFactory = class {
|
|
192
|
-
constructor() {
|
|
193
|
-
this.wallets = [];
|
|
194
|
-
this.transactions = [];
|
|
195
|
-
}
|
|
196
|
-
addWallet(address) {
|
|
197
|
-
if (address && !this.wallets.includes(address)) {
|
|
198
|
-
this.wallets.push(address);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
addTransaction(id) {
|
|
202
|
-
if (id && !this.transactions.includes(id)) {
|
|
203
|
-
this.transactions.push(id);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
getWallet(index = 0) {
|
|
207
|
-
return this.wallets[index];
|
|
208
|
-
}
|
|
209
|
-
getTransaction(index = 0) {
|
|
210
|
-
return this.transactions[index];
|
|
211
|
-
}
|
|
212
|
-
hasWallets() {
|
|
213
|
-
return this.wallets.length > 0;
|
|
214
|
-
}
|
|
215
|
-
clear() {
|
|
216
|
-
this.wallets = [];
|
|
217
|
-
this.transactions = [];
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
function ensureWalletExists(_0, _1) {
|
|
221
|
-
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (apiClient, testData, options = {}) {
|
|
222
|
-
if (testData.hasWallets()) {
|
|
223
|
-
return testData.getWallet();
|
|
224
|
-
}
|
|
225
|
-
const { chainType = "evm", type = "mpc", owner, testName = "default" } = options;
|
|
226
|
-
const ownerId = owner || `userId:integration-${testName}-${Date.now()}`;
|
|
227
|
-
const createResult = yield apiClient.createWallet(_chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
228
|
-
chainType,
|
|
229
|
-
type
|
|
230
|
-
}, owner && { owner: ownerId }));
|
|
231
|
-
if (isSuccessWalletResponse(createResult)) {
|
|
232
|
-
testData.addWallet(createResult.address);
|
|
233
|
-
return createResult.address;
|
|
234
|
-
}
|
|
235
|
-
return void 0;
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function createTestWallet(apiClient, testData, params) {
|
|
239
|
-
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
240
|
-
const result = yield apiClient.createWallet(params);
|
|
241
|
-
if (isSuccessWalletResponse(result)) {
|
|
242
|
-
testData.addWallet(result.address);
|
|
243
|
-
}
|
|
244
|
-
return result;
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
function expectErrorResponse(response, message) {
|
|
248
|
-
_vitest.expect.call(void 0, isErrorResponse(response)).toBe(true);
|
|
249
|
-
if (message) {
|
|
250
|
-
_vitest.expect.call(void 0, response.message).toBeDefined();
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
function expectSuccessWalletResponse(response) {
|
|
254
|
-
_vitest.expect.call(void 0, isSuccessWalletResponse(response)).toBe(true);
|
|
255
|
-
}
|
|
256
|
-
function expectSuccessTransactionResponse(response) {
|
|
257
|
-
_vitest.expect.call(void 0, isSuccessTransactionResponse(response)).toBe(true);
|
|
258
|
-
}
|
|
259
|
-
var fundWallet = (apiClient, walletLocator, amount, token = "usdxm", chain = "base-sepolia") => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
260
|
-
const params = {
|
|
261
|
-
amount,
|
|
262
|
-
token,
|
|
263
|
-
chain
|
|
264
|
-
};
|
|
265
|
-
const result = yield apiClient.fundWallet(walletLocator, params);
|
|
266
|
-
if (isErrorResponse(result)) {
|
|
267
|
-
throw new Error(`Failed to fund wallet: ${result.message || "Unknown error"}`);
|
|
268
|
-
}
|
|
269
|
-
yield delay(_chunkG6QJHFSYcjs.DELAY_LONG);
|
|
270
|
-
return result;
|
|
271
|
-
});
|
|
272
|
-
var approveTransaction = (_0, _1, _2, ..._3) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, [_0, _1, _2, ..._3], function* (apiClient, walletLocator, transactionId, maxRetries = _chunkG6QJHFSYcjs.TEST_VALUES.APPROVE_TRANSACTION_MAX_RETRIES) {
|
|
273
|
-
var _a;
|
|
274
|
-
for (let i = 0; i < maxRetries; i++) {
|
|
275
|
-
const transaction = yield apiClient.getTransaction(walletLocator, transactionId);
|
|
276
|
-
if (isErrorResponse(transaction)) {
|
|
277
|
-
throw new Error(`Transaction not found: ${transaction.message || "Unknown error"}`);
|
|
278
|
-
}
|
|
279
|
-
if ("status" in transaction && (transaction.status === "success" || transaction.status === "failed")) {
|
|
280
|
-
return transaction;
|
|
281
|
-
}
|
|
282
|
-
const pendingApprovals = "approvals" in transaction ? (_a = transaction.approvals) == null ? void 0 : _a.pending : void 0;
|
|
283
|
-
if (pendingApprovals && pendingApprovals.length > 0) {
|
|
284
|
-
const approvals = {
|
|
285
|
-
approvals: pendingApprovals.map((approval) => ({
|
|
286
|
-
signer: approval.signer.locator,
|
|
287
|
-
signature: ""
|
|
288
|
-
}))
|
|
289
|
-
};
|
|
290
|
-
const approvedTransaction = yield apiClient.approveTransaction(walletLocator, transactionId, approvals);
|
|
291
|
-
if (isErrorResponse(approvedTransaction)) {
|
|
292
|
-
throw new Error(`Failed to approve transaction: ${approvedTransaction.message || "Unknown error"}`);
|
|
293
|
-
}
|
|
294
|
-
yield delay(_chunkG6QJHFSYcjs.DELAY_RATE_LIMIT_WINDOW);
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
yield delay(_chunkG6QJHFSYcjs.DELAY_LONG);
|
|
298
|
-
}
|
|
299
|
-
const finalTransaction = yield apiClient.getTransaction(walletLocator, transactionId);
|
|
300
|
-
if (isErrorResponse(finalTransaction)) {
|
|
301
|
-
throw new Error(`Transaction not found after retries: ${finalTransaction.message || "Unknown error"}`);
|
|
302
|
-
}
|
|
303
|
-
if (!("status" in finalTransaction)) {
|
|
304
|
-
throw new Error("Transaction response missing status property");
|
|
305
|
-
}
|
|
306
|
-
return finalTransaction;
|
|
307
|
-
});
|
|
308
|
-
var fundWalletAndWait = (apiClient, walletLocator, amount = 1, token = "usdxm", chain = "base-sepolia") => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
309
|
-
return fundWallet(apiClient, walletLocator, amount, token, chain);
|
|
310
|
-
});
|
|
311
|
-
var sendTokenAndApprove = (apiClient, walletLocator, tokenLocator, recipient, amount) => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
312
|
-
const sendResult = yield apiClient.send(walletLocator, tokenLocator, {
|
|
313
|
-
recipient,
|
|
314
|
-
amount
|
|
315
|
-
});
|
|
316
|
-
if (isErrorResponse(sendResult)) {
|
|
317
|
-
throw new Error(`Failed to send token: ${sendResult.message || "Unknown error"}`);
|
|
318
|
-
}
|
|
319
|
-
if (typeof sendResult === "object" && sendResult !== null && "id" in sendResult && typeof sendResult.id === "string") {
|
|
320
|
-
return approveTransaction(apiClient, walletLocator, sendResult.id);
|
|
321
|
-
}
|
|
322
|
-
throw new Error("Transaction ID not found in send response");
|
|
323
|
-
});
|
|
324
|
-
var ensureWalletFunded = (apiClient, walletLocator, amount = 1, token = "usdxm", chain = "base-sepolia") => _chunkUO2J2ZB2cjs.__async.call(void 0, void 0, null, function* () {
|
|
325
|
-
try {
|
|
326
|
-
yield fundWallet(apiClient, walletLocator, amount, token, chain);
|
|
327
|
-
} catch (error) {
|
|
328
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
329
|
-
if (!errorMessage.includes("already funded") && !errorMessage.includes("insufficient")) {
|
|
330
|
-
throw error;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
exports.TestDataFactory = TestDataFactory; exports.approveTransaction = approveTransaction; exports.createIntegrationApiClient = createIntegrationApiClient; exports.createMockCrossmint = createMockCrossmint; exports.createMockErrorResponse = createMockErrorResponse; exports.createMockResponse = createMockResponse; exports.createMockSendResponse = createMockSendResponse; exports.createMockSuccessResponse = createMockSuccessResponse; exports.createMockWalletResponse = createMockWalletResponse; exports.createServerSideApiClient = createServerSideApiClient; exports.createTestApiClient = createTestApiClient; exports.createTestWallet = createTestWallet; exports.delay = delay; exports.ensureWalletExists = ensureWalletExists; exports.ensureWalletFunded = ensureWalletFunded; exports.expectCommonHeaders = expectCommonHeaders; exports.expectErrorResponse = expectErrorResponse; exports.expectRequestBody = expectRequestBody; exports.expectRequestPath = expectRequestPath; exports.expectSuccessTransactionResponse = expectSuccessTransactionResponse; exports.expectSuccessWalletResponse = expectSuccessWalletResponse; exports.extractFetchCall = extractFetchCall; exports.fundWallet = fundWallet; exports.fundWalletAndWait = fundWalletAndWait; exports.isErrorResponse = isErrorResponse; exports.isSuccessTransactionResponse = isSuccessTransactionResponse; exports.isSuccessWalletResponse = isSuccessWalletResponse; exports.isValidEthereumAddress = isValidEthereumAddress; exports.isValidSolanaAddress = isValidSolanaAddress; exports.sendTokenAndApprove = sendTokenAndApprove; exports.testCommonHttpErrors = testCommonHttpErrors; exports.testHttpErrorResponse = testHttpErrorResponse; exports.testInvalidJsonResponse = testInvalidJsonResponse; exports.testMalformedResponse = testMalformedResponse; exports.testNetworkError = testNetworkError; exports.testTimeoutError = testTimeoutError; exports.validateRequest = validateRequest;
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkJ33QM2IDcjs = require('../../chunk-J33QM2ID.cjs');var _chunkISXH7QXGcjs = require('../../chunk-ISXH7QXG.cjs');require('../../chunk-O4FVTK7X.cjs');require('../../chunk-S4O54O4C.cjs');require('../../chunk-U7QSF6P7.cjs');var _chunk2GKPWQBQcjs = require('../../chunk-2GKPWQBQ.cjs');var _vitest = require('vitest');var b=({data:e,status:t=200,ok:n=!0,statusText:s="OK"})=>({json:_vitest.vi.fn().mockResolvedValue(e),ok:n,status:t,statusText:s}),j= exports.createMockSuccessResponse =e=>b({data:e}),P= exports.createMockErrorResponse =(e,t=400,n="Bad Request")=>b({data:e,status:t,ok:!1,statusText:n}),B= exports.createMockCrossmint =(e={})=>{let t=_chunk2GKPWQBQcjs.a.call(void 0, {apiKey:_chunkJ33QM2IDcjs.m},e);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{setJwt:_vitest.vi.fn().mockReturnThis()})},L= exports.createTestApiClient =e=>new (0, _chunkISXH7QXGcjs.a)(e||B()),K= exports.createServerSideApiClient =()=>{let e=L();return Object.defineProperty(e,"isServerSide",{get:()=>!0,configurable:!0}),e},Y= exports.extractFetchCall =e=>{let t=e.mock.calls;if(t.length===0)return;let n=t[t.length-1];return{path:n[0],options:n[1]}},N= exports.expectRequestPath =(e,t)=>{_vitest.expect.call(void 0, e==null?void 0:e.path).toBe(t)},V= exports.expectCommonHeaders =e=>{_vitest.expect.call(void 0, e["Content-Type"]).toBe("application/json")},q= exports.expectRequestBody =(e,t)=>{_vitest.expect.call(void 0, e.body).toBe(JSON.stringify(t))},z= exports.validateRequest =(e,t,n)=>{_vitest.expect.call(void 0, e).toBeDefined(),e&&(N(e,t),e.options.headers&&V(e.options.headers),n!==void 0&&e.options&&q(e.options,n))},X= exports.testHttpErrorResponse =(e,t,n,s)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(P(n,s));let a=yield e();_vitest.expect.call(void 0, u(a)).toBe(!0),u(a)&&(_vitest.expect.call(void 0, a.error).toBe(!0),n.message&&_vitest.expect.call(void 0, a.message).toBe(n.message))}),Z= exports.testCommonHttpErrors =(s,a,...o)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,[s,a,...o],function*(e,t,n=[]){for(let{status:c,message:g}of _chunkJ33QM2IDcjs.a){if(n.includes(c))continue;let l={error:!0,message:g};t.mockResolvedValueOnce(P(l,c));let m=yield e();_vitest.expect.call(void 0, u(m)).toBe(!0)}}),Q= exports.testNetworkError =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockRejectedValue(new Error("Network error")),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Network error")}),ee= exports.testInvalidJsonResponse =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let n={json:_vitest.vi.fn().mockRejectedValue(new Error("Invalid JSON")),ok:!0,status:200};t.mockResolvedValue(n),yield _vitest.expect.call(void 0, e()).rejects.toThrow()}),te= exports.testTimeoutError =(e,t)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockImplementation(()=>new Promise((n,s)=>setTimeout(()=>s(new Error("Request timeout")),0))),yield _vitest.expect.call(void 0, e()).rejects.toThrow("Request timeout")}),ne= exports.testMalformedResponse =(e,t,n)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){t.mockResolvedValue(j(n));let s=yield e();_vitest.expect.call(void 0, s).toEqual(n)}),se= exports.createMockWalletResponse =(e={})=>_chunk2GKPWQBQcjs.a.call(void 0, {address:_chunkJ33QM2IDcjs.b.evmAddress,chainType:"evm",type:"smart",config:{adminSigner:{type:"external-wallet",address:_chunkJ33QM2IDcjs.k.EVM_TEST}}},e),oe= exports.createMockSendResponse =(e={})=>_chunk2GKPWQBQcjs.a.call(void 0, {id:"txn-123",status:"pending",chainType:"evm",walletType:"evm-smart-wallet",params:{transaction:"0x1234567890abcdef",signer:"api-key:test"},onChain:{txId:"0xabcdef1234567890abcdef1234567890abcdef12",explorerLink:"https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"},createdAt:Date.now()},e);function u(e){return typeof e=="object"&&e!==null&&"error"in e&&e.error===!0}function h(e){return typeof e=="object"&&e!==null&&"address"in e&&"chainType"in e&&"type"in e}function $(e){return typeof e=="object"&&e!==null&&"id"in e&&"status"in e&&"chainType"in e}var x=e=>new Promise(t=>setTimeout(t,e)),re= exports.isValidEthereumAddress =e=>/^0x[a-fA-F0-9]{40}$/.test(e),ae= exports.isValidSolanaAddress =e=>/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(e),ie= exports.createIntegrationApiClient =(e,t,n={})=>{let s=_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {apiKey:e},t&&{overrideBaseUrl:t}),n),a=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},s),{setJwt:()=>a});return new (0, _chunkISXH7QXGcjs.a)(a)},v= exports.TestDataFactory =class{constructor(){this.wallets=[];this.transactions=[]}addWallet(t){t&&!this.wallets.includes(t)&&this.wallets.push(t)}addTransaction(t){t&&!this.transactions.includes(t)&&this.transactions.push(t)}getWallet(t=0){return this.wallets[t]}getTransaction(t=0){return this.transactions[t]}hasWallets(){return this.wallets.length>0}clear(){this.wallets=[],this.transactions=[]}};function ce(s,a){return _chunk2GKPWQBQcjs.g.call(void 0, this,arguments,function*(e,t,n={}){if(t.hasWallets())return t.getWallet();let{chainType:o="evm",type:c="mpc",owner:g,testName:l="default"}=n,m=g||`userId:integration-${l}-${Date.now()}`,f=yield e.createWallet(_chunk2GKPWQBQcjs.a.call(void 0, {chainType:o,type:c},g&&{owner:m}));if(h(f))return t.addWallet(f.address),f.address})}function pe(e,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let s=yield e.createWallet(n);return h(s)&&t.addWallet(s.address),s})}function ue(e,t){_vitest.expect.call(void 0, u(e)).toBe(!0),t&&_vitest.expect.call(void 0, e.message).toBeDefined()}function le(e){_vitest.expect.call(void 0, h(e)).toBe(!0)}function de(e){_vitest.expect.call(void 0, $(e)).toBe(!0)}var I=(e,t,n,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o={amount:n,token:s,chain:a},c=yield e.fundWallet(t,o);if(u(c))throw new Error(`Failed to fund wallet: ${c.message||"Unknown error"}`);return yield x(_chunkJ33QM2IDcjs.i),c}),U= exports.approveTransaction =(a,o,c,...g)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,[a,o,c,...g],function*(e,t,n,s=_chunkJ33QM2IDcjs.l.APPROVE_TRANSACTION_MAX_RETRIES){var m;for(let f=0;f<s;f++){let d=yield e.getTransaction(t,n);if(u(d))throw new Error(`Transaction not found: ${d.message||"Unknown error"}`);if("status"in d&&(d.status==="success"||d.status==="failed"))return d;let T="approvals"in d?(m=d.approvals)==null?void 0:m.pending:void 0;if(T&&T.length>0){let O={approvals:T.map(_=>({signer:_.signer.locator,signature:""}))},C=yield e.approveTransaction(t,n,O);if(u(C))throw new Error(`Failed to approve transaction: ${C.message||"Unknown error"}`);yield x(_chunkJ33QM2IDcjs.j);continue}yield x(_chunkJ33QM2IDcjs.i)}let l=yield e.getTransaction(t,n);if(u(l))throw new Error(`Transaction not found after retries: ${l.message||"Unknown error"}`);if(!("status"in l))throw new Error("Transaction response missing status property");return l}),me= exports.fundWalletAndWait =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){return I(e,t,n,s,a)}),fe= exports.sendTokenAndApprove =(e,t,n,s,a)=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){let o=yield e.send(t,n,{recipient:s,amount:a});if(u(o))throw new Error(`Failed to send token: ${o.message||"Unknown error"}`);if(typeof o=="object"&&o!==null&&"id"in o&&typeof o.id=="string")return U(e,t,o.id);throw new Error("Transaction ID not found in send response")}),ge= exports.ensureWalletFunded =(e,t,n=1,s="usdxm",a="base-sepolia")=>_chunk2GKPWQBQcjs.g.call(void 0, void 0,null,function*(){try{yield I(e,t,n,s,a)}catch(o){let c=o instanceof Error?o.message:String(o);if(!c.includes("already funded")&&!c.includes("insufficient"))throw o}});exports.TestDataFactory = v; exports.approveTransaction = U; exports.createIntegrationApiClient = ie; exports.createMockCrossmint = B; exports.createMockErrorResponse = P; exports.createMockResponse = b; exports.createMockSendResponse = oe; exports.createMockSuccessResponse = j; exports.createMockWalletResponse = se; exports.createServerSideApiClient = K; exports.createTestApiClient = L; exports.createTestWallet = pe; exports.delay = x; exports.ensureWalletExists = ce; exports.ensureWalletFunded = ge; exports.expectCommonHeaders = V; exports.expectErrorResponse = ue; exports.expectRequestBody = q; exports.expectRequestPath = N; exports.expectSuccessTransactionResponse = de; exports.expectSuccessWalletResponse = le; exports.extractFetchCall = Y; exports.fundWallet = I; exports.fundWalletAndWait = me; exports.isErrorResponse = u; exports.isSuccessTransactionResponse = $; exports.isSuccessWalletResponse = h; exports.isValidEthereumAddress = re; exports.isValidSolanaAddress = ae; exports.sendTokenAndApprove = fe; exports.testCommonHttpErrors = Z; exports.testHttpErrorResponse = X; exports.testInvalidJsonResponse = ee; exports.testMalformedResponse = ne; exports.testNetworkError = Q; exports.testTimeoutError = te; exports.validateRequest = z;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.cjs';
|
|
4
|
-
import { CreateWalletResponse, SendResponse, CreateWalletParams, WalletLocator, FundWalletResponse, GetTransactionResponse } from '
|
|
4
|
+
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-D-xASbms.cjs';
|
|
5
5
|
import '../../chains/chains.cjs';
|
|
6
6
|
import 'viem';
|
|
7
|
+
import '@solana/web3.js';
|
|
8
|
+
import '@crossmint/client-sdk-window';
|
|
9
|
+
import '@crossmint/client-signers';
|
|
10
|
+
import 'abitype';
|
|
7
11
|
import '../gen/types.gen.cjs';
|
|
12
|
+
import 'ox';
|
|
13
|
+
import '../../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
8
14
|
|
|
9
15
|
type MockResponseOptions<T> = {
|
|
10
16
|
data: T;
|
|
@@ -90,10 +96,10 @@ declare function createTestWallet(apiClient: ApiClient, testData: TestDataFactor
|
|
|
90
96
|
declare function expectErrorResponse(response: unknown, message?: string): asserts response is ErrorResponse;
|
|
91
97
|
declare function expectSuccessWalletResponse(response: unknown): asserts response is SuccessWalletResponse;
|
|
92
98
|
declare function expectSuccessTransactionResponse(response: unknown): asserts response is SuccessTransactionResponse;
|
|
93
|
-
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "
|
|
99
|
+
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
94
100
|
declare const approveTransaction: (apiClient: ApiClient, walletLocator: WalletLocator, transactionId: string, maxRetries?: number) => Promise<GetTransactionResponse>;
|
|
95
|
-
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "
|
|
101
|
+
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
96
102
|
declare const sendTokenAndApprove: (apiClient: ApiClient, walletLocator: WalletLocator, tokenLocator: string, recipient: string, amount: string) => Promise<GetTransactionResponse>;
|
|
97
|
-
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "
|
|
103
|
+
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdxm", chain?: string) => Promise<void>;
|
|
98
104
|
|
|
99
105
|
export { type ErrorResponse, type FetchCallInfo, type MockResponseOptions, type SuccessTransactionResponse, type SuccessWalletResponse, TestDataFactory, approveTransaction, createIntegrationApiClient, createMockCrossmint, createMockErrorResponse, createMockResponse, createMockSendResponse, createMockSuccessResponse, createMockWalletResponse, createServerSideApiClient, createTestApiClient, createTestWallet, delay, ensureWalletExists, ensureWalletFunded, expectCommonHeaders, expectErrorResponse, expectRequestBody, expectRequestPath, expectSuccessTransactionResponse, expectSuccessWalletResponse, extractFetchCall, fundWallet, fundWalletAndWait, isErrorResponse, isSuccessTransactionResponse, isSuccessWalletResponse, isValidEthereumAddress, isValidSolanaAddress, sendTokenAndApprove, testCommonHttpErrors, testHttpErrorResponse, testInvalidJsonResponse, testMalformedResponse, testNetworkError, testTimeoutError, validateRequest };
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { MockedFunction } from 'vitest';
|
|
2
2
|
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
3
|
import { ApiClient } from '../client.js';
|
|
4
|
-
import { CreateWalletResponse, SendResponse, CreateWalletParams, WalletLocator, FundWalletResponse, GetTransactionResponse } from '
|
|
4
|
+
import { a5 as CreateWalletResponse, a6 as SendResponse, a7 as CreateWalletParams, U as WalletLocator, V as FundWalletResponse, a8 as GetTransactionResponse } from '../../types-BDRS_MOb.js';
|
|
5
5
|
import '../../chains/chains.js';
|
|
6
6
|
import 'viem';
|
|
7
|
+
import '@solana/web3.js';
|
|
8
|
+
import '@crossmint/client-sdk-window';
|
|
9
|
+
import '@crossmint/client-signers';
|
|
10
|
+
import 'abitype';
|
|
7
11
|
import '../gen/types.gen.js';
|
|
12
|
+
import 'ox';
|
|
13
|
+
import '../../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
8
14
|
|
|
9
15
|
type MockResponseOptions<T> = {
|
|
10
16
|
data: T;
|
|
@@ -90,10 +96,10 @@ declare function createTestWallet(apiClient: ApiClient, testData: TestDataFactor
|
|
|
90
96
|
declare function expectErrorResponse(response: unknown, message?: string): asserts response is ErrorResponse;
|
|
91
97
|
declare function expectSuccessWalletResponse(response: unknown): asserts response is SuccessWalletResponse;
|
|
92
98
|
declare function expectSuccessTransactionResponse(response: unknown): asserts response is SuccessTransactionResponse;
|
|
93
|
-
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "
|
|
99
|
+
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
94
100
|
declare const approveTransaction: (apiClient: ApiClient, walletLocator: WalletLocator, transactionId: string, maxRetries?: number) => Promise<GetTransactionResponse>;
|
|
95
|
-
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "
|
|
101
|
+
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
96
102
|
declare const sendTokenAndApprove: (apiClient: ApiClient, walletLocator: WalletLocator, tokenLocator: string, recipient: string, amount: string) => Promise<GetTransactionResponse>;
|
|
97
|
-
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "
|
|
103
|
+
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdxm", chain?: string) => Promise<void>;
|
|
98
104
|
|
|
99
105
|
export { type ErrorResponse, type FetchCallInfo, type MockResponseOptions, type SuccessTransactionResponse, type SuccessWalletResponse, TestDataFactory, approveTransaction, createIntegrationApiClient, createMockCrossmint, createMockErrorResponse, createMockResponse, createMockSendResponse, createMockSuccessResponse, createMockWalletResponse, createServerSideApiClient, createTestApiClient, createTestWallet, delay, ensureWalletExists, ensureWalletFunded, expectCommonHeaders, expectErrorResponse, expectRequestBody, expectRequestPath, expectSuccessTransactionResponse, expectSuccessWalletResponse, extractFetchCall, fundWallet, fundWalletAndWait, isErrorResponse, isSuccessTransactionResponse, isSuccessWalletResponse, isValidEthereumAddress, isValidSolanaAddress, sendTokenAndApprove, testCommonHttpErrors, testHttpErrorResponse, testInvalidJsonResponse, testMalformedResponse, testNetworkError, testTimeoutError, validateRequest };
|