@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/dist/chunk-FHMKNG62.js
DELETED
|
@@ -1,741 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NonCustodialSigner
|
|
3
|
-
} from "./chunk-U3NV7UY7.js";
|
|
4
|
-
import {
|
|
5
|
-
validateChainForEnvironment
|
|
6
|
-
} from "./chunk-2WBSPOWU.js";
|
|
7
|
-
import {
|
|
8
|
-
InvalidSignerError,
|
|
9
|
-
SignatureFailedError,
|
|
10
|
-
SignatureNotAvailableError,
|
|
11
|
-
SigningFailedError,
|
|
12
|
-
TransactionAwaitingApprovalError,
|
|
13
|
-
TransactionConfirmationTimeoutError,
|
|
14
|
-
TransactionFailedError,
|
|
15
|
-
TransactionHashNotFoundError,
|
|
16
|
-
TransactionNotAvailableError,
|
|
17
|
-
TransactionNotCreatedError,
|
|
18
|
-
TransactionSendingFailedError,
|
|
19
|
-
WalletNotAvailableError,
|
|
20
|
-
WalletTypeNotSupportedError
|
|
21
|
-
} from "./chunk-SGINWAB6.js";
|
|
22
|
-
import {
|
|
23
|
-
walletsLogger
|
|
24
|
-
} from "./chunk-ABMZ3ZVN.js";
|
|
25
|
-
import {
|
|
26
|
-
STATUS_POLLING_INTERVAL_MS
|
|
27
|
-
} from "./chunk-TYQ4YIP7.js";
|
|
28
|
-
import {
|
|
29
|
-
__async,
|
|
30
|
-
__decorateClass,
|
|
31
|
-
__privateAdd,
|
|
32
|
-
__privateGet,
|
|
33
|
-
__privateSet,
|
|
34
|
-
__spreadProps,
|
|
35
|
-
__spreadValues
|
|
36
|
-
} from "./chunk-ASE2FXWP.js";
|
|
37
|
-
|
|
38
|
-
// src/wallets/wallet.ts
|
|
39
|
-
import { isValidAddress, WithLoggerContext } from "@crossmint/common-sdk-base";
|
|
40
|
-
var _options, _apiClient;
|
|
41
|
-
var Wallet = class {
|
|
42
|
-
constructor(args, apiClient) {
|
|
43
|
-
__privateAdd(this, _options);
|
|
44
|
-
__privateAdd(this, _apiClient);
|
|
45
|
-
const { chain, address, owner, signer, options, alias } = args;
|
|
46
|
-
__privateSet(this, _apiClient, apiClient);
|
|
47
|
-
this.chain = chain;
|
|
48
|
-
this.address = address;
|
|
49
|
-
this.owner = owner;
|
|
50
|
-
this.signer = signer;
|
|
51
|
-
__privateSet(this, _options, options);
|
|
52
|
-
this.alias = alias;
|
|
53
|
-
}
|
|
54
|
-
static getApiClient(wallet) {
|
|
55
|
-
return wallet.apiClient;
|
|
56
|
-
}
|
|
57
|
-
static getOptions(wallet) {
|
|
58
|
-
return wallet.options;
|
|
59
|
-
}
|
|
60
|
-
get apiClient() {
|
|
61
|
-
return __privateGet(this, _apiClient);
|
|
62
|
-
}
|
|
63
|
-
get options() {
|
|
64
|
-
return __privateGet(this, _options);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Get the API client
|
|
68
|
-
* @returns The API client
|
|
69
|
-
* @experimental This API is experimental and may change in the future
|
|
70
|
-
*/
|
|
71
|
-
experimental_apiClient() {
|
|
72
|
-
return __privateGet(this, _apiClient);
|
|
73
|
-
}
|
|
74
|
-
balances(tokens) {
|
|
75
|
-
return __async(this, null, function* () {
|
|
76
|
-
walletsLogger.info("wallet.balances.start");
|
|
77
|
-
const resolvedChain = this.resolveChainForEnvironment();
|
|
78
|
-
let nativeToken;
|
|
79
|
-
switch (this.chain) {
|
|
80
|
-
case "solana":
|
|
81
|
-
nativeToken = "sol";
|
|
82
|
-
break;
|
|
83
|
-
case "stellar":
|
|
84
|
-
nativeToken = "xlm";
|
|
85
|
-
break;
|
|
86
|
-
default:
|
|
87
|
-
nativeToken = "eth";
|
|
88
|
-
break;
|
|
89
|
-
}
|
|
90
|
-
const allTokens = [nativeToken, "usdc", ...tokens != null ? tokens : []];
|
|
91
|
-
const response = yield __privateGet(this, _apiClient).getBalance(this.address, {
|
|
92
|
-
chains: [resolvedChain],
|
|
93
|
-
tokens: allTokens
|
|
94
|
-
});
|
|
95
|
-
if ("error" in response) {
|
|
96
|
-
walletsLogger.error("wallet.balances.error", { error: response });
|
|
97
|
-
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
98
|
-
}
|
|
99
|
-
walletsLogger.info("wallet.balances.success");
|
|
100
|
-
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
stagingFund(amount, chain) {
|
|
104
|
-
return __async(this, null, function* () {
|
|
105
|
-
walletsLogger.info("wallet.stagingFund.start", {
|
|
106
|
-
amount,
|
|
107
|
-
chain: chain != null ? chain : this.chain
|
|
108
|
-
});
|
|
109
|
-
const response = yield this.apiClient.fundWallet(this.address, {
|
|
110
|
-
amount,
|
|
111
|
-
token: "usdxm",
|
|
112
|
-
// Type casting is necessary here due to a type mismatch between our DTO schema and server-side types
|
|
113
|
-
// (which only contains 10 testnet chains. Variable in main server is called EvmUsdcEnabledTestnetChains for reference).
|
|
114
|
-
chain: chain != null ? chain : this.chain
|
|
115
|
-
});
|
|
116
|
-
if ("error" in response) {
|
|
117
|
-
walletsLogger.error("wallet.stagingFund.error", {
|
|
118
|
-
error: response
|
|
119
|
-
});
|
|
120
|
-
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
121
|
-
}
|
|
122
|
-
walletsLogger.info("wallet.stagingFund.success");
|
|
123
|
-
return response;
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Transform the API balance response to the new structure
|
|
128
|
-
* @private
|
|
129
|
-
*/
|
|
130
|
-
transformBalanceResponse(apiResponse, nativeTokenSymbol, requestedTokens) {
|
|
131
|
-
const transformTokenBalance = (tokenData) => {
|
|
132
|
-
var _a, _b, _c, _d, _e;
|
|
133
|
-
const chainData = (_a = tokenData.chains) == null ? void 0 : _a[this.chain];
|
|
134
|
-
let chainSpecificField = {};
|
|
135
|
-
if (this.chain === "solana" && chainData != null && "mintHash" in chainData) {
|
|
136
|
-
chainSpecificField = { mintHash: chainData.mintHash };
|
|
137
|
-
} else if (this.chain === "stellar" && chainData != null && "contractId" in chainData) {
|
|
138
|
-
chainSpecificField = { contractId: chainData.contractId };
|
|
139
|
-
} else if (chainData != null && "contractAddress" in chainData) {
|
|
140
|
-
chainSpecificField = {
|
|
141
|
-
contractAddress: chainData.contractAddress
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
return __spreadValues({
|
|
145
|
-
symbol: (_b = tokenData.symbol) != null ? _b : "",
|
|
146
|
-
name: (_c = tokenData.name) != null ? _c : "",
|
|
147
|
-
amount: (_d = tokenData.amount) != null ? _d : "0",
|
|
148
|
-
decimals: tokenData.decimals,
|
|
149
|
-
rawAmount: (_e = tokenData.rawAmount) != null ? _e : "0"
|
|
150
|
-
}, chainSpecificField);
|
|
151
|
-
};
|
|
152
|
-
const nativeTokenData = apiResponse.find((token) => token.symbol === nativeTokenSymbol);
|
|
153
|
-
const usdcData = apiResponse.find((token) => token.symbol === "usdc");
|
|
154
|
-
const otherTokens = apiResponse.filter((token) => {
|
|
155
|
-
return token.symbol !== nativeTokenSymbol && token.symbol !== "usdc";
|
|
156
|
-
});
|
|
157
|
-
const createDefaultToken = (symbol) => {
|
|
158
|
-
const baseToken = {
|
|
159
|
-
symbol,
|
|
160
|
-
name: symbol,
|
|
161
|
-
amount: "0",
|
|
162
|
-
decimals: 0,
|
|
163
|
-
rawAmount: "0"
|
|
164
|
-
};
|
|
165
|
-
let chainSpecificField = {};
|
|
166
|
-
if (this.chain === "solana") {
|
|
167
|
-
chainSpecificField = { mintHash: void 0 };
|
|
168
|
-
} else if (this.chain === "stellar") {
|
|
169
|
-
chainSpecificField = { contractId: void 0 };
|
|
170
|
-
} else {
|
|
171
|
-
chainSpecificField = { contractAddress: void 0 };
|
|
172
|
-
}
|
|
173
|
-
return __spreadValues(__spreadValues({}, baseToken), chainSpecificField);
|
|
174
|
-
};
|
|
175
|
-
return {
|
|
176
|
-
nativeToken: nativeTokenData != null ? transformTokenBalance(nativeTokenData) : createDefaultToken(nativeTokenSymbol),
|
|
177
|
-
usdc: usdcData != null ? transformTokenBalance(usdcData) : createDefaultToken("usdc"),
|
|
178
|
-
tokens: otherTokens.map(transformTokenBalance)
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Get the wallet NFTs
|
|
183
|
-
* @param {Object} params - The parameters
|
|
184
|
-
* @param {number} params.perPage - The number of NFTs per page
|
|
185
|
-
* @param {number} params.page - The page number
|
|
186
|
-
* @param {WalletLocator} [params.locator] - The locator
|
|
187
|
-
* @returns The NFTs
|
|
188
|
-
* @experimental This API is experimental and may change in the future
|
|
189
|
-
*/
|
|
190
|
-
experimental_nfts(params) {
|
|
191
|
-
return __async(this, null, function* () {
|
|
192
|
-
return yield __privateGet(this, _apiClient).experimental_getNfts(__spreadProps(__spreadValues({}, params), {
|
|
193
|
-
chain: this.chain,
|
|
194
|
-
address: this.address
|
|
195
|
-
}));
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Get the wallet transactions
|
|
200
|
-
* @returns The transactions
|
|
201
|
-
* @throws {Error} If the transactions cannot be retrieved
|
|
202
|
-
*/
|
|
203
|
-
experimental_transactions() {
|
|
204
|
-
return __async(this, null, function* () {
|
|
205
|
-
const response = yield __privateGet(this, _apiClient).getTransactions(this.walletLocator);
|
|
206
|
-
if ("error" in response) {
|
|
207
|
-
throw new Error(`Failed to get transactions: ${JSON.stringify(response.message)}`);
|
|
208
|
-
}
|
|
209
|
-
return response;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Get a transaction by id
|
|
214
|
-
* @returns The transaction
|
|
215
|
-
* @throws {Error} If the transaction cannot be retrieved
|
|
216
|
-
*/
|
|
217
|
-
experimental_transaction(transactionId) {
|
|
218
|
-
return __async(this, null, function* () {
|
|
219
|
-
const response = yield __privateGet(this, _apiClient).getTransaction(this.walletLocator, transactionId);
|
|
220
|
-
if ("error" in response) {
|
|
221
|
-
throw new Error(`Failed to get transaction: ${JSON.stringify(response.error)}`);
|
|
222
|
-
}
|
|
223
|
-
return response;
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Get the wallet activity
|
|
228
|
-
* @returns The activity
|
|
229
|
-
* @experimental This API is experimental and may change in the future
|
|
230
|
-
* @throws {Error} If the activity cannot be retrieved
|
|
231
|
-
*/
|
|
232
|
-
experimental_activity() {
|
|
233
|
-
return __async(this, null, function* () {
|
|
234
|
-
const resolvedChain = this.resolveChainForEnvironment();
|
|
235
|
-
const response = yield this.apiClient.experimental_activity(this.walletLocator, { chain: resolvedChain });
|
|
236
|
-
if ("error" in response) {
|
|
237
|
-
throw new Error(`Failed to get activity: ${JSON.stringify(response.message)}`);
|
|
238
|
-
}
|
|
239
|
-
return response;
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
send(to, token, amount, options) {
|
|
243
|
-
return __async(this, null, function* () {
|
|
244
|
-
const resolvedChain = this.resolveChainForEnvironment();
|
|
245
|
-
const recipient = toRecipientLocator(to);
|
|
246
|
-
const tokenLocator = toTokenLocator(token, resolvedChain);
|
|
247
|
-
walletsLogger.info("wallet.send.start", __spreadValues({
|
|
248
|
-
recipient,
|
|
249
|
-
token: tokenLocator,
|
|
250
|
-
amount
|
|
251
|
-
}, (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {}));
|
|
252
|
-
yield this.preAuthIfNeeded();
|
|
253
|
-
const sendParams = __spreadValues(__spreadValues({
|
|
254
|
-
recipient,
|
|
255
|
-
amount
|
|
256
|
-
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
257
|
-
const transactionCreationResponse = yield __privateGet(this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
258
|
-
if ("message" in transactionCreationResponse) {
|
|
259
|
-
walletsLogger.error("wallet.send.error", {
|
|
260
|
-
error: transactionCreationResponse
|
|
261
|
-
});
|
|
262
|
-
throw new TransactionNotCreatedError(
|
|
263
|
-
`Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
267
|
-
walletsLogger.info("wallet.send.prepared", {
|
|
268
|
-
transactionId: transactionCreationResponse.id
|
|
269
|
-
});
|
|
270
|
-
return {
|
|
271
|
-
hash: void 0,
|
|
272
|
-
explorerLink: void 0,
|
|
273
|
-
transactionId: transactionCreationResponse.id
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
277
|
-
walletsLogger.info("wallet.send.success", {
|
|
278
|
-
transactionId: transactionCreationResponse.id,
|
|
279
|
-
hash: result.hash
|
|
280
|
-
});
|
|
281
|
-
return result;
|
|
282
|
-
});
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* @deprecated Use `approve` instead.
|
|
286
|
-
* Approve a transaction
|
|
287
|
-
* @param params - The parameters
|
|
288
|
-
* @param params.transactionId - The transaction id
|
|
289
|
-
* @param params.options - The options for the transaction
|
|
290
|
-
* @param params.options.experimental_approval - The approval
|
|
291
|
-
* @param params.options.additionalSigners - The additional signers
|
|
292
|
-
* @returns The transaction
|
|
293
|
-
*/
|
|
294
|
-
// TODO: Remove this method in the next major version
|
|
295
|
-
approveTransaction(params) {
|
|
296
|
-
return __async(this, null, function* () {
|
|
297
|
-
console.warn(
|
|
298
|
-
"approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."
|
|
299
|
-
);
|
|
300
|
-
return yield this.approve(params);
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
approve(params) {
|
|
304
|
-
return __async(this, null, function* () {
|
|
305
|
-
walletsLogger.info("wallet.approve.start", {
|
|
306
|
-
transactionId: params.transactionId,
|
|
307
|
-
signatureId: params.signatureId
|
|
308
|
-
});
|
|
309
|
-
if (params.transactionId != null) {
|
|
310
|
-
const result = yield this.approveTransactionAndWait(
|
|
311
|
-
params.transactionId,
|
|
312
|
-
params.options
|
|
313
|
-
);
|
|
314
|
-
walletsLogger.info("wallet.approve.success", {
|
|
315
|
-
transactionId: params.transactionId
|
|
316
|
-
});
|
|
317
|
-
return result;
|
|
318
|
-
}
|
|
319
|
-
if (params.signatureId != null) {
|
|
320
|
-
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
321
|
-
walletsLogger.info("wallet.approve.success", {
|
|
322
|
-
signatureId: params.signatureId
|
|
323
|
-
});
|
|
324
|
-
return result;
|
|
325
|
-
}
|
|
326
|
-
walletsLogger.error("wallet.approve.error", {
|
|
327
|
-
error: "Either transactionId or signatureId must be provided"
|
|
328
|
-
});
|
|
329
|
-
throw new Error("Either transactionId or signatureId must be provided");
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
addDelegatedSigner(params) {
|
|
333
|
-
return __async(this, null, function* () {
|
|
334
|
-
var _a, _b, _c;
|
|
335
|
-
walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
336
|
-
const response = yield __privateGet(this, _apiClient).registerSigner(this.walletLocator, {
|
|
337
|
-
signer: params.signer,
|
|
338
|
-
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
339
|
-
});
|
|
340
|
-
if ("error" in response) {
|
|
341
|
-
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
342
|
-
error: response
|
|
343
|
-
});
|
|
344
|
-
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
345
|
-
}
|
|
346
|
-
if (this.chain === "solana" || this.chain === "stellar") {
|
|
347
|
-
if (!("transaction" in response) || response.transaction == null) {
|
|
348
|
-
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
349
|
-
error: "Expected transaction in response for Solana/Stellar chain"
|
|
350
|
-
});
|
|
351
|
-
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
352
|
-
}
|
|
353
|
-
const transactionId = response.transaction.id;
|
|
354
|
-
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
355
|
-
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
356
|
-
transactionId
|
|
357
|
-
});
|
|
358
|
-
return { transactionId };
|
|
359
|
-
}
|
|
360
|
-
yield this.approveTransactionAndWait(transactionId);
|
|
361
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
362
|
-
transactionId
|
|
363
|
-
});
|
|
364
|
-
return void 0;
|
|
365
|
-
}
|
|
366
|
-
if (!("chains" in response)) {
|
|
367
|
-
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
368
|
-
error: "Expected chains in response for EVM chain"
|
|
369
|
-
});
|
|
370
|
-
throw new Error("Expected chains in response for EVM chain");
|
|
371
|
-
}
|
|
372
|
-
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
373
|
-
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
374
|
-
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
375
|
-
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
376
|
-
signatureId
|
|
377
|
-
});
|
|
378
|
-
return { signatureId };
|
|
379
|
-
}
|
|
380
|
-
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
381
|
-
yield this.approveSignatureAndWait(chainResponse.id);
|
|
382
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
383
|
-
signatureId: chainResponse.id
|
|
384
|
-
});
|
|
385
|
-
return void 0;
|
|
386
|
-
}
|
|
387
|
-
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
388
|
-
yield this.waitForSignature(chainResponse.id);
|
|
389
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
390
|
-
signatureId: chainResponse.id
|
|
391
|
-
});
|
|
392
|
-
return void 0;
|
|
393
|
-
}
|
|
394
|
-
walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
395
|
-
return void 0;
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
delegatedSigners() {
|
|
399
|
-
return __async(this, null, function* () {
|
|
400
|
-
var _a, _b, _c;
|
|
401
|
-
walletsLogger.info("wallet.delegatedSigners.start");
|
|
402
|
-
const walletResponse = yield __privateGet(this, _apiClient).getWallet(this.walletLocator);
|
|
403
|
-
if ("error" in walletResponse) {
|
|
404
|
-
walletsLogger.error("wallet.delegatedSigners.error", {
|
|
405
|
-
error: walletResponse
|
|
406
|
-
});
|
|
407
|
-
throw new WalletNotAvailableError(JSON.stringify(walletResponse));
|
|
408
|
-
}
|
|
409
|
-
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
410
|
-
walletsLogger.error("wallet.delegatedSigners.error", {
|
|
411
|
-
error: `Wallet type ${walletResponse.type} not supported`
|
|
412
|
-
});
|
|
413
|
-
throw new WalletTypeNotSupportedError(`Wallet type ${walletResponse.type} not supported`);
|
|
414
|
-
}
|
|
415
|
-
const signers = (_c = (_b = (_a = walletResponse == null ? void 0 : walletResponse.config) == null ? void 0 : _a.delegatedSigners) == null ? void 0 : _b.map((signer) => {
|
|
416
|
-
const colonIndex = signer.locator.indexOf(":");
|
|
417
|
-
const address = colonIndex >= 0 ? signer.locator.slice(colonIndex + 1) : signer.locator;
|
|
418
|
-
return {
|
|
419
|
-
signer: `external-wallet:${address}`
|
|
420
|
-
};
|
|
421
|
-
})) != null ? _c : [];
|
|
422
|
-
walletsLogger.info("wallet.delegatedSigners.success", {
|
|
423
|
-
count: signers.length
|
|
424
|
-
});
|
|
425
|
-
return signers;
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
get walletLocator() {
|
|
429
|
-
if (__privateGet(this, _apiClient).isServerSide) {
|
|
430
|
-
return this.address;
|
|
431
|
-
} else {
|
|
432
|
-
let baseLocator;
|
|
433
|
-
switch (this.chain) {
|
|
434
|
-
case "stellar":
|
|
435
|
-
baseLocator = `me:stellar:smart`;
|
|
436
|
-
break;
|
|
437
|
-
case "solana":
|
|
438
|
-
baseLocator = `me:solana:smart`;
|
|
439
|
-
break;
|
|
440
|
-
default:
|
|
441
|
-
baseLocator = `me:evm:smart`;
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
const aliasLocatorPart = this.alias != null ? `:alias:${this.alias}` : "";
|
|
445
|
-
return baseLocator + aliasLocatorPart;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
preAuthIfNeeded() {
|
|
449
|
-
return __async(this, null, function* () {
|
|
450
|
-
if (this.signer instanceof NonCustodialSigner) {
|
|
451
|
-
yield this.signer.ensureAuthenticated();
|
|
452
|
-
}
|
|
453
|
-
});
|
|
454
|
-
}
|
|
455
|
-
get isSolanaWallet() {
|
|
456
|
-
return this.chain === "solana";
|
|
457
|
-
}
|
|
458
|
-
resolveChainForEnvironment() {
|
|
459
|
-
const resolvedChain = validateChainForEnvironment(this.chain, __privateGet(this, _apiClient).environment);
|
|
460
|
-
if (resolvedChain !== this.chain) {
|
|
461
|
-
this.chain = resolvedChain;
|
|
462
|
-
}
|
|
463
|
-
return this.chain;
|
|
464
|
-
}
|
|
465
|
-
approveTransactionAndWait(transactionId, options) {
|
|
466
|
-
return __async(this, null, function* () {
|
|
467
|
-
yield this.approveTransactionInternal(transactionId, options);
|
|
468
|
-
yield this.sleep(1e3);
|
|
469
|
-
return yield this.waitForTransaction(transactionId);
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
approveSignatureAndWait(signatureId, options) {
|
|
473
|
-
return __async(this, null, function* () {
|
|
474
|
-
const signatureResponse = yield this.approveSignatureInternal(signatureId, options);
|
|
475
|
-
if (!("error" in signatureResponse) && signatureResponse.status === "success" && signatureResponse.outputSignature != null) {
|
|
476
|
-
return {
|
|
477
|
-
signature: signatureResponse.outputSignature,
|
|
478
|
-
signatureId
|
|
479
|
-
};
|
|
480
|
-
}
|
|
481
|
-
yield this.sleep(1e3);
|
|
482
|
-
return yield this.waitForSignature(signatureId);
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
approveSignatureInternal(signatureId, options) {
|
|
486
|
-
return __async(this, null, function* () {
|
|
487
|
-
var _a, _b;
|
|
488
|
-
if (this.isSolanaWallet) {
|
|
489
|
-
throw new Error("Approving signatures is only supported for EVM smart wallets");
|
|
490
|
-
}
|
|
491
|
-
const signature = yield __privateGet(this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
492
|
-
if ("error" in signature) {
|
|
493
|
-
throw new SignatureNotAvailableError(JSON.stringify(signature));
|
|
494
|
-
}
|
|
495
|
-
if (this.signer.type === "api-key") {
|
|
496
|
-
return signature;
|
|
497
|
-
}
|
|
498
|
-
if ((options == null ? void 0 : options.experimental_approval) != null) {
|
|
499
|
-
const approvals2 = [options.experimental_approval];
|
|
500
|
-
return yield this.executeApproveSignatureWithErrorHandling(signatureId, approvals2);
|
|
501
|
-
}
|
|
502
|
-
const pendingApprovals = (_a = signature.approvals) == null ? void 0 : _a.pending;
|
|
503
|
-
if (pendingApprovals == null) {
|
|
504
|
-
return signature;
|
|
505
|
-
}
|
|
506
|
-
const signers = [...(_b = options == null ? void 0 : options.additionalSigners) != null ? _b : [], this.signer];
|
|
507
|
-
const approvals = yield Promise.all(
|
|
508
|
-
pendingApprovals.map((pendingApproval) => __async(this, null, function* () {
|
|
509
|
-
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
510
|
-
if (signer == null) {
|
|
511
|
-
throw new InvalidSignerError(`Signer ${pendingApproval.signer} not found in pending approvals`);
|
|
512
|
-
}
|
|
513
|
-
const signature2 = yield signer.signMessage(pendingApproval.message);
|
|
514
|
-
return __spreadProps(__spreadValues({}, signature2), {
|
|
515
|
-
signer: signer.locator()
|
|
516
|
-
});
|
|
517
|
-
}))
|
|
518
|
-
);
|
|
519
|
-
return yield this.executeApproveSignatureWithErrorHandling(signatureId, approvals);
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
approveTransactionInternal(transactionId, options) {
|
|
523
|
-
return __async(this, null, function* () {
|
|
524
|
-
var _a, _b, _c, _d, _e;
|
|
525
|
-
const transaction = yield __privateGet(this, _apiClient).getTransaction(this.walletLocator, transactionId);
|
|
526
|
-
if ("error" in transaction) {
|
|
527
|
-
throw new TransactionNotAvailableError(JSON.stringify(transaction));
|
|
528
|
-
}
|
|
529
|
-
yield (_c = (_b = (_a = __privateGet(this, _options)) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onTransactionStart) == null ? void 0 : _c.call(_b);
|
|
530
|
-
if (this.signer.type === "api-key") {
|
|
531
|
-
return transaction;
|
|
532
|
-
}
|
|
533
|
-
if ((options == null ? void 0 : options.experimental_approval) != null) {
|
|
534
|
-
const approvals2 = [options.experimental_approval];
|
|
535
|
-
return yield this.executeApproveTransactionWithErrorHandling(transactionId, approvals2);
|
|
536
|
-
}
|
|
537
|
-
const pendingApprovals = (_d = transaction.approvals) == null ? void 0 : _d.pending;
|
|
538
|
-
if (pendingApprovals == null) {
|
|
539
|
-
return transaction;
|
|
540
|
-
}
|
|
541
|
-
const signers = [...(_e = options == null ? void 0 : options.additionalSigners) != null ? _e : [], this.signer];
|
|
542
|
-
const approvals = yield Promise.all(
|
|
543
|
-
pendingApprovals.map((pendingApproval) => __async(this, null, function* () {
|
|
544
|
-
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
545
|
-
if (signer == null) {
|
|
546
|
-
throw new InvalidSignerError(`Signer ${pendingApproval.signer} not found in pending approvals`);
|
|
547
|
-
}
|
|
548
|
-
const transactionToSign = transaction.chainType === "solana" && "transaction" in transaction.onChain ? transaction.onChain.transaction : pendingApproval.message;
|
|
549
|
-
const signature = yield signer.signTransaction(transactionToSign);
|
|
550
|
-
return __spreadProps(__spreadValues({}, signature), {
|
|
551
|
-
signer: signer.locator()
|
|
552
|
-
});
|
|
553
|
-
}))
|
|
554
|
-
);
|
|
555
|
-
return yield this.executeApproveTransactionWithErrorHandling(transactionId, approvals);
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
executeApproveTransactionWithErrorHandling(transactionId, approvals) {
|
|
559
|
-
return __async(this, null, function* () {
|
|
560
|
-
walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
|
|
561
|
-
const approvedTransaction = yield __privateGet(this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
|
|
562
|
-
approvals
|
|
563
|
-
});
|
|
564
|
-
if (approvedTransaction.error) {
|
|
565
|
-
throw new TransactionFailedError(JSON.stringify(approvedTransaction));
|
|
566
|
-
}
|
|
567
|
-
return approvedTransaction;
|
|
568
|
-
});
|
|
569
|
-
}
|
|
570
|
-
executeApproveSignatureWithErrorHandling(signatureId, approvals) {
|
|
571
|
-
return __async(this, null, function* () {
|
|
572
|
-
const approvedSignature = yield __privateGet(this, _apiClient).approveSignature(this.walletLocator, signatureId, {
|
|
573
|
-
approvals
|
|
574
|
-
});
|
|
575
|
-
if (approvedSignature.error) {
|
|
576
|
-
throw new SignatureFailedError(JSON.stringify(approvedSignature));
|
|
577
|
-
}
|
|
578
|
-
return approvedSignature;
|
|
579
|
-
});
|
|
580
|
-
}
|
|
581
|
-
waitForSignature(signatureId) {
|
|
582
|
-
return __async(this, null, function* () {
|
|
583
|
-
let signatureResponse = null;
|
|
584
|
-
do {
|
|
585
|
-
yield new Promise((resolve) => setTimeout(resolve, STATUS_POLLING_INTERVAL_MS));
|
|
586
|
-
signatureResponse = yield __privateGet(this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
587
|
-
if ("error" in signatureResponse) {
|
|
588
|
-
throw new SignatureNotAvailableError(JSON.stringify(signatureResponse));
|
|
589
|
-
}
|
|
590
|
-
} while (signatureResponse === null || signatureResponse.status === "pending");
|
|
591
|
-
if (signatureResponse.status === "failed") {
|
|
592
|
-
throw new SigningFailedError("Signature signing failed");
|
|
593
|
-
}
|
|
594
|
-
if (!signatureResponse.outputSignature) {
|
|
595
|
-
throw new SignatureNotAvailableError("Signature not available");
|
|
596
|
-
}
|
|
597
|
-
return {
|
|
598
|
-
signature: signatureResponse.outputSignature,
|
|
599
|
-
signatureId
|
|
600
|
-
};
|
|
601
|
-
});
|
|
602
|
-
}
|
|
603
|
-
waitForTransaction(_0) {
|
|
604
|
-
return __async(this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
605
|
-
backoffMultiplier = 1.1,
|
|
606
|
-
maxBackoffMs = 2e3,
|
|
607
|
-
initialBackoffMs = STATUS_POLLING_INTERVAL_MS
|
|
608
|
-
} = {}) {
|
|
609
|
-
var _a;
|
|
610
|
-
walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
|
|
611
|
-
const startTime = Date.now();
|
|
612
|
-
let transactionResponse;
|
|
613
|
-
do {
|
|
614
|
-
if (Date.now() - startTime > timeoutMs) {
|
|
615
|
-
const error = new TransactionConfirmationTimeoutError("Transaction confirmation timeout");
|
|
616
|
-
throw error;
|
|
617
|
-
}
|
|
618
|
-
transactionResponse = yield __privateGet(this, _apiClient).getTransaction(this.walletLocator, transactionId);
|
|
619
|
-
if (transactionResponse.error) {
|
|
620
|
-
throw new TransactionNotAvailableError(JSON.stringify(transactionResponse));
|
|
621
|
-
}
|
|
622
|
-
yield this.sleep(initialBackoffMs);
|
|
623
|
-
initialBackoffMs = Math.min(initialBackoffMs * backoffMultiplier, maxBackoffMs);
|
|
624
|
-
} while (transactionResponse.status === "pending");
|
|
625
|
-
if (transactionResponse.status === "failed") {
|
|
626
|
-
const error = new TransactionSendingFailedError(
|
|
627
|
-
`Transaction sending failed: ${JSON.stringify(transactionResponse.error)}`
|
|
628
|
-
);
|
|
629
|
-
throw error;
|
|
630
|
-
}
|
|
631
|
-
if (transactionResponse.status === "awaiting-approval") {
|
|
632
|
-
const error = new TransactionAwaitingApprovalError(
|
|
633
|
-
`Transaction is awaiting approval. Please submit required approvals before waiting for completion.`
|
|
634
|
-
);
|
|
635
|
-
throw error;
|
|
636
|
-
}
|
|
637
|
-
const transactionHash = transactionResponse.onChain.txId;
|
|
638
|
-
if (transactionHash == null) {
|
|
639
|
-
const error = new TransactionHashNotFoundError("Transaction hash not found on transaction response");
|
|
640
|
-
throw error;
|
|
641
|
-
}
|
|
642
|
-
return {
|
|
643
|
-
hash: transactionHash,
|
|
644
|
-
explorerLink: (_a = transactionResponse.onChain.explorerLink) != null ? _a : "",
|
|
645
|
-
transactionId: transactionResponse.id
|
|
646
|
-
};
|
|
647
|
-
});
|
|
648
|
-
}
|
|
649
|
-
sleep(ms) {
|
|
650
|
-
return __async(this, null, function* () {
|
|
651
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
652
|
-
});
|
|
653
|
-
}
|
|
654
|
-
};
|
|
655
|
-
_options = new WeakMap();
|
|
656
|
-
_apiClient = new WeakMap();
|
|
657
|
-
__decorateClass([
|
|
658
|
-
WithLoggerContext({
|
|
659
|
-
logger: walletsLogger,
|
|
660
|
-
methodName: "wallet.balances",
|
|
661
|
-
buildContext(thisArg) {
|
|
662
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
663
|
-
}
|
|
664
|
-
})
|
|
665
|
-
], Wallet.prototype, "balances", 1);
|
|
666
|
-
__decorateClass([
|
|
667
|
-
WithLoggerContext({
|
|
668
|
-
logger: walletsLogger,
|
|
669
|
-
methodName: "wallet.stagingFund",
|
|
670
|
-
buildContext(thisArg) {
|
|
671
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
672
|
-
}
|
|
673
|
-
})
|
|
674
|
-
], Wallet.prototype, "stagingFund", 1);
|
|
675
|
-
__decorateClass([
|
|
676
|
-
WithLoggerContext({
|
|
677
|
-
logger: walletsLogger,
|
|
678
|
-
methodName: "wallet.send",
|
|
679
|
-
buildContext(thisArg) {
|
|
680
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
681
|
-
}
|
|
682
|
-
})
|
|
683
|
-
], Wallet.prototype, "send", 1);
|
|
684
|
-
__decorateClass([
|
|
685
|
-
WithLoggerContext({
|
|
686
|
-
logger: walletsLogger,
|
|
687
|
-
methodName: "wallet.approve",
|
|
688
|
-
buildContext(thisArg) {
|
|
689
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
690
|
-
}
|
|
691
|
-
})
|
|
692
|
-
], Wallet.prototype, "approve", 1);
|
|
693
|
-
__decorateClass([
|
|
694
|
-
WithLoggerContext({
|
|
695
|
-
logger: walletsLogger,
|
|
696
|
-
methodName: "wallet.addDelegatedSigner",
|
|
697
|
-
buildContext(thisArg) {
|
|
698
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
699
|
-
}
|
|
700
|
-
})
|
|
701
|
-
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
702
|
-
__decorateClass([
|
|
703
|
-
WithLoggerContext({
|
|
704
|
-
logger: walletsLogger,
|
|
705
|
-
methodName: "wallet.delegatedSigners",
|
|
706
|
-
buildContext(thisArg) {
|
|
707
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
708
|
-
}
|
|
709
|
-
})
|
|
710
|
-
], Wallet.prototype, "delegatedSigners", 1);
|
|
711
|
-
function toRecipientLocator(to) {
|
|
712
|
-
if (typeof to === "string") {
|
|
713
|
-
return to;
|
|
714
|
-
}
|
|
715
|
-
if ("email" in to) {
|
|
716
|
-
return `email:${to.email}`;
|
|
717
|
-
}
|
|
718
|
-
if ("x" in to) {
|
|
719
|
-
return `x:${to.x}`;
|
|
720
|
-
}
|
|
721
|
-
if ("twitter" in to) {
|
|
722
|
-
return `twitter:${to.twitter}`;
|
|
723
|
-
}
|
|
724
|
-
if ("phone" in to) {
|
|
725
|
-
return `phoneNumber:${to.phone}`;
|
|
726
|
-
}
|
|
727
|
-
if ("userId" in to) {
|
|
728
|
-
return `userId:${to.userId}`;
|
|
729
|
-
}
|
|
730
|
-
throw new Error("Invalid recipient locator");
|
|
731
|
-
}
|
|
732
|
-
function toTokenLocator(token, chain) {
|
|
733
|
-
if (isValidAddress(token)) {
|
|
734
|
-
return `${chain}:${token}`;
|
|
735
|
-
}
|
|
736
|
-
return `${chain}:${token.toLowerCase()}`;
|
|
737
|
-
}
|
|
738
|
-
|
|
739
|
-
export {
|
|
740
|
-
Wallet
|
|
741
|
-
};
|