@crossmint/wallets-sdk 0.18.2 → 0.18.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.cjs +9 -1
- package/dist/api/client.d.cts +4 -4
- package/dist/api/client.d.ts +4 -4
- package/dist/api/client.js +9 -1
- package/dist/api/gen/client.gen.cjs +7 -1
- package/dist/api/gen/client.gen.js +7 -1
- package/dist/api/gen/index.cjs +179 -1
- package/dist/api/gen/index.js +179 -1
- package/dist/api/gen/sdk.gen.cjs +178 -1
- package/dist/api/gen/sdk.gen.js +178 -1
- package/dist/api/gen/types.gen.js +1 -1
- package/dist/api/index.cjs +11 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +11 -1
- package/dist/api/types.d.cts +4 -2
- package/dist/api/types.d.ts +4 -2
- package/dist/api/types.js +1 -1
- package/dist/chains/chains.cjs +9 -1
- package/dist/chains/chains.js +9 -1
- package/dist/chains/definitions/story.cjs +7 -1
- package/dist/chains/definitions/story.js +7 -1
- package/dist/chains/definitions/storyTestnet.cjs +7 -1
- package/dist/chains/definitions/storyTestnet.js +7 -1
- package/dist/chunk-2DHIAP2S.js +58 -0
- package/dist/chunk-2T5HHKUI.js +19 -0
- package/dist/chunk-2VOEAAFA.cjs +200 -0
- package/dist/chunk-3U6UAYOV.js +25 -0
- package/dist/chunk-4BMNDPJ4.cjs +92 -0
- package/dist/chunk-4QGBVHV3.js +629 -0
- package/dist/chunk-55V4VMTX.cjs +25 -0
- package/dist/chunk-5H5YHSCK.js +200 -0
- package/dist/chunk-7ECQJFYM.cjs +63 -0
- package/dist/chunk-7GHQBCRV.cjs +57 -0
- package/dist/chunk-7JFVG4IY.js +59 -0
- package/dist/chunk-7QL5JVK4.js +262 -0
- package/dist/chunk-AJCWEEWH.js +73 -0
- package/dist/chunk-AL77JANE.js +36 -0
- package/dist/chunk-BAHU3KZE.cjs +75 -0
- package/dist/chunk-BAULM7A2.js +289 -0
- package/dist/chunk-BFAU2NL6.js +175 -0
- package/dist/chunk-BSC55MYK.cjs +43 -0
- package/dist/chunk-CHGPNMRL.cjs +36 -0
- package/dist/chunk-CN2GVFBU.cjs +138 -0
- package/dist/chunk-COVOGZ4S.js +80 -0
- package/dist/chunk-DPERJZBG.js +63 -0
- package/dist/chunk-DQCXGBZM.js +59 -0
- package/dist/chunk-E4LJ7252.cjs +289 -0
- package/dist/chunk-EM6H7EUU.cjs +80 -0
- package/dist/chunk-EYJQSDDI.js +43 -0
- package/dist/chunk-FAGFW4AR.js +16 -0
- package/dist/chunk-FK23BDCU.js +87 -0
- package/dist/chunk-FPMW7Q5O.js +55 -0
- package/dist/chunk-G5NYLGM5.cjs +55 -0
- package/dist/chunk-HHDDI3CS.js +75 -0
- package/dist/chunk-HNRM45KF.cjs +87 -0
- package/dist/chunk-JICSSJOK.js +57 -0
- package/dist/chunk-KS63YEQ4.js +138 -0
- package/dist/chunk-KT3CVXFG.js +9 -0
- package/dist/chunk-LLFD22UQ.cjs +36 -0
- package/dist/chunk-MPGPBFUZ.cjs +16 -0
- package/dist/chunk-MYKPHXUR.cjs +629 -0
- package/dist/chunk-MZBFXUHT.js +63 -0
- package/dist/chunk-NIBKCMQ2.cjs +19 -0
- package/dist/chunk-OD5RGQ4Z.js +92 -0
- package/dist/chunk-PSPNZEG4.cjs +175 -0
- package/dist/chunk-R2OY54EJ.cjs +59 -0
- package/dist/chunk-RHR6P2KP.cjs +15 -0
- package/dist/chunk-RSPJPRQW.cjs +262 -0
- package/dist/chunk-RTRDZB52.js +778 -0
- package/dist/chunk-SG7WIZLK.cjs +63 -0
- package/dist/chunk-SGINWAB6.js +155 -0
- package/dist/chunk-TK3EUCQ4.cjs +59 -0
- package/dist/chunk-V3QJQUT7.cjs +778 -0
- package/dist/chunk-WC7T2CR4.js +44 -0
- package/dist/chunk-WJUPOCKJ.js +15 -0
- package/dist/chunk-XC2V34TS.cjs +155 -0
- package/dist/chunk-XH3ARVJG.cjs +58 -0
- package/dist/chunk-YBA7WO32.cjs +44 -0
- package/dist/chunk-YOJETSLN.cjs +73 -0
- package/dist/chunk-ZT7EGOCI.cjs +9 -0
- package/dist/chunk-ZTGRDOOH.js +36 -0
- package/dist/index.cjs +55 -1
- package/dist/index.js +55 -1
- package/dist/sdk.cjs +31 -1
- package/dist/sdk.js +31 -1
- package/dist/signers/evm-api-key.cjs +7 -1
- package/dist/signers/evm-api-key.js +7 -1
- package/dist/signers/evm-external-wallet.cjs +7 -1
- package/dist/signers/evm-external-wallet.js +7 -1
- package/dist/signers/index.cjs +21 -1
- package/dist/signers/index.js +21 -1
- package/dist/signers/non-custodial/index.cjs +24 -1
- package/dist/signers/non-custodial/index.js +24 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +10 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +7 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.js +7 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +11 -1
- package/dist/signers/non-custodial/ncs-signer.js +11 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-solana-signer.js +10 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +10 -1
- package/dist/signers/passkey.cjs +7 -1
- package/dist/signers/passkey.js +7 -1
- package/dist/signers/solana-api-key.cjs +7 -1
- package/dist/signers/solana-api-key.js +7 -1
- package/dist/signers/solana-external-wallet.cjs +8 -1
- package/dist/signers/solana-external-wallet.js +8 -1
- package/dist/signers/stellar-external-wallet.cjs +7 -1
- package/dist/signers/stellar-external-wallet.js +7 -1
- package/dist/signers/types.cjs +9 -1
- package/dist/signers/types.js +9 -1
- package/dist/utils/constants.cjs +13 -1
- package/dist/utils/constants.js +13 -1
- package/dist/utils/errors.cjs +55 -1
- package/dist/utils/errors.js +55 -1
- package/dist/utils/signer-validation.cjs +8 -1
- package/dist/utils/signer-validation.js +8 -1
- package/dist/wallets/evm.cjs +20 -1
- package/dist/wallets/evm.js +20 -1
- package/dist/wallets/solana.cjs +18 -1
- package/dist/wallets/solana.js +18 -1
- package/dist/wallets/stellar.cjs +17 -1
- package/dist/wallets/stellar.js +17 -1
- package/dist/wallets/wallet-factory.cjs +25 -1
- package/dist/wallets/wallet-factory.js +25 -1
- package/dist/wallets/wallet.cjs +16 -1
- package/dist/wallets/wallet.d.cts +12 -1
- package/dist/wallets/wallet.d.ts +12 -1
- package/dist/wallets/wallet.js +16 -1
- package/package.json +4 -4
- package/dist/chunk-23ZHV3VD.js +0 -1
- package/dist/chunk-2SHDBC47.js +0 -1
- package/dist/chunk-2XVV7Z43.cjs +0 -1
- package/dist/chunk-2YH3NVVK.cjs +0 -1
- package/dist/chunk-3APSOOE3.js +0 -1
- package/dist/chunk-3IZNWAZE.cjs +0 -1
- package/dist/chunk-4AJT6I6Q.js +0 -1
- package/dist/chunk-4KXOWU5E.cjs +0 -1
- package/dist/chunk-5M7IRODB.js +0 -1
- package/dist/chunk-5QIW67NU.cjs +0 -1
- package/dist/chunk-6PVKL5RC.js +0 -1
- package/dist/chunk-73RCBQG5.js +0 -1
- package/dist/chunk-7JIPYRKX.js +0 -1
- package/dist/chunk-7WKKOG6H.cjs +0 -3
- package/dist/chunk-BQZES4ST.js +0 -1
- package/dist/chunk-BW7YYVZE.js +0 -1
- package/dist/chunk-C3T63EC7.cjs +0 -1
- package/dist/chunk-CVZ3RNWV.cjs +0 -1
- package/dist/chunk-GEY574TH.cjs +0 -1
- package/dist/chunk-H4T4IXCF.js +0 -1
- package/dist/chunk-HJ5EDMTA.js +0 -1
- package/dist/chunk-HMPMFEPS.cjs +0 -1
- package/dist/chunk-HPHVJ6BA.cjs +0 -1
- package/dist/chunk-HRSVFJND.cjs +0 -1
- package/dist/chunk-IGBQEAD5.js +0 -1
- package/dist/chunk-IR5WN6FQ.cjs +0 -1
- package/dist/chunk-JUSY5XEE.js +0 -1
- package/dist/chunk-KHSWQE6W.js +0 -1
- package/dist/chunk-KKQBZXFE.js +0 -1
- package/dist/chunk-KO6QYKDX.cjs +0 -1
- package/dist/chunk-KRV3IXJU.cjs +0 -1
- package/dist/chunk-L5L64FWM.js +0 -1
- package/dist/chunk-LW6JSI4J.js +0 -1
- package/dist/chunk-M4TOGGLV.cjs +0 -1
- package/dist/chunk-MQP5VZCA.cjs +0 -1
- package/dist/chunk-NEJPPLYW.cjs +0 -1
- package/dist/chunk-NIKULSJK.cjs +0 -1
- package/dist/chunk-NT4EICOB.cjs +0 -1
- package/dist/chunk-O4FVTK7X.cjs +0 -1
- package/dist/chunk-P6JJHAAV.js +0 -1
- package/dist/chunk-PONCGT2H.cjs +0 -1
- package/dist/chunk-PSXRNSOE.js +0 -1
- package/dist/chunk-R6VFNNAA.js +0 -3
- package/dist/chunk-RJZV72YF.js +0 -1
- package/dist/chunk-S3DYQVRD.js +0 -1
- package/dist/chunk-SHVVA55W.js +0 -1
- package/dist/chunk-STYSP6KL.cjs +0 -1
- package/dist/chunk-UBOWSXW3.js +0 -1
- package/dist/chunk-UNBXKCNN.js +0 -1
- package/dist/chunk-VXFSSEA4.js +0 -1
- package/dist/chunk-VY634F3J.js +0 -1
- package/dist/chunk-WQP2FSVI.js +0 -1
- package/dist/chunk-WYYAPI4G.cjs +0 -1
- package/dist/chunk-WZFHEUWT.cjs +0 -1
- package/dist/chunk-XALFCQKD.cjs +0 -1
- package/dist/chunk-XIRT2EZN.cjs +0 -1
- package/dist/chunk-YWPTI2QO.cjs +0 -1
- package/dist/chunk-YZ4HRYSL.cjs +0 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkRSPJPRQWcjs = require('./chunk-RSPJPRQW.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk2VOEAAFAcjs = require('./chunk-2VOEAAFA.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
10
|
+
|
|
11
|
+
// src/sdk.ts
|
|
12
|
+
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
13
|
+
var CrossmintWallets = class _CrossmintWallets {
|
|
14
|
+
constructor(crossmint) {
|
|
15
|
+
const apiClient = new (0, _chunk2VOEAAFAcjs.ApiClient)(crossmint);
|
|
16
|
+
this.walletFactory = new (0, _chunkRSPJPRQWcjs.WalletFactory)(apiClient);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Initialize the Wallets SDK
|
|
20
|
+
* @param crossmint - Crossmint data (use `createCrossmint` to initialize)
|
|
21
|
+
* @returns A new CrossmintWallets instance
|
|
22
|
+
*/
|
|
23
|
+
static from(crossmint) {
|
|
24
|
+
return new _CrossmintWallets(crossmint);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get or create a wallet, can only be called on the client side
|
|
28
|
+
* @param args - Wallet data
|
|
29
|
+
* @param options - Wallet options
|
|
30
|
+
* @returns An existing wallet or a new wallet
|
|
31
|
+
*/
|
|
32
|
+
getOrCreateWallet(options) {
|
|
33
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
34
|
+
return yield this.walletFactory.getOrCreateWallet(options);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get an existing wallet by its locator, can only be called on the server side
|
|
39
|
+
* @param walletLocator - Wallet locator
|
|
40
|
+
* @param options - Wallet options
|
|
41
|
+
* @returns A wallet if found, throws WalletNotAvailableError if not found
|
|
42
|
+
*/
|
|
43
|
+
getWallet(walletLocator, options) {
|
|
44
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
45
|
+
return yield this.walletFactory.getWallet(walletLocator, options);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Create a new wallet, can only be called on the server side
|
|
50
|
+
* @param options - Wallet options
|
|
51
|
+
* @returns A new wallet
|
|
52
|
+
*/
|
|
53
|
+
createWallet(options) {
|
|
54
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
55
|
+
return yield this.walletFactory.createWallet(options);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
exports.createCrossmint = _commonsdkbase.createCrossmint; exports.CrossmintWallets = CrossmintWallets;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// src/utils/errors.ts
|
|
2
|
+
import { CrossmintSDKError, WalletErrorCode } from "@crossmint/common-sdk-base";
|
|
3
|
+
var InvalidApiKeyError = class extends CrossmintSDKError {
|
|
4
|
+
constructor(message, details) {
|
|
5
|
+
super(message, WalletErrorCode.API_KEY_INVALID, details);
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
var InvalidEnvironmentError = class extends CrossmintSDKError {
|
|
9
|
+
constructor(message, details) {
|
|
10
|
+
super(message, WalletErrorCode.ENVIRONMENT_INVALID, details);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var WalletTypeNotSupportedError = class extends CrossmintSDKError {
|
|
14
|
+
constructor(message, details) {
|
|
15
|
+
super(message, WalletErrorCode.WALLET_TYPE_INVALID, details);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
var WalletNotAvailableError = class extends CrossmintSDKError {
|
|
19
|
+
constructor(message, details) {
|
|
20
|
+
super(message, WalletErrorCode.WALLET_NOT_AVAILABLE, details);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var InvalidWalletConfigError = class extends CrossmintSDKError {
|
|
24
|
+
constructor(message, details) {
|
|
25
|
+
super(message, WalletErrorCode.WALLET_NOT_AVAILABLE, details);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
var WalletCreationError = class extends CrossmintSDKError {
|
|
29
|
+
constructor(message, details) {
|
|
30
|
+
super(message, WalletErrorCode.WALLET_CREATION_FAILED, details);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
var WalletTypeMismatchError = class extends CrossmintSDKError {
|
|
34
|
+
constructor(message, details) {
|
|
35
|
+
super(message, WalletErrorCode.WALLET_TYPE_INVALID, details);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var SignerTypeMismatchError = class extends CrossmintSDKError {
|
|
39
|
+
constructor(message, details) {
|
|
40
|
+
super(message, WalletErrorCode.SIGNER_INVALID, details);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var InvalidSignerError = class extends CrossmintSDKError {
|
|
44
|
+
constructor(message, details) {
|
|
45
|
+
super(message, WalletErrorCode.SIGNER_INVALID, details);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var InvalidMessageFormatError = class extends CrossmintSDKError {
|
|
49
|
+
constructor(message, details) {
|
|
50
|
+
super(message, WalletErrorCode.MESSAGE_INVALID, details);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var InvalidTypedDataError = class extends CrossmintSDKError {
|
|
54
|
+
constructor(message, details) {
|
|
55
|
+
super(message, WalletErrorCode.MESSAGE_INVALID, details);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var SignatureNotFoundError = class extends CrossmintSDKError {
|
|
59
|
+
constructor(message, details) {
|
|
60
|
+
super(message, WalletErrorCode.SIGNING_FAILED, details);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var SigningFailedError = class extends CrossmintSDKError {
|
|
64
|
+
constructor(message, details) {
|
|
65
|
+
super(message, WalletErrorCode.SIGNING_FAILED, details);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
var MessageSigningNotSupportedError = class extends CrossmintSDKError {
|
|
69
|
+
constructor(message, details) {
|
|
70
|
+
super(message, WalletErrorCode.SIGNING_FAILED, details);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
var SignatureNotCreatedError = class extends CrossmintSDKError {
|
|
74
|
+
constructor(message, details) {
|
|
75
|
+
super(message, WalletErrorCode.NO_SIGNATURE, details);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
var SignatureNotAvailableError = class extends CrossmintSDKError {
|
|
79
|
+
constructor(message, details) {
|
|
80
|
+
super(message, WalletErrorCode.NO_SIGNATURE, details);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var SignatureFailedError = class extends CrossmintSDKError {
|
|
84
|
+
constructor(message, details) {
|
|
85
|
+
super(message, WalletErrorCode.SIGNING_FAILED, details);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
var TransactionNotCreatedError = class extends CrossmintSDKError {
|
|
89
|
+
constructor(message, details) {
|
|
90
|
+
super(message, WalletErrorCode.NO_TRANSACTION, details);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var TransactionNotAvailableError = class extends CrossmintSDKError {
|
|
94
|
+
constructor(message, details) {
|
|
95
|
+
super(message, WalletErrorCode.NO_TRANSACTION, details);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
var TransactionConfirmationTimeoutError = class extends CrossmintSDKError {
|
|
99
|
+
constructor(message, details) {
|
|
100
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var TransactionSendingFailedError = class extends CrossmintSDKError {
|
|
104
|
+
constructor(message, details) {
|
|
105
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var TransactionAwaitingApprovalError = class extends CrossmintSDKError {
|
|
109
|
+
constructor(message, details) {
|
|
110
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var TransactionHashNotFoundError = class extends CrossmintSDKError {
|
|
114
|
+
constructor(message, details) {
|
|
115
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var TransactionFailedError = class extends CrossmintSDKError {
|
|
119
|
+
constructor(message, details) {
|
|
120
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var PendingApprovalsError = class extends CrossmintSDKError {
|
|
124
|
+
constructor(message, details) {
|
|
125
|
+
super(message, WalletErrorCode.TRANSACTION_FAILED, details);
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export {
|
|
130
|
+
InvalidApiKeyError,
|
|
131
|
+
InvalidEnvironmentError,
|
|
132
|
+
WalletTypeNotSupportedError,
|
|
133
|
+
WalletNotAvailableError,
|
|
134
|
+
InvalidWalletConfigError,
|
|
135
|
+
WalletCreationError,
|
|
136
|
+
WalletTypeMismatchError,
|
|
137
|
+
SignerTypeMismatchError,
|
|
138
|
+
InvalidSignerError,
|
|
139
|
+
InvalidMessageFormatError,
|
|
140
|
+
InvalidTypedDataError,
|
|
141
|
+
SignatureNotFoundError,
|
|
142
|
+
SigningFailedError,
|
|
143
|
+
MessageSigningNotSupportedError,
|
|
144
|
+
SignatureNotCreatedError,
|
|
145
|
+
SignatureNotAvailableError,
|
|
146
|
+
SignatureFailedError,
|
|
147
|
+
TransactionNotCreatedError,
|
|
148
|
+
TransactionNotAvailableError,
|
|
149
|
+
TransactionConfirmationTimeoutError,
|
|
150
|
+
TransactionSendingFailedError,
|
|
151
|
+
TransactionAwaitingApprovalError,
|
|
152
|
+
TransactionHashNotFoundError,
|
|
153
|
+
TransactionFailedError,
|
|
154
|
+
PendingApprovalsError
|
|
155
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
4
|
+
|
|
5
|
+
// src/signers/non-custodial/ncs-iframe-manager.ts
|
|
6
|
+
var _clientsdkwindow = require('@crossmint/client-sdk-window');
|
|
7
|
+
var _clientsigners = require('@crossmint/client-signers');
|
|
8
|
+
var NcsIframeManager = class {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.handshakeParent = null;
|
|
12
|
+
}
|
|
13
|
+
initialize() {
|
|
14
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
15
|
+
if (this.handshakeParent) {
|
|
16
|
+
return this.handshakeParent;
|
|
17
|
+
}
|
|
18
|
+
const iframeUrl = new URL(_clientsigners.environmentUrlConfig[this.config.environment]);
|
|
19
|
+
iframeUrl.searchParams.set("targetOrigin", window.location.origin);
|
|
20
|
+
const iframeElement = yield this.createInvisibleIFrame(iframeUrl.toString());
|
|
21
|
+
this.handshakeParent = yield _clientsdkwindow.IFrameWindow.init(
|
|
22
|
+
iframeElement,
|
|
23
|
+
{
|
|
24
|
+
targetOrigin: iframeUrl.origin,
|
|
25
|
+
incomingEvents: _clientsigners.signerOutboundEvents,
|
|
26
|
+
outgoingEvents: _clientsigners.signerInboundEvents
|
|
27
|
+
},
|
|
28
|
+
_clientsdkwindow.SignersWindowTransport
|
|
29
|
+
);
|
|
30
|
+
yield this.handshakeParent.handshakeWithChild();
|
|
31
|
+
return this.handshakeParent;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
createInvisibleIFrame(url) {
|
|
35
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
36
|
+
const iframe = document.createElement("iframe");
|
|
37
|
+
iframe.src = url;
|
|
38
|
+
Object.assign(iframe.style, {
|
|
39
|
+
position: "absolute",
|
|
40
|
+
opacity: "0",
|
|
41
|
+
pointerEvents: "none",
|
|
42
|
+
width: "0",
|
|
43
|
+
height: "0",
|
|
44
|
+
border: "none",
|
|
45
|
+
top: "-9999px",
|
|
46
|
+
left: "-9999px"
|
|
47
|
+
});
|
|
48
|
+
return new Promise((resolve, reject) => {
|
|
49
|
+
iframe.onload = () => resolve(iframe);
|
|
50
|
+
iframe.onerror = () => reject(new Error("Failed to load iframe content"));
|
|
51
|
+
document.body.appendChild(iframe);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
exports.NcsIframeManager = NcsIframeManager;
|