@effectstream/frontend-sdk 0.101.0 → 0.102.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/LICENSE-APACHE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024-2026 Midnight Foundation
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/LICENSE-MIT ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-2026 Midnight Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/mod.js CHANGED
@@ -6135,15 +6135,26 @@ __export(exports_crypto, {
6135
6135
  Cipheriv: () => Cipheriv2,
6136
6136
  Cipher: () => Cipher2
6137
6137
  });
6138
+ function __accessProp2(key) {
6139
+ return this[key];
6140
+ }
6138
6141
  function getCurves() {
6139
6142
  return hardcoded_curves;
6140
6143
  }
6141
- var __create, __getProtoOf, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESM = (mod5, isNodeMode, target) => {
6144
+ var __create, __getProtoOf, __defProp2, __getOwnPropNames2, __hasOwnProp2, __toESMCache_node, __toESMCache_esm, __toESM = (mod5, isNodeMode, target) => {
6145
+ var canCache = mod5 != null && typeof mod5 === "object";
6146
+ if (canCache) {
6147
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap, cached = cache.get(mod5);
6148
+ if (cached)
6149
+ return cached;
6150
+ }
6142
6151
  target = mod5 != null ? __create(__getProtoOf(mod5)) : {};
6143
6152
  let to = isNodeMode || !mod5 || !mod5.__esModule ? __defProp2(target, "default", { value: mod5, enumerable: true }) : target;
6144
6153
  for (let key of __getOwnPropNames2(mod5))
6145
6154
  if (!__hasOwnProp2.call(to, key))
6146
- __defProp2(to, key, { get: () => mod5[key], enumerable: true });
6155
+ __defProp2(to, key, { get: __accessProp2.bind(mod5, key), enumerable: true });
6156
+ if (canCache)
6157
+ cache.set(mod5, to);
6147
6158
  return to;
6148
6159
  }, __commonJS2 = (cb, mod5) => () => (mod5 || cb((mod5 = { exports: {} }).exports, mod5), mod5.exports), require_randombytes, require_create_hash, require_create_hmac, require_algorithms, require_precondition, require_default_encoding, require_safe_buffer, require_isarray, require_type, require_es_object_atoms, require_es_errors, require_eval, require_range, require_ref, require_syntax, require_uri, require_abs, require_floor, require_max, require_min, require_pow, require_round, require_isNaN, require_sign, require_gOPD, require_gopd, require_es_define_property, require_shams, require_has_symbols, require_Reflect_getPrototypeOf, require_Object_getPrototypeOf, require_implementation, require_function_bind, require_functionCall, require_functionApply, require_reflectApply, require_actualApply, require_call_bind_apply_helpers, require_get, require_get_proto, require_hasown, require_get_intrinsic, require_call_bound, require_is_callable, require_for_each, require_possible_typed_array_names, require_available_typed_arrays, require_define_data_property, require_has_property_descriptors, require_set_function_length, require_applyBind, require_call_bind, require_shams2, require_which_typed_array, require_is_typed_array, require_typed_array_buffer, require_to_buffer, require_to_buffer2, require_sync, require_async, require_pbkdf2, require_browserify_cipher, require_diffie_hellman, require_browserify_sign, require_package, require_bn, require_minimalistic_assert, require_utils, require_utils2, require_brorand, require_base, require_inherits_browser, require_inherits, require_short, require_mont, require_edwards, require_curve, require_utils3, require_common, require_common2, require_1, require_256, require_224, require_512, require_384, require_sha, require_ripemd, require_hmac, require_hash, require_secp256k1, require_curves, require_hmac_drbg, require_key, require_signature, require_ec, require_key2, require_signature2, require_eddsa, require_elliptic, require_bn2, require_browser, require_create_ecdh, require_bn3, require_api, require_reporter, require_buffer, require_node, require_base2, require_der, require_constants, require_der2, require_pem, require_decoders, require_der3, require_pem2, require_encoders, require_asn1, require_certificate, require_asn12, require_aesid, require_hash_base, require_md5, require_evp_bytestokey, require_browserify_aes, require_fixProc, require_parse_asn1, require_mgf, require_xor, require_bn4, require_withPublic, require_bn5, require_browserify_rsa, require_publicEncrypt, require_privateDecrypt, require_browser2, require_public_encrypt, require_browser3, require_randomfill, require_crypto_browserify, cryptoBrowserify, prng2, pseudoRandomBytes2, rng2, randomBytes2, Hash2, createHash2, Hmac2, createHmac2, getHashes2, pbkdf22, pbkdf2Sync2, Cipher2, createCipher2, Cipheriv2, createCipheriv2, Decipher2, createDecipher2, Decipheriv2, createDecipheriv2, getCiphers2, listCiphers2, DiffieHellmanGroup2, createDiffieHellmanGroup2, getDiffieHellman2, createDiffieHellman2, DiffieHellman2, createSign2, Sign2, createVerify2, Verify2, createECDH2, publicEncrypt2, privateEncrypt2, publicDecrypt2, privateDecrypt2, randomFill2, randomFillSync2, createCredentials2, constants22, DEFAULT_ENCODING = "buffer", getRandomValues = (array) => {
6149
6160
  return crypto.getRandomValues(array);
@@ -8289,18 +8300,18 @@ var init_crypto = __esm(() => {
8289
8300
  }, BN._prime = function(name) {
8290
8301
  if (primes[name])
8291
8302
  return primes[name];
8292
- var prime;
8303
+ var prime2;
8293
8304
  if (name === "k256")
8294
- prime = new K256;
8305
+ prime2 = new K256;
8295
8306
  else if (name === "p224")
8296
- prime = new P224;
8307
+ prime2 = new P224;
8297
8308
  else if (name === "p192")
8298
- prime = new P192;
8309
+ prime2 = new P192;
8299
8310
  else if (name === "p25519")
8300
- prime = new P25519;
8311
+ prime2 = new P25519;
8301
8312
  else
8302
8313
  throw Error("Unknown prime " + name);
8303
- return primes[name] = prime, prime;
8314
+ return primes[name] = prime2, prime2;
8304
8315
  };
8305
8316
  function Red(m) {
8306
8317
  if (typeof m === "string") {
@@ -11964,18 +11975,18 @@ var init_crypto = __esm(() => {
11964
11975
  }, BN._prime = function(name) {
11965
11976
  if (primes[name])
11966
11977
  return primes[name];
11967
- var prime;
11978
+ var prime2;
11968
11979
  if (name === "k256")
11969
- prime = new K256;
11980
+ prime2 = new K256;
11970
11981
  else if (name === "p224")
11971
- prime = new P224;
11982
+ prime2 = new P224;
11972
11983
  else if (name === "p192")
11973
- prime = new P192;
11984
+ prime2 = new P192;
11974
11985
  else if (name === "p25519")
11975
- prime = new P25519;
11986
+ prime2 = new P25519;
11976
11987
  else
11977
11988
  throw Error("Unknown prime " + name);
11978
- return primes[name] = prime, prime;
11989
+ return primes[name] = prime2, prime2;
11979
11990
  };
11980
11991
  function Red(m) {
11981
11992
  if (typeof m === "string") {
@@ -13427,18 +13438,18 @@ var init_crypto = __esm(() => {
13427
13438
  }, BN._prime = function(name) {
13428
13439
  if (primes[name])
13429
13440
  return primes[name];
13430
- var prime;
13441
+ var prime2;
13431
13442
  if (name === "k256")
13432
- prime = new K256;
13443
+ prime2 = new K256;
13433
13444
  else if (name === "p224")
13434
- prime = new P224;
13445
+ prime2 = new P224;
13435
13446
  else if (name === "p192")
13436
- prime = new P192;
13447
+ prime2 = new P192;
13437
13448
  else if (name === "p25519")
13438
- prime = new P25519;
13449
+ prime2 = new P25519;
13439
13450
  else
13440
13451
  throw Error("Unknown prime " + name);
13441
- return primes[name] = prime, prime;
13452
+ return primes[name] = prime2, prime2;
13442
13453
  };
13443
13454
  function Red(m) {
13444
13455
  if (typeof m === "string") {
@@ -14660,10 +14671,10 @@ var init_crypto = __esm(() => {
14660
14671
  exports.RSAPublicKey = RSAPublicKey;
14661
14672
  var AlgorithmIdentifier = asn1.define("AlgorithmIdentifier", function() {
14662
14673
  this.seq().obj(this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve").objid().optional(), this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this.key("g").int()).optional());
14663
- }), PublicKey = asn1.define("SubjectPublicKeyInfo", function() {
14674
+ }), PublicKey2 = asn1.define("SubjectPublicKeyInfo", function() {
14664
14675
  this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPublicKey").bitstr());
14665
14676
  });
14666
- exports.PublicKey = PublicKey;
14677
+ exports.PublicKey = PublicKey2;
14667
14678
  var PrivateKeyInfo = asn1.define("PrivateKeyInfo", function() {
14668
14679
  this.seq().obj(this.key("version").int(), this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPrivateKey").octstr());
14669
14680
  });
@@ -16168,18 +16179,18 @@ var init_crypto = __esm(() => {
16168
16179
  }, BN._prime = function(name) {
16169
16180
  if (primes[name])
16170
16181
  return primes[name];
16171
- var prime;
16182
+ var prime2;
16172
16183
  if (name === "k256")
16173
- prime = new K256;
16184
+ prime2 = new K256;
16174
16185
  else if (name === "p224")
16175
- prime = new P224;
16186
+ prime2 = new P224;
16176
16187
  else if (name === "p192")
16177
- prime = new P192;
16188
+ prime2 = new P192;
16178
16189
  else if (name === "p25519")
16179
- prime = new P25519;
16190
+ prime2 = new P25519;
16180
16191
  else
16181
16192
  throw Error("Unknown prime " + name);
16182
- return primes[name] = prime, prime;
16193
+ return primes[name] = prime2, prime2;
16183
16194
  };
16184
16195
  function Red(m) {
16185
16196
  if (typeof m === "string") {
@@ -17637,18 +17648,18 @@ var init_crypto = __esm(() => {
17637
17648
  }, BN._prime = function(name) {
17638
17649
  if (primes[name])
17639
17650
  return primes[name];
17640
- var prime;
17651
+ var prime2;
17641
17652
  if (name === "k256")
17642
- prime = new K256;
17653
+ prime2 = new K256;
17643
17654
  else if (name === "p224")
17644
- prime = new P224;
17655
+ prime2 = new P224;
17645
17656
  else if (name === "p192")
17646
- prime = new P192;
17657
+ prime2 = new P192;
17647
17658
  else if (name === "p25519")
17648
- prime = new P25519;
17659
+ prime2 = new P25519;
17649
17660
  else
17650
17661
  throw Error("Unknown prime " + name);
17651
- return primes[name] = prime, prime;
17662
+ return primes[name] = prime2, prime2;
17652
17663
  };
17653
17664
  function Red(m) {
17654
17665
  if (typeof m === "string") {
@@ -18565,6 +18576,17 @@ var variableLengthDecode = (array) => {
18565
18576
  return { bytesRead, value };
18566
18577
  };
18567
18578
 
18579
+ // ../effectstream-sdk/utils/src/types/validators/solana.ts
18580
+ import bs582 from "bs58";
18581
+ var ADDRESS_BYTE_LENGTH3 = 32;
18582
+ function verifySolanaAddress(address) {
18583
+ const decoded = bs582.decode(address);
18584
+ if (decoded.length !== ADDRESS_BYTE_LENGTH3) {
18585
+ throw new Error(`Malformed Solana address: expected byte length ${ADDRESS_BYTE_LENGTH3}, got ${decoded.length}`);
18586
+ }
18587
+ return true;
18588
+ }
18589
+
18568
18590
  // ../effectstream-sdk/utils/src/types/typebox-helpers.ts
18569
18591
  function tryDecode(val, validator, checkResult = () => true) {
18570
18592
  try {
@@ -18583,6 +18605,7 @@ FormatRegistry.Set("cardano-address", (val) => tryDecode(val, verifyCardanoByron
18583
18605
  FormatRegistry.Set("ss58", (val) => tryDecode(val, ss58.decode));
18584
18606
  FormatRegistry.Set("bs58check", (val) => tryDecode(val, bs58check2.decode));
18585
18607
  FormatRegistry.Set("bech32", (val) => tryDecode(val, (val2) => bech322.decode(val2, Number.MAX_SAFE_INTEGER / 2)));
18608
+ FormatRegistry.Set("solana-address", (val) => tryDecode(val, verifySolanaAddress));
18586
18609
  function forceLowercase(schema) {
18587
18610
  return Type.Transform(schema).Decode((value) => value.toLowerCase()).Encode((value) => value.toLowerCase());
18588
18611
  }
@@ -18648,6 +18671,9 @@ var TypeboxHelpers = {
18648
18671
  Near: {
18649
18672
  Address: Type.Unsafe(Type.String())
18650
18673
  },
18674
+ Solana: {
18675
+ Address: Type.Unsafe(Type.String({ format: "solana-address" }))
18676
+ },
18651
18677
  Caip2: Type.Unsafe(Type.String()),
18652
18678
  WalletAddress: () => Type.Union(AddressTypebox),
18653
18679
  IntervalMs: (options) => Type.Unsafe(Type.Number(options)),
@@ -18674,7 +18700,8 @@ var AddressValidator = {
18674
18700
  [4 /* MINA */]: TypeboxHelpers.Mina.Address,
18675
18701
  [5 /* MIDNIGHT */]: TypeboxHelpers.Midnight.Address,
18676
18702
  [7 /* POLKADOT */]: TypeboxHelpers.Polkadot.Address,
18677
- [8 /* NEAR */]: TypeboxHelpers.Near.Address
18703
+ [8 /* NEAR */]: TypeboxHelpers.Near.Address,
18704
+ [9 /* SOLANA */]: TypeboxHelpers.Solana.Address
18678
18705
  };
18679
18706
  var AddressTypebox = [
18680
18707
  Type.Object({
@@ -18716,6 +18743,10 @@ var AddressTypebox = [
18716
18743
  Type.Object({
18717
18744
  type: Type.Literal(8 /* NEAR */),
18718
18745
  address: TypeboxHelpers.Near.Address
18746
+ }),
18747
+ Type.Object({
18748
+ type: Type.Literal(9 /* SOLANA */),
18749
+ address: TypeboxHelpers.Solana.Address
18719
18750
  })
18720
18751
  ];
18721
18752
  // ../effectstream-sdk/utils/src/viem.ts
@@ -18965,7 +18996,7 @@ class MidnightCrypto {
18965
18996
  return false;
18966
18997
  const [ledgerMod, addrMod] = await Promise.all([
18967
18998
  import("@midnight-ntwrk/ledger-v8"),
18968
- import("@midnight-ntwrk/wallet-sdk-address-format")
18999
+ import("@midnightntwrk/wallet-sdk-address-format")
18969
19000
  ]);
18970
19001
  const expectedHexAddress = ledgerMod.addressFromKey(verifyingKey).toLowerCase();
18971
19002
  let decodedHex;
@@ -18990,6 +19021,37 @@ class MidnightCrypto {
18990
19021
  }
18991
19022
  }
18992
19023
 
19024
+ // ../effectstream-sdk/crypto/src/chains/solana.ts
19025
+ import { PublicKey } from "@solana/web3.js";
19026
+ import nacl from "tweetnacl";
19027
+ import { Value as Value8 } from "@sinclair/typebox/value";
19028
+
19029
+ class SolanaCrypto {
19030
+ verifyAddress = (address) => {
19031
+ return Value8.Check(TypeboxHelpers.Solana.Address, address);
19032
+ };
19033
+ verifySignature = async (userAddress, message, sigStruct) => {
19034
+ try {
19035
+ if (!this.verifyAddress(userAddress)) {
19036
+ return false;
19037
+ }
19038
+ if (!sigStruct) {
19039
+ return false;
19040
+ }
19041
+ const publicKeyBytes = new PublicKey(userAddress).toBytes();
19042
+ const messageBytes = new TextEncoder().encode(message);
19043
+ const signatureBytes = new Uint8Array(Buffer.from(sigStruct, "base64"));
19044
+ return nacl.sign.detached.verify(messageBytes, signatureBytes, publicKeyBytes);
19045
+ } catch (err) {
19046
+ console.error("[address-validator] error verifying solana signature:", err);
19047
+ return false;
19048
+ }
19049
+ };
19050
+ decodeAddress(address) {
19051
+ return Value8.Decode(TypeboxHelpers.Solana.Address, address);
19052
+ }
19053
+ }
19054
+
18993
19055
  // ../effectstream-sdk/crypto/src/CryptoManager.ts
18994
19056
  class CryptoManager {
18995
19057
  static algorand;
@@ -18998,6 +19060,7 @@ class CryptoManager {
18998
19060
  static polkadot;
18999
19061
  static mina;
19000
19062
  static midnight;
19063
+ static solana;
19001
19064
  static Algorand() {
19002
19065
  if (CryptoManager.algorand == null) {
19003
19066
  CryptoManager.algorand = new AlgorandCrypto;
@@ -19034,6 +19097,12 @@ class CryptoManager {
19034
19097
  }
19035
19098
  return CryptoManager.midnight;
19036
19099
  }
19100
+ static Solana() {
19101
+ if (CryptoManager.solana == null) {
19102
+ CryptoManager.solana = new SolanaCrypto;
19103
+ }
19104
+ return CryptoManager.solana;
19105
+ }
19037
19106
  static getCryptoManager(addressType) {
19038
19107
  switch (addressType) {
19039
19108
  case 0 /* EVM */:
@@ -19048,6 +19117,8 @@ class CryptoManager {
19048
19117
  return CryptoManager.Mina();
19049
19118
  case 5 /* MIDNIGHT */:
19050
19119
  return CryptoManager.Midnight();
19120
+ case 9 /* SOLANA */:
19121
+ return CryptoManager.Solana();
19051
19122
  default:
19052
19123
  throw new Error(`Unsupported address type: ${addressType}`);
19053
19124
  }
@@ -19066,7 +19137,7 @@ function toKeyedJsonGrammar(grammar) {
19066
19137
  return keyedTypes;
19067
19138
  }
19068
19139
  // ../effectstream-sdk/concise/src/v2/inputs.ts
19069
- import { Value as Value8 } from "@sinclair/typebox/value";
19140
+ import { Value as Value9 } from "@sinclair/typebox/value";
19070
19141
  // ../effectstream-sdk/concise/src/v2/builtins/batcher.ts
19071
19142
  import { Type as Type3 } from "@sinclair/typebox";
19072
19143
  function userAddress(addr) {
@@ -19161,7 +19232,7 @@ function createMessageForBatcher(namespace, millisecondTimestamp, _walletAddress
19161
19232
  // ../effectstream-sdk/concise/src/delegate.ts
19162
19233
  import { privateKeyToAccount } from "viem/accounts";
19163
19234
  import { createWalletClient, http as http2 } from "viem";
19164
- import { Value as Value9 } from "@sinclair/typebox/value";
19235
+ import { Value as Value10 } from "@sinclair/typebox/value";
19165
19236
  var accountMessages = {
19166
19237
  linkAccount: (account_id, other_address, is_new_primary) => {
19167
19238
  return `link:${String(account_id)}:${other_address}:${is_new_primary ? "true" : "false"}`;
@@ -20671,11 +20742,11 @@ class MidnightLocalProvider {
20671
20742
  getUnshieldedKeystore = () => this.unshieldedKeystore;
20672
20743
  }
20673
20744
  async function loadKeystoreDeps() {
20674
- const hdMod = await import("@midnight-ntwrk/wallet-sdk-hd").catch(() => {
20675
- throw new Error("@midnight-ntwrk/wallet-sdk-hd is required for WalletMode.MidnightLocal.");
20745
+ const hdMod = await import("@midnightntwrk/wallet-sdk-hd").catch(() => {
20746
+ throw new Error("@midnightntwrk/wallet-sdk-hd is required for WalletMode.MidnightLocal.");
20676
20747
  });
20677
- const keystoreMod = await import("@midnight-ntwrk/wallet-sdk-unshielded-wallet").catch(() => {
20678
- throw new Error("@midnight-ntwrk/wallet-sdk-unshielded-wallet is required for WalletMode.MidnightLocal.");
20748
+ const keystoreMod = await import("@midnightntwrk/wallet-sdk-unshielded-wallet").catch(() => {
20749
+ throw new Error("@midnightntwrk/wallet-sdk-unshielded-wallet is required for WalletMode.MidnightLocal.");
20679
20750
  });
20680
20751
  return { hdMod, keystoreMod };
20681
20752
  }
@@ -20697,6 +20768,236 @@ function generateRandomHexSeed(byteLength2) {
20697
20768
  return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
20698
20769
  }
20699
20770
 
20771
+ // ../effectstream-sdk/wallets/src/solana/solana.ts
20772
+ import { getWallets } from "@wallet-standard/app";
20773
+ import { Transaction } from "@solana/web3.js";
20774
+ var STANDARD_CONNECT = "standard:connect";
20775
+ var STANDARD_DISCONNECT = "standard:disconnect";
20776
+ var SOLANA_SIGN_MESSAGE = "solana:signMessage";
20777
+ var SOLANA_SIGN_TRANSACTION = "solana:signTransaction";
20778
+
20779
+ class SolanaConnector {
20780
+ provider;
20781
+ static INSTANCE = undefined;
20782
+ static getWalletOptions() {
20783
+ const win = getWindow();
20784
+ const wallets = [];
20785
+ if (win?.phantom?.solana) {
20786
+ wallets.push({
20787
+ metadata: {
20788
+ name: "phantom",
20789
+ displayName: "Phantom",
20790
+ icon: win.phantom?.solana?.icon
20791
+ },
20792
+ api: async () => win.phantom.solana
20793
+ });
20794
+ }
20795
+ if (win?.backpack?.solana) {
20796
+ wallets.push({
20797
+ metadata: {
20798
+ name: "backpack",
20799
+ displayName: "Backpack"
20800
+ },
20801
+ api: async () => win.backpack.solana
20802
+ });
20803
+ }
20804
+ if (win?.solflare?.isSolflare) {
20805
+ wallets.push({
20806
+ metadata: {
20807
+ name: "solflare",
20808
+ displayName: "Solflare"
20809
+ },
20810
+ api: async () => win.solflare
20811
+ });
20812
+ }
20813
+ if (win?.solana && !win.solana.isPhantom && wallets.length === 0) {
20814
+ wallets.push({
20815
+ metadata: {
20816
+ name: "solana",
20817
+ displayName: "Solana Wallet"
20818
+ },
20819
+ api: async () => win.solana
20820
+ });
20821
+ }
20822
+ try {
20823
+ for (const w of getWallets().get()) {
20824
+ if (!isSolanaStandardWallet(w))
20825
+ continue;
20826
+ const name = (w.name ?? "").toLowerCase();
20827
+ const already = wallets.some((o) => o.metadata.displayName.toLowerCase() === name);
20828
+ if (already)
20829
+ continue;
20830
+ wallets.push({
20831
+ metadata: {
20832
+ name: `standard:${name}`,
20833
+ displayName: w.name,
20834
+ icon: w.icon
20835
+ },
20836
+ api: async () => new WalletStandardSolanaApi(w)
20837
+ });
20838
+ }
20839
+ } catch {}
20840
+ return wallets;
20841
+ }
20842
+ static instance() {
20843
+ if (SolanaConnector.INSTANCE == null) {
20844
+ const newInstance = new SolanaConnector;
20845
+ SolanaConnector.INSTANCE = newInstance;
20846
+ }
20847
+ return SolanaConnector.INSTANCE;
20848
+ }
20849
+ connectSimple = async () => {
20850
+ const options = SolanaConnector.getWalletOptions();
20851
+ if (options.length === 0) {
20852
+ throw new Error("No Solana wallet found. Please install a Solana wallet (Phantom, Backpack, or MetaMask).");
20853
+ }
20854
+ return this.connectNamed(options[0].metadata.name);
20855
+ };
20856
+ connectNamed = async (name) => {
20857
+ const options = SolanaConnector.getWalletOptions();
20858
+ const option = options.find((o) => o.metadata.name === name);
20859
+ if (!option) {
20860
+ throw new Error(`Wallet "${name}" not found`);
20861
+ }
20862
+ const active = await optionToActive(option);
20863
+ return this.connectExternal(active);
20864
+ };
20865
+ connectExternal = async (conn) => {
20866
+ const api = conn.api;
20867
+ if (api.isConnected === false) {
20868
+ await api.connect();
20869
+ }
20870
+ const address = api.publicKey.toBase58();
20871
+ this.provider = new SolanaProvider(conn, address);
20872
+ return this.provider;
20873
+ };
20874
+ getProvider() {
20875
+ return this.provider;
20876
+ }
20877
+ getOrThrowProvider() {
20878
+ if (!this.provider) {
20879
+ throw new Error("Solana wallet not connected");
20880
+ }
20881
+ return this.provider;
20882
+ }
20883
+ isConnected() {
20884
+ return this.provider != null;
20885
+ }
20886
+ }
20887
+
20888
+ class SolanaProvider {
20889
+ connection;
20890
+ address;
20891
+ constructor(connection, address) {
20892
+ this.connection = connection;
20893
+ this.address = address;
20894
+ }
20895
+ getConnection() {
20896
+ return this.connection;
20897
+ }
20898
+ async signMessage(message) {
20899
+ const encoded = new TextEncoder().encode(message);
20900
+ const { signature } = await this.connection.api.signMessage(encoded);
20901
+ return Buffer.from(signature).toString("base64");
20902
+ }
20903
+ getAddress() {
20904
+ return {
20905
+ type: 9 /* SOLANA */,
20906
+ address: this.address
20907
+ };
20908
+ }
20909
+ async signTransaction(txBase64) {
20910
+ if (!this.connection.api.signTransaction) {
20911
+ throw new Error("Wallet does not support signTransaction");
20912
+ }
20913
+ const tx = Transaction.from(Buffer.from(txBase64, "base64"));
20914
+ const signed = await this.connection.api.signTransaction(tx);
20915
+ return serializeSignedTx(signed);
20916
+ }
20917
+ }
20918
+ function serializeSignedTx(signed) {
20919
+ if (signed != null && typeof signed.serialize === "function") {
20920
+ const bytes = signed.serialize({
20921
+ requireAllSignatures: false,
20922
+ verifySignatures: false
20923
+ });
20924
+ return Buffer.from(bytes).toString("base64");
20925
+ }
20926
+ if (signed instanceof Uint8Array) {
20927
+ return Buffer.from(signed).toString("base64");
20928
+ }
20929
+ throw new Error("Wallet returned an unrecognised signTransaction result (expected a Transaction or bytes)");
20930
+ }
20931
+ function isSolanaStandardWallet(wallet) {
20932
+ const features = wallet?.features ?? {};
20933
+ return Boolean(features[STANDARD_CONNECT] && features[SOLANA_SIGN_MESSAGE]);
20934
+ }
20935
+ function pickSolanaChain(account, wallet) {
20936
+ const chains = account?.chains ?? wallet?.chains ?? [];
20937
+ return chains.find((c) => typeof c === "string" && c.startsWith("solana:"));
20938
+ }
20939
+
20940
+ class WalletStandardSolanaApi {
20941
+ wallet;
20942
+ isConnected = false;
20943
+ account;
20944
+ constructor(wallet) {
20945
+ this.wallet = wallet;
20946
+ }
20947
+ get publicKey() {
20948
+ const address = this.account?.address ?? "";
20949
+ return { toBase58: () => address };
20950
+ }
20951
+ async connect() {
20952
+ if (!this.account) {
20953
+ const result = await this.wallet.features[STANDARD_CONNECT].connect();
20954
+ this.account = (result?.accounts ?? this.wallet.accounts ?? [])[0];
20955
+ }
20956
+ if (!this.account) {
20957
+ throw new Error("Wallet returned no Solana account");
20958
+ }
20959
+ this.isConnected = true;
20960
+ }
20961
+ async disconnect() {
20962
+ const feature = this.wallet.features[STANDARD_DISCONNECT];
20963
+ if (feature?.disconnect) {
20964
+ await feature.disconnect();
20965
+ }
20966
+ this.account = undefined;
20967
+ this.isConnected = false;
20968
+ }
20969
+ async signMessage(message) {
20970
+ const feature = this.wallet.features[SOLANA_SIGN_MESSAGE];
20971
+ if (!feature) {
20972
+ throw new Error("Wallet does not support solana:signMessage");
20973
+ }
20974
+ const [output] = await feature.signMessage({
20975
+ account: this.account,
20976
+ message
20977
+ });
20978
+ return { signature: output.signature };
20979
+ }
20980
+ async signTransaction(tx) {
20981
+ const feature = this.wallet.features[SOLANA_SIGN_TRANSACTION];
20982
+ if (!feature) {
20983
+ throw new Error("Wallet does not support solana:signTransaction. The batcher flow " + "needs a sign-only signature, which this wallet does not provide.");
20984
+ }
20985
+ const asObject = tx != null && typeof tx.serialize === "function";
20986
+ const bytes = asObject ? tx.serialize({
20987
+ requireAllSignatures: false,
20988
+ verifySignatures: false
20989
+ }) : tx;
20990
+ const chain = pickSolanaChain(this.account, this.wallet);
20991
+ const [output] = await feature.signTransaction({
20992
+ account: this.account,
20993
+ transaction: Uint8Array.from(bytes),
20994
+ ...chain ? { chain } : {}
20995
+ });
20996
+ const signed = output.signedTransaction;
20997
+ return asObject ? { serialize: () => signed } : signed;
20998
+ }
20999
+ }
21000
+
20700
21001
  // ../effectstream-sdk/wallets/src/utils.ts
20701
21002
  var WalletMode;
20702
21003
  ((WalletMode2) => {
@@ -20711,6 +21012,7 @@ var WalletMode;
20711
21012
  WalletMode2[WalletMode2["Algorand"] = 8] = "Algorand";
20712
21013
  WalletMode2[WalletMode2["Mina"] = 9] = "Mina";
20713
21014
  WalletMode2[WalletMode2["AvailJs"] = 10] = "AvailJs";
21015
+ WalletMode2[WalletMode2["Solana"] = 11] = "Solana";
20714
21016
  })(WalletMode ||= {});
20715
21017
  var WalletNameMap = {
20716
21018
  [0 /* EvmInjected */]: "EVM",
@@ -20723,7 +21025,8 @@ var WalletNameMap = {
20723
21025
  [7 /* Polkadot */]: "Polkadot",
20724
21026
  [8 /* Algorand */]: "Algorand",
20725
21027
  [9 /* Mina */]: "Mina",
20726
- [10 /* AvailJs */]: "Avail"
21028
+ [10 /* AvailJs */]: "Avail",
21029
+ [11 /* Solana */]: "Solana"
20727
21030
  };
20728
21031
  var WalletModeMap = {
20729
21032
  [0 /* EvmInjected */]: EvmInjectedConnector.instance(),
@@ -20736,7 +21039,8 @@ var WalletModeMap = {
20736
21039
  [7 /* Polkadot */]: PolkadotConnector.instance(),
20737
21040
  [8 /* Algorand */]: AlgorandConnector.instance(),
20738
21041
  [9 /* Mina */]: MinaConnector.instance(),
20739
- [10 /* AvailJs */]: AvailConnector.instance()
21042
+ [10 /* AvailJs */]: AvailConnector.instance(),
21043
+ [11 /* Solana */]: SolanaConnector.instance()
20740
21044
  };
20741
21045
  async function allInjectedWallets(config = {
20742
21046
  signatureSupport: true,
@@ -20838,8 +21142,8 @@ function getAddressType(mode) {
20838
21142
  return 5 /* MIDNIGHT */;
20839
21143
  case 10 /* AvailJs */:
20840
21144
  return 6 /* AVAIL */;
20841
- case 7 /* Polkadot */:
20842
- return 7 /* POLKADOT */;
21145
+ case 11 /* Solana */:
21146
+ return 9 /* SOLANA */;
20843
21147
  default:
20844
21148
  throw new Error(`Unsupported wallet mode: ${mode}`);
20845
21149
  }
@@ -21069,6 +21373,18 @@ async function midnightLocalLoginWrapper(loginInfo) {
21069
21373
  }
21070
21374
  }
21071
21375
 
21376
+ // ../effectstream-sdk/wallets/src/solana/wrapper.ts
21377
+ async function solanaLoginWrapper(loginInfo) {
21378
+ const loginResult = await connectInjected("solanaLoginWrapper", loginInfo, SolanaConnector.instance());
21379
+ if (loginResult.success === false) {
21380
+ return loginResult;
21381
+ }
21382
+ return {
21383
+ success: true,
21384
+ result: loginResult.result
21385
+ };
21386
+ }
21387
+
21072
21388
  // ../effectstream-sdk/wallets/src/wallets.ts
21073
21389
  async function walletLogin(loginInfo) {
21074
21390
  const provider = await login(loginInfo);
@@ -21118,6 +21434,9 @@ async function login(loginInfo) {
21118
21434
  case 4 /* MidnightLocal */: {
21119
21435
  return await midnightLocalLoginWrapper(loginInfo);
21120
21436
  }
21437
+ case 11 /* Solana */: {
21438
+ return await solanaLoginWrapper(loginInfo);
21439
+ }
21121
21440
  default:
21122
21441
  throw new Error(`Unsupported wallet mode: ${loginInfo.mode}`);
21123
21442
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@effectstream/frontend-sdk",
3
- "version": "0.101.0",
4
- "license": "MIT",
3
+ "version": "0.102.0",
4
+ "license": "(MIT OR Apache-2.0)",
5
5
  "homepage": "https://effectstream.github.io/docs/",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,7 +15,9 @@
15
15
  "dist",
16
16
  "src",
17
17
  "build.ts",
18
- "tsconfig.build.json"
18
+ "tsconfig.build.json",
19
+ "LICENSE-MIT",
20
+ "LICENSE-APACHE"
19
21
  ],
20
22
  "exports": {
21
23
  ".": {
@@ -27,7 +29,7 @@
27
29
  "build": "bun run build.ts"
28
30
  },
29
31
  "dependencies": {
30
- "@effectstream/wallets": "0.101.0"
32
+ "@effectstream/wallets": "0.102.0"
31
33
  },
32
34
  "description": "React frontend SDK for EffectStream"
33
35
  }