@crossmint/wallets-sdk 0.18.14 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/constants.cjs +31 -0
- package/dist/api/__tests__/constants.d.cts +96 -0
- package/dist/api/__tests__/constants.d.ts +96 -0
- package/dist/api/__tests__/constants.js +31 -0
- package/dist/api/__tests__/test-utils.cjs +372 -0
- package/dist/api/__tests__/test-utils.d.cts +99 -0
- package/dist/api/__tests__/test-utils.d.ts +99 -0
- package/dist/api/__tests__/test-utils.js +372 -0
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.js +3 -3
- package/dist/api/gen/types.gen.d.cts +8 -0
- package/dist/api/gen/types.gen.d.ts +8 -0
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/chains/chains.cjs +8 -4
- package/dist/chains/chains.d.cts +3 -1
- package/dist/chains/chains.d.ts +3 -1
- package/dist/chains/chains.js +7 -3
- package/dist/{chunk-AAESOWQL.js → chunk-57HPJVTI.js} +8 -3
- package/dist/{chunk-ADCODBBF.cjs → chunk-5CBGJLA4.cjs} +1 -1
- package/dist/{chunk-CEFMURL3.js → chunk-6EP3PLGP.js} +2 -2
- package/dist/{chunk-ZJZO6LQ3.js → chunk-7EZZGCYI.js} +10 -1
- package/dist/{chunk-THLRRDVV.js → chunk-7NKX266V.js} +39 -5
- package/dist/{chunk-5CTWIW7X.js → chunk-BBYNVHFR.js} +3 -3
- package/dist/{chunk-PUXRHELK.cjs → chunk-C5F6IECX.cjs} +12 -12
- package/dist/{chunk-GROJZ247.cjs → chunk-DIM3X4IX.cjs} +13 -5
- package/dist/{chunk-OPKBL6A2.cjs → chunk-EIZVQAZO.cjs} +54 -20
- package/dist/{chunk-VJ2ZKU3R.js → chunk-ETCH6L2Y.js} +5 -5
- package/dist/{chunk-SWPJZ5JX.cjs → chunk-FQV77LH4.cjs} +3 -3
- package/dist/chunk-G6QJHFSY.cjs +74 -0
- package/dist/{chunk-FV4PV7HU.cjs → chunk-JLW3Q65G.cjs} +6 -6
- package/dist/{chunk-FUMQWMQR.cjs → chunk-JZQYCISB.cjs} +9 -9
- package/dist/{chunk-SEGDDAL2.js → chunk-KE6LX37B.js} +1 -1
- package/dist/{chunk-3PI54IUS.js → chunk-L5IMC3NM.js} +2 -2
- package/dist/{chunk-KIS2P5DM.js → chunk-N65K6TUY.js} +10 -1
- package/dist/{chunk-PST7R25G.cjs → chunk-NXST74TX.cjs} +80 -43
- package/dist/chunk-PJOJIRTY.js +74 -0
- package/dist/{chunk-SGKMU5NX.cjs → chunk-REP547HH.cjs} +36 -13
- package/dist/{chunk-B24CPC6Y.js → chunk-S2AKC2CK.js} +1 -1
- package/dist/{chunk-PCZDMOJH.js → chunk-SUJQZWLJ.js} +2 -2
- package/dist/{chunk-BEJB6ZUK.cjs → chunk-TCNXKNBQ.cjs} +7 -7
- package/dist/{chunk-5TYDRD6D.cjs → chunk-VNPL3HFN.cjs} +12 -3
- package/dist/{chunk-G7TC2YMQ.cjs → chunk-VWENCGQO.cjs} +12 -3
- package/dist/{chunk-LKAE7D7W.js → chunk-W3OYA42M.js} +32 -9
- package/dist/{chunk-ZQACPBUW.js → chunk-XEZBA7I2.js} +58 -21
- package/dist/{chunk-5WJE5X7V.cjs → chunk-XQSMZXBR.cjs} +28 -23
- package/dist/{chunk-NJTKHWXR.js → chunk-XSMIDXUA.js} +15 -7
- package/dist/{chunk-UWKMOJ4D.js → chunk-YF4DYTBM.js} +10 -1
- package/dist/{chunk-2RVPHSR5.cjs → chunk-YFOUZXSM.cjs} +12 -3
- package/dist/{chunk-SB5FTFPM.cjs → chunk-YXFIZNFL.cjs} +9 -9
- package/dist/index.cjs +18 -18
- package/dist/index.js +17 -17
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +17 -12
- package/dist/sdk.js +16 -11
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +8 -8
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
- package/dist/signers/non-custodial/ncs-signer.js +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +10 -8
- package/dist/wallets/__tests__/test-helpers.d.cts +2 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +2 -1
- package/dist/wallets/__tests__/test-helpers.js +9 -7
- package/dist/wallets/evm.cjs +12 -12
- package/dist/wallets/evm.d.cts +20 -0
- package/dist/wallets/evm.d.ts +20 -0
- package/dist/wallets/evm.js +11 -11
- package/dist/wallets/solana.cjs +9 -9
- package/dist/wallets/solana.d.cts +5 -0
- package/dist/wallets/solana.d.ts +5 -0
- package/dist/wallets/solana.js +8 -8
- package/dist/wallets/stellar.cjs +9 -9
- package/dist/wallets/stellar.d.cts +5 -0
- package/dist/wallets/stellar.d.ts +5 -0
- package/dist/wallets/stellar.js +8 -8
- package/dist/wallets/types.d.cts +5 -1
- package/dist/wallets/types.d.ts +5 -1
- package/dist/wallets/wallet-factory.cjs +15 -10
- package/dist/wallets/wallet-factory.d.cts +2 -0
- package/dist/wallets/wallet-factory.d.ts +2 -0
- package/dist/wallets/wallet-factory.js +14 -9
- package/dist/wallets/wallet.cjs +8 -8
- package/dist/wallets/wallet.d.cts +6 -2
- package/dist/wallets/wallet.d.ts +6 -2
- package/dist/wallets/wallet.js +7 -7
- package/package.json +4 -4
|
@@ -6,7 +6,7 @@ var _chunk4GFSUI2Icjs = require('./chunk-4GFSUI2I.cjs');
|
|
|
6
6
|
var _chunkRHR6P2KPcjs = require('./chunk-RHR6P2KP.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -64,7 +64,7 @@ var NonCustodialSigner = class {
|
|
|
64
64
|
}
|
|
65
65
|
initializeTEEConnection() {
|
|
66
66
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
67
|
-
|
|
67
|
+
_chunkFQV77LH4cjs.walletsLogger.info("TEE connection not initialized, initializing now");
|
|
68
68
|
const parsedAPIKey = _commonsdkbase.validateAPIKey.call(void 0, this.config.crossmint.apiKey);
|
|
69
69
|
if (!parsedAPIKey.isValid) {
|
|
70
70
|
throw new Error("Invalid API key");
|
|
@@ -76,7 +76,7 @@ var NonCustodialSigner = class {
|
|
|
76
76
|
if (this.config.clientTEEConnection == null) {
|
|
77
77
|
throw new Error("Failed to initialize TEE connection");
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
_chunkFQV77LH4cjs.walletsLogger.info("TEE connection initialized successfully");
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
handleAuthRequired() {
|
|
@@ -88,6 +88,8 @@ var NonCustodialSigner = class {
|
|
|
88
88
|
`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendEmailWithOtp, verifyOtp, reject) => { /* your UI logic */ }`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
+
_chunkFQV77LH4cjs.walletsLogger.info("get-status: sending request");
|
|
92
|
+
const startTime = Date.now();
|
|
91
93
|
const signerResponse = yield clientTEEConnection.sendAction({
|
|
92
94
|
event: "request:get-status",
|
|
93
95
|
responseEvent: "response:get-status",
|
|
@@ -99,18 +101,26 @@ var NonCustodialSigner = class {
|
|
|
99
101
|
},
|
|
100
102
|
options: DEFAULT_EVENT_OPTIONS
|
|
101
103
|
});
|
|
104
|
+
const durationMs = Date.now() - startTime;
|
|
102
105
|
if ((signerResponse == null ? void 0 : signerResponse.status) !== "success") {
|
|
106
|
+
_chunkFQV77LH4cjs.walletsLogger.error("get-status: failed", {
|
|
107
|
+
status: signerResponse == null ? void 0 : signerResponse.status,
|
|
108
|
+
error: signerResponse == null ? void 0 : signerResponse.error,
|
|
109
|
+
durationMs
|
|
110
|
+
});
|
|
103
111
|
throw new Error(signerResponse == null ? void 0 : signerResponse.error);
|
|
104
112
|
}
|
|
113
|
+
_chunkFQV77LH4cjs.walletsLogger.info("get-status: response received", {
|
|
114
|
+
signerStatus: signerResponse.signerStatus,
|
|
115
|
+
durationMs
|
|
116
|
+
});
|
|
105
117
|
if (signerResponse.signerStatus === "ready") {
|
|
106
118
|
this._needsAuth = false;
|
|
107
119
|
return;
|
|
108
120
|
} else {
|
|
109
121
|
this._needsAuth = true;
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
_chunkSWPJZ5JXcjs.walletsLogger.info("Needs auth", { needsAuth: this._needsAuth });
|
|
113
|
-
_chunkSWPJZ5JXcjs.walletsLogger.info("Config onAuthRequired", { onAuthRequired: this.config.onAuthRequired });
|
|
123
|
+
_chunkFQV77LH4cjs.walletsLogger.info("Auth required, initiating OTP flow", { needsAuth: this._needsAuth });
|
|
114
124
|
const { promise, resolve, reject } = this.createAuthPromise();
|
|
115
125
|
this._authPromise = { promise, resolve, reject };
|
|
116
126
|
if (this.config.onAuthRequired) {
|
|
@@ -120,7 +130,7 @@ var NonCustodialSigner = class {
|
|
|
120
130
|
() => this.sendMessageWithOtp(),
|
|
121
131
|
(otp) => this.verifyOtp(otp),
|
|
122
132
|
() => _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
123
|
-
|
|
133
|
+
_chunkFQV77LH4cjs.walletsLogger.info("Auth rejected", { authRejected: true });
|
|
124
134
|
this._needsAuth = false;
|
|
125
135
|
if (this.config.onAuthRequired != null) {
|
|
126
136
|
yield this.config.onAuthRequired(
|
|
@@ -137,14 +147,14 @@ var NonCustodialSigner = class {
|
|
|
137
147
|
})
|
|
138
148
|
);
|
|
139
149
|
} catch (error) {
|
|
140
|
-
|
|
150
|
+
_chunkFQV77LH4cjs.walletsLogger.error("handleAuthRequired error", { error });
|
|
141
151
|
reject(error);
|
|
142
152
|
}
|
|
143
153
|
}
|
|
144
154
|
try {
|
|
145
155
|
yield promise;
|
|
146
156
|
} catch (error) {
|
|
147
|
-
|
|
157
|
+
_chunkFQV77LH4cjs.walletsLogger.error("handleAuthRequired promise error", { error });
|
|
148
158
|
throw error;
|
|
149
159
|
}
|
|
150
160
|
});
|
|
@@ -176,6 +186,8 @@ var NonCustodialSigner = class {
|
|
|
176
186
|
var _a, _b, _c;
|
|
177
187
|
const handshakeParent = yield this.getTEEConnection();
|
|
178
188
|
const authId = this.getAuthId();
|
|
189
|
+
_chunkFQV77LH4cjs.walletsLogger.info("start-onboarding: sending request");
|
|
190
|
+
const startTime = Date.now();
|
|
179
191
|
const response = yield handshakeParent.sendAction({
|
|
180
192
|
event: "request:start-onboarding",
|
|
181
193
|
responseEvent: "response:start-onboarding",
|
|
@@ -188,12 +200,17 @@ var NonCustodialSigner = class {
|
|
|
188
200
|
},
|
|
189
201
|
options: DEFAULT_EVENT_OPTIONS
|
|
190
202
|
});
|
|
203
|
+
const durationMs = Date.now() - startTime;
|
|
204
|
+
_chunkFQV77LH4cjs.walletsLogger.info("start-onboarding: response received", {
|
|
205
|
+
status: response == null ? void 0 : response.status,
|
|
206
|
+
durationMs
|
|
207
|
+
});
|
|
191
208
|
if ((response == null ? void 0 : response.status) === "success" && response.signerStatus === "ready") {
|
|
192
209
|
this._needsAuth = false;
|
|
193
210
|
return;
|
|
194
211
|
}
|
|
195
212
|
if ((response == null ? void 0 : response.status) === "error") {
|
|
196
|
-
|
|
213
|
+
_chunkFQV77LH4cjs.walletsLogger.error("start-onboarding: failed", { error: response.error });
|
|
197
214
|
(_c = this._authPromise) == null ? void 0 : _c.reject(new Error(response.error || "Failed to initiate OTP process."));
|
|
198
215
|
}
|
|
199
216
|
});
|
|
@@ -210,6 +227,8 @@ var NonCustodialSigner = class {
|
|
|
210
227
|
let response;
|
|
211
228
|
try {
|
|
212
229
|
const handshakeParent = yield this.getTEEConnection();
|
|
230
|
+
_chunkFQV77LH4cjs.walletsLogger.info("complete-onboarding: sending request");
|
|
231
|
+
const startTime = Date.now();
|
|
213
232
|
response = yield handshakeParent.sendAction({
|
|
214
233
|
event: "request:complete-onboarding",
|
|
215
234
|
responseEvent: "response:complete-onboarding",
|
|
@@ -224,8 +243,12 @@ var NonCustodialSigner = class {
|
|
|
224
243
|
},
|
|
225
244
|
options: DEFAULT_EVENT_OPTIONS
|
|
226
245
|
});
|
|
246
|
+
_chunkFQV77LH4cjs.walletsLogger.info("complete-onboarding: response received", {
|
|
247
|
+
status: response == null ? void 0 : response.status,
|
|
248
|
+
durationMs: Date.now() - startTime
|
|
249
|
+
});
|
|
227
250
|
} catch (err) {
|
|
228
|
-
|
|
251
|
+
_chunkFQV77LH4cjs.walletsLogger.error("complete-onboarding: error", { error: err });
|
|
229
252
|
this._needsAuth = true;
|
|
230
253
|
(_c = this._authPromise) == null ? void 0 : _c.reject(err);
|
|
231
254
|
throw err;
|
|
@@ -246,7 +269,7 @@ var NonCustodialSigner = class {
|
|
|
246
269
|
(_d = this._authPromise) == null ? void 0 : _d.resolve();
|
|
247
270
|
return;
|
|
248
271
|
}
|
|
249
|
-
|
|
272
|
+
_chunkFQV77LH4cjs.walletsLogger.error("complete-onboarding: OTP validation failed", { status: response == null ? void 0 : response.status });
|
|
250
273
|
this._needsAuth = true;
|
|
251
274
|
const errorMessage = (response == null ? void 0 : response.status) === "error" ? response.error : "Failed to validate encrypted OTP";
|
|
252
275
|
const error = new Error(errorMessage);
|
|
@@ -286,7 +309,7 @@ var NonCustodialSigner = class {
|
|
|
286
309
|
};
|
|
287
310
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
288
311
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
289
|
-
logger:
|
|
312
|
+
logger: _chunkFQV77LH4cjs.walletsLogger,
|
|
290
313
|
methodName: "handleAuthRequired"
|
|
291
314
|
})
|
|
292
315
|
], NonCustodialSigner.prototype, "handleAuthRequired", 1);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XEZBA7I2.js";
|
|
4
4
|
import {
|
|
5
5
|
SolanaExternalWalletSigner
|
|
6
6
|
} from "./chunk-PIFD6KNH.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-SGINWAB6.js";
|
|
10
10
|
import {
|
|
11
11
|
walletsLogger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-S2AKC2CK.js";
|
|
13
13
|
import {
|
|
14
14
|
__async,
|
|
15
15
|
__decorateClass
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkEIZVQAZOcjs = require('./chunk-EIZVQAZO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkC5F6IECXcjs = require('./chunk-C5F6IECX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -16,10 +16,10 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
16
16
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
17
17
|
var CrossmintWallets = class _CrossmintWallets {
|
|
18
18
|
constructor(crossmint) {
|
|
19
|
-
|
|
20
|
-
const apiClient = new (0,
|
|
21
|
-
this.walletFactory = new (0,
|
|
22
|
-
|
|
19
|
+
_chunkFQV77LH4cjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkC5F6IECXcjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunkEIZVQAZOcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.sdk.initialized");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the Wallets SDK
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkREP547HHcjs = require('./chunk-REP547HH.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -9,7 +12,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
9
12
|
// src/signers/non-custodial/ncs-evm-signer.ts
|
|
10
13
|
var _ox = require('ox');
|
|
11
14
|
var _viem = require('viem');
|
|
12
|
-
var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends
|
|
15
|
+
var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkREP547HHcjs.NonCustodialSigner {
|
|
13
16
|
constructor(config) {
|
|
14
17
|
super(config);
|
|
15
18
|
}
|
|
@@ -31,6 +34,8 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkSGKMU5NXc
|
|
|
31
34
|
yield this.handleAuthRequired();
|
|
32
35
|
const jwt = this.getJwtOrThrow();
|
|
33
36
|
const hexString = raw.replace("0x", "");
|
|
37
|
+
_chunkFQV77LH4cjs.walletsLogger.info("sign: sending request", { keyType: "secp256k1" });
|
|
38
|
+
const startTime = Date.now();
|
|
34
39
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
35
40
|
event: "request:sign",
|
|
36
41
|
responseEvent: "response:sign",
|
|
@@ -45,7 +50,11 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkSGKMU5NXc
|
|
|
45
50
|
encoding: "hex"
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
|
-
options:
|
|
53
|
+
options: _chunkREP547HHcjs.DEFAULT_EVENT_OPTIONS
|
|
54
|
+
});
|
|
55
|
+
_chunkFQV77LH4cjs.walletsLogger.info("sign: response received", {
|
|
56
|
+
status: res == null ? void 0 : res.status,
|
|
57
|
+
durationMs: Date.now() - startTime
|
|
49
58
|
});
|
|
50
59
|
if ((res == null ? void 0 : res.status) === "error") {
|
|
51
60
|
throw new Error(res.error);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkREP547HHcjs = require('./chunk-REP547HH.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
|
|
5
8
|
|
|
6
9
|
|
|
7
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -9,7 +12,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
9
12
|
// src/signers/non-custodial/ncs-solana-signer.ts
|
|
10
13
|
var _web3js = require('@solana/web3.js');
|
|
11
14
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
12
|
-
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends
|
|
15
|
+
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkREP547HHcjs.NonCustodialSigner {
|
|
13
16
|
constructor(config) {
|
|
14
17
|
super(config);
|
|
15
18
|
}
|
|
@@ -26,6 +29,8 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkSGK
|
|
|
26
29
|
const transactionBytes = _bs582.default.decode(transaction);
|
|
27
30
|
const deserializedTransaction = _web3js.VersionedTransaction.deserialize(transactionBytes);
|
|
28
31
|
const messageData = deserializedTransaction.message.serialize();
|
|
32
|
+
_chunkFQV77LH4cjs.walletsLogger.info("sign: sending request", { keyType: "ed25519" });
|
|
33
|
+
const startTime = Date.now();
|
|
29
34
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
30
35
|
event: "request:sign",
|
|
31
36
|
responseEvent: "response:sign",
|
|
@@ -40,7 +45,11 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkSGK
|
|
|
40
45
|
encoding: "base58"
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
|
-
options:
|
|
48
|
+
options: _chunkREP547HHcjs.DEFAULT_EVENT_OPTIONS
|
|
49
|
+
});
|
|
50
|
+
_chunkFQV77LH4cjs.walletsLogger.info("sign: response received", {
|
|
51
|
+
status: res == null ? void 0 : res.status,
|
|
52
|
+
durationMs: Date.now() - startTime
|
|
44
53
|
});
|
|
45
54
|
if ((res == null ? void 0 : res.status) === "error") {
|
|
46
55
|
throw new Error(res.error);
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
} from "./chunk-WJUPOCKJ.js";
|
|
7
7
|
import {
|
|
8
8
|
walletsLogger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-S2AKC2CK.js";
|
|
10
10
|
import {
|
|
11
11
|
__async,
|
|
12
12
|
__decorateClass
|
|
@@ -64,7 +64,7 @@ var NonCustodialSigner = class {
|
|
|
64
64
|
}
|
|
65
65
|
initializeTEEConnection() {
|
|
66
66
|
return __async(this, null, function* () {
|
|
67
|
-
|
|
67
|
+
walletsLogger.info("TEE connection not initialized, initializing now");
|
|
68
68
|
const parsedAPIKey = validateAPIKey(this.config.crossmint.apiKey);
|
|
69
69
|
if (!parsedAPIKey.isValid) {
|
|
70
70
|
throw new Error("Invalid API key");
|
|
@@ -76,7 +76,7 @@ var NonCustodialSigner = class {
|
|
|
76
76
|
if (this.config.clientTEEConnection == null) {
|
|
77
77
|
throw new Error("Failed to initialize TEE connection");
|
|
78
78
|
}
|
|
79
|
-
|
|
79
|
+
walletsLogger.info("TEE connection initialized successfully");
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
82
|
handleAuthRequired() {
|
|
@@ -88,6 +88,8 @@ var NonCustodialSigner = class {
|
|
|
88
88
|
`${this.type} signer requires the onAuthRequired callback to handle OTP verification. This callback manages the authentication flow (sending OTP and verifying user input). If using our React/React Native SDK, this is handled automatically by the provider. For other environments, implement: onAuthRequired: (needsAuth, sendEmailWithOtp, verifyOtp, reject) => { /* your UI logic */ }`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
+
walletsLogger.info("get-status: sending request");
|
|
92
|
+
const startTime = Date.now();
|
|
91
93
|
const signerResponse = yield clientTEEConnection.sendAction({
|
|
92
94
|
event: "request:get-status",
|
|
93
95
|
responseEvent: "response:get-status",
|
|
@@ -99,18 +101,26 @@ var NonCustodialSigner = class {
|
|
|
99
101
|
},
|
|
100
102
|
options: DEFAULT_EVENT_OPTIONS
|
|
101
103
|
});
|
|
104
|
+
const durationMs = Date.now() - startTime;
|
|
102
105
|
if ((signerResponse == null ? void 0 : signerResponse.status) !== "success") {
|
|
106
|
+
walletsLogger.error("get-status: failed", {
|
|
107
|
+
status: signerResponse == null ? void 0 : signerResponse.status,
|
|
108
|
+
error: signerResponse == null ? void 0 : signerResponse.error,
|
|
109
|
+
durationMs
|
|
110
|
+
});
|
|
103
111
|
throw new Error(signerResponse == null ? void 0 : signerResponse.error);
|
|
104
112
|
}
|
|
113
|
+
walletsLogger.info("get-status: response received", {
|
|
114
|
+
signerStatus: signerResponse.signerStatus,
|
|
115
|
+
durationMs
|
|
116
|
+
});
|
|
105
117
|
if (signerResponse.signerStatus === "ready") {
|
|
106
118
|
this._needsAuth = false;
|
|
107
119
|
return;
|
|
108
120
|
} else {
|
|
109
121
|
this._needsAuth = true;
|
|
110
122
|
}
|
|
111
|
-
walletsLogger.info("
|
|
112
|
-
walletsLogger.info("Needs auth", { needsAuth: this._needsAuth });
|
|
113
|
-
walletsLogger.info("Config onAuthRequired", { onAuthRequired: this.config.onAuthRequired });
|
|
123
|
+
walletsLogger.info("Auth required, initiating OTP flow", { needsAuth: this._needsAuth });
|
|
114
124
|
const { promise, resolve, reject } = this.createAuthPromise();
|
|
115
125
|
this._authPromise = { promise, resolve, reject };
|
|
116
126
|
if (this.config.onAuthRequired) {
|
|
@@ -176,6 +186,8 @@ var NonCustodialSigner = class {
|
|
|
176
186
|
var _a, _b, _c;
|
|
177
187
|
const handshakeParent = yield this.getTEEConnection();
|
|
178
188
|
const authId = this.getAuthId();
|
|
189
|
+
walletsLogger.info("start-onboarding: sending request");
|
|
190
|
+
const startTime = Date.now();
|
|
179
191
|
const response = yield handshakeParent.sendAction({
|
|
180
192
|
event: "request:start-onboarding",
|
|
181
193
|
responseEvent: "response:start-onboarding",
|
|
@@ -188,12 +200,17 @@ var NonCustodialSigner = class {
|
|
|
188
200
|
},
|
|
189
201
|
options: DEFAULT_EVENT_OPTIONS
|
|
190
202
|
});
|
|
203
|
+
const durationMs = Date.now() - startTime;
|
|
204
|
+
walletsLogger.info("start-onboarding: response received", {
|
|
205
|
+
status: response == null ? void 0 : response.status,
|
|
206
|
+
durationMs
|
|
207
|
+
});
|
|
191
208
|
if ((response == null ? void 0 : response.status) === "success" && response.signerStatus === "ready") {
|
|
192
209
|
this._needsAuth = false;
|
|
193
210
|
return;
|
|
194
211
|
}
|
|
195
212
|
if ((response == null ? void 0 : response.status) === "error") {
|
|
196
|
-
|
|
213
|
+
walletsLogger.error("start-onboarding: failed", { error: response.error });
|
|
197
214
|
(_c = this._authPromise) == null ? void 0 : _c.reject(new Error(response.error || "Failed to initiate OTP process."));
|
|
198
215
|
}
|
|
199
216
|
});
|
|
@@ -210,6 +227,8 @@ var NonCustodialSigner = class {
|
|
|
210
227
|
let response;
|
|
211
228
|
try {
|
|
212
229
|
const handshakeParent = yield this.getTEEConnection();
|
|
230
|
+
walletsLogger.info("complete-onboarding: sending request");
|
|
231
|
+
const startTime = Date.now();
|
|
213
232
|
response = yield handshakeParent.sendAction({
|
|
214
233
|
event: "request:complete-onboarding",
|
|
215
234
|
responseEvent: "response:complete-onboarding",
|
|
@@ -224,8 +243,12 @@ var NonCustodialSigner = class {
|
|
|
224
243
|
},
|
|
225
244
|
options: DEFAULT_EVENT_OPTIONS
|
|
226
245
|
});
|
|
246
|
+
walletsLogger.info("complete-onboarding: response received", {
|
|
247
|
+
status: response == null ? void 0 : response.status,
|
|
248
|
+
durationMs: Date.now() - startTime
|
|
249
|
+
});
|
|
227
250
|
} catch (err) {
|
|
228
|
-
|
|
251
|
+
walletsLogger.error("complete-onboarding: error", { error: err });
|
|
229
252
|
this._needsAuth = true;
|
|
230
253
|
(_c = this._authPromise) == null ? void 0 : _c.reject(err);
|
|
231
254
|
throw err;
|
|
@@ -246,7 +269,7 @@ var NonCustodialSigner = class {
|
|
|
246
269
|
(_d = this._authPromise) == null ? void 0 : _d.resolve();
|
|
247
270
|
return;
|
|
248
271
|
}
|
|
249
|
-
|
|
272
|
+
walletsLogger.error("complete-onboarding: OTP validation failed", { status: response == null ? void 0 : response.status });
|
|
250
273
|
this._needsAuth = true;
|
|
251
274
|
const errorMessage = (response == null ? void 0 : response.status) === "error" ? response.error : "Failed to validate encrypted OTP";
|
|
252
275
|
const error = new Error(errorMessage);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NonCustodialSigner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W3OYA42M.js";
|
|
4
4
|
import {
|
|
5
5
|
InvalidSignerError,
|
|
6
6
|
SignatureFailedError,
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
} from "./chunk-SGINWAB6.js";
|
|
19
19
|
import {
|
|
20
20
|
walletsLogger
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-S2AKC2CK.js";
|
|
22
22
|
import {
|
|
23
23
|
STATUS_POLLING_INTERVAL_MS
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-KE6LX37B.js";
|
|
25
25
|
import {
|
|
26
26
|
__async,
|
|
27
27
|
__decorateClass,
|
|
@@ -98,7 +98,10 @@ var Wallet = class {
|
|
|
98
98
|
}
|
|
99
99
|
stagingFund(amount, chain) {
|
|
100
100
|
return __async(this, null, function* () {
|
|
101
|
-
walletsLogger.info("wallet.stagingFund.start", {
|
|
101
|
+
walletsLogger.info("wallet.stagingFund.start", {
|
|
102
|
+
amount,
|
|
103
|
+
chain: chain != null ? chain : this.chain
|
|
104
|
+
});
|
|
102
105
|
const response = yield this.apiClient.fundWallet(this.address, {
|
|
103
106
|
amount,
|
|
104
107
|
token: "usdxm",
|
|
@@ -107,7 +110,9 @@ var Wallet = class {
|
|
|
107
110
|
chain: chain != null ? chain : this.chain
|
|
108
111
|
});
|
|
109
112
|
if ("error" in response) {
|
|
110
|
-
walletsLogger.error("wallet.stagingFund.error", {
|
|
113
|
+
walletsLogger.error("wallet.stagingFund.error", {
|
|
114
|
+
error: response
|
|
115
|
+
});
|
|
111
116
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
112
117
|
}
|
|
113
118
|
walletsLogger.info("wallet.stagingFund.success");
|
|
@@ -128,7 +133,9 @@ var Wallet = class {
|
|
|
128
133
|
} else if (this.chain === "stellar" && chainData != null && "contractId" in chainData) {
|
|
129
134
|
chainSpecificField = { contractId: chainData.contractId };
|
|
130
135
|
} else if (chainData != null && "contractAddress" in chainData) {
|
|
131
|
-
chainSpecificField = {
|
|
136
|
+
chainSpecificField = {
|
|
137
|
+
contractAddress: chainData.contractAddress
|
|
138
|
+
};
|
|
132
139
|
}
|
|
133
140
|
return __spreadValues({
|
|
134
141
|
symbol: (_b = tokenData.symbol) != null ? _b : "",
|
|
@@ -231,21 +238,29 @@ var Wallet = class {
|
|
|
231
238
|
return __async(this, null, function* () {
|
|
232
239
|
const recipient = toRecipientLocator(to);
|
|
233
240
|
const tokenLocator = toTokenLocator(token, this.chain);
|
|
234
|
-
walletsLogger.info("wallet.send.start", {
|
|
241
|
+
walletsLogger.info("wallet.send.start", __spreadValues({
|
|
242
|
+
recipient,
|
|
243
|
+
token: tokenLocator,
|
|
244
|
+
amount
|
|
245
|
+
}, (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {}));
|
|
235
246
|
yield this.preAuthIfNeeded();
|
|
236
|
-
const sendParams = __spreadValues({
|
|
247
|
+
const sendParams = __spreadValues(__spreadValues({
|
|
237
248
|
recipient,
|
|
238
249
|
amount
|
|
239
|
-
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {});
|
|
250
|
+
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
240
251
|
const transactionCreationResponse = yield __privateGet(this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
241
252
|
if ("message" in transactionCreationResponse) {
|
|
242
|
-
walletsLogger.error("wallet.send.error", {
|
|
253
|
+
walletsLogger.error("wallet.send.error", {
|
|
254
|
+
error: transactionCreationResponse
|
|
255
|
+
});
|
|
243
256
|
throw new TransactionNotCreatedError(
|
|
244
257
|
`Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
|
|
245
258
|
);
|
|
246
259
|
}
|
|
247
260
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
248
|
-
walletsLogger.info("wallet.send.prepared", {
|
|
261
|
+
walletsLogger.info("wallet.send.prepared", {
|
|
262
|
+
transactionId: transactionCreationResponse.id
|
|
263
|
+
});
|
|
249
264
|
return {
|
|
250
265
|
hash: void 0,
|
|
251
266
|
explorerLink: void 0,
|
|
@@ -290,12 +305,16 @@ var Wallet = class {
|
|
|
290
305
|
params.transactionId,
|
|
291
306
|
params.options
|
|
292
307
|
);
|
|
293
|
-
walletsLogger.info("wallet.approve.success", {
|
|
308
|
+
walletsLogger.info("wallet.approve.success", {
|
|
309
|
+
transactionId: params.transactionId
|
|
310
|
+
});
|
|
294
311
|
return result;
|
|
295
312
|
}
|
|
296
313
|
if (params.signatureId != null) {
|
|
297
314
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
298
|
-
walletsLogger.info("wallet.approve.success", {
|
|
315
|
+
walletsLogger.info("wallet.approve.success", {
|
|
316
|
+
signatureId: params.signatureId
|
|
317
|
+
});
|
|
299
318
|
return result;
|
|
300
319
|
}
|
|
301
320
|
walletsLogger.error("wallet.approve.error", {
|
|
@@ -313,7 +332,9 @@ var Wallet = class {
|
|
|
313
332
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
314
333
|
});
|
|
315
334
|
if ("error" in response) {
|
|
316
|
-
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
335
|
+
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
336
|
+
error: response
|
|
337
|
+
});
|
|
317
338
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
318
339
|
}
|
|
319
340
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
@@ -325,11 +346,15 @@ var Wallet = class {
|
|
|
325
346
|
}
|
|
326
347
|
const transactionId = response.transaction.id;
|
|
327
348
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
328
|
-
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
349
|
+
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
350
|
+
transactionId
|
|
351
|
+
});
|
|
329
352
|
return { transactionId };
|
|
330
353
|
}
|
|
331
354
|
yield this.approveTransactionAndWait(transactionId);
|
|
332
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
355
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
356
|
+
transactionId
|
|
357
|
+
});
|
|
333
358
|
return void 0;
|
|
334
359
|
}
|
|
335
360
|
if (!("chains" in response)) {
|
|
@@ -341,17 +366,23 @@ var Wallet = class {
|
|
|
341
366
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
342
367
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
343
368
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
344
|
-
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
369
|
+
walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
370
|
+
signatureId
|
|
371
|
+
});
|
|
345
372
|
return { signatureId };
|
|
346
373
|
}
|
|
347
374
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
348
375
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
349
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
376
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
377
|
+
signatureId: chainResponse.id
|
|
378
|
+
});
|
|
350
379
|
return void 0;
|
|
351
380
|
}
|
|
352
381
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
353
382
|
yield this.waitForSignature(chainResponse.id);
|
|
354
|
-
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
383
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
384
|
+
signatureId: chainResponse.id
|
|
385
|
+
});
|
|
355
386
|
return void 0;
|
|
356
387
|
}
|
|
357
388
|
walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
@@ -364,7 +395,9 @@ var Wallet = class {
|
|
|
364
395
|
walletsLogger.info("wallet.delegatedSigners.start");
|
|
365
396
|
const walletResponse = yield __privateGet(this, _apiClient).getWallet(this.walletLocator);
|
|
366
397
|
if ("error" in walletResponse) {
|
|
367
|
-
walletsLogger.error("wallet.delegatedSigners.error", {
|
|
398
|
+
walletsLogger.error("wallet.delegatedSigners.error", {
|
|
399
|
+
error: walletResponse
|
|
400
|
+
});
|
|
368
401
|
throw new WalletNotAvailableError(JSON.stringify(walletResponse));
|
|
369
402
|
}
|
|
370
403
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
@@ -380,7 +413,9 @@ var Wallet = class {
|
|
|
380
413
|
signer: `external-wallet:${address}`
|
|
381
414
|
};
|
|
382
415
|
})) != null ? _c : [];
|
|
383
|
-
walletsLogger.info("wallet.delegatedSigners.success", {
|
|
416
|
+
walletsLogger.info("wallet.delegatedSigners.success", {
|
|
417
|
+
count: signers.length
|
|
418
|
+
});
|
|
384
419
|
return signers;
|
|
385
420
|
});
|
|
386
421
|
}
|
|
@@ -509,6 +544,7 @@ var Wallet = class {
|
|
|
509
544
|
}
|
|
510
545
|
executeApproveTransactionWithErrorHandling(transactionId, approvals) {
|
|
511
546
|
return __async(this, null, function* () {
|
|
547
|
+
walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
|
|
512
548
|
const approvedTransaction = yield __privateGet(this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
|
|
513
549
|
approvals
|
|
514
550
|
});
|
|
@@ -558,6 +594,7 @@ var Wallet = class {
|
|
|
558
594
|
initialBackoffMs = STATUS_POLLING_INTERVAL_MS
|
|
559
595
|
} = {}) {
|
|
560
596
|
var _a;
|
|
597
|
+
walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
|
|
561
598
|
const startTime = Date.now();
|
|
562
599
|
let transactionResponse;
|
|
563
600
|
do {
|