@dcl-regenesislabs/sdk 0.0.0-stage → 7.0.0-42722791062.commit-bc8d909

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 (97) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +119 -2
  3. package/composite-provider.d.ts +2 -0
  4. package/composite-provider.js +67 -0
  5. package/ecs.d.ts +16 -0
  6. package/ecs.js +17 -0
  7. package/ethereum-provider/index.d.ts +24 -0
  8. package/ethereum-provider/index.js +27 -0
  9. package/ethereum-provider/text-encoder.d.ts +1 -0
  10. package/ethereum-provider/text-encoder.js +5 -0
  11. package/explorer-ui/index.d.ts +118 -0
  12. package/explorer-ui/index.js +235 -0
  13. package/index.d.ts +1 -0
  14. package/index.js +45 -0
  15. package/internal/Observable.d.ts +192 -0
  16. package/internal/Observable.js +324 -0
  17. package/internal/language-events.d.ts +1 -0
  18. package/internal/language-events.js +8 -0
  19. package/internal/provider.d.ts +22 -0
  20. package/internal/provider.js +29 -0
  21. package/internal/transports/logger.d.ts +2 -0
  22. package/internal/transports/logger.js +38 -0
  23. package/internal/transports/rendererTransport.d.ts +7 -0
  24. package/internal/transports/rendererTransport.js +40 -0
  25. package/internal/utf8.d.ts +15 -0
  26. package/internal/utf8.js +172 -0
  27. package/math.d.ts +16 -0
  28. package/math.js +17 -0
  29. package/message-bus.d.ts +14 -0
  30. package/message-bus.js +49 -0
  31. package/network/binary-message-bus.d.ts +18 -0
  32. package/network/binary-message-bus.js +68 -0
  33. package/network/entities.d.ts +11 -0
  34. package/network/entities.js +121 -0
  35. package/network/filter.d.ts +2 -0
  36. package/network/filter.js +43 -0
  37. package/network/index.d.ts +2 -0
  38. package/network/index.js +8 -0
  39. package/network/message-bus-sync.d.ts +18 -0
  40. package/network/message-bus-sync.js +174 -0
  41. package/network/state.d.ts +7 -0
  42. package/network/state.js +84 -0
  43. package/network/utils.d.ts +4 -0
  44. package/network/utils.js +16 -0
  45. package/observables.d.ts +179 -0
  46. package/observables.js +259 -0
  47. package/package.json +35 -3
  48. package/platform/index.d.ts +21 -0
  49. package/platform/index.js +70 -0
  50. package/players/index.d.ts +34 -0
  51. package/players/index.js +81 -0
  52. package/react-ecs.d.ts +21 -0
  53. package/react-ecs.js +27 -0
  54. package/src/composite-provider.ts +67 -0
  55. package/src/ecs.ts +17 -0
  56. package/src/ethereum-provider/index.ts +30 -0
  57. package/src/ethereum-provider/text-encoder.ts +4 -0
  58. package/src/explorer-ui/index.ts +398 -0
  59. package/src/index.ts +49 -0
  60. package/src/internal/Observable.ts +394 -0
  61. package/src/internal/language-events.ts +8 -0
  62. package/src/internal/provider.ts +51 -0
  63. package/src/internal/transports/logger.ts +45 -0
  64. package/src/internal/transports/rendererTransport.ts +48 -0
  65. package/src/internal/utf8.ts +167 -0
  66. package/src/math.ts +17 -0
  67. package/src/message-bus.ts +56 -0
  68. package/src/network/README.md +122 -0
  69. package/src/network/binary-message-bus.ts +74 -0
  70. package/src/network/entities.ts +149 -0
  71. package/src/network/filter.ts +63 -0
  72. package/src/network/index.ts +10 -0
  73. package/src/network/message-bus-sync.ts +208 -0
  74. package/src/network/state.ts +136 -0
  75. package/src/network/utils.ts +22 -0
  76. package/src/observables.ts +386 -0
  77. package/src/platform/index.ts +82 -0
  78. package/src/players/index.ts +110 -0
  79. package/src/react-ecs.ts +29 -0
  80. package/src/testing/assert.ts +134 -0
  81. package/src/testing/index.ts +42 -0
  82. package/src/testing/runtime.ts +223 -0
  83. package/src/testing/types.ts +21 -0
  84. package/src/text-codec.ts +70 -0
  85. package/testing/assert.d.ts +11 -0
  86. package/testing/assert.js +126 -0
  87. package/testing/index.d.ts +7 -0
  88. package/testing/index.js +36 -0
  89. package/testing/runtime.d.ts +8 -0
  90. package/testing/runtime.js +197 -0
  91. package/testing/types.d.ts +18 -0
  92. package/testing/types.js +2 -0
  93. package/text-codec.d.ts +28 -0
  94. package/text-codec.js +65 -0
  95. package/tsconfig.json +12 -0
  96. package/types/tsconfig.ecs7.json +31 -0
  97. package/types/tsconfig.ecs7.strict.json +4 -0
