@btc-vision/transaction 1.0.0
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/.babelrc +7 -0
- package/.gitattributes +2 -0
- package/.github/workflows/node.js.yml +22 -0
- package/.idea/codeStyles/Project.xml +56 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/.idea/jsLibraryMappings.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/transaction.iml +16 -0
- package/.idea/vcs.xml +6 -0
- package/.prettierrc.json +12 -0
- package/CONTRIBUTING.md +71 -0
- package/LICENSE.md +16 -0
- package/README.md +213 -0
- package/browser/873e754d6c7c6e9361f1.module.wasm +0 -0
- package/browser/_version.d.ts +1 -0
- package/browser/bytecode/Compressor.d.ts +6 -0
- package/browser/crypto/crypto-browser.d.ts +40 -0
- package/browser/crypto/crypto.d.ts +2 -0
- package/browser/generators/Generator.d.ts +12 -0
- package/browser/generators/builders/CalldataGenerator.d.ts +8 -0
- package/browser/generators/builders/DeploymentGenerator.d.ts +7 -0
- package/browser/index.d.ts +3 -0
- package/browser/index.js +2 -0
- package/browser/index.js.LICENSE.txt +23 -0
- package/browser/keypair/EcKeyPair.d.ts +24 -0
- package/browser/keypair/Wallet.d.ts +16 -0
- package/browser/keypair/interfaces/IWallet.d.ts +5 -0
- package/browser/metadata/ContractBaseMetadata.d.ts +9 -0
- package/browser/metadata/ContractMetadataManager.d.ts +1 -0
- package/browser/metadata/contracts/wBTC.d.ts +12 -0
- package/browser/network/NetworkInformation.d.ts +6 -0
- package/browser/opnet.d.ts +22 -0
- package/browser/scripts/Regtest.d.ts +2 -0
- package/browser/scripts/test.d.ts +1 -0
- package/browser/signer/TweakedSigner.d.ts +9 -0
- package/browser/transaction/TransactionBuilder.d.ts +1 -0
- package/browser/transaction/TransactionFactory.d.ts +4 -0
- package/browser/transaction/builders/FundingTransaction.d.ts +11 -0
- package/browser/transaction/builders/InteractionTransaction.d.ts +47 -0
- package/browser/transaction/builders/TransactionBuilder.d.ts +64 -0
- package/browser/transaction/enums/TransactionType.d.ts +7 -0
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +33 -0
- package/browser/transaction/interfaces/Tap.d.ts +22 -0
- package/browser/utils/BitcoinUtils.d.ts +5 -0
- package/browser/utxo/UTXOManager.d.ts +7 -0
- package/browser/utxo/interfaces/IUTXO.d.ts +19 -0
- package/build/Utils.d.ts +0 -0
- package/build/Utils.js +1 -0
- package/build/_version.d.ts +1 -0
- package/build/_version.js +1 -0
- package/build/bytecode/Compressor.d.ts +6 -0
- package/build/bytecode/Compressor.js +13 -0
- package/build/contracts/ContractMetadataManager.d.ts +0 -0
- package/build/contracts/ContractMetadataManager.js +1 -0
- package/build/crypto/crypto.d.ts +2 -0
- package/build/crypto/crypto.js +1 -0
- package/build/generators/Generator.d.ts +12 -0
- package/build/generators/Generator.js +25 -0
- package/build/generators/builders/CalldataGenerator.d.ts +8 -0
- package/build/generators/builders/CalldataGenerator.js +79 -0
- package/build/generators/builders/DeploymentGenerator.d.ts +7 -0
- package/build/generators/builders/DeploymentGenerator.js +38 -0
- package/build/index.d.ts +3 -0
- package/build/index.js +3 -0
- package/build/keypair/EcKeyPair.d.ts +24 -0
- package/build/keypair/EcKeyPair.js +107 -0
- package/build/keypair/Wallet.d.ts +16 -0
- package/build/keypair/Wallet.js +30 -0
- package/build/keypair/interfaces/GeneratedWallet.d.ts +5 -0
- package/build/keypair/interfaces/GeneratedWallet.js +1 -0
- package/build/keypair/interfaces/IWallet.d.ts +5 -0
- package/build/keypair/interfaces/IWallet.js +1 -0
- package/build/metadata/ContractBaseMetadata.d.ts +9 -0
- package/build/metadata/ContractBaseMetadata.js +13 -0
- package/build/metadata/ContractMetadataManager.d.ts +1 -0
- package/build/metadata/ContractMetadataManager.js +9 -0
- package/build/metadata/contracts/ContractBase.d.ts +9 -0
- package/build/metadata/contracts/ContractBase.js +13 -0
- package/build/metadata/contracts/ContractBaseMetadata.d.ts +9 -0
- package/build/metadata/contracts/ContractBaseMetadata.js +13 -0
- package/build/metadata/contracts/ContractMetadataManager.d.ts +0 -0
- package/build/metadata/contracts/ContractMetadataManager.js +1 -0
- package/build/metadata/contracts/wBTC.d.ts +12 -0
- package/build/metadata/contracts/wBTC.js +26 -0
- package/build/network/NetworkConverter.d.ts +0 -0
- package/build/network/NetworkConverter.js +14 -0
- package/build/network/NetworkInformation.d.ts +6 -0
- package/build/network/NetworkInformation.js +1 -0
- package/build/opnet.d.ts +22 -0
- package/build/opnet.js +22 -0
- package/build/scripts/Regtest.d.ts +2 -0
- package/build/scripts/Regtest.js +15 -0
- package/build/scripts/test.d.ts +1 -0
- package/build/scripts/test.js +74 -0
- package/build/signer/Regtest.d.ts +2 -0
- package/build/signer/Regtest.js +15 -0
- package/build/signer/TweakedSigner.d.ts +9 -0
- package/build/signer/TweakedSigner.js +22 -0
- package/build/transaction/TransactionBuilder.d.ts +60 -0
- package/build/transaction/TransactionBuilder.js +244 -0
- package/build/transaction/TransactionFactory.d.ts +4 -0
- package/build/transaction/TransactionFactory.js +32 -0
- package/build/transaction/builders/FundingTransaction.d.ts +11 -0
- package/build/transaction/builders/FundingTransaction.js +23 -0
- package/build/transaction/builders/GenericTransaction.d.ts +11 -0
- package/build/transaction/builders/GenericTransaction.js +23 -0
- package/build/transaction/builders/InteractionTransaction.d.ts +47 -0
- package/build/transaction/builders/InteractionTransaction.js +219 -0
- package/build/transaction/builders/TransactionBuilder.d.ts +64 -0
- package/build/transaction/builders/TransactionBuilder.js +288 -0
- package/build/transaction/enums/TransactionType.d.ts +7 -0
- package/build/transaction/enums/TransactionType.js +8 -0
- package/build/transaction/interfaces/ITransactionParameters.d.ts +33 -0
- package/build/transaction/interfaces/ITransactionParameters.js +1 -0
- package/build/transaction/interfaces/ITransactions.d.ts +32 -0
- package/build/transaction/interfaces/ITransactions.js +1 -0
- package/build/transaction/interfaces/Tap.d.ts +22 -0
- package/build/transaction/interfaces/Tap.js +1 -0
- package/build/utils/BitcoinUtils.d.ts +5 -0
- package/build/utils/BitcoinUtils.js +9 -0
- package/build/utxo/IUTXO.d.ts +0 -0
- package/build/utxo/IUTXO.js +1 -0
- package/build/utxo/UTXOManager.d.ts +7 -0
- package/build/utxo/UTXOManager.js +47 -0
- package/build/utxo/interfaces/IUTXO.d.ts +19 -0
- package/build/utxo/interfaces/IUTXO.js +1 -0
- package/cjs/_version.d.ts +1 -0
- package/cjs/_version.js +4 -0
- package/cjs/bytecode/Compressor.d.ts +6 -0
- package/cjs/bytecode/Compressor.js +20 -0
- package/cjs/crypto/crypto.d.ts +2 -0
- package/cjs/crypto/crypto.js +8 -0
- package/cjs/generators/Generator.d.ts +13 -0
- package/cjs/generators/Generator.js +31 -0
- package/cjs/generators/builders/CalldataGenerator.d.ts +8 -0
- package/cjs/generators/builders/CalldataGenerator.js +83 -0
- package/cjs/generators/builders/DeploymentGenerator.d.ts +7 -0
- package/cjs/generators/builders/DeploymentGenerator.js +42 -0
- package/cjs/index.d.ts +3 -0
- package/cjs/index.js +32 -0
- package/cjs/keypair/EcKeyPair.d.ts +24 -0
- package/cjs/keypair/EcKeyPair.js +137 -0
- package/cjs/keypair/Wallet.d.ts +16 -0
- package/cjs/keypair/Wallet.js +34 -0
- package/cjs/keypair/interfaces/IWallet.d.ts +5 -0
- package/cjs/keypair/interfaces/IWallet.js +2 -0
- package/cjs/metadata/ContractBaseMetadata.d.ts +9 -0
- package/cjs/metadata/ContractBaseMetadata.js +17 -0
- package/cjs/metadata/ContractMetadataManager.d.ts +0 -0
- package/cjs/metadata/ContractMetadataManager.js +1 -0
- package/cjs/metadata/contracts/wBTC.d.ts +12 -0
- package/cjs/metadata/contracts/wBTC.js +30 -0
- package/cjs/network/NetworkInformation.d.ts +6 -0
- package/cjs/network/NetworkInformation.js +2 -0
- package/cjs/opnet.d.ts +1 -0
- package/cjs/opnet.js +5 -0
- package/cjs/scripts/Regtest.d.ts +2 -0
- package/cjs/scripts/Regtest.js +18 -0
- package/cjs/scripts/test.d.ts +1 -0
- package/cjs/scripts/test.js +44 -0
- package/cjs/signer/TweakedSigner.d.ts +9 -0
- package/cjs/signer/TweakedSigner.js +49 -0
- package/cjs/transaction/TransactionBuilder.d.ts +0 -0
- package/cjs/transaction/TransactionBuilder.js +1 -0
- package/cjs/transaction/TransactionFactory.d.ts +4 -0
- package/cjs/transaction/TransactionFactory.js +33 -0
- package/cjs/transaction/builders/FundingTransaction.d.ts +11 -0
- package/cjs/transaction/builders/FundingTransaction.js +27 -0
- package/cjs/transaction/builders/InteractionTransaction.d.ts +45 -0
- package/cjs/transaction/builders/InteractionTransaction.js +214 -0
- package/cjs/transaction/builders/TransactionBuilder.d.ts +64 -0
- package/cjs/transaction/builders/TransactionBuilder.js +304 -0
- package/cjs/transaction/enums/TransactionType.d.ts +7 -0
- package/cjs/transaction/enums/TransactionType.js +11 -0
- package/cjs/transaction/interfaces/ITransactionParameters.d.ts +32 -0
- package/cjs/transaction/interfaces/ITransactionParameters.js +2 -0
- package/cjs/transaction/interfaces/Tap.d.ts +22 -0
- package/cjs/transaction/interfaces/Tap.js +2 -0
- package/cjs/utils/BitcoinUtils.d.ts +5 -0
- package/cjs/utils/BitcoinUtils.js +13 -0
- package/cjs/utxo/UTXOManager.d.ts +7 -0
- package/cjs/utxo/UTXOManager.js +51 -0
- package/cjs/utxo/interfaces/IUTXO.d.ts +19 -0
- package/cjs/utxo/interfaces/IUTXO.js +2 -0
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +92 -0
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/material-style.css +247 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1412 -0
- package/docs/classes/BitcoinUtils.html +183 -0
- package/docs/classes/CalldataGenerator.html +211 -0
- package/docs/classes/Compressor.html +185 -0
- package/docs/classes/ContractBaseMetadata.html +182 -0
- package/docs/classes/DeploymentGenerator.html +200 -0
- package/docs/classes/EcKeyPair.html +280 -0
- package/docs/classes/FundingTransaction.html +293 -0
- package/docs/classes/Generator.html +199 -0
- package/docs/classes/InteractionTransaction.html +365 -0
- package/docs/classes/TransactionBuilder.html +303 -0
- package/docs/classes/TransactionFactory.html +180 -0
- package/docs/classes/TweakedSigner.html +181 -0
- package/docs/classes/UTXOManager.html +187 -0
- package/docs/classes/Wallet.html +191 -0
- package/docs/classes/wBTC.html +189 -0
- package/docs/enums/TransactionType.html +179 -0
- package/docs/hierarchy.html +174 -0
- package/docs/index.html +237 -0
- package/docs/interfaces/FetchUTXOParams.html +178 -0
- package/docs/interfaces/IFundingTransactionParameters.html +182 -0
- package/docs/interfaces/IInteractionParameters.html +185 -0
- package/docs/interfaces/ITransactionDataContractDeployment.html +184 -0
- package/docs/interfaces/ITransactionDataContractInteractionWrap.html +186 -0
- package/docs/interfaces/ITransactionParameters.html +181 -0
- package/docs/interfaces/IWallet.html +181 -0
- package/docs/interfaces/NetworkInformation.html +176 -0
- package/docs/interfaces/PsbtInputExtended.html +194 -0
- package/docs/interfaces/PsbtOutputExtendedAddress.html +183 -0
- package/docs/interfaces/PsbtOutputExtendedScript.html +183 -0
- package/docs/interfaces/RawUTXOResponse.html +178 -0
- package/docs/interfaces/TapLeafScript.html +177 -0
- package/docs/interfaces/TweakSettings.html +179 -0
- package/docs/interfaces/UTXO.html +178 -0
- package/docs/interfaces/UpdateInput.html +175 -0
- package/docs/modules.html +208 -0
- package/docs/types/PsbtOutputExtended.html +174 -0
- package/docs/variables/version.html +174 -0
- package/gulpfile.js +152 -0
- package/jest.config.ts +52 -0
- package/package.json +116 -0
- package/src/_version.ts +1 -0
- package/src/bytecode/Compressor.ts +27 -0
- package/src/crypto/crypto-browser.js +71 -0
- package/src/crypto/crypto.ts +1 -0
- package/src/generators/Generator.ts +75 -0
- package/src/generators/builders/CalldataGenerator.ts +143 -0
- package/src/generators/builders/DeploymentGenerator.ts +63 -0
- package/src/index.ts +4 -0
- package/src/keypair/EcKeyPair.ts +265 -0
- package/src/keypair/Wallet.ts +75 -0
- package/src/keypair/interfaces/IWallet.ts +19 -0
- package/src/metadata/ContractBaseMetadata.ts +23 -0
- package/src/metadata/contracts/wBTC.ts +44 -0
- package/src/network/NetworkInformation.ts +7 -0
- package/src/opnet.ts +42 -0
- package/src/scripts/Regtest.ts +19 -0
- package/src/scripts/test.ts +98 -0
- package/src/signer/TweakedSigner.ts +57 -0
- package/src/transaction/TransactionFactory.ts +57 -0
- package/src/transaction/builders/FundingTransaction.ts +36 -0
- package/src/transaction/builders/InteractionTransaction.ts +439 -0
- package/src/transaction/builders/TransactionBuilder.ts +603 -0
- package/src/transaction/enums/TransactionType.ts +7 -0
- package/src/transaction/interfaces/ITransactionParameters.ts +41 -0
- package/src/transaction/interfaces/Tap.ts +26 -0
- package/src/utils/BitcoinUtils.ts +24 -0
- package/src/utxo/UTXOManager.ts +67 -0
- package/src/utxo/interfaces/IUTXO.ts +22 -0
- package/tests/TransactionBuilder.test.ts +58 -0
- package/tests/contracts/wbtc.wasm +0 -0
- package/tsconfig.base.json +43 -0
- package/tsconfig.cjs.json +9 -0
- package/tsconfig.json +8 -0
- package/tsconfig.webpack.json +11 -0
- package/webpack.config.js +77 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>version | OPNet</title><meta name="description" content="Documentation for OPNet"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><style>
|
|
2
|
+
@media (prefers-color-scheme: dark) {
|
|
3
|
+
:root {
|
|
4
|
+
--md-sys-color-primary: #f6be46;
|
|
5
|
+
--md-sys-color-on-primary: #412d00;
|
|
6
|
+
--md-sys-color-primary-container: #5d4200;
|
|
7
|
+
--md-sys-color-on-primary-container: #ffdea3;
|
|
8
|
+
--md-sys-color-secondary: #d9c4a0;
|
|
9
|
+
--md-sys-color-on-secondary: #3b2f15;
|
|
10
|
+
--md-sys-color-secondary-container: #53452a;
|
|
11
|
+
--md-sys-color-on-secondary-container: #f6e0bb;
|
|
12
|
+
--md-sys-color-tertiary: #b2cfa8;
|
|
13
|
+
--md-sys-color-on-tertiary: #1e361a;
|
|
14
|
+
--md-sys-color-tertiary-container: #344d2f;
|
|
15
|
+
--md-sys-color-on-tertiary-container: #cdebc2;
|
|
16
|
+
--md-sys-color-error: #ffb4ab;
|
|
17
|
+
--md-sys-color-on-error: #690005;
|
|
18
|
+
--md-sys-color-error-container: #93000a;
|
|
19
|
+
--md-sys-color-on-error-container: #ffb4ab;
|
|
20
|
+
--md-sys-color-background: #1e1b16;
|
|
21
|
+
--md-sys-color-on-background: #e9e1d9;
|
|
22
|
+
--md-sys-color-surface: #1e1b16;
|
|
23
|
+
--md-sys-color-on-surface: #e9e1d9;
|
|
24
|
+
--md-sys-color-surface-variant: #4e4639;
|
|
25
|
+
--md-sys-color-on-surface-variant: #d1c5b4;
|
|
26
|
+
--md-sys-color-outline: #9a8f80;
|
|
27
|
+
--md-sys-color-outline-variant: #4e4639;
|
|
28
|
+
--md-sys-color-shadow: #000000;
|
|
29
|
+
--md-sys-color-scrim: #000000;
|
|
30
|
+
--md-sys-color-inverse-surface: #e9e1d9;
|
|
31
|
+
--md-sys-color-inverse-on-surface: #34302a;
|
|
32
|
+
--md-sys-color-inverse-primary: #7a5900;
|
|
33
|
+
--md-sys-color-surface-dim: #16130e;
|
|
34
|
+
--md-sys-color-surface-bright: #3d3933;
|
|
35
|
+
--md-sys-color-surface-container-lowest: #110e09;
|
|
36
|
+
--md-sys-color-surface-container-low: #1e1b16;
|
|
37
|
+
--md-sys-color-surface-container: #221f1a;
|
|
38
|
+
--md-sys-color-surface-container-high: #2d2924;
|
|
39
|
+
--md-sys-color-surface-container-highest: #38342e
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
:root[data-theme="dark"] {
|
|
43
|
+
--md-sys-color-primary: #f6be46;
|
|
44
|
+
--md-sys-color-on-primary: #412d00;
|
|
45
|
+
--md-sys-color-primary-container: #5d4200;
|
|
46
|
+
--md-sys-color-on-primary-container: #ffdea3;
|
|
47
|
+
--md-sys-color-secondary: #d9c4a0;
|
|
48
|
+
--md-sys-color-on-secondary: #3b2f15;
|
|
49
|
+
--md-sys-color-secondary-container: #53452a;
|
|
50
|
+
--md-sys-color-on-secondary-container: #f6e0bb;
|
|
51
|
+
--md-sys-color-tertiary: #b2cfa8;
|
|
52
|
+
--md-sys-color-on-tertiary: #1e361a;
|
|
53
|
+
--md-sys-color-tertiary-container: #344d2f;
|
|
54
|
+
--md-sys-color-on-tertiary-container: #cdebc2;
|
|
55
|
+
--md-sys-color-error: #ffb4ab;
|
|
56
|
+
--md-sys-color-on-error: #690005;
|
|
57
|
+
--md-sys-color-error-container: #93000a;
|
|
58
|
+
--md-sys-color-on-error-container: #ffb4ab;
|
|
59
|
+
--md-sys-color-background: #1e1b16;
|
|
60
|
+
--md-sys-color-on-background: #e9e1d9;
|
|
61
|
+
--md-sys-color-surface: #1e1b16;
|
|
62
|
+
--md-sys-color-on-surface: #e9e1d9;
|
|
63
|
+
--md-sys-color-surface-variant: #4e4639;
|
|
64
|
+
--md-sys-color-on-surface-variant: #d1c5b4;
|
|
65
|
+
--md-sys-color-outline: #9a8f80;
|
|
66
|
+
--md-sys-color-outline-variant: #4e4639;
|
|
67
|
+
--md-sys-color-shadow: #000000;
|
|
68
|
+
--md-sys-color-scrim: #000000;
|
|
69
|
+
--md-sys-color-inverse-surface: #e9e1d9;
|
|
70
|
+
--md-sys-color-inverse-on-surface: #34302a;
|
|
71
|
+
--md-sys-color-inverse-primary: #7a5900;
|
|
72
|
+
--md-sys-color-surface-dim: #16130e;
|
|
73
|
+
--md-sys-color-surface-bright: #3d3933;
|
|
74
|
+
--md-sys-color-surface-container-lowest: #110e09;
|
|
75
|
+
--md-sys-color-surface-container-low: #1e1b16;
|
|
76
|
+
--md-sys-color-surface-container: #221f1a;
|
|
77
|
+
--md-sys-color-surface-container-high: #2d2924;
|
|
78
|
+
--md-sys-color-surface-container-highest: #38342e
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (prefers-color-scheme: light) {
|
|
82
|
+
:root {
|
|
83
|
+
--md-sys-color-primary: #7a5900;
|
|
84
|
+
--md-sys-color-on-primary: #ffffff;
|
|
85
|
+
--md-sys-color-primary-container: #ffdea3;
|
|
86
|
+
--md-sys-color-on-primary-container: #261900;
|
|
87
|
+
--md-sys-color-secondary: #6c5c3f;
|
|
88
|
+
--md-sys-color-on-secondary: #ffffff;
|
|
89
|
+
--md-sys-color-secondary-container: #f6e0bb;
|
|
90
|
+
--md-sys-color-on-secondary-container: #251a04;
|
|
91
|
+
--md-sys-color-tertiary: #4b6545;
|
|
92
|
+
--md-sys-color-on-tertiary: #ffffff;
|
|
93
|
+
--md-sys-color-tertiary-container: #cdebc2;
|
|
94
|
+
--md-sys-color-on-tertiary-container: #092007;
|
|
95
|
+
--md-sys-color-error: #ba1a1a;
|
|
96
|
+
--md-sys-color-on-error: #ffffff;
|
|
97
|
+
--md-sys-color-error-container: #ffdad6;
|
|
98
|
+
--md-sys-color-on-error-container: #410002;
|
|
99
|
+
--md-sys-color-background: #fffbff;
|
|
100
|
+
--md-sys-color-on-background: #1e1b16;
|
|
101
|
+
--md-sys-color-surface: #fffbff;
|
|
102
|
+
--md-sys-color-on-surface: #1e1b16;
|
|
103
|
+
--md-sys-color-surface-variant: #ede1cf;
|
|
104
|
+
--md-sys-color-on-surface-variant: #4e4639;
|
|
105
|
+
--md-sys-color-outline: #7f7667;
|
|
106
|
+
--md-sys-color-outline-variant: #d1c5b4;
|
|
107
|
+
--md-sys-color-shadow: #000000;
|
|
108
|
+
--md-sys-color-scrim: #000000;
|
|
109
|
+
--md-sys-color-inverse-surface: #34302a;
|
|
110
|
+
--md-sys-color-inverse-on-surface: #f8efe7;
|
|
111
|
+
--md-sys-color-inverse-primary: #f6be46;
|
|
112
|
+
--md-sys-color-surface-dim: #e1d9d0;
|
|
113
|
+
--md-sys-color-surface-bright: #fff8f2;
|
|
114
|
+
--md-sys-color-surface-container-lowest: #ffffff;
|
|
115
|
+
--md-sys-color-surface-container-low: #fbf2e9;
|
|
116
|
+
--md-sys-color-surface-container: #f5ede4;
|
|
117
|
+
--md-sys-color-surface-container-high: #efe7de;
|
|
118
|
+
--md-sys-color-surface-container-highest: #e9e1d9
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
:root[data-theme="light"] {
|
|
122
|
+
--md-sys-color-primary: #7a5900;
|
|
123
|
+
--md-sys-color-on-primary: #ffffff;
|
|
124
|
+
--md-sys-color-primary-container: #ffdea3;
|
|
125
|
+
--md-sys-color-on-primary-container: #261900;
|
|
126
|
+
--md-sys-color-secondary: #6c5c3f;
|
|
127
|
+
--md-sys-color-on-secondary: #ffffff;
|
|
128
|
+
--md-sys-color-secondary-container: #f6e0bb;
|
|
129
|
+
--md-sys-color-on-secondary-container: #251a04;
|
|
130
|
+
--md-sys-color-tertiary: #4b6545;
|
|
131
|
+
--md-sys-color-on-tertiary: #ffffff;
|
|
132
|
+
--md-sys-color-tertiary-container: #cdebc2;
|
|
133
|
+
--md-sys-color-on-tertiary-container: #092007;
|
|
134
|
+
--md-sys-color-error: #ba1a1a;
|
|
135
|
+
--md-sys-color-on-error: #ffffff;
|
|
136
|
+
--md-sys-color-error-container: #ffdad6;
|
|
137
|
+
--md-sys-color-on-error-container: #410002;
|
|
138
|
+
--md-sys-color-background: #fffbff;
|
|
139
|
+
--md-sys-color-on-background: #1e1b16;
|
|
140
|
+
--md-sys-color-surface: #fffbff;
|
|
141
|
+
--md-sys-color-on-surface: #1e1b16;
|
|
142
|
+
--md-sys-color-surface-variant: #ede1cf;
|
|
143
|
+
--md-sys-color-on-surface-variant: #4e4639;
|
|
144
|
+
--md-sys-color-outline: #7f7667;
|
|
145
|
+
--md-sys-color-outline-variant: #d1c5b4;
|
|
146
|
+
--md-sys-color-shadow: #000000;
|
|
147
|
+
--md-sys-color-scrim: #000000;
|
|
148
|
+
--md-sys-color-inverse-surface: #34302a;
|
|
149
|
+
--md-sys-color-inverse-on-surface: #f8efe7;
|
|
150
|
+
--md-sys-color-inverse-primary: #f6be46;
|
|
151
|
+
--md-sys-color-surface-dim: #e1d9d0;
|
|
152
|
+
--md-sys-color-surface-bright: #fff8f2;
|
|
153
|
+
--md-sys-color-surface-container-lowest: #ffffff;
|
|
154
|
+
--md-sys-color-surface-container-low: #fbf2e9;
|
|
155
|
+
--md-sys-color-surface-container: #f5ede4;
|
|
156
|
+
--md-sys-color-surface-container-high: #efe7de;
|
|
157
|
+
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
|
+
}
|
|
159
|
+
</style><link rel="stylesheet" href="../assets/material-style.css"/></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search" data-base=".."><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">OPNet</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">OPNet</a></li><li><a href="version.html">version</a></li></ul><h1>Variable version<code class="tsd-tag ts-flagConst">Const</code> </h1></div><div class="tsd-signature"><span class="tsd-kind-variable">version</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">"1.0.0"</span><span class="tsd-signature-symbol"> = '1.0.0'</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/btc-vision/transaction/blob/c826dbc7747be9260a8346ab2f0254581401d734/src/_version.ts#L1">src/_version.ts:1</a></li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-index-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><h4 class="uppercase">Member Visibility</h4><form><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div><div class="tsd-theme-toggle"><h4 class="uppercase">Theme</h4><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1"></use></svg><span>OPNet</span></a><ul class="tsd-small-nested-navigation" id="tsd-nav-container" data-base=".."><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div><script>
|
|
160
|
+
try {
|
|
161
|
+
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
162
|
+
const link = document.createElement("a");
|
|
163
|
+
Object.assign(link, {
|
|
164
|
+
href: "https://github.com/dmnsgn/typedoc-material-theme",
|
|
165
|
+
target: "_blank",
|
|
166
|
+
rel: "noreferrer",
|
|
167
|
+
innerText: "typedoc-material-theme."
|
|
168
|
+
});
|
|
169
|
+
generateLinkElement.insertAdjacentElement("afterend", link);
|
|
170
|
+
generateLinkElement.insertAdjacentText("afterend", " with ");
|
|
171
|
+
} catch (error) {
|
|
172
|
+
|
|
173
|
+
}
|
|
174
|
+
</script></body></html>
|
package/gulpfile.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
process.on('uncaughtException', function (err) {
|
|
2
|
+
console.log('Caught exception: ', err);
|
|
3
|
+
});
|
|
4
|
+
|
|
5
|
+
import gulp from 'gulp';
|
|
6
|
+
import gulpcache from 'gulp-cached';
|
|
7
|
+
import logger from 'gulp-logger';
|
|
8
|
+
import ts from 'gulp-typescript';
|
|
9
|
+
|
|
10
|
+
const tsProject = ts.createProject('tsconfig.json');
|
|
11
|
+
const tsProjectCJS = ts.createProject('tsconfig.cjs.json');
|
|
12
|
+
|
|
13
|
+
function onError(e) {
|
|
14
|
+
console.log('Errored', e);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async function build() {
|
|
18
|
+
return new Promise(async (resolve) => {
|
|
19
|
+
tsProject
|
|
20
|
+
.src()
|
|
21
|
+
.pipe(gulpcache())
|
|
22
|
+
.pipe(
|
|
23
|
+
logger({
|
|
24
|
+
before: 'Starting...',
|
|
25
|
+
after: 'Project compiled!',
|
|
26
|
+
extname: '.js',
|
|
27
|
+
showChange: true,
|
|
28
|
+
}),
|
|
29
|
+
)
|
|
30
|
+
.pipe(tsProject())
|
|
31
|
+
.on('error', onError)
|
|
32
|
+
.pipe(gulp.dest('build'))
|
|
33
|
+
.on('end', async () => {
|
|
34
|
+
resolve();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function buildCJS() {
|
|
40
|
+
return new Promise(async (resolve) => {
|
|
41
|
+
tsProject
|
|
42
|
+
.src()
|
|
43
|
+
.pipe(gulpcache())
|
|
44
|
+
.pipe(
|
|
45
|
+
logger({
|
|
46
|
+
before: 'Starting...',
|
|
47
|
+
after: 'Project compiled!',
|
|
48
|
+
extname: '.js',
|
|
49
|
+
showChange: true,
|
|
50
|
+
}),
|
|
51
|
+
)
|
|
52
|
+
.pipe(tsProjectCJS())
|
|
53
|
+
.on('error', onError)
|
|
54
|
+
.pipe(gulp.dest('cjs'))
|
|
55
|
+
.on('end', async () => {
|
|
56
|
+
resolve();
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function buildProtoYaml() {
|
|
62
|
+
return new Promise(async (resolve) => {
|
|
63
|
+
gulp.src('./src/**/*.yaml')
|
|
64
|
+
.pipe(
|
|
65
|
+
logger({
|
|
66
|
+
before: 'Starting...',
|
|
67
|
+
after: 'Compiled yaml.',
|
|
68
|
+
extname: '.yaml',
|
|
69
|
+
showChange: true,
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
.pipe(gulpcache())
|
|
73
|
+
.pipe(gulp.dest('./build/'))
|
|
74
|
+
.on('end', () => {
|
|
75
|
+
gulp.src('./src/**/*.proto')
|
|
76
|
+
.pipe(
|
|
77
|
+
logger({
|
|
78
|
+
before: 'Starting...',
|
|
79
|
+
after: 'Compiled protobuf.',
|
|
80
|
+
extname: '.proto',
|
|
81
|
+
showChange: true,
|
|
82
|
+
}),
|
|
83
|
+
)
|
|
84
|
+
.pipe(gulp.dest('./build/'))
|
|
85
|
+
.on('end', async () => {
|
|
86
|
+
gulp.src('./src/config/*.conf')
|
|
87
|
+
.pipe(
|
|
88
|
+
logger({
|
|
89
|
+
before: 'Starting...',
|
|
90
|
+
after: 'Compiled conf.',
|
|
91
|
+
extname: '.conf',
|
|
92
|
+
showChange: true,
|
|
93
|
+
}),
|
|
94
|
+
)
|
|
95
|
+
.pipe(gulpcache())
|
|
96
|
+
.pipe(gulp.dest('./build/config'))
|
|
97
|
+
.on('end', async () => {
|
|
98
|
+
resolve();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
gulp.task('default', async () => {
|
|
106
|
+
await build().catch((e) => {});
|
|
107
|
+
await buildProtoYaml();
|
|
108
|
+
|
|
109
|
+
return true;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
gulp.task('cjs', async () => {
|
|
113
|
+
await buildCJS().catch((e) => {});
|
|
114
|
+
await buildProtoYaml();
|
|
115
|
+
|
|
116
|
+
return true;
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
gulp.task('watch', () => {
|
|
120
|
+
gulp.watch(
|
|
121
|
+
['src/**/**/*.ts', 'src/**/*.ts', 'src/**/*.js', 'src/*.ts', 'src/*.js'],
|
|
122
|
+
async (cb) => {
|
|
123
|
+
await build().catch((e) => {
|
|
124
|
+
console.log('Errored 2', e);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
cb();
|
|
128
|
+
},
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
gulp.watch(
|
|
132
|
+
[
|
|
133
|
+
'src/components/*.yaml',
|
|
134
|
+
'src/**/*.yaml',
|
|
135
|
+
'src/src/*.yaml',
|
|
136
|
+
'src/*.proto',
|
|
137
|
+
'src/**/**/*.proto',
|
|
138
|
+
'src/**/*.proto',
|
|
139
|
+
'*.proto',
|
|
140
|
+
'*.yaml',
|
|
141
|
+
'*.conf',
|
|
142
|
+
'src/config/*.conf',
|
|
143
|
+
],
|
|
144
|
+
async (cb) => {
|
|
145
|
+
await buildProtoYaml().catch((e) => {
|
|
146
|
+
console.log('Errored 2', e);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
cb();
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
});
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Config } from '@jest/types';
|
|
2
|
+
import { BabelConfig } from 'ts-jest';
|
|
3
|
+
|
|
4
|
+
const esModules = ['chalk', 'supports-color', '@btc-vision/logger', '@btc-vision/common'].join('|');
|
|
5
|
+
|
|
6
|
+
const babelConfig: BabelConfig = {
|
|
7
|
+
presets: ['@babel/preset-env'],
|
|
8
|
+
plugins: [['babel-plugin-transform-import-meta', { module: 'ES6' }]],
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
const config: Config.InitialOptions = {
|
|
13
|
+
verbose: true,
|
|
14
|
+
rootDir: './',
|
|
15
|
+
transform: {
|
|
16
|
+
'\\.[jt]s?$': [
|
|
17
|
+
'ts-jest',
|
|
18
|
+
{
|
|
19
|
+
useESM: true,
|
|
20
|
+
tsconfig: { allowJs: true },
|
|
21
|
+
babelConfig: babelConfig,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
modulePathIgnorePatterns: [
|
|
26
|
+
'packages',
|
|
27
|
+
'build',
|
|
28
|
+
'node_modules',
|
|
29
|
+
'data',
|
|
30
|
+
'documents',
|
|
31
|
+
'models',
|
|
32
|
+
'repositories',
|
|
33
|
+
'utils',
|
|
34
|
+
'config',
|
|
35
|
+
],
|
|
36
|
+
testMatch: [
|
|
37
|
+
'<rootPath>/tests/**/*.test.ts',
|
|
38
|
+
'<rootPath>/tests/*.test.ts',
|
|
39
|
+
'<rootDir>/tests/*.test.ts',
|
|
40
|
+
'<rootDir>/tests/**/*.test.ts',
|
|
41
|
+
],
|
|
42
|
+
moduleNameMapper: {
|
|
43
|
+
'^(\\.{1,2}/.*)\\.[jt]s$': '$1',
|
|
44
|
+
},
|
|
45
|
+
moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
|
|
46
|
+
moduleDirectories: ['node_modules', 'src', 'build'],
|
|
47
|
+
testEnvironment: 'node',
|
|
48
|
+
transformIgnorePatterns: [`/node_modules/(?!${esModules})`, `/build/`],
|
|
49
|
+
preset: 'ts-jest/presets/js-with-babel',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default config;
|
package/package.json
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"author": "BlobMaster41",
|
|
5
|
+
"description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=16.0.0"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
"node": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"require": "./cjs/index.js",
|
|
13
|
+
"types": "./build/index.d.ts"
|
|
14
|
+
},
|
|
15
|
+
"browser": {
|
|
16
|
+
"import": "./browser/index.js",
|
|
17
|
+
"require": "./browser/index.js",
|
|
18
|
+
"types": "./browser/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"browser": {
|
|
22
|
+
"Buffer": "buffer",
|
|
23
|
+
"crypto": "./src/crypto/crypto-browser.js",
|
|
24
|
+
"stream": "stream-browserify",
|
|
25
|
+
"zlib": "browserify-zlib"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://opnet.org",
|
|
28
|
+
"keywords": [
|
|
29
|
+
"opnet",
|
|
30
|
+
"bsi",
|
|
31
|
+
"bsi-binary",
|
|
32
|
+
"bsi-bitcoin-rpc",
|
|
33
|
+
"bitcoin transaction",
|
|
34
|
+
"transaction builder",
|
|
35
|
+
"transaction signer",
|
|
36
|
+
"bitcoin",
|
|
37
|
+
"btc",
|
|
38
|
+
"bitcoin smart contracts",
|
|
39
|
+
"smart inscriptions",
|
|
40
|
+
"ordinals"
|
|
41
|
+
],
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"main": "build/index.js",
|
|
44
|
+
"types": "build/index.d.ts",
|
|
45
|
+
"typings": "build/index.d.ts",
|
|
46
|
+
"module": "build/index.js",
|
|
47
|
+
"name": "@btc-vision/transaction",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public",
|
|
50
|
+
"tag": "latest"
|
|
51
|
+
},
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git://github.com/btc-vision/transaction.git"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"watch": "gulp watch",
|
|
58
|
+
"build": "gulp",
|
|
59
|
+
"test": "jest --runInBand",
|
|
60
|
+
"setup": "npm npm i && npm run build",
|
|
61
|
+
"browserBuild": "webpack --mode production",
|
|
62
|
+
"cjs": "gulp cjs",
|
|
63
|
+
"docs": "typedoc --out docs --tsconfig tsconfig.json --readme README.md --name OPNet --plugin typedoc-material-theme --themeColor '#cb9820' --exclude src/scripts/test.ts --exclude src/index.ts src",
|
|
64
|
+
"install": "gulp && gulp cjs"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
68
|
+
"@babel/plugin-transform-runtime": "^7.24.3",
|
|
69
|
+
"@babel/preset-env": "^7.24.5",
|
|
70
|
+
"@babel/preset-flow": "^7.24.1",
|
|
71
|
+
"@babel/preset-react": "^7.24.1",
|
|
72
|
+
"@babel/preset-typescript": "^7.24.1",
|
|
73
|
+
"@jest/types": "^29.6.3",
|
|
74
|
+
"@types/jest": "^29.5.12",
|
|
75
|
+
"@types/node": "^20.11.30",
|
|
76
|
+
"eslint": "^8.57.0",
|
|
77
|
+
"https-browserify": "^1.0.0",
|
|
78
|
+
"jest": "^29.7.0",
|
|
79
|
+
"os-browserify": "^0.3.0",
|
|
80
|
+
"prettier": "^3.3.1",
|
|
81
|
+
"stream-browserify": "^3.0.0",
|
|
82
|
+
"stream-http": "^3.2.0",
|
|
83
|
+
"ts-jest": "^29.1.2",
|
|
84
|
+
"typedoc": "^0.25.13",
|
|
85
|
+
"typedoc-material-theme": "^1.0.2",
|
|
86
|
+
"typescript": "^5.4.5",
|
|
87
|
+
"typescript-eslint": "^7.4.0",
|
|
88
|
+
"webpack": "^5.91.0",
|
|
89
|
+
"webpack-cli": "^5.1.4"
|
|
90
|
+
},
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
93
|
+
"@bitcoinerlab/secp256k1": "^1.1.1",
|
|
94
|
+
"@btc-vision/bsi-binary": "^1.0.16",
|
|
95
|
+
"@btc-vision/bsi-bitcoin-rpc": "^1.0.17",
|
|
96
|
+
"@btc-vision/bsi-common": "^1.0.14",
|
|
97
|
+
"@btc-vision/logger": "^1.0.2",
|
|
98
|
+
"assert": "^2.1.0",
|
|
99
|
+
"babel-loader": "^9.1.3",
|
|
100
|
+
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
101
|
+
"babel-preset-react": "^6.24.1",
|
|
102
|
+
"babelify": "^10.0.0",
|
|
103
|
+
"bip32": "^4.0.0",
|
|
104
|
+
"bitcoinjs-lib": "^6.1.5",
|
|
105
|
+
"browserify-zlib": "^0.2.0",
|
|
106
|
+
"buffer": "^6.0.3",
|
|
107
|
+
"gulp": "^4.0.2",
|
|
108
|
+
"gulp-cached": "^1.1.1",
|
|
109
|
+
"gulp-logger": "^0.0.2",
|
|
110
|
+
"gulp-typescript": "^6.0.0-alpha.1",
|
|
111
|
+
"gulplog": "^2.2.0",
|
|
112
|
+
"tiny-secp256k1": "^2.2.3",
|
|
113
|
+
"ts-loader": "^9.5.1",
|
|
114
|
+
"ts-node": "^10.9.2"
|
|
115
|
+
}
|
|
116
|
+
}
|
package/src/_version.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const version = '1.0.0';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import zlib, { ZlibOptions } from 'zlib';
|
|
2
|
+
|
|
3
|
+
/** Compressor class for compressing and decompressing data. */
|
|
4
|
+
export class Compressor {
|
|
5
|
+
private static readonly zlibOptions: ZlibOptions = {
|
|
6
|
+
level: zlib.constants.Z_MAX_LEVEL,
|
|
7
|
+
maxOutputLength: 1024 * 1024 * 16, // 16mb, limit it to 16mb.
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Compresses the data using gzip.
|
|
12
|
+
* @param {Uint8Array | Buffer} data The data to compress.
|
|
13
|
+
* @returns {Buffer} The compressed data.
|
|
14
|
+
*/
|
|
15
|
+
public static compress(data: Uint8Array | Buffer): Buffer {
|
|
16
|
+
return zlib.gzipSync(data, Compressor.zlibOptions);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Decompresses the data using gunzip.
|
|
21
|
+
* @param {Uint8Array | Buffer} data The data to decompress.
|
|
22
|
+
* @returns {Buffer} The decompressed data.
|
|
23
|
+
*/
|
|
24
|
+
public static decompress(data: Uint8Array | Buffer): Buffer {
|
|
25
|
+
return zlib.gunzipSync(data, Compressor.zlibOptions);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* Browser Crypto Shims */
|
|
2
|
+
import { hmac } from '@noble/hashes/hmac';
|
|
3
|
+
import { pbkdf2 } from '@noble/hashes/pbkdf2';
|
|
4
|
+
import { sha256 } from '@noble/hashes/sha256';
|
|
5
|
+
import { sha512 } from '@noble/hashes/sha512';
|
|
6
|
+
import { assertArgument } from 'ethers';
|
|
7
|
+
|
|
8
|
+
function getGlobal() {
|
|
9
|
+
if (typeof self !== 'undefined') {
|
|
10
|
+
return self;
|
|
11
|
+
}
|
|
12
|
+
if (typeof window !== 'undefined') {
|
|
13
|
+
return window;
|
|
14
|
+
}
|
|
15
|
+
if (typeof global !== 'undefined') {
|
|
16
|
+
return global;
|
|
17
|
+
}
|
|
18
|
+
throw new Error('unable to locate global object');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const anyGlobal = getGlobal();
|
|
22
|
+
const crypto = anyGlobal.crypto || anyGlobal.msCrypto;
|
|
23
|
+
|
|
24
|
+
export function createHash(algo) {
|
|
25
|
+
switch (algo) {
|
|
26
|
+
case 'sha256':
|
|
27
|
+
return sha256.create();
|
|
28
|
+
case 'sha512':
|
|
29
|
+
return sha512.create();
|
|
30
|
+
}
|
|
31
|
+
assertArgument(false, 'invalid hashing algorithm name', 'algorithm', algo);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function createHmac(_algo, key) {
|
|
35
|
+
const algo = { sha256, sha512 }[_algo];
|
|
36
|
+
assertArgument(algo != null, 'invalid hmac algorithm', 'algorithm', _algo);
|
|
37
|
+
return hmac.create(algo, key);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function pbkdf2Sync(password, salt, iterations, keylen, _algo) {
|
|
41
|
+
const algo = { sha256, sha512 }[_algo];
|
|
42
|
+
assertArgument(algo != null, 'invalid pbkdf2 algorithm', 'algorithm', _algo);
|
|
43
|
+
return pbkdf2(algo, password, salt, { c: iterations, dkLen: keylen });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function randomBytes(length) {
|
|
47
|
+
assert(
|
|
48
|
+
crypto != null,
|
|
49
|
+
'platform does not support secure random numbers',
|
|
50
|
+
'UNSUPPORTED_OPERATION',
|
|
51
|
+
{
|
|
52
|
+
operation: 'randomBytes',
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
assertArgument(
|
|
56
|
+
Number.isInteger(length) && length > 0 && length <= 1024,
|
|
57
|
+
'invalid length',
|
|
58
|
+
'length',
|
|
59
|
+
length,
|
|
60
|
+
);
|
|
61
|
+
const result = new Uint8Array(length);
|
|
62
|
+
crypto.getRandomValues(result);
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default {
|
|
67
|
+
createHash,
|
|
68
|
+
createHmac,
|
|
69
|
+
pbkdf2Sync,
|
|
70
|
+
randomBytes,
|
|
71
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createHash, createHmac, pbkdf2Sync, randomBytes } from 'crypto';
|