@blocklet/meta 1.8.34 → 1.8.36

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 (58) hide show
  1. package/lib/channel.d.ts +27 -0
  2. package/lib/channel.js +32 -32
  3. package/lib/constants.d.ts +2 -0
  4. package/lib/constants.js +6 -3
  5. package/lib/did.d.ts +10 -0
  6. package/lib/did.js +18 -24
  7. package/lib/engine.d.ts +7 -0
  8. package/lib/engine.js +21 -25
  9. package/lib/entry.d.ts +3 -0
  10. package/lib/entry.js +51 -64
  11. package/lib/extension.d.ts +10 -0
  12. package/lib/extension.js +78 -77
  13. package/lib/file.d.ts +21 -0
  14. package/lib/file.js +44 -39
  15. package/lib/fix.d.ts +33 -0
  16. package/lib/fix.js +218 -208
  17. package/lib/get-component-process-id.d.ts +5 -0
  18. package/lib/get-component-process-id.js +13 -14
  19. package/lib/has-reserved-key.d.ts +3 -0
  20. package/lib/has-reserved-key.js +10 -9
  21. package/lib/index.d.ts +82 -0
  22. package/lib/index.js +51 -34
  23. package/lib/info.d.ts +13 -0
  24. package/lib/info.js +58 -60
  25. package/lib/name.d.ts +5 -0
  26. package/lib/name.js +14 -7
  27. package/lib/nft-templates.d.ts +86 -0
  28. package/lib/nft-templates.js +47 -42
  29. package/lib/parse-navigation.d.ts +3 -0
  30. package/lib/parse-navigation.js +167 -228
  31. package/lib/parse.d.ts +22 -0
  32. package/lib/parse.js +71 -82
  33. package/lib/payment/index.d.ts +254 -0
  34. package/lib/payment/index.js +13 -6
  35. package/lib/payment/v1.d.ts +185 -0
  36. package/lib/payment/v1.js +80 -81
  37. package/lib/payment/v2.d.ts +242 -0
  38. package/lib/payment/v2.js +453 -531
  39. package/lib/schema.d.ts +50 -0
  40. package/lib/schema.js +405 -402
  41. package/lib/service-configs/auth.json +61 -61
  42. package/lib/service.d.ts +26 -0
  43. package/lib/service.js +69 -85
  44. package/lib/types/index.d.ts +1 -0
  45. package/lib/types/index.js +18 -0
  46. package/lib/types/schema.d.ts +241 -0
  47. package/lib/types/schema.js +3 -0
  48. package/lib/util-meta.d.ts +42 -0
  49. package/lib/util-meta.js +138 -158
  50. package/lib/util.d.ts +185 -0
  51. package/lib/util.js +359 -414
  52. package/lib/validate.d.ts +10 -0
  53. package/lib/validate.js +28 -34
  54. package/lib/verify-multi-sig.d.ts +3 -0
  55. package/lib/verify-multi-sig.js +94 -101
  56. package/lib/wallet.d.ts +9 -0
  57. package/lib/wallet.js +17 -27
  58. package/package.json +40 -18
