mainnet-js 1.1.7 → 1.1.8
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/dist/index.html +1 -1
- package/dist/{mainnet-1.1.7.js → mainnet-1.1.8.js} +1 -1
- package/dist/module/wallet/Bcmr.d.ts +1 -1
- package/dist/module/wallet/Bcmr.d.ts.map +1 -1
- package/dist/module/wallet/Bcmr.js +9 -22
- package/dist/module/wallet/Bcmr.js.map +1 -1
- package/dist/module/wallet/Wif.d.ts +1 -1
- package/dist/module/wallet/bcmr-v2.schema.d.ts +833 -0
- package/dist/module/wallet/bcmr-v2.schema.d.ts.map +1 -0
- package/dist/module/wallet/bcmr-v2.schema.js +2 -0
- package/dist/module/wallet/bcmr-v2.schema.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/wallet/Bcmr.test.headless.js +47 -15
- package/src/wallet/Bcmr.test.ts +28 -15
- package/src/wallet/Bcmr.ts +12 -25
- package/src/wallet/Wif.ts +1 -1
- package/src/wallet/bcmr-v2.schema.ts +893 -0
- package/dist/module/wallet/bcmr-v1.schema.d.ts +0 -623
- package/dist/module/wallet/bcmr-v1.schema.d.ts.map +0 -1
- package/dist/module/wallet/bcmr-v1.schema.js +0 -2
- package/dist/module/wallet/bcmr-v1.schema.js.map +0 -1
- package/src/wallet/bcmr-v1.schema.ts +0 -639
package/src/wallet/Bcmr.ts
CHANGED
|
@@ -10,10 +10,9 @@ import {
|
|
|
10
10
|
} from "@bitauth/libauth";
|
|
11
11
|
import axios from "axios";
|
|
12
12
|
import { Network, TxI } from "../interface.js";
|
|
13
|
-
import { getGlobalProvider } from "../network/default.js";
|
|
14
13
|
import ElectrumNetworkProvider from "../network/ElectrumNetworkProvider.js";
|
|
15
14
|
import { ElectrumRawTransaction } from "../network/interface.js";
|
|
16
|
-
import { IdentitySnapshot, Registry } from "./bcmr-
|
|
15
|
+
import { IdentitySnapshot, Registry } from "./bcmr-v2.schema.js";
|
|
17
16
|
import { initProvider } from "../network/Connection.js";
|
|
18
17
|
|
|
19
18
|
export interface AuthChainElement {
|
|
@@ -324,9 +323,9 @@ export class BCMR {
|
|
|
324
323
|
if (
|
|
325
324
|
registry.extensions &&
|
|
326
325
|
registry.extensions["authchain"] &&
|
|
327
|
-
(registry.extensions["authchain"]
|
|
326
|
+
(Object.keys(registry.extensions["authchain"])).length
|
|
328
327
|
) {
|
|
329
|
-
const chainTxArray = registry.extensions!["authchain"] as string[];
|
|
328
|
+
const chainTxArray = Object.values(registry.extensions!["authchain"]) as string[];
|
|
330
329
|
|
|
331
330
|
chainBase = chainTxArray
|
|
332
331
|
.map((tx) => {
|
|
@@ -435,28 +434,16 @@ export class BCMR {
|
|
|
435
434
|
*/
|
|
436
435
|
public static getTokenInfo(tokenId: string): IdentitySnapshot | undefined {
|
|
437
436
|
for (const registry of this.metadataRegistries.slice().reverse()) {
|
|
438
|
-
|
|
439
|
-
if (
|
|
440
|
-
|
|
441
|
-
if (registry.identities?.[registry.registryIdentity]) {
|
|
442
|
-
// find the latest identity in history and add it to the list
|
|
443
|
-
const latestIdentityInHistory = registry.identities![tokenId]?.[0];
|
|
444
|
-
if (latestIdentityInHistory) {
|
|
445
|
-
return latestIdentityInHistory;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
} else {
|
|
449
|
-
// if the token identity is the registry identity and categories match, return it
|
|
450
|
-
if (registry.registryIdentity.token?.category === tokenId) {
|
|
451
|
-
return registry.registryIdentity;
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// find the latest identity in history and add it to the list
|
|
455
|
-
const latestIdentityInHistory = registry.identities![tokenId]?.[0];
|
|
456
|
-
if (latestIdentityInHistory) {
|
|
457
|
-
return latestIdentityInHistory;
|
|
458
|
-
}
|
|
437
|
+
const history = registry.identities?.[tokenId];
|
|
438
|
+
if (!history) {
|
|
439
|
+
continue;
|
|
459
440
|
}
|
|
441
|
+
const latestIdentityIndex = Object.keys(history)[0];
|
|
442
|
+
if (latestIdentityIndex === undefined) {
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return history[latestIdentityIndex];
|
|
460
447
|
}
|
|
461
448
|
|
|
462
449
|
return undefined;
|
package/src/wallet/Wif.ts
CHANGED
|
@@ -107,7 +107,7 @@ import { DERIVATION_PATHS, DUST_UTXO_THRESHOLD } from "../constant.js";
|
|
|
107
107
|
|
|
108
108
|
import { TransactionHistoryI } from "../history/interface.js";
|
|
109
109
|
import { getAddressHistory } from "../history/electrumTransformer.js";
|
|
110
|
-
import { IdentitySnapshot, Registry } from "./bcmr-
|
|
110
|
+
import { IdentitySnapshot, Registry } from "./bcmr-v2.schema.js";
|
|
111
111
|
import { BCMR } from "./Bcmr.js";
|
|
112
112
|
import { qrAddress } from "../qr/Qr.js";
|
|
113
113
|
import { ImageI } from "../qr/interface.js";
|