package/LICENSE 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 2019 Metaverse Holdings Ltd.
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/README.md CHANGED
@@ -1,3 +1,120 @@
1
- # Temporary Holding Version
1
+ # @dcl/sdk
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Main SDK package for building Decentraland scenes.
4
+
5
+ ## Overview
6
+
7
+ The Decentraland SDK provides a complete framework for creating interactive 3D scenes in the Decentraland metaverse. It includes:
8
+
9
+ - Entity Component System (ECS) for scene development
10
+ - UI components and layout tools
11
+ - Asset management utilities
12
+ - Scene networking capabilities
13
+ - Input handling and interactions
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @dcl/sdk
19
+ ```
20
+
21
+ ## Quick Start
22
+
23
+ 1. Create a new scene:
24
+
25
+ ```bash
26
+ npx @dcl/sdk-commands init
27
+ ```
28
+
29
+ 2. Start the development server:
30
+
31
+ ```bash
32
+ npm start
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```typescript
38
+ import { engine, Entity, Transform, GltfContainer } from '@dcl/sdk/ecs'
39
+
40
+ // Create an entity
41
+ const entity = engine.addEntity()
42
+
43
+ // Add components
44
+ Transform.create(entity, {
45
+ position: { x: 8, y: 0, z: 8 },
46
+ scale: { x: 1, y: 1, z: 1 }
47
+ })
48
+
49
+ GltfContainer.create(entity, {
50
+ src: 'models/myModel.glb'
51
+ })
52
+ ```
53
+
54
+ ## Features
55
+
56
+ ### Components
57
+
58
+ - Transform
59
+ - GltfContainer
60
+ - Material
61
+ - UiTransform
62
+ - AudioSource
63
+ - And many more...
64
+
65
+ ### Systems
66
+
67
+ - Input handling
68
+ - Physics
69
+ - Animation
70
+ - Networking
71
+
72
+ ### UI Framework
73
+
74
+ - Flexbox layout
75
+ - React-like components
76
+ - Event handling
77
+
78
+ ## Development
79
+
80
+ ### Building the Package
81
+
82
+ ```bash
83
+ make build
84
+ ```
85
+
86
+ ### Testing
87
+
88
+ ```bash
89
+ # Run all tests
90
+ make test
91
+ ```
92
+
93
+ ### Development Commands
94
+
95
+ For local development, you can also use:
96
+
97
+ ```bash
98
+ # Clean all build artifacts and reinstall dependencies
99
+ make clean && make install
100
+
101
+ # Format and fix linting issues
102
+ make lint-fix
103
+
104
+ # Update dependencies across packages
105
+ make sync-deps
106
+ ```
107
+
108
+ ## Documentation
109
+
110
+ - [SDK Documentation](https://docs.decentraland.org/creator/development-guide/sdk7/sdk-101/)
111
+ - [Scene Examples](https://github.com/decentraland/sdk7-goerli-plaza)
112
+ - [ECS](https://docs.decentraland.org/creator/development-guide/sdk7/entities-components/)
113
+
114
+ ## Architecture Decisions
115
+
116
+ For a deeper understanding of the SDK architecture:
117
+
118
+ - [ADR-117: CRDT Protocol for Scenes](https://adr.decentraland.org/adr/ADR-117)
119
+ - [ADR-123: Schema and Serialization](https://adr.decentraland.org/adr/ADR-123)
120
+ - [ADR-165: Component Declaration](https://adr.decentraland.org/adr/ADR-165)
@@ -0,0 +1,2 @@
1
+ import { Composite } from '@dcl/ecs';
2
+ export declare const compositeProvider: Composite.Provider;
@@ -0,0 +1,67 @@
1
+ import { compositeFromLoader } from '~sdk/all-composites';
2
+ import { readFile } from '~system/Runtime';
3
+ import { Composite } from '@dcl/ecs';
4
+ import { decodeUtf8 } from './internal/utf8';
5
+ const composites = new Map();
6
+ function findCached(src) {
7
+ return composites.get(src) ?? null;
8
+ }
9
+ function cache(src, composite) {
10
+ const existing = findCached(src);
11
+ if (existing)
12
+ return existing;
13
+ const resource = { src, composite };
14
+ composites.set(src, resource);
15
+ return resource;
16
+ }
17
+ function decodeFromLoader(src, fromLoader) {
18
+ if (fromLoader instanceof Uint8Array)
19
+ return Composite.fromBinary(fromLoader);
20
+ if (typeof fromLoader === 'string')
21
+ return Composite.fromJson(JSON.parse(fromLoader));
22
+ if (typeof fromLoader === 'object' && fromLoader !== null)
23
+ return Composite.fromJson(fromLoader);
24
+ return null;
25
+ }
26
+ function decodeFromBytes(content) {
27
+ // .composite files are JSON (UTF-8); .composite.bin files are protobuf binary.
28
+ // The first-byte check is a fast path; a JSON.parse failure falls back to fromBinary
29
+ // because a protobuf message can also begin with 0x7b.
30
+ if (content[0] === 0x7b /* '{' */) {
31
+ try {
32
+ return Composite.fromJson(JSON.parse(decodeUtf8(content, { fatal: true })));
33
+ }
34
+ catch {
35
+ return Composite.fromBinary(content);
36
+ }
37
+ }
38
+ return Composite.fromBinary(content);
39
+ }
40
+ // @public
41
+ export const compositeProvider = {
42
+ schemas: [],
43
+ getCompositeOrNull(src) {
44
+ const fromLoader = compositeFromLoader[src];
45
+ if (fromLoader) {
46
+ try {
47
+ const composite = decodeFromLoader(src, fromLoader);
48
+ if (composite)
49
+ cache(src, composite);
50
+ }
51
+ catch (err) {
52
+ console.error(`compositeProvider: failed to decode composite "${src}"`, err);
53
+ }
54
+ delete compositeFromLoader[src];
55
+ }
56
+ return findCached(src);
57
+ },
58
+ async loadComposite(src) {
59
+ const cached = findCached(src);
60
+ if (cached)
61
+ return cached;
62
+ const { content } = await readFile({ fileName: src });
63
+ const composite = decodeFromBytes(content);
64
+ return cache(src, composite);
65
+ }
66
+ };
67
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9zaXRlLXByb3ZpZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic3JjL2NvbXBvc2l0ZS1wcm92aWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQTtBQUN6RCxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0saUJBQWlCLENBQUE7QUFDMUMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLFVBQVUsQ0FBQTtBQUNwQyxPQUFPLEVBQU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W5kQ2FjaGVkKHNyYylcbiAgfSxcblxuICBhc3luYyBsb2FkQ29tcG9zaXRlKHNyYzogc3RyaW5nKTogUHJvbWlzZTxDb21wb3NpdGUuUmVzb3VyY2U+IHtcbiAgICBjb25zdCBjYWNoZWQgPSBmaW5kQ2FjaGVkKHNyYylcbiAgICBpZiAoY2FjaGVkKSByZXR1cm4gY2FjaGVkXG5cbiAgICBjb25zdCB7IGNvbnRlbnQgfSA9IGF3YWl0IHJlYWRGaWxlKHsgZmlsZU5hbWU6IHNyYyB9KVxuICAgIGNvbnN0IGNvbXBvc2l0ZSA9IGRlY29kZUZyb21CeXRlcyhjb250ZW50KVxuICAgIHJldHVybiBjYWNoZShzcmMsIGNvbXBvc2l0ZSlcbiAgfVxufVxuIl19
package/ecs.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The module ecs is exposed by the sdk via `@dcl/sdk/ecs`
3
+ *
4
+ * It defines the engine, components & systems for the SDK 7.
5
+
6
+ * @example
7
+ * ```tsx
8
+ * import { engine, Transform } from '@dcl/sdk/ecs'
9
+ * const entity = engine.addEntity()
10
+ * Transform.create(entity, defaultPosition)
11
+ * ```
12
+ *
13
+ * @module ECS
14
+ *
15
+ */
16
+ export * from '@dcl/ecs';
package/ecs.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The module ecs is exposed by the sdk via `@dcl/sdk/ecs`
3
+ *
4
+ * It defines the engine, components & systems for the SDK 7.
5
+
6
+ * @example
7
+ * ```tsx
8
+ * import { engine, Transform } from '@dcl/sdk/ecs'
9
+ * const entity = engine.addEntity()
10
+ * Transform.create(entity, defaultPosition)
11
+ * ```
12
+ *
13
+ * @module ECS
14
+ *
15
+ */
16
+ export * from '@dcl/ecs';
17
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZWNzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsic3JjL2Vjcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7Ozs7Ozs7Ozs7Ozs7R0FjRztBQUVILGNBQWMsVUFBVSxDQUFBIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBUaGUgbW9kdWxlIGVjcyBpcyBleHBvc2VkIGJ5IHRoZSBzZGsgdmlhIGBAZGNsL3Nkay9lY3NgXG4gKlxuICogSXQgZGVmaW5lcyB0aGUgZW5naW5lLCBjb21wb25lbnRzICYgc3lzdGVtcyBmb3IgdGhlIFNESyA3LlxuXG4qIEBleGFtcGxlXG4gKiBgYGB0c3hcbiAqIGltcG9ydCB7IGVuZ2luZSwgVHJhbnNmb3JtIH0gZnJvbSAnQGRjbC9zZGsvZWNzJ1xuICogY29uc3QgZW50aXR5ID0gZW5naW5lLmFkZEVudGl0eSgpXG4gKiBUcmFuc2Zvcm0uY3JlYXRlKGVudGl0eSwgZGVmYXVsdFBvc2l0aW9uKVxuICogYGBgXG4gKlxuICogQG1vZHVsZSBFQ1NcbiAqXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnQGRjbC9lY3MnXG4iXX0=
@@ -0,0 +1,24 @@
1
+ /**
2
+ * This module is exposed by the sdk via `@dcl/sdk/etherum-provider`
3
+ *
4
+
5
+ * @example
6
+ * ```tsx
7
+ * import { createEthereumProvider } from '@dcl/sdk/ethereum-provider'
8
+ * import { ethers } from 'ethers'
9
+
10
+ * const provider = new ethers.providers.Web3Provider(createEthereumProvider() as any)
11
+ * ```
12
+ *
13
+ * @module Etherum Provider
14
+ *
15
+ */
16
+ /**
17
+ * Etherum Provider
18
+ * @public
19
+ */
20
+ export declare function createEthereumProvider(): {
21
+ send(message: import("../internal/provider").RPCSendableMessage, callback?: ((error: Error | null, result?: any) => void) | undefined): void;
22
+ sendAsync(message: import("../internal/provider").RPCSendableMessage, callback: (error: Error | null, result?: any) => void): void;
23
+ };
24
+ export { RPCSendableMessage } from '../internal/provider';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * This module is exposed by the sdk via `@dcl/sdk/etherum-provider`
3
+ *
4
+
5
+ * @example
6
+ * ```tsx
7
+ * import { createEthereumProvider } from '@dcl/sdk/ethereum-provider'
8
+ * import { ethers } from 'ethers'
9
+
10
+ * const provider = new ethers.providers.Web3Provider(createEthereumProvider() as any)
11
+ * ```
12
+ *
13
+ * @module Etherum Provider
14
+ *
15
+ */
16
+ import { sendAsync } from '~system/EthereumController';
17
+ import { getEthereumProvider } from '../internal/provider';
18
+ import { polyfillTextEncoder } from './text-encoder';
19
+ /**
20
+ * Etherum Provider
21
+ * @public
22
+ */
23
+ export function createEthereumProvider() {
24
+ polyfillTextEncoder();
25
+ return getEthereumProvider(sendAsync);
26
+ }
27
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvZXRoZXJldW0tcHJvdmlkZXIvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7Ozs7Ozs7Ozs7O0dBY0c7QUFFSCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sNEJBQTRCLENBQUE7QUFDdEQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sc0JBQXNCLENBQUE7QUFDMUQsT0FBTyxFQUFFLG1CQUFtQixFQUFFLE1BQU0sZ0JBQWdCLENBQUE7QUFFcEQ7OztHQUdHO0FBQ0gsTUFBTSxVQUFVLHNCQUFzQjtJQUNwQyxtQkFBbUIsRUFBRSxDQUFBO0lBQ3JCLE9BQU8sbUJBQW1CLENBQUMsU0FBUyxDQUFDLENBQUE7QUFDdkMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qKlxuICogVGhpcyBtb2R1bGUgaXMgZXhwb3NlZCBieSB0aGUgc2RrIHZpYSBgQGRjbC9zZGsvZXRoZXJ1bS1wcm92aWRlcmBcbiAqXG5cbiogQGV4YW1wbGVcbiAqIGBgYHRzeFxuICogaW1wb3J0IHsgY3JlYXRlRXRoZXJldW1Qcm92aWRlciB9IGZyb20gJ0BkY2wvc2RrL2V0aGVyZXVtLXByb3ZpZGVyJ1xuICogaW1wb3J0IHsgZXRoZXJzIH0gZnJvbSAnZXRoZXJzJ1xuXG4gKiBjb25zdCBwcm92aWRlciA9IG5ldyBldGhlcnMucHJvdmlkZXJzLldlYjNQcm92aWRlcihjcmVhdGVFdGhlcmV1bVByb3ZpZGVyKCkgYXMgYW55KVxuICogYGBgXG4gKlxuICogQG1vZHVsZSBFdGhlcnVtIFByb3ZpZGVyXG4gKlxuICovXG5cbmltcG9ydCB7IHNlbmRBc3luYyB9IGZyb20gJ35zeXN0ZW0vRXRoZXJldW1Db250cm9sbGVyJ1xuaW1wb3J0IHsgZ2V0RXRoZXJldW1Qcm92aWRlciB9IGZyb20gJy4uL2ludGVybmFsL3Byb3ZpZGVyJ1xuaW1wb3J0IHsgcG9seWZpbGxUZXh0RW5jb2RlciB9IGZyb20gJy4vdGV4dC1lbmNvZGVyJ1xuXG4vKipcbiAqIEV0aGVydW0gUHJvdmlkZXJcbiAqIEBwdWJsaWNcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGNyZWF0ZUV0aGVyZXVtUHJvdmlkZXIoKSB7XG4gIHBvbHlmaWxsVGV4dEVuY29kZXIoKVxuICByZXR1cm4gZ2V0RXRoZXJldW1Qcm92aWRlcihzZW5kQXN5bmMpXG59XG5cbmV4cG9ydCB7IFJQQ1NlbmRhYmxlTWVzc2FnZSB9IGZyb20gJy4uL2ludGVybmFsL3Byb3ZpZGVyJ1xuIl19
@@ -0,0 +1 @@
1
+ export { polyfillTextEncoder } from '../text-codec';
@@ -0,0 +1,5 @@
1
+ // The TextEncoder/TextDecoder polyfill now lives in the lean `@dcl/sdk/text-codec`
2
+ // subpath so it can be installed without pulling in the ethereum provider. This
3
+ // re-export keeps the historical `./text-encoder` import path working.
4
+ export { polyfillTextEncoder } from '../text-codec';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGV4dC1lbmNvZGVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2V0aGVyZXVtLXByb3ZpZGVyL3RleHQtZW5jb2Rlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxtRkFBbUY7QUFDbkYsZ0ZBQWdGO0FBQ2hGLHVFQUF1RTtBQUN2RSxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSxlQUFlLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUaGUgVGV4dEVuY29kZXIvVGV4dERlY29kZXIgcG9seWZpbGwgbm93IGxpdmVzIGluIHRoZSBsZWFuIGBAZGNsL3Nkay90ZXh0LWNvZGVjYFxuLy8gc3VicGF0aCBzbyBpdCBjYW4gYmUgaW5zdGFsbGVkIHdpdGhvdXQgcHVsbGluZyBpbiB0aGUgZXRoZXJldW0gcHJvdmlkZXIuIFRoaXNcbi8vIHJlLWV4cG9ydCBrZWVwcyB0aGUgaGlzdG9yaWNhbCBgLi90ZXh0LWVuY29kZXJgIGltcG9ydCBwYXRoIHdvcmtpbmcuXG5leHBvcnQgeyBwb2x5ZmlsbFRleHRFbmNvZGVyIH0gZnJvbSAnLi4vdGV4dC1jb2RlYydcbiJdfQ==
@@ -0,0 +1,118 @@
1
+ /// <reference types="@dcl/js-runtime" />
2
+ import { ExplorerUi, GrowOnlyValueSetComponentDefinition, PBExplorerItemPurchaseResult, PBExplorerUiEventsResult } from '@dcl/ecs';
3
+ import { OpenExplorerUiResult } from '~system/RestrictedActions';
4
+ export { ExplorerUi, OpenExplorerUiResult };
5
+ /** @public */
6
+ export type CorrelatedEvent = {
7
+ timestamp: number;
8
+ requestId: number;
9
+ };
10
+ /**
11
+ * A named stream of events that this helper can collect and stop on.
12
+ * @public
13
+ */
14
+ export type Channel<N extends string = string, T extends CorrelatedEvent = CorrelatedEvent> = {
15
+ readonly name: N;
16
+ readonly component: GrowOnlyValueSetComponentDefinition<T>;
17
+ };
18
+ /** @public */
19
+ export type AnyChannel = Channel<string, any>;
20
+ /**
21
+ * Wraps a grow-only result component as a {@link Channel}. The name must be unique within a scene.
22
+ * @public
23
+ */
24
+ export declare function channel<N extends string, T extends CorrelatedEvent>(name: N, component: GrowOnlyValueSetComponentDefinition<T>): Channel<N, T>;
25
+ /** Panel lifecycle events: opened and closed. @public */
26
+ export declare const ExplorerUiEvents: Channel<'explorerUi', PBExplorerUiEventsResult>;
27
+ /** Outcome of an `EU_ITEM_PURCHASE` flow: purchased, dismissed or failed. @public */
28
+ export declare const ItemPurchase: Channel<'itemPurchase', PBExplorerItemPurchaseResult>;
29
+ /**
30
+ * The `$case` names of a channel's event union.
31
+ * @public
32
+ */
33
+ export type CaseOf<C extends AnyChannel> = C extends Channel<any, infer T> ? Extract<T[keyof T], {
34
+ $case: string;
35
+ }>['$case'] : never;
36
+ /** @public */
37
+ export type Variant<C extends AnyChannel = AnyChannel, K extends string = string> = {
38
+ readonly channel: C;
39
+ readonly $case: K;
40
+ };
41
+ /** @public */
42
+ export declare function variant<C extends AnyChannel, K extends CaseOf<C>>(ch: C, $case: K): Variant<C, K>;
43
+ /**
44
+ * What ends the wait before the panel closes: any event on a channel, or one `$case` of it.
45
+ * @public
46
+ */
47
+ export type StopCondition = AnyChannel | Variant;
48
+ /** @public */
49
+ export type Collected<C> = C extends Channel<infer N, infer T> ? {
50
+ channel: N;
51
+ event: T;
52
+ } : never;
53
+ /**
54
+ * How the wait ended.
55
+ * - `closed`: the panel this call opened was closed.
56
+ * - `matched`: `until` fired first, so the panel may still be on screen.
57
+ * - `notOpened`: this call did not open anything. `openResult` says why.
58
+ * - `timedOut`: `timeoutMs` elapsed first.
59
+ *
60
+ * `events` always holds everything collected, the event that stopped the wait included.
61
+ * @public
62
+ */
63
+ export type WaitOutcome<C extends readonly AnyChannel[]> = {
64
+ $case: 'closed';
65
+ events: readonly Collected<C[number]>[];
66
+ } | {
67
+ $case: 'matched';
68
+ events: readonly Collected<C[number]>[];
69
+ } | {
70
+ $case: 'notOpened';
71
+ openResult: OpenExplorerUiResult;
72
+ } | {
73
+ $case: 'timedOut';
74
+ events: readonly Collected<C[number]>[];
75
+ };
76
+ /** @public */
77
+ export type WaitOptions<C extends readonly AnyChannel[]> = {
78
+ /** Channels whose events land in `events`. Defaults to none. */
79
+ collect?: C;
80
+ /** Stops the wait early. The panel closing always stops it regardless. */
81
+ until?: StopCondition;
82
+ /**
83
+ * Bounds the wait, in milliseconds. On expiry the promise resolves with `$case: 'timedOut'`.
84
+ * No default, because a panel can stay open for minutes. Without it, an explorer that opens
85
+ * a panel and then emits no `closed` leaves the promise pending for the scene's whole life.
86
+ */
87
+ timeoutMs?: number;
88
+ };
89
+ /** @public */
90
+ export type OpenExplorerUiRequest = {
91
+ ui: Exclude<ExplorerUi, ExplorerUi.EU_ITEM_PURCHASE>;
92
+ itemPurchase?: undefined;
93
+ } | {
94
+ ui: ExplorerUi.EU_ITEM_PURCHASE;
95
+ itemPurchase: {
96
+ urn: string;
97
+ };
98
+ };
99
+ /**
100
+ * Signature of {@link openExplorerUiAndWait}. The second overload takes a bare `ui`, so a
101
+ * computed panel value needs no narrowing.
102
+ * @public
103
+ */
104
+ export interface OpenExplorerUiAndWait {
105
+ <const C extends readonly AnyChannel[] = []>(request: OpenExplorerUiRequest, options?: WaitOptions<C>): Promise<WaitOutcome<C>>;
106
+ (ui: Exclude<ExplorerUi, ExplorerUi.EU_ITEM_PURCHASE>): Promise<WaitOutcome<[]>>;
107
+ }
108
+ /**
109
+ * Opens an explorer panel and waits for the session it started. The wait ends when the panel
110
+ * closes. See {@link WaitOptions} to collect events, to stop earlier or to bound the wait.
111
+ *
112
+ * Every lifecycle outcome resolves, see {@link WaitOutcome}. The promise rejects only when an
113
+ * event cannot be attributed to a call at all: an explorer too old to echo `request_id`
114
+ * paired with a panel that can coexist with another one.
115
+ *
116
+ * @public
117
+ */
118
+ export declare const openExplorerUiAndWait: OpenExplorerUiAndWait;