@@ -0,0 +1,242 @@
1
+ import { TBlockletMeta } from '../types';
2
+ declare const VERSION = "2.0.0";
3
+ export interface Store {
4
+ id: string;
5
+ pk: string;
6
+ url: string;
7
+ components: Array<{
8
+ did: string;
9
+ version: string;
10
+ }>;
11
+ }
12
+ export interface Component {
13
+ meta: TBlockletMeta;
14
+ storeInfo: {
15
+ id: string;
16
+ pk: string;
17
+ };
18
+ storeUrl: string;
19
+ children: Component[];
20
+ }
21
+ /**
22
+ * Used by CLI and Store to independent compute factory itx
23
+ *
24
+ * @param {{
25
+ * blockletMeta: TBlockletMeta,
26
+ * ocapClient: OcapClient,
27
+ * issuers: Array<string>,
28
+ * storeUrl: string,
29
+ * }}
30
+ * @returns {{
31
+ * itx: Itx
32
+ * store: Array<{id, url}>
33
+ * shares: Array<{
34
+ * accountName: string
35
+ * accountAddress: DID
36
+ * tokenAddress: DID
37
+ * amount: string|number,
38
+ * }>
39
+ * }}
40
+ */
41
+ declare const createNftFactoryItx: ({ blockletMeta, ocapClient, issuers, storeUrl, }: {
42
+ blockletMeta: TBlockletMeta;
43
+ ocapClient: any;
44
+ issuers: string[];
45
+ storeUrl: string;
46
+ }) => Promise<{
47
+ itx: any;
48
+ stores: {
49
+ id: string;
50
+ url: string;
51
+ }[];
52
+ shares: {
53
+ amount: string;
54
+ tokenAddress: string;
55
+ accountAddress: string;
56
+ }[];
57
+ }>;
58
+ /**
59
+ * Used by Store before generating payment signature
60
+ *
61
+ * @param {{
62
+ * integrity: string,
63
+ * blockletMeta: TBlockletMeta,
64
+ * ocapClient: OcapClient,
65
+ * storeId: string
66
+ * }}
67
+ * @returns {string} integrity
68
+ */
69
+ declare const verifyPaymentIntegrity: ({ integrity: expected, blockletMeta, ocapClient, storeId, }: {
70
+ integrity: string;
71
+ blockletMeta: TBlockletMeta;
72
+ ocapClient: any;
73
+ storeId: string;
74
+ }) => Promise<string>;
75
+ /**
76
+ * Used by Store before generating downloadToken
77
+ *
78
+ * @param {{
79
+ * {FactoryState} factoryState
80
+ * {Wallet} signerWallet
81
+ * }}
82
+ *
83
+ * @returns {{
84
+ * components: Array<{did: string, version: string}>
85
+ * }}
86
+ */
87
+ declare const verifyNftFactory: ({ factoryState, signerWallet, }: {
88
+ factoryState: {
89
+ data: {
90
+ value: string;
91
+ };
92
+ input?: any;
93
+ address?: string;
94
+ hooks?: Array<{
95
+ type: string;
96
+ hook: string;
97
+ }>;
98
+ };
99
+ signerWallet: any;
100
+ }) => Promise<any>;
101
+ /**
102
+ * Check blocklet and all of components are free
103
+ * Throw Error if not free
104
+ *
105
+ * @param {TBlockletMeta} meta
106
+ */
107
+ declare const checkFreeBlocklet: (blockletMeta: TBlockletMeta) => Promise<boolean>;
108
+ export declare const _test: {
109
+ getPriceTokens: (meta: any, ocapClient: any) => Promise<any>;
110
+ getFactoryInput: (inputTokens: Array<{
111
+ address: string;
112
+ value: string | number;
113
+ decimal: number;
114
+ }>, { formatToken }?: {
115
+ formatToken?: boolean;
116
+ }) => {
117
+ tokens: Array<{
118
+ address: string;
119
+ value: string | number;
120
+ decimal: number;
121
+ }>;
122
+ assets: [];
123
+ variables: [];
124
+ };
125
+ getPaymentIntegrity: ({ contract, factoryInput, storeComponents, meta, client, storeId, }: {
126
+ contract?: string;
127
+ factoryInput?: any;
128
+ storeComponents?: any;
129
+ meta?: any;
130
+ client?: any;
131
+ storeId?: string;
132
+ }) => Promise<string>;
133
+ getComponents: (inputMeta: any) => Promise<{
134
+ components: Component[];
135
+ stores: Store[];
136
+ }>;
137
+ getContract: ({ meta, priceTokens, components, }: {
138
+ meta: TBlockletMeta;
139
+ priceTokens: Array<{
140
+ decimal: number;
141
+ }>;
142
+ components: any;
143
+ }) => Promise<{
144
+ code: string;
145
+ shares: {
146
+ amount: string;
147
+ tokenAddress: string;
148
+ accountAddress: string;
149
+ }[];
150
+ }>;
151
+ };
152
+ export { createNftFactoryItx };
153
+ export { verifyPaymentIntegrity };
154
+ export { verifyNftFactory };
155
+ export { checkFreeBlocklet };
156
+ export { VERSION as version };
157
+ declare const _default: {
158
+ createNftFactoryItx: ({ blockletMeta, ocapClient, issuers, storeUrl, }: {
159
+ blockletMeta: TBlockletMeta;
160
+ ocapClient: any;
161
+ issuers: string[];
162
+ storeUrl: string;
163
+ }) => Promise<{
164
+ itx: any;
165
+ stores: {
166
+ id: string;
167
+ url: string;
168
+ }[];
169
+ shares: {
170
+ amount: string;
171
+ tokenAddress: string;
172
+ accountAddress: string;
173
+ }[];
174
+ }>;
175
+ verifyPaymentIntegrity: ({ integrity: expected, blockletMeta, ocapClient, storeId, }: {
176
+ integrity: string;
177
+ blockletMeta: TBlockletMeta;
178
+ ocapClient: any;
179
+ storeId: string;
180
+ }) => Promise<string>;
181
+ verifyNftFactory: ({ factoryState, signerWallet, }: {
182
+ factoryState: {
183
+ data: {
184
+ value: string;
185
+ };
186
+ input?: any;
187
+ address?: string;
188
+ hooks?: {
189
+ type: string;
190
+ hook: string;
191
+ }[];
192
+ };
193
+ signerWallet: any;
194
+ }) => Promise<any>;
195
+ checkFreeBlocklet: (blockletMeta: TBlockletMeta) => Promise<boolean>;
196
+ version: string;
197
+ _test: {
198
+ getPriceTokens: (meta: any, ocapClient: any) => Promise<any>;
199
+ getFactoryInput: (inputTokens: {
200
+ address: string;
201
+ value: string | number;
202
+ decimal: number;
203
+ }[], { formatToken }?: {
204
+ formatToken?: boolean;
205
+ }) => {
206
+ tokens: {
207
+ address: string;
208
+ value: string | number;
209
+ decimal: number;
210
+ }[];
211
+ assets: [];
212
+ variables: [];
213
+ };
214
+ getPaymentIntegrity: ({ contract, factoryInput, storeComponents, meta, client, storeId, }: {
215
+ contract?: string;
216
+ factoryInput?: any;
217
+ storeComponents?: any;
218
+ meta?: any;
219
+ client?: any;
220
+ storeId?: string;
221
+ }) => Promise<string>;
222
+ getComponents: (inputMeta: any) => Promise<{
223
+ components: Component[];
224
+ stores: Store[];
225
+ }>;
226
+ getContract: ({ meta, priceTokens, components, }: {
227
+ meta: TBlockletMeta;
228
+ priceTokens: {
229
+ decimal: number;
230
+ }[];
231
+ components: any;
232
+ }) => Promise<{
233
+ code: string;
234
+ shares: {
235
+ amount: string;
236
+ tokenAddress: string;
237
+ accountAddress: string;
238
+ }[];
239
+ }>;
240
+ };
241
+ };
242
+ export default _default;