opnet 1.0.49 → 1.0.50
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 +8 -7
- package/.github/ISSUE_TEMPLATE/bug_report.md +38 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -20
- package/.github/workflows/ci.yml +48 -0
- package/.prettierrc.json +11 -11
- package/CONTRIBUTING.md +71 -71
- package/LICENSE.md +16 -16
- package/README.md +96 -93
- package/STAKING.md +60 -70
- package/browser/_version.d.ts +1 -1
- package/browser/bitcoin/BitcoinAddress.d.ts +0 -1
- package/browser/contracts/CallResult.d.ts +0 -1
- package/browser/contracts/Contract.d.ts +0 -1
- package/browser/contracts/ContractData.d.ts +0 -1
- package/browser/contracts/interfaces/IContract.d.ts +0 -1
- package/browser/contracts/interfaces/IRawContract.d.ts +0 -1
- package/browser/crypto/crypto.d.ts +0 -1
- package/browser/index.js +2 -2
- package/browser/providers/AbstractRpcProvider.d.ts +47 -48
- package/browser/providers/JSONRpcProvider.d.ts +10 -10
- package/browser/storage/StoredValue.d.ts +0 -1
- package/browser/storage/interfaces/IStorageValue.d.ts +0 -1
- package/browser/transactions/decoders/DeploymentTransaction.d.ts +0 -1
- package/browser/transactions/decoders/InteractionTransaction.d.ts +0 -1
- package/browser/transactions/interfaces/ITransaction.d.ts +0 -1
- package/browser/transactions/interfaces/ITransactionReceipt.d.ts +0 -1
- package/browser/transactions/interfaces/transactions/IDeploymentTransaction.d.ts +0 -1
- package/browser/transactions/interfaces/transactions/IInteractionTransaction.d.ts +0 -1
- package/browser/transactions/interfaces/transactions/IUnwrapTransaction.d.ts +0 -1
- package/browser/transactions/metadata/TransactionOutput.d.ts +0 -1
- package/browser/transactions/metadata/TransactionReceipt.d.ts +0 -1
- package/build/abi/BitcoinInterface.js +0 -1
- package/build/bitcoin/BitcoinAddress.d.ts +0 -1
- package/build/bitcoin/BitcoinAddress.js +30 -19
- package/build/bitcoin/UTXOs.js +0 -4
- package/build/block/Block.js +1 -19
- package/build/contracts/CallResult.d.ts +0 -1
- package/build/contracts/CallResult.js +2 -7
- package/build/contracts/Contract.d.ts +0 -1
- package/build/contracts/Contract.js +1 -6
- package/build/contracts/ContractData.d.ts +0 -1
- package/build/contracts/ContractData.js +0 -11
- package/build/contracts/OPNetEvent.js +2 -5
- package/build/contracts/interfaces/IContract.d.ts +0 -1
- package/build/contracts/interfaces/IRawContract.d.ts +0 -1
- package/build/crypto/crypto.d.ts +0 -1
- package/build/providers/AbstractRpcProvider.d.ts +0 -1
- package/build/providers/AbstractRpcProvider.js +3 -4
- package/build/providers/JSONRpcProvider.js +1 -3
- package/build/providers/WebsocketRpcProvider.js +0 -1
- package/build/storage/StoredValue.d.ts +0 -1
- package/build/storage/StoredValue.js +0 -4
- package/build/storage/interfaces/IStorageValue.d.ts +0 -1
- package/build/transactions/Transaction.js +0 -8
- package/build/transactions/decoders/DeploymentTransaction.d.ts +0 -1
- package/build/transactions/decoders/DeploymentTransaction.js +0 -10
- package/build/transactions/decoders/InteractionTransaction.d.ts +0 -1
- package/build/transactions/decoders/InteractionTransaction.js +0 -7
- package/build/transactions/decoders/UnwrapTransaction.js +0 -5
- package/build/transactions/decoders/WrapTransaction.js +0 -7
- package/build/transactions/interfaces/ITransaction.d.ts +0 -1
- package/build/transactions/interfaces/ITransactionReceipt.d.ts +0 -1
- package/build/transactions/interfaces/transactions/IDeploymentTransaction.d.ts +0 -1
- package/build/transactions/interfaces/transactions/IInteractionTransaction.d.ts +0 -1
- package/build/transactions/interfaces/transactions/IUnwrapTransaction.d.ts +0 -1
- package/build/transactions/metadata/TransactionInput.js +1 -5
- package/build/transactions/metadata/TransactionOutput.d.ts +0 -1
- package/build/transactions/metadata/TransactionOutput.js +0 -4
- package/build/transactions/metadata/TransactionReceipt.d.ts +0 -1
- package/build/transactions/metadata/TransactionReceipt.js +0 -4
- package/cjs/package.json +3 -3
- package/docs/assets/highlight.css +92 -92
- package/docs/classes/AbstractRpcProvider.html +334 -334
- package/docs/classes/BaseContract.html +198 -198
- package/docs/classes/BitcoinAddress.html +192 -192
- package/docs/classes/BitcoinInterface.html +182 -182
- package/docs/classes/BitcoinUtils.html +182 -182
- package/docs/classes/Block.html +196 -196
- package/docs/classes/CallResult.html +185 -185
- package/docs/classes/ContractData.html +187 -187
- package/docs/classes/DeploymentTransaction.html +220 -220
- package/docs/classes/GenericTransaction.html +200 -200
- package/docs/classes/IBaseContract.html +203 -203
- package/docs/classes/InteractionTransaction.html +213 -213
- package/docs/classes/JSONRpcProvider.html +332 -332
- package/docs/classes/OPNetEvent.html +181 -181
- package/docs/classes/StoredValue.html +181 -181
- package/docs/classes/TransactionBase.html +200 -200
- package/docs/classes/TransactionInput.html +180 -180
- package/docs/classes/TransactionOutput.html +180 -180
- package/docs/classes/TransactionParser.html +177 -177
- package/docs/classes/TransactionReceipt.html +187 -187
- package/docs/classes/UTXO.html +180 -180
- package/docs/classes/UnwrapTransaction.html +224 -224
- package/docs/classes/WebSocketRpcProvider.html +329 -329
- package/docs/classes/WrapTransaction.html +228 -228
- package/docs/enums/ABIDataTypes.html +193 -193
- package/docs/enums/BitcoinAbiTypes.html +177 -177
- package/docs/enums/GenerateTarget.html +174 -174
- package/docs/enums/JSONRPCErrorCode.html +183 -183
- package/docs/enums/JSONRPCErrorHttpCodes.html +183 -183
- package/docs/enums/JSONRpcMethods.html +196 -196
- package/docs/enums/OPNetTransactionTypes.html +178 -178
- package/docs/functions/getContract.html +182 -182
- package/docs/hierarchy.html +173 -173
- package/docs/index.html +218 -218
- package/docs/interfaces/BaseContractProperties.html +180 -180
- package/docs/interfaces/BitcoinAbiValue.html +179 -179
- package/docs/interfaces/BitcoinInterfaceAbiBase.html +177 -177
- package/docs/interfaces/BroadcastedTransaction.html +183 -183
- package/docs/interfaces/ContractEvents.html +173 -173
- package/docs/interfaces/EventBaseData.html +178 -178
- package/docs/interfaces/FunctionBaseData.html +181 -181
- package/docs/interfaces/IAccessList.html +175 -175
- package/docs/interfaces/IAccessListItem.html +175 -175
- package/docs/interfaces/IBlock.html +195 -195
- package/docs/interfaces/IBlockCommon.html +194 -194
- package/docs/interfaces/IBlockWitness.html +175 -175
- package/docs/interfaces/IBlockWitnessAPI.html +177 -177
- package/docs/interfaces/ICallRequestError.html +176 -176
- package/docs/interfaces/ICallResultData.html +179 -179
- package/docs/interfaces/ICommonTransaction.html +205 -205
- package/docs/interfaces/IContract.html +180 -180
- package/docs/interfaces/IDecodedEvent.html +177 -177
- package/docs/interfaces/IDeploymentTransaction.html +219 -219
- package/docs/interfaces/IGenericTransaction.html +199 -199
- package/docs/interfaces/IInteractionTransaction.html +213 -213
- package/docs/interfaces/IMotoContract.html +196 -196
- package/docs/interfaces/IMotoswapFactoryContract.html +193 -193
- package/docs/interfaces/IMotoswapPoolContract.html +208 -208
- package/docs/interfaces/IMotoswapRouterContract.html +227 -227
- package/docs/interfaces/IOP_20Contract.html +196 -196
- package/docs/interfaces/IOP_NETContract.html +183 -183
- package/docs/interfaces/IRawContract.html +187 -187
- package/docs/interfaces/IRawContractEvents.html +173 -173
- package/docs/interfaces/IStackingContract.html +183 -183
- package/docs/interfaces/IStorageValue.html +179 -179
- package/docs/interfaces/ITransactionBase.html +199 -199
- package/docs/interfaces/ITransactionInput.html +179 -179
- package/docs/interfaces/ITransactionOutput.html +177 -177
- package/docs/interfaces/ITransactionReceipt.html +183 -183
- package/docs/interfaces/IUTXO.html +179 -179
- package/docs/interfaces/IUnwrapTransaction.html +223 -223
- package/docs/interfaces/IWBTCContract.html +209 -209
- package/docs/interfaces/IWrapTransaction.html +227 -227
- package/docs/interfaces/JSONRpc2Request.html +177 -177
- package/docs/interfaces/JSONRpc2ResponseError.html +177 -177
- package/docs/interfaces/JSONRpc2ResponseResult.html +177 -177
- package/docs/interfaces/JSONRpc2ResultData.html +173 -173
- package/docs/interfaces/JSONRpcErrorData.html +173 -173
- package/docs/interfaces/JSONRpcParams.html +173 -173
- package/docs/interfaces/JSONRpcResultError.html +176 -176
- package/docs/interfaces/MergedOP_20AndStackingContract.html +201 -201
- package/docs/interfaces/NetEventDocument.html +182 -182
- package/docs/interfaces/ParsedPartialWBTCUTXODocument.html +178 -178
- package/docs/interfaces/PartialWBTCUTXODocument.html +178 -178
- package/docs/interfaces/ReorgInformation.html +176 -176
- package/docs/interfaces/UsedUTXO.html +175 -175
- package/docs/modules.html +296 -296
- package/docs/types/BaseContractProperty.html +175 -175
- package/docs/types/BigNumberish.html +173 -173
- package/docs/types/BitcoinAddressLike.html +173 -173
- package/docs/types/BitcoinInterfaceAbi.html +173 -173
- package/docs/types/BlockHeaderChecksumProof.html +173 -173
- package/docs/types/BlockTag.html +173 -173
- package/docs/types/BlockWitnesses.html +173 -173
- package/docs/types/ContractDecodedObjectResult.html +173 -173
- package/docs/types/DecodedCallResult.html +173 -173
- package/docs/types/DecodedOutput.html +173 -173
- package/docs/types/GenerationParameters.html +173 -173
- package/docs/types/ICallResult.html +174 -174
- package/docs/types/ITransaction.html +174 -174
- package/docs/types/InteractionType.html +173 -173
- package/docs/types/JSONRpc2RequestParams.html +173 -173
- package/docs/types/JSONRpc2Result.html +173 -173
- package/docs/types/JSONRpcId.html +173 -173
- package/docs/types/JsonRpcCallResult.html +173 -173
- package/docs/types/JsonRpcError.html +173 -173
- package/docs/types/JsonRpcPayload.html +173 -173
- package/docs/types/JsonRpcResult.html +173 -173
- package/docs/types/Numeric.html +173 -173
- package/docs/types/PointerLike.html +173 -173
- package/docs/types/RawContractEvents.html +173 -173
- package/docs/types/UTXOs.html +175 -175
- package/docs/variables/MOTOSWAP_ROUTER_ABI.html +173 -173
- package/docs/variables/MOTO_TOKEN_ABI.html +173 -173
- package/docs/variables/MotoSwapFactoryAbi.html +173 -173
- package/docs/variables/MotoSwapFactoryEvents.html +173 -173
- package/docs/variables/MotoSwapPoolEvents.html +173 -173
- package/docs/variables/MotoswapPoolAbi.html +173 -173
- package/docs/variables/OP20Events.html +173 -173
- package/docs/variables/OP_20_ABI.html +173 -173
- package/docs/variables/OP_NET_ABI.html +173 -173
- package/docs/variables/STAKING_ABI.html +173 -173
- package/docs/variables/StackingEvents.html +173 -173
- package/docs/variables/WBTCEvents.html +173 -173
- package/docs/variables/WBTC_ABI.html +173 -173
- package/docs/variables/version.html +173 -173
- package/gulpfile.js +49 -120
- package/package.json +111 -109
- package/src/_version.ts +1 -1
- package/src/abi/shared/json/MOTOSWAP_POOL_ABI.ts +299 -299
- package/src/contracts/Contract.ts +600 -600
- package/src/crypto/crypto.ts +1 -1
- package/src/providers/AbstractRpcProvider.ts +602 -602
- package/src/providers/JSONRpcProvider.ts +81 -81
- package/src/serialize/BigInt.ts +15 -15
- package/tsconfig.base.json +43 -43
- package/tsconfig.json +15 -8
- package/tsconfig.webpack.json +19 -19
- package/.github/workflows/node.js.yml +0 -21
- package/.idea/bsc.iml +0 -14
- package/.idea/bsi-binary.iml +0 -14
- package/.idea/codeStyles/Project.xml +0 -101
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -7
- package/.idea/markdown.xml +0 -7
- package/.idea/modules.xml +0 -8
- package/.idea/motoswap.iml +0 -12
- package/.idea/opnet.iml +0 -17
- package/.idea/prettier.xml +0 -7
- package/.idea/vcs.xml +0 -6
- package/browser/crypto/crypto-browser.d.ts +0 -40
- package/browser/generator/WrappedGenerationParameters.d.ts +0 -9
- package/browser/scripts/ITestContract.d.ts +0 -22
- package/browser/scripts/block.d.ts +0 -1
- package/browser/scripts/test.d.ts +0 -1
- package/browser/scripts/testContract.d.ts +0 -1
- package/browser/scripts/testMethods.d.ts +0 -1
- package/browser/scripts/testMethodsReg.d.ts +0 -1
- package/browser/scripts/testWBTCContract.d.ts +0 -1
- package/browser/transactions/DeploymentTransaction.d.ts +0 -16
- package/browser/transactions/GenericTransaction.d.ts +0 -6
- package/browser/transactions/InteractionTransaction.d.ts +0 -15
- package/browser/transactions/TransactionInput.d.ts +0 -16
- package/browser/transactions/TransactionOutput.d.ts +0 -19
- package/browser/transactions/TransactionReceipt.d.ts +0 -11
- package/build/abi/BitcoinInterfaceAbi.d.ts +0 -3
- package/build/abi/BitcoinInterfaceAbi.js +0 -1
- package/build/abi/enums/ParamTypes.d.ts +0 -0
- package/build/abi/enums/ParamTypes.js +0 -1
- package/build/abi/interface/BitcoinInterface.d.ts +0 -6
- package/build/abi/interface/BitcoinInterface.js +0 -12
- package/build/abi/interface/BitcoinInterfaceAbi.d.ts +0 -3
- package/build/abi/interface/BitcoinInterfaceAbi.js +0 -1
- package/build/abi/interfaces/BaseContractProperty.d.ts +0 -2
- package/build/abi/interfaces/BaseContractProperty.js +0 -1
- package/build/abi/interfaces/BitcoinAbiInput.d.ts +0 -5
- package/build/abi/interfaces/BitcoinAbiInput.js +0 -1
- package/build/abi/shared/MOTOSWAP_FACTORY_ABI.d.ts +0 -2
- package/build/abi/shared/MOTOSWAP_FACTORY_ABI.js +0 -68
- package/build/abi/shared/OP_20_ABI.d.ts +0 -2
- package/build/abi/shared/OP_20_ABI.js +0 -235
- package/build/abi/shared/OP_NET_ABI.d.ts +0 -2
- package/build/abi/shared/OP_NET_ABI.js +0 -31
- package/build/abi/shared/STAKING_ABI.d.ts +0 -2
- package/build/abi/shared/STAKING_ABI.js +0 -96
- package/build/abi/shared/WBTC_ABI.d.ts +0 -2
- package/build/abi/shared/WBTC_ABI.js +0 -40
- package/build/bitcoin/UXTOs.d.ts +0 -7
- package/build/bitcoin/UXTOs.js +0 -1
- package/build/block/index.d.ts +0 -2
- package/build/block/index.js +0 -1
- package/build/contracts/DecodedEvent.d.ts +0 -15
- package/build/contracts/DecodedEvent.js +0 -18
- package/build/contracts/IRawContract.d.ts +0 -13
- package/build/contracts/IRawContract.js +0 -1
- package/build/crypto/crypto-browser.d.ts +0 -0
- package/build/crypto/crypto-browser.js +0 -47
- package/build/generator/WrappedGenerationParameters.d.ts +0 -9
- package/build/generator/WrappedGenerationParameters.js +0 -14
- package/build/interface/BitcoinInterface.d.ts +0 -6
- package/build/interface/BitcoinInterface.js +0 -12
- package/build/interface/BitcoinInterfaceAbi.d.ts +0 -3
- package/build/interface/BitcoinInterfaceAbi.js +0 -1
- package/build/interface/Interface.d.ts +0 -2
- package/build/interface/Interface.js +0 -2
- package/build/interface.d.ts +0 -0
- package/build/interface.js +0 -1
- package/build/interfaces/Block.d.ts +0 -0
- package/build/interfaces/Block.js +0 -1
- package/build/interfaces/IBlock.d.ts +0 -0
- package/build/interfaces/IBlock.js +0 -1
- package/build/interfaces/blocks/IBlock.d.ts +0 -28
- package/build/interfaces/blocks/IBlock.js +0 -1
- package/build/interfaces/transactions/ITransaction.d.ts +0 -39
- package/build/interfaces/transactions/ITransaction.js +0 -1
- package/build/providers/index.d.ts +0 -4
- package/build/providers/index.js +0 -4
- package/build/providers/interfaces/GenerateResult.d.ts +0 -0
- package/build/providers/interfaces/GenerateResult.js +0 -1
- package/build/scripts/ITestContract.d.ts +0 -18
- package/build/scripts/ITestContract.js +0 -1
- package/build/scripts/block.d.ts +0 -1
- package/build/scripts/block.js +0 -13
- package/build/scripts/test.d.ts +0 -1
- package/build/scripts/test.js +0 -24
- package/build/scripts/testContract.d.ts +0 -1
- package/build/scripts/testContract.js +0 -11
- package/build/scripts/testMethods.d.ts +0 -1
- package/build/scripts/testMethods.js +0 -11
- package/build/scripts/testMethodsReg.d.ts +0 -1
- package/build/scripts/testMethodsReg.js +0 -8
- package/build/scripts/testWBTCContract.d.ts +0 -1
- package/build/scripts/testWBTCContract.js +0 -11
- package/build/storage/interfaces/IStorage.d.ts +0 -7
- package/build/storage/interfaces/IStorage.js +0 -1
- package/build/transactions/DeploymentTransaction.d.ts +0 -16
- package/build/transactions/DeploymentTransaction.js +0 -24
- package/build/transactions/GenericTransaction.d.ts +0 -6
- package/build/transactions/GenericTransaction.js +0 -6
- package/build/transactions/InteractionTransaction.d.ts +0 -15
- package/build/transactions/InteractionTransaction.js +0 -21
- package/build/transactions/TransactionInput.d.ts +0 -16
- package/build/transactions/TransactionInput.js +0 -14
- package/build/transactions/TransactionOutput.d.ts +0 -19
- package/build/transactions/TransactionOutput.js +0 -16
- package/build/transactions/TransactionReceipt.d.ts +0 -11
- package/build/transactions/TransactionReceipt.js +0 -53
- package/build/transactions/decoders/WrapInteractionTransaction.d.ts +0 -15
- package/build/transactions/decoders/WrapInteractionTransaction.js +0 -21
- package/build/transactions/index.d.ts +0 -6
- package/build/transactions/index.js +0 -6
- package/build/transactions/interfaces/IWrapTransaction.d.ts +0 -3
- package/build/transactions/interfaces/IWrapTransaction.js +0 -1
- package/build/transactions/types/DeploymentTransaction.d.ts +0 -16
- package/build/transactions/types/DeploymentTransaction.js +0 -24
- package/build/transactions/types/GenericTransaction.d.ts +0 -6
- package/build/transactions/types/GenericTransaction.js +0 -6
- package/build/transactions/types/InteractionTransaction.d.ts +0 -15
- package/build/transactions/types/InteractionTransaction.js +0 -21
- package/cjs/_version.d.ts +0 -1
- package/cjs/_version.js +0 -4
- package/cjs/abi/BaseContractProperty.d.ts +0 -3
- package/cjs/abi/BaseContractProperty.js +0 -2
- package/cjs/abi/BitcoinAbiTypes.d.ts +0 -4
- package/cjs/abi/BitcoinAbiTypes.js +0 -8
- package/cjs/abi/BitcoinInterface.d.ts +0 -10
- package/cjs/abi/BitcoinInterface.js +0 -60
- package/cjs/abi/interfaces/BaseContractProperties.d.ts +0 -5
- package/cjs/abi/interfaces/BaseContractProperties.js +0 -2
- package/cjs/abi/interfaces/BitcoinAbiValue.d.ts +0 -5
- package/cjs/abi/interfaces/BitcoinAbiValue.js +0 -2
- package/cjs/abi/interfaces/BitcoinInterfaceAbi.d.ts +0 -16
- package/cjs/abi/interfaces/BitcoinInterfaceAbi.js +0 -2
- package/cjs/abi/shared/interfaces/IMotoContract.d.ts +0 -6
- package/cjs/abi/shared/interfaces/IMotoContract.js +0 -2
- package/cjs/abi/shared/interfaces/IMotoswapFactoryContract.d.ts +0 -7
- package/cjs/abi/shared/interfaces/IMotoswapFactoryContract.js +0 -2
- package/cjs/abi/shared/interfaces/IMotoswapPoolContract.d.ts +0 -13
- package/cjs/abi/shared/interfaces/IMotoswapPoolContract.js +0 -2
- package/cjs/abi/shared/interfaces/IMotoswapRouterContract.d.ts +0 -15
- package/cjs/abi/shared/interfaces/IMotoswapRouterContract.js +0 -2
- package/cjs/abi/shared/interfaces/IOP_20Contract.d.ts +0 -16
- package/cjs/abi/shared/interfaces/IOP_20Contract.js +0 -2
- package/cjs/abi/shared/interfaces/IOP_NETContract.d.ts +0 -7
- package/cjs/abi/shared/interfaces/IOP_NETContract.js +0 -2
- package/cjs/abi/shared/interfaces/IStackingContract.d.ts +0 -11
- package/cjs/abi/shared/interfaces/IStackingContract.js +0 -2
- package/cjs/abi/shared/interfaces/IWBTCContract.d.ts +0 -8
- package/cjs/abi/shared/interfaces/IWBTCContract.js +0 -2
- package/cjs/abi/shared/json/MOTOSWAP_FACTORY_ABI.d.ts +0 -3
- package/cjs/abi/shared/json/MOTOSWAP_FACTORY_ABI.js +0 -74
- package/cjs/abi/shared/json/MOTOSWAP_POOL_ABI.d.ts +0 -3
- package/cjs/abi/shared/json/MOTOSWAP_POOL_ABI.js +0 -280
- package/cjs/abi/shared/json/MOTOSWAP_ROUTER_ABI.d.ts +0 -2
- package/cjs/abi/shared/json/MOTOSWAP_ROUTER_ABI.js +0 -277
- package/cjs/abi/shared/json/MOTO_TOKEN_ABI.d.ts +0 -2
- package/cjs/abi/shared/json/MOTO_TOKEN_ABI.js +0 -25
- package/cjs/abi/shared/json/OP_20_ABI.d.ts +0 -3
- package/cjs/abi/shared/json/OP_20_ABI.js +0 -270
- package/cjs/abi/shared/json/OP_NET_ABI.d.ts +0 -2
- package/cjs/abi/shared/json/OP_NET_ABI.js +0 -34
- package/cjs/abi/shared/json/STAKING_ABI.d.ts +0 -3
- package/cjs/abi/shared/json/STAKING_ABI.js +0 -132
- package/cjs/abi/shared/json/WBTC_ABI.d.ts +0 -3
- package/cjs/abi/shared/json/WBTC_ABI.js +0 -60
- package/cjs/bitcoin/BitcoinAddress.d.ts +0 -20
- package/cjs/bitcoin/BitcoinAddress.js +0 -116
- package/cjs/bitcoin/UTXOs.d.ts +0 -10
- package/cjs/bitcoin/UTXOs.js +0 -16
- package/cjs/bitcoin/interfaces/IUTXO.d.ts +0 -7
- package/cjs/bitcoin/interfaces/IUTXO.js +0 -2
- package/cjs/block/Block.d.ts +0 -26
- package/cjs/block/Block.js +0 -47
- package/cjs/block/interfaces/BlockWitness.d.ts +0 -11
- package/cjs/block/interfaces/BlockWitness.js +0 -2
- package/cjs/block/interfaces/IBlock.d.ts +0 -28
- package/cjs/block/interfaces/IBlock.js +0 -2
- package/cjs/common/CommonTypes.d.ts +0 -8
- package/cjs/common/CommonTypes.js +0 -2
- package/cjs/contracts/CallResult.d.ts +0 -19
- package/cjs/contracts/CallResult.js +0 -35
- package/cjs/contracts/Contract.d.ts +0 -44
- package/cjs/contracts/Contract.js +0 -398
- package/cjs/contracts/ContractData.d.ts +0 -17
- package/cjs/contracts/ContractData.js +0 -38
- package/cjs/contracts/OPNetEvent.d.ts +0 -15
- package/cjs/contracts/OPNetEvent.js +0 -22
- package/cjs/contracts/interfaces/IAccessList.d.ts +0 -6
- package/cjs/contracts/interfaces/IAccessList.js +0 -2
- package/cjs/contracts/interfaces/ICallResult.d.ts +0 -12
- package/cjs/contracts/interfaces/ICallResult.js +0 -2
- package/cjs/contracts/interfaces/IContract.d.ts +0 -12
- package/cjs/contracts/interfaces/IContract.js +0 -2
- package/cjs/contracts/interfaces/IRawContract.d.ts +0 -15
- package/cjs/contracts/interfaces/IRawContract.js +0 -2
- package/cjs/crypto/crypto.d.ts +0 -2
- package/cjs/crypto/crypto.js +0 -8
- package/cjs/index.d.ts +0 -3
- package/cjs/index.js +0 -32
- package/cjs/interfaces/opnet/OPNetTransactionTypes.d.ts +0 -8
- package/cjs/interfaces/opnet/OPNetTransactionTypes.js +0 -11
- package/cjs/opnet.d.ts +0 -70
- package/cjs/opnet.js +0 -89
- package/cjs/providers/AbstractRpcProvider.d.ts +0 -48
- package/cjs/providers/AbstractRpcProvider.js +0 -277
- package/cjs/providers/JSONRpcProvider.d.ts +0 -10
- package/cjs/providers/JSONRpcProvider.js +0 -59
- package/cjs/providers/WebsocketRpcProvider.d.ts +0 -9
- package/cjs/providers/WebsocketRpcProvider.js +0 -27
- package/cjs/providers/interfaces/Generate.d.ts +0 -5
- package/cjs/providers/interfaces/Generate.js +0 -7
- package/cjs/providers/interfaces/JSONRpc.d.ts +0 -11
- package/cjs/providers/interfaces/JSONRpc.js +0 -2
- package/cjs/providers/interfaces/JSONRpcMethods.d.ts +0 -17
- package/cjs/providers/interfaces/JSONRpcMethods.js +0 -21
- package/cjs/providers/interfaces/JSONRpcParams.d.ts +0 -3
- package/cjs/providers/interfaces/JSONRpcParams.js +0 -2
- package/cjs/providers/interfaces/JSONRpcResult.d.ts +0 -51
- package/cjs/providers/interfaces/JSONRpcResult.js +0 -29
- package/cjs/providers/interfaces/ReorgInformation.d.ts +0 -5
- package/cjs/providers/interfaces/ReorgInformation.js +0 -2
- package/cjs/serialize/BigInt.d.ts +0 -6
- package/cjs/serialize/BigInt.js +0 -5
- package/cjs/storage/StoredValue.d.ts +0 -10
- package/cjs/storage/StoredValue.js +0 -28
- package/cjs/storage/interfaces/IStorageValue.d.ts +0 -8
- package/cjs/storage/interfaces/IStorageValue.js +0 -2
- package/cjs/transactions/Transaction.d.ts +0 -17
- package/cjs/transactions/Transaction.js +0 -33
- package/cjs/transactions/TransactionParser.d.ts +0 -7
- package/cjs/transactions/TransactionParser.js +0 -43
- package/cjs/transactions/decoders/DeploymentTransaction.d.ts +0 -17
- package/cjs/transactions/decoders/DeploymentTransaction.js +0 -30
- package/cjs/transactions/decoders/GenericTransaction.d.ts +0 -6
- package/cjs/transactions/decoders/GenericTransaction.js +0 -10
- package/cjs/transactions/decoders/InteractionTransaction.d.ts +0 -15
- package/cjs/transactions/decoders/InteractionTransaction.js +0 -25
- package/cjs/transactions/decoders/UnwrapTransaction.d.ts +0 -11
- package/cjs/transactions/decoders/UnwrapTransaction.js +0 -33
- package/cjs/transactions/decoders/WrapTransaction.d.ts +0 -15
- package/cjs/transactions/decoders/WrapTransaction.js +0 -34
- package/cjs/transactions/interfaces/BroadcastedTransaction.d.ts +0 -7
- package/cjs/transactions/interfaces/BroadcastedTransaction.js +0 -2
- package/cjs/transactions/interfaces/ITransaction.d.ts +0 -23
- package/cjs/transactions/interfaces/ITransaction.js +0 -2
- package/cjs/transactions/interfaces/ITransactionReceipt.d.ts +0 -21
- package/cjs/transactions/interfaces/ITransactionReceipt.js +0 -2
- package/cjs/transactions/interfaces/transactions/ICommonTransaction.d.ts +0 -7
- package/cjs/transactions/interfaces/transactions/ICommonTransaction.js +0 -2
- package/cjs/transactions/interfaces/transactions/IDeploymentTransaction.d.ts +0 -13
- package/cjs/transactions/interfaces/transactions/IDeploymentTransaction.js +0 -2
- package/cjs/transactions/interfaces/transactions/IInteractionTransaction.d.ts +0 -14
- package/cjs/transactions/interfaces/transactions/IInteractionTransaction.js +0 -2
- package/cjs/transactions/interfaces/transactions/IUnwrapTransaction.d.ts +0 -28
- package/cjs/transactions/interfaces/transactions/IUnwrapTransaction.js +0 -2
- package/cjs/transactions/interfaces/transactions/IWrapTransaction.d.ts +0 -10
- package/cjs/transactions/interfaces/transactions/IWrapTransaction.js +0 -2
- package/cjs/transactions/metadata/TransactionInput.d.ts +0 -16
- package/cjs/transactions/metadata/TransactionInput.js +0 -18
- package/cjs/transactions/metadata/TransactionOutput.d.ts +0 -19
- package/cjs/transactions/metadata/TransactionOutput.js +0 -20
- package/cjs/transactions/metadata/TransactionReceipt.d.ts +0 -11
- package/cjs/transactions/metadata/TransactionReceipt.js +0 -57
- package/cjs/utils/BitcoinUtils.d.ts +0 -4
- package/cjs/utils/BitcoinUtils.js +0 -14
- package/tsconfig.cjs.json +0 -9
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AbstractRpcProvider = void 0;
|
|
4
|
-
require("../serialize/BigInt.js");
|
|
5
|
-
const bsi_binary_1 = require("@btc-vision/bsi-binary");
|
|
6
|
-
const transaction_1 = require("@btc-vision/transaction");
|
|
7
|
-
const bitcoinjs_lib_1 = require("bitcoinjs-lib");
|
|
8
|
-
const UTXOs_js_1 = require("../bitcoin/UTXOs.js");
|
|
9
|
-
const Block_js_1 = require("../block/Block.js");
|
|
10
|
-
const CallResult_js_1 = require("../contracts/CallResult.js");
|
|
11
|
-
const ContractData_js_1 = require("../contracts/ContractData.js");
|
|
12
|
-
const StoredValue_js_1 = require("../storage/StoredValue.js");
|
|
13
|
-
const TransactionReceipt_js_1 = require("../transactions/metadata/TransactionReceipt.js");
|
|
14
|
-
const TransactionParser_js_1 = require("../transactions/TransactionParser.js");
|
|
15
|
-
const Generate_js_1 = require("./interfaces/Generate.js");
|
|
16
|
-
const JSONRpcMethods_js_1 = require("./interfaces/JSONRpcMethods.js");
|
|
17
|
-
class AbstractRpcProvider {
|
|
18
|
-
nextId = 0;
|
|
19
|
-
network;
|
|
20
|
-
chainId;
|
|
21
|
-
constructor() { }
|
|
22
|
-
async getBlockNumber() {
|
|
23
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.BLOCK_BY_NUMBER, []);
|
|
24
|
-
const rawBlockNumber = await this.callPayloadSingle(payload);
|
|
25
|
-
const result = rawBlockNumber.result;
|
|
26
|
-
return BigInt(result);
|
|
27
|
-
}
|
|
28
|
-
async getBlock(blockNumberOrHash, prefetchTxs = false) {
|
|
29
|
-
const method = typeof blockNumberOrHash === 'string'
|
|
30
|
-
? JSONRpcMethods_js_1.JSONRpcMethods.GET_BLOCK_BY_HASH
|
|
31
|
-
: JSONRpcMethods_js_1.JSONRpcMethods.GET_BLOCK_BY_NUMBER;
|
|
32
|
-
const payload = this.buildJsonRpcPayload(method, [
|
|
33
|
-
blockNumberOrHash,
|
|
34
|
-
prefetchTxs,
|
|
35
|
-
]);
|
|
36
|
-
const block = await this.callPayloadSingle(payload);
|
|
37
|
-
const result = block.result;
|
|
38
|
-
return new Block_js_1.Block(result);
|
|
39
|
-
}
|
|
40
|
-
async getBlocks(blockNumbers, prefetchTxs = false) {
|
|
41
|
-
const payloads = blockNumbers.map((blockNumber) => {
|
|
42
|
-
return this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_BLOCK_BY_NUMBER, [
|
|
43
|
-
blockNumber,
|
|
44
|
-
prefetchTxs,
|
|
45
|
-
]);
|
|
46
|
-
});
|
|
47
|
-
const blocks = await this.callMultiplePayloads(payloads);
|
|
48
|
-
if ('error' in blocks) {
|
|
49
|
-
const error = blocks.error;
|
|
50
|
-
throw new Error(`Error fetching block: ${error.message}`);
|
|
51
|
-
}
|
|
52
|
-
return blocks.map((block) => {
|
|
53
|
-
if ('error' in block) {
|
|
54
|
-
throw new Error(`Error fetching block: ${block.error}`);
|
|
55
|
-
}
|
|
56
|
-
const result = block.result;
|
|
57
|
-
return new Block_js_1.Block(result);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
async getBlockByHash(blockHash) {
|
|
61
|
-
return await this.getBlock(blockHash);
|
|
62
|
-
}
|
|
63
|
-
async getBalance(addressLike, filterOrdinals = true) {
|
|
64
|
-
const address = addressLike.toString();
|
|
65
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_BALANCE, [
|
|
66
|
-
address,
|
|
67
|
-
filterOrdinals
|
|
68
|
-
]);
|
|
69
|
-
const rawBalance = await this.callPayloadSingle(payload);
|
|
70
|
-
const result = rawBalance.result;
|
|
71
|
-
if (!result || (result && !result.startsWith('0x'))) {
|
|
72
|
-
throw new Error(`Invalid balance returned from provider: ${result}`);
|
|
73
|
-
}
|
|
74
|
-
return BigInt(result);
|
|
75
|
-
}
|
|
76
|
-
async getUXTOs(address, optimize = false) {
|
|
77
|
-
const addressStr = address.toString();
|
|
78
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_UTXOS, [
|
|
79
|
-
addressStr,
|
|
80
|
-
optimize,
|
|
81
|
-
]);
|
|
82
|
-
const rawUXTOs = await this.callPayloadSingle(payload);
|
|
83
|
-
const result = rawUXTOs.result || [];
|
|
84
|
-
return result.map((utxo) => {
|
|
85
|
-
return new UTXOs_js_1.UTXO(utxo);
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
async getTransaction(txHash) {
|
|
89
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_TRANSACTION_BY_HASH, [txHash]);
|
|
90
|
-
const rawTransaction = await this.callPayloadSingle(payload);
|
|
91
|
-
const result = rawTransaction.result;
|
|
92
|
-
if ('error' in rawTransaction) {
|
|
93
|
-
throw new Error(`Error fetching transaction: ${rawTransaction.error?.message || 'Unknown error'}`);
|
|
94
|
-
}
|
|
95
|
-
return TransactionParser_js_1.TransactionParser.parseTransaction(result);
|
|
96
|
-
}
|
|
97
|
-
async getTransactionReceipt(txHash) {
|
|
98
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_TRANSACTION_RECEIPT, [txHash]);
|
|
99
|
-
const rawTransaction = await this.callPayloadSingle(payload);
|
|
100
|
-
return new TransactionReceipt_js_1.TransactionReceipt(rawTransaction.result);
|
|
101
|
-
}
|
|
102
|
-
async getNetwork() {
|
|
103
|
-
if (this.network) {
|
|
104
|
-
return this.network;
|
|
105
|
-
}
|
|
106
|
-
const network = await this.getChainId();
|
|
107
|
-
switch (network) {
|
|
108
|
-
case 1n:
|
|
109
|
-
return bitcoinjs_lib_1.networks.bitcoin;
|
|
110
|
-
case 2n:
|
|
111
|
-
return bitcoinjs_lib_1.networks.testnet;
|
|
112
|
-
case 3n:
|
|
113
|
-
return bitcoinjs_lib_1.networks.regtest;
|
|
114
|
-
default:
|
|
115
|
-
throw new Error(`Invalid chain id: ${network}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
async getChainId() {
|
|
119
|
-
if (this.chainId !== undefined)
|
|
120
|
-
return this.chainId;
|
|
121
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.CHAIN_ID, []);
|
|
122
|
-
const rawChainId = await this.callPayloadSingle(payload);
|
|
123
|
-
if ('error' in rawChainId) {
|
|
124
|
-
throw new Error(`Something went wrong while fetching: ${rawChainId.error}`);
|
|
125
|
-
}
|
|
126
|
-
const chainId = rawChainId.result;
|
|
127
|
-
this.chainId = BigInt(chainId);
|
|
128
|
-
return this.chainId;
|
|
129
|
-
}
|
|
130
|
-
async getCode(address, onlyBytecode = false) {
|
|
131
|
-
const addressStr = address.toString();
|
|
132
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_CODE, [
|
|
133
|
-
addressStr,
|
|
134
|
-
onlyBytecode,
|
|
135
|
-
]);
|
|
136
|
-
const rawCode = await this.callPayloadSingle(payload);
|
|
137
|
-
if (rawCode.error) {
|
|
138
|
-
throw new Error(`${rawCode.error.code}: Something went wrong while fetching: ${rawCode.error.message}`);
|
|
139
|
-
}
|
|
140
|
-
const result = rawCode.result;
|
|
141
|
-
if ('contractAddress' in result) {
|
|
142
|
-
return new ContractData_js_1.ContractData(result);
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
return Buffer.from(result.bytecode, 'base64');
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
async getStorageAt(address, rawPointer, proofs = true, height) {
|
|
149
|
-
const addressStr = address.toString();
|
|
150
|
-
const pointer = typeof rawPointer === 'string' ? rawPointer : this.bigintToBase64(rawPointer);
|
|
151
|
-
const params = [addressStr, pointer, proofs];
|
|
152
|
-
if (height) {
|
|
153
|
-
params.push(height.toString());
|
|
154
|
-
}
|
|
155
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GET_STORAGE_AT, params);
|
|
156
|
-
const rawStorage = await this.callPayloadSingle(payload);
|
|
157
|
-
const result = rawStorage.result;
|
|
158
|
-
return new StoredValue_js_1.StoredValue(result);
|
|
159
|
-
}
|
|
160
|
-
async call(to, data, from, height) {
|
|
161
|
-
const toStr = to.toString();
|
|
162
|
-
const fromStr = from ? from.toString() : null;
|
|
163
|
-
let dataStr = Buffer.isBuffer(data) ? this.bufferToHex(data) : data;
|
|
164
|
-
if (dataStr.startsWith('0x')) {
|
|
165
|
-
dataStr = dataStr.slice(2);
|
|
166
|
-
}
|
|
167
|
-
const params = [toStr, dataStr];
|
|
168
|
-
if (fromStr) {
|
|
169
|
-
params.push(fromStr);
|
|
170
|
-
}
|
|
171
|
-
if (height) {
|
|
172
|
-
params.push(height.toString());
|
|
173
|
-
}
|
|
174
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.CALL, params);
|
|
175
|
-
const rawCall = await this.callPayloadSingle(payload);
|
|
176
|
-
const result = rawCall.result;
|
|
177
|
-
if ('error' in result) {
|
|
178
|
-
return result;
|
|
179
|
-
}
|
|
180
|
-
return new CallResult_js_1.CallResult(result);
|
|
181
|
-
}
|
|
182
|
-
async sendRawTransaction(tx, psbt) {
|
|
183
|
-
if (!/^[0-9A-Fa-f]+$/.test(tx)) {
|
|
184
|
-
throw new Error('sendRawTransaction: Invalid hex string');
|
|
185
|
-
}
|
|
186
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.BROADCAST_TRANSACTION, [tx, psbt]);
|
|
187
|
-
const rawTx = await this.callPayloadSingle(payload);
|
|
188
|
-
const result = rawTx.result;
|
|
189
|
-
if (result && result.identifier) {
|
|
190
|
-
return {
|
|
191
|
-
...result,
|
|
192
|
-
identifier: BigInt(result.identifier),
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
return result;
|
|
196
|
-
}
|
|
197
|
-
async getBlockWitness(height = -1, trusted, limit, page) {
|
|
198
|
-
const params = [height.toString()];
|
|
199
|
-
if (trusted !== undefined && trusted !== null)
|
|
200
|
-
params.push(trusted);
|
|
201
|
-
if (limit !== undefined && limit !== null)
|
|
202
|
-
params.push(limit);
|
|
203
|
-
if (page !== undefined && page !== null)
|
|
204
|
-
params.push(page);
|
|
205
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.BLOCK_WITNESS, params);
|
|
206
|
-
const rawWitnesses = await this.callPayloadSingle(payload);
|
|
207
|
-
const result = rawWitnesses.result;
|
|
208
|
-
for (let i = 0; i < result.length; i++) {
|
|
209
|
-
result[i].blockNumber = BigInt('0x' + result[i].blockNumber);
|
|
210
|
-
}
|
|
211
|
-
return result;
|
|
212
|
-
}
|
|
213
|
-
async getReorg(fromBlock, toBlock) {
|
|
214
|
-
const params = [];
|
|
215
|
-
if (fromBlock !== undefined && fromBlock !== null)
|
|
216
|
-
params.push(fromBlock.toString());
|
|
217
|
-
if (toBlock !== undefined && toBlock !== null)
|
|
218
|
-
params.push(toBlock.toString());
|
|
219
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.REORG, params);
|
|
220
|
-
const rawReorg = await this.callPayloadSingle(payload);
|
|
221
|
-
const result = rawReorg.result;
|
|
222
|
-
if (result.length > 0) {
|
|
223
|
-
for (let i = 0; i < result.length; i++) {
|
|
224
|
-
const res = result[i];
|
|
225
|
-
res.fromBlock = BigInt('0x' + res.fromBlock);
|
|
226
|
-
res.toBlock = BigInt('0x' + res.toBlock);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return result;
|
|
230
|
-
}
|
|
231
|
-
async requestTrustedPublicKeyForBitcoinWrapping(amount) {
|
|
232
|
-
const payload = this.buildJsonRpcPayload(JSONRpcMethods_js_1.JSONRpcMethods.GENERATE, [
|
|
233
|
-
Generate_js_1.GenerateTarget.WRAP,
|
|
234
|
-
amount.toString(),
|
|
235
|
-
]);
|
|
236
|
-
const rawPublicKey = await this.callPayloadSingle(payload);
|
|
237
|
-
const result = rawPublicKey.result;
|
|
238
|
-
return new transaction_1.WrappedGeneration(result);
|
|
239
|
-
}
|
|
240
|
-
async callPayloadSingle(payload) {
|
|
241
|
-
const rawData = await this._send(payload);
|
|
242
|
-
if (!rawData.length) {
|
|
243
|
-
throw new Error('No data returned');
|
|
244
|
-
}
|
|
245
|
-
const data = rawData.shift();
|
|
246
|
-
if (!data) {
|
|
247
|
-
throw new Error('Block not found');
|
|
248
|
-
}
|
|
249
|
-
return data;
|
|
250
|
-
}
|
|
251
|
-
async callMultiplePayloads(payloads) {
|
|
252
|
-
const rawData = (await this._send(payloads));
|
|
253
|
-
if ('error' in rawData) {
|
|
254
|
-
throw new Error(`Error fetching block: ${rawData.error}`);
|
|
255
|
-
}
|
|
256
|
-
const data = rawData.shift();
|
|
257
|
-
if (!data) {
|
|
258
|
-
throw new Error('Block not found');
|
|
259
|
-
}
|
|
260
|
-
return data;
|
|
261
|
-
}
|
|
262
|
-
bufferToHex(buffer) {
|
|
263
|
-
return buffer.toString('hex');
|
|
264
|
-
}
|
|
265
|
-
bigintToBase64(bigint) {
|
|
266
|
-
return Buffer.from(bsi_binary_1.BufferHelper.pointerToUint8Array(bigint)).toString('base64');
|
|
267
|
-
}
|
|
268
|
-
buildJsonRpcPayload(method, params) {
|
|
269
|
-
return {
|
|
270
|
-
method: method,
|
|
271
|
-
params: params,
|
|
272
|
-
id: this.nextId++,
|
|
273
|
-
jsonrpc: '2.0',
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
exports.AbstractRpcProvider = AbstractRpcProvider;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AbstractRpcProvider } from './AbstractRpcProvider.js';
|
|
2
|
-
import { JsonRpcPayload } from './interfaces/JSONRpc.js';
|
|
3
|
-
import { JsonRpcCallResult } from './interfaces/JSONRpcResult.js';
|
|
4
|
-
export declare class JSONRpcProvider extends AbstractRpcProvider {
|
|
5
|
-
private readonly timeout;
|
|
6
|
-
private readonly url;
|
|
7
|
-
constructor(url: string, timeout?: number);
|
|
8
|
-
_send(payload: JsonRpcPayload | JsonRpcPayload[]): Promise<JsonRpcCallResult>;
|
|
9
|
-
protected providerUrl(url: string): string;
|
|
10
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSONRpcProvider = void 0;
|
|
4
|
-
const AbstractRpcProvider_js_1 = require("./AbstractRpcProvider.js");
|
|
5
|
-
class JSONRpcProvider extends AbstractRpcProvider_js_1.AbstractRpcProvider {
|
|
6
|
-
timeout;
|
|
7
|
-
url;
|
|
8
|
-
constructor(url, timeout = 10_000) {
|
|
9
|
-
super();
|
|
10
|
-
this.timeout = timeout;
|
|
11
|
-
this.url = this.providerUrl(url);
|
|
12
|
-
}
|
|
13
|
-
async _send(payload) {
|
|
14
|
-
const controller = new AbortController();
|
|
15
|
-
const { signal } = controller;
|
|
16
|
-
const timeoutId = setTimeout(() => controller.abort(), this.timeout);
|
|
17
|
-
const params = {
|
|
18
|
-
method: 'POST',
|
|
19
|
-
headers: {
|
|
20
|
-
'Content-Type': 'application/json',
|
|
21
|
-
},
|
|
22
|
-
body: JSON.stringify(payload),
|
|
23
|
-
timeout: this.timeout,
|
|
24
|
-
signal: signal
|
|
25
|
-
};
|
|
26
|
-
try {
|
|
27
|
-
const resp = await fetch(this.url, params);
|
|
28
|
-
if (!resp.ok) {
|
|
29
|
-
throw new Error(`Failed to fetch: ${resp.statusText}`);
|
|
30
|
-
}
|
|
31
|
-
clearTimeout(timeoutId);
|
|
32
|
-
const fetchedData = await resp.json();
|
|
33
|
-
if (!fetchedData) {
|
|
34
|
-
throw new Error('No data fetched');
|
|
35
|
-
}
|
|
36
|
-
return [fetchedData];
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
const error = e;
|
|
40
|
-
if (error.name === 'AbortError') {
|
|
41
|
-
throw new Error(`Request timed out after ${this.timeout}ms`);
|
|
42
|
-
}
|
|
43
|
-
throw e;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
providerUrl(url) {
|
|
47
|
-
url = url.trim();
|
|
48
|
-
if (url.endsWith('/')) {
|
|
49
|
-
return url.slice(0, -1);
|
|
50
|
-
}
|
|
51
|
-
if (url.includes('api/v1/json-rpc')) {
|
|
52
|
-
return url;
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return `${url}/api/v1/json-rpc`;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
exports.JSONRpcProvider = JSONRpcProvider;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { AbstractRpcProvider } from './AbstractRpcProvider.js';
|
|
2
|
-
import { JsonRpcPayload } from './interfaces/JSONRpc.js';
|
|
3
|
-
import { JsonRpcCallResult } from './interfaces/JSONRpcResult.js';
|
|
4
|
-
export declare class WebSocketRpcProvider extends AbstractRpcProvider {
|
|
5
|
-
private readonly wsUrl;
|
|
6
|
-
constructor(url: string);
|
|
7
|
-
_send(payload: JsonRpcPayload): Promise<JsonRpcCallResult>;
|
|
8
|
-
protected providerUrl(url: string): string;
|
|
9
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebSocketRpcProvider = void 0;
|
|
4
|
-
const AbstractRpcProvider_js_1 = require("./AbstractRpcProvider.js");
|
|
5
|
-
class WebSocketRpcProvider extends AbstractRpcProvider_js_1.AbstractRpcProvider {
|
|
6
|
-
wsUrl;
|
|
7
|
-
constructor(url) {
|
|
8
|
-
super();
|
|
9
|
-
this.wsUrl = this.providerUrl(url);
|
|
10
|
-
}
|
|
11
|
-
async _send(payload) {
|
|
12
|
-
throw new Error('Method not implemented.');
|
|
13
|
-
}
|
|
14
|
-
providerUrl(url) {
|
|
15
|
-
url = url.trim();
|
|
16
|
-
if (url.endsWith('/')) {
|
|
17
|
-
return url.slice(0, -1);
|
|
18
|
-
}
|
|
19
|
-
if (url.includes('api/v1/json-rpc-ws')) {
|
|
20
|
-
return url;
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return `${url}/api/v1/json-rpc-ws`;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
exports.WebSocketRpcProvider = WebSocketRpcProvider;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GenerateTarget = void 0;
|
|
4
|
-
var GenerateTarget;
|
|
5
|
-
(function (GenerateTarget) {
|
|
6
|
-
GenerateTarget[GenerateTarget["WRAP"] = 0] = "WRAP";
|
|
7
|
-
})(GenerateTarget || (exports.GenerateTarget = GenerateTarget = {}));
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { JSONRpcMethods } from './JSONRpcMethods.js';
|
|
2
|
-
import { JSONRpcParams } from './JSONRpcParams.js';
|
|
3
|
-
export type JSONRpcId = string | number | null;
|
|
4
|
-
export type JSONRpc2RequestParams<T extends JSONRpcMethods> = JSONRpcParams<T> | Array<unknown>;
|
|
5
|
-
export interface JSONRpc2Request<T extends JSONRpcMethods> {
|
|
6
|
-
readonly jsonrpc: '2.0';
|
|
7
|
-
method: T;
|
|
8
|
-
readonly params: JSONRpc2RequestParams<T>;
|
|
9
|
-
readonly id?: JSONRpcId;
|
|
10
|
-
}
|
|
11
|
-
export type JsonRpcPayload = JSONRpc2Request<JSONRpcMethods>;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare enum JSONRpcMethods {
|
|
2
|
-
BLOCK_BY_NUMBER = "btc_blockNumber",
|
|
3
|
-
CHAIN_ID = "btc_chainId",
|
|
4
|
-
REORG = "btc_reorg",
|
|
5
|
-
GET_BLOCK_BY_HASH = "btc_getBlockByHash",
|
|
6
|
-
GET_BLOCK_BY_NUMBER = "btc_getBlockByNumber",
|
|
7
|
-
GET_TRANSACTION_BY_HASH = "btc_getTransactionByHash",
|
|
8
|
-
BROADCAST_TRANSACTION = "btc_sendRawTransaction",
|
|
9
|
-
GENERATE = "btc_generate",
|
|
10
|
-
GET_UTXOS = "btc_getUTXOs",
|
|
11
|
-
BLOCK_WITNESS = "btc_blockWitness",
|
|
12
|
-
GET_TRANSACTION_RECEIPT = "btc_getTransactionReceipt",
|
|
13
|
-
GET_CODE = "btc_getCode",
|
|
14
|
-
GET_STORAGE_AT = "btc_getStorageAt",
|
|
15
|
-
GET_BALANCE = "btc_getBalance",
|
|
16
|
-
CALL = "btc_call"
|
|
17
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSONRpcMethods = void 0;
|
|
4
|
-
var JSONRpcMethods;
|
|
5
|
-
(function (JSONRpcMethods) {
|
|
6
|
-
JSONRpcMethods["BLOCK_BY_NUMBER"] = "btc_blockNumber";
|
|
7
|
-
JSONRpcMethods["CHAIN_ID"] = "btc_chainId";
|
|
8
|
-
JSONRpcMethods["REORG"] = "btc_reorg";
|
|
9
|
-
JSONRpcMethods["GET_BLOCK_BY_HASH"] = "btc_getBlockByHash";
|
|
10
|
-
JSONRpcMethods["GET_BLOCK_BY_NUMBER"] = "btc_getBlockByNumber";
|
|
11
|
-
JSONRpcMethods["GET_TRANSACTION_BY_HASH"] = "btc_getTransactionByHash";
|
|
12
|
-
JSONRpcMethods["BROADCAST_TRANSACTION"] = "btc_sendRawTransaction";
|
|
13
|
-
JSONRpcMethods["GENERATE"] = "btc_generate";
|
|
14
|
-
JSONRpcMethods["GET_UTXOS"] = "btc_getUTXOs";
|
|
15
|
-
JSONRpcMethods["BLOCK_WITNESS"] = "btc_blockWitness";
|
|
16
|
-
JSONRpcMethods["GET_TRANSACTION_RECEIPT"] = "btc_getTransactionReceipt";
|
|
17
|
-
JSONRpcMethods["GET_CODE"] = "btc_getCode";
|
|
18
|
-
JSONRpcMethods["GET_STORAGE_AT"] = "btc_getStorageAt";
|
|
19
|
-
JSONRpcMethods["GET_BALANCE"] = "btc_getBalance";
|
|
20
|
-
JSONRpcMethods["CALL"] = "btc_call";
|
|
21
|
-
})(JSONRpcMethods || (exports.JSONRpcMethods = JSONRpcMethods = {}));
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { JSONRpcMethods } from './JSONRpcMethods.js';
|
|
2
|
-
export interface JSONRpc2ResultData<T extends JSONRpcMethods> {
|
|
3
|
-
}
|
|
4
|
-
export declare enum JSONRPCErrorCode {
|
|
5
|
-
PARSE_ERROR = -32700,
|
|
6
|
-
INVALID_REQUEST = -32600,
|
|
7
|
-
METHOD_NOT_FOUND = -32601,
|
|
8
|
-
INVALID_PARAMS = -32602,
|
|
9
|
-
INTERNAL_ERROR = -32603,
|
|
10
|
-
SERVER_ERROR = -32000,
|
|
11
|
-
APPLICATION_ERROR = -32099,
|
|
12
|
-
SYSTEM_ERROR = -32098,
|
|
13
|
-
TRANSPORT_ERROR = -32097,
|
|
14
|
-
GENERIC_ERROR = -32096
|
|
15
|
-
}
|
|
16
|
-
export declare enum JSONRPCErrorHttpCodes {
|
|
17
|
-
PARSE_ERROR = 500,
|
|
18
|
-
INVALID_REQUEST = 400,
|
|
19
|
-
METHOD_NOT_FOUND = 404,
|
|
20
|
-
INVALID_PARAMS = 400,
|
|
21
|
-
INTERNAL_ERROR = 500,
|
|
22
|
-
SERVER_ERROR = 500,
|
|
23
|
-
APPLICATION_ERROR = 500,
|
|
24
|
-
SYSTEM_ERROR = 500,
|
|
25
|
-
TRANSPORT_ERROR = 500,
|
|
26
|
-
GENERIC_ERROR = 500
|
|
27
|
-
}
|
|
28
|
-
export interface JSONRpcErrorData<T extends JSONRpcMethods> {
|
|
29
|
-
}
|
|
30
|
-
export interface JSONRpcResultError<T extends JSONRpcMethods> {
|
|
31
|
-
readonly code: JSONRPCErrorCode;
|
|
32
|
-
readonly message: string;
|
|
33
|
-
readonly data?: JSONRpcErrorData<T>;
|
|
34
|
-
}
|
|
35
|
-
interface JSONRpc2ResultBase<T extends JSONRpcMethods> {
|
|
36
|
-
readonly jsonrpc: '2.0';
|
|
37
|
-
readonly id: number | string | null;
|
|
38
|
-
readonly result?: JSONRpc2ResultData<T>;
|
|
39
|
-
readonly error?: JSONRpcResultError<T>;
|
|
40
|
-
}
|
|
41
|
-
export interface JSONRpc2ResponseResult<T extends JSONRpcMethods> extends JSONRpc2ResultBase<T> {
|
|
42
|
-
readonly result: JSONRpc2ResultData<T>;
|
|
43
|
-
}
|
|
44
|
-
export interface JSONRpc2ResponseError<T extends JSONRpcMethods> extends JSONRpc2ResultBase<T> {
|
|
45
|
-
readonly error: JSONRpcResultError<T>;
|
|
46
|
-
}
|
|
47
|
-
export type JsonRpcError = JSONRpc2ResponseError<JSONRpcMethods>;
|
|
48
|
-
export type JsonRpcResult = JSONRpc2ResponseResult<JSONRpcMethods>;
|
|
49
|
-
export type JSONRpc2Result<T extends JSONRpcMethods> = JSONRpc2ResponseResult<T> | JSONRpc2ResponseError<T>;
|
|
50
|
-
export type JsonRpcCallResult = (JsonRpcResult | JsonRpcError)[];
|
|
51
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.JSONRPCErrorHttpCodes = exports.JSONRPCErrorCode = void 0;
|
|
4
|
-
var JSONRPCErrorCode;
|
|
5
|
-
(function (JSONRPCErrorCode) {
|
|
6
|
-
JSONRPCErrorCode[JSONRPCErrorCode["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
|
|
7
|
-
JSONRPCErrorCode[JSONRPCErrorCode["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
|
|
8
|
-
JSONRPCErrorCode[JSONRPCErrorCode["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
|
|
9
|
-
JSONRPCErrorCode[JSONRPCErrorCode["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
|
|
10
|
-
JSONRPCErrorCode[JSONRPCErrorCode["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
|
|
11
|
-
JSONRPCErrorCode[JSONRPCErrorCode["SERVER_ERROR"] = -32000] = "SERVER_ERROR";
|
|
12
|
-
JSONRPCErrorCode[JSONRPCErrorCode["APPLICATION_ERROR"] = -32099] = "APPLICATION_ERROR";
|
|
13
|
-
JSONRPCErrorCode[JSONRPCErrorCode["SYSTEM_ERROR"] = -32098] = "SYSTEM_ERROR";
|
|
14
|
-
JSONRPCErrorCode[JSONRPCErrorCode["TRANSPORT_ERROR"] = -32097] = "TRANSPORT_ERROR";
|
|
15
|
-
JSONRPCErrorCode[JSONRPCErrorCode["GENERIC_ERROR"] = -32096] = "GENERIC_ERROR";
|
|
16
|
-
})(JSONRPCErrorCode || (exports.JSONRPCErrorCode = JSONRPCErrorCode = {}));
|
|
17
|
-
var JSONRPCErrorHttpCodes;
|
|
18
|
-
(function (JSONRPCErrorHttpCodes) {
|
|
19
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["PARSE_ERROR"] = 500] = "PARSE_ERROR";
|
|
20
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["INVALID_REQUEST"] = 400] = "INVALID_REQUEST";
|
|
21
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["METHOD_NOT_FOUND"] = 404] = "METHOD_NOT_FOUND";
|
|
22
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["INVALID_PARAMS"] = 400] = "INVALID_PARAMS";
|
|
23
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["INTERNAL_ERROR"] = 500] = "INTERNAL_ERROR";
|
|
24
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["SERVER_ERROR"] = 500] = "SERVER_ERROR";
|
|
25
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["APPLICATION_ERROR"] = 500] = "APPLICATION_ERROR";
|
|
26
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["SYSTEM_ERROR"] = 500] = "SYSTEM_ERROR";
|
|
27
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["TRANSPORT_ERROR"] = 500] = "TRANSPORT_ERROR";
|
|
28
|
-
JSONRPCErrorHttpCodes[JSONRPCErrorHttpCodes["GENERIC_ERROR"] = 500] = "GENERIC_ERROR";
|
|
29
|
-
})(JSONRPCErrorHttpCodes || (exports.JSONRPCErrorHttpCodes = JSONRPCErrorHttpCodes = {}));
|
package/cjs/serialize/BigInt.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { IStorageValue } from './interfaces/IStorageValue.js';
|
|
3
|
-
export declare class StoredValue implements IStorageValue {
|
|
4
|
-
readonly pointer: bigint;
|
|
5
|
-
readonly value: Buffer;
|
|
6
|
-
readonly height: bigint;
|
|
7
|
-
readonly proofs: string[];
|
|
8
|
-
constructor(iStoredValue: IStorageValue);
|
|
9
|
-
private base64ToBigInt;
|
|
10
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StoredValue = void 0;
|
|
4
|
-
const bsi_binary_1 = require("@btc-vision/bsi-binary");
|
|
5
|
-
class StoredValue {
|
|
6
|
-
pointer;
|
|
7
|
-
value;
|
|
8
|
-
height;
|
|
9
|
-
proofs;
|
|
10
|
-
constructor(iStoredValue) {
|
|
11
|
-
this.pointer =
|
|
12
|
-
typeof iStoredValue.pointer === 'string'
|
|
13
|
-
? this.base64ToBigInt(iStoredValue.pointer)
|
|
14
|
-
: iStoredValue.pointer;
|
|
15
|
-
if (iStoredValue.value instanceof Buffer) {
|
|
16
|
-
this.value = iStoredValue.value;
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
this.value = Buffer.from(iStoredValue.value, 'base64');
|
|
20
|
-
}
|
|
21
|
-
this.height = BigInt(iStoredValue.height);
|
|
22
|
-
this.proofs = iStoredValue.proofs || [];
|
|
23
|
-
}
|
|
24
|
-
base64ToBigInt(base64) {
|
|
25
|
-
return bsi_binary_1.BufferHelper.uint8ArrayToPointer(Buffer.from(base64, 'base64'));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
exports.StoredValue = StoredValue;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { BigNumberish, PointerLike } from '../../common/CommonTypes.js';
|
|
3
|
-
export interface IStorageValue {
|
|
4
|
-
readonly pointer: PointerLike;
|
|
5
|
-
readonly value: string | Buffer;
|
|
6
|
-
readonly height: BigNumberish;
|
|
7
|
-
readonly proofs?: string[];
|
|
8
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BigNumberish } from '../common/CommonTypes.js';
|
|
2
|
-
import { OPNetTransactionTypes } from '../interfaces/opnet/OPNetTransactionTypes.js';
|
|
3
|
-
import { ITransactionBase } from './interfaces/ITransaction.js';
|
|
4
|
-
import { TransactionInput } from './metadata/TransactionInput.js';
|
|
5
|
-
import { TransactionOutput } from './metadata/TransactionOutput.js';
|
|
6
|
-
import { TransactionReceipt } from './metadata/TransactionReceipt.js';
|
|
7
|
-
export declare abstract class TransactionBase<T extends OPNetTransactionTypes> extends TransactionReceipt implements ITransactionBase<T> {
|
|
8
|
-
readonly id: string;
|
|
9
|
-
readonly hash: string;
|
|
10
|
-
readonly index: number;
|
|
11
|
-
readonly burnedBitcoin: BigNumberish;
|
|
12
|
-
readonly inputs: TransactionInput[];
|
|
13
|
-
readonly outputs: TransactionOutput[];
|
|
14
|
-
readonly OPNetType: T;
|
|
15
|
-
readonly gasUsed: bigint;
|
|
16
|
-
protected constructor(transaction: ITransactionBase<T>);
|
|
17
|
-
}
|