@ckb-ccc/did-ckb 0.2.14 → 0.2.16
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/CHANGELOG.md +17 -0
- package/dist/barrel-BYdcNWd1.d.mts +431 -0
- package/dist/barrel-BYdcNWd1.d.mts.map +1 -0
- package/dist/barrel-CRigE_Kq.mjs +2 -0
- package/dist/barrel-CRigE_Kq.mjs.map +1 -0
- package/dist/barrel.d.mts +3 -440
- package/dist/barrel.mjs +1 -1
- package/{dist.commonjs/index-DbyAhugH.d.ts → dist/index-C0QY5P5_.d.mts} +2 -3
- package/dist/{index-PkKhX08A.d.mts.map → index-C0QY5P5_.d.mts.map} +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/plc-CAHX4f5y.mjs +2 -0
- package/dist/plc-CAHX4f5y.mjs.map +1 -0
- package/dist/plc.d.mts +1 -1
- package/dist/plc.mjs +1 -2
- package/dist/rolldown-runtime-P3Pd_6ND.mjs +1 -0
- package/dist.commonjs/barrel-9fYvfkI1.d.ts +431 -0
- package/dist.commonjs/barrel-9fYvfkI1.d.ts.map +1 -0
- package/dist.commonjs/barrel-BWApUcdp.js +6 -0
- package/dist.commonjs/barrel-BWApUcdp.js.map +1 -0
- package/dist.commonjs/barrel.d.ts +3 -440
- package/dist.commonjs/barrel.js +1 -1
- package/{dist/index-PkKhX08A.d.mts → dist.commonjs/index-C0QY5P5_.d.ts} +1 -2
- package/dist.commonjs/{index-DbyAhugH.d.ts.map → index-C0QY5P5_.d.ts.map} +1 -1
- package/dist.commonjs/index.d.ts +2 -2
- package/dist.commonjs/index.js +1 -1
- package/dist.commonjs/plc-DMi9GhTp.js +2 -0
- package/dist.commonjs/{plc.js.map → plc-DMi9GhTp.js.map} +1 -1
- package/dist.commonjs/plc.d.ts +1 -1
- package/dist.commonjs/plc.js +1 -2
- package/package.json +3 -3
- package/src/history.ts +4 -8
- package/dist/barrel-DEJnxd4o.mjs +0 -2
- package/dist/barrel-DEJnxd4o.mjs.map +0 -1
- package/dist/barrel.d.mts.map +0 -1
- package/dist/plc.mjs.map +0 -1
- package/dist/rolldown-runtime-DK3Fl9T5.mjs +0 -1
- package/dist.commonjs/barrel-C62ZxemC.js +0 -2
- package/dist.commonjs/barrel-C62ZxemC.js.map +0 -1
- package/dist.commonjs/barrel.d.ts.map +0 -1
- package/dist.commonjs/rolldown-runtime-BIInC43l.js +0 -1
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
import { n as PlcOperation, s as index_d_exports, t as Curve } from "./index-C0QY5P5_.js";
|
|
2
|
+
import { ccc } from "@ckb-ccc/core";
|
|
3
|
+
type DidCkbDataV1Like = {
|
|
4
|
+
document: unknown;
|
|
5
|
+
localId?: string | null;
|
|
6
|
+
};
|
|
7
|
+
declare const DidCkbDataV1_base: (abstract new () => {
|
|
8
|
+
toBytes(): ccc.Bytes;
|
|
9
|
+
clone(): DidCkbDataV1;
|
|
10
|
+
eq(other: DidCkbDataV1Like): boolean;
|
|
11
|
+
hash(): ccc.Hex;
|
|
12
|
+
toHex(): ccc.Hex;
|
|
13
|
+
}) & {
|
|
14
|
+
byteLength?: number;
|
|
15
|
+
encode(_: DidCkbDataV1Like): ccc.Bytes;
|
|
16
|
+
decode(_: ccc.BytesLike, _context?: any): DidCkbDataV1;
|
|
17
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: any): DidCkbDataV1;
|
|
18
|
+
from(_: DidCkbDataV1Like): DidCkbDataV1;
|
|
19
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
20
|
+
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
|
|
21
|
+
readonly inner: ccc.DecodedType<CodecType>;
|
|
22
|
+
match<Result>(handlers: ccc.mol.UnionMatchHandlers<CodecType, Result> & {
|
|
23
|
+
_?: undefined | null;
|
|
24
|
+
}): Result;
|
|
25
|
+
match<Result>(handlers: Partial<ccc.mol.UnionMatchHandlers<CodecType, Result>> & {
|
|
26
|
+
_: (inner: ccc.DecodedType<CodecType>) => Result;
|
|
27
|
+
}): Result;
|
|
28
|
+
toBytes(): ccc.Bytes;
|
|
29
|
+
clone(): SubType_1;
|
|
30
|
+
eq(other: SubTypeLike_1): boolean;
|
|
31
|
+
hash(): ccc.Hex;
|
|
32
|
+
toHex(): ccc.Hex;
|
|
33
|
+
}) & {
|
|
34
|
+
byteLength?: number;
|
|
35
|
+
encode(_: SubTypeLike_1): ccc.Bytes;
|
|
36
|
+
decode(_: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
37
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
38
|
+
from(_: SubTypeLike_1): SubType_1;
|
|
39
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
40
|
+
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
declare class DidCkbDataV1 extends DidCkbDataV1_base {
|
|
44
|
+
document: unknown;
|
|
45
|
+
localId?: string | undefined;
|
|
46
|
+
constructor(document: unknown, localId?: string | undefined);
|
|
47
|
+
static from(data: DidCkbDataV1Like): DidCkbDataV1;
|
|
48
|
+
}
|
|
49
|
+
type DidCkbDataLike = {
|
|
50
|
+
type?: "v1" | null;
|
|
51
|
+
value: DidCkbDataV1Like;
|
|
52
|
+
} | {
|
|
53
|
+
inner: {
|
|
54
|
+
type?: "v1" | null;
|
|
55
|
+
value: DidCkbDataV1Like;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
declare const DidCkbData_base: (abstract new (inner: {
|
|
59
|
+
type: "v1";
|
|
60
|
+
value: DidCkbDataV1;
|
|
61
|
+
}) => {
|
|
62
|
+
readonly inner: {
|
|
63
|
+
type: "v1";
|
|
64
|
+
value: DidCkbDataV1;
|
|
65
|
+
};
|
|
66
|
+
match<Result>(handlers: ccc.mol.UnionMatchHandlers<ccc.Codec<{
|
|
67
|
+
type: "v1";
|
|
68
|
+
value: DidCkbDataV1Like;
|
|
69
|
+
} | {
|
|
70
|
+
inner: {
|
|
71
|
+
type: "v1";
|
|
72
|
+
value: DidCkbDataV1Like;
|
|
73
|
+
};
|
|
74
|
+
}, {
|
|
75
|
+
type: "v1";
|
|
76
|
+
value: DidCkbDataV1;
|
|
77
|
+
}, unknown>, Result> & {
|
|
78
|
+
_?: undefined | null;
|
|
79
|
+
}): Result;
|
|
80
|
+
match<Result>(handlers: Partial<ccc.mol.UnionMatchHandlers<ccc.Codec<{
|
|
81
|
+
type: "v1";
|
|
82
|
+
value: DidCkbDataV1Like;
|
|
83
|
+
} | {
|
|
84
|
+
inner: {
|
|
85
|
+
type: "v1";
|
|
86
|
+
value: DidCkbDataV1Like;
|
|
87
|
+
};
|
|
88
|
+
}, {
|
|
89
|
+
type: "v1";
|
|
90
|
+
value: DidCkbDataV1;
|
|
91
|
+
}, unknown>, Result>> & {
|
|
92
|
+
_: (inner: {
|
|
93
|
+
type: "v1";
|
|
94
|
+
value: DidCkbDataV1;
|
|
95
|
+
}) => Result;
|
|
96
|
+
}): Result;
|
|
97
|
+
toBytes(): ccc.Bytes;
|
|
98
|
+
clone(): DidCkbData;
|
|
99
|
+
eq(other: DidCkbDataLike): boolean;
|
|
100
|
+
hash(): ccc.Hex;
|
|
101
|
+
toHex(): ccc.Hex;
|
|
102
|
+
}) & {
|
|
103
|
+
byteLength?: number;
|
|
104
|
+
encode(_: DidCkbDataLike): ccc.Bytes;
|
|
105
|
+
decode(_: ccc.BytesLike, _context?: unknown): DidCkbData;
|
|
106
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: unknown): DidCkbData;
|
|
107
|
+
from(_: DidCkbDataLike): DidCkbData;
|
|
108
|
+
Base<SubTypeLike_1, SubType_1 = SubTypeLike_1, Context = any>(): (abstract new () => {
|
|
109
|
+
toBytes(): ccc.Bytes;
|
|
110
|
+
clone(): SubType_1;
|
|
111
|
+
eq(other: SubTypeLike_1): boolean;
|
|
112
|
+
hash(): ccc.Hex;
|
|
113
|
+
toHex(): ccc.Hex;
|
|
114
|
+
}) & {
|
|
115
|
+
byteLength?: number;
|
|
116
|
+
encode(_: SubTypeLike_1): ccc.Bytes;
|
|
117
|
+
decode(_: ccc.BytesLike, _context?: Context): SubType_1;
|
|
118
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: Context): SubType_1;
|
|
119
|
+
from(_: SubTypeLike_1): SubType_1;
|
|
120
|
+
Base<SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1, Context_1 = any>(): any;
|
|
121
|
+
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike, SubType = SubTypeLike>(): any;
|
|
122
|
+
};
|
|
123
|
+
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike, SubType = SubTypeLike>(): any;
|
|
124
|
+
};
|
|
125
|
+
declare class DidCkbData extends DidCkbData_base {
|
|
126
|
+
type: "v1";
|
|
127
|
+
value: DidCkbDataV1;
|
|
128
|
+
constructor(type: "v1", value: DidCkbDataV1);
|
|
129
|
+
static from(data: DidCkbDataLike): DidCkbData;
|
|
130
|
+
static fromV1(data: DidCkbDataV1Like): DidCkbData & {
|
|
131
|
+
type: "v1";
|
|
132
|
+
value: DidCkbDataV1;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
type PlcAuthorizationLike = {
|
|
136
|
+
history: object[];
|
|
137
|
+
sig: ccc.HexLike;
|
|
138
|
+
rotationKeyIndices: ccc.NumLike[];
|
|
139
|
+
};
|
|
140
|
+
declare const PlcAuthorization_base: (abstract new () => {
|
|
141
|
+
toBytes(): ccc.Bytes;
|
|
142
|
+
clone(): PlcAuthorization;
|
|
143
|
+
eq(other: PlcAuthorizationLike): boolean;
|
|
144
|
+
hash(): ccc.Hex;
|
|
145
|
+
toHex(): ccc.Hex;
|
|
146
|
+
}) & {
|
|
147
|
+
byteLength?: number;
|
|
148
|
+
encode(_: PlcAuthorizationLike): ccc.Bytes;
|
|
149
|
+
decode(_: ccc.BytesLike, _context?: any): PlcAuthorization;
|
|
150
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: any): PlcAuthorization;
|
|
151
|
+
from(_: PlcAuthorizationLike): PlcAuthorization;
|
|
152
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
153
|
+
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
|
|
154
|
+
readonly inner: ccc.DecodedType<CodecType>;
|
|
155
|
+
match<Result>(handlers: ccc.mol.UnionMatchHandlers<CodecType, Result> & {
|
|
156
|
+
_?: undefined | null;
|
|
157
|
+
}): Result;
|
|
158
|
+
match<Result>(handlers: Partial<ccc.mol.UnionMatchHandlers<CodecType, Result>> & {
|
|
159
|
+
_: (inner: ccc.DecodedType<CodecType>) => Result;
|
|
160
|
+
}): Result;
|
|
161
|
+
toBytes(): ccc.Bytes;
|
|
162
|
+
clone(): SubType_1;
|
|
163
|
+
eq(other: SubTypeLike_1): boolean;
|
|
164
|
+
hash(): ccc.Hex;
|
|
165
|
+
toHex(): ccc.Hex;
|
|
166
|
+
}) & {
|
|
167
|
+
byteLength?: number;
|
|
168
|
+
encode(_: SubTypeLike_1): ccc.Bytes;
|
|
169
|
+
decode(_: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
170
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
171
|
+
from(_: SubTypeLike_1): SubType_1;
|
|
172
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
173
|
+
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
declare class PlcAuthorization extends PlcAuthorization_base {
|
|
177
|
+
history: object[];
|
|
178
|
+
sig: ccc.Hex;
|
|
179
|
+
rotationKeyIndices: ccc.Num[];
|
|
180
|
+
constructor(history: object[], sig: ccc.Hex, rotationKeyIndices: ccc.Num[]);
|
|
181
|
+
static from(data: PlcAuthorizationLike): PlcAuthorization;
|
|
182
|
+
}
|
|
183
|
+
type DidCkbWitnessLike = {
|
|
184
|
+
localIdAuthorization: PlcAuthorizationLike;
|
|
185
|
+
};
|
|
186
|
+
declare const DidCkbWitness_base: (abstract new () => {
|
|
187
|
+
toBytes(): ccc.Bytes;
|
|
188
|
+
clone(): DidCkbWitness;
|
|
189
|
+
eq(other: DidCkbWitnessLike): boolean;
|
|
190
|
+
hash(): ccc.Hex;
|
|
191
|
+
toHex(): ccc.Hex;
|
|
192
|
+
}) & {
|
|
193
|
+
byteLength?: number;
|
|
194
|
+
encode(_: DidCkbWitnessLike): ccc.Bytes;
|
|
195
|
+
decode(_: ccc.BytesLike, _context?: any): DidCkbWitness;
|
|
196
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: any): DidCkbWitness;
|
|
197
|
+
from(_: DidCkbWitnessLike): DidCkbWitness;
|
|
198
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
199
|
+
BaseUnion<CodecType extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1, SubType_1 = SubTypeLike_1>(): (abstract new (inner: ccc.DecodedType<CodecType>) => {
|
|
200
|
+
readonly inner: ccc.DecodedType<CodecType>;
|
|
201
|
+
match<Result>(handlers: ccc.mol.UnionMatchHandlers<CodecType, Result> & {
|
|
202
|
+
_?: undefined | null;
|
|
203
|
+
}): Result;
|
|
204
|
+
match<Result>(handlers: Partial<ccc.mol.UnionMatchHandlers<CodecType, Result>> & {
|
|
205
|
+
_: (inner: ccc.DecodedType<CodecType>) => Result;
|
|
206
|
+
}): Result;
|
|
207
|
+
toBytes(): ccc.Bytes;
|
|
208
|
+
clone(): SubType_1;
|
|
209
|
+
eq(other: SubTypeLike_1): boolean;
|
|
210
|
+
hash(): ccc.Hex;
|
|
211
|
+
toHex(): ccc.Hex;
|
|
212
|
+
}) & {
|
|
213
|
+
byteLength?: number;
|
|
214
|
+
encode(_: SubTypeLike_1): ccc.Bytes;
|
|
215
|
+
decode(_: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
216
|
+
fromBytes(_bytes: ccc.BytesLike, _context?: ccc.ContextType<CodecType> | undefined): SubType_1;
|
|
217
|
+
from(_: SubTypeLike_1): SubType_1;
|
|
218
|
+
Base<SubTypeLike, SubType = SubTypeLike, Context = any>(): any;
|
|
219
|
+
BaseUnion<CodecType_1 extends ccc.CodecLike<any, ccc.mol.UnionDecoded<any, any>, any>, SubTypeLike_1_1, SubType_1_1 = SubTypeLike_1_1>(): any;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
declare class DidCkbWitness extends DidCkbWitness_base {
|
|
223
|
+
localIdAuthorization: PlcAuthorization;
|
|
224
|
+
constructor(localIdAuthorization: PlcAuthorization);
|
|
225
|
+
static from(data: DidCkbWitnessLike): DidCkbWitness;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create a DID CKB cell.
|
|
229
|
+
*
|
|
230
|
+
* @param props The arguments for creating the cell.
|
|
231
|
+
* @param props.signer The signer to sign the transaction.
|
|
232
|
+
* @param props.receiver The receiver script (optional).
|
|
233
|
+
* @param props.data The output data.
|
|
234
|
+
* @param props.tx The transaction skeleton (optional).
|
|
235
|
+
*/
|
|
236
|
+
declare function createDidCkb(props: {
|
|
237
|
+
signer: ccc.Signer;
|
|
238
|
+
data: DidCkbDataLike;
|
|
239
|
+
receiver?: ccc.ScriptLike | null;
|
|
240
|
+
tx?: ccc.TransactionLike | null;
|
|
241
|
+
}): Promise<{
|
|
242
|
+
tx: ccc.Transaction;
|
|
243
|
+
id: ccc.Hex;
|
|
244
|
+
index: number;
|
|
245
|
+
}>;
|
|
246
|
+
/**
|
|
247
|
+
* Transfer a DID CKB cell.
|
|
248
|
+
*
|
|
249
|
+
* @param props The arguments for transferring the cell.
|
|
250
|
+
* @param props.client The client to communicate with CKB.
|
|
251
|
+
* @param props.id The Type ID to transfer.
|
|
252
|
+
* @param props.receiver The new receiver script.
|
|
253
|
+
* @param props.tx The transaction skeleton (optional).
|
|
254
|
+
* @param props.data The new output data or a transformer to update the data (optional).
|
|
255
|
+
*/
|
|
256
|
+
declare function transferDidCkb(props: {
|
|
257
|
+
client: ccc.Client;
|
|
258
|
+
id: ccc.HexLike;
|
|
259
|
+
receiver: ccc.ScriptLike;
|
|
260
|
+
tx?: ccc.TransactionLike | null;
|
|
261
|
+
data?: DidCkbDataLike | ((cell: ccc.Cell, data?: DidCkbData) => DidCkbDataLike | Promise<DidCkbDataLike>) | null;
|
|
262
|
+
}): Promise<{
|
|
263
|
+
tx: ccc.Transaction;
|
|
264
|
+
inIndex: number;
|
|
265
|
+
outIndex: number;
|
|
266
|
+
}>;
|
|
267
|
+
/**
|
|
268
|
+
* Destroy a DID CKB cell.
|
|
269
|
+
*
|
|
270
|
+
* @param props The arguments for destroying the cell.
|
|
271
|
+
* @param props.client The client to communicate with CKB.
|
|
272
|
+
* @param props.id The Type ID to destroy.
|
|
273
|
+
* @param props.tx The transaction skeleton (optional).
|
|
274
|
+
*/
|
|
275
|
+
declare function destroyDidCkb(props: {
|
|
276
|
+
client: ccc.Client;
|
|
277
|
+
id: ccc.HexLike;
|
|
278
|
+
tx?: ccc.TransactionLike | null;
|
|
279
|
+
}): Promise<{
|
|
280
|
+
tx: ccc.Transaction;
|
|
281
|
+
index: number;
|
|
282
|
+
}>;
|
|
283
|
+
type HistoryAction = "CREATE" | "UPDATE" | "MIGRATE";
|
|
284
|
+
type HistoryEntry = {
|
|
285
|
+
/**
|
|
286
|
+
* `CREATE` for a fresh mint, `MIGRATE` for a did:plc import (genesis cell
|
|
287
|
+
* with a `localId` set), `UPDATE` for every subsequent transfer.
|
|
288
|
+
*/
|
|
289
|
+
action: HistoryAction;
|
|
290
|
+
txHash: ccc.Hex;
|
|
291
|
+
outputIndex: ccc.Num;
|
|
292
|
+
blockNumber?: ccc.Num;
|
|
293
|
+
capacity: ccc.Num;
|
|
294
|
+
data: DidCkbData;
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Walk the DID cell chain backwards to produce the ordered list of operations
|
|
298
|
+
* applied to a DID.
|
|
299
|
+
*
|
|
300
|
+
* Each `transferDidCkb` consumes the previous DID cell as an input and creates
|
|
301
|
+
* a new one with the same Type ID args; the genesis (`createDidCkb` /
|
|
302
|
+
* `createDidCkb` with localId) has no DID input. We start from the live cell,
|
|
303
|
+
* read its tx, look for the prior DID cell among the inputs, and repeat. The
|
|
304
|
+
* first entry returned is the newest (most recent transfer); the last is the
|
|
305
|
+
* genesis.
|
|
306
|
+
*
|
|
307
|
+
* Cost: roughly one `getTransaction` call per step plus one `input.getCell`
|
|
308
|
+
* lookup per non-DID input on each step. `input.getCell` goes through the
|
|
309
|
+
* client's cell cache, so repeated walks over the same chain are cheap.
|
|
310
|
+
*
|
|
311
|
+
* @throws If an input cell lookup fails or the input cell is unavailable.
|
|
312
|
+
* An unresolved input cannot establish that a transaction is the genesis.
|
|
313
|
+
*/
|
|
314
|
+
declare function getDidCkbHistory(props: {
|
|
315
|
+
client: ccc.Client;
|
|
316
|
+
/**
|
|
317
|
+
* Either the 20-byte Type ID args hex returned by `createDidCkb`, or a
|
|
318
|
+
* `did:ckb:` URI. URIs are converted via `didToArgs`.
|
|
319
|
+
*/
|
|
320
|
+
id: ccc.HexLike | string;
|
|
321
|
+
/** Pre-resolved live cell; if omitted, we fetch it. */
|
|
322
|
+
liveCell?: ccc.Cell;
|
|
323
|
+
/** Safety bound to prevent runaway walks. Default 50. */
|
|
324
|
+
maxSteps?: number;
|
|
325
|
+
}): Promise<HistoryEntry[]>;
|
|
326
|
+
declare function base32Encode(bytes: ccc.BytesLike): string;
|
|
327
|
+
declare function base32Decode(input: string): ccc.Bytes;
|
|
328
|
+
/**
|
|
329
|
+
* Convert 20-byte Type ID args (the `id` returned from `createDidCkb`) to a
|
|
330
|
+
* `did:ckb:` identifier string per WIP-01 §2.2.
|
|
331
|
+
*/
|
|
332
|
+
declare function argsToDid(args: ccc.HexLike): string;
|
|
333
|
+
/**
|
|
334
|
+
* Reverse of `argsToDid`. Validates the prefix, base32 length, and decoded
|
|
335
|
+
* byte count.
|
|
336
|
+
*/
|
|
337
|
+
declare function didToArgs(did: string): ccc.Hex;
|
|
338
|
+
declare function isDidCkb(value: string): boolean;
|
|
339
|
+
/**
|
|
340
|
+
* Build the migration witness payload that authorizes a did:plc -> did:ckb
|
|
341
|
+
* import. Pure: takes a tx hash + signing material, returns a typed
|
|
342
|
+
* `DidCkbWitness` that the caller wraps in a `WitnessArgs.outputType` field.
|
|
343
|
+
*
|
|
344
|
+
* Per WIP-02 §3.1.1 we send only the genesis operation in `history`. The
|
|
345
|
+
* contract recomputes the genesis CID over the CBOR-encoded op, verifies the
|
|
346
|
+
* self-signature inside it, then verifies `sig` against
|
|
347
|
+
* `history[0].rotationKeys[rotationKeyIndex]`.
|
|
348
|
+
*
|
|
349
|
+
* `selfSigIndex` defaults to 0 because PLC genesis ops are conventionally
|
|
350
|
+
* self-signed by the first rotation key; override if the genesis you're
|
|
351
|
+
* migrating used a different one.
|
|
352
|
+
*/
|
|
353
|
+
declare function buildMigrationWitness(props: {
|
|
354
|
+
txHash: ccc.HexLike;
|
|
355
|
+
genesisOperation: PlcOperation;
|
|
356
|
+
rotationKeyIndex: number;
|
|
357
|
+
rotationPrivateKey: ccc.BytesLike;
|
|
358
|
+
curve?: Curve;
|
|
359
|
+
selfSigIndex?: number;
|
|
360
|
+
}): DidCkbWitness;
|
|
361
|
+
/**
|
|
362
|
+
* Build a create tx whose output declares an imported did:plc identifier in
|
|
363
|
+
* its `localId` field. Equivalent to calling `createDidCkb` with
|
|
364
|
+
* `data.value.localId = sourceDid`; provided as a named helper for symmetry
|
|
365
|
+
* with the other DID operations and so `did:plc:` migrations have an
|
|
366
|
+
* obvious entry point.
|
|
367
|
+
*
|
|
368
|
+
* The caller is responsible for: completing inputs + fee, building the
|
|
369
|
+
* migration witness with `buildMigrationWitness`, and setting it at the
|
|
370
|
+
* witness slot of input 0. See `packages/examples/src/migrateDid.ts` for the
|
|
371
|
+
* full flow.
|
|
372
|
+
*/
|
|
373
|
+
declare function migrateDidCkb(props: {
|
|
374
|
+
signer: ccc.Signer;
|
|
375
|
+
sourceDid: string;
|
|
376
|
+
data?: DidCkbDataLike | null;
|
|
377
|
+
receiver?: ccc.ScriptLike | null;
|
|
378
|
+
tx?: ccc.TransactionLike | null;
|
|
379
|
+
}): Promise<{
|
|
380
|
+
tx: ccc.Transaction;
|
|
381
|
+
id: ccc.Hex;
|
|
382
|
+
index: number;
|
|
383
|
+
}>;
|
|
384
|
+
type DidCkbRecord = {
|
|
385
|
+
/** The `did:ckb:` string identifying this cell. */
|
|
386
|
+
did: string;
|
|
387
|
+
/** 20-byte Type ID args (same value `createDidCkb` returned as `id`). */
|
|
388
|
+
id: ccc.Hex;
|
|
389
|
+
/** Decoded DidCkbData; `.value.document` is the CBOR-decoded document. */
|
|
390
|
+
data: DidCkbData;
|
|
391
|
+
/** The live DID Metadata Cell itself. */
|
|
392
|
+
cell: ccc.Cell;
|
|
393
|
+
};
|
|
394
|
+
/**
|
|
395
|
+
* Find the live DID Metadata Cell for a given Type ID and decode its data.
|
|
396
|
+
*
|
|
397
|
+
* Returns `undefined` when no live cell exists (the DID was never created or
|
|
398
|
+
* has been destroyed).
|
|
399
|
+
*/
|
|
400
|
+
declare function findDidCkbCell(props: {
|
|
401
|
+
client: ccc.Client;
|
|
402
|
+
id: ccc.HexLike;
|
|
403
|
+
}): Promise<DidCkbRecord | undefined>;
|
|
404
|
+
/**
|
|
405
|
+
* Resolve a `did:ckb:` string to its live cell + decoded document.
|
|
406
|
+
*
|
|
407
|
+
* Throws if `did` is not a syntactically valid did:ckb identifier. Returns
|
|
408
|
+
* `undefined` if the DID was created and then destroyed, or never existed.
|
|
409
|
+
*/
|
|
410
|
+
declare function resolveDidCkb(props: {
|
|
411
|
+
client: ccc.Client;
|
|
412
|
+
did: string;
|
|
413
|
+
}): Promise<DidCkbRecord | undefined>;
|
|
414
|
+
/**
|
|
415
|
+
* List every live DID Metadata Cell owned by the given lock. Useful for
|
|
416
|
+
* dashboards that want to enumerate the DIDs an address controls.
|
|
417
|
+
*
|
|
418
|
+
* Cells whose data fails to decode (e.g. a future on-chain schema version) are
|
|
419
|
+
* skipped, not thrown, so a single bad cell can't break the whole listing.
|
|
420
|
+
*/
|
|
421
|
+
declare function listDidCkbsByLock(props: {
|
|
422
|
+
client: ccc.Client;
|
|
423
|
+
lock: ccc.ScriptLike;
|
|
424
|
+
limit?: number;
|
|
425
|
+
order?: "asc" | "desc";
|
|
426
|
+
}): Promise<DidCkbRecord[]>;
|
|
427
|
+
declare namespace barrel_d_exports {
|
|
428
|
+
export { DidCkbData, DidCkbDataLike, DidCkbDataV1, DidCkbDataV1Like, DidCkbRecord, DidCkbWitness, DidCkbWitnessLike, HistoryAction, HistoryEntry, PlcAuthorization, PlcAuthorizationLike, argsToDid, base32Decode, base32Encode, buildMigrationWitness, createDidCkb, destroyDidCkb, didToArgs, findDidCkbCell, getDidCkbHistory, isDidCkb, listDidCkbsByLock, migrateDidCkb, index_d_exports as plc, resolveDidCkb, transferDidCkb };
|
|
429
|
+
}
|
|
430
|
+
export { DidCkbWitness as C, PlcAuthorizationLike as E, DidCkbDataV1Like as S, PlcAuthorization as T, destroyDidCkb as _, resolveDidCkb as a, DidCkbDataLike as b, argsToDid as c, didToArgs as d, isDidCkb as f, createDidCkb as g, getDidCkbHistory as h, listDidCkbsByLock as i, base32Decode as l, HistoryEntry as m, DidCkbRecord as n, buildMigrationWitness as o, HistoryAction as p, findDidCkbCell as r, migrateDidCkb as s, barrel_d_exports as t, base32Encode as u, transferDidCkb as v, DidCkbWitnessLike as w, DidCkbDataV1 as x, DidCkbData as y };
|
|
431
|
+
//# sourceMappingURL=barrel-9fYvfkI1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"barrel-9fYvfkI1.d.ts","names":[],"sources":["../src/codec.ts","../src/didCkb.ts","../src/history.ts","../src/identifier.ts","../src/migrate.ts","../src/resolver.ts"],"mappings":";;KAGY;EACV;EACA;;;;;;;;;;;;;;;;;;MAiKu7jC;;;;;;;;;;;IAAs/C;;IAAunB,OAAA,GAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;IAA4Z,UAAA,QAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;;;;;;cA9Iv7oC,qBAAqB;EAKvB;EACA;EADA,YAAA,mBACA;SAKF,KAAK,MAAM,mBAAmB;;KAa3B;EAEN;EACA,OAAO;;EAGP;IACE;IACA,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8Gw80C;;IAAunB,OAAA,GAAA,IAAA,WAAA,WAAC,UAAA;IAAiY,UAAA,QAAA,IAAA,WAAA,WAAC,UAAA;;;;;;;cAzGp82C,mBAAmB;EAMrB;EACA,OAAO;EADP,YAAA,YACA,OAAO;SAKT,KAAK,MAAM,iBAAiB;SAe5B,OACL,MAAM,mBACL;IAAe;IAAY,OAAO;;;KAK3B;EACV;EACA,KAAK,IAAI;EACT,oBAAoB,IAAI;;;;;;;;;;;;;;;;;;MAoE+5jC;;;;;;;;;;;IAAs/C;;IAAunB,OAAA,GAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;IAA4Z,UAAA,QAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;;;;;;cA/Cv7oC,yBAAyB;EAK3B;EACA,KAAK,IAAI;EACT,oBAAoB,IAAI;EAFxB,YAAA,mBACA,KAAK,IAAI,KACT,oBAAoB,IAAI;SAK1B,KAAK,MAAM,uBAAuB;;KAY/B;EACV,sBAAsB;;;;;;;;;;;;;;;;;;MAsBi6jC;;;;;;;;;;;IAAs/C;;IAAunB,OAAA,GAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;IAA4Z,UAAA,QAAA,IAAA,WAAA,WAAC,IAAA,YAAA,yBAAA;;;;;;cAfv7oC,sBAAsB;EAId,sBAAsB;EAAtB,YAAA,sBAAsB;SAIlC,KAAK,MAAM,oBAAoB;;;;;;;;;;;iBCnIxB,aAAa;EAC3B,QAAQ,IAAI;EACZ,MAAM;EACN,WAAW,IAAI;EACf,KAAK,IAAI;IACP;EACF,IAAI,IAAI;EACR,IAAI,IAAI;EACR;;;;;;;;;;;;iBAeoB,eAAe;EACnC,QAAQ,IAAI;EACZ,IAAI,IAAI;EACR,UAAU,IAAI;EACd,KAAK,IAAI;EACT,OACI,mBAEE,MAAM,IAAI,MACV,OAAO,eACJ,iBAAiB,QAAQ;IAEhC;EACF,IAAI,IAAI;EACR;EACA;;;;;;;;;;iBAaoB,cAAc;EAClC,QAAQ,IAAI;EACZ,IAAI,IAAI;EACR,KAAK,IAAI;IACP;EACF,IAAI,IAAI;EACR;;KChFU;KAEA;;;;;EAKV,QAAQ;EACR,QAAQ,IAAI;EACZ,aAAa,IAAI;EACjB,cAAc,IAAI;EAClB,UAAU,IAAI;EACd,MAAM;;;;;;;;;;;;;;;;;;;;iBAuBc,iBAAiB;EACrC,QAAQ,IAAI;;;;;EAKZ,IAAI,IAAI;;EAER,WAAW,IAAI;;EAEf;IACE,QAAQ;iBCnCI,aAAa,OAAO,IAAI;iBAmBxB,aAAa,gBAAgB,IAAI;;;;;iBAwBjC,UAAU,MAAM,IAAI;;;;;iBAcpB,UAAU,cAAc,IAAI;iBAqB5B,SAAS;;;;;;;;;;;;;;;iBCtET,sBAAsB;EACpC,QAAQ,IAAI;EACZ,kBAAkB;EAClB;EACA,oBAAoB,IAAI;EACxB,QAAQ;EACR;IACE;;;;;;;;;;;;;iBAkCkB,cAAc;EAClC,QAAQ,IAAI;EACZ;EACA,OAAO;EACP,WAAW,IAAI;EACf,KAAK,IAAI;IACP;EACF,IAAI,IAAI;EACR,IAAI,IAAI;EACR;;KCtEU;;EAEV;;EAEA,IAAI,IAAI;;EAER,MAAM;;EAEN,MAAM,IAAI;;;;;;;;iBA8BU,eAAe;EACnC,QAAQ,IAAI;EACZ,IAAI,IAAI;IACN,QAAQ;;;;;;;iBAgBU,cAAc;EAClC,QAAQ,IAAI;EACZ;IACE,QAAQ;;;;;;;;iBAcU,kBAAkB;EACtC,QAAQ,IAAI;EACZ,MAAM,IAAI;EACV;EACA;IACE,QAAQ"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const e=require("./plc-DMi9GhTp.js");let t=require("@ckb-ccc/core"),n=require("@ckb-ccc/type-id/advanced");const r=[`Object`,`RegExp`,`Date`,`Error`,`Map`,`Set`,`WeakMap`,`WeakSet`,`ArrayBuffer`,`SharedArrayBuffer`,`DataView`,`Promise`,`URL`,`HTMLElement`,`Int8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`,`Tagged`];function i(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(e===!0||e===!1)return`boolean`;let t=typeof e;return t===`string`||t===`number`||t===`bigint`||t===`symbol`?t:t===`function`?`Function`:Array.isArray(e)?`Array`:e instanceof Uint8Array?`Uint8Array`:e.constructor===Object?`Object`:a(e)||`Object`}function a(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(r.includes(t))return t}var o=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:+(this.major>e.major)}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};o.uint=new o(0,`uint`,!0),o.negint=new o(1,`negint`,!0),o.bytes=new o(2,`bytes`,!0),o.string=new o(3,`string`,!0),o.array=new o(4,`array`,!1),o.map=new o(5,`map`,!1),o.tag=new o(6,`tag`,!1),o.float=new o(7,`float`,!0),o.false=new o(7,`false`,!0),o.true=new o(7,`true`,!0),o.null=new o(7,`null`,!0),o.undefined=new o(7,`undefined`,!0),o.break=new o(7,`break`,!0);var s=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};const c=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer==`function`,l=new TextEncoder;function u(e){return c&&globalThis.Buffer.isBuffer(e)}function d(e){return e instanceof Uint8Array?u(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}const f=c?e=>e.length>=24?globalThis.Buffer.from(e):ne(e):e=>e.length>=200?l.encode(e):ne(e),p=e=>Uint8Array.from(e),m=c?(e,t,n)=>u(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),h=c?(e,t)=>(e=e.map(e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e)),d(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let t of e)r+t.length>n.length&&(t=t.subarray(0,n.length-r)),n.set(t,r),r+=t.length;return n},ee=c?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function te(e,t){if(u(e)&&u(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function ne(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}var re=class{constructor(e=256){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}pushByte(e){let t=this.chunks[this.chunks.length-1];this.cursor>this.maxCursor&&(t=ee(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t));let n=t.length-(this.maxCursor-this.cursor)-1;t[n]=e,this.cursor++}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let e=t.length-(this.maxCursor-this.cursor)-1;e<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,e),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=ee(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=m(n,0,this.cursor)}else t=h(this.chunks,this.cursor);return e&&this.reset(),t}},ie=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}pushByte(e){if(this.cursor>=this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest[this.cursor++]=e}push(e){if(this.cursor+e.length>this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}};const g=`CBOR decode error:`,ae=`CBOR encode error:`;function _(e,t,n){if(e.length-t<n)throw Error(`${g} not enough data for type`)}const v=[24,256,65536,4294967296,BigInt(`18446744073709551616`)];function y(e,t,n){_(e,t,1);let r=e[t];if(n.strict===!0&&r<v[0])throw Error(`${g} integer encoded in more bytes than necessary (strict decode)`);return r}function b(e,t,n){_(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<v[1])throw Error(`${g} integer encoded in more bytes than necessary (strict decode)`);return r}function x(e,t,n){_(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<v[2])throw Error(`${g} integer encoded in more bytes than necessary (strict decode)`);return r}function S(e,t,n){_(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],a=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&a<v[3])throw Error(`${g} integer encoded in more bytes than necessary (strict decode)`);if(a<=2**53-1)return Number(a);if(n.allowBigInt===!0)return a;throw Error(`${g} integers outside of the safe integer range are not supported`)}function oe(e,t,n,r){return new s(o.uint,y(e,t+1,r),2)}function se(e,t,n,r){return new s(o.uint,b(e,t+1,r),3)}function ce(e,t,n,r){return new s(o.uint,x(e,t+1,r),5)}function le(e,t,n,r){return new s(o.uint,S(e,t+1,r),9)}function C(e,t){return w(e,0,t.value)}function w(e,t,n){if(n<v[0]){let r=Number(n);e.pushByte(t|r)}else if(n<v[1]){let r=Number(n);e.push([t|24,r])}else if(n<v[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<v[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<v[4]){let n=[t|27,0,0,0,0,0,0,0],i=Number(r&BigInt(4294967295)),a=Number(r>>BigInt(32)&BigInt(4294967295));n[8]=i&255,i>>=8,n[7]=i&255,i>>=8,n[6]=i&255,i>>=8,n[5]=i&255,n[4]=a&255,a>>=8,n[3]=a&255,a>>=8,n[2]=a&255,a>>=8,n[1]=a&255,e.push(n)}else throw Error(`${g} encountered BigInt larger than allowable range`)}}C.encodedSize=function(e){return w.encodedSize(e.value)},w.encodedSize=function(e){return e<v[0]?1:e<v[1]?2:e<v[2]?3:e<v[3]?5:9},C.compareTokens=function(e,t){return e.value<t.value?-1:+(e.value>t.value)};function ue(e,t,n,r){return new s(o.negint,-1-y(e,t+1,r),2)}function de(e,t,n,r){return new s(o.negint,-1-b(e,t+1,r),3)}function fe(e,t,n,r){return new s(o.negint,-1-x(e,t+1,r),5)}const pe=BigInt(-1),me=BigInt(1);function he(e,t,n,r){let i=S(e,t+1,r);if(typeof i!=`bigint`){let e=-1-i;if(e>=-(2**53-1))return new s(o.negint,e,9)}if(r.allowBigInt!==!0)throw Error(`${g} integers outside of the safe integer range are not supported`);return new s(o.negint,pe-BigInt(i),9)}function ge(e,t){let n=t.value,r=typeof n==`bigint`?n*pe-me:n*-1-1;w(e,t.type.majorEncoded,r)}ge.encodedSize=function(e){let t=e.value,n=typeof t==`bigint`?t*pe-me:t*-1-1;return n<v[0]?1:n<v[1]?2:n<v[2]?3:n<v[3]?5:9},ge.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function T(e,t,n,r){_(e,t,n+r);let i=e.slice(t+n,t+n+r);return new s(o.bytes,i,n+r)}function _e(e,t,n,r){return T(e,t,1,n)}function ve(e,t,n,r){return T(e,t,2,y(e,t+1,r))}function ye(e,t,n,r){return T(e,t,3,b(e,t+1,r))}function be(e,t,n,r){return T(e,t,5,x(e,t+1,r))}function xe(e,t,n,r){let i=S(e,t+1,r);if(typeof i==`bigint`)throw Error(`${g} 64-bit integer bytes lengths not supported`);return T(e,t,9,i)}function Se(e){return e.encodedBytes===void 0&&(e.encodedBytes=o.equals(e.type,o.string)?f(e.value):e.value),e.encodedBytes}function Ce(e,t){let n=Se(t);w(e,t.type.majorEncoded,n.length),e.push(n)}Ce.encodedSize=function(e){let t=Se(e);return w.encodedSize(t.length)+t.length},Ce.compareTokens=function(e,t){return we(Se(e),Se(t))};function we(e,t){return e.length<t.length?-1:e.length>t.length?1:te(e,t)}const Te=new TextDecoder;function Ee(e,t,n){if(n-t<32){let r=``;for(let i=t;i<n;i++){let a=e[i];if(a&128)return Te.decode(e.subarray(t,n));r+=String.fromCharCode(a)}return r}return Te.decode(e.subarray(t,n))}function E(e,t,n,r,i){let a=n+r;_(e,t,a);let c=new s(o.string,Ee(e,t+n,t+a),a);return i.retainStringBytes===!0&&(c.byteValue=e.slice(t+n,t+a)),c}function De(e,t,n,r){return E(e,t,1,n,r)}function Oe(e,t,n,r){return E(e,t,2,y(e,t+1,r),r)}function ke(e,t,n,r){return E(e,t,3,b(e,t+1,r),r)}function Ae(e,t,n,r){return E(e,t,5,x(e,t+1,r),r)}function je(e,t,n,r){let i=S(e,t+1,r);if(typeof i==`bigint`)throw Error(`${g} 64-bit integer string lengths not supported`);return E(e,t,9,i,r)}const Me=Ce;function D(e,t,n,r){return new s(o.array,r,n)}function Ne(e,t,n,r){return D(e,t,1,n)}function Pe(e,t,n,r){return D(e,t,2,y(e,t+1,r))}function Fe(e,t,n,r){return D(e,t,3,b(e,t+1,r))}function Ie(e,t,n,r){return D(e,t,5,x(e,t+1,r))}function Le(e,t,n,r){let i=S(e,t+1,r);if(typeof i==`bigint`)throw Error(`${g} 64-bit integer array lengths not supported`);return D(e,t,9,i)}function Re(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${g} indefinite length items not allowed`);return D(e,t,1,1/0)}function ze(e,t){w(e,o.array.majorEncoded,t.value)}ze.compareTokens=C.compareTokens,ze.encodedSize=function(e){return w.encodedSize(e.value)};function O(e,t,n,r){return new s(o.map,r,n)}function Be(e,t,n,r){return O(e,t,1,n)}function Ve(e,t,n,r){return O(e,t,2,y(e,t+1,r))}function He(e,t,n,r){return O(e,t,3,b(e,t+1,r))}function Ue(e,t,n,r){return O(e,t,5,x(e,t+1,r))}function We(e,t,n,r){let i=S(e,t+1,r);if(typeof i==`bigint`)throw Error(`${g} 64-bit integer map lengths not supported`);return O(e,t,9,i)}function Ge(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${g} indefinite length items not allowed`);return O(e,t,1,1/0)}function Ke(e,t){w(e,o.map.majorEncoded,t.value)}Ke.compareTokens=C.compareTokens,Ke.encodedSize=function(e){return w.encodedSize(e.value)};function qe(e,t,n,r){return new s(o.tag,n,1)}function Je(e,t,n,r){return new s(o.tag,y(e,t+1,r),2)}function Ye(e,t,n,r){return new s(o.tag,b(e,t+1,r),3)}function Xe(e,t,n,r){return new s(o.tag,x(e,t+1,r),5)}function Ze(e,t,n,r){return new s(o.tag,S(e,t+1,r),9)}function Qe(e,t){w(e,o.tag.majorEncoded,t.value)}Qe.compareTokens=C.compareTokens,Qe.encodedSize=function(e){return w.encodedSize(e.value)};function $e(e,t,n,r){if(r.allowUndefined===!1)throw Error(`${g} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new s(o.null,null,1):new s(o.undefined,void 0,1)}function et(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${g} indefinite length items not allowed`);return new s(o.break,void 0,1)}function tt(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw Error(`${g} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw Error(`${g} Infinity values are not supported`)}return new s(o.float,e,t)}function nt(e,t,n,r){return tt(ct(e,t+1),3,r)}function rt(e,t,n,r){return tt(ut(e,t+1),5,r)}function it(e,t,n,r){return tt(ft(e,t+1),9,r)}function at(e,t,n){let r=t.value;if(r===!1)e.pushByte(o.float.majorEncoded|20);else if(r===!0)e.pushByte(o.float.majorEncoded|21);else if(r===null)e.pushByte(o.float.majorEncoded|22);else if(r===void 0)e.pushByte(o.float.majorEncoded|23);else{let t,i=!1;n&&n.float64===!0||(st(r),t=ct(A,1),r===t||Number.isNaN(r)?(A[0]=249,e.push(A.slice(0,3)),i=!0):(lt(r),t=ut(A,1),r===t&&(A[0]=250,e.push(A.slice(0,5)),i=!0))),i||(dt(r),t=ft(A,1),A[0]=251,e.push(A.slice(0,9)))}}at.encodedSize=function(e,t){let n=e.value;if(n===!1||n===!0||n==null)return 1;if(!t||t.float64!==!0){st(n);let e=ct(A,1);if(n===e||Number.isNaN(n))return 3;if(lt(n),e=ut(A,1),n===e)return 5}return 9};const ot=/* @__PURE__ */ new ArrayBuffer(9),k=new DataView(ot,1),A=new Uint8Array(ot,0);function st(e){if(e===1/0)k.setUint16(0,31744,!1);else if(e===-1/0)k.setUint16(0,64512,!1);else if(Number.isNaN(e))k.setUint16(0,32256,!1);else{k.setFloat32(0,e);let t=k.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)k.setUint16(0,31744,!1);else if(n===0)k.setUint16(0,(t&2147483648)>>16|r>>13,!1);else{let e=n-127;e<-24?k.setUint16(0,0):e<-14?k.setUint16(0,(t&2147483648)>>16|1<<24+e,!1):k.setUint16(0,(t&2147483648)>>16|e+15<<10|r>>13,!1)}}}function ct(e,t){if(e.length-t<2)throw Error(`${g} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,a;return a=r===0?i*2**-24:r===31?i===0?1/0:NaN:(i+1024)*2**(r-25),n&32768?-a:a}function lt(e){k.setFloat32(0,e,!1)}function ut(e,t){if(e.length-t<4)throw Error(`${g} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function dt(e){k.setFloat64(0,e,!1)}function ft(e,t){if(e.length-t<8)throw Error(`${g} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}function pt(e,t){let n=e.value;if(n===!1)return Uint8Array.of(o.float.majorEncoded|20);if(n===!0)return Uint8Array.of(o.float.majorEncoded|21);if(n===null)return Uint8Array.of(o.float.majorEncoded|22);if(n===void 0)return Uint8Array.of(o.float.majorEncoded|23);if(!t){if(st(n),n===ct(A,1)||Number.isNaN(n))return A[0]=249,A.slice(0,3);if(lt(n),n===ut(A,1))return A[0]=250,A.slice(0,5)}return dt(n),A[0]=251,A.slice(0,9)}function mt(e,t){let n=e,r=t?.float64===!0,i=r?n._keyBytesFloat64:n._keyBytes;if(i!==void 0)return i;let a=pt(e,r);return r?n._keyBytesFloat64=a:n._keyBytes=a,a}at.compareTokens=function(e,t,n){let r=mt(e,n),i=mt(t,n);return r.length===i.length?te(r,i):r.length<i.length?-1:1};function j(e,t,n){throw Error(`${g} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function ht(e){return()=>{throw Error(`${g} ${e}`)}}const M=[];for(let e=0;e<=23;e++)M[e]=j;M[24]=oe,M[25]=se,M[26]=ce,M[27]=le,M[28]=j,M[29]=j,M[30]=j,M[31]=j;for(let e=32;e<=55;e++)M[e]=j;M[56]=ue,M[57]=de,M[58]=fe,M[59]=he,M[60]=j,M[61]=j,M[62]=j,M[63]=j;for(let e=64;e<=87;e++)M[e]=_e;M[88]=ve,M[89]=ye,M[90]=be,M[91]=xe,M[92]=j,M[93]=j,M[94]=j,M[95]=ht(`indefinite length bytes/strings are not supported`);for(let e=96;e<=119;e++)M[e]=De;M[120]=Oe,M[121]=ke,M[122]=Ae,M[123]=je,M[124]=j,M[125]=j,M[126]=j,M[127]=ht(`indefinite length bytes/strings are not supported`);for(let e=128;e<=151;e++)M[e]=Ne;M[152]=Pe,M[153]=Fe,M[154]=Ie,M[155]=Le,M[156]=j,M[157]=j,M[158]=j,M[159]=Re;for(let e=160;e<=183;e++)M[e]=Be;M[184]=Ve,M[185]=He,M[186]=Ue,M[187]=We,M[188]=j,M[189]=j,M[190]=j,M[191]=Ge;for(let e=192;e<=215;e++)M[e]=qe;M[216]=Je,M[217]=Ye,M[218]=Xe,M[219]=Ze,M[220]=j,M[221]=j,M[222]=j,M[223]=j;for(let e=224;e<=243;e++)M[e]=ht(`simple values are not supported`);M[244]=j,M[245]=j,M[246]=j,M[247]=$e,M[248]=ht(`simple values are not supported`),M[249]=nt,M[250]=rt,M[251]=it,M[252]=j,M[253]=j,M[254]=j,M[255]=et;const N=[];for(let e=0;e<24;e++)N[e]=new s(o.uint,e,1);for(let e=-1;e>=-24;e--)N[31-e]=new s(o.negint,e,1);N[64]=new s(o.bytes,/* @__PURE__ */ new Uint8Array,1),N[96]=new s(o.string,``,1),N[128]=new s(o.array,0,1),N[160]=new s(o.map,0,1),N[244]=new s(o.false,!1,1),N[245]=new s(o.true,!0,1),N[246]=new s(o.null,null,1);function gt(e){switch(e.type){case o.false:return p([244]);case o.true:return p([245]);case o.null:return p([246]);case o.bytes:return e.value.length?void 0:p([64]);case o.string:return e.value===``?p([96]):void 0;case o.array:return e.value===0?p([128]):void 0;case o.map:return e.value===0?p([160]):void 0;case o.uint:return e.value<24?p([Number(e.value)]):void 0;case o.negint:if(e.value>=-24)return p([31-Number(e.value)])}}const _t={float64:!1,mapSorter:Ct,quickEncodeToken:gt},vt=Object.freeze({mapSorter:wt,quickEncodeToken:gt});function yt(){let e=[];return e[o.uint.major]=C,e[o.negint.major]=ge,e[o.bytes.major]=Ce,e[o.string.major]=Me,e[o.array.major]=ze,e[o.map.major]=Ke,e[o.tag.major]=Qe,e[o.float.major]=at,e}const P=yt(),bt=new re;var xt=class e{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw Error(`${ae} object contains circular references`);return new e(n,t)}};const F={null:new s(o.null,null),undefined:new s(o.undefined,void 0),true:new s(o.true,!0),false:new s(o.false,!1),emptyArray:new s(o.array,0),emptyMap:new s(o.map,0)},I={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new s(o.float,e):e>=0?new s(o.uint,e):new s(o.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new s(o.uint,e):new s(o.negint,e)},Uint8Array(e,t,n,r){return new s(o.bytes,e)},string(e,t,n,r){return new s(o.string,e)},boolean(e,t,n,r){return e?F.true:F.false},null(e,t,n,r){return F.null},undefined(e,t,n,r){return F.undefined},ArrayBuffer(e,t,n,r){return new s(o.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new s(o.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[F.emptyArray,new s(o.break)]:F.emptyArray;r=xt.createCheck(r,e);let i=[],a=0;for(let t of e)i[a++]=L(t,n,r);return n.addBreakTokens?[new s(o.array,e.length),i,new s(o.break)]:[new s(o.array,e.length),i]},Object(e,t,n,r){let i=t!==`Object`,a=i?e.keys():Object.keys(e),c=i?e.size:a.length,l;if(c){l=Array(c),r=xt.createCheck(r,e);let t=!i&&n.ignoreUndefinedProperties,o=0;for(let s of a){let a=i?e.get(s):e[s];t&&a===void 0||(l[o++]=[L(s,n,r),L(a,n,r)])}o<c&&(l.length=o)}return l?.length?(St(l,n),n.addBreakTokens?[new s(o.map,l.length),l,new s(o.break)]:[new s(o.map,l.length),l]):n.addBreakTokens===!0?[F.emptyMap,new s(o.break)]:F.emptyMap},Tagged(e,t,n,r){return[new s(o.tag,e.tag),L(e.value,n,r)]}};I.Map=I.Object,I.Buffer=I.Uint8Array;for(let e of`Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64`.split(` `))I[`${e}Array`]=I.DataView;function L(e,t={},n){let r=i(e),a=t&&t.typeEncoders&&t.typeEncoders[r]||I[r];if(typeof a==`function`){let i=a(e,r,t,n);if(i!=null)return i}let o=I[r];if(!o)throw Error(`${ae} unsupported type: ${r}`);return o(e,r,t,n)}function St(e,t){let n=t.mapSorter;n&&e.sort((e,r)=>n(e,r,t))}function Ct(e,t,n){let r=Array.isArray(e[0])?e[0][0]:e[0],i=Array.isArray(t[0])?t[0][0]:t[0];if(r.type.major!==i.type.major)return r.type.compare(i.type);let a=r.type.major,o=P[a].compareTokens(r,i,n);return o===0&&console.warn(`WARNING: complex key types used, CBOR key sorting guarantees are gone`),o}function wt(e,t){if(e[0]instanceof s&&t[0]instanceof s){let n=e[0],r=t[0];return n._keyBytes||=Tt(n.value),r._keyBytes||=Tt(r.value),te(n._keyBytes,r._keyBytes)}throw Error(`rfc8949MapSorter: complex key types are not supported yet`)}function Tt(e){return Vt(e,P,vt)}function R(e,t,n,r){if(Array.isArray(t))for(let i of t)R(e,i,n,r);else n[t.type.major](e,t,r)}const Et=o.uint.majorEncoded,Dt=o.negint.majorEncoded,Ot=o.bytes.majorEncoded,kt=o.string.majorEncoded,At=o.array.majorEncoded,jt=o.map.majorEncoded,Mt=o.float.majorEncoded|20,Nt=o.float.majorEncoded|21,Pt=o.float.majorEncoded|22,Ft=o.float.majorEncoded|23,It=BigInt(-1),Lt=BigInt(1);function z(e,t,n){n<24?e.pushByte(t|Number(n)):w(e,t,n)}function Rt(e){return e.addBreakTokens!==!0}function zt(e,t,n,r,i){let a=n===`Map`,o=a?t.keys():Object.keys(t),s=a?t.size:o.length;if(!s){e.pushByte(jt);return}i=xt.createCheck(i,t);let c=!a&&r.ignoreUndefinedProperties,l=Array(s),u=0;for(let e of o){let n=a?t.get(e):t[e];c&&n===void 0||(l[u++]=[L(e,r,i),n])}if(u===0)e.pushByte(jt);else{u<s&&(l.length=u),l.sort((e,t)=>Ct(e,t,r)),z(e,jt,u);for(let[t,n]of l)R(e,t,P,r),Bt(e,n,r,i)}}function Bt(e,t,n,r){let a=i(t),c=n.typeEncoders&&n.typeEncoders[a];if(c){let i=c(t,a,n,r);if(i!=null){R(e,i,P,n);return}}switch(a){case`null`:e.pushByte(Pt);return;case`undefined`:e.pushByte(Ft);return;case`boolean`:e.pushByte(t?Nt:Mt);return;case`number`:!Number.isInteger(t)||!Number.isSafeInteger(t)?at(e,new s(o.float,t),n):t>=0?z(e,Et,t):z(e,Dt,t*-1-1);return;case`bigint`:t>=BigInt(0)?z(e,Et,t):z(e,Dt,t*It-Lt);return;case`string`:{let n=f(t);z(e,kt,n.length),e.push(n);return}case`Uint8Array`:z(e,Ot,t.length),e.push(t);return;case`Array`:if(!t.length){e.pushByte(At);return}r=xt.createCheck(r,t),z(e,At,t.length);for(let i of t)Bt(e,i,n,r);return;case`Object`:case`Map`:n.mapSorter===Ct?zt(e,t,a,n,r):R(e,I.Object(t,a,n,r),P,n);return;default:{let i=I[a];if(!i)throw Error(`${ae} unsupported type: ${a}`);R(e,i(t,a,n,r),P,n)}}}function Vt(e,t,n,r){let i=r instanceof Uint8Array,a=i?new ie(r):bt,o=L(e,n);if(!Array.isArray(o)&&n.quickEncodeToken){let e=n.quickEncodeToken(o);if(e)return i?(a.push(e),a.toBytes()):e;let r=t[o.type.major];if(r.encodedSize){let e=r.encodedSize(o,n);if(i||(a=new re(e)),r(a,o,n),a.chunks.length!==1)throw Error(`Unexpected error: pre-calculated length for ${o} was wrong`);return i?a.toBytes():d(a.chunks[0])}}return a.reset(),R(a,o,t,n),a.toBytes(!0)}function Ht(e,t){return t=Object.assign({},_t,t),Rt(t)?(bt.reset(),Bt(bt,e,t,void 0),bt.toBytes(!0)):Vt(e,P,t)}const Ut={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};var Wt=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=N[e];if(t===void 0){let n=M[e];if(!n)throw Error(`${g} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,`0`)})`);let r=e&31;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}};const B=Symbol.for(`DONE`),V=Symbol.for(`BREAK`);function Gt(e,t,n){let r=[];for(let i=0;i<e.value;i++){let a=H(t,n);if(a===V){if(e.value===1/0)break;throw Error(`${g} got unexpected break to lengthed array`)}if(a===B)throw Error(`${g} found array but not enough entries (got ${i}, expected ${e.value})`);r[i]=a}return r}function Kt(e,t,n){let r=n.useMaps===!0,i=n.rejectDuplicateMapKeys===!0,a=r?void 0:{},o=r?/* @__PURE__ */ new Map:void 0;for(let s=0;s<e.value;s++){let c=H(t,n);if(c===V){if(e.value===1/0)break;throw Error(`${g} got unexpected break to lengthed map`)}if(c===B)throw Error(`${g} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!r&&typeof c!=`string`)throw Error(`${g} non-string keys not supported (got ${typeof c})`);if(i&&(r&&o.has(c)||!r&&Object.hasOwn(a,c)))throw Error(`${g} found repeat map key "${c}"`);let l=H(t,n);if(l===B)throw Error(`${g} found map but not enough entries (got ${s} [no value], expected ${e.value})`);r?o.set(c,l):a[c]=l}return r?o:a}function*qt(e,t,n){for(let r=0;r<e.value;r++){let i=H(t,n);if(i===V){if(e.value===1/0)break;throw Error(`${g} got unexpected break to lengthed map`)}if(i===B)throw Error(`${g} found map but not enough entries (got ${r} [no key], expected ${e.value})`);let a=H(t,n);if(a===B)throw Error(`${g} found map but not enough entries (got ${r} [no value], expected ${e.value})`);yield[i,a]}}function Jt(e,t){let n=function(){if(n._called)throw Error(`${g} tag decode() may only be called once`);n._called=!0;let r=H(e,t);if(r===B)throw Error(`${g} tag content missing`);if(r===V)throw Error(`${g} got unexpected break in tag content`);return r};return n.entries=function(){if(n._called)throw Error(`${g} tag decode() may only be called once`);n._called=!0;let r=e.next();if(!o.equals(r.type,o.map))throw Error(`${g} entries() requires map content, got ${r.type.name}`);let i=[];for(let n of qt(r,e,t))i.push(n);return i},n._called=!1,n}function H(e,t){if(e.done())return B;let n=e.next();if(o.equals(n.type,o.break))return V;if(n.type.terminal)return n.value;if(o.equals(n.type,o.array))return Gt(n,e,t);if(o.equals(n.type,o.map))return Kt(n,e,t);if(o.equals(n.type,o.tag)){if(t.tags&&typeof t.tags[n.value]==`function`){let r=Jt(e,t),i=t.tags[n.value](r);if(!r._called)throw Error(`${g} tag decoder must call decode() or entries()`);return i}throw Error(`${g} tag not supported (${n.value})`)}throw Error(`unsupported`)}function Yt(e,t){if(!(e instanceof Uint8Array))throw Error(`${g} data to decode must be a Uint8Array`);t=Object.assign({},Ut,t);let n=d(e),r=t.tokenizer||new Wt(n,t),i=H(r,t);if(i===B)throw Error(`${g} did not find any content to decode`);if(i===V)throw Error(`${g} got unexpected break`);return[i,e.subarray(r.pos())]}function Xt(e,t){let[n,r]=Yt(e,t);if(r.length>0)throw Error(`${g} too many terminals, data makes no sense`);return n}Object.defineProperty(class e{constructor(e,t){if(typeof e!=`number`||!Number.isInteger(e)||e<0)throw TypeError(`Tagged: tag must be a non-negative integer`);this.tag=e,this.value=t}static decoder(t){return n=>new e(t,n())}static preserve(...t){let n={};for(let r of t)n[r]=e.decoder(r);return n}}.prototype,Symbol.toStringTag,{value:`Tagged`});function Zt(e,t){if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n++)if(e[n]!==t[n])return!1;return!0}function Qt(e){if(e instanceof Uint8Array&&e.constructor.name===`Uint8Array`)return U(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return U(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));throw Error(`Unknown type, must be binary type`)}function $t(e){return e?.buffer instanceof ArrayBuffer}function U(e){return $t(e)?e:e.slice()}function en(e,t,n){if(e.length>=255)throw TypeError(`Alphabet too long`);for(var r=/* @__PURE__ */ new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var a=0;a<e.length;a++){var o=e.charAt(a),s=o.charCodeAt(0);if(r[s]!==255)throw TypeError(o+` is ambiguous`);if(r[s]=a,n){var c=o.toLowerCase().charCodeAt(0),l=o.toUpperCase().charCodeAt(0);c!==s&&(r[c]=a),l!==s&&(r[l]=a)}}var u=e.length,d=e.charAt(0),f=Math.log(u)/Math.log(256),p=Math.log(256)/Math.log(u);function m(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;for(var n=0,r=0,i=0,a=t.length;i!==a&&t[i]===0;)i++,n++;for(var o=(a-i)*p+1>>>0,s=new Uint8Array(o);i!==a;){for(var c=t[i],l=0,f=o-1;(c!==0||l<r)&&f!==-1;f--,l++)c+=256*s[f]>>>0,s[f]=c%u>>>0,c=c/u>>>0;if(c!==0)throw Error(`Non-zero carry`);r=l,i++}for(var m=o-r;m!==o&&s[m]===0;)m++;for(var h=d.repeat(n);m<o;++m)h+=e.charAt(s[m]);return h}function h(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return/* @__PURE__ */ new Uint8Array;var t=0;if(e[t]!==` `){for(var n=0,i=0;e[t]===d;)n++,t++;for(var a=(e.length-t)*f+1>>>0,o=new Uint8Array(a);e[t];){var s=r[e.charCodeAt(t)];if(s===255)return;for(var c=0,l=a-1;(s!==0||c<i)&&l!==-1;l--,c++)s+=u*o[l]>>>0,o[l]=s%256>>>0,s=s/256>>>0;if(s!==0)throw Error(`Non-zero carry`);i=c,t++}if(e[t]!==` `){for(var p=a-i;p!==a&&o[p]===0;)p++;for(var m=new Uint8Array(n+(a-p)),h=n;p!==a;)m[h++]=o[p++];return m}}}function ee(e){var n=h(e);if(n)return n;throw Error(`Non-${t} character`)}return{encode:m,decodeUnsafe:h,decode:ee}}var tn=en,nn=class{name;prefix;baseEncode;constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error(`Unknown type, must be binary type`)}},rn=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,n){this.name=e,this.prefix=t;let r=t.codePointAt(0);
|
|
2
|
+
/* c8 ignore next 3 */
|
|
3
|
+
if(r===void 0)throw Error(`Invalid prefix character`);this.prefixCodePoint=r,this.baseDecode=n}decode(e){if(typeof e==`string`){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error(`Can only multibase decode strings`)}or(e){return on(this,e)}},an=class{decoders;constructor(e){this.decoders=e}or(e){return on(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function on(e,t){return new an({...e.decoders??{[e.prefix]:e},...t.decoders??{[t.prefix]:t}})}var sn=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new nn(e,t,n),this.decoder=new rn(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function cn({name:e,prefix:t,encode:n,decode:r}){return new sn(e,t,n,r)}function ln({name:e,prefix:t,alphabet:n,caseInsensitive:r=!1}){let{encode:i,decode:a}=tn(n,e,r);return cn({prefix:t,name:e,encode:i,decode:e=>Qt(a(e))})}function un(e,t,n,r){let i=e.length;for(;e[i-1]===`=`;)--i;let a=new Uint8Array(i*n/8|0),o=0,s=0,c=0;for(let l=0;l<i;++l){let i=t[e[l]];if(i===void 0)throw SyntaxError(`Non-${r} character`);s=s<<n|i,o+=n,o>=8&&(o-=8,a[c++]=255&s>>o)}if(o>=n||255&s<<8-o)throw SyntaxError(`Unexpected end of data`);return a}function dn(e,t,n){let r=t[t.length-1]===`=`,i=(1<<n)-1,a=``,o=0,s=0;for(let r=0;r<e.length;++r)for(s=s<<8|e[r],o+=8;o>n;)o-=n,a+=t[i&s>>o];if(o!==0&&(a+=t[i&s<<n-o]),r)for(;a.length*n&7;)a+=`=`;return a}function fn(e,t){let n={};for(let r=0;r<e.length;++r)if(n[e[r]]=r,t){let t=e[r].toLowerCase(),i=e[r].toUpperCase();t!==e[r]&&(n[t]=r),i!==e[r]&&(n[i]=r)}return n}function W({name:e,prefix:t,bitsPerChar:n,alphabet:r,caseInsensitive:i=!1}){let a=fn(r,i);return cn({prefix:t,name:e,encode(e){return dn(e,r,n)},decode(t){return un(t,a,n,e)}})}const pn=W({prefix:`b`,name:`base32`,alphabet:`abcdefghijklmnopqrstuvwxyz234567`,bitsPerChar:5,caseInsensitive:!0});W({prefix:`B`,name:`base32upper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`c`,name:`base32pad`,alphabet:`abcdefghijklmnopqrstuvwxyz234567=`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`C`,name:`base32padupper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`v`,name:`base32hex`,alphabet:`0123456789abcdefghijklmnopqrstuv`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`V`,name:`base32hexupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`t`,name:`base32hexpad`,alphabet:`0123456789abcdefghijklmnopqrstuv=`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`T`,name:`base32hexpadupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV=`,bitsPerChar:5,caseInsensitive:!0}),W({prefix:`h`,name:`base32z`,alphabet:`ybndrfg8ejkmcpqxot1uwisza345h769`,bitsPerChar:5});const mn=ln({prefix:`k`,name:`base36`,alphabet:`0123456789abcdefghijklmnopqrstuvwxyz`,caseInsensitive:!0});ln({prefix:`K`,name:`base36upper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`,caseInsensitive:!0});const G=ln({name:`base58btc`,prefix:`z`,alphabet:`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`});ln({name:`base58flickr`,prefix:`Z`,alphabet:`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`});var hn=yn,gn=128,_n=-128,vn=2**31;function yn(e,t,n){t||=[],n||=0;for(var r=n;e>=vn;)t[n++]=e&255|gn,e/=128;for(;e&_n;)t[n++]=e&255|gn,e>>>=7;return t[n]=e|0,yn.bytes=n-r+1,t}var bn=Cn,xn=128,Sn=127;function Cn(e,t){var n=0,t=t||0,r=0,i=t,a,o=e.length;do{if(i>=o)throw Cn.bytes=0,RangeError(`Could not decode varint`);a=e[i++],n+=r<28?(a&Sn)<<r:(a&Sn)*2**r,r+=7}while(a>=xn);return Cn.bytes=i-t,n}var wn=128,Tn=2**14,En=2**21,Dn=2**28,On=2**35,kn=2**42,An=2**49,jn=2**56,Mn=2**63,Nn={encode:hn,decode:bn,encodingLength:function(e){return e<wn?1:e<Tn?2:e<En?3:e<Dn?4:e<On?5:e<kn?6:e<An?7:e<jn?8:e<Mn?9:10}};function Pn(e,t=0){let n=Nn.decode(e,t),r=Nn.decode.bytes;if(r>9)throw RangeError(`Invalid varint: too long`);if(r>1&&e[t+r-1]===0)throw RangeError(`Invalid varint: not minimally encoded`);return[n,r]}function Fn(e,t,n=0){return Nn.encode(e,t,n),t}function In(e){return Nn.encodingLength(e)}function Ln(e,t){let n=t.byteLength,r=In(e),i=r+In(n),a=new Uint8Array(i+n);return Fn(e,a,0),Fn(n,a,r),a.set(t,i),new Bn(e,n,t,a)}function Rn(e){let t=Qt(e),[n,r]=Pn(t),[i,a]=Pn(t.subarray(r)),o=t.subarray(r+a);if(o.byteLength!==i)throw Error(`Incorrect length`);return new Bn(n,i,o,t)}function zn(e,t){if(e===t)return!0;{let n=t;return e.code===n.code&&e.size===n.size&&n.bytes instanceof Uint8Array&&Zt(e.bytes,n.bytes)}}var Bn=class{code;size;digest;bytes;constructor(e,t,n,r){this.code=e,this.size=t,this.digest=U(n),this.bytes=U(r)}};function Vn(e,t){let{bytes:n,version:r}=e;switch(r){case 0:return Kn(n,Un(e),t??G.encoder);default:return qn(n,Un(e),t??pn.encoder)}}const Hn=/* @__PURE__ */ new WeakMap;function Un(e){let t=Hn.get(e);if(t==null){let t=/* @__PURE__ */ new Map;return Hn.set(e,t),t}return t}var Wn=class e{code;version;multihash;bytes;"/";constructor(e,t,n,r){this.code=t,this.version=e,this.multihash=n,this.bytes=U(r),this[`/`]=this.bytes}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:t,multihash:n}=this;if(t!==K)throw Error(`Cannot convert a non dag-pb CID to CIDv0`);if(n.code!==Jn)throw Error(`Cannot convert non sha2-256 multihash CID to CIDv0`);return e.createV0(n)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:t,digest:n}=this.multihash,r=Ln(t,n);return e.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(t){return e.equals(this,t)}static equals(e,t){let n=t;return n!=null&&e.code===n.code&&e.version===n.version&&zn(e.multihash,n.multihash)}toString(e){return Vn(this,e)}toJSON(){return{"/":Vn(this)}}link(){return this}[Symbol.toStringTag]=`CID`;[Symbol.for(`nodejs.util.inspect.custom`)](){return`CID(${this.toString()})`}static asCID(t){if(t==null)return null;let n=t;if(n instanceof e)return n;if(n[`/`]!=null&&n[`/`]===n.bytes||n.asCID===n){let{version:t,code:r,multihash:i,bytes:a}=n;return new e(t,r,i,a??Yn(t,r,i.bytes))}if(n[Xn]===!0){let{version:t,multihash:r,code:i}=n,a=Rn(r);return e.create(t,i,a)}return null}static create(t,n,r){if(typeof n!=`number`)throw Error(`String codecs are no longer supported`);if(!(r.bytes instanceof Uint8Array))throw Error(`Invalid digest`);switch(t){case 0:if(n!==K)throw Error(`Version 0 CID must use dag-pb (code: ${K}) block encoding`);return new e(t,n,r,r.bytes);case 1:{let i=Yn(t,n,r.bytes);return new e(t,n,r,i)}default:throw Error(`Invalid version`)}}static createV0(t){return e.create(0,K,t)}static createV1(t,n){return e.create(1,t,n)}static decode(t){let[n,r]=e.decodeFirst(t);if(r.length!==0)throw Error(`Incorrect length`);return n}static decodeFirst(t){let n=e.inspectBytes(t),r=n.size-n.multihashSize,i=Qt(t.subarray(r,r+n.multihashSize));if(i.byteLength!==n.multihashSize)throw Error(`Incorrect length`);let a=i.subarray(n.multihashSize-n.digestSize),o=new Bn(n.multihashCode,n.digestSize,a,i);return[n.version===0?e.createV0(o):e.createV1(n.codec,o),t.subarray(n.size)]}static inspectBytes(e){let t=0,n=()=>{let[n,r]=Pn(e.subarray(t));return t+=r,n},r=n(),i=K;if(r===18?(r=0,t=0):i=n(),r!==0&&r!==1)throw RangeError(`Invalid CID version ${r}`);let a=t,o=n(),s=n(),c=t+s,l=c-a;return{version:r,codec:i,multihashCode:o,digestSize:s,multihashSize:l,size:c}}static parse(t,n){let[r,i]=Gn(t,n),a=e.decode(i);if(a.version===0&&t[0]!==`Q`)throw Error(`Version 0 CID string must not include multibase prefix`);return Un(a).set(r,t),a}};function Gn(e,t){switch(e[0]){case`Q`:{let n=t??G;return[G.prefix,n.decode(`${G.prefix}${e}`)]}case G.prefix:{let n=t??G;return[G.prefix,n.decode(e)]}case pn.prefix:{let n=t??pn;return[pn.prefix,n.decode(e)]}case mn.prefix:{let n=t??mn;return[mn.prefix,n.decode(e)]}default:if(t==null)throw Error(`To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided`);return[e[0],t.decode(e)]}}function Kn(e,t,n){let{prefix:r}=n;if(r!==G.prefix)throw Error(`Cannot string encode V0 in ${n.name} encoding`);let i=t.get(r);if(i==null){let i=n.encode(e).slice(1);return t.set(r,i),i}return i}function qn(e,t,n){let{prefix:r}=n,i=t.get(r);if(i==null){let i=n.encode(e);return t.set(r,i),i}return i}const K=112,Jn=18;function Yn(e,t,n){let r=In(e),i=r+In(t),a=new Uint8Array(i+n.byteLength);return Fn(e,a,0),Fn(t,a,r),a.set(n,i),a}const Xn=Symbol.for(`@ipld/js-cid/CID`);function Zn(e){return e instanceof ArrayBuffer?new Uint8Array(e,0,e.byteLength):e}function Qn(e){if(e.asCID!==e&&e[`/`]!==e.bytes)return null;let t=Wn.asCID(e);
|
|
4
|
+
/* c8 ignore next 4 */
|
|
5
|
+
if(!t)return null;let n=new Uint8Array(t.bytes.byteLength+1);return n.set(t.bytes,1),[new s(o.tag,42),new s(o.bytes,n)]}function $n(){throw Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}function er(e){if(Number.isNaN(e))throw Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}function tr(e){for(let t of e.keys())if(typeof t!=`string`||t.length===0)throw Error(`Non-string Map keys are not supported by the IPLD Data Model and cannot be encoded`);return null}const nr={float64:!0,typeEncoders:{Map:tr,Object:Qn,undefined:$n,number:er}};({...nr}),{...nr.typeEncoders};function rr(e){let t=e();if(t[0]!==0)throw Error(`Invalid CID for CBOR tag 42; expected leading 0x00`);return Wn.decode(t.subarray(1))}const ir={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,rejectDuplicateMapKeys:!0,tags:{42:rr}};({...ir}),{...ir.tags};const ar=e=>Ht(e,nr),or=e=>Xt(Zn(e),ir);function sr(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var cr,q,lr,ur;let J=cr=class extends t.ccc.Entity.Base(){constructor(e,t){super(),this.document=e,this.localId=t}static from(e){return e instanceof cr?e:new cr(e.document,e.localId??void 0)}};J=cr=sr([t.ccc.codec(t.ccc.mol.table({document:t.ccc.mol.Bytes,localId:t.ccc.mol.StringOpt}).map({inMap:e=>({...e,document:t.ccc.hexFrom(ar(e.document))}),outMap:e=>({...e,document:or(t.ccc.bytesFrom(e.document))})}))],J);const dr=t.ccc.mol.union({v1:J});let Y=q=class extends t.ccc.Entity.BaseUnion(){constructor(e,t){super({type:e,value:t}),this.type=e,this.value=t}static from(e){return e instanceof q?e:`inner`in e?new q(e.inner.type??`v1`,J.from(e.inner.value)):new q(e.type??`v1`,J.from(e.value))}static fromV1(e){return new q(`v1`,J.from(e))}};Y=q=sr([t.ccc.codec(dr)],Y);let X=lr=class extends t.ccc.Entity.Base(){constructor(e,t,n){super(),this.history=e,this.sig=t,this.rotationKeyIndices=n}static from(e){return e instanceof lr?e:new lr(e.history,t.ccc.hexFrom(e.sig),e.rotationKeyIndices.map(t.ccc.numFrom))}};X=lr=sr([t.ccc.codec(t.ccc.mol.table({history:t.ccc.mol.BytesVec,sig:t.ccc.mol.Bytes,rotationKeyIndices:t.ccc.mol.Uint8Vec}).map({inMap:e=>({...e,history:e.history.map(e=>t.ccc.hexFrom(ar(e)))}),outMap:e=>({...e,history:e.history.map(e=>or(t.ccc.bytesFrom(e)))})}))],X);let Z=ur=class extends t.ccc.Entity.Base(){constructor(e){super(),this.localIdAuthorization=e}static from(e){return e instanceof ur?e:new ur(X.from(e.localIdAuthorization))}};Z=ur=sr([t.ccc.codec(t.ccc.mol.table({localIdAuthorization:X}))],Z);const fr=n.typeIdA.buildTypeIdOperations({async getScriptInfo(e){return e.getKnownScript(t.ccc.KnownScript.DidCkb)},codec:Y,async calculateTypeId(e,n){return t.ccc.bytesFrom(t.ccc.hashTypeId(n.inputs[0],n.outputs.length)).slice(0,20)}});function pr(e){return fr.create(e)}async function mr(e){return fr.transfer(e)}async function hr(e){return fr.destroy(e)}const gr=`did:ckb:`,_r=`abcdefghijklmnopqrstuvwxyz234567`,vr=(()=>{let e={};for(let t=0;t<32;t++)e[_r[t]]=t;return e})();function yr(e){let n=t.ccc.bytesFrom(e),r=0,i=0,a=``;for(let e=0;e<n.length;e++)for(i=i<<8|n[e],r+=8;r>=5;)a+=_r[i>>>r-5&31],r-=5;return r>0&&(a+=_r[i<<5-r&31]),a}function br(e){let t=e.toLowerCase().replace(/=+$/g,``),n=0,r=0,i=[];for(let e of t){let t=vr[e];if(t===void 0)throw Error(`Invalid base32 character "${e}" in input`);r=r<<5|t,n+=5,n>=8&&(i.push(r>>>n-8&255),n-=8)}return Uint8Array.from(i)}function xr(e){let n=t.ccc.bytesFrom(e);if(n.length!==20)throw Error(`did:ckb args must be 20 bytes, got ${n.length}`);return gr+yr(n)}function Q(e){if(!e.startsWith(gr))throw Error(`Expected did:ckb:..., got "${e}"`);let n=e.slice(8);if(n.length!==32)throw Error(`did:ckb identifier must be 32 base32 chars, got ${n.length}`);let r=br(n);if(r.length!==20)throw Error(`did:ckb identifier must decode to 20 bytes, got ${r.length}`);return t.ccc.hexFrom(r)}function $(e){if(!e.startsWith(gr))return!1;try{return Q(e),!0}catch{return!1}}async function Sr(e,n){let r=await e.getKnownScript(t.ccc.KnownScript.DidCkb);return t.ccc.Script.from({codeHash:r.codeHash,hashType:r.hashType,args:n})}function Cr(e,t){return{did:xr(t),id:t,data:Y.decode(e.outputData),cell:e}}async function wr(e){let n=t.ccc.hexFrom(e.id),r=await Sr(e.client,n),i=await e.client.findSingletonCellByType(r,!0);if(i)return Cr(i,n)}async function Tr(e){if(!$(e.did))throw Error(`Not a did:ckb identifier: ${e.did}`);return wr({client:e.client,id:Q(e.did)})}async function Er(e){let n=await e.client.getKnownScript(t.ccc.KnownScript.DidCkb),r=[];for await(let i of e.client.findCells({script:t.ccc.Script.from(e.lock),scriptType:`lock`,scriptSearchMode:`exact`,filter:{script:t.ccc.Script.from({codeHash:n.codeHash,hashType:n.hashType,args:`0x`})},withData:!0},e.order,e.limit)){let e=i.cellOutput.type;if(e&&t.ccc.bytesFrom(e.args).length===20)try{r.push(Cr(i,t.ccc.hexFrom(e.args)))}catch{}}return r}async function Dr(e){let n=typeof e.id==`string`&&$(e.id)?Q(e.id):t.ccc.hexFrom(e.id),r=(await e.client.getKnownScript(t.ccc.KnownScript.DidCkb)).codeHash.toLowerCase(),i=n.toLowerCase(),a=e.liveCell??(await wr({client:e.client,id:n}))?.cell;if(!a)return[];let o=[],s=e.maxSteps??50,c=0;for(;a&&c<s;){c++;let t=await e.client.getTransaction(a.outPoint.txHash);if(!t)break;let n=kr(a,t.blockNumber);if(!n)break;let s=await Or(e.client,t.transaction,r,i);if(!s){n.action=n.data.value.localId?`MIGRATE`:`CREATE`,o.push(n);break}n.action=`UPDATE`,o.push(n),a=s}return o}async function Or(e,n,r,i){let{inputs:a}=t.ccc.Transaction.from(n);for(let n of a){let a=await n.getCell(e),o=a.cellOutput.type;if(o&&o.codeHash.toLowerCase()===r&&t.ccc.hexFrom(o.args).toLowerCase()===i)return a}}function kr(e,t){try{let n=Y.decode(e.outputData);return{action:`UPDATE`,txHash:e.outPoint.txHash,outputIndex:e.outPoint.index,blockNumber:t,capacity:e.cellOutput.capacity,data:n}}catch{return}}function Ar(n){let r=e.r(n.genesisOperation);if(!r[n.rotationKeyIndex])throw Error(`rotationKeyIndex ${n.rotationKeyIndex} out of range (genesis has ${r.length} keys)`);let i=n.curve??r[n.rotationKeyIndex].curve,a=e.o(n.rotationPrivateKey,t.ccc.bytesFrom(n.txHash),i);return Z.from({localIdAuthorization:{history:[n.genesisOperation],sig:t.ccc.hexFrom(a),rotationKeyIndices:[n.selfSigIndex??0,n.rotationKeyIndex]}})}async function jr(e){if(!e.sourceDid.startsWith(`did:plc:`))throw Error(`sourceDid must be did:plc:..., got "${e.sourceDid}"`);let t=Y.from(e.data??{value:{document:{}}});return t.value.localId=e.sourceDid,pr({signer:e.signer,data:t,receiver:e.receiver,tx:e.tx})}var Mr=/* @__PURE__ */ e.c({DidCkbData:()=>Y,DidCkbDataV1:()=>J,DidCkbWitness:()=>Z,PlcAuthorization:()=>X,argsToDid:()=>xr,base32Decode:()=>br,base32Encode:()=>yr,buildMigrationWitness:()=>Ar,createDidCkb:()=>pr,destroyDidCkb:()=>hr,didToArgs:()=>Q,findDidCkbCell:()=>wr,getDidCkbHistory:()=>Dr,isDidCkb:()=>$,listDidCkbsByLock:()=>Er,migrateDidCkb:()=>jr,plc:()=>e.a,resolveDidCkb:()=>Tr,transferDidCkb:()=>mr});Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return wr}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return xr}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return br}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return pr}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return jr}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Tr}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return Mr}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return Z}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return X}});
|
|
6
|
+
//# sourceMappingURL=barrel-BWApUcdp.js.map
|