tempo.ts 0.0.0 → 0.0.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 (153) hide show
  1. package/README.md +92 -0
  2. package/dist/chains.d.ts +1477 -0
  3. package/dist/chains.d.ts.map +1 -0
  4. package/dist/chains.js +43 -0
  5. package/dist/chains.js.map +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +2 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/internal/types.d.ts +284 -0
  11. package/dist/internal/types.d.ts.map +1 -0
  12. package/dist/internal/types.js +2 -0
  13. package/dist/internal/types.js.map +1 -0
  14. package/dist/ox/TokenId.d.ts +18 -0
  15. package/dist/ox/TokenId.d.ts.map +1 -0
  16. package/dist/ox/TokenId.js +29 -0
  17. package/dist/ox/TokenId.js.map +1 -0
  18. package/dist/ox/TokenRole.d.ts +11 -0
  19. package/dist/ox/TokenRole.d.ts.map +1 -0
  20. package/dist/ox/TokenRole.js +22 -0
  21. package/dist/ox/TokenRole.js.map +1 -0
  22. package/dist/ox/Transaction.d.ts +161 -0
  23. package/dist/ox/Transaction.d.ts.map +1 -0
  24. package/dist/ox/Transaction.js +117 -0
  25. package/dist/ox/Transaction.js.map +1 -0
  26. package/dist/ox/TransactionEnvelopeFeeToken.d.ts +393 -0
  27. package/dist/ox/TransactionEnvelopeFeeToken.d.ts.map +1 -0
  28. package/dist/ox/TransactionEnvelopeFeeToken.js +452 -0
  29. package/dist/ox/TransactionEnvelopeFeeToken.js.map +1 -0
  30. package/dist/ox/TransactionRequest.d.ts +62 -0
  31. package/dist/ox/TransactionRequest.d.ts.map +1 -0
  32. package/dist/ox/TransactionRequest.js +66 -0
  33. package/dist/ox/TransactionRequest.js.map +1 -0
  34. package/dist/ox/index.d.ts +5 -0
  35. package/dist/ox/index.d.ts.map +1 -0
  36. package/dist/ox/index.js +5 -0
  37. package/dist/ox/index.js.map +1 -0
  38. package/dist/prool/Instance.d.ts +92 -0
  39. package/dist/prool/Instance.d.ts.map +1 -0
  40. package/dist/prool/Instance.js +96 -0
  41. package/dist/prool/Instance.js.map +1 -0
  42. package/dist/prool/index.d.ts +2 -0
  43. package/dist/prool/index.d.ts.map +1 -0
  44. package/dist/prool/index.js +2 -0
  45. package/dist/prool/index.js.map +1 -0
  46. package/dist/viem/abis.d.ts +2058 -0
  47. package/dist/viem/abis.d.ts.map +1 -0
  48. package/dist/viem/abis.js +1599 -0
  49. package/dist/viem/abis.js.map +1 -0
  50. package/dist/viem/actions/amm.d.ts +2091 -0
  51. package/dist/viem/actions/amm.d.ts.map +1 -0
  52. package/dist/viem/actions/amm.js +876 -0
  53. package/dist/viem/actions/amm.js.map +1 -0
  54. package/dist/viem/actions/fee.d.ts +727 -0
  55. package/dist/viem/actions/fee.d.ts.map +1 -0
  56. package/dist/viem/actions/fee.js +230 -0
  57. package/dist/viem/actions/fee.js.map +1 -0
  58. package/dist/viem/actions/index.d.ts +5 -0
  59. package/dist/viem/actions/index.d.ts.map +1 -0
  60. package/dist/viem/actions/index.js +5 -0
  61. package/dist/viem/actions/index.js.map +1 -0
  62. package/dist/viem/actions/policy.d.ts +1900 -0
  63. package/dist/viem/actions/policy.d.ts.map +1 -0
  64. package/dist/viem/actions/policy.js +841 -0
  65. package/dist/viem/actions/policy.js.map +1 -0
  66. package/dist/viem/actions/token.d.ts +13759 -0
  67. package/dist/viem/actions/token.d.ts.map +1 -0
  68. package/dist/viem/actions/token.js +2579 -0
  69. package/dist/viem/actions/token.js.map +1 -0
  70. package/dist/viem/addresses.d.ts +8 -0
  71. package/dist/viem/addresses.d.ts.map +1 -0
  72. package/dist/viem/addresses.js +8 -0
  73. package/dist/viem/addresses.js.map +1 -0
  74. package/dist/viem/chain.d.ts +341 -0
  75. package/dist/viem/chain.d.ts.map +1 -0
  76. package/dist/viem/chain.js +22 -0
  77. package/dist/viem/chain.js.map +1 -0
  78. package/dist/viem/client.d.ts +27 -0
  79. package/dist/viem/client.d.ts.map +1 -0
  80. package/dist/viem/client.js +28 -0
  81. package/dist/viem/client.js.map +1 -0
  82. package/dist/viem/decorator.d.ts +1636 -0
  83. package/dist/viem/decorator.d.ts.map +1 -0
  84. package/dist/viem/decorator.js +95 -0
  85. package/dist/viem/decorator.js.map +1 -0
  86. package/dist/viem/formatters.d.ts +4 -0
  87. package/dist/viem/formatters.d.ts.map +1 -0
  88. package/dist/viem/formatters.js +69 -0
  89. package/dist/viem/formatters.js.map +1 -0
  90. package/dist/viem/index.d.ts +9 -0
  91. package/dist/viem/index.d.ts.map +1 -0
  92. package/dist/viem/index.js +9 -0
  93. package/dist/viem/index.js.map +1 -0
  94. package/dist/viem/transaction.d.ts +54 -0
  95. package/dist/viem/transaction.d.ts.map +1 -0
  96. package/dist/viem/transaction.js +108 -0
  97. package/dist/viem/transaction.js.map +1 -0
  98. package/dist/viem/transport.d.ts +16 -0
  99. package/dist/viem/transport.d.ts.map +1 -0
  100. package/dist/viem/transport.js +33 -0
  101. package/dist/viem/transport.js.map +1 -0
  102. package/dist/viem/types.d.ts +10 -0
  103. package/dist/viem/types.d.ts.map +1 -0
  104. package/dist/viem/types.js +2 -0
  105. package/dist/viem/types.js.map +1 -0
  106. package/dist/viem/utils.d.ts +8 -0
  107. package/dist/viem/utils.d.ts.map +1 -0
  108. package/dist/viem/utils.js +9 -0
  109. package/dist/viem/utils.js.map +1 -0
  110. package/package.json +100 -2
  111. package/src/chains.ts +46 -0
  112. package/src/index.ts +1 -0
  113. package/src/internal/types.ts +414 -0
  114. package/src/ox/TokenId.test.ts +29 -0
  115. package/src/ox/TokenId.ts +35 -0
  116. package/src/ox/TokenRole.test.ts +20 -0
  117. package/src/ox/TokenRole.ts +27 -0
  118. package/src/ox/Transaction.test.ts +257 -0
  119. package/src/ox/Transaction.ts +247 -0
  120. package/src/ox/TransactionEnvelopeFeeToken.test.ts +1215 -0
  121. package/src/ox/TransactionEnvelopeFeeToken.ts +717 -0
  122. package/src/ox/TransactionRequest.ts +100 -0
  123. package/src/ox/index.ts +4 -0
  124. package/src/prool/Instance.test.ts +43 -0
  125. package/src/prool/Instance.ts +190 -0
  126. package/src/prool/index.ts +1 -0
  127. package/src/prool/internal/chain.json +106 -0
  128. package/src/prool/internal/consensus.toml +32 -0
  129. package/src/viem/abis.ts +1606 -0
  130. package/src/viem/actions/amm.test.ts +425 -0
  131. package/src/viem/actions/amm.ts +1308 -0
  132. package/src/viem/actions/fee.test.ts +281 -0
  133. package/src/viem/actions/fee.ts +362 -0
  134. package/src/viem/actions/index.ts +4 -0
  135. package/src/viem/actions/policy.test.ts +514 -0
  136. package/src/viem/actions/policy.ts +1284 -0
  137. package/src/viem/actions/token.test.ts +2172 -0
  138. package/src/viem/actions/token.ts +3830 -0
  139. package/src/viem/addresses.ts +10 -0
  140. package/src/viem/chain.ts +27 -0
  141. package/src/viem/client.bench-d.ts +8 -0
  142. package/src/viem/client.test.ts +152 -0
  143. package/src/viem/client.ts +91 -0
  144. package/src/viem/decorator.bench-d.ts +11 -0
  145. package/src/viem/decorator.test.ts +35 -0
  146. package/src/viem/decorator.ts +1914 -0
  147. package/src/viem/e2e.test.ts +410 -0
  148. package/src/viem/formatters.ts +100 -0
  149. package/src/viem/index.ts +8 -0
  150. package/src/viem/transaction.ts +253 -0
  151. package/src/viem/transport.ts +47 -0
  152. package/src/viem/types.ts +55 -0
  153. package/src/viem/utils.ts +37 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAwC,CAAA"}
