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
package/cjs/block/Block.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { BigNumberish } from '../common/CommonTypes.js';
|
|
2
|
-
import { OPNetTransactionTypes } from '../interfaces/opnet/OPNetTransactionTypes.js';
|
|
3
|
-
import { TransactionBase } from '../transactions/Transaction.js';
|
|
4
|
-
import { BlockHeaderChecksumProof, IBlock } from './interfaces/IBlock.js';
|
|
5
|
-
export declare class Block implements IBlock {
|
|
6
|
-
readonly height: BigNumberish;
|
|
7
|
-
readonly hash: string;
|
|
8
|
-
readonly previousBlockHash: string;
|
|
9
|
-
readonly previousBlockChecksum: string;
|
|
10
|
-
readonly bits: string;
|
|
11
|
-
readonly nonce: number;
|
|
12
|
-
readonly version: number;
|
|
13
|
-
readonly size: number;
|
|
14
|
-
readonly txCount: number;
|
|
15
|
-
readonly weight: number;
|
|
16
|
-
readonly strippedSize: number;
|
|
17
|
-
readonly time: number;
|
|
18
|
-
readonly medianTime: number;
|
|
19
|
-
readonly checksumRoot: string;
|
|
20
|
-
readonly merkleRoot: string;
|
|
21
|
-
readonly storageRoot: string;
|
|
22
|
-
readonly receiptRoot: string;
|
|
23
|
-
readonly checksumProofs: BlockHeaderChecksumProof;
|
|
24
|
-
readonly transactions: TransactionBase<OPNetTransactionTypes>[];
|
|
25
|
-
constructor(block: IBlock);
|
|
26
|
-
}
|
package/cjs/block/Block.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Block = void 0;
|
|
4
|
-
const TransactionParser_js_1 = require("../transactions/TransactionParser.js");
|
|
5
|
-
class Block {
|
|
6
|
-
height;
|
|
7
|
-
hash;
|
|
8
|
-
previousBlockHash;
|
|
9
|
-
previousBlockChecksum;
|
|
10
|
-
bits;
|
|
11
|
-
nonce;
|
|
12
|
-
version;
|
|
13
|
-
size;
|
|
14
|
-
txCount;
|
|
15
|
-
weight;
|
|
16
|
-
strippedSize;
|
|
17
|
-
time;
|
|
18
|
-
medianTime;
|
|
19
|
-
checksumRoot;
|
|
20
|
-
merkleRoot;
|
|
21
|
-
storageRoot;
|
|
22
|
-
receiptRoot;
|
|
23
|
-
checksumProofs;
|
|
24
|
-
transactions = [];
|
|
25
|
-
constructor(block) {
|
|
26
|
-
this.height = BigInt(block.height.toString());
|
|
27
|
-
this.hash = block.hash;
|
|
28
|
-
this.previousBlockHash = block.previousBlockHash;
|
|
29
|
-
this.previousBlockChecksum = block.previousBlockChecksum;
|
|
30
|
-
this.bits = block.bits;
|
|
31
|
-
this.nonce = block.nonce;
|
|
32
|
-
this.version = block.version;
|
|
33
|
-
this.size = block.size;
|
|
34
|
-
this.txCount = block.txCount;
|
|
35
|
-
this.weight = block.weight;
|
|
36
|
-
this.strippedSize = block.strippedSize;
|
|
37
|
-
this.time = block.time;
|
|
38
|
-
this.medianTime = block.medianTime;
|
|
39
|
-
this.checksumRoot = block.checksumRoot;
|
|
40
|
-
this.merkleRoot = block.merkleRoot;
|
|
41
|
-
this.storageRoot = block.storageRoot;
|
|
42
|
-
this.receiptRoot = block.receiptRoot;
|
|
43
|
-
this.checksumProofs = block.checksumProofs;
|
|
44
|
-
this.transactions = TransactionParser_js_1.TransactionParser.parseTransactions(block.transactions);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.Block = Block;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface IBlockWitnessAPI {
|
|
2
|
-
readonly trusted: boolean;
|
|
3
|
-
readonly signature: string;
|
|
4
|
-
readonly identity?: string;
|
|
5
|
-
readonly opnetPubKey?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface IBlockWitness {
|
|
8
|
-
blockNumber: bigint | string;
|
|
9
|
-
readonly witnesses: IBlockWitnessAPI[];
|
|
10
|
-
}
|
|
11
|
-
export type BlockWitnesses = IBlockWitness[];
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { BigNumberish } from '../../common/CommonTypes.js';
|
|
2
|
-
import { OPNetTransactionTypes } from '../../interfaces/opnet/OPNetTransactionTypes.js';
|
|
3
|
-
import { ITransaction } from '../../transactions/interfaces/ITransaction.js';
|
|
4
|
-
import { TransactionBase } from '../../transactions/Transaction.js';
|
|
5
|
-
export type BlockHeaderChecksumProof = Array<[number, string[]]>;
|
|
6
|
-
export interface IBlockCommon {
|
|
7
|
-
height: string | BigNumberish;
|
|
8
|
-
hash: string;
|
|
9
|
-
previousBlockHash: string;
|
|
10
|
-
previousBlockChecksum: string;
|
|
11
|
-
bits: string;
|
|
12
|
-
nonce: number;
|
|
13
|
-
version: number;
|
|
14
|
-
size: number;
|
|
15
|
-
txCount: number;
|
|
16
|
-
weight: number;
|
|
17
|
-
strippedSize: number;
|
|
18
|
-
time: number;
|
|
19
|
-
medianTime: number;
|
|
20
|
-
checksumRoot: string;
|
|
21
|
-
merkleRoot: string;
|
|
22
|
-
storageRoot: string;
|
|
23
|
-
receiptRoot: string;
|
|
24
|
-
checksumProofs: BlockHeaderChecksumProof;
|
|
25
|
-
}
|
|
26
|
-
export interface IBlock extends IBlockCommon {
|
|
27
|
-
transactions?: ITransaction[] | TransactionBase<OPNetTransactionTypes>[];
|
|
28
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Address } from '@btc-vision/bsi-binary';
|
|
2
|
-
import { BitcoinAddress } from '../bitcoin/BitcoinAddress.js';
|
|
3
|
-
export type BitcoinAddressLike = string | BitcoinAddress;
|
|
4
|
-
export type PointerLike = bigint | string;
|
|
5
|
-
export type DecodedCallResult = bigint | string | boolean | number | Uint8Array | Array<bigint> | Array<string> | Array<boolean> | Array<number> | Array<Uint8Array> | Map<Address, bigint>;
|
|
6
|
-
export type Numeric = number | bigint;
|
|
7
|
-
export type BigNumberish = Numeric | string;
|
|
8
|
-
export type BlockTag = BigNumberish | 'latest' | 'pending' | 'earliest';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { BinaryReader, NetEvent } from '@btc-vision/bsi-binary';
|
|
3
|
-
import { DecodedCallResult } from '../common/CommonTypes.js';
|
|
4
|
-
import { ContractDecodedObjectResult, DecodedOutput } from './Contract.js';
|
|
5
|
-
import { IAccessList } from './interfaces/IAccessList.js';
|
|
6
|
-
import { ICallResultData } from './interfaces/ICallResult.js';
|
|
7
|
-
export declare class CallResult<T extends ContractDecodedObjectResult = {}> implements Omit<ICallResultData, 'estimatedGas'> {
|
|
8
|
-
readonly result: BinaryReader;
|
|
9
|
-
readonly events: NetEvent[];
|
|
10
|
-
readonly accessList: IAccessList;
|
|
11
|
-
calldata: Buffer | undefined;
|
|
12
|
-
readonly estimatedGas: bigint | undefined;
|
|
13
|
-
readonly decoded: Array<DecodedCallResult>;
|
|
14
|
-
properties: T;
|
|
15
|
-
constructor(callResult: ICallResultData);
|
|
16
|
-
setDecoded(decoded: DecodedOutput): void;
|
|
17
|
-
setCalldata(calldata: Buffer): void;
|
|
18
|
-
private base64ToUint8Array;
|
|
19
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CallResult = void 0;
|
|
4
|
-
const bsi_binary_1 = require("@btc-vision/bsi-binary");
|
|
5
|
-
class CallResult {
|
|
6
|
-
result;
|
|
7
|
-
events;
|
|
8
|
-
accessList;
|
|
9
|
-
calldata;
|
|
10
|
-
estimatedGas;
|
|
11
|
-
decoded = [];
|
|
12
|
-
properties = {};
|
|
13
|
-
constructor(callResult) {
|
|
14
|
-
this.events = callResult.events;
|
|
15
|
-
this.accessList = callResult.accessList;
|
|
16
|
-
if (callResult.estimatedGas) {
|
|
17
|
-
this.estimatedGas = BigInt(callResult.estimatedGas);
|
|
18
|
-
}
|
|
19
|
-
this.result =
|
|
20
|
-
typeof callResult.result === 'string'
|
|
21
|
-
? new bsi_binary_1.BinaryReader(this.base64ToUint8Array(callResult.result))
|
|
22
|
-
: callResult.result;
|
|
23
|
-
}
|
|
24
|
-
setDecoded(decoded) {
|
|
25
|
-
this.properties = Object.freeze(decoded.obj);
|
|
26
|
-
this.decoded.push(...decoded.values);
|
|
27
|
-
}
|
|
28
|
-
setCalldata(calldata) {
|
|
29
|
-
this.calldata = calldata;
|
|
30
|
-
}
|
|
31
|
-
base64ToUint8Array(base64) {
|
|
32
|
-
return bsi_binary_1.BufferHelper.bufferToUint8Array(Buffer.from(base64, 'base64'));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.CallResult = CallResult;
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Address, NetEvent } from '@btc-vision/bsi-binary';
|
|
3
|
-
import { BaseContractProperty } from '../abi/BaseContractProperty.js';
|
|
4
|
-
import { BitcoinInterface } from '../abi/BitcoinInterface.js';
|
|
5
|
-
import { BaseContractProperties } from '../abi/interfaces/BaseContractProperties.js';
|
|
6
|
-
import { BitcoinInterfaceAbi } from '../abi/interfaces/BitcoinInterfaceAbi.js';
|
|
7
|
-
import { BitcoinAddressLike, DecodedCallResult } from '../common/CommonTypes.js';
|
|
8
|
-
import { AbstractRpcProvider } from '../providers/AbstractRpcProvider.js';
|
|
9
|
-
import { ContractEvents } from '../transactions/interfaces/ITransactionReceipt.js';
|
|
10
|
-
import { IContract } from './interfaces/IContract.js';
|
|
11
|
-
import { OPNetEvent } from './OPNetEvent.js';
|
|
12
|
-
declare const internal: unique symbol;
|
|
13
|
-
export type ContractDecodedObjectResult = {
|
|
14
|
-
[key: string]: DecodedCallResult;
|
|
15
|
-
};
|
|
16
|
-
export type DecodedOutput = {
|
|
17
|
-
values: Array<DecodedCallResult>;
|
|
18
|
-
obj: ContractDecodedObjectResult;
|
|
19
|
-
};
|
|
20
|
-
export declare abstract class IBaseContract<T extends BaseContractProperties> implements IContract {
|
|
21
|
-
readonly address: BitcoinAddressLike;
|
|
22
|
-
readonly interface: BitcoinInterface;
|
|
23
|
-
readonly provider: AbstractRpcProvider;
|
|
24
|
-
from?: Address;
|
|
25
|
-
readonly [internal]: keyof T | undefined;
|
|
26
|
-
private events;
|
|
27
|
-
protected constructor(address: BitcoinAddressLike, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, from?: Address);
|
|
28
|
-
setSender(sender: Address): void;
|
|
29
|
-
decodeEvents(events: NetEvent[] | ContractEvents): OPNetEvent[];
|
|
30
|
-
decodeEvent(event: NetEvent): OPNetEvent;
|
|
31
|
-
encodeCalldata(functionName: string, args: unknown[]): Buffer;
|
|
32
|
-
protected getFunction(name: symbol): BaseContractProperty | undefined | string | number | symbol;
|
|
33
|
-
private defineInternalFunctions;
|
|
34
|
-
private encodeFunctionData;
|
|
35
|
-
private encodeInput;
|
|
36
|
-
private decodeOutput;
|
|
37
|
-
private callFunction;
|
|
38
|
-
}
|
|
39
|
-
export declare class BaseContract<T extends BaseContractProperties> extends IBaseContract<T> {
|
|
40
|
-
constructor(address: BitcoinAddressLike, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, sender?: Address);
|
|
41
|
-
private proxify;
|
|
42
|
-
}
|
|
43
|
-
export declare function getContract<T extends BaseContractProperties>(address: BitcoinAddressLike, abi: BitcoinInterface | BitcoinInterfaceAbi, provider: AbstractRpcProvider, sender?: Address): BaseContract<T> & Omit<T, keyof BaseContract<T>>;
|
|
44
|
-
export {};
|
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContract = exports.BaseContract = exports.IBaseContract = void 0;
|
|
4
|
-
const bsi_binary_1 = require("@btc-vision/bsi-binary");
|
|
5
|
-
const BitcoinAbiTypes_js_1 = require("../abi/BitcoinAbiTypes.js");
|
|
6
|
-
const BitcoinInterface_js_1 = require("../abi/BitcoinInterface.js");
|
|
7
|
-
const OPNetEvent_js_1 = require("./OPNetEvent.js");
|
|
8
|
-
const internal = Symbol.for('_btc_internal');
|
|
9
|
-
const bitcoinAbiCoder = new bsi_binary_1.ABICoder();
|
|
10
|
-
class IBaseContract {
|
|
11
|
-
address;
|
|
12
|
-
interface;
|
|
13
|
-
provider;
|
|
14
|
-
from;
|
|
15
|
-
[internal];
|
|
16
|
-
events = new Map();
|
|
17
|
-
constructor(address, abi, provider, from) {
|
|
18
|
-
this.address = address;
|
|
19
|
-
this.provider = provider;
|
|
20
|
-
this.interface = BitcoinInterface_js_1.BitcoinInterface.from(abi);
|
|
21
|
-
this.from = from;
|
|
22
|
-
Object.defineProperty(this, internal, { value: {} });
|
|
23
|
-
this.defineInternalFunctions();
|
|
24
|
-
}
|
|
25
|
-
setSender(sender) {
|
|
26
|
-
this.from = sender;
|
|
27
|
-
}
|
|
28
|
-
decodeEvents(events) {
|
|
29
|
-
const decodedEvents = [];
|
|
30
|
-
if (!Array.isArray(events)) {
|
|
31
|
-
events = events[this.address.toString()];
|
|
32
|
-
if (!events) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
for (let event of events) {
|
|
37
|
-
decodedEvents.push(this.decodeEvent(event));
|
|
38
|
-
}
|
|
39
|
-
return decodedEvents;
|
|
40
|
-
}
|
|
41
|
-
decodeEvent(event) {
|
|
42
|
-
const eventData = this.events.get(event.eventType);
|
|
43
|
-
if (!eventData || eventData.values.length === 0) {
|
|
44
|
-
return new OPNetEvent_js_1.OPNetEvent(event.eventType, event.eventDataSelector, event.eventData);
|
|
45
|
-
}
|
|
46
|
-
const binaryReader = new bsi_binary_1.BinaryReader(event.eventData);
|
|
47
|
-
const out = this.decodeOutput(eventData.values, binaryReader);
|
|
48
|
-
const decodedEvent = new OPNetEvent_js_1.OPNetEvent(event.eventType, event.eventDataSelector, event.eventData);
|
|
49
|
-
decodedEvent.setDecoded(out);
|
|
50
|
-
return decodedEvent;
|
|
51
|
-
}
|
|
52
|
-
encodeCalldata(functionName, args) {
|
|
53
|
-
for (const element of this.interface.abi) {
|
|
54
|
-
if (element.name === functionName) {
|
|
55
|
-
const data = this.encodeFunctionData(element, args);
|
|
56
|
-
return Buffer.from(data.getBuffer());
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
throw new Error(`Function not found: ${functionName}`);
|
|
60
|
-
}
|
|
61
|
-
getFunction(name) {
|
|
62
|
-
const key = name;
|
|
63
|
-
return this[key];
|
|
64
|
-
}
|
|
65
|
-
defineInternalFunctions() {
|
|
66
|
-
for (const element of this.interface.abi) {
|
|
67
|
-
switch (element.type) {
|
|
68
|
-
case BitcoinAbiTypes_js_1.BitcoinAbiTypes.Function: {
|
|
69
|
-
if (this[element.name]) {
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
Object.defineProperty(this, element.name, {
|
|
73
|
-
value: this.callFunction(element).bind(this),
|
|
74
|
-
});
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case BitcoinAbiTypes_js_1.BitcoinAbiTypes.Event: {
|
|
78
|
-
if (this.events.has(element.name)) {
|
|
79
|
-
throw new Error(`Duplicate event found in the ABI: ${element.name}.`);
|
|
80
|
-
}
|
|
81
|
-
this.events.set(element.name, element);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
default:
|
|
85
|
-
throw new Error(`Unsupported type.`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
encodeFunctionData(element, args) {
|
|
90
|
-
const writer = new bsi_binary_1.BinaryWriter();
|
|
91
|
-
const selector = Number('0x' + bitcoinAbiCoder.encodeSelector(element.name));
|
|
92
|
-
writer.writeSelector(selector);
|
|
93
|
-
if (args.length !== (element.inputs?.length ?? 0)) {
|
|
94
|
-
throw new Error('Invalid number of arguments provided');
|
|
95
|
-
}
|
|
96
|
-
if (!element.inputs || (element.inputs && element.inputs.length === 0)) {
|
|
97
|
-
return writer;
|
|
98
|
-
}
|
|
99
|
-
for (let i = 0; i < element.inputs.length; i++) {
|
|
100
|
-
this.encodeInput(writer, element.inputs[i], args[i]);
|
|
101
|
-
}
|
|
102
|
-
return writer;
|
|
103
|
-
}
|
|
104
|
-
encodeInput(writer, abi, value) {
|
|
105
|
-
const type = abi.type;
|
|
106
|
-
const name = abi.name;
|
|
107
|
-
switch (type) {
|
|
108
|
-
case bsi_binary_1.ABIDataTypes.UINT256: {
|
|
109
|
-
if (typeof value !== 'bigint') {
|
|
110
|
-
throw new Error(`Expected value to be of type bigint (${name})`);
|
|
111
|
-
}
|
|
112
|
-
writer.writeU256(value);
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
case bsi_binary_1.ABIDataTypes.BOOL: {
|
|
116
|
-
if (typeof value !== 'boolean') {
|
|
117
|
-
throw new Error(`Expected value to be of type boolean (${name})`);
|
|
118
|
-
}
|
|
119
|
-
writer.writeBoolean(value);
|
|
120
|
-
break;
|
|
121
|
-
}
|
|
122
|
-
case bsi_binary_1.ABIDataTypes.STRING: {
|
|
123
|
-
if (typeof value !== 'string') {
|
|
124
|
-
throw new Error(`Expected value to be of type string (${name})`);
|
|
125
|
-
}
|
|
126
|
-
writer.writeStringWithLength(value);
|
|
127
|
-
break;
|
|
128
|
-
}
|
|
129
|
-
case bsi_binary_1.ABIDataTypes.ADDRESS: {
|
|
130
|
-
const address = value;
|
|
131
|
-
writer.writeAddress(address.toString());
|
|
132
|
-
break;
|
|
133
|
-
}
|
|
134
|
-
case bsi_binary_1.ABIDataTypes.TUPLE: {
|
|
135
|
-
if (!(value instanceof Array)) {
|
|
136
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
137
|
-
}
|
|
138
|
-
writer.writeTuple(value);
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
case bsi_binary_1.ABIDataTypes.UINT8: {
|
|
142
|
-
if (typeof value !== 'number') {
|
|
143
|
-
throw new Error(`Expected value to be of type number (${name})`);
|
|
144
|
-
}
|
|
145
|
-
writer.writeU8(value);
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
|
-
case bsi_binary_1.ABIDataTypes.UINT16: {
|
|
149
|
-
if (typeof value !== 'number') {
|
|
150
|
-
throw new Error(`Expected value to be of type number (${name})`);
|
|
151
|
-
}
|
|
152
|
-
writer.writeU16(value);
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
case bsi_binary_1.ABIDataTypes.UINT32: {
|
|
156
|
-
if (typeof value !== 'number') {
|
|
157
|
-
throw new Error(`Expected value to be of type number (${name})`);
|
|
158
|
-
}
|
|
159
|
-
writer.writeU32(value);
|
|
160
|
-
break;
|
|
161
|
-
}
|
|
162
|
-
case bsi_binary_1.ABIDataTypes.BYTES32: {
|
|
163
|
-
if (!(value instanceof Uint8Array)) {
|
|
164
|
-
throw new Error(`Expected value to be of type Uint8Array (${name})`);
|
|
165
|
-
}
|
|
166
|
-
writer.writeBytes(value);
|
|
167
|
-
break;
|
|
168
|
-
}
|
|
169
|
-
case bsi_binary_1.ABIDataTypes.ADDRESS_UINT256_TUPLE: {
|
|
170
|
-
if (!(value instanceof Map)) {
|
|
171
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
172
|
-
}
|
|
173
|
-
writer.writeAddressValueTupleMap(value);
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
case bsi_binary_1.ABIDataTypes.BYTES: {
|
|
177
|
-
if (!(value instanceof Uint8Array)) {
|
|
178
|
-
throw new Error(`Expected value to be of type Uint8Array (${name})`);
|
|
179
|
-
}
|
|
180
|
-
writer.writeBytesWithLength(value);
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
case bsi_binary_1.ABIDataTypes.UINT64: {
|
|
184
|
-
if (typeof value !== 'bigint') {
|
|
185
|
-
throw new Error(`Expected value to be of type bigint (${name})`);
|
|
186
|
-
}
|
|
187
|
-
writer.writeU64(value);
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_ADDRESSES: {
|
|
191
|
-
if (!(value instanceof Array)) {
|
|
192
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
193
|
-
}
|
|
194
|
-
writer.writeAddressArray(value);
|
|
195
|
-
break;
|
|
196
|
-
}
|
|
197
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT256: {
|
|
198
|
-
if (!(value instanceof Array)) {
|
|
199
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
200
|
-
}
|
|
201
|
-
writer.writeU256Array(value);
|
|
202
|
-
break;
|
|
203
|
-
}
|
|
204
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT32: {
|
|
205
|
-
if (!(value instanceof Array)) {
|
|
206
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
207
|
-
}
|
|
208
|
-
writer.writeU32Array(value);
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_STRING: {
|
|
212
|
-
if (!(value instanceof Array)) {
|
|
213
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
214
|
-
}
|
|
215
|
-
writer.writeStringArray(value);
|
|
216
|
-
break;
|
|
217
|
-
}
|
|
218
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_BYTES: {
|
|
219
|
-
if (!(value instanceof Array)) {
|
|
220
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
221
|
-
}
|
|
222
|
-
writer.writeBytesArray(value);
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT64: {
|
|
226
|
-
if (!(value instanceof Array)) {
|
|
227
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
228
|
-
}
|
|
229
|
-
writer.writeU64Array(value);
|
|
230
|
-
break;
|
|
231
|
-
}
|
|
232
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT8: {
|
|
233
|
-
if (!(value instanceof Array)) {
|
|
234
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
235
|
-
}
|
|
236
|
-
writer.writeU8Array(value);
|
|
237
|
-
break;
|
|
238
|
-
}
|
|
239
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT16: {
|
|
240
|
-
if (!(value instanceof Array)) {
|
|
241
|
-
throw new Error(`Expected value to be of type Array (${name})`);
|
|
242
|
-
}
|
|
243
|
-
writer.writeU16Array(value);
|
|
244
|
-
break;
|
|
245
|
-
}
|
|
246
|
-
default: {
|
|
247
|
-
throw new Error(`Unsupported type: ${type} (${name})`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
decodeOutput(abi, reader) {
|
|
252
|
-
const result = [];
|
|
253
|
-
const obj = {};
|
|
254
|
-
for (let i = 0; i < abi.length; i++) {
|
|
255
|
-
const type = abi[i].type;
|
|
256
|
-
const name = abi[i].name;
|
|
257
|
-
let decodedResult;
|
|
258
|
-
switch (type) {
|
|
259
|
-
case bsi_binary_1.ABIDataTypes.UINT256:
|
|
260
|
-
decodedResult = reader.readU256();
|
|
261
|
-
break;
|
|
262
|
-
case bsi_binary_1.ABIDataTypes.BOOL:
|
|
263
|
-
decodedResult = reader.readBoolean();
|
|
264
|
-
break;
|
|
265
|
-
case bsi_binary_1.ABIDataTypes.STRING:
|
|
266
|
-
decodedResult = reader.readStringWithLength();
|
|
267
|
-
break;
|
|
268
|
-
case bsi_binary_1.ABIDataTypes.ADDRESS:
|
|
269
|
-
decodedResult = reader.readAddress();
|
|
270
|
-
break;
|
|
271
|
-
case bsi_binary_1.ABIDataTypes.TUPLE:
|
|
272
|
-
decodedResult = reader.readTuple();
|
|
273
|
-
break;
|
|
274
|
-
case bsi_binary_1.ABIDataTypes.UINT8:
|
|
275
|
-
decodedResult = reader.readU8();
|
|
276
|
-
break;
|
|
277
|
-
case bsi_binary_1.ABIDataTypes.UINT16:
|
|
278
|
-
decodedResult = reader.readU16();
|
|
279
|
-
break;
|
|
280
|
-
case bsi_binary_1.ABIDataTypes.UINT32:
|
|
281
|
-
decodedResult = reader.readU32();
|
|
282
|
-
break;
|
|
283
|
-
case bsi_binary_1.ABIDataTypes.BYTES32:
|
|
284
|
-
decodedResult = reader.readBytes(32);
|
|
285
|
-
break;
|
|
286
|
-
case bsi_binary_1.ABIDataTypes.ADDRESS_UINT256_TUPLE:
|
|
287
|
-
decodedResult = reader.readAddressValueTuple();
|
|
288
|
-
break;
|
|
289
|
-
case bsi_binary_1.ABIDataTypes.BYTES: {
|
|
290
|
-
decodedResult = reader.readBytesWithLength();
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
case bsi_binary_1.ABIDataTypes.UINT64: {
|
|
294
|
-
decodedResult = reader.readU64();
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_ADDRESSES: {
|
|
298
|
-
decodedResult = reader.readAddressArray();
|
|
299
|
-
break;
|
|
300
|
-
}
|
|
301
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT256: {
|
|
302
|
-
decodedResult = reader.readU256Array();
|
|
303
|
-
break;
|
|
304
|
-
}
|
|
305
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT32: {
|
|
306
|
-
decodedResult = reader.readU32Array();
|
|
307
|
-
break;
|
|
308
|
-
}
|
|
309
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_STRING: {
|
|
310
|
-
decodedResult = reader.readStringArray();
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_BYTES: {
|
|
314
|
-
decodedResult = reader.readBytesArray();
|
|
315
|
-
break;
|
|
316
|
-
}
|
|
317
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT64: {
|
|
318
|
-
decodedResult = reader.readU64Array();
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT8: {
|
|
322
|
-
decodedResult = reader.readU8Array();
|
|
323
|
-
break;
|
|
324
|
-
}
|
|
325
|
-
case bsi_binary_1.ABIDataTypes.ARRAY_OF_UINT16: {
|
|
326
|
-
decodedResult = reader.readU16Array();
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
default:
|
|
330
|
-
throw new Error(`Unsupported type: ${type} (${name})`);
|
|
331
|
-
}
|
|
332
|
-
result.push(decodedResult);
|
|
333
|
-
obj[name] = decodedResult;
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
values: result,
|
|
337
|
-
obj: obj,
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
callFunction(element) {
|
|
341
|
-
return async (...args) => {
|
|
342
|
-
const data = this.encodeFunctionData(element, args);
|
|
343
|
-
const buffer = Buffer.from(data.getBuffer());
|
|
344
|
-
const response = await this.provider.call(this.address, buffer, this.from);
|
|
345
|
-
if ('error' in response) {
|
|
346
|
-
return response;
|
|
347
|
-
}
|
|
348
|
-
const decoded = element.outputs
|
|
349
|
-
? this.decodeOutput(element.outputs, response.result)
|
|
350
|
-
: { values: [], obj: {} };
|
|
351
|
-
response.setDecoded(decoded);
|
|
352
|
-
response.setCalldata(buffer);
|
|
353
|
-
return response;
|
|
354
|
-
};
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.IBaseContract = IBaseContract;
|
|
358
|
-
class BaseContract extends IBaseContract {
|
|
359
|
-
constructor(address, abi, provider, sender) {
|
|
360
|
-
super(address, abi, provider, sender);
|
|
361
|
-
return this.proxify();
|
|
362
|
-
}
|
|
363
|
-
proxify() {
|
|
364
|
-
return new Proxy(this, {
|
|
365
|
-
get: (target, prop, receiver) => {
|
|
366
|
-
if (typeof prop === 'symbol' || prop in target) {
|
|
367
|
-
return Reflect.get(target, prop, receiver);
|
|
368
|
-
}
|
|
369
|
-
try {
|
|
370
|
-
return this.getFunction(prop);
|
|
371
|
-
}
|
|
372
|
-
catch (error) {
|
|
373
|
-
if (!(error instanceof Error)) {
|
|
374
|
-
throw new Error(`Something went wrong when trying to get the function: ${error}`);
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
throw error;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
},
|
|
381
|
-
has: (target, prop) => {
|
|
382
|
-
if (typeof prop === 'symbol' || prop in target) {
|
|
383
|
-
return Reflect.has(target, prop);
|
|
384
|
-
}
|
|
385
|
-
return target.interface.hasFunction(prop);
|
|
386
|
-
},
|
|
387
|
-
});
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
exports.BaseContract = BaseContract;
|
|
391
|
-
function contractBase() {
|
|
392
|
-
return BaseContract;
|
|
393
|
-
}
|
|
394
|
-
function getContract(address, abi, provider, sender) {
|
|
395
|
-
const base = contractBase();
|
|
396
|
-
return new base(address, abi, provider, sender);
|
|
397
|
-
}
|
|
398
|
-
exports.getContract = getContract;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Address } from '@btc-vision/bsi-binary';
|
|
3
|
-
import { IRawContract } from './interfaces/IRawContract.js';
|
|
4
|
-
export declare class ContractData implements IRawContract {
|
|
5
|
-
readonly contractAddress: Address;
|
|
6
|
-
readonly virtualAddress: Address;
|
|
7
|
-
readonly p2trAddress: Address;
|
|
8
|
-
readonly bytecode: Buffer;
|
|
9
|
-
readonly wasCompressed: boolean;
|
|
10
|
-
readonly deployedTransactionId: string;
|
|
11
|
-
readonly deployedTransactionHash: string;
|
|
12
|
-
readonly deployerPubKey: Buffer;
|
|
13
|
-
readonly contractSeed: Buffer;
|
|
14
|
-
readonly contractSaltHash: Buffer;
|
|
15
|
-
readonly deployerAddress: Address;
|
|
16
|
-
constructor(raw: IRawContract);
|
|
17
|
-
}
|