@leofcoin/chain 1.9.2 → 1.9.4
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/exports/browser/chain.js +111 -89
- package/exports/browser/{constants-BTdMMS4w.js → constants-D_XqG46B.js} +316 -214
- package/exports/browser/node-browser.js +1 -18
- package/exports/browser/workers/block-worker.js +1 -1
- package/exports/browser/workers/machine-worker.js +1 -1
- package/exports/browser/workers/{worker-BrtyXRJ7-BrtyXRJ7.js → worker-Bsi6vKgF-Bsi6vKgF.js} +238 -198
- package/exports/chain.d.ts +0 -1
- package/exports/chain.js +110 -89
- package/exports/workers/block-worker.js +1 -1
- package/exports/workers/machine-worker.js +1 -1
- package/exports/workers/{worker-BrtyXRJ7-BrtyXRJ7.js → worker-Bsi6vKgF-Bsi6vKgF.js} +238 -198
- package/package.json +9 -9
|
@@ -7569,209 +7569,237 @@ class BasicInterface {
|
|
|
7569
7569
|
}
|
|
7570
7570
|
}
|
|
7571
7571
|
|
|
7572
|
-
const blockchainCodecs = [
|
|
7573
|
-
{
|
|
7574
|
-
name: 'leofcoin-block',
|
|
7575
|
-
codec: '0x6c62',
|
|
7576
|
-
hashAlg: 'dbl-keccak-512'
|
|
7577
|
-
},
|
|
7578
|
-
{
|
|
7579
|
-
name: 'leofcoin-tx',
|
|
7580
|
-
codec: '0x6c74',
|
|
7581
|
-
hashAlg: 'dbl-keccak-512'
|
|
7582
|
-
},
|
|
7583
|
-
{
|
|
7584
|
-
name: 'leofcoin-itx',
|
|
7585
|
-
codec: '0x6c69',
|
|
7586
|
-
hashAlg: 'keccak-512'
|
|
7587
|
-
},
|
|
7588
|
-
{
|
|
7589
|
-
name: 'leofcoin-pr',
|
|
7590
|
-
codec: '0x6c70',
|
|
7591
|
-
hashAlg: 'keccak-256'
|
|
7592
|
-
},
|
|
7593
|
-
{
|
|
7594
|
-
name: 'contract-message',
|
|
7595
|
-
codec: '0x63636d',
|
|
7596
|
-
hashAlg: 'keccak-256'
|
|
7597
|
-
},
|
|
7598
|
-
{
|
|
7599
|
-
name: 'transaction-message',
|
|
7600
|
-
codec: '0x746d',
|
|
7601
|
-
hashAlg: 'keccak-256'
|
|
7602
|
-
},
|
|
7603
|
-
{
|
|
7604
|
-
name: 'raw-transaction-message',
|
|
7605
|
-
codec: '0x772746d',
|
|
7606
|
-
hashAlg: 'keccak-256'
|
|
7607
|
-
},
|
|
7608
|
-
{
|
|
7609
|
-
name: 'block-message',
|
|
7610
|
-
codec: '0x626d',
|
|
7611
|
-
hashAlg: 'keccak-256'
|
|
7612
|
-
},
|
|
7613
|
-
{
|
|
7614
|
-
name: 'bw-message',
|
|
7615
|
-
codec: '0x62776d',
|
|
7616
|
-
hashAlg: 'keccak-256'
|
|
7617
|
-
},
|
|
7618
|
-
{
|
|
7619
|
-
name: 'bw-request-message',
|
|
7620
|
-
codec: '0x6277726d',
|
|
7621
|
-
hashAlg: 'keccak-256'
|
|
7622
|
-
},
|
|
7623
|
-
{
|
|
7624
|
-
name: 'validator-message',
|
|
7625
|
-
codec: '0x766d',
|
|
7626
|
-
hashAlg: 'keccak-256'
|
|
7627
|
-
}
|
|
7572
|
+
const blockchainCodecs = [
|
|
7573
|
+
{
|
|
7574
|
+
name: 'leofcoin-block',
|
|
7575
|
+
codec: '0x6c62',
|
|
7576
|
+
hashAlg: 'dbl-keccak-512'
|
|
7577
|
+
},
|
|
7578
|
+
{
|
|
7579
|
+
name: 'leofcoin-tx',
|
|
7580
|
+
codec: '0x6c74',
|
|
7581
|
+
hashAlg: 'dbl-keccak-512'
|
|
7582
|
+
},
|
|
7583
|
+
{
|
|
7584
|
+
name: 'leofcoin-itx',
|
|
7585
|
+
codec: '0x6c69',
|
|
7586
|
+
hashAlg: 'keccak-512'
|
|
7587
|
+
},
|
|
7588
|
+
{
|
|
7589
|
+
name: 'leofcoin-pr',
|
|
7590
|
+
codec: '0x6c70',
|
|
7591
|
+
hashAlg: 'keccak-256'
|
|
7592
|
+
},
|
|
7593
|
+
{
|
|
7594
|
+
name: 'contract-message',
|
|
7595
|
+
codec: '0x63636d',
|
|
7596
|
+
hashAlg: 'keccak-256'
|
|
7597
|
+
},
|
|
7598
|
+
{
|
|
7599
|
+
name: 'transaction-message',
|
|
7600
|
+
codec: '0x746d',
|
|
7601
|
+
hashAlg: 'keccak-256'
|
|
7602
|
+
},
|
|
7603
|
+
{
|
|
7604
|
+
name: 'raw-transaction-message',
|
|
7605
|
+
codec: '0x772746d',
|
|
7606
|
+
hashAlg: 'keccak-256'
|
|
7607
|
+
},
|
|
7608
|
+
{
|
|
7609
|
+
name: 'block-message',
|
|
7610
|
+
codec: '0x626d',
|
|
7611
|
+
hashAlg: 'keccak-256'
|
|
7612
|
+
},
|
|
7613
|
+
{
|
|
7614
|
+
name: 'bw-message',
|
|
7615
|
+
codec: '0x62776d',
|
|
7616
|
+
hashAlg: 'keccak-256'
|
|
7617
|
+
},
|
|
7618
|
+
{
|
|
7619
|
+
name: 'bw-request-message',
|
|
7620
|
+
codec: '0x6277726d',
|
|
7621
|
+
hashAlg: 'keccak-256'
|
|
7622
|
+
},
|
|
7623
|
+
{
|
|
7624
|
+
name: 'validator-message',
|
|
7625
|
+
codec: '0x766d',
|
|
7626
|
+
hashAlg: 'keccak-256'
|
|
7627
|
+
},
|
|
7628
|
+
{
|
|
7629
|
+
name: 'last-block-message',
|
|
7630
|
+
codec: '0x6c626d',
|
|
7631
|
+
hashAlg: 'keccak-256'
|
|
7632
|
+
},
|
|
7633
|
+
{
|
|
7634
|
+
name: 'last-block-request-message',
|
|
7635
|
+
codec: '0x6c62726d',
|
|
7636
|
+
hashAlg: 'keccak-256'
|
|
7637
|
+
},
|
|
7638
|
+
{
|
|
7639
|
+
name: 'state-message',
|
|
7640
|
+
codec: '0x73746d',
|
|
7641
|
+
hashAlg: 'keccak-256'
|
|
7642
|
+
},
|
|
7643
|
+
{
|
|
7644
|
+
name: 'publish-message',
|
|
7645
|
+
codec: '0x70626d',
|
|
7646
|
+
hashAlg: 'keccak-256'
|
|
7647
|
+
}
|
|
7628
7648
|
];
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7649
|
+
const consensusCodecs = [
|
|
7650
|
+
{
|
|
7651
|
+
name: 'proposal-message',
|
|
7652
|
+
codec: '0x70726d',
|
|
7653
|
+
hashAlg: 'keccak-256'
|
|
7654
|
+
},
|
|
7655
|
+
{
|
|
7656
|
+
name: 'prevote-message',
|
|
7657
|
+
codec: '0x70766d',
|
|
7658
|
+
hashAlg: 'keccak-256'
|
|
7659
|
+
},
|
|
7660
|
+
{
|
|
7661
|
+
name: 'precommit-message',
|
|
7662
|
+
codec: '0x7063636d',
|
|
7663
|
+
hashAlg: 'keccak-256'
|
|
7664
|
+
}
|
|
7641
7665
|
];
|
|
7642
|
-
|
|
7643
|
-
|
|
7644
|
-
name: '
|
|
7645
|
-
codec: '
|
|
7646
|
-
hashAlg: '
|
|
7647
|
-
}
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
hashAlg: 'dbl-keccak-256',
|
|
7654
|
-
},
|
|
7655
|
-
{
|
|
7656
|
-
name: 'peernet-peer-response',
|
|
7657
|
-
codec: '0x707072',
|
|
7658
|
-
hashAlg: 'keccak-256',
|
|
7659
|
-
},
|
|
7660
|
-
{
|
|
7661
|
-
name: 'peernet-peer',
|
|
7662
|
-
codec: '0x7070',
|
|
7663
|
-
hashAlg: 'keccak-256',
|
|
7664
|
-
},
|
|
7665
|
-
{
|
|
7666
|
-
name: 'peernet-dht',
|
|
7667
|
-
codec: '0x706468',
|
|
7668
|
-
hashAlg: 'keccak-256',
|
|
7669
|
-
},
|
|
7670
|
-
{
|
|
7671
|
-
name: 'peernet-dht-response',
|
|
7672
|
-
codec: '0x706472',
|
|
7673
|
-
hashAlg: 'keccak-256',
|
|
7674
|
-
},
|
|
7675
|
-
{
|
|
7676
|
-
name: 'peernet-data',
|
|
7677
|
-
codec: '0x706461',
|
|
7678
|
-
hashAlg: 'keccak-256',
|
|
7679
|
-
},
|
|
7680
|
-
{
|
|
7681
|
-
name: 'peernet-data-response',
|
|
7682
|
-
codec: '0x70646172',
|
|
7683
|
-
hashAlg: 'keccak-256',
|
|
7684
|
-
},
|
|
7685
|
-
{
|
|
7686
|
-
name: 'peernet-message',
|
|
7687
|
-
codec: '0x706d65',
|
|
7688
|
-
hashAlg: 'keccak-256',
|
|
7689
|
-
},
|
|
7690
|
-
{
|
|
7691
|
-
name: 'peernet-ps',
|
|
7692
|
-
codec: '707073',
|
|
7693
|
-
hashAlg: 'keccak-256',
|
|
7694
|
-
},
|
|
7695
|
-
{
|
|
7696
|
-
name: 'peernet-response',
|
|
7697
|
-
codec: '0x7072',
|
|
7698
|
-
hashAlg: 'keccak-256',
|
|
7699
|
-
},
|
|
7700
|
-
{
|
|
7701
|
-
name: 'peernet-request',
|
|
7702
|
-
codec: '0x707271',
|
|
7703
|
-
hashAlg: 'keccak-256',
|
|
7704
|
-
},
|
|
7705
|
-
{
|
|
7706
|
-
name: 'peernet-file',
|
|
7707
|
-
codec: '0x7066',
|
|
7708
|
-
hashAlg: 'keccak-256',
|
|
7709
|
-
},
|
|
7710
|
-
{
|
|
7711
|
-
name: 'peernet-file-response',
|
|
7712
|
-
codec: '0x706672',
|
|
7713
|
-
hashAlg: 'keccak-256',
|
|
7714
|
-
}
|
|
7666
|
+
const internalCodecs = [
|
|
7667
|
+
{
|
|
7668
|
+
name: 'pubsub-request',
|
|
7669
|
+
codec: '0x70737271',
|
|
7670
|
+
hashAlg: 'keccak-256'
|
|
7671
|
+
},
|
|
7672
|
+
{
|
|
7673
|
+
name: 'pubsub-response',
|
|
7674
|
+
codec: '0x707372',
|
|
7675
|
+
hashAlg: 'keccak-256'
|
|
7676
|
+
}
|
|
7715
7677
|
];
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7678
|
+
const socialCodecs = [
|
|
7679
|
+
{
|
|
7680
|
+
name: 'chat-message',
|
|
7681
|
+
codec: '0x70636d',
|
|
7682
|
+
hashAlg: 'dbl-keccak-256'
|
|
7683
|
+
}
|
|
7684
|
+
];
|
|
7685
|
+
const peernetCodecs = [
|
|
7686
|
+
{
|
|
7687
|
+
name: 'disco-hash',
|
|
7688
|
+
codec: '0x30',
|
|
7689
|
+
hashAlg: 'dbl-keccak-256'
|
|
7690
|
+
},
|
|
7691
|
+
{
|
|
7692
|
+
name: 'peernet-peer-response',
|
|
7693
|
+
codec: '0x707072',
|
|
7694
|
+
hashAlg: 'keccak-256'
|
|
7695
|
+
},
|
|
7696
|
+
{
|
|
7697
|
+
name: 'peernet-peer',
|
|
7698
|
+
codec: '0x7070',
|
|
7699
|
+
hashAlg: 'keccak-256'
|
|
7700
|
+
},
|
|
7701
|
+
{
|
|
7702
|
+
name: 'peernet-dht',
|
|
7703
|
+
codec: '0x706468',
|
|
7704
|
+
hashAlg: 'keccak-256'
|
|
7705
|
+
},
|
|
7706
|
+
{
|
|
7707
|
+
name: 'peernet-dht-response',
|
|
7708
|
+
codec: '0x706472',
|
|
7709
|
+
hashAlg: 'keccak-256'
|
|
7710
|
+
},
|
|
7711
|
+
{
|
|
7712
|
+
name: 'peernet-data',
|
|
7713
|
+
codec: '0x706461',
|
|
7714
|
+
hashAlg: 'keccak-256'
|
|
7715
|
+
},
|
|
7716
|
+
{
|
|
7717
|
+
name: 'peernet-data-response',
|
|
7718
|
+
codec: '0x70646172',
|
|
7719
|
+
hashAlg: 'keccak-256'
|
|
7720
|
+
},
|
|
7721
|
+
{
|
|
7722
|
+
name: 'peernet-message',
|
|
7723
|
+
codec: '0x706d65',
|
|
7724
|
+
hashAlg: 'keccak-256'
|
|
7725
|
+
},
|
|
7726
|
+
{
|
|
7727
|
+
name: 'peernet-ps',
|
|
7728
|
+
codec: '707073',
|
|
7729
|
+
hashAlg: 'keccak-256'
|
|
7730
|
+
},
|
|
7731
|
+
{
|
|
7732
|
+
name: 'peernet-response',
|
|
7733
|
+
codec: '0x7072',
|
|
7734
|
+
hashAlg: 'keccak-256'
|
|
7735
|
+
},
|
|
7736
|
+
{
|
|
7737
|
+
name: 'peernet-request',
|
|
7738
|
+
codec: '0x707271',
|
|
7739
|
+
hashAlg: 'keccak-256'
|
|
7740
|
+
},
|
|
7741
|
+
{
|
|
7742
|
+
name: 'peernet-file',
|
|
7743
|
+
codec: '0x7066',
|
|
7744
|
+
hashAlg: 'keccak-256'
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
name: 'peernet-file-response',
|
|
7748
|
+
codec: '0x706672',
|
|
7749
|
+
hashAlg: 'keccak-256'
|
|
7750
|
+
}
|
|
7751
|
+
];
|
|
7752
|
+
const codecs = [
|
|
7753
|
+
...internalCodecs,
|
|
7754
|
+
...blockchainCodecs,
|
|
7755
|
+
...consensusCodecs,
|
|
7756
|
+
...socialCodecs,
|
|
7757
|
+
...peernetCodecs
|
|
7722
7758
|
];
|
|
7723
7759
|
|
|
7724
|
-
const
|
|
7725
|
-
const addCodec = (codecInput) => {
|
|
7726
|
-
|
|
7727
|
-
if (!
|
|
7728
|
-
|
|
7729
|
-
hashAlg,
|
|
7730
|
-
codec: typeof codec === 'string' ? parseInt(codec, 16) : codec
|
|
7731
|
-
};
|
|
7732
|
-
};
|
|
7733
|
-
for (const codec of codecs
|
|
7734
|
-
addCodec(codec);
|
|
7735
|
-
}
|
|
7736
|
-
const
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
};
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
var utils = {
|
|
7768
|
-
isCodec,
|
|
7769
|
-
addCodec,
|
|
7770
|
-
getCodec,
|
|
7771
|
-
getHashAlg,
|
|
7772
|
-
getCodecName,
|
|
7773
|
-
validateCodec,
|
|
7774
|
-
codecs: codecs
|
|
7760
|
+
const registry = {};
|
|
7761
|
+
const addCodec = (codecInput) => {
|
|
7762
|
+
const { hashAlg, codec, name } = codecInput;
|
|
7763
|
+
if (!registry[name])
|
|
7764
|
+
registry[name] = {
|
|
7765
|
+
hashAlg,
|
|
7766
|
+
codec: typeof codec === 'string' ? parseInt(codec, 16) : codec
|
|
7767
|
+
};
|
|
7768
|
+
};
|
|
7769
|
+
for (const codec of codecs) {
|
|
7770
|
+
addCodec(codec);
|
|
7771
|
+
}
|
|
7772
|
+
const getCodecByName = (name) => registry[name];
|
|
7773
|
+
const getCodecName = (codec) => {
|
|
7774
|
+
return Object.keys(registry).reduce((p, c) => {
|
|
7775
|
+
return registry[c].codec === codec ? c : p;
|
|
7776
|
+
}, undefined);
|
|
7777
|
+
};
|
|
7778
|
+
const getCodec = (name) => {
|
|
7779
|
+
if (typeof name === 'number')
|
|
7780
|
+
return name;
|
|
7781
|
+
return getCodecByName(name).codec;
|
|
7782
|
+
};
|
|
7783
|
+
const getHashAlg = (name) => {
|
|
7784
|
+
if (typeof name === 'number')
|
|
7785
|
+
return getCodecByName(getCodecName(name)).hashAlg;
|
|
7786
|
+
return getCodecByName(name).hashAlg;
|
|
7787
|
+
};
|
|
7788
|
+
const isCodec = (codec) => {
|
|
7789
|
+
return codec.codec !== undefined && !!codec.hashAlg;
|
|
7790
|
+
};
|
|
7791
|
+
const validateCodec = (codec) => {
|
|
7792
|
+
if (codec.codec === undefined || codec.hashAlg === undefined || codec.name === undefined)
|
|
7793
|
+
throw new Error(`invalid codecInput: ${codec}`);
|
|
7794
|
+
};
|
|
7795
|
+
const utils = {
|
|
7796
|
+
isCodec,
|
|
7797
|
+
addCodec,
|
|
7798
|
+
getCodec,
|
|
7799
|
+
getHashAlg,
|
|
7800
|
+
getCodecName,
|
|
7801
|
+
validateCodec,
|
|
7802
|
+
codecs: registry
|
|
7775
7803
|
};
|
|
7776
7804
|
|
|
7777
7805
|
class Codec extends BasicInterface {
|
|
@@ -8856,6 +8884,18 @@ class TransactionMessage extends FormatInterface {
|
|
|
8856
8884
|
({
|
|
8857
8885
|
params: Array()});
|
|
8858
8886
|
|
|
8887
|
+
({
|
|
8888
|
+
index: BigInt(0),
|
|
8889
|
+
round: BigInt(0)});
|
|
8890
|
+
|
|
8891
|
+
({
|
|
8892
|
+
index: BigInt(0),
|
|
8893
|
+
round: BigInt(0)});
|
|
8894
|
+
|
|
8895
|
+
({
|
|
8896
|
+
index: BigInt(0),
|
|
8897
|
+
round: BigInt(0)});
|
|
8898
|
+
|
|
8859
8899
|
class EasyWorker {
|
|
8860
8900
|
#messageEvent = 'message';
|
|
8861
8901
|
#errorEvent = 'error';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leofcoin/chain",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.4",
|
|
4
4
|
"description": "Official javascript implementation",
|
|
5
5
|
"private": false,
|
|
6
6
|
"exports": {
|
|
@@ -61,18 +61,18 @@
|
|
|
61
61
|
"tslib": "^2.8.1"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@leofcoin/addresses": "^1.0.
|
|
65
|
-
"@leofcoin/contracts": "^0.1.
|
|
64
|
+
"@leofcoin/addresses": "^1.0.56",
|
|
65
|
+
"@leofcoin/contracts": "^0.1.17",
|
|
66
66
|
"@leofcoin/crypto": "^0.2.37",
|
|
67
|
-
"@leofcoin/errors": "^1.0.
|
|
68
|
-
"@leofcoin/lib": "^1.2.
|
|
69
|
-
"@leofcoin/messages": "^1.
|
|
67
|
+
"@leofcoin/errors": "^1.0.26",
|
|
68
|
+
"@leofcoin/lib": "^1.2.75",
|
|
69
|
+
"@leofcoin/messages": "^1.5.0",
|
|
70
70
|
"@leofcoin/multi-wallet": "^3.1.8",
|
|
71
|
-
"@leofcoin/networks": "^1.1.
|
|
71
|
+
"@leofcoin/networks": "^1.1.26",
|
|
72
72
|
"@leofcoin/peernet": "^1.2.17",
|
|
73
73
|
"@leofcoin/storage": "^3.5.38",
|
|
74
|
-
"@leofcoin/utils": "^1.1.
|
|
75
|
-
"@leofcoin/workers": "^1.5.
|
|
74
|
+
"@leofcoin/utils": "^1.1.41",
|
|
75
|
+
"@leofcoin/workers": "^1.5.28",
|
|
76
76
|
"@vandeurenglenn/base58": "^1.1.9",
|
|
77
77
|
"@vandeurenglenn/easy-worker": "^1.0.3",
|
|
78
78
|
"semver": "^7.7.4"
|