@crossmint/wallets-sdk 0.20.2 → 0.21.1

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.
Files changed (161) hide show
  1. package/dist/api/__tests__/test-utils.cjs +8 -8
  2. package/dist/api/__tests__/test-utils.d.cts +3 -3
  3. package/dist/api/__tests__/test-utils.d.ts +3 -3
  4. package/dist/api/__tests__/test-utils.js +6 -6
  5. package/dist/api/client.cjs +4 -4
  6. package/dist/api/client.d.cts +1 -0
  7. package/dist/api/client.d.ts +1 -0
  8. package/dist/api/client.js +3 -3
  9. package/dist/api/gen/index.cjs +3 -103
  10. package/dist/api/gen/index.d.cts +2 -2
  11. package/dist/api/gen/index.d.ts +2 -2
  12. package/dist/api/gen/index.js +6 -106
  13. package/dist/api/gen/sdk.gen.cjs +2 -102
  14. package/dist/api/gen/sdk.gen.d.cts +22 -370
  15. package/dist/api/gen/sdk.gen.d.ts +22 -370
  16. package/dist/api/gen/sdk.gen.js +5 -105
  17. package/dist/api/gen/types.gen.d.cts +2558 -5712
  18. package/dist/api/gen/types.gen.d.ts +2558 -5712
  19. package/dist/api/index.cjs +4 -4
  20. package/dist/api/index.js +3 -3
  21. package/dist/api/types.d.cts +12 -12
  22. package/dist/api/types.d.ts +12 -12
  23. package/dist/chains/chains.cjs +4 -4
  24. package/dist/chains/chains.js +3 -3
  25. package/dist/{chunk-6FG5QXII.cjs → chunk-2YGFMFQH.cjs} +20 -11
  26. package/dist/{chunk-47R3UV3J.cjs → chunk-357M7AYZ.cjs} +11 -6
  27. package/dist/chunk-4MEGQR3I.js +40 -0
  28. package/dist/chunk-5IC7UWND.cjs +1 -0
  29. package/dist/{chunk-ZAX22GSI.cjs → chunk-5NWGYER3.cjs} +18 -18
  30. package/dist/{chunk-RYQI3RXL.cjs → chunk-67C2QSRT.cjs} +18 -12
  31. package/dist/{chunk-CMBFV325.js → chunk-772Z6PBD.js} +3 -3
  32. package/dist/{chunk-JREZWZ2S.cjs → chunk-BJQHHI7K.cjs} +3 -3
  33. package/dist/chunk-BR4UVMIC.js +332 -0
  34. package/dist/chunk-BUBSPQ7U.cjs +332 -0
  35. package/dist/{chunk-FHMKNG62.js → chunk-CUE4X7Y4.js} +24 -8
  36. package/dist/chunk-DDNG224J.cjs +45 -0
  37. package/dist/{chunk-FICVKSXZ.js → chunk-FBUGIHIP.js} +2 -2
  38. package/dist/{chunk-HXJ3YPAN.js → chunk-GIHJEXL7.js} +13 -4
  39. package/dist/chunk-GJT2JD3E.js +45 -0
  40. package/dist/chunk-H6WV5NRT.js +10 -0
  41. package/dist/chunk-HWTWDQYT.cjs +42 -0
  42. package/dist/{chunk-66UY53KP.cjs → chunk-I3KIMQEV.cjs} +80 -37
  43. package/dist/chunk-IGRPHTXZ.cjs +1 -0
  44. package/dist/{chunk-IDKGJO2G.cjs → chunk-IL6J7SYU.cjs} +21 -11
  45. package/dist/chunk-IXDC5JR2.js +316 -0
  46. package/dist/{chunk-7TT3VUDF.cjs → chunk-IZQHJM2P.cjs} +6 -6
  47. package/dist/chunk-J65ILI3Y.cjs +44 -0
  48. package/dist/chunk-JD77GNRZ.cjs +40 -0
  49. package/dist/{chunk-PUO4QNXH.js → chunk-JO7QKDU4.js} +2 -2
  50. package/dist/{chunk-KQH5ZXJ4.js → chunk-JP6227LZ.js} +61 -18
  51. package/dist/{chunk-POG76HDD.cjs → chunk-JUS5BKF2.cjs} +64 -48
  52. package/dist/chunk-K6LSGLG6.js +42 -0
  53. package/dist/chunk-KEDMRERX.cjs +29 -0
  54. package/dist/{chunk-W7K5E64Q.js → chunk-KSN7G2DH.js} +8 -2
  55. package/dist/chunk-L52GDMSH.js +0 -0
  56. package/dist/{chunk-U3NV7UY7.js → chunk-LDVEJ2XZ.js} +1 -1
  57. package/dist/{chunk-PM7BGATN.cjs → chunk-LIUDLEBE.cjs} +34 -25
  58. package/dist/{chunk-6UMJYMAY.js → chunk-LQWOPRRW.js} +2 -2
  59. package/dist/chunk-M6E6A543.cjs +316 -0
  60. package/dist/chunk-MNHK6EQK.cjs +57 -0
  61. package/dist/{chunk-2WBSPOWU.js → chunk-NBBOYFQW.js} +1 -1
  62. package/dist/{chunk-A6E67ZZP.js → chunk-OBKOVQQJ.js} +14 -5
  63. package/dist/{chunk-TYQ4YIP7.js → chunk-PC3YMFJM.js} +1 -1
  64. package/dist/chunk-Q52MMQSC.js +57 -0
  65. package/dist/chunk-QM3BB4E2.js +0 -0
  66. package/dist/{chunk-R6DH4V7S.cjs → chunk-QMSFEJPD.cjs} +7 -7
  67. package/dist/{chunk-T2XUADHW.js → chunk-QPVKMB34.js} +10 -5
  68. package/dist/chunk-RUQYXEEG.cjs +10 -0
  69. package/dist/{chunk-WHTECI7J.cjs → chunk-RZYHYTWY.cjs} +6 -6
  70. package/dist/{chunk-ABMZ3ZVN.js → chunk-SIP7NNGL.js} +1 -1
  71. package/dist/{chunk-WDZY4PP4.cjs → chunk-UBWFRFQ6.cjs} +3 -3
  72. package/dist/{chunk-R4AW5ADG.cjs → chunk-WATHSVAQ.cjs} +1 -1
  73. package/dist/chunk-WQZLYIIG.js +44 -0
  74. package/dist/chunk-WXIYTJDM.js +29 -0
  75. package/dist/{chunk-WWW6IGZ7.js → chunk-Y2DLCE7H.js} +14 -4
  76. package/dist/{chunk-MRZXYVQO.cjs → chunk-ZXQHWKZN.cjs} +6 -6
  77. package/dist/index.cjs +26 -16
  78. package/dist/index.d.cts +1 -1
  79. package/dist/index.d.ts +1 -1
  80. package/dist/index.js +25 -15
  81. package/dist/logger/index.cjs +3 -3
  82. package/dist/logger/index.js +2 -2
  83. package/dist/logger/init.cjs +3 -3
  84. package/dist/logger/init.js +2 -2
  85. package/dist/sdk.cjs +23 -13
  86. package/dist/sdk.js +22 -12
  87. package/dist/signers/index.cjs +18 -8
  88. package/dist/signers/index.js +17 -7
  89. package/dist/signers/non-custodial/index.cjs +7 -7
  90. package/dist/signers/non-custodial/index.js +8 -8
  91. package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
  92. package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
  93. package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
  94. package/dist/signers/non-custodial/ncs-signer.js +3 -3
  95. package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
  96. package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
  97. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
  98. package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
  99. package/dist/signers/server/assemble-server-signer.cjs +15 -0
  100. package/dist/signers/server/assemble-server-signer.d.cts +11 -0
  101. package/dist/signers/server/assemble-server-signer.d.ts +11 -0
  102. package/dist/signers/server/assemble-server-signer.js +15 -0
  103. package/dist/signers/server/evm-server-signer.cjs +7 -0
  104. package/dist/signers/server/evm-server-signer.d.cts +25 -0
  105. package/dist/signers/server/evm-server-signer.d.ts +25 -0
  106. package/dist/signers/server/evm-server-signer.js +7 -0
  107. package/dist/signers/server/helpers/derive-server-signer.cjs +12 -0
  108. package/dist/signers/server/helpers/derive-server-signer.d.cts +15 -0
  109. package/dist/signers/server/helpers/derive-server-signer.d.ts +15 -0
  110. package/dist/signers/server/helpers/derive-server-signer.js +12 -0
  111. package/dist/signers/server/helpers/get-chain-type.cjs +7 -0
  112. package/dist/signers/server/helpers/get-chain-type.d.cts +7 -0
  113. package/dist/signers/server/helpers/get-chain-type.d.ts +7 -0
  114. package/dist/signers/server/helpers/get-chain-type.js +7 -0
  115. package/dist/signers/server/helpers/index.cjs +16 -0
  116. package/dist/signers/server/helpers/index.d.cts +9 -0
  117. package/dist/signers/server/helpers/index.d.ts +9 -0
  118. package/dist/signers/server/helpers/index.js +16 -0
  119. package/dist/signers/server/index.cjs +30 -0
  120. package/dist/signers/server/index.d.cts +12 -0
  121. package/dist/signers/server/index.d.ts +12 -0
  122. package/dist/signers/server/index.js +30 -0
  123. package/dist/signers/server/solana-server-signer.cjs +7 -0
  124. package/dist/signers/server/solana-server-signer.d.cts +25 -0
  125. package/dist/signers/server/solana-server-signer.d.ts +25 -0
  126. package/dist/signers/server/solana-server-signer.js +7 -0
  127. package/dist/signers/server/stellar-server-signer.cjs +8 -0
  128. package/dist/signers/server/stellar-server-signer.d.cts +25 -0
  129. package/dist/signers/server/stellar-server-signer.d.ts +25 -0
  130. package/dist/signers/server/stellar-server-signer.js +8 -0
  131. package/dist/signers/types.d.cts +15 -3
  132. package/dist/signers/types.d.ts +15 -3
  133. package/dist/utils/constants.cjs +2 -2
  134. package/dist/utils/constants.js +1 -1
  135. package/dist/utils/server-key-derivation.cjs +9 -0
  136. package/dist/utils/server-key-derivation.d.cts +20 -0
  137. package/dist/utils/server-key-derivation.d.ts +20 -0
  138. package/dist/utils/server-key-derivation.js +9 -0
  139. package/dist/utils/stellar.cjs +11 -0
  140. package/dist/utils/stellar.d.cts +18 -0
  141. package/dist/utils/stellar.d.ts +18 -0
  142. package/dist/utils/stellar.js +11 -0
  143. package/dist/wallets/__tests__/test-helpers.cjs +19 -9
  144. package/dist/wallets/__tests__/test-helpers.js +18 -8
  145. package/dist/wallets/evm.cjs +20 -10
  146. package/dist/wallets/evm.js +19 -9
  147. package/dist/wallets/solana.cjs +20 -10
  148. package/dist/wallets/solana.js +19 -9
  149. package/dist/wallets/stellar.cjs +20 -10
  150. package/dist/wallets/stellar.js +19 -9
  151. package/dist/wallets/types.d.cts +7 -4
  152. package/dist/wallets/types.d.ts +7 -4
  153. package/dist/wallets/wallet-factory.cjs +21 -11
  154. package/dist/wallets/wallet-factory.js +20 -10
  155. package/dist/wallets/wallet.cjs +19 -9
  156. package/dist/wallets/wallet.d.cts +2 -2
  157. package/dist/wallets/wallet.d.ts +2 -2
  158. package/dist/wallets/wallet.js +18 -8
  159. package/package.json +3 -3
  160. package/dist/chunk-BMMZIPXT.js +0 -778
  161. package/dist/chunk-COR3CNRW.cjs +0 -778
