@crossmint/wallets-sdk 1.0.0-beta.5 → 1.0.0-beta.7
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 +175 -49
- package/dist/api/__tests__/constants.d.cts +1 -1
- package/dist/api/__tests__/constants.d.ts +1 -1
- package/dist/api/__tests__/test-utils.cjs +1 -1
- package/dist/api/__tests__/test-utils.d.cts +1 -1
- package/dist/api/__tests__/test-utils.d.ts +1 -1
- package/dist/api/__tests__/test-utils.js +1 -1
- package/dist/api/client.cjs +1 -1
- package/dist/api/client.d.cts +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/index.cjs +1 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/types.d.cts +1 -1
- package/dist/api/types.d.ts +1 -1
- package/dist/chains/chains.cjs +1 -1
- package/dist/chains/chains.js +1 -1
- package/dist/chunk-2AKP3GZ7.js +3 -0
- package/dist/{chunk-HPRRBZOO.cjs → chunk-2UJBCUG2.cjs} +1 -1
- package/dist/{chunk-5AMNTK5L.js → chunk-2X65YHU4.js} +1 -1
- package/dist/{chunk-ZXOKPK5Y.cjs → chunk-2XOKOXIL.cjs} +1 -1
- package/dist/{chunk-HJMLB3CZ.cjs → chunk-3AJ7OWQE.cjs} +1 -1
- package/dist/{chunk-YYHIRIRF.js → chunk-5QKUXVP3.js} +1 -1
- package/dist/chunk-5Z6QHCTT.cjs +3 -0
- package/dist/{chunk-GN7GYBJA.cjs → chunk-7O3CV5HX.cjs} +1 -1
- package/dist/{chunk-3LIYGJ26.js → chunk-A4ENPOX6.js} +1 -1
- package/dist/{chunk-FSW2NPEJ.cjs → chunk-BP3WBO3W.cjs} +1 -1
- package/dist/{chunk-QPNYLHYO.cjs → chunk-CKZPF7KE.cjs} +1 -1
- package/dist/{chunk-Y22BJFQT.cjs → chunk-CV5GT7CP.cjs} +1 -1
- package/dist/{chunk-2G7S3WW3.js → chunk-D3CCPMC3.js} +1 -1
- package/dist/chunk-D6SLJ5C2.cjs +1 -0
- package/dist/{chunk-DRTL6SPT.js → chunk-FNWSI6UN.js} +1 -1
- package/dist/{chunk-YNQPYZGU.js → chunk-HQVHXT3U.js} +1 -1
- package/dist/chunk-J7C3SSSQ.js +1 -0
- package/dist/{chunk-EPJRLPAI.cjs → chunk-JJKL6FU2.cjs} +1 -1
- package/dist/{chunk-MXNC4GJQ.cjs → chunk-JMCNCVQN.cjs} +1 -1
- package/dist/{chunk-MCVOUQFZ.cjs → chunk-LECLHOLK.cjs} +1 -1
- package/dist/{chunk-65HJGWCL.js → chunk-LLQEZP55.js} +1 -1
- package/dist/{chunk-OYHK6BIR.js → chunk-MKKB6W5V.js} +1 -1
- package/dist/{chunk-QZ5WUDCX.js → chunk-MTKY5MIE.js} +1 -1
- package/dist/{chunk-JSE5PYVY.cjs → chunk-NR4PS5NF.cjs} +1 -1
- package/dist/{chunk-DWEJKOHG.js → chunk-OYPXGE5H.js} +1 -1
- package/dist/{chunk-I2PY7FD5.cjs → chunk-P3ZA2ACP.cjs} +1 -1
- package/dist/{chunk-V3PIHRNQ.cjs → chunk-RKMOWHVB.cjs} +1 -1
- package/dist/{chunk-AT4UIPAG.js → chunk-SAXV4RQK.js} +1 -1
- package/dist/{chunk-H7AD7AFJ.js → chunk-SG4NRUNV.js} +1 -1
- package/dist/{chunk-CW2GPBXZ.cjs → chunk-V5A3FGH2.cjs} +1 -1
- package/dist/chunk-VADIEIDS.js +1 -0
- package/dist/{chunk-6Z2HKIQA.cjs → chunk-VDT2DSTW.cjs} +1 -1
- package/dist/{chunk-XVNWOU37.js → chunk-Y2OIXWOS.js} +1 -1
- package/dist/{chunk-CV3WPOEA.js → chunk-Z5BYVIWY.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/logger/index.cjs +1 -1
- package/dist/logger/index.js +1 -1
- package/dist/logger/init.cjs +1 -1
- package/dist/logger/init.js +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.d.cts +1 -2
- package/dist/sdk.d.ts +1 -2
- package/dist/sdk.js +1 -1
- package/dist/signers/device.d.cts +1 -1
- package/dist/signers/device.d.ts +1 -1
- package/dist/signers/evm-api-key.d.cts +1 -1
- package/dist/signers/evm-api-key.d.ts +1 -1
- package/dist/signers/evm-external-wallet.d.cts +1 -1
- package/dist/signers/evm-external-wallet.d.ts +1 -1
- package/dist/signers/external-wallet-signer.d.cts +1 -1
- package/dist/signers/external-wallet-signer.d.ts +1 -1
- package/dist/signers/index.cjs +1 -1
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +1 -1
- package/dist/signers/non-custodial/index.cjs +1 -1
- package/dist/signers/non-custodial/index.d.cts +1 -1
- package/dist/signers/non-custodial/index.d.ts +1 -1
- package/dist/signers/non-custodial/index.js +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +1 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +1 -1
- package/dist/signers/passkey.d.cts +1 -1
- package/dist/signers/passkey.d.ts +1 -1
- package/dist/signers/server/assemble-server-signer.d.cts +1 -1
- package/dist/signers/server/assemble-server-signer.d.ts +1 -1
- package/dist/signers/server/evm-server-signer.d.cts +1 -1
- package/dist/signers/server/evm-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.cts +1 -1
- package/dist/signers/server/helpers/derive-server-signer.d.ts +1 -1
- package/dist/signers/server/helpers/index.d.cts +1 -1
- package/dist/signers/server/helpers/index.d.ts +1 -1
- package/dist/signers/server/index.d.cts +1 -1
- package/dist/signers/server/index.d.ts +1 -1
- package/dist/signers/server/solana-server-signer.d.cts +1 -1
- package/dist/signers/server/solana-server-signer.d.ts +1 -1
- package/dist/signers/server/stellar-server-signer.d.cts +1 -1
- package/dist/signers/server/stellar-server-signer.d.ts +1 -1
- package/dist/signers/solana-api-key.d.cts +1 -1
- package/dist/signers/solana-api-key.d.ts +1 -1
- package/dist/signers/solana-external-wallet.d.cts +1 -1
- package/dist/signers/solana-external-wallet.d.ts +1 -1
- package/dist/signers/stellar-external-wallet.d.cts +1 -1
- package/dist/signers/stellar-external-wallet.d.ts +1 -1
- package/dist/signers/types.d.cts +1 -1
- package/dist/signers/types.d.ts +1 -1
- package/dist/{types-DmDAqO_P.d.cts → types-DfT-EHk3.d.cts} +2 -1
- package/dist/{types-BTh6aKMQ.d.ts → types-vcGYTcL0.d.ts} +2 -1
- package/dist/utils/constants.cjs +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.cjs +1 -1
- package/dist/utils/device-signers/IframeDeviceSignerKeyStorage.js +1 -1
- package/dist/utils/device-signers/createDeviceSigner.d.cts +2 -2
- package/dist/utils/device-signers/createDeviceSigner.d.ts +2 -2
- package/dist/utils/device-signers/index.cjs +1 -1
- package/dist/utils/device-signers/index.d.cts +1 -1
- package/dist/utils/device-signers/index.d.ts +1 -1
- package/dist/utils/device-signers/index.js +1 -1
- package/dist/utils/signer-locator.d.cts +1 -1
- package/dist/utils/signer-locator.d.ts +1 -1
- package/dist/utils/signer-mapping.cjs +1 -1
- package/dist/utils/signer-mapping.d.cts +6 -2
- package/dist/utils/signer-mapping.d.ts +6 -2
- package/dist/utils/signer-mapping.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +1 -1
- package/dist/wallets/__tests__/test-helpers.d.cts +1 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +1 -1
- package/dist/wallets/__tests__/test-helpers.js +1 -1
- package/dist/wallets/evm.cjs +1 -1
- package/dist/wallets/evm.d.cts +1 -1
- package/dist/wallets/evm.d.ts +1 -1
- package/dist/wallets/evm.js +1 -1
- package/dist/wallets/solana.cjs +1 -1
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +1 -1
- package/dist/wallets/stellar.cjs +1 -1
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- package/dist/wallets/stellar.js +1 -1
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +1 -1
- package/dist/wallets/wallet-factory.d.cts +1 -1
- package/dist/wallets/wallet-factory.d.ts +1 -1
- package/dist/wallets/wallet-factory.js +1 -1
- package/dist/wallets/wallet.cjs +1 -1
- package/dist/wallets/wallet.d.cts +16 -9
- package/dist/wallets/wallet.d.ts +16 -9
- package/dist/wallets/wallet.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-34LCOL3F.js +0 -1
- package/dist/chunk-BTSOX4OO.js +0 -1
- package/dist/chunk-CA2NUPQP.js +0 -1
- package/dist/chunk-JGFVDY5U.cjs +0 -1
- package/dist/chunk-OXR3FJF4.cjs +0 -1
package/dist/wallets/stellar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkCKZPF7KEcjs = require('../chunk-CKZPF7KE.cjs');require('../chunk-5Z6QHCTT.cjs');require('../chunk-CUHDOBKN.cjs');require('../chunk-YHV3672R.cjs');require('../chunk-2XOKOXIL.cjs');require('../chunk-3VYGTPRF.cjs');require('../chunk-NX256LAH.cjs');require('../chunk-D6SLJ5C2.cjs');require('../chunk-NR4PS5NF.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-3VSFHDFH.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-LECLHOLK.cjs');require('../chunk-VDT2DSTW.cjs');require('../chunk-3AJ7OWQE.cjs');require('../chunk-P3ZA2ACP.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-5QIW67NU.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-6EZCCLTK.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-JMCNCVQN.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-V5A3FGH2.cjs');require('../chunk-CV5GT7CP.cjs');require('../chunk-2GKPWQBQ.cjs');exports.StellarWallet = _chunkCKZPF7KEcjs.a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StellarChain, Chain } from '../chains/chains.cjs';
|
|
2
|
-
import {
|
|
2
|
+
import { V as TransactionInputOptions, X as StellarTransactionInput, c as Transaction, O as PrepareOnly } from '../types-DfT-EHk3.cjs';
|
|
3
3
|
import { Wallet } from './wallet.cjs';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
5
|
import 'viem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StellarChain, Chain } from '../chains/chains.js';
|
|
2
|
-
import {
|
|
2
|
+
import { V as TransactionInputOptions, X as StellarTransactionInput, c as Transaction, O as PrepareOnly } from '../types-vcGYTcL0.js';
|
|
3
3
|
import { Wallet } from './wallet.js';
|
|
4
4
|
import '@crossmint/common-sdk-base';
|
|
5
5
|
import 'viem';
|
package/dist/wallets/stellar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-MKKB6W5V.js";import"../chunk-2AKP3GZ7.js";import"../chunk-TOAFCAVT.js";import"../chunk-N4IWDL6M.js";import"../chunk-MTKY5MIE.js";import"../chunk-IOSADDL5.js";import"../chunk-GOXB2RBF.js";import"../chunk-VADIEIDS.js";import"../chunk-LLQEZP55.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-RBSMBO4T.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-OYPXGE5H.js";import"../chunk-5QKUXVP3.js";import"../chunk-FNWSI6UN.js";import"../chunk-SG4NRUNV.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-WCGUGIGJ.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-W7LJS32A.js";import"../chunk-2YLRFJ66.js";import"../chunk-A4ENPOX6.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-2X65YHU4.js";import"../chunk-J7C3SSSQ.js";import"../chunk-J3R36SGJ.js";export{a as StellarWallet};
|
package/dist/wallets/types.d.cts
CHANGED
|
@@ -3,7 +3,7 @@ import '@crossmint/client-sdk-window';
|
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import 'abitype';
|
|
6
|
-
export {
|
|
6
|
+
export { k as AddSignerOptions, a2 as AddSignerReturnType, aH as Approval, j as ApproveOptions, A as ApproveParams, a1 as ApproveResult, B as Balances, e as Callbacks, C as ClientSideWalletArgsFor, a as ClientSideWalletCreateArgs, aF as DeviceSignerDescriptor, E as EVMTransactionInput, aB as FormattedEVMTransaction, aD as PendingApproval, O as PrepareOnly, $ as SendTokenTransactionOptions, az as SendTokenTransactionType, Q as SignMessageInput, U as SignTypedDataInput, h as Signature, aA as SignatureInputOptions, S as Signer, aC as SignerInput, b as SignerStatus, i as SolanaTransactionInput, X as StellarTransactionInput, aE as StellarWalletPlugin, aG as TokenBalance, c as Transaction, V as TransactionInputOptions, T as Transfers, a0 as UserLocator, W as WalletArgsFor, d as WalletCreateArgs, f as WalletOptions, g as WalletPlugin } from '../types-DfT-EHk3.cjs';
|
|
7
7
|
import '../chains/chains.cjs';
|
|
8
8
|
import '../utils/device-signers/DeviceSignerKeyStorage.cjs';
|
|
9
9
|
import '../api/gen/types.gen.cjs';
|
package/dist/wallets/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import '@crossmint/client-sdk-window';
|
|
|
3
3
|
import '@crossmint/client-signers';
|
|
4
4
|
import 'viem';
|
|
5
5
|
import 'abitype';
|
|
6
|
-
export {
|
|
6
|
+
export { k as AddSignerOptions, a2 as AddSignerReturnType, aH as Approval, j as ApproveOptions, A as ApproveParams, a1 as ApproveResult, B as Balances, e as Callbacks, C as ClientSideWalletArgsFor, a as ClientSideWalletCreateArgs, aF as DeviceSignerDescriptor, E as EVMTransactionInput, aB as FormattedEVMTransaction, aD as PendingApproval, O as PrepareOnly, $ as SendTokenTransactionOptions, az as SendTokenTransactionType, Q as SignMessageInput, U as SignTypedDataInput, h as Signature, aA as SignatureInputOptions, S as Signer, aC as SignerInput, b as SignerStatus, i as SolanaTransactionInput, X as StellarTransactionInput, aE as StellarWalletPlugin, aG as TokenBalance, c as Transaction, V as TransactionInputOptions, T as Transfers, a0 as UserLocator, W as WalletArgsFor, d as WalletCreateArgs, f as WalletOptions, g as WalletPlugin } from '../types-vcGYTcL0.js';
|
|
7
7
|
import '../chains/chains.js';
|
|
8
8
|
import '../utils/device-signers/DeviceSignerKeyStorage.js';
|
|
9
9
|
import '../api/gen/types.gen.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7O3CV5HXcjs = require('../chunk-7O3CV5HX.cjs');require('../chunk-K5TQ4QU3.cjs');require('../chunk-5Z6QHCTT.cjs');require('../chunk-CUHDOBKN.cjs');require('../chunk-YHV3672R.cjs');require('../chunk-2XOKOXIL.cjs');require('../chunk-3VYGTPRF.cjs');require('../chunk-NX256LAH.cjs');require('../chunk-D6SLJ5C2.cjs');require('../chunk-NR4PS5NF.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-3VSFHDFH.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-LECLHOLK.cjs');require('../chunk-VDT2DSTW.cjs');require('../chunk-3AJ7OWQE.cjs');require('../chunk-P3ZA2ACP.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-5QIW67NU.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-6EZCCLTK.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-JMCNCVQN.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-V5A3FGH2.cjs');require('../chunk-CV5GT7CP.cjs');require('../chunk-2GKPWQBQ.cjs');exports.WalletFactory = _chunk7O3CV5HXcjs.a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiClient } from '../api/client.cjs';
|
|
2
2
|
import { Chain } from '../chains/chains.cjs';
|
|
3
|
-
import { W as WalletArgsFor, d as WalletCreateArgs } from '../types-
|
|
3
|
+
import { W as WalletArgsFor, d as WalletCreateArgs } from '../types-DfT-EHk3.cjs';
|
|
4
4
|
import { Wallet } from './wallet.cjs';
|
|
5
5
|
import '@crossmint/common-sdk-base';
|
|
6
6
|
import 'viem';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiClient } from '../api/client.js';
|
|
2
2
|
import { Chain } from '../chains/chains.js';
|
|
3
|
-
import { W as WalletArgsFor, d as WalletCreateArgs } from '../types-
|
|
3
|
+
import { W as WalletArgsFor, d as WalletCreateArgs } from '../types-vcGYTcL0.js';
|
|
4
4
|
import { Wallet } from './wallet.js';
|
|
5
5
|
import '@crossmint/common-sdk-base';
|
|
6
6
|
import 'viem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-SAXV4RQK.js";import"../chunk-YIO5XXQ4.js";import"../chunk-2AKP3GZ7.js";import"../chunk-TOAFCAVT.js";import"../chunk-N4IWDL6M.js";import"../chunk-MTKY5MIE.js";import"../chunk-IOSADDL5.js";import"../chunk-GOXB2RBF.js";import"../chunk-VADIEIDS.js";import"../chunk-LLQEZP55.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-RBSMBO4T.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-OYPXGE5H.js";import"../chunk-5QKUXVP3.js";import"../chunk-FNWSI6UN.js";import"../chunk-SG4NRUNV.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-WCGUGIGJ.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-W7LJS32A.js";import"../chunk-2YLRFJ66.js";import"../chunk-A4ENPOX6.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-2X65YHU4.js";import"../chunk-J7C3SSSQ.js";import"../chunk-J3R36SGJ.js";export{a as WalletFactory};
|
package/dist/wallets/wallet.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5Z6QHCTTcjs = require('../chunk-5Z6QHCTT.cjs');require('../chunk-CUHDOBKN.cjs');require('../chunk-YHV3672R.cjs');require('../chunk-2XOKOXIL.cjs');require('../chunk-3VYGTPRF.cjs');require('../chunk-NX256LAH.cjs');require('../chunk-D6SLJ5C2.cjs');require('../chunk-NR4PS5NF.cjs');require('../chunk-5IC7UWND.cjs');require('../chunk-GZP2JQ6P.cjs');require('../chunk-IGRPHTXZ.cjs');require('../chunk-3VSFHDFH.cjs');require('../chunk-ENU3EKBG.cjs');require('../chunk-3SVXPFSP.cjs');require('../chunk-4DJWSV7I.cjs');require('../chunk-YF5G4U6L.cjs');require('../chunk-PO6S7UR3.cjs');require('../chunk-LECLHOLK.cjs');require('../chunk-VDT2DSTW.cjs');require('../chunk-3AJ7OWQE.cjs');require('../chunk-P3ZA2ACP.cjs');require('../chunk-JBP52JOH.cjs');require('../chunk-5FH7WFWL.cjs');require('../chunk-SPTXAOFR.cjs');require('../chunk-5QIW67NU.cjs');require('../chunk-YGL4ITFK.cjs');require('../chunk-GEY3BU62.cjs');require('../chunk-PHPBBEXU.cjs');require('../chunk-A33BEWR7.cjs');require('../chunk-OGP7B5O3.cjs');require('../chunk-IJ632UXD.cjs');require('../chunk-6EZCCLTK.cjs');require('../chunk-SCEPJO4Q.cjs');require('../chunk-JMCNCVQN.cjs');require('../chunk-GEY574TH.cjs');require('../chunk-UE3WVHTM.cjs');require('../chunk-5X4EOJFG.cjs');require('../chunk-HRUMWG2F.cjs');require('../chunk-IR5WN6FQ.cjs');require('../chunk-T3U46LK3.cjs');require('../chunk-CCIGWTAO.cjs');require('../chunk-V5A3FGH2.cjs');require('../chunk-CV5GT7CP.cjs');require('../chunk-2GKPWQBQ.cjs');exports.Wallet = _chunk5Z6QHCTTcjs.a;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.cjs';
|
|
2
2
|
import { ApiClient } from '../api/client.cjs';
|
|
3
|
-
import { f as WalletOptions,
|
|
3
|
+
import { f as WalletOptions, r as SignerConfigForChain, m as SignerAdapter, B as Balances, Y as FundWalletResponse, Z as GetTransactionsResponse, _ as GetTransactionSuccessResponse, T as Transfers, $ as SendTokenTransactionOptions, a0 as UserLocator, c as Transaction, O as PrepareOnly, A as ApproveParams, a1 as ApproveResult, k as AddSignerOptions, q as ServerSignerConfig, o as ExternalWalletRegistrationConfig, a2 as AddSignerReturnType, S as Signer, s as SignerLocator, a3 as WalletLocator, j as ApproveOptions, a4 as ApproveSignatureResponse, h as Signature } from '../types-DfT-EHk3.cjs';
|
|
4
4
|
import { Chain } from '../chains/chains.cjs';
|
|
5
5
|
import '@crossmint/common-sdk-base';
|
|
6
6
|
import 'viem';
|
|
@@ -86,10 +86,9 @@ declare class Wallet<C extends Chain> {
|
|
|
86
86
|
private transformBalanceResponse;
|
|
87
87
|
/**
|
|
88
88
|
* Get the wallet NFTs
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @param {WalletLocator} [params.locator] - The locator
|
|
89
|
+
* @param params - The parameters
|
|
90
|
+
* @param params.perPage - The number of NFTs per page
|
|
91
|
+
* @param params.page - The page number
|
|
93
92
|
* @returns The NFTs
|
|
94
93
|
*/
|
|
95
94
|
nfts(params: {
|
|
@@ -140,11 +139,11 @@ declare class Wallet<C extends Chain> {
|
|
|
140
139
|
/**
|
|
141
140
|
* Approve a transaction or signature
|
|
142
141
|
* @param params - The parameters
|
|
143
|
-
* @param params.transactionId - The transaction id
|
|
142
|
+
* @param params.transactionId - The transaction id
|
|
144
143
|
* @param params.signatureId - The signature id
|
|
145
|
-
* @param params.options - The options for the
|
|
146
|
-
* @param params.options.approval - The approval
|
|
147
|
-
* @param params.options.additionalSigners -
|
|
144
|
+
* @param params.options - The options for the approval
|
|
145
|
+
* @param params.options.approval - The approval data
|
|
146
|
+
* @param params.options.additionalSigners - Additional signers for the approval
|
|
148
147
|
* @returns The transaction or signature
|
|
149
148
|
*/
|
|
150
149
|
approve<T extends ApproveParams>(params: T): Promise<ApproveResult<T>>;
|
|
@@ -198,6 +197,12 @@ declare class Wallet<C extends Chain> {
|
|
|
198
197
|
* @returns true if the signer is registered
|
|
199
198
|
*/
|
|
200
199
|
signerIsRegistered(signerLocator: SignerLocator | string): Promise<boolean>;
|
|
200
|
+
/**
|
|
201
|
+
* Check if a signer is approved and usable for the current wallet chain.
|
|
202
|
+
* @param signerLocator - The locator of the signer to check
|
|
203
|
+
* @returns true if the signer is approved for this chain
|
|
204
|
+
*/
|
|
205
|
+
isSignerApproved(signerLocator: SignerLocator | string): Promise<boolean>;
|
|
201
206
|
/**
|
|
202
207
|
* Whether the wallet needs recovery (signer registration) before the next transaction.
|
|
203
208
|
* @returns true if recovery is needed
|
|
@@ -236,6 +241,8 @@ declare class Wallet<C extends Chain> {
|
|
|
236
241
|
* If no key is found, sets needsRecovery so a new device key is generated during the next transaction.
|
|
237
242
|
*/
|
|
238
243
|
private resolveDeviceSignerAvailability;
|
|
244
|
+
private assembleFullSigner;
|
|
245
|
+
private getSignerState;
|
|
239
246
|
/**
|
|
240
247
|
* Build an InternalSignerConfig from a SignerConfigForChain.
|
|
241
248
|
*/
|
package/dist/wallets/wallet.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WalletsTransactionV2025ResponseDto } from '../api/gen/types.gen.js';
|
|
2
2
|
import { ApiClient } from '../api/client.js';
|
|
3
|
-
import { f as WalletOptions,
|
|
3
|
+
import { f as WalletOptions, r as SignerConfigForChain, m as SignerAdapter, B as Balances, Y as FundWalletResponse, Z as GetTransactionsResponse, _ as GetTransactionSuccessResponse, T as Transfers, $ as SendTokenTransactionOptions, a0 as UserLocator, c as Transaction, O as PrepareOnly, A as ApproveParams, a1 as ApproveResult, k as AddSignerOptions, q as ServerSignerConfig, o as ExternalWalletRegistrationConfig, a2 as AddSignerReturnType, S as Signer, s as SignerLocator, a3 as WalletLocator, j as ApproveOptions, a4 as ApproveSignatureResponse, h as Signature } from '../types-vcGYTcL0.js';
|
|
4
4
|
import { Chain } from '../chains/chains.js';
|
|
5
5
|
import '@crossmint/common-sdk-base';
|
|
6
6
|
import 'viem';
|
|
@@ -86,10 +86,9 @@ declare class Wallet<C extends Chain> {
|
|
|
86
86
|
private transformBalanceResponse;
|
|
87
87
|
/**
|
|
88
88
|
* Get the wallet NFTs
|
|
89
|
-
* @param
|
|
90
|
-
* @param
|
|
91
|
-
* @param
|
|
92
|
-
* @param {WalletLocator} [params.locator] - The locator
|
|
89
|
+
* @param params - The parameters
|
|
90
|
+
* @param params.perPage - The number of NFTs per page
|
|
91
|
+
* @param params.page - The page number
|
|
93
92
|
* @returns The NFTs
|
|
94
93
|
*/
|
|
95
94
|
nfts(params: {
|
|
@@ -140,11 +139,11 @@ declare class Wallet<C extends Chain> {
|
|
|
140
139
|
/**
|
|
141
140
|
* Approve a transaction or signature
|
|
142
141
|
* @param params - The parameters
|
|
143
|
-
* @param params.transactionId - The transaction id
|
|
142
|
+
* @param params.transactionId - The transaction id
|
|
144
143
|
* @param params.signatureId - The signature id
|
|
145
|
-
* @param params.options - The options for the
|
|
146
|
-
* @param params.options.approval - The approval
|
|
147
|
-
* @param params.options.additionalSigners -
|
|
144
|
+
* @param params.options - The options for the approval
|
|
145
|
+
* @param params.options.approval - The approval data
|
|
146
|
+
* @param params.options.additionalSigners - Additional signers for the approval
|
|
148
147
|
* @returns The transaction or signature
|
|
149
148
|
*/
|
|
150
149
|
approve<T extends ApproveParams>(params: T): Promise<ApproveResult<T>>;
|
|
@@ -198,6 +197,12 @@ declare class Wallet<C extends Chain> {
|
|
|
198
197
|
* @returns true if the signer is registered
|
|
199
198
|
*/
|
|
200
199
|
signerIsRegistered(signerLocator: SignerLocator | string): Promise<boolean>;
|
|
200
|
+
/**
|
|
201
|
+
* Check if a signer is approved and usable for the current wallet chain.
|
|
202
|
+
* @param signerLocator - The locator of the signer to check
|
|
203
|
+
* @returns true if the signer is approved for this chain
|
|
204
|
+
*/
|
|
205
|
+
isSignerApproved(signerLocator: SignerLocator | string): Promise<boolean>;
|
|
201
206
|
/**
|
|
202
207
|
* Whether the wallet needs recovery (signer registration) before the next transaction.
|
|
203
208
|
* @returns true if recovery is needed
|
|
@@ -236,6 +241,8 @@ declare class Wallet<C extends Chain> {
|
|
|
236
241
|
* If no key is found, sets needsRecovery so a new device key is generated during the next transaction.
|
|
237
242
|
*/
|
|
238
243
|
private resolveDeviceSignerAvailability;
|
|
244
|
+
private assembleFullSigner;
|
|
245
|
+
private getSignerState;
|
|
239
246
|
/**
|
|
240
247
|
* Build an InternalSignerConfig from a SignerConfigForChain.
|
|
241
248
|
*/
|
package/dist/wallets/wallet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a}from"../chunk-
|
|
1
|
+
import{a}from"../chunk-2AKP3GZ7.js";import"../chunk-TOAFCAVT.js";import"../chunk-N4IWDL6M.js";import"../chunk-MTKY5MIE.js";import"../chunk-IOSADDL5.js";import"../chunk-GOXB2RBF.js";import"../chunk-VADIEIDS.js";import"../chunk-LLQEZP55.js";import"../chunk-L52GDMSH.js";import"../chunk-6X5JEJD7.js";import"../chunk-QM3BB4E2.js";import"../chunk-RBSMBO4T.js";import"../chunk-OQZTL6ZG.js";import"../chunk-N355UETO.js";import"../chunk-3VRN3GKQ.js";import"../chunk-BITOMWYZ.js";import"../chunk-YDZRBHS3.js";import"../chunk-OYPXGE5H.js";import"../chunk-5QKUXVP3.js";import"../chunk-FNWSI6UN.js";import"../chunk-SG4NRUNV.js";import"../chunk-O6VBO7KG.js";import"../chunk-EM3D5Q3A.js";import"../chunk-EE4ITUGS.js";import"../chunk-WCGUGIGJ.js";import"../chunk-XNZLCUTY.js";import"../chunk-CKZYSQOK.js";import"../chunk-QVTKTDED.js";import"../chunk-XS5B3TUE.js";import"../chunk-M335XCYO.js";import"../chunk-YH7G2U6V.js";import"../chunk-W7LJS32A.js";import"../chunk-2YLRFJ66.js";import"../chunk-A4ENPOX6.js";import"../chunk-S3DYQVRD.js";import"../chunk-KUP7H7X2.js";import"../chunk-FT5EVMLB.js";import"../chunk-SVIKBM3S.js";import"../chunk-KKQBZXFE.js";import"../chunk-EXC7TCGL.js";import"../chunk-455NK5LB.js";import"../chunk-2X65YHU4.js";import"../chunk-J7C3SSSQ.js";import"../chunk-J3R36SGJ.js";export{a as Wallet};
|
package/package.json
CHANGED
package/dist/chunk-34LCOL3F.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var s="@crossmint/wallets-sdk",t="1.0.0-beta.5";var c="WALLETS_SDK",r=t,a=s,d=500;export{c as a,r as b,a as c,d};
|
package/dist/chunk-BTSOX4OO.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as ae}from"./chunk-N4IWDL6M.js";import{a as $}from"./chunk-GOXB2RBF.js";import{b as G,c as M}from"./chunk-CA2NUPQP.js";import{a as W}from"./chunk-65HJGWCL.js";import{b as L}from"./chunk-RBSMBO4T.js";import{a as ne}from"./chunk-H7AD7AFJ.js";import{f as ie}from"./chunk-3LIYGJ26.js";import{B as te,d as j,e as _,j as J,n as U,q as B,r as V,s as z,t as Q,u as H,v as X,w as Y,x as Z,y as ee,z as re}from"./chunk-EXC7TCGL.js";import{a}from"./chunk-5AMNTK5L.js";import{d as q}from"./chunk-34LCOL3F.js";import{a as m,b as E,c as I,d as i,e as T,f,g as u}from"./chunk-J3R36SGJ.js";import{isValidAddress as se,WithLoggerContext as x}from"@crossmint/common-sdk-base";var v,y,g,k,P,b,N,R,O,A=class{constructor(e,r){T(this,v);T(this,y);T(this,g);T(this,k);T(this,P);T(this,b,!1);T(this,N,!1);T(this,R);T(this,O,null);let{chain:t,address:n,owner:d,options:p,alias:h,recovery:l,signers:s,signer:c}=e;f(this,g,r),this.chain=t,this.address=n,this.owner=d,f(this,y,p),this.alias=h,f(this,k,l),f(this,P,s!=null?s:[]),f(this,v,c),f(this,R,this.initDefaultSigner())}get signer(){return i(this,v)}initDeviceSigner(){return u(this,null,function*(){var n;let e=(n=i(this,y))==null?void 0:n.deviceSignerKeyStorage;if(e==null||this.chain==="solana")return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(d){a.error("wallet.initDeviceSigner.error",{error:d}),f(this,b,!0);return}let t=this.buildInternalSignerConfig(r);f(this,v,W(this.chain,t,e))})}initDefaultSigner(){return u(this,null,function*(){var e,r;if(i(this,v)==null&&(yield this.initDeviceSigner(),!(i(this,v)!=null||i(this,b))))try{if(i(this,P).length===0){let t=this.buildInternalSignerConfig(i(this,k));f(this,v,W(this.chain,t,(e=i(this,y))==null?void 0:e.deviceSignerKeyStorage))}else if(i(this,P).length===1){let t=this.buildInternalSignerConfig(i(this,P)[0]);f(this,v,W(this.chain,t,(r=i(this,y))==null?void 0:r.deviceSignerKeyStorage))}}catch(t){}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return i(e,k)}static getInitialSigners(e){return i(e,P)}get apiClient(){return i(this,g)}get options(){return i(this,y)}get recovery(){return i(this,k)}balances(e){return u(this,null,function*(){a.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...e!=null?e:[]],d=yield i(this,g).getBalance(this.address,{chains:[r],tokens:n});if("error"in d)throw a.error("wallet.balances.error",{error:d}),new Error(`Failed to get balances for wallet: ${JSON.stringify(d.message)}`);return a.info("wallet.balances.success"),this.transformBalanceResponse(d,t,e)})}stagingFund(e,r){return u(this,null,function*(){a.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw a.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return a.info("wallet.stagingFund.success"),t})}transformBalanceResponse(e,r,t){let n=s=>{var S,C,F,K,D;let c=(S=s.chains)==null?void 0:S[this.chain],o={};return this.chain==="solana"&&c!=null&&"mintHash"in c?o={mintHash:c.mintHash}:this.chain==="stellar"&&c!=null&&"contractId"in c?o={contractId:c.contractId}:c!=null&&"contractAddress"in c&&(o={contractAddress:c.contractAddress}),m({symbol:(C=s.symbol)!=null?C:"",name:(F=s.name)!=null?F:"",amount:(K=s.amount)!=null?K:"0",decimals:s.decimals,rawAmount:(D=s.rawAmount)!=null?D:"0"},o)},d=e.find(s=>s.symbol===r),p=e.find(s=>s.symbol==="usdc"),h=e.filter(s=>{var c;return s.symbol!==r&&s.symbol!=="usdc"&&(t==null||t.includes((c=s.symbol)!=null?c:""))}),l=s=>{let c={symbol:s,name:s,amount:"0",decimals:0,rawAmount:"0"},o={};return this.chain==="solana"?o={mintHash:void 0}:this.chain==="stellar"?o={contractId:void 0}:o={contractAddress:void 0},m(m({},c),o)};return{nativeToken:d!=null?n(d):l(r),usdc:p!=null?n(p):l("usdc"),tokens:h.map(n)}}nfts(e){return u(this,null,function*(){return yield i(this,g).getNfts(E(m({},e),{chain:this.chain,address:this.address}))})}transactions(){return u(this,null,function*(){let e=yield i(this,g).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return u(this,null,function*(){let r=yield i(this,g).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return u(this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e==null?void 0:e.tokens,status:e==null?void 0:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return u(this,null,function*(){let d=this.resolveChainForEnvironment(),p=ce(e),h=de(r,d),l=Number(t);if(Number.isNaN(l)||!Number.isFinite(l)||l<=0)throw new z(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);a.info("wallet.send.start",m({recipient:p,token:h,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let s=this.requireSigner(),c;(n==null?void 0:n.signer)==null?c=s.locator():typeof n.signer=="string"?c=n.signer:c=`server:${L(n.signer,this.chain,i(this,g).projectId,i(this,g).environment).derivedAddress}`;let o=m({recipient:p,amount:t,signer:c},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),S=yield i(this,g).send(this.walletLocator,h,o);if("message"in S)throw a.error("wallet.send.error",{error:S}),new Q(`Failed to send token: ${JSON.stringify(S.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return a.info("wallet.send.prepared",{transactionId:S.id}),{hash:void 0,explorerLink:void 0,transactionId:S.id};let C=yield this.approveTransactionAndWait(S.id);return a.info("wallet.send.success",{transactionId:S.id,hash:C.hash}),C})}approveTransaction(e){return u(this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return u(this,null,function*(){if(this.requireSigner(),a.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return a.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return a.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw a.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return u(this,null,function*(){var p,h;a.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?`server:${L(e,this.chain,i(this,g).projectId,i(this,g).environment).derivedAddress}`:e,n=this.signer,d=this.buildInternalSignerConfig(i(this,k));f(this,v,W(this.chain,d,(p=i(this,y))==null?void 0:p.deviceSignerKeyStorage));try{let l=typeof t=="string"||t.type==="passkey"&&t.id==null?t:t.type==="device"&&"publicKey"in t&&t.publicKey!=null?{type:"device",publicKey:t.publicKey,name:t.name}:$(t),s=yield i(this,g).registerSigner(this.walletLocator,{signer:l,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in s)throw a.error("wallet.addSigner.error",{error:s}),new Error(`Failed to register signer: ${JSON.stringify(s.message)}`);let c=G(s,this.chain);if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in s)||s.transaction==null)throw a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");let o=s.transaction.id;if(c==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);return r!=null&&r.prepareOnly?(a.info("wallet.addSigner.prepared",{transactionId:o}),E(m({},c),{transactionId:o})):(yield this.approveTransactionAndWait(o),a.info("wallet.addSigner.success",{transactionId:o}),E(m({},c),{status:"success"}))}else{if(!("chains"in s))throw a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");let o=(h=s.chains)==null?void 0:h[this.chain];if(c==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);if(r!=null&&r.prepareOnly){let S=(o==null?void 0:o.status)!=="success"?o==null?void 0:o.id:void 0;return a.info("wallet.addSigner.prepared",{signatureId:S}),E(m({},c),{signatureId:S})}if((o==null?void 0:o.status)==="awaiting-approval")yield this.approveSignatureAndWait(o.id),a.info("wallet.addSigner.success",{signatureId:o.id});else if((o==null?void 0:o.status)==="pending")yield this.waitForSignature(o.id),a.info("wallet.addSigner.success",{signatureId:o.id});else{if((o==null?void 0:o.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);a.info("wallet.addSigner.success")}return E(m({},c),{status:"success"})}}finally{f(this,v,n)}})}useSigner(e){return u(this,null,function*(){var n;a.info("wallet.useSigner.start"),this.validateSignerInput(e),e.type==="device"?yield this.resolveDeviceSignerAvailability(e):yield this.resolveNonDeviceSigner(e);let r=this.buildInternalSignerConfig(e),t=$(e);f(this,v,W(this.chain,r,(n=i(this,y))==null?void 0:n.deviceSignerKeyStorage)),a.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return u(this,null,function*(){if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e)){f(this,b,!1);return}throw new Error("No passkey signer is registered on this wallet.")}let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r)){f(this,b,!1);return}if(this.isRecoverySigner(e)){f(this,b,!1);return}throw new Error(`Signer "${r}" is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return u(this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){if(e.type==="server"){let{derivedAddress:r}=L(e,this.chain,i(this,g).projectId,i(this,g).environment);return`server:${r}`}return $(e)}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return u(this,null,function*(){return(yield this.signers()).some(t=>t.locator===e)})}needsRecovery(){return i(this,b)}recover(){return u(this,null,function*(){var d,p;if(a.info("wallet.recover.start"),i(this,v)==null&&(yield this.initDeviceSigner()),((d=i(this,v))==null?void 0:d.type)!=="device"){a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"});return}if(i(this,N)){a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}let e=i(this,v).locator();if(yield this.signerIsRegistered(e)){a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),f(this,b,!1),f(this,N,!0);return}let t=(p=i(this,y))==null?void 0:p.deviceSignerKeyStorage;if(t==null)throw new Error("Device signer key storage is required to recover a device signer");let n=yield ae(t,this.address);try{yield this.addSigner(n)}catch(h){throw a.error("wallet.recover.device.error",{error:h}),yield t.deleteKey(this.address),h}f(this,v,W(this.chain,{type:"device",locator:n.locator,address:this.address},t)),a.info("wallet.recover.device.success",{signerLocator:n.locator}),f(this,b,!1),f(this,N,!0)})}signers(){return u(this,null,function*(){var d,p;a.info("wallet.signers.start");let e=yield i(this,g).getWallet(this.walletLocator);if("error"in e)throw a.error("wallet.signers.error",{error:e}),new _(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw a.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new j(`Wallet type ${e.type} not supported`);let r=(p=(d=e==null?void 0:e.config)==null?void 0:d.delegatedSigners)!=null?p:[];if(this.chain==="solana"||this.chain==="stellar"){let h=r.map(l=>M(l,"success"));return a.info("wallet.signers.success",{count:h.length}),h}let n=(yield Promise.all(r.map(h=>u(this,null,function*(){if(h.locator.startsWith("device:"))return M(h,"success");try{let l=yield i(this,g).getSigner(this.walletLocator,h.locator);return"error"in l?null:G(l,this.chain)}catch(l){return null}})))).filter(h=>h!=null);return a.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(i(this,g).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(i(this,v)==null)throw new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return i(this,v)}preAuthIfNeeded(){return u(this,null,function*(){yield i(this,R),i(this,O)==null&&f(this,O,this.recover());try{yield i(this,O)}finally{f(this,O,null)}let e=this.requireSigner();e instanceof ne&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=i(this,k);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let t=L(e,this.chain,i(this,g).projectId,i(this,g).environment).derivedAddress,n=L(r,this.chain,i(this,g).projectId,i(this,g).environment).derivedAddress;return t===n}return $(e)===$(r)}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return u(this,null,function*(){var p;let r=(p=i(this,y))==null?void 0:p.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let t=yield r.getKey(this.address);if(t!=null){e.locator=`device:${t}`;return}let d=(yield this.signers()).filter(h=>h.locator.startsWith("device:"));for(let h of d){let l=h.locator.replace("device:","");if(yield r.hasKey(l)){yield r.mapAddressToKey(this.address,l),e.locator=h.locator;return}}f(this,b,!0),f(this,N,!1)})}buildInternalSignerConfig(e){var r,t,n,d,p,h;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:i(this,g).crossmint,clientTEEConnection:(r=i(this,y))==null?void 0:r.clientTEEConnection,onAuthRequired:(n=(t=i(this,y))==null?void 0:t.callbacks)==null?void 0:n.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:i(this,g).crossmint,clientTEEConnection:(d=i(this,y))==null?void 0:d.clientTEEConnection,onAuthRequired:(h=(p=i(this,y))==null?void 0:p.callbacks)==null?void 0:h.onAuthRequired};case"passkey":{let l="id"in e&&e.id?e.id:"";return{type:"passkey",id:l,locator:`passkey:${l}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return E(m({},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:l,derivedAddress:s}=L(e,this.chain,i(this,g).projectId,i(this,g).environment);return{type:"server",derivedKeyBytes:l,locator:`server:${s}`,address:s}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=ie(this.chain,i(this,g).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return u(this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return u(this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return u(this,null,function*(){var l,s;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=this.requireSigner(),n=yield i(this,g).getSignature(this.walletLocator,e);if("error"in n)throw new B(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let c=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,c)}let d=(l=n.approvals)==null?void 0:l.pending;if(d==null)return n;let p=[...(s=r==null?void 0:r.additionalSigners)!=null?s:[],t],h=yield Promise.all(d.map(c=>u(this,null,function*(){let o=p.find(C=>C.locator()===c.signer.locator);if(o==null)throw new J(`Signer ${c.signer.locator} not found in pending approvals`);let S=yield o.signMessage(c.message);return E(m({},S),{signer:o.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,h)})}approveTransactionInternal(e,r){return u(this,null,function*(){var l,s,c,o,S;let t=yield i(this,g).getTransaction(this.walletLocator,e);if("error"in t)throw new H(JSON.stringify(t));yield(c=(s=(l=i(this,y))==null?void 0:l.callbacks)==null?void 0:s.onTransactionStart)==null?void 0:c.call(s);let n=this.requireSigner();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let C=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,C)}let d=(o=t.approvals)==null?void 0:o.pending;if(d==null)return t;let p=[...(S=r==null?void 0:r.additionalSigners)!=null?S:[],n],h=yield Promise.all(d.map(C=>u(this,null,function*(){let F=p.find(le=>le.locator()===C.signer.locator);if(F==null)throw new J(`Signer ${C.signer.locator} not found in pending approvals`);let K=F.type==="device",D=t.chainType==="solana"&&"transaction"in t.onChain&&!K?t.onChain.transaction:C.message,oe=yield F.signTransaction(D);return E(m({},oe),{signer:F.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,h)})}executeApproveTransactionWithErrorHandling(e,r){return u(this,null,function*(){a.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield i(this,g).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new re(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return u(this,null,function*(){let t=yield i(this,g).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new V(JSON.stringify(t));return t})}waitForSignature(e){return u(this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,q)),r=yield i(this,g).getSignature(this.walletLocator,e),"error"in r)throw new B(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new U("Signature signing failed");if(!r.outputSignature)throw new B("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(p){return u(this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:d=q}={}){var c;a.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let h=Date.now(),l;do{if(Date.now()-h>r)throw new X("Transaction confirmation timeout");if(l=yield i(this,g).getTransaction(this.walletLocator,e),l.error)throw new H(JSON.stringify(l));yield this.sleep(d),d=Math.min(d*t,n)}while(l.status==="pending");if(l.status==="failed")throw new Y(`Transaction sending failed: ${JSON.stringify(l.error)}`);if(l.status==="awaiting-approval")throw new Z("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let s=l.onChain.txId;if(s==null)throw new ee("Transaction hash not found on transaction response");return{hash:s,explorerLink:(c=l.onChain.explorerLink)!=null?c:"",transactionId:l.id}})}sleep(e){return u(this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};v=new WeakMap,y=new WeakMap,g=new WeakMap,k=new WeakMap,P=new WeakMap,b=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,I([x({logger:a,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"balances",1),I([x({logger:a,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"stagingFund",1),I([x({logger:a,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"send",1),I([x({logger:a,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"approve",1),I([x({logger:a,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"addSigner",1),I([x({logger:a,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"useSigner",1),I([x({logger:a,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"recover",1),I([x({logger:a,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"signers",1);function ce(w){if(typeof w=="string"){if(!se(w))throw new te(`Invalid recipient address: "${w}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return w}if("email"in w)return`email:${w.email}`;if("x"in w)return`x:${w.x}`;if("twitter"in w)return`twitter:${w.twitter}`;if("phone"in w)return`phoneNumber:${w.phone}`;if("userId"in w)return`userId:${w.userId}`;throw new Error("Invalid recipient locator")}function de(w,e){return se(w)?`${e}:${w}`:`${e}:${w.toLowerCase()}`}export{A as a};
|
package/dist/chunk-CA2NUPQP.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as o,b as a}from"./chunk-J3R36SGJ.js";function n(t){switch(t.type){case"passkey":return{type:"passkey",id:t.id,name:t.name,publicKey:t.publicKey,validatorContractVersion:t.validatorContractVersion,locator:t.locator};case"api-key":return{type:"api-key",address:t.address,locator:t.locator};case"external-wallet":return{type:"external-wallet",address:t.address,locator:t.locator};case"email":return{type:"email",email:t.email,address:t.address,locator:t.locator};case"phone":return{type:"phone",phone:t.phone,address:t.address,locator:t.locator};case"device":return{type:"device",publicKey:t.publicKey,locator:t.locator};case"server":return{type:"server",address:t.address,locator:t.locator};default:throw new Error(`Unknown signer type: ${t.type}`)}}function u(t,r){let e=n(t);if(r==="solana"||r==="stellar"){let s="success";return"transaction"in t&&t.transaction!=null&&(s=t.transaction.status),a(o({},e),{status:s})}if("chains"in t&&t.chains!=null&&Object.keys(t.chains).length>0){let s=t.chains[r];return s==null?null:a(o({},e),{status:s.status})}return a(o({},e),{status:"success"})}function d(t,r){let e=a(o({},t),{status:r});return t.locator.indexOf(":")===-1&&(t.type==="api-key"?e.locator=t.locator:(e.locator=`external-wallet:${t.locator}`,e.type="external-wallet")),e}export{n as a,u as b,d as c};
|
package/dist/chunk-JGFVDY5U.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkYHV3672Rcjs = require('./chunk-YHV3672R.cjs');var _chunkNX256LAHcjs = require('./chunk-NX256LAH.cjs');var _chunkOXR3FJF4cjs = require('./chunk-OXR3FJF4.cjs');var _chunkJSE5PYVYcjs = require('./chunk-JSE5PYVY.cjs');var _chunk3VSFHDFHcjs = require('./chunk-3VSFHDFH.cjs');var _chunkI2PY7FD5cjs = require('./chunk-I2PY7FD5.cjs');var _chunkMXNC4GJQcjs = require('./chunk-MXNC4GJQ.cjs');var _chunkT3U46LK3cjs = require('./chunk-T3U46LK3.cjs');var _chunkCW2GPBXZcjs = require('./chunk-CW2GPBXZ.cjs');var _chunkY22BJFQTcjs = require('./chunk-Y22BJFQT.cjs');var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');var _commonsdkbase = require('@crossmint/common-sdk-base');var v,y,g,k,P,b,N,R,O,A= exports.a =class{constructor(e,r){_chunk2GKPWQBQcjs.e.call(void 0, this,v);_chunk2GKPWQBQcjs.e.call(void 0, this,y);_chunk2GKPWQBQcjs.e.call(void 0, this,g);_chunk2GKPWQBQcjs.e.call(void 0, this,k);_chunk2GKPWQBQcjs.e.call(void 0, this,P);_chunk2GKPWQBQcjs.e.call(void 0, this,b,!1);_chunk2GKPWQBQcjs.e.call(void 0, this,N,!1);_chunk2GKPWQBQcjs.e.call(void 0, this,R);_chunk2GKPWQBQcjs.e.call(void 0, this,O,null);let{chain:t,address:n,owner:d,options:p,alias:h,recovery:l,signers:s,signer:c}=e;_chunk2GKPWQBQcjs.f.call(void 0, this,g,r),this.chain=t,this.address=n,this.owner=d,_chunk2GKPWQBQcjs.f.call(void 0, this,y,p),this.alias=h,_chunk2GKPWQBQcjs.f.call(void 0, this,k,l),_chunk2GKPWQBQcjs.f.call(void 0, this,P,s!=null?s:[]),_chunk2GKPWQBQcjs.f.call(void 0, this,v,c),_chunk2GKPWQBQcjs.f.call(void 0, this,R,this.initDefaultSigner())}get signer(){return _chunk2GKPWQBQcjs.d.call(void 0, this,v)}initDeviceSigner(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var n;let e=(n=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:n.deviceSignerKeyStorage;if(e==null||this.chain==="solana")return;let r={type:"device"};try{yield this.resolveDeviceSignerAvailability(r)}catch(d){_chunkCW2GPBXZcjs.a.error("wallet.initDeviceSigner.error",{error:d}),_chunk2GKPWQBQcjs.f.call(void 0, this,b,!0);return}let t=this.buildInternalSignerConfig(r);_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,t,e))})}initDefaultSigner(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var e,r;if(_chunk2GKPWQBQcjs.d.call(void 0, this,v)==null&&(yield this.initDeviceSigner(),!(_chunk2GKPWQBQcjs.d.call(void 0, this,v)!=null||_chunk2GKPWQBQcjs.d.call(void 0, this,b))))try{if(_chunk2GKPWQBQcjs.d.call(void 0, this,P).length===0){let t=this.buildInternalSignerConfig(_chunk2GKPWQBQcjs.d.call(void 0, this,k));_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,t,(e=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:e.deviceSignerKeyStorage))}else if(_chunk2GKPWQBQcjs.d.call(void 0, this,P).length===1){let t=this.buildInternalSignerConfig(_chunk2GKPWQBQcjs.d.call(void 0, this,P)[0]);_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,t,(r=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:r.deviceSignerKeyStorage))}}catch(t){}})}static getApiClient(e){return e.apiClient}static getOptions(e){return e.options}static getRecovery(e){return _chunk2GKPWQBQcjs.d.call(void 0, e,k)}static getInitialSigners(e){return _chunk2GKPWQBQcjs.d.call(void 0, e,P)}get apiClient(){return _chunk2GKPWQBQcjs.d.call(void 0, this,g)}get options(){return _chunk2GKPWQBQcjs.d.call(void 0, this,y)}get recovery(){return _chunk2GKPWQBQcjs.d.call(void 0, this,k)}balances(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCW2GPBXZcjs.a.info("wallet.balances.start");let r=this.resolveChainForEnvironment(),t;switch(this.chain){case"solana":t="sol";break;case"stellar":t="xlm";break;default:t="eth";break}let n=[t,"usdc",...e!=null?e:[]],d=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getBalance(this.address,{chains:[r],tokens:n});if("error"in d)throw _chunkCW2GPBXZcjs.a.error("wallet.balances.error",{error:d}),new Error(`Failed to get balances for wallet: ${JSON.stringify(d.message)}`);return _chunkCW2GPBXZcjs.a.info("wallet.balances.success"),this.transformBalanceResponse(d,t,e)})}stagingFund(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCW2GPBXZcjs.a.info("wallet.stagingFund.start",{amount:e,chain:r!=null?r:this.chain});let t=yield this.apiClient.fundWallet(this.address,{amount:e,token:"usdxm",chain:r!=null?r:this.chain});if("error"in t)throw _chunkCW2GPBXZcjs.a.error("wallet.stagingFund.error",{error:t}),new Error(`Failed to fund wallet: ${JSON.stringify(t.message)}`);return _chunkCW2GPBXZcjs.a.info("wallet.stagingFund.success"),t})}transformBalanceResponse(e,r,t){let n=s=>{var S,C,F,K,D;let c=(S=s.chains)==null?void 0:S[this.chain],o={};return this.chain==="solana"&&c!=null&&"mintHash"in c?o={mintHash:c.mintHash}:this.chain==="stellar"&&c!=null&&"contractId"in c?o={contractId:c.contractId}:c!=null&&"contractAddress"in c&&(o={contractAddress:c.contractAddress}),_chunk2GKPWQBQcjs.a.call(void 0, {symbol:(C=s.symbol)!=null?C:"",name:(F=s.name)!=null?F:"",amount:(K=s.amount)!=null?K:"0",decimals:s.decimals,rawAmount:(D=s.rawAmount)!=null?D:"0"},o)},d=e.find(s=>s.symbol===r),p=e.find(s=>s.symbol==="usdc"),h=e.filter(s=>{var c;return s.symbol!==r&&s.symbol!=="usdc"&&(t==null||t.includes((c=s.symbol)!=null?c:""))}),l=s=>{let c={symbol:s,name:s,amount:"0",decimals:0,rawAmount:"0"},o={};return this.chain==="solana"?o={mintHash:void 0}:this.chain==="stellar"?o={contractId:void 0}:o={contractAddress:void 0},_chunk2GKPWQBQcjs.a.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},c),o)};return{nativeToken:d!=null?n(d):l(r),usdc:p!=null?n(p):l("usdc"),tokens:h.map(n)}}nfts(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getNfts(_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{chain:this.chain,address:this.address}))})}transactions(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let e=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getTransactions(this.walletLocator);if("error"in e)throw new Error(`Failed to get transactions: ${JSON.stringify(e.message)}`);return e})}transaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getTransaction(this.walletLocator,e);if("error"in r)throw new Error(`Failed to get transaction: ${JSON.stringify(r.error)}`);return r})}transfers(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=this.resolveChainForEnvironment(),t=yield this.apiClient.getTransfers(this.walletLocator,{chain:r,tokens:e==null?void 0:e.tokens,status:e==null?void 0:e.status});if("error"in t)throw new Error(`Failed to get transfers: ${JSON.stringify(t.message)}`);return t})}send(e,r,t,n){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let d=this.resolveChainForEnvironment(),p=ce(e),h=de(r,d),l=Number(t);if(Number.isNaN(l)||!Number.isFinite(l)||l<=0)throw new (0, _chunkT3U46LK3cjs.s)(`Invalid transfer amount: "${t}". Amount must be a positive number greater than zero.`);_chunkCW2GPBXZcjs.a.info("wallet.send.start",_chunk2GKPWQBQcjs.a.call(void 0, {recipient:p,token:h,amount:t},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{})),yield this.preAuthIfNeeded();let s=this.requireSigner(),c;(n==null?void 0:n.signer)==null?c=s.locator():typeof n.signer=="string"?c=n.signer:c=`server:${_chunk3VSFHDFHcjs.b.call(void 0, n.signer,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment).derivedAddress}`;let o=_chunk2GKPWQBQcjs.a.call(void 0, {recipient:p,amount:t,signer:c},(n==null?void 0:n.transactionType)!=null?{transactionType:n.transactionType}:{}),S=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).send(this.walletLocator,h,o);if("message"in S)throw _chunkCW2GPBXZcjs.a.error("wallet.send.error",{error:S}),new (0, _chunkT3U46LK3cjs.t)(`Failed to send token: ${JSON.stringify(S.message)}`);if((n==null?void 0:n.prepareOnly)===!0)return _chunkCW2GPBXZcjs.a.info("wallet.send.prepared",{transactionId:S.id}),{hash:void 0,explorerLink:void 0,transactionId:S.id};let C=yield this.approveTransactionAndWait(S.id);return _chunkCW2GPBXZcjs.a.info("wallet.send.success",{transactionId:S.id,hash:C.hash}),C})}approveTransaction(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return console.warn("approveTransaction is deprecated. Use approve instead. This method will be removed in the next major version."),yield this.approve(e)})}approve(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(this.requireSigner(),_chunkCW2GPBXZcjs.a.info("wallet.approve.start",{transactionId:e.transactionId,signatureId:e.signatureId}),e.transactionId!=null){let r=yield this.approveTransactionAndWait(e.transactionId,e.options);return _chunkCW2GPBXZcjs.a.info("wallet.approve.success",{transactionId:e.transactionId}),r}if(e.signatureId!=null){let r=yield this.approveSignatureAndWait(e.signatureId,e.options);return _chunkCW2GPBXZcjs.a.info("wallet.approve.success",{signatureId:e.signatureId}),r}throw _chunkCW2GPBXZcjs.a.error("wallet.approve.error",{error:"Either transactionId or signatureId must be provided"}),new Error("Either transactionId or signatureId must be provided")})}addSigner(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var p,h;_chunkCW2GPBXZcjs.a.info("wallet.addSigner.start");let t=typeof e=="object"&&"type"in e&&e.type==="server"?`server:${_chunk3VSFHDFHcjs.b.call(void 0, e,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment).derivedAddress}`:e,n=this.signer,d=this.buildInternalSignerConfig(_chunk2GKPWQBQcjs.d.call(void 0, this,k));_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,d,(p=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:p.deviceSignerKeyStorage));try{let l=typeof t=="string"||t.type==="passkey"&&t.id==null?t:t.type==="device"&&"publicKey"in t&&t.publicKey!=null?{type:"device",publicKey:t.publicKey,name:t.name}:_chunkNX256LAHcjs.a.call(void 0, t),s=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).registerSigner(this.walletLocator,{signer:l,chain:this.chain==="solana"||this.chain==="stellar"?void 0:this.chain});if("error"in s)throw _chunkCW2GPBXZcjs.a.error("wallet.addSigner.error",{error:s}),new Error(`Failed to register signer: ${JSON.stringify(s.message)}`);let c=_chunkOXR3FJF4cjs.b.call(void 0, s,this.chain);if(this.chain==="solana"||this.chain==="stellar"){if(!("transaction"in s)||s.transaction==null)throw _chunkCW2GPBXZcjs.a.error("wallet.addSigner.error",{error:"Expected transaction in response for Solana/Stellar chain"}),new Error("Expected transaction in response for Solana/Stellar chain");let o=s.transaction.id;if(c==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);return r!=null&&r.prepareOnly?(_chunkCW2GPBXZcjs.a.info("wallet.addSigner.prepared",{transactionId:o}),_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},c),{transactionId:o})):(yield this.approveTransactionAndWait(o),_chunkCW2GPBXZcjs.a.info("wallet.addSigner.success",{transactionId:o}),_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},c),{status:"success"}))}else{if(!("chains"in s))throw _chunkCW2GPBXZcjs.a.error("wallet.addSigner.error",{error:"Expected chains in response for EVM chain"}),new Error("Expected chains in response for EVM chain");let o=(h=s.chains)==null?void 0:h[this.chain];if(c==null)throw new Error(`No approval found for chain ${this.chain} in register signer response`);if(r!=null&&r.prepareOnly){let S=(o==null?void 0:o.status)!=="success"?o==null?void 0:o.id:void 0;return _chunkCW2GPBXZcjs.a.info("wallet.addSigner.prepared",{signatureId:S}),_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},c),{signatureId:S})}if((o==null?void 0:o.status)==="awaiting-approval")yield this.approveSignatureAndWait(o.id),_chunkCW2GPBXZcjs.a.info("wallet.addSigner.success",{signatureId:o.id});else if((o==null?void 0:o.status)==="pending")yield this.waitForSignature(o.id),_chunkCW2GPBXZcjs.a.info("wallet.addSigner.success",{signatureId:o.id});else{if((o==null?void 0:o.status)==="failed")throw new Error(`Signer registration failed for chain ${this.chain}`);_chunkCW2GPBXZcjs.a.info("wallet.addSigner.success")}return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},c),{status:"success"})}}finally{_chunk2GKPWQBQcjs.f.call(void 0, this,v,n)}})}useSigner(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var n;_chunkCW2GPBXZcjs.a.info("wallet.useSigner.start"),this.validateSignerInput(e),e.type==="device"?yield this.resolveDeviceSignerAvailability(e):yield this.resolveNonDeviceSigner(e);let r=this.buildInternalSignerConfig(e),t=_chunkNX256LAHcjs.a.call(void 0, e);_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,r,(n=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:n.deviceSignerKeyStorage)),_chunkCW2GPBXZcjs.a.info("wallet.useSigner.success",{signerLocator:t})})}resolveNonDeviceSigner(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(e.type==="passkey"&&this.isPasskeyMissingId(e)&&!(yield this.tryAutoSelectPasskey(e))){if(this.isRecoverySigner(e)){_chunk2GKPWQBQcjs.f.call(void 0, this,b,!1);return}throw new Error("No passkey signer is registered on this wallet.")}let r=this.resolveSignerLocator(e);if(yield this.signerIsRegistered(r)){_chunk2GKPWQBQcjs.f.call(void 0, this,b,!1);return}if(this.isRecoverySigner(e)){_chunk2GKPWQBQcjs.f.call(void 0, this,b,!1);return}throw new Error(`Signer "${r}" is not registered in this wallet.`)})}tryAutoSelectPasskey(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=(yield this.signers()).filter(n=>n.type==="passkey");if(t.length===0)return!1;if(t.length>1)throw new Error('Multiple passkey signers are registered on this wallet. Please specify the credential id: wallet.useSigner({ type: "passkey", id: "<credential-id>" })');return e.id=t[0].locator.replace("passkey:",""),!0})}resolveSignerLocator(e){if(e.type==="server"){let{derivedAddress:r}=_chunk3VSFHDFHcjs.b.call(void 0, e,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment);return`server:${r}`}return _chunkNX256LAHcjs.a.call(void 0, e)}isPasskeyMissingId(e){return e.id==null||e.id===""}signerIsRegistered(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return(yield this.signers()).some(t=>t.locator===e)})}needsRecovery(){return _chunk2GKPWQBQcjs.d.call(void 0, this,b)}recover(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d,p;if(_chunkCW2GPBXZcjs.a.info("wallet.recover.start"),_chunk2GKPWQBQcjs.d.call(void 0, this,v)==null&&(yield this.initDeviceSigner()),((d=_chunk2GKPWQBQcjs.d.call(void 0, this,v))==null?void 0:d.type)!=="device"){_chunkCW2GPBXZcjs.a.warn("wallet.recover.skipped",{reason:"Recovery is only supported for device signers"});return}if(_chunk2GKPWQBQcjs.d.call(void 0, this,N)){_chunkCW2GPBXZcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved (cached)"});return}let e=_chunk2GKPWQBQcjs.d.call(void 0, this,v).locator();if(yield this.signerIsRegistered(e)){_chunkCW2GPBXZcjs.a.info("wallet.recover.skipped",{reason:"Device signer already approved"}),_chunk2GKPWQBQcjs.f.call(void 0, this,b,!1),_chunk2GKPWQBQcjs.f.call(void 0, this,N,!0);return}let t=(p=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:p.deviceSignerKeyStorage;if(t==null)throw new Error("Device signer key storage is required to recover a device signer");let n=yield _chunkYHV3672Rcjs.a.call(void 0, t,this.address);try{yield this.addSigner(n)}catch(h){throw _chunkCW2GPBXZcjs.a.error("wallet.recover.device.error",{error:h}),yield t.deleteKey(this.address),h}_chunk2GKPWQBQcjs.f.call(void 0, this,v,_chunkJSE5PYVYcjs.a.call(void 0, this.chain,{type:"device",locator:n.locator,address:this.address},t)),_chunkCW2GPBXZcjs.a.info("wallet.recover.device.success",{signerLocator:n.locator}),_chunk2GKPWQBQcjs.f.call(void 0, this,b,!1),_chunk2GKPWQBQcjs.f.call(void 0, this,N,!0)})}signers(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var d,p;_chunkCW2GPBXZcjs.a.info("wallet.signers.start");let e=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getWallet(this.walletLocator);if("error"in e)throw _chunkCW2GPBXZcjs.a.error("wallet.signers.error",{error:e}),new (0, _chunkT3U46LK3cjs.e)(JSON.stringify(e));if(e.type!=="smart"||e.chainType!=="evm"&&e.chainType!=="solana"&&e.chainType!=="stellar")throw _chunkCW2GPBXZcjs.a.error("wallet.signers.error",{error:`Wallet type ${e.type} not supported`}),new (0, _chunkT3U46LK3cjs.d)(`Wallet type ${e.type} not supported`);let r=(p=(d=e==null?void 0:e.config)==null?void 0:d.delegatedSigners)!=null?p:[];if(this.chain==="solana"||this.chain==="stellar"){let h=r.map(l=>_chunkOXR3FJF4cjs.c.call(void 0, l,"success"));return _chunkCW2GPBXZcjs.a.info("wallet.signers.success",{count:h.length}),h}let n=(yield Promise.all(r.map(h=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){if(h.locator.startsWith("device:"))return _chunkOXR3FJF4cjs.c.call(void 0, h,"success");try{let l=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getSigner(this.walletLocator,h.locator);return"error"in l?null:_chunkOXR3FJF4cjs.b.call(void 0, l,this.chain)}catch(l){return null}})))).filter(h=>h!=null);return _chunkCW2GPBXZcjs.a.info("wallet.signers.success",{count:n.length}),n})}get walletLocator(){if(_chunk2GKPWQBQcjs.d.call(void 0, this,g).isServerSide)return this.address;{let e;switch(this.chain){case"stellar":e="me:stellar:smart";break;case"solana":e="me:solana:smart";break;default:e="me:evm:smart";break}let r=this.alias!=null?`:alias:${this.alias}`:"";return e+r}}requireSigner(){if(_chunk2GKPWQBQcjs.d.call(void 0, this,v)==null)throw new Error("This wallet is read-only because no signer was provided. Operations that require signing (send, approve, addSigner, etc.) are not available.");return _chunk2GKPWQBQcjs.d.call(void 0, this,v)}preAuthIfNeeded(){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){yield _chunk2GKPWQBQcjs.d.call(void 0, this,R),_chunk2GKPWQBQcjs.d.call(void 0, this,O)==null&&_chunk2GKPWQBQcjs.f.call(void 0, this,O,this.recover());try{yield _chunk2GKPWQBQcjs.d.call(void 0, this,O)}finally{_chunk2GKPWQBQcjs.f.call(void 0, this,O,null)}let e=this.requireSigner();e instanceof _chunkI2PY7FD5cjs.a&&(yield e.ensureAuthenticated())})}isRecoverySigner(e){let r=_chunk2GKPWQBQcjs.d.call(void 0, this,k);if(r==null||r.type!==e.type||e.type==="device")return!1;if(e.type==="passkey")return!0;if(e.type==="server"&&r.type==="server"){let t=_chunk3VSFHDFHcjs.b.call(void 0, e,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment).derivedAddress,n=_chunk3VSFHDFHcjs.b.call(void 0, r,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment).derivedAddress;return t===n}return _chunkNX256LAHcjs.a.call(void 0, e)===_chunkNX256LAHcjs.a.call(void 0, r)}validateSignerInput(e){switch(e.type){case"email":if(!("email"in e)||e.email==null)throw new Error("Email signer requires an email address");break;case"phone":if(!("phone"in e)||e.phone==null)throw new Error("Phone signer requires a phone number");break;case"external-wallet":if(!("address"in e)||e.address==null)throw new Error("External wallet signer requires a wallet address");if(!("onSign"in e)||typeof e.onSign!="function")throw new Error("External wallet signer requires an onSign callback");break;case"passkey":case"device":case"api-key":break;default:break}}resolveDeviceSignerAvailability(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var p;let r=(p=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:p.deviceSignerKeyStorage;if(r==null)throw new Error("Device signer key storage is required for device signers");let t=yield r.getKey(this.address);if(t!=null){e.locator=`device:${t}`;return}let d=(yield this.signers()).filter(h=>h.locator.startsWith("device:"));for(let h of d){let l=h.locator.replace("device:","");if(yield r.hasKey(l)){yield r.mapAddressToKey(this.address,l),e.locator=h.locator;return}}_chunk2GKPWQBQcjs.f.call(void 0, this,b,!0),_chunk2GKPWQBQcjs.f.call(void 0, this,N,!1)})}buildInternalSignerConfig(e){var r,t,n,d,p,h;switch(e.type){case"email":return{type:"email",email:e.email,locator:`email:${e.email}`,address:this.address,crossmint:_chunk2GKPWQBQcjs.d.call(void 0, this,g).crossmint,clientTEEConnection:(r=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:r.clientTEEConnection,onAuthRequired:(n=(t=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:t.callbacks)==null?void 0:n.onAuthRequired};case"phone":return{type:"phone",phone:e.phone,locator:`phone:${e.phone}`,address:this.address,crossmint:_chunk2GKPWQBQcjs.d.call(void 0, this,g).crossmint,clientTEEConnection:(d=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:d.clientTEEConnection,onAuthRequired:(h=(p=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:p.callbacks)==null?void 0:h.onAuthRequired};case"passkey":{let l="id"in e&&e.id?e.id:"";return{type:"passkey",id:l,locator:`passkey:${l}`,name:"name"in e?e.name:void 0,publicKey:"publicKey"in e?e.publicKey:void 0,onCreatePasskey:e.onCreatePasskey,onSignWithPasskey:e.onSignWithPasskey}}case"device":return{type:"device",locator:"locator"in e&&e.locator?e.locator:void 0,address:this.address};case"external-wallet":return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{locator:`external-wallet:${e.address}`});case"api-key":return{type:"api-key",locator:"api-key",address:this.address};case"server":{let{derivedKeyBytes:l,derivedAddress:s}=_chunk3VSFHDFHcjs.b.call(void 0, e,this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).projectId,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment);return{type:"server",derivedKeyBytes:l,locator:`server:${s}`,address:s}}default:throw new Error(`Unknown signer type: ${e==null?void 0:e.type}`)}}get isSolanaWallet(){return this.chain==="solana"}resolveChainForEnvironment(){let e=_chunkMXNC4GJQcjs.f.call(void 0, this.chain,_chunk2GKPWQBQcjs.d.call(void 0, this,g).environment);return e!==this.chain&&(this.chain=e),this.chain}approveTransactionAndWait(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return yield this.approveTransactionInternal(e,r),yield this.sleep(1e3),yield this.waitForTransaction(e)})}approveSignatureAndWait(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield this.approveSignatureInternal(e,r);return!("error"in t)&&t.status==="success"&&t.outputSignature!=null?{signature:t.outputSignature,signatureId:e}:(yield this.sleep(1e3),yield this.waitForSignature(e))})}approveSignatureInternal(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var l,s;if(this.isSolanaWallet)throw new Error("Approving signatures is only supported for EVM smart wallets");let t=this.requireSigner(),n=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getSignature(this.walletLocator,e);if("error"in n)throw new (0, _chunkT3U46LK3cjs.q)(JSON.stringify(n));if(t.type==="api-key")return n;if((r==null?void 0:r.approval)!=null){let c=[r.approval];return yield this.executeApproveSignatureWithErrorHandling(e,c)}let d=(l=n.approvals)==null?void 0:l.pending;if(d==null)return n;let p=[...(s=r==null?void 0:r.additionalSigners)!=null?s:[],t],h=yield Promise.all(d.map(c=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let o=p.find(C=>C.locator()===c.signer.locator);if(o==null)throw new (0, _chunkT3U46LK3cjs.j)(`Signer ${c.signer.locator} not found in pending approvals`);let S=yield o.signMessage(c.message);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},S),{signer:o.locator()})})));return yield this.executeApproveSignatureWithErrorHandling(e,h)})}approveTransactionInternal(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){var l,s,c,o,S;let t=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getTransaction(this.walletLocator,e);if("error"in t)throw new (0, _chunkT3U46LK3cjs.u)(JSON.stringify(t));yield(c=(s=(l=_chunk2GKPWQBQcjs.d.call(void 0, this,y))==null?void 0:l.callbacks)==null?void 0:s.onTransactionStart)==null?void 0:c.call(s);let n=this.requireSigner();if(n.type==="api-key")return t;if((r==null?void 0:r.approval)!=null){let C=[r.approval];return yield this.executeApproveTransactionWithErrorHandling(e,C)}let d=(o=t.approvals)==null?void 0:o.pending;if(d==null)return t;let p=[...(S=r==null?void 0:r.additionalSigners)!=null?S:[],n],h=yield Promise.all(d.map(C=>_chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let F=p.find(le=>le.locator()===C.signer.locator);if(F==null)throw new (0, _chunkT3U46LK3cjs.j)(`Signer ${C.signer.locator} not found in pending approvals`);let K=F.type==="device",D=t.chainType==="solana"&&"transaction"in t.onChain&&!K?t.onChain.transaction:C.message,oe=yield F.signTransaction(D);return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},oe),{signer:F.locator()})})));return yield this.executeApproveTransactionWithErrorHandling(e,h)})}executeApproveTransactionWithErrorHandling(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){_chunkCW2GPBXZcjs.a.info("wallet.approve: submitting approval to API",{transactionId:e});let t=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).approveTransaction(this.walletLocator,e,{approvals:r});if(t.error)throw new (0, _chunkT3U46LK3cjs.z)(JSON.stringify(t));return t})}executeApproveSignatureWithErrorHandling(e,r){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let t=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).approveSignature(this.walletLocator,e,{approvals:r});if(t.error)throw new (0, _chunkT3U46LK3cjs.r)(JSON.stringify(t));return t})}waitForSignature(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){let r=null;do if(yield new Promise(t=>setTimeout(t,_chunkY22BJFQTcjs.d)),r=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getSignature(this.walletLocator,e),"error"in r)throw new (0, _chunkT3U46LK3cjs.q)(JSON.stringify(r));while(r===null||r.status==="pending");if(r.status==="failed")throw new (0, _chunkT3U46LK3cjs.n)("Signature signing failed");if(!r.outputSignature)throw new (0, _chunkT3U46LK3cjs.q)("Signature not available");return{signature:r.outputSignature,signatureId:e}})}waitForTransaction(p){return _chunk2GKPWQBQcjs.g.call(void 0, this,arguments,function*(e,r=6e4,{backoffMultiplier:t=1.1,maxBackoffMs:n=2e3,initialBackoffMs:d=_chunkY22BJFQTcjs.d}={}){var c;_chunkCW2GPBXZcjs.a.info("wallet.approve: waiting for transaction confirmation",{transactionId:e,timeoutMs:r});let h=Date.now(),l;do{if(Date.now()-h>r)throw new (0, _chunkT3U46LK3cjs.v)("Transaction confirmation timeout");if(l=yield _chunk2GKPWQBQcjs.d.call(void 0, this,g).getTransaction(this.walletLocator,e),l.error)throw new (0, _chunkT3U46LK3cjs.u)(JSON.stringify(l));yield this.sleep(d),d=Math.min(d*t,n)}while(l.status==="pending");if(l.status==="failed")throw new (0, _chunkT3U46LK3cjs.w)(`Transaction sending failed: ${JSON.stringify(l.error)}`);if(l.status==="awaiting-approval")throw new (0, _chunkT3U46LK3cjs.x)("Transaction is awaiting approval. Please submit required approvals before waiting for completion.");let s=l.onChain.txId;if(s==null)throw new (0, _chunkT3U46LK3cjs.y)("Transaction hash not found on transaction response");return{hash:s,explorerLink:(c=l.onChain.explorerLink)!=null?c:"",transactionId:l.id}})}sleep(e){return _chunk2GKPWQBQcjs.g.call(void 0, this,null,function*(){return new Promise(r=>setTimeout(r,e))})}};v=new WeakMap,y=new WeakMap,g=new WeakMap,k=new WeakMap,P=new WeakMap,b=new WeakMap,N=new WeakMap,R=new WeakMap,O=new WeakMap,_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.balances",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"balances",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.stagingFund",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"stagingFund",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.send",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"send",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.approve",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"approve",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.addSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"addSigner",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.useSigner",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"useSigner",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.recover",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"recover",1),_chunk2GKPWQBQcjs.c.call(void 0, [_commonsdkbase.WithLoggerContext.call(void 0, {logger:_chunkCW2GPBXZcjs.a,methodName:"wallet.signers",buildContext(e){return{chain:e.chain,address:e.address}}})],A.prototype,"signers",1);function ce(w){if(typeof w=="string"){if(!_commonsdkbase.isValidAddress.call(void 0, w))throw new (0, _chunkT3U46LK3cjs.B)(`Invalid recipient address: "${w}". Expected a valid EVM (0x...), Solana (base58), or Stellar (G.../C...) address.`);return w}if("email"in w)return`email:${w.email}`;if("x"in w)return`x:${w.x}`;if("twitter"in w)return`twitter:${w.twitter}`;if("phone"in w)return`phoneNumber:${w.phone}`;if("userId"in w)return`userId:${w.userId}`;throw new Error("Invalid recipient locator")}function de(w,e){return _commonsdkbase.isValidAddress.call(void 0, w)?`${e}:${w}`:`${e}:${w.toLowerCase()}`}exports.a = A;
|
package/dist/chunk-OXR3FJF4.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk2GKPWQBQcjs = require('./chunk-2GKPWQBQ.cjs');function n(t){switch(t.type){case"passkey":return{type:"passkey",id:t.id,name:t.name,publicKey:t.publicKey,validatorContractVersion:t.validatorContractVersion,locator:t.locator};case"api-key":return{type:"api-key",address:t.address,locator:t.locator};case"external-wallet":return{type:"external-wallet",address:t.address,locator:t.locator};case"email":return{type:"email",email:t.email,address:t.address,locator:t.locator};case"phone":return{type:"phone",phone:t.phone,address:t.address,locator:t.locator};case"device":return{type:"device",publicKey:t.publicKey,locator:t.locator};case"server":return{type:"server",address:t.address,locator:t.locator};default:throw new Error(`Unknown signer type: ${t.type}`)}}function c(t,r){let e=n(t);if(r==="solana"||r==="stellar"){let s="success";return"transaction"in t&&t.transaction!=null&&(s=t.transaction.status),_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:s})}if("chains"in t&&t.chains!=null&&Object.keys(t.chains).length>0){let s=t.chains[r];return s==null?null:_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:s.status})}return _chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},e),{status:"success"})}function u(t,r){let e=_chunk2GKPWQBQcjs.b.call(void 0, _chunk2GKPWQBQcjs.a.call(void 0, {},t),{status:r});return t.locator.indexOf(":")===-1&&(t.type==="api-key"?e.locator=t.locator:(e.locator=`external-wallet:${t.locator}`,e.type="external-wallet")),e}exports.a = n; exports.b = c; exports.c = u;
|