@mainnet-cash/bcmr 2.7.23

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.
@@ -0,0 +1,9 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>The Empty Mainnet App</title>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1"><script defer src="BCMR-2.7.23.js"></script></head>
7
+ <body><script defer src="mainnet.js"></script><script>document.addEventListener("DOMContentLoaded", async (event) => Object.assign(globalThis, await __mainnetPromise, await __bcmrPromise))</script>
8
+ </body>
9
+ </html>
@@ -0,0 +1,106 @@
1
+ import { IdentitySnapshot, Transaction } from "@bitauth/libauth";
2
+ import { ElectrumRawTransaction, Network, TxI } from "mainnet-js";
3
+ import { Registry } from "./bcmr-v2.schema";
4
+ export interface AuthChainElement {
5
+ txHash: string;
6
+ contentHash: string;
7
+ uris: string[];
8
+ httpsUrl: string;
9
+ }
10
+ export type AuthChain = AuthChainElement[];
11
+ export declare class BCMR {
12
+ static metadataRegistries: Registry[];
13
+ static getRegistries(): Registry[];
14
+ static resetRegistries(): void;
15
+ /**
16
+ * fetchMetadataRegistry Fetch the BCMR registry JSON file from a remote URI, optionally verifying its content hash
17
+ *
18
+ * @param {string} uri URI of the registry to fetch from
19
+ * @param {string?} contentHash SHA256 hash of the resource the `uri` parameter points at.
20
+ * If specified, calculates the hash of the data fetched from `uri` and matches it with provided one.
21
+ * Yields an error upon mismatch.
22
+ *
23
+ * @returns {Registry} resolved registry
24
+ */
25
+ static fetchMetadataRegistry(uri: string, contentHash?: string): Promise<Registry>;
26
+ /**
27
+ * addMetadataRegistry Add the metadata registry to the list of tracked registries
28
+ *
29
+ * @param {Registry} registry Registry object per schema specification, see https://raw.githubusercontent.com/bitjson/chip-bcmr/master/bcmr-v1.schema.json
30
+ *
31
+ */
32
+ static addMetadataRegistry(registry: Registry): void;
33
+ /**
34
+ * addMetadataRegistryFromUri Add the metadata registry by fetching a JSON file from a remote URI, optionally verifying its content hash
35
+ *
36
+ * @param {string} uri URI of the registry to fetch from
37
+ * @param {string?} contentHash SHA256 hash of the resource the `uri` parameter points at.
38
+ * If specified, calculates the hash of the data fetched from `uri` and matches it with provided one.
39
+ * Yields an error upon mismatch.
40
+ *
41
+ */
42
+ static addMetadataRegistryFromUri(uri: string, contentHash?: string): Promise<void>;
43
+ static makeAuthChainElement(rawTx: ElectrumRawTransaction | Transaction, hash: string): AuthChainElement;
44
+ /**
45
+ * buildAuthChain Build an authchain - Zeroth-Descendant Transaction Chain, refer to https://github.com/bitjson/chip-bcmr#zeroth-descendant-transaction-chains
46
+ * The authchain in this implementation is specific to resolve to a valid metadata registry
47
+ *
48
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
49
+ * @param {Network?} options.network (default=mainnet) network to query the data from
50
+ * @param {boolean?} options.resolveBase (default=false) boolean flag to indicate that autchain building should resolve and verify elements back to base or be stopped at this exact chain element
51
+ * @param {boolean?} options.followToHead (default=true) boolean flag to indicate that autchain building should progress to head or be stopped at this exact chain element
52
+ * @param {ElectrumRawTransaction?} options.rawTx cached raw transaction obtained previously, spares a Fulcrum call
53
+ * @param {TxI[]?} options.historyCache cached address history to be reused if authchain building proceeds with the same address, spares a flurry of Fulcrum calls
54
+ *
55
+ * @returns {AuthChain} returns the resolved authchain
56
+ */
57
+ static buildAuthChain(options: {
58
+ transactionHash: string;
59
+ network?: Network;
60
+ resolveBase?: boolean;
61
+ followToHead?: boolean;
62
+ rawTx?: ElectrumRawTransaction;
63
+ historyCache?: TxI[];
64
+ }): Promise<AuthChain>;
65
+ /**
66
+ * fetchAuthChainFromChaingraph Fetch the authchain information from a trusted external indexer
67
+ * The authchain in this implementation is specific to resolve to a valid metadata registry
68
+ *
69
+ * @param {string} options.chaingraphUrl (required) URL of a chaingraph indexer instance to fetch info from
70
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
71
+ * @param {string?} options.network (default=undefined) network to query the data from, specific to the queried instance,
72
+ * can be 'mainnet', 'chipnet', or anything else.
73
+ * if left undefined all chaingraph transactions will be looked at, disregarding the chain
74
+ *
75
+ * @returns {AuthChain} returns the resolved authchain
76
+ */
77
+ static fetchAuthChainFromChaingraph(options: {
78
+ chaingraphUrl: string;
79
+ transactionHash: string;
80
+ network?: string;
81
+ }): Promise<AuthChain>;
82
+ /**
83
+ * addMetadataRegistryAuthChain Add BCMR metadata registry by resolving an authchain
84
+ *
85
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
86
+ * @param {Network?} options.network (default=mainnet) network to query the data from
87
+ * @param {boolean?} options.followToHead (default=true) boolean flag to indicate that autchain building should progress to head (most recent registry version) or be stopped at this exact chain element
88
+ * @param {ElectrumRawTransaction?} options.rawTx cached raw transaction obtained previously, spares a Fulcrum call
89
+ *
90
+ * @returns {AuthChain} returns the resolved authchain
91
+ */
92
+ static addMetadataRegistryAuthChain(options: {
93
+ transactionHash: string;
94
+ network?: Network;
95
+ followToHead?: boolean;
96
+ rawTx?: ElectrumRawTransaction;
97
+ }): Promise<AuthChain>;
98
+ /**
99
+ * getTokenInfo Return the token info (or the identity snapshot as per spec)
100
+ *
101
+ * @param {string} tokenId token id to look up
102
+ *
103
+ * @returns {IdentitySnapshot?} return the info for the token found, otherwise undefined
104
+ */
105
+ static getTokenInfo(tokenId: string): IdentitySnapshot | undefined;
106
+ }
@@ -0,0 +1,410 @@
1
+ import { binToHex, binToUtf8, decodeTransaction, hexToBin, sha256, utf8ToBin, } from "@bitauth/libauth";
2
+ import { OpReturnData, Config, Network, initProvider, } from "mainnet-js";
3
+ // Implementation of CHIP-BCMR v2.0.0-draft, refer to https://github.com/bitjson/chip-bcmr
4
+ export class BCMR {
5
+ // List of tracked registries
6
+ static { this.metadataRegistries = []; }
7
+ static getRegistries() {
8
+ return this.metadataRegistries;
9
+ }
10
+ static resetRegistries() {
11
+ this.metadataRegistries = [];
12
+ }
13
+ /**
14
+ * fetchMetadataRegistry Fetch the BCMR registry JSON file from a remote URI, optionally verifying its content hash
15
+ *
16
+ * @param {string} uri URI of the registry to fetch from
17
+ * @param {string?} contentHash SHA256 hash of the resource the `uri` parameter points at.
18
+ * If specified, calculates the hash of the data fetched from `uri` and matches it with provided one.
19
+ * Yields an error upon mismatch.
20
+ *
21
+ * @returns {Registry} resolved registry
22
+ */
23
+ static async fetchMetadataRegistry(uri, contentHash) {
24
+ if (uri.indexOf("https://") < 0) {
25
+ uri = `https://${uri}`;
26
+ }
27
+ // content hashes HTTPS Publication Outputs per spec
28
+ if (contentHash) {
29
+ // request as text and verify hash
30
+ const response = await fetch(uri);
31
+ const data = await response.text();
32
+ const hash = binToHex(sha256.hash(utf8ToBin(data)));
33
+ if (contentHash != hash) {
34
+ throw new Error(`Content hash mismatch for URI: ${uri}\nreceived: ${hash}\nrequired: ${contentHash}`);
35
+ }
36
+ return JSON.parse(data);
37
+ }
38
+ // request as JSON
39
+ const response = await fetch(uri);
40
+ const data = await response.json();
41
+ return data;
42
+ }
43
+ /**
44
+ * addMetadataRegistry Add the metadata registry to the list of tracked registries
45
+ *
46
+ * @param {Registry} registry Registry object per schema specification, see https://raw.githubusercontent.com/bitjson/chip-bcmr/master/bcmr-v1.schema.json
47
+ *
48
+ */
49
+ static addMetadataRegistry(registry) {
50
+ if (this.metadataRegistries.some((val) => JSON.stringify(val) === JSON.stringify(registry))) {
51
+ return;
52
+ }
53
+ this.metadataRegistries.push(registry);
54
+ }
55
+ /**
56
+ * addMetadataRegistryFromUri Add the metadata registry by fetching a JSON file from a remote URI, optionally verifying its content hash
57
+ *
58
+ * @param {string} uri URI of the registry to fetch from
59
+ * @param {string?} contentHash SHA256 hash of the resource the `uri` parameter points at.
60
+ * If specified, calculates the hash of the data fetched from `uri` and matches it with provided one.
61
+ * Yields an error upon mismatch.
62
+ *
63
+ */
64
+ static async addMetadataRegistryFromUri(uri, contentHash) {
65
+ const registry = await this.fetchMetadataRegistry(uri, contentHash);
66
+ this.addMetadataRegistry(registry);
67
+ }
68
+ // helper function to enforce the constraints on the 0th output, decode the BCMR's OP_RETURN data
69
+ // returns resolved AuthChainElement
70
+ static makeAuthChainElement(rawTx, hash) {
71
+ let opReturns;
72
+ let spends0thOutput = false;
73
+ if (rawTx.hasOwnProperty("vout")) {
74
+ const electrumTransaction = rawTx;
75
+ opReturns = electrumTransaction.vout
76
+ .filter((val) => val.scriptPubKey.type === "nulldata")
77
+ .map((val) => val.scriptPubKey.hex);
78
+ spends0thOutput = electrumTransaction.vin.some((val) => val.vout === 0);
79
+ }
80
+ else {
81
+ const libauthTransaction = rawTx;
82
+ opReturns = libauthTransaction.outputs
83
+ .map((val) => binToHex(val.lockingBytecode))
84
+ .filter((val) => val.indexOf("6a") === 0);
85
+ spends0thOutput = libauthTransaction.inputs.some((val) => val.outpointIndex === 0);
86
+ }
87
+ if (!spends0thOutput) {
88
+ throw new Error("Invalid authchain transaction (does not spend 0th output of previous transaction)");
89
+ }
90
+ const bcmrOpReturns = opReturns.filter((val) => val.indexOf("6a0442434d52") === 0 ||
91
+ val.indexOf("6a4c0442434d52") === 0 ||
92
+ val.indexOf("6a4d040042434d52") === 0 ||
93
+ val.indexOf("6a4e0400000042434d52") === 0);
94
+ if (bcmrOpReturns.length === 0) {
95
+ return {
96
+ txHash: hash,
97
+ contentHash: "",
98
+ uris: [],
99
+ httpsUrl: "",
100
+ };
101
+ }
102
+ const opReturnHex = opReturns[0];
103
+ const chunks = OpReturnData.parseBinary(hexToBin(opReturnHex));
104
+ if (chunks.length < 2) {
105
+ throw new Error(`Malformed BCMR output: ${opReturnHex}`);
106
+ }
107
+ const result = {
108
+ txHash: hash,
109
+ contentHash: "",
110
+ uris: [],
111
+ httpsUrl: "",
112
+ };
113
+ if (chunks.length === 2) {
114
+ // IPFS Publication Output
115
+ result.contentHash = binToHex(chunks[1]);
116
+ const ipfsCid = binToUtf8(chunks[1]);
117
+ result.uris = [`ipfs://${ipfsCid}`];
118
+ result.httpsUrl = `${Config.DefaultIpfsGateway}${ipfsCid}`;
119
+ }
120
+ else {
121
+ // URI Publication Output
122
+ // content hash is in OP_SHA256 byte order per spec
123
+ result.contentHash = binToHex(chunks[1].slice());
124
+ const uris = chunks.slice(2);
125
+ for (const uri of uris) {
126
+ const uriString = binToUtf8(uri);
127
+ result.uris.push(uriString);
128
+ if (result.httpsUrl) {
129
+ continue;
130
+ }
131
+ if (uriString.indexOf("ipfs://") === 0) {
132
+ const ipfsCid = uriString.replace("ipfs://", "");
133
+ result.httpsUrl = `${Config.DefaultIpfsGateway}${ipfsCid}`;
134
+ }
135
+ else if (uriString.indexOf("https://") === 0) {
136
+ result.httpsUrl = uriString;
137
+ }
138
+ else if (uriString.indexOf("https://") === -1) {
139
+ result.httpsUrl = uriString;
140
+ // case for domain name specifier, like example.com
141
+ if (uriString.indexOf("/") === -1) {
142
+ const parts = uriString.toLowerCase().split(".");
143
+ if (!(parts?.[0]?.indexOf("baf") === 0 && parts?.[1] === "ipfs")) {
144
+ result.httpsUrl = `${result.httpsUrl}/.well-known/bitcoin-cash-metadata-registry.json`;
145
+ }
146
+ }
147
+ result.httpsUrl = `https://${result.httpsUrl}`;
148
+ }
149
+ else {
150
+ throw new Error(`Unsupported uri type: ${uriString}`);
151
+ }
152
+ }
153
+ }
154
+ return result;
155
+ }
156
+ /**
157
+ * buildAuthChain Build an authchain - Zeroth-Descendant Transaction Chain, refer to https://github.com/bitjson/chip-bcmr#zeroth-descendant-transaction-chains
158
+ * The authchain in this implementation is specific to resolve to a valid metadata registry
159
+ *
160
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
161
+ * @param {Network?} options.network (default=mainnet) network to query the data from
162
+ * @param {boolean?} options.resolveBase (default=false) boolean flag to indicate that autchain building should resolve and verify elements back to base or be stopped at this exact chain element
163
+ * @param {boolean?} options.followToHead (default=true) boolean flag to indicate that autchain building should progress to head or be stopped at this exact chain element
164
+ * @param {ElectrumRawTransaction?} options.rawTx cached raw transaction obtained previously, spares a Fulcrum call
165
+ * @param {TxI[]?} options.historyCache cached address history to be reused if authchain building proceeds with the same address, spares a flurry of Fulcrum calls
166
+ *
167
+ * @returns {AuthChain} returns the resolved authchain
168
+ */
169
+ static async buildAuthChain(options) {
170
+ if (options.network === undefined) {
171
+ options.network = Network.MAINNET;
172
+ }
173
+ if (options.followToHead === undefined) {
174
+ options.followToHead = true;
175
+ }
176
+ if (options.resolveBase === undefined) {
177
+ options.resolveBase = false;
178
+ }
179
+ const provider = (await initProvider(options.network));
180
+ if (options.rawTx === undefined) {
181
+ options.rawTx = await provider.getRawTransactionObject(options.transactionHash);
182
+ }
183
+ // figure out the autchain by moving towards authhead
184
+ const getAuthChainChild = async () => {
185
+ const history = options.historyCache ||
186
+ (await provider.getHistory(options.rawTx.vout[0].scriptPubKey.addresses[0]));
187
+ const thisTx = history.find((val) => val.tx_hash === options.transactionHash);
188
+ let filteredHistory = history.filter((val) => val.height > 0
189
+ ? val.height >= thisTx.height || val.height <= 0
190
+ : val.height <= 0 && val.tx_hash !== thisTx.tx_hash);
191
+ for (const historyTx of filteredHistory) {
192
+ const historyRawTx = await provider.getRawTransactionObject(historyTx.tx_hash);
193
+ const authChainVin = historyRawTx.vin.find((val) => val.txid === options.transactionHash && val.vout === 0);
194
+ // if we've found continuation of authchain, we shall recurse into it
195
+ if (authChainVin) {
196
+ // reuse queried address history if the next element in chain is the same address
197
+ const historyCache = options.rawTx.vout[0].scriptPubKey.addresses[0] ===
198
+ historyRawTx.vout[0].scriptPubKey.addresses[0]
199
+ ? filteredHistory
200
+ : undefined;
201
+ // combine the authchain element with the rest obtained
202
+ return { rawTx: historyRawTx, historyCache };
203
+ }
204
+ }
205
+ return undefined;
206
+ };
207
+ // make authchain element and combine with the rest obtained
208
+ let element;
209
+ try {
210
+ element = BCMR.makeAuthChainElement(options.rawTx, options.rawTx.hash);
211
+ }
212
+ catch (error) {
213
+ // special case for cashtoken authchain lookup by categoryId - allow to fail first lookup and inspect the genesis transaction
214
+ // follow authchain to head and look for BCMR outputs
215
+ const child = await getAuthChainChild();
216
+ if (child) {
217
+ return await BCMR.buildAuthChain({
218
+ ...options,
219
+ transactionHash: child.rawTx.hash,
220
+ rawTx: child.rawTx,
221
+ historyCache: child.historyCache,
222
+ });
223
+ }
224
+ else {
225
+ throw error;
226
+ }
227
+ }
228
+ let chainBase = [];
229
+ if (options.resolveBase) {
230
+ // check for accelerated path if "authchain" extension is in registry
231
+ const registry = await this.fetchMetadataRegistry(element.httpsUrl, element.contentHash);
232
+ if (registry.extensions &&
233
+ registry.extensions["authchain"] &&
234
+ Object.keys(registry.extensions["authchain"]).length) {
235
+ const chainTxArray = Object.values(registry.extensions["authchain"]);
236
+ chainBase = chainTxArray
237
+ .map((tx) => {
238
+ const transactionBin = hexToBin(tx);
239
+ const decoded = decodeTransaction(transactionBin);
240
+ if (typeof decoded === "string") {
241
+ throw new Error(`Error decoding transaction ${JSON.stringify(tx)}, ${decoded}`);
242
+ }
243
+ const hash = binToHex(sha256.hash(sha256.hash(transactionBin)).reverse());
244
+ return { decoded, hash };
245
+ })
246
+ .map(({ decoded, hash }) => BCMR.makeAuthChainElement(decoded, hash));
247
+ }
248
+ else {
249
+ // simply go back in history towards authhead
250
+ let stop = false;
251
+ let tx = { ...options.rawTx };
252
+ let maxElements = 10;
253
+ while (stop == false || maxElements === 0) {
254
+ const vin = tx.vin.find((val) => val.vout === 0);
255
+ tx = await provider.getRawTransactionObject(vin.txid);
256
+ try {
257
+ const pastElement = BCMR.makeAuthChainElement(tx, tx.hash);
258
+ chainBase.unshift(pastElement);
259
+ maxElements--;
260
+ }
261
+ catch {
262
+ stop = true;
263
+ }
264
+ }
265
+ }
266
+ }
267
+ // if we follow to head, we need to locate the next transaction spending our 0th output
268
+ // and repeat the building process recursively
269
+ if (options.followToHead) {
270
+ const child = await getAuthChainChild();
271
+ if (child) {
272
+ const chainHead = await BCMR.buildAuthChain({
273
+ transactionHash: child.rawTx.hash,
274
+ network: options.network,
275
+ rawTx: child.rawTx,
276
+ historyCache: child.historyCache,
277
+ followToHead: options.followToHead,
278
+ resolveBase: false,
279
+ });
280
+ // combine the authchain element with the rest obtained
281
+ return [...chainBase, element, ...chainHead].filter((val) => val.httpsUrl.length);
282
+ }
283
+ }
284
+ // return the last chain element (or the only found in an edge case)
285
+ return [...chainBase, element].filter((val) => val.httpsUrl.length);
286
+ }
287
+ /**
288
+ * fetchAuthChainFromChaingraph Fetch the authchain information from a trusted external indexer
289
+ * The authchain in this implementation is specific to resolve to a valid metadata registry
290
+ *
291
+ * @param {string} options.chaingraphUrl (required) URL of a chaingraph indexer instance to fetch info from
292
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
293
+ * @param {string?} options.network (default=undefined) network to query the data from, specific to the queried instance,
294
+ * can be 'mainnet', 'chipnet', or anything else.
295
+ * if left undefined all chaingraph transactions will be looked at, disregarding the chain
296
+ *
297
+ * @returns {AuthChain} returns the resolved authchain
298
+ */
299
+ static async fetchAuthChainFromChaingraph(options) {
300
+ if (!options.chaingraphUrl) {
301
+ throw new Error("Provide `chaingraphUrl` param.");
302
+ }
303
+ const response = await fetch(options.chaingraphUrl, {
304
+ method: "POST",
305
+ headers: {
306
+ Accept: "*/*",
307
+ "Content-Type": "application/json",
308
+ },
309
+ body: JSON.stringify({
310
+ operationName: null,
311
+ variables: {},
312
+ query: `
313
+ {
314
+ transaction(
315
+ where: {
316
+ hash:{_eq:"\\\\x${options.transactionHash}"}
317
+ }
318
+ ) {
319
+ hash
320
+ authchains {
321
+ authchain_length
322
+ migrations(
323
+ where: {
324
+ transaction: {
325
+ outputs: { locking_bytecode_pattern: { _like: "6a04%" } }
326
+ }
327
+ }
328
+ ) {
329
+ transaction {
330
+ hash
331
+ inputs(where:{ outpoint_index: { _eq:"0" } }){
332
+ outpoint_index
333
+ }
334
+ outputs(where: { locking_bytecode_pattern: { _like: "6a04%" } }) {
335
+ output_index
336
+ locking_bytecode
337
+ }
338
+ }
339
+ }
340
+ }
341
+ }
342
+ }`,
343
+ }),
344
+ });
345
+ const responseData = await response.json();
346
+ const result = [];
347
+ const migrations = responseData.data.transaction[0]?.authchains[0].migrations;
348
+ if (!migrations) {
349
+ return result;
350
+ }
351
+ for (const migration of migrations) {
352
+ const transaction = migration.transaction[0];
353
+ if (!transaction) {
354
+ continue;
355
+ }
356
+ transaction.inputs.forEach((input) => (input.outpointIndex = Number(input.outpoint_index)));
357
+ transaction.outputs.forEach((output) => {
358
+ output.outputIndex = Number(output.output_index);
359
+ output.lockingBytecode = hexToBin(output.locking_bytecode.replace("\\x", ""));
360
+ });
361
+ const txHash = transaction.hash.replace("\\x", "");
362
+ result.push(BCMR.makeAuthChainElement(transaction, txHash));
363
+ }
364
+ return result.filter((element) => element.contentHash.length && element.httpsUrl.length);
365
+ }
366
+ /**
367
+ * addMetadataRegistryAuthChain Add BCMR metadata registry by resolving an authchain
368
+ *
369
+ * @param {string} options.transactionHash (required) transaction hash from which to build the auth chain
370
+ * @param {Network?} options.network (default=mainnet) network to query the data from
371
+ * @param {boolean?} options.followToHead (default=true) boolean flag to indicate that autchain building should progress to head (most recent registry version) or be stopped at this exact chain element
372
+ * @param {ElectrumRawTransaction?} options.rawTx cached raw transaction obtained previously, spares a Fulcrum call
373
+ *
374
+ * @returns {AuthChain} returns the resolved authchain
375
+ */
376
+ static async addMetadataRegistryAuthChain(options) {
377
+ const authChain = await this.buildAuthChain({
378
+ ...options,
379
+ resolveBase: false,
380
+ });
381
+ if (!authChain.length) {
382
+ throw new Error(`There were no BCMR entries in the resolved authchain ${JSON.stringify(authChain, null, 2)}`);
383
+ }
384
+ const registry = await this.fetchMetadataRegistry(authChain.reverse()[0].httpsUrl);
385
+ this.addMetadataRegistry(registry);
386
+ return authChain;
387
+ }
388
+ /**
389
+ * getTokenInfo Return the token info (or the identity snapshot as per spec)
390
+ *
391
+ * @param {string} tokenId token id to look up
392
+ *
393
+ * @returns {IdentitySnapshot?} return the info for the token found, otherwise undefined
394
+ */
395
+ static getTokenInfo(tokenId) {
396
+ for (const registry of this.metadataRegistries.slice().reverse()) {
397
+ const history = registry.identities?.[tokenId];
398
+ if (!history) {
399
+ continue;
400
+ }
401
+ const latestIdentityIndex = Object.keys(history)[0];
402
+ if (latestIdentityIndex === undefined) {
403
+ continue;
404
+ }
405
+ return history[latestIdentityIndex];
406
+ }
407
+ return undefined;
408
+ }
409
+ }
410
+ //# sourceMappingURL=Bcmr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Bcmr.js","sourceRoot":"","sources":["../../src/Bcmr.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,QAAQ,EAER,MAAM,EAEN,SAAS,GACV,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,YAAY,EACZ,MAAM,EACN,OAAO,EAGP,YAAY,GACb,MAAM,YAAY,CAAC;AAYpB,0FAA0F;AAC1F,MAAM,OAAO,IAAI;IACf,6BAA6B;aACf,uBAAkB,GAAe,EAAE,CAAC;IAE3C,MAAM,CAAC,aAAa;QACzB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,eAAe;QAC3B,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAED;;;;;;;;;OASG;IACI,MAAM,CAAC,KAAK,CAAC,qBAAqB,CACvC,GAAW,EACX,WAAoB;QAEpB,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAChC,GAAG,GAAG,WAAW,GAAG,EAAE,CAAC;QACzB,CAAC;QAED,oDAAoD;QACpD,IAAI,WAAW,EAAE,CAAC;YAChB,kCAAkC;YAClC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAA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