@@ -1,9 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkPOG76HDDcjs = require('./chunk-POG76HDD.cjs');
3
+ var _chunkJUS5BKF2cjs = require('./chunk-JUS5BKF2.cjs');
4
4
 
5
5
 
6
- var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
6
+ var _chunkJD77GNRZcjs = require('./chunk-JD77GNRZ.cjs');
7
+
8
+
9
+ var _chunkUBWFRFQ6cjs = require('./chunk-UBWFRFQ6.cjs');
7
10
 
8
11
 
9
12
 
@@ -11,7 +14,7 @@ var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
11
14
  var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
12
15
 
13
16
 
14
- var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
17
+ var _chunkBJQHHI7Kcjs = require('./chunk-BJQHHI7K.cjs');
15
18
 
16
19
 
17
20
 
@@ -20,7 +23,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
20
23
  // src/wallets/evm.ts
21
24
  var _viem = require('viem');
22
25
  var _commonsdkbase = require('@crossmint/common-sdk-base');
23
- var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
26
+ var _EVMWallet = class _EVMWallet extends _chunkJUS5BKF2cjs.Wallet {
24
27
  constructor(wallet) {
25
28
  super(
26
29
  {
@@ -28,10 +31,10 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
28
31
  address: wallet.address,
29
32
  owner: wallet.owner,
30
33
  signer: wallet.signer,
31
- options: _chunkPOG76HDDcjs.Wallet.getOptions(wallet),
34
+ options: _chunkJUS5BKF2cjs.Wallet.getOptions(wallet),
32
35
  alias: wallet.alias
33
36
  },
34
- _chunkPOG76HDDcjs.Wallet.getApiClient(wallet)
37
+ _chunkJUS5BKF2cjs.Wallet.getApiClient(wallet)
35
38
  );
36
39
  }
37
40
  static from(wallet) {
@@ -43,12 +46,12 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
43
46
  sendTransaction(params) {
44
47
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
45
48
  var _a;
46
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.start");
49
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.sendTransaction.start");
47
50
  yield this.preAuthIfNeeded();
48
51
  const builtTransaction = this.buildTransaction(params);
49
52
  const createdTransaction = yield this.createTransaction(builtTransaction, params.options);
50
53
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
51
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
54
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
52
55
  transactionId: createdTransaction.id
53
56
  });
54
57
  return {
@@ -58,7 +61,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
58
61
  };
59
62
  }
