opnet 1.0.13 → 1.0.15
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/CONTRIBUTING.md +71 -0
- package/README.md +6 -7
- package/browser/_version.d.ts +1 -1
- package/browser/abi/BaseContractProperty.d.ts +3 -0
- package/browser/abi/BitcoinAbiTypes.d.ts +4 -0
- package/browser/abi/BitcoinInterface.d.ts +9 -0
- package/browser/abi/interfaces/BaseContractProperties.d.ts +4 -0
- package/browser/abi/interfaces/BitcoinAbiValue.d.ts +5 -0
- package/browser/abi/interfaces/BitcoinInterfaceAbi.d.ts +11 -0
- package/browser/bitcoin/UTXOs.d.ts +1 -6
- package/browser/bitcoin/interfaces/IUTXO.d.ts +7 -0
- package/browser/common/CommonTypes.d.ts +1 -0
- package/browser/contracts/CallResult.d.ts +6 -3
- package/browser/contracts/Contract.d.ts +28 -0
- package/browser/contracts/interfaces/ICallResult.d.ts +2 -3
- package/browser/contracts/interfaces/IContract.d.ts +4 -0
- package/browser/crypto/crypto-browser.d.ts +7 -0
- package/browser/index.js +1 -1
- package/browser/opnet.d.ts +11 -0
- package/browser/scripts/testContract.d.ts +1 -0
- package/browser/scripts/testMethods.d.ts +1 -0
- package/browser/utils/BitcoinUtils.d.ts +4 -0
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/abi/BaseContractProperty.d.ts +3 -0
- package/build/abi/BaseContractProperty.js +1 -0
- package/build/abi/BitcoinAbiTypes.d.ts +4 -0
- package/build/abi/BitcoinAbiTypes.js +5 -0
- package/build/abi/BitcoinInterface.d.ts +9 -0
- package/build/abi/BitcoinInterface.js +45 -0
- package/build/abi/BitcoinInterfaceAbi.d.ts +3 -0
- package/build/abi/BitcoinInterfaceAbi.js +1 -0
- package/build/abi/enums/ParamTypes.d.ts +0 -0
- package/build/abi/enums/ParamTypes.js +1 -0
- package/build/abi/interface/BitcoinInterface.d.ts +6 -0
- package/build/abi/interface/BitcoinInterface.js +12 -0
- package/build/abi/interface/BitcoinInterfaceAbi.d.ts +3 -0
- package/build/abi/interface/BitcoinInterfaceAbi.js +1 -0
- package/build/abi/interfaces/BaseContractProperties.d.ts +4 -0
- package/build/abi/interfaces/BaseContractProperties.js +1 -0
- package/build/abi/interfaces/BaseContractProperty.d.ts +2 -0
- package/build/abi/interfaces/BaseContractProperty.js +1 -0
- package/build/abi/interfaces/BitcoinAbiInput.d.ts +5 -0
- package/build/abi/interfaces/BitcoinAbiInput.js +1 -0
- package/build/abi/interfaces/BitcoinAbiValue.d.ts +5 -0
- package/build/abi/interfaces/BitcoinAbiValue.js +1 -0
- package/build/abi/interfaces/BitcoinInterfaceAbi.d.ts +11 -0
- package/build/abi/interfaces/BitcoinInterfaceAbi.js +1 -0
- package/build/bitcoin/UTXOs.d.ts +1 -6
- package/build/bitcoin/interfaces/IUTXO.d.ts +7 -0
- package/build/bitcoin/interfaces/IUTXO.js +1 -0
- package/build/common/CommonTypes.d.ts +1 -0
- package/build/contracts/CallResult.d.ts +6 -3
- package/build/contracts/CallResult.js +9 -2
- package/build/contracts/Contract.d.ts +28 -0
- package/build/contracts/Contract.js +206 -0
- package/build/contracts/interfaces/ICallResult.d.ts +2 -3
- package/build/contracts/interfaces/IContract.d.ts +4 -0
- package/build/contracts/interfaces/IContract.js +1 -0
- package/build/interface/BitcoinInterface.d.ts +6 -0
- package/build/interface/BitcoinInterface.js +12 -0
- package/build/interface/BitcoinInterfaceAbi.d.ts +3 -0
- package/build/interface/BitcoinInterfaceAbi.js +1 -0
- package/build/interface/Interface.d.ts +2 -0
- package/build/interface/Interface.js +2 -0
- package/build/interface.d.ts +0 -0
- package/build/interface.js +1 -0
- package/build/opnet.d.ts +11 -0
- package/build/opnet.js +11 -0
- package/build/scripts/test.js +12 -0
- package/build/scripts/testContract.d.ts +1 -0
- package/build/scripts/testContract.js +28 -0
- package/build/scripts/testMethods.d.ts +1 -0
- package/build/scripts/testMethods.js +24 -0
- package/build/utils/BitcoinUtils.d.ts +4 -0
- package/build/utils/BitcoinUtils.js +7 -0
- package/cjs/_version.d.ts +1 -0
- package/cjs/_version.js +4 -0
- package/cjs/abi/BaseContractProperty.d.ts +3 -0
- package/cjs/abi/BaseContractProperty.js +2 -0
- package/cjs/abi/BitcoinAbiTypes.d.ts +4 -0
- package/cjs/abi/BitcoinAbiTypes.js +8 -0
- package/cjs/abi/BitcoinInterface.d.ts +9 -0
- package/cjs/abi/BitcoinInterface.js +49 -0
- package/cjs/abi/interfaces/BaseContractProperties.d.ts +4 -0
- package/cjs/abi/interfaces/BaseContractProperties.js +2 -0
- package/cjs/abi/interfaces/BitcoinAbiValue.d.ts +5 -0
- package/cjs/abi/interfaces/BitcoinAbiValue.js +2 -0
- package/cjs/abi/interfaces/BitcoinInterfaceAbi.d.ts +11 -0
- package/cjs/abi/interfaces/BitcoinInterfaceAbi.js +2 -0
- package/cjs/bitcoin/BitcoinAddress.d.ts +20 -0
- package/cjs/bitcoin/BitcoinAddress.js +116 -0
- package/cjs/bitcoin/UTXOs.d.ts +15 -0
- package/cjs/bitcoin/UTXOs.js +16 -0
- package/cjs/block/Block.d.ts +2 -3
- package/cjs/block/Block.js +3 -28
- package/cjs/block/interfaces/IBlock.d.ts +28 -0
- package/cjs/block/interfaces/IBlock.js +2 -0
- package/cjs/common/CommonTypes.d.ts +4 -0
- package/cjs/common/CommonTypes.js +2 -0
- package/cjs/contracts/CallResult.d.ts +13 -0
- package/cjs/contracts/CallResult.js +25 -0
- package/cjs/contracts/Contract.d.ts +28 -0
- package/cjs/contracts/Contract.js +212 -0
- package/cjs/contracts/ContractData.d.ts +15 -0
- package/cjs/contracts/ContractData.js +36 -0
- package/cjs/contracts/interfaces/IAccessList.d.ts +6 -0
- package/cjs/contracts/interfaces/IAccessList.js +2 -0
- package/cjs/contracts/interfaces/ICallResult.d.ts +11 -0
- package/cjs/contracts/interfaces/ICallResult.js +2 -0
- package/cjs/contracts/interfaces/IContract.d.ts +4 -0
- package/cjs/contracts/interfaces/IContract.js +2 -0
- package/cjs/contracts/interfaces/IRawContract.d.ts +13 -0
- package/cjs/contracts/interfaces/IRawContract.js +2 -0
- package/cjs/crypto/crypto.d.ts +2 -0
- package/cjs/crypto/crypto.js +8 -0
- package/cjs/index.d.ts +3 -11
- package/cjs/index.js +16 -11
- package/cjs/opnet.d.ts +36 -0
- package/cjs/opnet.js +54 -0
- package/cjs/providers/AbstractRpcProvider.d.ts +34 -0
- package/cjs/providers/AbstractRpcProvider.js +161 -0
- package/cjs/providers/JSONRpcProvider.d.ts +5 -9
- package/cjs/providers/JSONRpcProvider.js +4 -29
- package/cjs/providers/WebsocketRpcProvider.d.ts +8 -0
- package/cjs/providers/WebsocketRpcProvider.js +27 -0
- package/cjs/scripts/testContract.d.ts +1 -0
- package/cjs/scripts/testContract.js +30 -0
- package/cjs/scripts/testMethods.d.ts +1 -0
- package/cjs/scripts/testMethods.js +26 -0
- package/cjs/serialize/BigInt.d.ts +6 -0
- package/cjs/serialize/BigInt.js +5 -0
- package/cjs/storage/StoredValue.d.ts +10 -0
- package/cjs/storage/StoredValue.js +28 -0
- package/cjs/storage/interfaces/IStorageValue.d.ts +9 -0
- package/cjs/storage/interfaces/IStorageValue.js +2 -0
- package/cjs/transactions/DeploymentTransaction.d.ts +10 -1
- package/cjs/transactions/DeploymentTransaction.js +16 -0
- package/cjs/transactions/GenericTransaction.d.ts +1 -1
- package/cjs/transactions/InteractionTransaction.d.ts +1 -1
- package/cjs/transactions/Transaction.d.ts +1 -1
- package/cjs/transactions/Transaction.js +1 -1
- package/cjs/transactions/TransactionParser.d.ts +7 -0
- package/cjs/transactions/TransactionParser.js +32 -0
- package/cjs/transactions/TransactionReceipt.d.ts +10 -0
- package/cjs/transactions/TransactionReceipt.js +16 -0
- package/cjs/transactions/interfaces/ITransaction.d.ts +39 -0
- package/cjs/transactions/interfaces/ITransaction.js +2 -0
- package/cjs/transactions/interfaces/ITransactionReceipt.d.ts +8 -0
- package/cjs/transactions/interfaces/ITransactionReceipt.js +2 -0
- package/cjs/utils/BitcoinUtils.d.ts +4 -0
- package/cjs/utils/BitcoinUtils.js +14 -0
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/AbstractRpcProvider.html +15 -15
- package/docs/classes/BaseContract.html +187 -0
- package/docs/classes/BitcoinAddress.html +5 -2
- package/docs/classes/BitcoinInterface.html +182 -0
- package/docs/classes/BitcoinUtils.html +183 -0
- package/docs/classes/Block.html +5 -3
- package/docs/classes/CallResult.html +6 -2
- package/docs/classes/ContractData.html +4 -2
- package/docs/classes/DeploymentTransaction.html +4 -2
- package/docs/classes/GenericTransaction.html +4 -2
- package/docs/classes/IBaseContract.html +192 -0
- package/docs/classes/InteractionTransaction.html +3 -2
- package/docs/classes/JSONRpcProvider.html +14 -14
- package/docs/classes/StoredValue.html +4 -2
- package/docs/classes/TransactionBase.html +4 -2
- package/docs/classes/TransactionInput.html +3 -2
- package/docs/classes/TransactionOutput.html +3 -2
- package/docs/classes/TransactionParser.html +3 -2
- package/docs/classes/TransactionReceipt.html +3 -2
- package/docs/classes/UTXO.html +4 -2
- package/docs/classes/WebSocketRpcProvider.html +14 -14
- package/docs/enums/ABIDataTypes.html +183 -0
- package/docs/enums/BitcoinAbiTypes.html +178 -0
- package/docs/enums/OPNetTransactionTypes.html +2 -2
- package/docs/functions/getContract.html +180 -0
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +4 -5
- package/docs/interfaces/BaseContractProperties.html +176 -0
- package/docs/interfaces/BitcoinAbiValue.html +180 -0
- package/docs/interfaces/BitcoinInterfaceAbiBase.html +182 -0
- package/docs/interfaces/IAccessList.html +3 -1
- package/docs/interfaces/IAccessListItem.html +3 -1
- package/docs/interfaces/IBlock.html +5 -3
- package/docs/interfaces/IBlockCommon.html +5 -3
- package/docs/interfaces/ICallRequestError.html +4 -2
- package/docs/interfaces/ICallResultData.html +4 -2
- package/docs/interfaces/IContract.html +177 -0
- package/docs/interfaces/IDeploymentTransaction.html +4 -2
- package/docs/interfaces/IGenericTransaction.html +4 -2
- package/docs/interfaces/IInteractionTransaction.html +4 -2
- package/docs/interfaces/IRawContract.html +5 -2
- package/docs/interfaces/IStorageValue.html +4 -2
- package/docs/interfaces/ITransactionBase.html +4 -2
- package/docs/interfaces/ITransactionInput.html +3 -2
- package/docs/interfaces/ITransactionOutput.html +3 -2
- package/docs/interfaces/ITransactionReceipt.html +4 -2
- package/docs/interfaces/IUTXO.html +4 -2
- package/docs/modules.html +38 -24
- package/docs/types/BaseContractProperty.html +176 -0
- package/docs/types/BitcoinAddressLike.html +1 -1
- package/docs/types/BitcoinInterfaceAbi.html +174 -0
- package/docs/types/BlockHeaderChecksumProof.html +1 -1
- package/docs/types/DecodedCallResult.html +174 -0
- package/docs/types/ICallResult.html +2 -1
- package/docs/types/ITransaction.html +2 -1
- package/docs/types/PointerLike.html +1 -1
- package/docs/types/UTXOs.html +3 -1
- package/docs/variables/version.html +1 -1
- package/package.json +6 -4
- package/src/_version.ts +1 -1
- package/src/abi/BaseContractProperty.ts +8 -0
- package/src/abi/BitcoinAbiTypes.ts +9 -0
- package/src/abi/BitcoinInterface.ts +63 -0
- package/src/abi/interfaces/BaseContractProperties.ts +9 -0
- package/src/abi/interfaces/BitcoinAbiValue.ts +18 -0
- package/src/abi/interfaces/BitcoinInterfaceAbi.ts +19 -0
- package/src/bitcoin/BitcoinAddress.ts +5 -0
- package/src/bitcoin/UTXOs.ts +28 -26
- package/src/bitcoin/interfaces/IUTXO.ts +12 -0
- package/src/block/Block.ts +5 -0
- package/src/block/interfaces/IBlock.ts +46 -38
- package/src/common/CommonTypes.ts +16 -4
- package/src/contracts/CallResult.ts +34 -20
- package/src/contracts/Contract.ts +321 -0
- package/src/contracts/ContractData.ts +46 -41
- package/src/contracts/interfaces/IAccessList.ts +17 -7
- package/src/contracts/interfaces/ICallResult.ts +29 -15
- package/src/contracts/interfaces/IContract.ts +10 -0
- package/src/contracts/interfaces/IRawContract.ts +17 -12
- package/src/crypto/crypto-browser.js +71 -60
- package/src/opnet.ts +17 -0
- package/src/providers/AbstractRpcProvider.ts +352 -351
- package/src/scripts/testContract.ts +51 -0
- package/src/scripts/{test.ts → testMethods.ts} +52 -54
- package/src/scripts/test_abi.json +31 -0
- package/src/storage/StoredValue.ts +35 -30
- package/src/storage/interfaces/IStorageValue.ts +15 -10
- package/src/transactions/DeploymentTransaction.ts +41 -36
- package/src/transactions/GenericTransaction.ts +19 -12
- package/src/transactions/InteractionTransaction.ts +44 -40
- package/src/transactions/Transaction.ts +8 -0
- package/src/transactions/TransactionInput.ts +8 -0
- package/src/transactions/TransactionOutput.ts +8 -0
- package/src/transactions/TransactionParser.ts +47 -43
- package/src/transactions/TransactionReceipt.ts +22 -18
- package/src/transactions/interfaces/ITransaction.ts +78 -52
- package/src/transactions/interfaces/ITransactionReceipt.ts +14 -9
- package/src/utils/BitcoinUtils.ts +22 -0
- package/webpack.config.js +71 -75
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
--md-sys-color-surface-container-high: #efe7de;
|
|
157
157
|
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
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="PointerLike.html">PointerLike</a></li></ul><h1>Type alias PointerLike</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Pointer<wbr/>Like</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/btc-vision/opnet/blob/
|
|
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="PointerLike.html">PointerLike</a></li></ul><h1>Type alias PointerLike</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">Pointer<wbr/>Like</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">bigint</span><span class="tsd-signature-symbol"> | </span><span class="tsd-signature-type">string</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/btc-vision/opnet/blob/196468c4350eb7809ac84c707cb9ed7901f21d28/src/common/CommonTypes.ts#L4">src/common/CommonTypes.ts:4</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
160
|
try {
|
|
161
161
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
162
162
|
const link = document.createElement("a");
|
package/docs/types/UTXOs.html
CHANGED
|
@@ -156,7 +156,9 @@
|
|
|
156
156
|
--md-sys-color-surface-container-high: #efe7de;
|
|
157
157
|
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
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="UTXOs.html">UTXOs</a></li></ul><h1>Type alias UTXOs</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">UTXOs</span><span class="tsd-signature-symbol">:</span> <a href="../classes/UTXO.html" class="tsd-signature-type tsd-kind-class">UTXO</a><span class="tsd-signature-symbol">[]</span></div><
|
|
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="UTXOs.html">UTXOs</a></li></ul><h1>Type alias UTXOs</h1></div><div class="tsd-signature"><span class="tsd-kind-type-alias">UTXOs</span><span class="tsd-signature-symbol">:</span> <a href="../classes/UTXO.html" class="tsd-signature-type tsd-kind-class">UTXO</a><span class="tsd-signature-symbol">[]</span></div><div class="tsd-comment tsd-typography"><p>Array of Unspent Transaction Outputs</p>
|
|
160
|
+
</div><div class="tsd-comment tsd-typography"><h4>Cathegory</h4><p>Bitcoin</p>
|
|
161
|
+
</div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/btc-vision/opnet/blob/196468c4350eb7809ac84c707cb9ed7901f21d28/src/bitcoin/UTXOs.ts#L28">src/bitcoin/UTXOs.ts:28</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
162
|
try {
|
|
161
163
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
162
164
|
const link = document.createElement("a");
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
--md-sys-color-surface-container-high: #efe7de;
|
|
157
157
|
--md-sys-color-surface-container-highest: #e9e1d9
|
|
158
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.
|
|
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.15"</span><span class="tsd-signature-symbol"> = '1.0.15'</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/btc-vision/opnet/blob/196468c4350eb7809ac84c707cb9ed7901f21d28/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
160
|
try {
|
|
161
161
|
const generateLinkElement = document.querySelector(".tsd-generator a");
|
|
162
162
|
const link = document.createElement("a");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"author": "BlobMaster41",
|
|
5
5
|
"description": "The perfect library for building Bitcoin based applications.",
|
|
6
6
|
"engines": {
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"btc",
|
|
31
31
|
"bitcoin smart contracts",
|
|
32
32
|
"smart inscriptions",
|
|
33
|
-
"bsi"
|
|
33
|
+
"bsi",
|
|
34
|
+
"bsi-binary",
|
|
35
|
+
"ordinals"
|
|
34
36
|
],
|
|
35
37
|
"license": "MIT",
|
|
36
38
|
"main": "build/index.js",
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
},
|
|
45
47
|
"repository": {
|
|
46
48
|
"type": "git",
|
|
47
|
-
"url": "git://github.com/
|
|
49
|
+
"url": "git://github.com/btc-vision/opnet.git"
|
|
48
50
|
},
|
|
49
51
|
"scripts": {
|
|
50
52
|
"watch": "gulp watch",
|
|
@@ -92,6 +94,7 @@
|
|
|
92
94
|
"babel-plugin-transform-import-meta": "^2.2.1",
|
|
93
95
|
"babel-preset-react": "^6.24.1",
|
|
94
96
|
"babelify": "^10.0.0",
|
|
97
|
+
"bignumber.js": "^9.1.2",
|
|
95
98
|
"bitcoinjs-lib": "^6.1.5",
|
|
96
99
|
"buffer": "^6.0.3",
|
|
97
100
|
"ethers": "^6.12.1",
|
|
@@ -99,7 +102,6 @@
|
|
|
99
102
|
"gulp-cached": "^1.1.1",
|
|
100
103
|
"gulp-logger": "^0.0.2",
|
|
101
104
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
102
|
-
"node-polyfill-webpack-plugin": "^3.0.0",
|
|
103
105
|
"tiny-secp256k1": "^2.2.3",
|
|
104
106
|
"ts-jest": "^29.1.2",
|
|
105
107
|
"ts-loader": "^9.5.1",
|
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.15';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CallResult } from '../contracts/CallResult.js';
|
|
2
|
+
import { ICallRequestError } from '../contracts/interfaces/ICallResult.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description This type is used to represent a base contract property.
|
|
6
|
+
* @cathegory Abi
|
|
7
|
+
*/
|
|
8
|
+
export type BaseContractProperty = CallResult | ICallRequestError;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BitcoinAbiValue } from './interfaces/BitcoinAbiValue.js';
|
|
2
|
+
import { BitcoinInterfaceAbi } from './interfaces/BitcoinInterfaceAbi.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description This class is used to provide a Bitcoin interface.
|
|
6
|
+
* @cathegory Abi
|
|
7
|
+
*/
|
|
8
|
+
export class BitcoinInterface {
|
|
9
|
+
public readonly abi: BitcoinInterfaceAbi;
|
|
10
|
+
|
|
11
|
+
constructor(abi: BitcoinInterfaceAbi) {
|
|
12
|
+
this.verifyAbi(abi);
|
|
13
|
+
|
|
14
|
+
this.abi = abi;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public static from(abi: BitcoinInterface | BitcoinInterfaceAbi): BitcoinInterface {
|
|
18
|
+
if (abi instanceof BitcoinInterface) {
|
|
19
|
+
return abi;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return new BitcoinInterface(abi);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public hasFunction(name: string): boolean {
|
|
26
|
+
return this.abi.some((element) => element.name === name && element.type === 'function');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
private verifyAbi(abi: BitcoinInterfaceAbi): void {
|
|
30
|
+
if (abi.length === 0) {
|
|
31
|
+
throw new Error('The ABI provided is empty.');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for (let i = 0; i < abi.length; i++) {
|
|
35
|
+
const element = abi[i];
|
|
36
|
+
|
|
37
|
+
if (!element.name) {
|
|
38
|
+
throw new Error('The ABI provided is missing a name.');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (!element.type) {
|
|
42
|
+
throw new Error('The ABI provided is missing a type.');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (element.inputs && element.inputs!.length) this.verifyAbiValues(element.inputs);
|
|
46
|
+
if (element.outputs && element.outputs!.length) this.verifyAbiValues(element.outputs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private verifyAbiValues(inputs: BitcoinAbiValue[]): void {
|
|
51
|
+
for (let j = 0; j < inputs.length; j++) {
|
|
52
|
+
const input = inputs[j];
|
|
53
|
+
|
|
54
|
+
if (!input.name) {
|
|
55
|
+
throw new Error('The ABI provided is missing an input name.');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!input.type) {
|
|
59
|
+
throw new Error('The ABI provided is missing an input type.');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ABIDataTypes } from '@btc-vision/bsi-binary';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The Bitcoin ABI value.
|
|
5
|
+
* @interface
|
|
6
|
+
* @cathegory Abi
|
|
7
|
+
*/
|
|
8
|
+
export interface BitcoinAbiValue {
|
|
9
|
+
/**
|
|
10
|
+
* The name of the input.
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The type of the input.
|
|
16
|
+
*/
|
|
17
|
+
type: ABIDataTypes;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BitcoinAbiTypes } from '../BitcoinAbiTypes.js';
|
|
2
|
+
import { BitcoinAbiValue } from './BitcoinAbiValue.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description This interface is used to define the Bitcoin interface ABI.
|
|
6
|
+
* @cathegory Abi
|
|
7
|
+
*/
|
|
8
|
+
export interface BitcoinInterfaceAbiBase {
|
|
9
|
+
readonly constant?: boolean;
|
|
10
|
+
readonly name: string;
|
|
11
|
+
|
|
12
|
+
readonly inputs?: BitcoinAbiValue[];
|
|
13
|
+
readonly outputs?: BitcoinAbiValue[];
|
|
14
|
+
|
|
15
|
+
readonly type: BitcoinAbiTypes;
|
|
16
|
+
readonly payable?: boolean;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type BitcoinInterfaceAbi = BitcoinInterfaceAbiBase[];
|
|
@@ -7,6 +7,11 @@ initEccLib(ecc);
|
|
|
7
7
|
|
|
8
8
|
const ECPair = ECPairFactory(ecc);
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Bitcoin Address
|
|
12
|
+
* @description This class is used to create a Bitcoin address.
|
|
13
|
+
* @cathegory Bitcoin
|
|
14
|
+
*/
|
|
10
15
|
export class BitcoinAddress {
|
|
11
16
|
readonly #keyPair: ECPairInterface;
|
|
12
17
|
readonly #taprootAddress: string;
|
package/src/bitcoin/UTXOs.ts
CHANGED
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
public readonly
|
|
12
|
-
public readonly
|
|
13
|
-
|
|
14
|
-
public
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
|
|
2
|
+
import { IUTXO } from './interfaces/IUTXO.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Unspent Transaction Output
|
|
6
|
+
* @cathegory Bitcoin
|
|
7
|
+
*/
|
|
8
|
+
export class UTXO implements IUTXO {
|
|
9
|
+
public readonly transactionId: string;
|
|
10
|
+
public readonly outputIndex: number;
|
|
11
|
+
public readonly value: bigint;
|
|
12
|
+
public readonly scriptPubKey: ScriptPubKey;
|
|
13
|
+
|
|
14
|
+
public constructor(iUTXO: IUTXO) {
|
|
15
|
+
this.transactionId = iUTXO.transactionId;
|
|
16
|
+
this.outputIndex = iUTXO.outputIndex;
|
|
17
|
+
|
|
18
|
+
this.value = BigInt(iUTXO.value);
|
|
19
|
+
|
|
20
|
+
this.scriptPubKey = iUTXO.scriptPubKey;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Array of Unspent Transaction Outputs
|
|
26
|
+
* @cathegory Bitcoin
|
|
27
|
+
*/
|
|
28
|
+
export type UTXOs = UTXO[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ScriptPubKey } from '@btc-vision/bsi-bitcoin-rpc';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Unspent Transaction Output
|
|
5
|
+
* @cathegory Interfaces
|
|
6
|
+
*/
|
|
7
|
+
export interface IUTXO {
|
|
8
|
+
readonly transactionId: string;
|
|
9
|
+
readonly outputIndex: number;
|
|
10
|
+
readonly value: bigint | string;
|
|
11
|
+
readonly scriptPubKey: ScriptPubKey;
|
|
12
|
+
}
|
package/src/block/Block.ts
CHANGED
|
@@ -5,6 +5,11 @@ import { TransactionBase } from '../transactions/Transaction.js';
|
|
|
5
5
|
import { TransactionParser } from '../transactions/TransactionParser.js';
|
|
6
6
|
import { BlockHeaderChecksumProof, IBlock } from './interfaces/IBlock.js';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @description This class is used to represent a block.
|
|
10
|
+
* @class Block
|
|
11
|
+
* @category Block
|
|
12
|
+
*/
|
|
8
13
|
export class Block implements IBlock {
|
|
9
14
|
public readonly height: BigNumberish;
|
|
10
15
|
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
import { BigNumberish } from 'ethers';
|
|
2
|
-
import { OPNetTransactionTypes } from '../../interfaces/opnet/OPNetTransactionTypes.js';
|
|
3
|
-
import { ITransaction } from '../../transactions/interfaces/ITransaction.js';
|
|
4
|
-
import { TransactionBase } from '../../transactions/Transaction.js';
|
|
5
|
-
|
|
6
|
-
export type BlockHeaderChecksumProof = Array<[number, string[]]>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
1
|
+
import { BigNumberish } from 'ethers';
|
|
2
|
+
import { OPNetTransactionTypes } from '../../interfaces/opnet/OPNetTransactionTypes.js';
|
|
3
|
+
import { ITransaction } from '../../transactions/interfaces/ITransaction.js';
|
|
4
|
+
import { TransactionBase } from '../../transactions/Transaction.js';
|
|
5
|
+
|
|
6
|
+
export type BlockHeaderChecksumProof = Array<[number, string[]]>;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @description This interface is used to define the common properties of a block.
|
|
10
|
+
* @cathegory Raw
|
|
11
|
+
*/
|
|
12
|
+
export interface IBlockCommon {
|
|
13
|
+
height: string | BigNumberish;
|
|
14
|
+
hash: string;
|
|
15
|
+
|
|
16
|
+
previousBlockHash: string;
|
|
17
|
+
previousBlockChecksum: string;
|
|
18
|
+
|
|
19
|
+
bits: string;
|
|
20
|
+
nonce: number;
|
|
21
|
+
version: number;
|
|
22
|
+
size: number;
|
|
23
|
+
txCount: number;
|
|
24
|
+
|
|
25
|
+
weight: number;
|
|
26
|
+
strippedSize: number;
|
|
27
|
+
|
|
28
|
+
time: number;
|
|
29
|
+
medianTime: number;
|
|
30
|
+
|
|
31
|
+
/** Allows us to verify that the block is correct and not regenerated. */
|
|
32
|
+
checksumRoot: string;
|
|
33
|
+
merkleRoot: string;
|
|
34
|
+
storageRoot: string;
|
|
35
|
+
receiptRoot: string;
|
|
36
|
+
|
|
37
|
+
checksumProofs: BlockHeaderChecksumProof;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description This interface is used to define the properties of a block.
|
|
42
|
+
* @cathegory Raw
|
|
43
|
+
*/
|
|
44
|
+
export interface IBlock extends IBlockCommon {
|
|
45
|
+
transactions?: ITransaction[] | TransactionBase<OPNetTransactionTypes>[];
|
|
46
|
+
}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import { BitcoinAddress } from '../bitcoin/BitcoinAddress.js';
|
|
2
|
-
|
|
3
|
-
export type BitcoinAddressLike = string | BitcoinAddress;
|
|
4
|
-
export type PointerLike = bigint | string;
|
|
1
|
+
import { BitcoinAddress } from '../bitcoin/BitcoinAddress.js';
|
|
2
|
+
|
|
3
|
+
export type BitcoinAddressLike = string | BitcoinAddress;
|
|
4
|
+
export type PointerLike = bigint | string;
|
|
5
|
+
|
|
6
|
+
export type DecodedCallResult =
|
|
7
|
+
| bigint
|
|
8
|
+
| string
|
|
9
|
+
| boolean
|
|
10
|
+
| number
|
|
11
|
+
| Uint8Array
|
|
12
|
+
| Array<bigint>
|
|
13
|
+
| Array<string>
|
|
14
|
+
| Array<boolean>
|
|
15
|
+
| Array<number>
|
|
16
|
+
| Array<Uint8Array>;
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import { NetEvent } from '@btc-vision/bsi-binary';
|
|
2
|
-
import {
|
|
3
|
-
import { IAccessList } from './interfaces/IAccessList.js';
|
|
4
|
-
import { ICallResultData } from './interfaces/ICallResult.js';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { BinaryReader, BufferHelper, NetEvent } from '@btc-vision/bsi-binary';
|
|
2
|
+
import { DecodedCallResult } from '../common/CommonTypes.js';
|
|
3
|
+
import { IAccessList } from './interfaces/IAccessList.js';
|
|
4
|
+
import { ICallResultData } from './interfaces/ICallResult.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the result of a contract call.
|
|
8
|
+
* @category Contracts
|
|
9
|
+
*/
|
|
10
|
+
export class CallResult implements ICallResultData {
|
|
11
|
+
public readonly result: BinaryReader;
|
|
12
|
+
public readonly events: NetEvent[];
|
|
13
|
+
public readonly accessList: IAccessList;
|
|
14
|
+
|
|
15
|
+
public readonly decoded: Array<DecodedCallResult> = [];
|
|
16
|
+
|
|
17
|
+
constructor(iCallResult: ICallResultData) {
|
|
18
|
+
this.events = iCallResult.events;
|
|
19
|
+
this.accessList = iCallResult.accessList;
|
|
20
|
+
|
|
21
|
+
this.result =
|
|
22
|
+
typeof iCallResult.result === 'string'
|
|
23
|
+
? new BinaryReader(this.base64ToUint8Array(iCallResult.result))
|
|
24
|
+
: iCallResult.result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public setDecoded(decoded: Array<DecodedCallResult>): void {
|
|
28
|
+
this.decoded.push(...decoded);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private base64ToUint8Array(base64: string): Uint8Array {
|
|
32
|
+
return BufferHelper.bufferToUint8Array(Buffer.from(base64, 'base64'));
|
|
33
|
+
}
|
|
34
|
+
}
|