tempo.ts 0.1.1 → 0.1.2
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/package.json +17 -18
- package/src/ox/TokenId.test.ts +11 -0
- package/src/ox/TokenId.ts +15 -0
- package/src/prool/Instance.ts +2 -2
- package/src/viem/Abis.ts +2 -1
- package/src/viem/Actions/dex.test.ts +15 -15
- package/src/viem/Actions/token.test.ts +22 -4
- package/src/viem/Actions/token.ts +1 -1
- package/src/viem/e2e.test.ts +11 -10
- package/dist/chains.d.ts +0 -1180
- package/dist/chains.d.ts.map +0 -1
- package/dist/chains.js +0 -30
- package/dist/chains.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/internal/types.d.ts +0 -284
- package/dist/internal/types.d.ts.map +0 -1
- package/dist/internal/types.js +0 -2
- package/dist/internal/types.js.map +0 -1
- package/dist/ox/SignatureEnvelope.d.ts +0 -245
- package/dist/ox/SignatureEnvelope.d.ts.map +0 -1
- package/dist/ox/SignatureEnvelope.js +0 -437
- package/dist/ox/SignatureEnvelope.js.map +0 -1
- package/dist/ox/TokenId.d.ts +0 -18
- package/dist/ox/TokenId.d.ts.map +0 -1
- package/dist/ox/TokenId.js +0 -29
- package/dist/ox/TokenId.js.map +0 -1
- package/dist/ox/TokenRole.d.ts +0 -11
- package/dist/ox/TokenRole.d.ts.map +0 -1
- package/dist/ox/TokenRole.js +0 -22
- package/dist/ox/TokenRole.js.map +0 -1
- package/dist/ox/Transaction.d.ts +0 -198
- package/dist/ox/Transaction.d.ts.map +0 -1
- package/dist/ox/Transaction.js +0 -162
- package/dist/ox/Transaction.js.map +0 -1
- package/dist/ox/TransactionEnvelopeAA.d.ts +0 -461
- package/dist/ox/TransactionEnvelopeAA.d.ts.map +0 -1
- package/dist/ox/TransactionEnvelopeAA.js +0 -528
- package/dist/ox/TransactionEnvelopeAA.js.map +0 -1
- package/dist/ox/TransactionRequest.d.ts +0 -64
- package/dist/ox/TransactionRequest.d.ts.map +0 -1
- package/dist/ox/TransactionRequest.js +0 -75
- package/dist/ox/TransactionRequest.js.map +0 -1
- package/dist/ox/index.d.ts +0 -6
- package/dist/ox/index.d.ts.map +0 -1
- package/dist/ox/index.js +0 -6
- package/dist/ox/index.js.map +0 -1
- package/dist/prool/Instance.d.ts +0 -88
- package/dist/prool/Instance.d.ts.map +0 -1
- package/dist/prool/Instance.js +0 -96
- package/dist/prool/Instance.js.map +0 -1
- package/dist/prool/index.d.ts +0 -2
- package/dist/prool/index.d.ts.map +0 -1
- package/dist/prool/index.js +0 -2
- package/dist/prool/index.js.map +0 -1
- package/dist/viem/Abis.d.ts +0 -1881
- package/dist/viem/Abis.d.ts.map +0 -1
- package/dist/viem/Abis.js +0 -1173
- package/dist/viem/Abis.js.map +0 -1
- package/dist/viem/Actions/amm.d.ts +0 -2006
- package/dist/viem/Actions/amm.d.ts.map +0 -1
- package/dist/viem/Actions/amm.js +0 -900
- package/dist/viem/Actions/amm.js.map +0 -1
- package/dist/viem/Actions/dex.d.ts +0 -3263
- package/dist/viem/Actions/dex.d.ts.map +0 -1
- package/dist/viem/Actions/dex.js +0 -1357
- package/dist/viem/Actions/dex.js.map +0 -1
- package/dist/viem/Actions/fee.d.ts +0 -374
- package/dist/viem/Actions/fee.d.ts.map +0 -1
- package/dist/viem/Actions/fee.js +0 -235
- package/dist/viem/Actions/fee.js.map +0 -1
- package/dist/viem/Actions/index.d.ts +0 -6
- package/dist/viem/Actions/index.d.ts.map +0 -1
- package/dist/viem/Actions/index.js +0 -6
- package/dist/viem/Actions/index.js.map +0 -1
- package/dist/viem/Actions/policy.d.ts +0 -1672
- package/dist/viem/Actions/policy.d.ts.map +0 -1
- package/dist/viem/Actions/policy.js +0 -875
- package/dist/viem/Actions/policy.js.map +0 -1
- package/dist/viem/Actions/token.d.ts +0 -13714
- package/dist/viem/Actions/token.d.ts.map +0 -1
- package/dist/viem/Actions/token.js +0 -3058
- package/dist/viem/Actions/token.js.map +0 -1
- package/dist/viem/Addresses.d.ts +0 -9
- package/dist/viem/Addresses.d.ts.map +0 -1
- package/dist/viem/Addresses.js +0 -9
- package/dist/viem/Addresses.js.map +0 -1
- package/dist/viem/Chain.d.ts +0 -365
- package/dist/viem/Chain.d.ts.map +0 -1
- package/dist/viem/Chain.js +0 -22
- package/dist/viem/Chain.js.map +0 -1
- package/dist/viem/Client.d.ts +0 -27
- package/dist/viem/Client.d.ts.map +0 -1
- package/dist/viem/Client.js +0 -28
- package/dist/viem/Client.js.map +0 -1
- package/dist/viem/Decorator.d.ts +0 -2161
- package/dist/viem/Decorator.d.ts.map +0 -1
- package/dist/viem/Decorator.js +0 -122
- package/dist/viem/Decorator.js.map +0 -1
- package/dist/viem/Formatters.d.ts +0 -4
- package/dist/viem/Formatters.d.ts.map +0 -1
- package/dist/viem/Formatters.js +0 -76
- package/dist/viem/Formatters.js.map +0 -1
- package/dist/viem/Tick.d.ts +0 -111
- package/dist/viem/Tick.d.ts.map +0 -1
- package/dist/viem/Tick.js +0 -127
- package/dist/viem/Tick.js.map +0 -1
- package/dist/viem/TokenIds.d.ts +0 -3
- package/dist/viem/TokenIds.d.ts.map +0 -1
- package/dist/viem/TokenIds.js +0 -3
- package/dist/viem/TokenIds.js.map +0 -1
- package/dist/viem/Transaction.d.ts +0 -57
- package/dist/viem/Transaction.d.ts.map +0 -1
- package/dist/viem/Transaction.js +0 -137
- package/dist/viem/Transaction.js.map +0 -1
- package/dist/viem/Transport.d.ts +0 -16
- package/dist/viem/Transport.d.ts.map +0 -1
- package/dist/viem/Transport.js +0 -33
- package/dist/viem/Transport.js.map +0 -1
- package/dist/viem/index.d.ts +0 -14
- package/dist/viem/index.d.ts.map +0 -1
- package/dist/viem/index.js +0 -14
- package/dist/viem/index.js.map +0 -1
- package/dist/viem/internal/types.d.ts +0 -10
- package/dist/viem/internal/types.d.ts.map +0 -1
- package/dist/viem/internal/types.js +0 -2
- package/dist/viem/internal/types.js.map +0 -1
- package/dist/viem/internal/utils.d.ts +0 -8
- package/dist/viem/internal/utils.d.ts.map +0 -1
- package/dist/viem/internal/utils.js +0 -9
- package/dist/viem/internal/utils.js.map +0 -1
package/dist/chains.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYvB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAYrB,CAAA;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAA0C,CAAA"}
|
package/dist/chains.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { defineChain } from 'viem';
|
|
2
|
-
import * as Chain from './viem/Chain.js';
|
|
3
|
-
export const tempoAndante = /*#__PURE__*/ defineChain({
|
|
4
|
-
...Chain.config,
|
|
5
|
-
id: 42427,
|
|
6
|
-
name: 'Tempo Andante',
|
|
7
|
-
nativeCurrency: {
|
|
8
|
-
name: 'USD',
|
|
9
|
-
symbol: 'USD',
|
|
10
|
-
decimals: 6,
|
|
11
|
-
},
|
|
12
|
-
rpcUrls: {
|
|
13
|
-
default: { http: ['https://rpc-andante.tempoxyz.dev'] },
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
export const tempoLocal = /*#__PURE__*/ defineChain({
|
|
17
|
-
...Chain.config,
|
|
18
|
-
id: 1337,
|
|
19
|
-
name: 'Tempo',
|
|
20
|
-
nativeCurrency: {
|
|
21
|
-
name: 'USD',
|
|
22
|
-
symbol: 'USD',
|
|
23
|
-
decimals: 6,
|
|
24
|
-
},
|
|
25
|
-
rpcUrls: {
|
|
26
|
-
default: { http: ['http://localhost:8545'] },
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
export const tempo = /*#__PURE__*/ defineChain(tempoAndante);
|
|
30
|
-
//# sourceMappingURL=chains.js.map
|
package/dist/chains.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chains.js","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,KAAK,MAAM,iBAAiB,CAAA;AAExC,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC,WAAW,CAAC;IACpD,GAAG,KAAK,CAAC,MAAM;IACf,EAAE,EAAE,KAAK;IACT,IAAI,EAAE,eAAe;IACrB,cAAc,EAAE;QACd,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,kCAAkC,CAAC,EAAE;KACxD;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC,WAAW,CAAC;IAClD,GAAG,KAAK,CAAC,MAAM;IACf,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,OAAO;IACb,cAAc,EAAE;QACd,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,CAAC;KACZ;IACD,OAAO,EAAE;QACP,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,uBAAuB,CAAC,EAAE;KAC7C;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,WAAW,CAAC,YAAY,CAAC,CAAA"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
|
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAA"}
|
package/dist/internal/types.d.ts
DELETED
|
@@ -1,284 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,CAAC;CAAE,GAAG,OAAO,CAAA;AAExE,OAAO,CAAC,MAAM,MAAM,EAAE,OAAO,MAAM,CAAA;AAEnC;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;CAAE,CAAA;AAE/C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,MAAM,CAChB,CAAC,SAAS,SAAS,OAAO,EAAE,EAC5B,CAAC,EACD,GAAG,SAAS,SAAS,OAAO,EAAE,GAAG,EAAE,IACjC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,IAAI,SAAS,SAAS,OA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,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"}
|
package/dist/internal/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/internal/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import * as Errors from 'ox/Errors';
|
|
2
|
-
import * as Hex from 'ox/Hex';
|
|
3
|
-
import type * as PublicKey from 'ox/PublicKey';
|
|
4
|
-
import * as Signature from 'ox/Signature';
|
|
5
|
-
import type * as WebAuthnP256 from 'ox/WebAuthnP256';
|
|
6
|
-
import type { Assign, Compute, IsNarrowable, OneOf, PartialBy } from '../internal/types.js';
|
|
7
|
-
/**
|
|
8
|
-
* Statically determines the signature type of an envelope at compile time.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts twoslash
|
|
12
|
-
* import type { SignatureEnvelope } from 'tempo.ts/ox'
|
|
13
|
-
*
|
|
14
|
-
* type Type = SignatureEnvelope.GetType<{ r: bigint; s: bigint; yParity: number }>
|
|
15
|
-
* // @log: 'secp256k1'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export type GetType<envelope extends PartialBy<SignatureEnvelope, 'type'> | unknown> = unknown extends envelope ? envelope extends unknown ? Type : never : envelope extends {
|
|
19
|
-
type: infer T extends Type;
|
|
20
|
-
} ? T : envelope extends {
|
|
21
|
-
signature: {
|
|
22
|
-
r: bigint;
|
|
23
|
-
s: bigint;
|
|
24
|
-
};
|
|
25
|
-
prehash: boolean;
|
|
26
|
-
publicKey: PublicKey.PublicKey;
|
|
27
|
-
} ? 'p256' : envelope extends {
|
|
28
|
-
signature: {
|
|
29
|
-
r: bigint;
|
|
30
|
-
s: bigint;
|
|
31
|
-
};
|
|
32
|
-
metadata: any;
|
|
33
|
-
publicKey: PublicKey.PublicKey;
|
|
34
|
-
} ? 'webAuthn' : envelope extends {
|
|
35
|
-
r: bigint;
|
|
36
|
-
s: bigint;
|
|
37
|
-
yParity: number;
|
|
38
|
-
} ? 'secp256k1' : envelope extends {
|
|
39
|
-
signature: {
|
|
40
|
-
r: bigint;
|
|
41
|
-
s: bigint;
|
|
42
|
-
yParity: number;
|
|
43
|
-
};
|
|
44
|
-
} ? 'secp256k1' : never;
|
|
45
|
-
/**
|
|
46
|
-
* Represents a signature envelope that can contain different signature types.
|
|
47
|
-
*
|
|
48
|
-
* Supports:
|
|
49
|
-
* - secp256k1: Standard ECDSA signature (65 bytes)
|
|
50
|
-
* - p256: P256 signature with embedded public key and prehash flag (130 bytes)
|
|
51
|
-
* - webAuthn: WebAuthn signature with variable-length authenticator data
|
|
52
|
-
*/
|
|
53
|
-
export type SignatureEnvelope<bigintType = bigint, numberType = number> = OneOf<Secp256k1<bigintType, numberType> | P256<bigintType, numberType> | WebAuthn<bigintType, numberType>>;
|
|
54
|
-
/**
|
|
55
|
-
* RPC-formatted signature envelope.
|
|
56
|
-
*/
|
|
57
|
-
export type SignatureEnvelopeRpc = OneOf<Secp256k1Rpc | P256Rpc | WebAuthnRpc>;
|
|
58
|
-
export type P256<bigintType = bigint, numberType = number> = {
|
|
59
|
-
prehash: boolean;
|
|
60
|
-
publicKey: PublicKey.PublicKey;
|
|
61
|
-
signature: Signature.Signature<false, bigintType, numberType>;
|
|
62
|
-
type: 'p256';
|
|
63
|
-
};
|
|
64
|
-
export type P256Rpc = {
|
|
65
|
-
prehash: boolean;
|
|
66
|
-
pubKeyX: Hex.Hex;
|
|
67
|
-
pubKeyY: Hex.Hex;
|
|
68
|
-
r: Hex.Hex;
|
|
69
|
-
s: Hex.Hex;
|
|
70
|
-
type: 'p256';
|
|
71
|
-
};
|
|
72
|
-
export type Secp256k1<bigintType = bigint, numberType = number> = {
|
|
73
|
-
signature: Signature.Signature<true, bigintType, numberType>;
|
|
74
|
-
type: 'secp256k1';
|
|
75
|
-
};
|
|
76
|
-
export type Secp256k1Rpc = Compute<Signature.Rpc<true> & {
|
|
77
|
-
v?: Hex.Hex | undefined;
|
|
78
|
-
type: 'secp256k1';
|
|
79
|
-
}>;
|
|
80
|
-
export type Secp256k1Flat<bigintType = bigint, numberType = number> = Signature.Signature<true, bigintType, numberType> & {
|
|
81
|
-
type?: 'secp256k1' | undefined;
|
|
82
|
-
};
|
|
83
|
-
export type WebAuthn<bigintType = bigint, numberType = number> = {
|
|
84
|
-
metadata: Pick<WebAuthnP256.SignMetadata, 'authenticatorData' | 'clientDataJSON'>;
|
|
85
|
-
signature: Signature.Signature<false, bigintType, numberType>;
|
|
86
|
-
publicKey: PublicKey.PublicKey;
|
|
87
|
-
type: 'webAuthn';
|
|
88
|
-
};
|
|
89
|
-
export type WebAuthnRpc = {
|
|
90
|
-
pubKeyX: Hex.Hex;
|
|
91
|
-
pubKeyY: Hex.Hex;
|
|
92
|
-
r: Hex.Hex;
|
|
93
|
-
s: Hex.Hex;
|
|
94
|
-
type: 'webAuthn';
|
|
95
|
-
webauthnData: Hex.Hex;
|
|
96
|
-
};
|
|
97
|
-
/** Hex-encoded serialized signature envelope. */
|
|
98
|
-
export type Serialized = Hex.Hex;
|
|
99
|
-
/** List of supported signature types. */
|
|
100
|
-
export declare const types: readonly ["secp256k1", "p256", "webAuthn"];
|
|
101
|
-
/** Union type of supported signature types. */
|
|
102
|
-
export type Type = (typeof types)[number];
|
|
103
|
-
/**
|
|
104
|
-
* Asserts that a {@link SignatureEnvelope} is valid.
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```ts twoslash
|
|
108
|
-
* import { SignatureEnvelope } from 'tempo.ts/ox'
|
|
109
|
-
*
|
|
110
|
-
* SignatureEnvelope.assert({
|
|
111
|
-
* r: 0n,
|
|
112
|
-
* s: 0n,
|
|
113
|
-
* yParity: 0,
|
|
114
|
-
* type: 'secp256k1',
|
|
115
|
-
* })
|
|
116
|
-
* ```
|
|
117
|
-
*
|
|
118
|
-
* @param envelope - The signature envelope to assert.
|
|
119
|
-
* @throws {CoercionError} If the envelope type cannot be determined.
|
|
120
|
-
*/
|
|
121
|
-
export declare function assert(envelope: PartialBy<SignatureEnvelope, 'type'>): void;
|
|
122
|
-
export declare namespace assert {
|
|
123
|
-
type ErrorType = CoercionError | MissingPropertiesError | Signature.assert.ErrorType | Errors.GlobalErrorType;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Deserializes a hex-encoded signature envelope into a typed signature object.
|
|
127
|
-
*
|
|
128
|
-
* For backward compatibility:
|
|
129
|
-
* - 65 bytes: secp256k1 signature (no type identifier)
|
|
130
|
-
* - 130 bytes: P256 signature (1 byte type + 129 bytes data)
|
|
131
|
-
* - 129+ bytes: WebAuthn signature (1 byte type + variable data)
|
|
132
|
-
*
|
|
133
|
-
* @param serialized - The hex-encoded signature envelope to deserialize.
|
|
134
|
-
* @returns The deserialized signature envelope.
|
|
135
|
-
* @throws {CoercionError} If the serialized value cannot be coerced to a valid signature envelope.
|
|
136
|
-
*/
|
|
137
|
-
export declare function deserialize(serialized: Serialized): SignatureEnvelope;
|
|
138
|
-
/**
|
|
139
|
-
* Coerces a value to a signature envelope.
|
|
140
|
-
*
|
|
141
|
-
* Accepts either a serialized hex string or an existing signature envelope object.
|
|
142
|
-
*
|
|
143
|
-
* @param value - The value to coerce (either a hex string or signature envelope).
|
|
144
|
-
* @returns The signature envelope.
|
|
145
|
-
*/
|
|
146
|
-
export declare function from<const value extends from.Value>(value: value | from.Value): from.ReturnValue<value>;
|
|
147
|
-
export declare namespace from {
|
|
148
|
-
type Value = PartialBy<SignatureEnvelope, 'type'> | Secp256k1Flat | Serialized;
|
|
149
|
-
type ReturnValue<value extends Value> = Compute<OneOf<value extends Serialized ? SignatureEnvelope : value extends Secp256k1Flat ? Secp256k1 : IsNarrowable<value, SignatureEnvelope> extends true ? SignatureEnvelope : Assign<value, {
|
|
150
|
-
readonly type: GetType<value>;
|
|
151
|
-
}>>>;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Converts an {@link SignatureEnvelopeRpc} to a {@link SignatureEnvelope}.
|
|
155
|
-
*
|
|
156
|
-
* @param envelope - The RPC signature envelope to convert.
|
|
157
|
-
* @returns The signature envelope with bigint values.
|
|
158
|
-
*/
|
|
159
|
-
export declare function fromRpc(envelope: SignatureEnvelopeRpc): SignatureEnvelope;
|
|
160
|
-
export declare namespace fromRpc {
|
|
161
|
-
type ErrorType = CoercionError | InvalidSerializedError | Signature.fromRpc.ErrorType | Errors.GlobalErrorType;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Determines the signature type of an envelope.
|
|
165
|
-
*
|
|
166
|
-
* @param envelope - The signature envelope to inspect.
|
|
167
|
-
* @returns The signature type ('secp256k1', 'p256', or 'webAuthn').
|
|
168
|
-
* @throws {CoercionError} If the envelope type cannot be determined.
|
|
169
|
-
*/
|
|
170
|
-
export declare function getType<envelope extends PartialBy<SignatureEnvelope, 'type'> | Secp256k1Flat | unknown>(envelope: envelope): GetType<envelope>;
|
|
171
|
-
/**
|
|
172
|
-
* Serializes a signature envelope to a hex-encoded string.
|
|
173
|
-
*
|
|
174
|
-
* For backward compatibility:
|
|
175
|
-
* - secp256k1: encoded WITHOUT type identifier (65 bytes)
|
|
176
|
-
* - P256: encoded WITH type identifier prefix (130 bytes)
|
|
177
|
-
* - WebAuthn: encoded WITH type identifier prefix (variable length)
|
|
178
|
-
*
|
|
179
|
-
* @param envelope - The signature envelope to serialize.
|
|
180
|
-
* @returns The hex-encoded serialized signature.
|
|
181
|
-
* @throws {CoercionError} If the envelope cannot be serialized.
|
|
182
|
-
*/
|
|
183
|
-
export declare function serialize(envelope: SignatureEnvelope): Serialized;
|
|
184
|
-
/**
|
|
185
|
-
* Converts a {@link SignatureEnvelope} to an {@link SignatureEnvelopeRpc}.
|
|
186
|
-
*
|
|
187
|
-
* @param envelope - The signature envelope to convert.
|
|
188
|
-
* @returns The RPC signature envelope with hex values.
|
|
189
|
-
*/
|
|
190
|
-
export declare function toRpc(envelope: SignatureEnvelope): SignatureEnvelopeRpc;
|
|
191
|
-
export declare namespace toRpc {
|
|
192
|
-
type ErrorType = CoercionError | Signature.toRpc.ErrorType | Errors.GlobalErrorType;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Validates a {@link SignatureEnvelope}. Returns `true` if the envelope is valid, `false` otherwise.
|
|
196
|
-
*
|
|
197
|
-
* @example
|
|
198
|
-
* ```ts twoslash
|
|
199
|
-
* import { SignatureEnvelope } from 'tempo.ts/ox'
|
|
200
|
-
*
|
|
201
|
-
* const valid = SignatureEnvelope.validate({
|
|
202
|
-
* signature: { r: 0n, s: 0n, yParity: 0 },
|
|
203
|
-
* type: 'secp256k1',
|
|
204
|
-
* })
|
|
205
|
-
* // @log: true
|
|
206
|
-
* ```
|
|
207
|
-
*
|
|
208
|
-
* @param envelope - The signature envelope to validate.
|
|
209
|
-
* @returns `true` if valid, `false` otherwise.
|
|
210
|
-
*/
|
|
211
|
-
export declare function validate(envelope: PartialBy<SignatureEnvelope, 'type'>): boolean;
|
|
212
|
-
export declare namespace validate {
|
|
213
|
-
type ErrorType = Errors.GlobalErrorType;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Error thrown when a signature envelope cannot be coerced to a valid type.
|
|
217
|
-
*/
|
|
218
|
-
export declare class CoercionError extends Errors.BaseError {
|
|
219
|
-
readonly name = "SignatureEnvelope.CoercionError";
|
|
220
|
-
constructor({ envelope }: {
|
|
221
|
-
envelope: unknown;
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Error thrown when a signature envelope is missing required properties.
|
|
226
|
-
*/
|
|
227
|
-
export declare class MissingPropertiesError extends Errors.BaseError {
|
|
228
|
-
readonly name = "SignatureEnvelope.MissingPropertiesError";
|
|
229
|
-
constructor({ envelope, missing, type, }: {
|
|
230
|
-
envelope: unknown;
|
|
231
|
-
missing: string[];
|
|
232
|
-
type: Type;
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Error thrown when a serialized signature envelope cannot be deserialized.
|
|
237
|
-
*/
|
|
238
|
-
export declare class InvalidSerializedError extends Errors.BaseError {
|
|
239
|
-
readonly name = "SignatureEnvelope.InvalidSerializedError";
|
|
240
|
-
constructor({ reason, serialized, }: {
|
|
241
|
-
reason: string;
|
|
242
|
-
serialized: Hex.Hex;
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
//# sourceMappingURL=SignatureEnvelope.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SignatureEnvelope.d.ts","sourceRoot":"","sources":["../../src/ox/SignatureEnvelope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,KAAK,KAAK,SAAS,MAAM,cAAc,CAAA;AAC9C,OAAO,KAAK,SAAS,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,KAAK,YAAY,MAAM,iBAAiB,CAAA;AACpD,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,YAAY,EACZ,KAAK,EACL,SAAS,EACV,MAAM,sBAAsB,CAAA;AAM7B;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,CACjB,QAAQ,SAAS,SAAS,CAAC,iBAAiB,EAAE,MAAM,CAAC,GAAG,OAAO,IAC7D,OAAO,SAAS,QAAQ,GAC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