60
63
  const result = yield this.approveTransactionAndWait(createdTransaction.id);
61
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.success", {
64
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.sendTransaction.success", {
62
65
  transactionId: createdTransaction.id,
63
66
  hash: result.hash
64
67
  });
@@ -68,7 +71,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
68
71
  signMessage(params) {
69
72
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
70
73
  var _a;
71
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.start");
74
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signMessage.start");
72
75
  yield this.preAuthIfNeeded();
73
76
  const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
74
77
  type: "message",
@@ -79,11 +82,11 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
79
82
  }
80
83
  });
81
84
  if ("error" in signatureCreationResponse) {
82
- _chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
85
+ _chunkBJQHHI7Kcjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
83
86
  throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
84
87
  }
85
88
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
86
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.prepared", {
89
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signMessage.prepared", {
87
90
  signatureId: signatureCreationResponse.id
88
91
  });
89
92
  return {
@@ -92,23 +95,23 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
92
95
  };
93
96
  }
94
97
  const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
95
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
98
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
96
99
  return result;
97
100
  });
98
101
  }
99
102
  signTypedData(params) {
100
103
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
101
104
  var _a;
102
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.start");
105
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signTypedData.start");
103
106
  yield this.preAuthIfNeeded();
104
107
  const { domain, message, primaryType, types, chain } = params;
105
108
  if (!domain || !message || !types || !chain) {
106
- _chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
109
+ _chunkBJQHHI7Kcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
107
110
  throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data");
108
111
  }
109
112
  const { name, version, chainId, verifyingContract, salt } = domain;
110
113
  if (!name || !version || !chainId || !verifyingContract) {
111
- _chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
114
+ _chunkBJQHHI7Kcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
112
115
  throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data domain");
113
116
  }
114
117
  const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
@@ -131,11 +134,11 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
131
134
  }