package/dist/chains.js ADDED
@@ -0,0 +1,43 @@
1
+ import { defineChain } from 'viem';
2
+ import { chainConfig } from "./viem/chain.js";
3
+ export const tempoAdagietto = /*#__PURE__*/ defineChain({
4
+ ...chainConfig,
5
+ id: 1337,
6
+ name: 'Tempo',
7
+ nativeCurrency: {
8
+ name: 'USD',
9
+ symbol: 'USD',
10
+ decimals: 18,
11
+ },
12
+ rpcUrls: {
13
+ default: { http: ['https://rpc-adagietto.tempoxyz.dev'] },
14
+ },
15
+ });
16
+ export const tempoLento = /*#__PURE__*/ defineChain({
17
+ ...chainConfig,
18
+ id: 4246,
19
+ name: 'Tempo',
20
+ nativeCurrency: {
21
+ name: 'USD',
22
+ symbol: 'USD',
23
+ decimals: 18,
24
+ },
25
+ rpcUrls: {
26
+ default: { http: ['https://rpc-lento.tempoxyz.dev'] },
27
+ },
28
+ });
29
+ export const tempoLocal = /*#__PURE__*/ defineChain({
30
+ ...chainConfig,
31
+ id: 1337,
32
+ name: 'Tempo',
33
+ nativeCurrency: {
34
+ name: 'USD',
35
+ symbol: 'USD',
36
+ decimals: 18,
37
+ },
38
+ rpcUrls: {
39
+ default: { http: ['http://localhost:8545'] },
40
+ },
41
+ });
42
+ export const tempo = /*#__PURE__*/ defineChain(tempoLento);
43
+ //# sourceMappingURL=chains.js.map
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+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,284 @@
1
+ /** Combines members of an intersection into a readable type. */
2
+ export type Compute<type> = {
3
+ [key in keyof type]: type[key];
4
+ } & unknown;
5
+ declare const symbol: unique symbol;
6
+ /**
7
+ * Creates a branded type of `T` with the brand `U`.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * type Result = Branded<string, 'foo'>
12
+ * // ^? type Result = string & { [symbol]: 'foo' }
13
+ * ```
14
+ */
15
+ export type Branded<T, U> = T & {
16
+ [symbol]: U;
17
+ };
18
+ /**
19
+ * Filters out all members of `T` that are not `P`
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * type Result = Filter<['a', 'b', 'c'], 'b'>
24
+ * // ^? type Result = ['a', 'c']
25
+ * ```
26
+ *
27
+ * @internal
28
+ */
29
+ export type Filter<T extends readonly unknown[], P, Acc extends readonly unknown[] = []> = T extends readonly [infer F, ...infer Rest extends readonly unknown[]] ? [F] extends [P] ? Filter<Rest, P, [...Acc, F]> : Filter<Rest, P, Acc> : readonly [...Acc];
30
+ /**
31
+ * Checks if `T` can be narrowed further than `U`
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * type Result = IsNarrowable<'foo', string>
36
+ * // ^? true
37
+ * ```
38
+ */
39
+ export type IsNarrowable<T, U> = IsNever<(T extends U ? true : false) & (U extends T ? false : true)> extends true ? false : true;
40
+ /**
41
+ * Checks if `T` is `never`
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * type Result = IsNever<never>
46
+ * // ^? type Result = true
47
+ * ```
48
+ */
49
+ export type IsNever<T> = [T] extends [never] ? true : false;
50
+ /**
51
+ * Removes `readonly` from all properties of an object.
52
+ *
53
+ * @internal
54
+ */
55
+ export type Mutable<type extends object> = {
56
+ -readonly [key in keyof type]: type[key];
57
+ };
58
+ /**
59
+ * Evaluates boolean "or" condition for `T` properties.
60
+ *
61
+ * * @example
62
+ * ```ts
63
+ * type Result = Or<[false, true, false]>
64
+ * // ^? type Result = true
65
+ * ```
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * type Result = Or<[false, false, false]>
70
+ * // ^? type Result = false
71
+ * ```
72
+ *
73
+ * @internal
74
+ */
75
+ export type Or<T extends readonly unknown[]> = T extends readonly [
76
+ infer Head,
77
+ ...infer Tail
78
+ ] ? Head extends true ? true : Or<Tail> : false;
79
+ /**
80
+ * Checks if `T` is `undefined`
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * type Result = IsUndefined<undefined>
85
+ * // ^? type Result = true
86
+ * ```
87
+ *
88
+ * @internal
89
+ */
90
+ export type IsUndefined<T> = [undefined] extends [T] ? true : false;
91
+ /**
92
+ * Checks if type `T` is the `unknown` type.
93
+ *
94
+ * @internal
95
+ */
96
+ export type IsUnknown<T> = unknown extends T ? [T] extends [null] ? false : true : false;
97
+ /** @internal */
98
+ export type MaybePromise<T> = T | Promise<T>;
99
+ /**
100
+ * Makes attributes on the type T required if required is true.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * MaybeRequired<{ a: string, b?: number }, true>
105
+ * // { a: string, b: number }
106
+ *
107
+ * MaybeRequired<{ a: string, b?: number }, false>
108
+ * // { a: string, b?: number }
109
+ * ```
110
+ *
111
+ * @internal
112
+ */
113
+ export type MaybeRequired<T, required extends boolean> = required extends true ? ExactRequired<T> : T;
114
+ /**
115
+ * Assigns the properties of U onto T.
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * Assign<{ a: string, b: number }, { a: undefined, c: boolean }>
120
+ * // { a: undefined, b: number, c: boolean }
121
+ * ```
122
+ *
123
+ * @internal
124
+ */
125
+ export type Assign<T, U> = Assign_inner<T, U> & U;
126
+ /** @internal */
127
+ export type Assign_inner<T, U> = {
128
+ [K in keyof T as K extends keyof U ? U[K] extends void ? never : K : K]: K extends keyof U ? U[K] : T[K];
129
+ };
130
+ /**
131
+ * Constructs a type by excluding `undefined` from `T`.
132
+ *
133
+ * @example
134
+ * ```ts
135
+ * NoUndefined<string | undefined>
136
+ * // string
137
+ * ```
138
+ *
139
+ * @internal
140
+ */
141
+ export type NoUndefined<T> = T extends undefined ? never : T;
142
+ /**
143
+ * Strict version of built-in Omit type
144
+ *
145
+ * @internal
146
+ */
147
+ export type Omit<type, keys extends keyof type> = Pick<type, Exclude<keyof type, keys>>;
148
+ /**
149
+ * Creates a type that is a partial of T, but with the required keys K.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * PartialBy<{ a: string, b: number }, 'a'>
154
+ * // { a?: string, b: number }
155
+ * ```
156
+ *
157
+ * @internal
158
+ */
159
+ export type PartialBy<T, K extends keyof T> = Omit<T, K> & ExactPartial<Pick<T, K>>;
160
+ export type RecursiveArray<T> = T | readonly RecursiveArray<T>[];
161
+ /**
162
+ * Creates a type that is T with the required keys K.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * RequiredBy<{ a?: string, b: number }, 'a'>
167
+ * // { a: string, b: number }
168
+ * ```
169
+ *
170
+ * @internal
171
+ */
172
+ export type RequiredBy<T, K extends keyof T> = Omit<T, K> & ExactRequired<Pick<T, K>>;
173
+ /**
174
+ * Returns truthy if `array` contains `value`.
175
+ *
176
+ * @example
177
+ * ```ts
178
+ * Some<[1, 2, 3], 2>
179
+ * // true
180
+ * ```
181
+ *
182
+ * @internal
183
+ */
184
+ export type Some<array extends readonly unknown[], value> = array extends readonly [value, ...unknown[]] ? true : array extends readonly [unknown, ...infer rest] ? Some<rest, value> : false;
185
+ /**
186
+ * Prints custom error message
187
+ *
188
+ * @param messages - Error message
189
+ * @returns Custom error message
190
+ *
191
+ * @example
192
+ * ```ts
193
+ * type Result = TypeErrorMessage<'Custom error message'>
194
+ * // ^? type Result = ['Error: Custom error message']
195
+ * ```
196
+ */
197
+ export type TypeErrorMessage<messages extends string | string[]> = messages extends string ? [
198
+ `Error: ${messages}`
199
+ ] : {
200
+ [key in keyof messages]: messages[key] extends infer message extends string ? `Error: ${message}` : never;
201
+ };
202
+ /** @internal */
203
+ export type UnionToTuple<union, last = LastInUnion<union>> = [union] extends [never] ? [] : [...UnionToTuple<Exclude<union, last>>, last];
204
+ /** @internal */
205
+ export type LastInUnion<U> = UnionToIntersection<U extends unknown ? (x: U) => 0 : never> extends (x: infer l) => 0 ? l : never;
206
+ /** @internal */
207
+ export type UnionToIntersection<union> = (union extends unknown ? (arg: union) => 0 : never) extends (arg: infer i) => 0 ? i : never;
208
+ /** @internal */
209
+ export type IsUnion<union, union2 = union> = union extends union2 ? ([union2] extends [union] ? false : true) : never;
210
+ /** @internal */
211
+ export type MaybePartial<type, enabled extends boolean | undefined> = enabled extends true ? Compute<ExactPartial<type>> : type;
212
+ export type ExactPartial<type> = {
213
+ [key in keyof type]?: type[key] | undefined;
214
+ };
215
+ /** @internal */
216
+ export type ExactRequired<type> = {
217
+ [key in keyof type]-?: Exclude<type[key], undefined>;
218
+ };
219
+ export type OneOf<union extends object, fallback extends object | undefined = undefined, keys extends KeyofUnion<union> = KeyofUnion<union>> = union extends infer item ? Compute<item & {
220
+ [key in Exclude<keys, keyof item>]?: fallback extends object ? key extends keyof fallback ? fallback[key] : undefined : undefined;
221
+ }> : never;
222
+ /** @internal */
223
+ export type KeyofUnion<type> = type extends type ? keyof type : never;
224
+ /** @internal */
225
+ export type Undefined<type> = {
226
+ [key in keyof type]?: undefined;
227
+ };
228
+ /**
229
+ * Loose version of {@link Omit}
230
+ * @internal
231
+ */
232
+ export type LooseOmit<type, keys extends string> = Pick<type, Exclude<keyof type, keys>>;
233
+ /** @internal */
234
+ export type UnionCompute<type> = type extends object ? Compute<type> : type;
235
+ /** @internal */
236
+ export type UnionLooseOmit<type, keys extends string> = type extends any ? LooseOmit<type, keys> : never;
237
+ /**
238
+ * Construct a type with the properties of union type T except for those in type K.
239
+ * @example
240
+ * ```ts
241
+ * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>
242
+ * // { b: number } | { b: undefined, c: number }
243
+ * ```
244
+ *
245
+ * @internal
246
+ */
247
+ export type UnionOmit<type, keys extends keyof type> = type extends any ? Omit<type, keys> : never;
248
+ /**
249
+ * Construct a type with the properties of union type T except for those in type K.
250
+ * @example
251
+ * ```ts
252
+ * type Result = UnionOmit<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>
253
+ * // { b: number } | { b: undefined, c: number }
254
+ * ```
255
+ *
256
+ * @internal
257
+ */
258
+ export type UnionPick<type, keys extends keyof type> = type extends any ? Pick<type, keys> : never;
259
+ /**
260
+ * Creates a type that is a partial of T, but with the required keys K.
261
+ *
262
+ * @example
263
+ * ```ts
264
+ * PartialBy<{ a: string, b: number } | { a: string, b: undefined, c: number }, 'a'>
265
+ * // { a?: string, b: number } | { a?: string, b: undefined, c: number }
266
+ * ```
267
+ *
268
+ * @internal
269
+ */
270
+ export type UnionPartialBy<T, K extends keyof T> = T extends any ? PartialBy<T, K> : never;
271
+ /**
272
+ * Creates a type that is T with the required keys K.
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * RequiredBy<{ a?: string, b: number } | { a?: string, c?: number }, 'a'>
277
+ * // { a: string, b: number } | { a: string, c?: number }
278
+ * ```
279
+ *
280
+ * @internal
281
+ */
282
+ export type UnionRequiredBy<T, K extends keyof T> = T extends any ? RequiredBy<T, K> : never;
283
+ export {};
284
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAEhE,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI;KAAG,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,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,CAAA;AAE3E,gBAAgB;AAChB,MAAM,MAAM,cAAc,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,SAAS,GAAG,GACpE,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,GACrB,KAAK,CAAA;AAET;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,IAAI,SAAS,GAAG,GACnE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAChB,KAAK,CAAA;AAET;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,IAAI,SAAS,GAAG,GACnE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAChB,KAAK,CAAA;AAET;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,SAAS,GAAG,GAC5D,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACf,KAAK,CAAA;AAET;;;;;;;;;;GAUG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,CAAC,SAAS,GAAG,GAC7D,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAChB,KAAK,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,18 @@
1
+ import * as Address from 'ox/Address';
2
+ export type TokenId = bigint;
3
+ export type TokenIdOrAddress = TokenId | Address.Address;
4
+ /**
5
+ * Converts a TIP20 token address to a token ID.
6
+ *
7
+ * @param address - The token address.
8
+ * @returns The token ID.
9
+ */
10
+ export declare function fromAddress(address: Address.Address): TokenId;
11
+ /**
12
+ * Converts a TIP20 token ID to an address.
13
+ *
14
+ * @param tokenId - The token ID.
15
+ * @returns The address.
16
+ */
17
+ export declare function toAddress(tokenId: TokenIdOrAddress): Address.Address;
18
+ //# sourceMappingURL=TokenId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenId.d.ts","sourceRoot":"","sources":["../../src/ox/TokenId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AAKrC,MAAM,MAAM,OAAO,GAAG,MAAM,CAAA;AAC5B,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;AAExD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,GAAG,OAAO,CAI7D;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAQpE"}
@@ -0,0 +1,29 @@
1
+ import * as Address from 'ox/Address';
2
+ import * as Hex from 'ox/Hex';
3
+ const tip20Prefix = '0x20c0';
4
+ /**
5
+ * Converts a TIP20 token address to a token ID.
6
+ *
7
+ * @param address - The token address.
8
+ * @returns The token ID.
9
+ */
10
+ export function fromAddress(address) {
11
+ if (!address.toLowerCase().startsWith(tip20Prefix))
12
+ throw new Error('invalid tip20 address.');
13
+ return Hex.toBigInt(Hex.slice(address, tip20Prefix.length));
14
+ }
15
+ /**
16
+ * Converts a TIP20 token ID to an address.
17
+ *
18
+ * @param tokenId - The token ID.
19
+ * @returns The address.
20
+ */
21
+ export function toAddress(tokenId) {
22
+ if (typeof tokenId === 'string') {
23
+ Address.assert(tokenId);
24
+ return tokenId;
25
+ }
26
+ const tokenIdHex = Hex.fromNumber(tokenId, { size: 18 });
27
+ return Hex.concat(tip20Prefix, tokenIdHex);
28
+ }
29
+ //# sourceMappingURL=TokenId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenId.js","sourceRoot":"","sources":["../../src/ox/TokenId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,MAAM,WAAW,GAAG,QAAQ,CAAA;AAK5B;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAwB;IAClD,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC3C,OAAO,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QACvB,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,CAAA;AAC5C,CAAC"}
@@ -0,0 +1,11 @@
1
+ export declare const roles: readonly ["defaultAdmin", "pause", "unpause", "issuer", "burnBlocked"];
2
+ export type TokenRole = (typeof roles)[number] | (string & {});
3
+ export declare const toPreHashed: {
4
+ readonly defaultAdmin: "DEFAULT_ADMIN_ROLE";
5
+ readonly pause: "PAUSE_ROLE";
6
+ readonly unpause: "UNPAUSE_ROLE";
7
+ readonly issuer: "ISSUER_ROLE";
8
+ readonly burnBlocked: "BURN_BLOCKED_ROLE";
9
+ };
10
+ export declare function serialize(role: TokenRole): `0x${string}`;
11
+ //# sourceMappingURL=TokenRole.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenRole.d.ts","sourceRoot":"","sources":["../../src/ox/TokenRole.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,wEAMR,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;AAE9D,eAAO,MAAM,WAAW;;;;;;CAMsB,CAAA;AAE9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,iBAMxC"}
@@ -0,0 +1,22 @@
1
+ import * as Hash from 'ox/Hash';
2
+ import * as Hex from 'ox/Hex';
3
+ export const roles = [
4
+ 'defaultAdmin',
5
+ 'pause',
6
+ 'unpause',
7
+ 'issuer',
8
+ 'burnBlocked',
9
+ ];
10
+ export const toPreHashed = {
11
+ defaultAdmin: 'DEFAULT_ADMIN_ROLE',
12
+ pause: 'PAUSE_ROLE',
13
+ unpause: 'UNPAUSE_ROLE',
14
+ issuer: 'ISSUER_ROLE',
15
+ burnBlocked: 'BURN_BLOCKED_ROLE',
16
+ };
17
+ export function serialize(role) {
18
+ if (role === 'defaultAdmin')
19
+ return '0x0000000000000000000000000000000000000000000000000000000000000000';
20
+ return Hash.keccak256(Hex.fromString(toPreHashed[role] ?? role));
21
+ }
22
+ //# sourceMappingURL=TokenRole.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TokenRole.js","sourceRoot":"","sources":["../../src/ox/TokenRole.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,SAAS,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,cAAc;IACd,OAAO;IACP,SAAS;IACT,QAAQ;IACR,aAAa;CACL,CAAA;AAGV,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,YAAY,EAAE,oBAAoB;IAClC,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,mBAAmB;CACY,CAAA;AAE9C,MAAM,UAAU,SAAS,CAAC,IAAe;IACvC,IAAI,IAAI,KAAK,cAAc;QACzB,OAAO,oEAAoE,CAAA;IAC7E,OAAO,IAAI,CAAC,SAAS,CACnB,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,IAAgC,CAAC,IAAI,IAAI,CAAC,CACtE,CAAA;AACH,CAAC"}
@@ -0,0 +1,161 @@
1
+ import type * as AccessList from 'ox/AccessList';
2
+ import type * as Address from 'ox/Address';
3
+ import type * as Authorization from 'ox/Authorization';
4
+ import type * as Errors from 'ox/Errors';
5
+ import * as Hex from 'ox/Hex';
6
+ import * as ox_Transaction from 'ox/Transaction';
7
+ import type { Compute, OneOf, UnionCompute } from "../internal/types.js";
8
+ /**
9
+ * A Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
10
+ */
11
+ export type Transaction<pending extends boolean = false, bigintType = bigint, numberType = number> = UnionCompute<OneOf<FeeToken<pending, bigintType, numberType> | ox_Transaction.Transaction<pending, bigintType, numberType>>>;
12
+ /**
13
+ * An RPC Transaction as defined in the [Execution API specification](https://github.com/ethereum/execution-apis/blob/main/src/schemas/transaction.yaml).
14
+ */
15
+ export type Rpc<pending extends boolean = false> = UnionCompute<OneOf<FeeTokenRpc<pending> | ox_Transaction.Rpc<pending>>>;
16
+ /**
17
+ * Fee token transaction.
18
+ */
19
+ export type FeeToken<pending extends boolean = false, bigintType = bigint, numberType = number, type extends string = 'feeToken'> = Compute<ox_Transaction.Base<type, pending, bigintType, numberType> & {
20
+ /** EIP-2930 Access List. */
21
+ accessList: AccessList.AccessList;
22
+ /** EIP-7702 Authorization list for the transaction. */
23
+ authorizationList: Authorization.ListSigned<bigintType, numberType>;
24
+ /** Fee token preference. */
25
+ feeToken: Address.Address;
26
+ /** Fee payer address. */
27
+ feePayer?: Address.Address | undefined;
28
+ /** Fee payer signature. */
29
+ feePayerSignature?: {
30
+ /** ECDSA signature r. */
31
+ r: bigintType;
32
+ /** ECDSA signature s. */
33
+ s: bigintType;
34
+ /** ECDSA signature yParity. */
35
+ yParity: numberType;
36
+ /** @deprecated ECDSA signature v (for backwards compatibility). */
37
+ v?: numberType | undefined;
38
+ } | undefined;
39
+ /** Effective gas price paid by the sender in wei. */
40
+ gasPrice?: bigintType | undefined;
41
+ /** Total fee per gas in wei (gasPrice/baseFeePerGas + maxPriorityFeePerGas). */
42
+ maxFeePerGas: bigintType;
43
+ /** Max priority fee per gas (in wei). */
44
+ maxPriorityFeePerGas: bigintType;
45
+ }>;
46
+ /**
47
+ * Fee token transaction in RPC format.
48
+ */
49
+ export type FeeTokenRpc<pending extends boolean = false> = Compute<FeeToken<pending, Hex.Hex, Hex.Hex, ToRpcType['feeToken']>>;
50
+ /** Type to RPC Type mapping. */
51
+ export declare const toRpcType: {
52
+ readonly feeToken: "0x77";
53
+ readonly legacy: "0x0";
54
+ readonly eip2930: "0x1";
55
+ readonly eip1559: "0x2";
56
+ readonly eip4844: "0x3";
57
+ readonly eip7702: "0x4";
58
+ };
59
+ /** Type to RPC Type mapping. */
60
+ export type ToRpcType = typeof toRpcType & {
61
+ [type: string]: `0x${string}`;
62
+ };
63
+ /** RPC Type to Type mapping. */
64
+ export declare const fromRpcType: {
65
+ readonly '0x77': "feeToken";
66
+ readonly '0x0': "legacy";
67
+ readonly '0x1': "eip2930";
68
+ readonly '0x2': "eip1559";
69
+ readonly '0x3': "eip4844";
70
+ readonly '0x4': "eip7702";
71
+ };
72
+ /** RPC Type to Type mapping. */
73
+ export type FromRpcType = typeof fromRpcType & {
74
+ [type: `0x${string}`]: string;
75
+ };
76
+ /**
77
+ * Converts an {@link ox#Transaction.Rpc} to an {@link ox#Transaction.Transaction}.
78
+ *
79
+ * @example
80
+ * ```ts twoslash
81
+ * import { Transaction } from 'ox/tempo'
82
+ *
83
+ * const transaction = Transaction.fromRpc({
84
+ * hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
85
+ * nonce: '0x357',
86
+ * blockHash:
87
+ * '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
88
+ * blockNumber: '0x12f296f',
89
+ * feeToken: '0x20c0000000000000000000000000000000000000',
90
+ * transactionIndex: '0x2',
91
+ * from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
92
+ * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
93
+ * value: '0x9b6e64a8ec60000',
94
+ * gas: '0x43f5d',
95
+ * maxFeePerGas: '0x2ca6ae494',
96
+ * maxPriorityFeePerGas: '0x41cc3c0',
97
+ * input:
98
+ * '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
99
+ * r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
100
+ * s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
101
+ * yParity: '0x0',
102
+ * chainId: '0x1',
103
+ * accessList: [],
104
+ * type: '0x77',
105
+ * })
106
+ * ```
107
+ *
108
+ * @param transaction - The RPC transaction to convert.
109
+ * @returns An instantiated {@link ox#Transaction.Transaction}.
110
+ */
111
+ export declare function fromRpc<const transaction extends Rpc | null, pending extends boolean = false>(transaction: transaction | Rpc<pending> | null, _options?: fromRpc.Options<pending>): transaction extends Rpc<pending> ? Transaction<pending> : null;
112
+ export declare namespace fromRpc {
113
+ type Options<pending extends boolean = false> = {
114
+ pending?: pending | boolean | undefined;
115
+ };
116
+ type ErrorType = ox_Transaction.fromRpc.ErrorType | Errors.GlobalErrorType;
117
+ }
118
+ /**
119
+ * Converts an {@link ox#Transaction.Transaction} to an {@link ox#Transaction.Rpc}.
120
+ *
121
+ * @example
122
+ * ```ts twoslash
123
+ * import { Transaction } from 'ox/tempo'
124
+ *
125
+ * const transaction = Transaction.toRpc({
126
+ * accessList: [],
127
+ * blockHash:
128
+ * '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
129
+ * blockNumber: 19868015n,
130
+ * chainId: 1,
131
+ * feeToken: '0x20c0000000000000000000000000000000000000',
132
+ * from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
133
+ * gas: 278365n,
134
+ * hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
135
+ * input:
136
+ * '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
137
+ * maxFeePerGas: 11985937556n,
138
+ * maxPriorityFeePerGas: 68993984n,
139
+ * nonce: 855n,
140
+ * r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
141
+ * s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
142
+ * to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
143
+ * transactionIndex: 2,
144
+ * type: 'feeToken',
145
+ * v: 27,
146
+ * value: 700000000000000000n,
147
+ * yParity: 0,
148
+ * })
149
+ * ```
150
+ *
151
+ * @param transaction - The transaction to convert.
152
+ * @returns An RPC-formatted transaction.
153
+ */
154
+ export declare function toRpc<pending extends boolean = false>(transaction: Transaction<pending>, _options?: toRpc.Options<pending>): Rpc<pending>;
155
+ export declare namespace toRpc {
156
+ type Options<pending extends boolean = false> = {
157
+ pending?: pending | boolean | undefined;
158
+ };
159
+ type ErrorType = ox_Transaction.toRpc.ErrorType | Errors.GlobalErrorType;
160
+ }
161
+ //# sourceMappingURL=Transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transaction.d.ts","sourceRoot":"","sources":["../../src/ox/Transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,eAAe,CAAA;AAChD,OAAO,KAAK,KAAK,OAAO,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,KAAK,aAAa,MAAM,kBAAkB,CAAA;AACtD,OAAO,KAAK,KAAK,MAAM,MAAM,WAAW,CAAA;AACxC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAG7B,OAAO,KAAK,cAAc,MAAM,gBAAgB,CAAA;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,6BAA4B;AAGxE;;GAEG;AACH,MAAM,MAAM,WAAW,CACrB,OAAO,SAAS,OAAO,GAAG,KAAK,EAC/B,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,IACjB,YAAY,CACd,KAAK,CACD,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,GACzC,cAAc,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,CAAC,CAC9D,CACF,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,GAAG,CAAC,OAAO,SAAS,OAAO,GAAG,KAAK,IAAI,YAAY,CAC7D,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAC1D,CAAA;AAED;;GAEG;AACH,MAAM,MAAM,QAAQ,CAClB,OAAO,SAAS,OAAO,GAAG,KAAK,EAC/B,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,EACnB,IAA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