132
135
  });
133
136
  if ("error" in signatureCreationResponse) {
134
- _chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
137
+ _chunkBJQHHI7Kcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
135
138
  throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
136
139
  }
137
140
  if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
138
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
141
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
139
142
  signatureId: signatureCreationResponse.id
140
143
  });
141
144
  return {
@@ -144,7 +147,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
144
147
  };
145
148
  }
146
149
  const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
147
- _chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
150
+ _chunkBJQHHI7Kcjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
148
151
  return result;
149
152
  });
150
153
  }
@@ -157,13 +160,19 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
157
160
  var _a;
158
161
  return _viem.createPublicClient.call(void 0, {
159
162
  transport: (_a = params == null ? void 0 : params.transport) != null ? _a : _viem.http.call(void 0, ),
160
- chain: _chunkWDZY4PP4cjs.toViemChain.call(void 0, this.chain)
163
+ chain: _chunkUBWFRFQ6cjs.toViemChain.call(void 0, this.chain)
161
164
  });
162
165
  }
163
166
  createTransaction(transaction, options) {
164
167
  return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
165
- var _a;
166
- const signer = (_a = options == null ? void 0 : options.experimental_signer) != null ? _a : this.signer.locator();
168
+ let signer;
169
+ if ((options == null ? void 0 : options.experimental_signer) == null) {
170
+ signer = this.signer.locator();
171
+ } else if (typeof options.experimental_signer === "string") {
172
+ signer = options.experimental_signer;
173
+ } else {
174
+ signer = `server:${_chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0, options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
175
+ }
167
176
  const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
168
177
  params: {
169
178
  signer,
@@ -205,7 +214,7 @@ var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
205
214
  };
206
215
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
207
216
  _commonsdkbase.WithLoggerContext.call(void 0, {
208
- logger: _chunkJREZWZ2Scjs.walletsLogger,
217
+ logger: _chunkBJQHHI7Kcjs.walletsLogger,
209
218
  methodName: "evmWallet.sendTransaction",
210
219
  buildContext(thisArg) {
211
220
  return { chain: thisArg.chain, address: thisArg.address };
@@ -214,7 +223,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
214
223
  ], _EVMWallet.prototype, "sendTransaction", 1);
215
224
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
216
225
  _commonsdkbase.WithLoggerContext.call(void 0, {
217
- logger: _chunkJREZWZ2Scjs.walletsLogger,
226
+ logger: _chunkBJQHHI7Kcjs.walletsLogger,
218
227
  methodName: "evmWallet.signMessage",
219
228
  buildContext(thisArg) {
220
229
  return { chain: thisArg.chain, address: thisArg.address };
@@ -223,7 +232,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
223
232
  ], _EVMWallet.prototype, "signMessage", 1);
224
233
  _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
225
234
  _commonsdkbase.WithLoggerContext.call(void 0, {
226
- logger: _chunkJREZWZ2Scjs.walletsLogger,
235
+ logger: _chunkBJQHHI7Kcjs.walletsLogger,
227
236
  methodName: "evmWallet.signTypedData",
228
237
  buildContext(thisArg) {
229
238
  return { chain: thisArg.chain, address: thisArg.address };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  DEFAULT_EVENT_OPTIONS,
3
3
  NonCustodialSigner
4
- } from "./chunk-U3NV7UY7.js";
4
+ } from "./chunk-LDVEJ2XZ.js";
5
5
  import {
6
6
  walletsLogger
7
- } from "./chunk-ABMZ3ZVN.js";
7
+ } from "./chunk-SIP7NNGL.js";
8
8
  import {
9
9
  __async
10
10
  } from "./chunk-ASE2FXWP.js";
@@ -0,0 +1,316 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/utils/stellar.ts
2
+ var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);
3
+ var ED25519_PUBLIC_KEY_VERSION_BYTE = 6 << 3;
4
+ var BASE32_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
5
+ var CRC16_TABLE = [
6
+ 0,
7
+ 4129,
8
+ 8258,
9
+ 12387,
10
+ 16516,
11
+ 20645,
12
+ 24774,
13
+ 28903,
14
+ 33032,
15
+ 37161,
16
+ 41290,
17
+ 45419,
18
+ 49548,
19
+ 53677,
20
+ 57806,
21
+ 61935,
22
+ 4657,
23
+ 528,
24
+ 12915,
25
+ 8786,
26
+ 21173,
27
+ 17044,
28
+ 29431,
29
+ 25302,
30
+ 37689,
31
+ 33560,
32
+ 45947,
33
+ 41818,
34
+ 54205,
35
+ 50076,
36
+ 62463,
37
+ 58334,
38
+ 9314,
39
+ 13379,
40
+ 1056,
41
+ 5121,
42
+ 25830,
43
+ 29895,
44
+ 17572,
45
+ 21637,
46
+ 42346,
47
+ 46411,
48
+ 34088,
49
+ 38153,
50
+ 58862,
51
+ 62927,
52
+ 50604,
53
+ 54669,
54
+ 13907,
55
+ 9842,
56
+ 5649,
57
+ 1584,
58
+ 30423,
59
+ 26358,
60
+ 22165,
61
+ 18100,
62
+ 46939,
63
+ 42874,
64
+ 38681,
65
+ 34616,
66
+ 63455,
67
+ 59390,
68
+ 55197,
69
+ 51132,
70
+ 18628,
71
+ 22757,
72
+ 26758,
73
+ 30887,
74
+ 2112,
75
+ 6241,
76
+ 10242,
77
+ 14371,
78
+ 51660,
79
+ 55789,
80
+ 59790,
81
+ 63919,
82
+ 35144,
83
+ 39273,
84
+ 43274,
85
+ 47403,
86
+ 23285,
87
+ 19156,
88
+ 31415,
89
+ 27286,
90
+ 6769,
91
+ 2640,
92
+ 14899,
93
+ 10770,
94
+ 56317,
95
+ 52188,
96
+ 64447,
97
+ 60318,
98
+ 39801,
99
+ 35672,
100
+ 47931,
101
+ 43802,
102
+ 27814,
103
+ 31879,
104
+ 19684,
105
+ 23749,
106
+ 11298,
107
+ 15363,
108
+ 3168,
109
+ 7233,
110
+ 60846,
111
+ 64911,
112
+ 52716,
113
+ 56781,
114
+ 44330,
115
+ 48395,
116
+ 36200,
117
+ 40265,
118
+ 32407,
119
+ 28342,
120
+ 24277,
121
+ 20212,
122
+ 15891,
123
+ 11826,
124
+ 7761,
125
+ 3696,
126
+ 65439,
127
+ 61374,
128
+ 57309,
129
+ 53244,
130
+ 48923,
131
+ 44858,
132
+ 40793,
133
+ 36728,
134
+ 37256,
135
+ 33193,
136
+ 45514,
137
+ 41451,
138
+ 53516,
139
+ 49453,
140
+ 61774,
141
+ 57711,
142
+ 4224,
143
+ 161,
144
+ 12482,
145
+ 8419,
146
+ 20484,
147
+ 16421,
148
+ 28742,
149
+ 24679,
150
+ 33721,
151
+ 37784,
152
+ 41979,
153
+ 46042,
154
+ 49981,
155
+ 54044,
156
+ 58239,
157
+ 62302,
158
+ 689,
159
+ 4752,
160
+ 8947,
161
+ 13010,
162
+ 16949,
163
+ 21012,
164
+ 25207,
165
+ 29270,
166
+ 46570,
167
+ 42443,
168
+ 38312,
169
+ 34185,
170
+ 62830,
171
+ 58703,
172
+ 54572,
173
+ 50445,
174
+ 13538,
175
+ 9411,
176
+ 5280,
177
+ 1153,
178
+ 29798,
179
+ 25671,
180
+ 21540,
181
+ 17413,
182
+ 42971,
183
+ 47098,
184
+ 34713,
185
+ 38840,
186
+ 59231,
187
+ 63358,
188
+ 50973,
189
+ 55100,
190
+ 9939,
191
+ 14066,
192
+ 1681,
193
+ 5808,
194
+ 26199,
195
+ 30326,
196
+ 17941,
197
+ 22068,
198
+ 55628,
199
+ 51565,
200
+ 63758,
201
+ 59695,
202
+ 39368,
203
+ 35305,
204
+ 47498,
205
+ 43435,
206
+ 22596,
207
+ 18533,
208
+ 30726,
209
+ 26663,
210
+ 6336,
211
+ 2273,
212
+ 14466,
213
+ 10403,
214
+ 52093,
215
+ 56156,
216
+ 60223,
217
+ 64286,
218
+ 35833,
219
+ 39896,
220
+ 43963,
221
+ 48026,
222
+ 19061,
223
+ 23124,
224
+ 27191,
225
+ 31254,
226
+ 2801,
227
+ 6864,
228
+ 10931,
229
+ 14994,
230
+ 64814,
231
+ 60687,
232
+ 56684,
233
+ 52557,
234
+ 48554,
235
+ 44427,
236
+ 40424,
237
+ 36297,
238
+ 31782,
239
+ 27655,
240
+ 23652,
241
+ 19525,
242
+ 15522,
243
+ 11395,
244
+ 7392,
245
+ 3265,
246
+ 61215,
247
+ 65342,
248
+ 53085,
249
+ 57212,
250
+ 44955,
251
+ 49082,
252
+ 36825,
253
+ 40952,
254
+ 28183,
255
+ 32310,
256
+ 20053,
257
+ 24180,
258
+ 11923,
259
+ 16050,
260
+ 3793,
261
+ 7920
262
+ ];
263
+ function crc16Xmodem(data) {
264
+ let crc = 0;
265
+ for (let i = 0; i < data.length; i++) {
266
+ const byte = data[i];
267
+ crc = (crc << 8 ^ CRC16_TABLE[crc >> 8 ^ byte]) & 65535;
268
+ }
269
+ const checksum = new Uint8Array(2);
270
+ checksum[0] = crc & 255;
271
+ checksum[1] = crc >> 8 & 255;
272
+ return checksum;
273
+ }
274
+ function base32Encode(data) {
275
+ let bits = 0;
276
+ let value = 0;
277
+ let output = "";
278
+ for (let i = 0; i < data.length; i++) {
279
+ value = value << 8 | data[i];
280
+ bits += 8;
281
+ while (bits >= 5) {
282
+ output += BASE32_ALPHABET[value >>> bits - 5 & 31];
283
+ bits -= 5;
284
+ }
285
+ }
286
+ if (bits > 0) {
287
+ output += BASE32_ALPHABET[value << 5 - bits & 31];
288
+ }
289
+ while (output.length % 8 !== 0) {
290
+ output += "=";
291
+ }
292
+ return output;
293
+ }
294
+ function encodeStellarPublicKey(publicKeyBytes) {
295
+ const payload = new Uint8Array(1 + publicKeyBytes.length);
296
+ payload[0] = ED25519_PUBLIC_KEY_VERSION_BYTE;
297
+ payload.set(publicKeyBytes, 1);
298
+ const checksum = crc16Xmodem(payload);
299
+ const unencoded = new Uint8Array(payload.length + 2);
300
+ unencoded.set(payload, 0);
301
+ unencoded.set(checksum, payload.length);
302
+ return base32Encode(unencoded);
303
+ }
304
+ function ed25519KeypairFromSeed(seed) {
305
+ const keypair = _tweetnacl2.default.sign.keyPair.fromSeed(seed);
306
+ return { publicKey: keypair.publicKey, secretKey: keypair.secretKey };
307
+ }
308
+ function ed25519Sign(message, secretKey) {
309
+ return _tweetnacl2.default.sign.detached(message, secretKey);
310
+ }
311
+
312
+
313
+
314
+
315
+
316
+ exports.encodeStellarPublicKey = encodeStellarPublicKey; exports.ed25519KeypairFromSeed = ed25519KeypairFromSeed; exports.ed25519Sign = ed25519Sign;
@@ -0,0 +1,57 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/server-key-derivation.ts
2
+ var _hkdf = require('@noble/hashes/hkdf');
3
+ var _sha2 = require('@noble/hashes/sha2');
4
+ var _utils = require('@noble/hashes/utils');
5
+ var HKDF_SALT = "crossmint";
6
+ var SECRET_PREFIX = "xmsk1_";
7
+ function deriveKeyBytes(secret, projectId, environment, chain) {
8
+ const rawSecret = stripAndValidateSecret(secret);
9
+ const ikm = hexToBytes(rawSecret);
10
+ const algorithm = getAlgorithmForChain(chain);
11
+ const info = `${projectId}:${environment}:${chain}-${algorithm}`;
12
+ return _hkdf.hkdf.call(void 0, _sha2.sha256, ikm, HKDF_SALT, info, 32);
13
+ }
14
+ function deriveAlias(secret, projectId, environment, chain) {
15
+ const rawSecret = stripAndValidateSecret(secret);
16
+ const ikm = hexToBytes(rawSecret);
17
+ const info = `${projectId}:${environment}:${chain}-alias`;
18
+ const derived = _hkdf.hkdf.call(void 0, _sha2.sha256, ikm, HKDF_SALT, info, 17);
19
+ return `s-${_utils.bytesToHex.call(void 0, derived).slice(0, 34)}`;
20
+ }
21
+ var EXPECTED_SECRET_LENGTH = 64;
22
+ function stripAndValidateSecret(secret) {
23
+ const rawSecret = secret.startsWith(SECRET_PREFIX) ? secret.slice(SECRET_PREFIX.length) : secret;
24
+ if (rawSecret.length !== EXPECTED_SECRET_LENGTH) {
25
+ throw new Error(
26
+ `Invalid server signer secret: expected ${EXPECTED_SECRET_LENGTH}-char hex string (256-bit), got ${rawSecret.length} chars`
27
+ );
28
+ }
29
+ return rawSecret;
30
+ }
31
+ function getAlgorithmForChain(chain) {
32
+ if (chain === "solana") {
33
+ return "ed25519";
34
+ }
35
+ if (chain === "stellar") {
36
+ return "ed25519";
37
+ }
38
+ return "secp256k1";
39
+ }
40
+ function hexToBytes(hex) {
41
+ if (hex.length % 2 !== 0) {
42
+ throw new Error(`Invalid hex string: odd length (${hex.length})`);
43
+ }
44
+ if (!/^[0-9a-fA-F]+$/.test(hex)) {
45
+ throw new Error("Invalid hex string: contains non-hex characters");
46
+ }
47
+ const bytes = new Uint8Array(hex.length / 2);
48
+ for (let i = 0; i < hex.length; i += 2) {
49
+ bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
50
+ }
51
+ return bytes;
52
+ }
53
+
54
+
55
+
56
+
57
+ exports.deriveKeyBytes = deriveKeyBytes; exports.deriveAlias = deriveAlias;
@@ -18,7 +18,7 @@ import {
18
18
  } from "./chunk-SGINWAB6.js";
19
19
  import {
20
20
  walletsLogger
21
- } from "./chunk-ABMZ3ZVN.js";
21
+ } from "./chunk-SIP7NNGL.js";
22
22
 
23
23
  // src/chains/chains.ts
24
24
  import { APIKeyEnvironmentPrefix, BlockchainIncludingTestnet as Blockchain } from "@crossmint/common-sdk-base";
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  Wallet
3
- } from "./chunk-FHMKNG62.js";
3
+ } from "./chunk-CUE4X7Y4.js";
4
+ import {
5
+ deriveServerSignerDetails
6
+ } from "./chunk-4MEGQR3I.js";
4
7
  import {
5
8
  toViemChain
6
- } from "./chunk-2WBSPOWU.js";
9
+ } from "./chunk-NBBOYFQW.js";
7
10
  import {
8
11
  InvalidTypedDataError,
9
12
  SignatureNotCreatedError,
@@ -11,7 +14,7 @@ import {
11
14
  } from "./chunk-SGINWAB6.js";
12
15
  import {
13
16
  walletsLogger
14
- } from "./chunk-ABMZ3ZVN.js";
17
+ } from "./chunk-SIP7NNGL.js";
15
18
  import {
16
19
  __async,
17
20
  __decorateClass
@@ -162,8 +165,14 @@ var _EVMWallet = class _EVMWallet extends Wallet {
162
165
  }
163
166
  createTransaction(transaction, options) {
164
167
  return __async(this, null, function* () {
165
- var _a;
166
- const signer = (_a = options == null ? void 0 : options.experimental_signer) != null ? _a : this.signer.locator();
168
+ let signer;
169
+ if ((options == null ? void 0 : options.experimental_signer) == null) {
170
+ signer = this.signer.locator();
171
+ } else if (typeof options.experimental_signer === "string") {
172
+ signer = options.experimental_signer;
173
+ } else {
174
+ signer = `server:${deriveServerSignerDetails(options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
175
+ }
167
176
  const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
168
177
  params: {
169
178
  signer,
@@ -1,6 +1,6 @@
1
1
  // package.json
2
2
  var name = "@crossmint/wallets-sdk";
3
- var version = "0.20.2";
3
+ var version = "0.21.1";
4
4
 
5
5
  // src/utils/constants.ts
6
6
  var WALLETS_SERVICE = "WALLETS_SDK";
@@ -0,0 +1,57 @@
1
+ // src/utils/server-key-derivation.ts
2
+ import { hkdf } from "@noble/hashes/hkdf";
3
+ import { sha256 } from "@noble/hashes/sha2";
4
+ import { bytesToHex } from "@noble/hashes/utils";
5
+ var HKDF_SALT = "crossmint";
6
+ var SECRET_PREFIX = "xmsk1_";
7
+ function deriveKeyBytes(secret, projectId, environment, chain) {
8
+ const rawSecret = stripAndValidateSecret(secret);
9
+ const ikm = hexToBytes(rawSecret);
10
+ const algorithm = getAlgorithmForChain(chain);
11
+ const info = `${projectId}:${environment}:${chain}-${algorithm}`;
12
+ return hkdf(sha256, ikm, HKDF_SALT, info, 32);
13
+ }
14
+ function deriveAlias(secret, projectId, environment, chain) {
15
+ const rawSecret = stripAndValidateSecret(secret);
16
+ const ikm = hexToBytes(rawSecret);
17
+ const info = `${projectId}:${environment}:${chain}-alias`;
18
+ const derived = hkdf(sha256, ikm, HKDF_SALT, info, 17);
19
+ return `s-${bytesToHex(derived).slice(0, 34)}`;
20
+ }
21
+ var EXPECTED_SECRET_LENGTH = 64;
22
+ function stripAndValidateSecret(secret) {
23
+ const rawSecret = secret.startsWith(SECRET_PREFIX) ? secret.slice(SECRET_PREFIX.length) : secret;
24
+ if (rawSecret.length !== EXPECTED_SECRET_LENGTH) {
25
+ throw new Error(
26
+ `Invalid server signer secret: expected ${EXPECTED_SECRET_LENGTH}-char hex string (256-bit), got ${rawSecret.length} chars`
27
+ );
28
+ }
29
+ return rawSecret;
30
+ }
31
+ function getAlgorithmForChain(chain) {
32
+ if (chain === "solana") {
33
+ return "ed25519";
34
+ }
35
+ if (chain === "stellar") {
36
+ return "ed25519";
37
+ }
38
+ return "secp256k1";
39
+ }
40
+ function hexToBytes(hex) {
41
+ if (hex.length % 2 !== 0) {
42
+ throw new Error(`Invalid hex string: odd length (${hex.length})`);
43
+ }
44
+ if (!/^[0-9a-fA-F]+$/.test(hex)) {
45
+ throw new Error("Invalid hex string: contains non-hex characters");
46
+ }
47
+ const bytes = new Uint8Array(hex.length / 2);
48
+ for (let i = 0; i < hex.length; i += 2) {
49
+ bytes[i / 2] = parseInt(hex.slice(i, i + 2), 16);
50
+ }
51
+ return bytes;
52
+ }
53
+
54
+ export {
55
+ deriveKeyBytes,
56
+ deriveAlias
57
+ };
File without changes