phantasma-sdk-ts 0.1.71
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/.eslintignore +13 -0
- package/.eslintrc.cjs +15 -0
- package/.github/workflows/npm-publish.yml +47 -0
- package/.prettierignore +13 -0
- package/.prettierrc +8 -0
- package/LICENSE +201 -0
- package/README.md +842 -0
- package/babel.config.js +6 -0
- package/core/index.d.ts +10 -0
- package/core/index.d.ts.map +1 -0
- package/core/index.js +25 -0
- package/core/interfaces/IContract.d.ts +27 -0
- package/core/interfaces/IContract.d.ts.map +1 -0
- package/core/interfaces/IContract.js +25 -0
- package/core/interfaces/IKeyPair.d.ts +7 -0
- package/core/interfaces/IKeyPair.d.ts.map +1 -0
- package/core/interfaces/IKeyPair.js +2 -0
- package/core/interfaces/ISerializable.d.ts +6 -0
- package/core/interfaces/ISerializable.d.ts.map +1 -0
- package/core/interfaces/ISerializable.js +9 -0
- package/core/interfaces/IStack.d.ts +7 -0
- package/core/interfaces/IStack.d.ts.map +1 -0
- package/core/interfaces/IStack.js +2 -0
- package/core/interfaces/IToken.d.ts +29 -0
- package/core/interfaces/IToken.d.ts.map +1 -0
- package/core/interfaces/IToken.js +22 -0
- package/core/interfaces/Signature.d.ts +21 -0
- package/core/interfaces/Signature.d.ts.map +1 -0
- package/core/interfaces/Signature.js +31 -0
- package/core/interfaces/index.d.ts +7 -0
- package/core/interfaces/index.d.ts.map +1 -0
- package/core/interfaces/index.js +22 -0
- package/core/ledger/Address-Transcode.d.ts +20 -0
- package/core/ledger/Address-Transcode.d.ts.map +1 -0
- package/core/ledger/Address-Transcode.js +70 -0
- package/core/ledger/Ledger-Commands.d.ts +76 -0
- package/core/ledger/Ledger-Commands.d.ts.map +1 -0
- package/core/ledger/Ledger-Commands.js +530 -0
- package/core/ledger/Ledger-Utils.d.ts +74 -0
- package/core/ledger/Ledger-Utils.d.ts.map +1 -0
- package/core/ledger/Ledger-Utils.js +609 -0
- package/core/ledger/LedgerConfig.d.ts +17 -0
- package/core/ledger/LedgerConfig.d.ts.map +1 -0
- package/core/ledger/LedgerConfig.js +2 -0
- package/core/ledger/Mnemonic.d.ts +35 -0
- package/core/ledger/Mnemonic.d.ts.map +1 -0
- package/core/ledger/Mnemonic.js +65 -0
- package/core/ledger/Transaction-Sign.d.ts +10 -0
- package/core/ledger/Transaction-Sign.d.ts.map +1 -0
- package/core/ledger/Transaction-Sign.js +149 -0
- package/core/ledger/Transaction-Transcode.d.ts +24 -0
- package/core/ledger/Transaction-Transcode.d.ts.map +1 -0
- package/core/ledger/Transaction-Transcode.js +47 -0
- package/core/ledger/index.d.ts +9 -0
- package/core/ledger/index.d.ts.map +1 -0
- package/core/ledger/index.js +24 -0
- package/core/ledger/interfaces/ApplicationNameResponse.d.ts +6 -0
- package/core/ledger/interfaces/ApplicationNameResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/ApplicationNameResponse.js +2 -0
- package/core/ledger/interfaces/Device.d.ts +7 -0
- package/core/ledger/interfaces/Device.d.ts.map +1 -0
- package/core/ledger/interfaces/Device.js +2 -0
- package/core/ledger/interfaces/DeviceResponse.d.ts +7 -0
- package/core/ledger/interfaces/DeviceResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/DeviceResponse.js +2 -0
- package/core/ledger/interfaces/Ledger.d.ts +2 -0
- package/core/ledger/interfaces/Ledger.d.ts.map +1 -0
- package/core/ledger/interfaces/Ledger.js +2 -0
- package/core/ledger/interfaces/LedgerBalanceFromLedgerResponse.d.ts +12 -0
- package/core/ledger/interfaces/LedgerBalanceFromLedgerResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerBalanceFromLedgerResponse.js +2 -0
- package/core/ledger/interfaces/LedgerConfig.d.ts +17 -0
- package/core/ledger/interfaces/LedgerConfig.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerConfig.js +2 -0
- package/core/ledger/interfaces/LedgerDeviceInfoResponse.d.ts +7 -0
- package/core/ledger/interfaces/LedgerDeviceInfoResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerDeviceInfoResponse.js +2 -0
- package/core/ledger/interfaces/LedgerSendTransactionResponse.d.ts +5 -0
- package/core/ledger/interfaces/LedgerSendTransactionResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerSendTransactionResponse.js +2 -0
- package/core/ledger/interfaces/LedgerSigner.d.ts +6 -0
- package/core/ledger/interfaces/LedgerSigner.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerSigner.js +2 -0
- package/core/ledger/interfaces/LedgerSignerData.d.ts +8 -0
- package/core/ledger/interfaces/LedgerSignerData.d.ts.map +1 -0
- package/core/ledger/interfaces/LedgerSignerData.js +2 -0
- package/core/ledger/interfaces/PublicKeyResponse.d.ts +6 -0
- package/core/ledger/interfaces/PublicKeyResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/PublicKeyResponse.js +2 -0
- package/core/ledger/interfaces/SignResponse.d.ts +6 -0
- package/core/ledger/interfaces/SignResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/SignResponse.js +2 -0
- package/core/ledger/interfaces/VersionResponse.d.ts +6 -0
- package/core/ledger/interfaces/VersionResponse.d.ts.map +1 -0
- package/core/ledger/interfaces/VersionResponse.js +2 -0
- package/core/ledger/interfaces/index.d.ts +14 -0
- package/core/ledger/interfaces/index.d.ts.map +1 -0
- package/core/ledger/interfaces/index.js +29 -0
- package/core/ledger/ledger-comm.d.ts +85 -0
- package/core/ledger/ledger-comm.d.ts.map +1 -0
- package/core/ledger/ledger-comm.js +613 -0
- package/core/link/easyConnect.d.ts +23 -0
- package/core/link/easyConnect.d.ts.map +1 -0
- package/core/link/easyConnect.js +237 -0
- package/core/link/easyScript.d.ts +13 -0
- package/core/link/easyScript.d.ts.map +1 -0
- package/core/link/easyScript.js +52 -0
- package/core/link/index.d.ts +2 -0
- package/core/link/index.d.ts.map +1 -0
- package/core/link/index.js +17 -0
- package/core/link/interfaces/IAccount.d.ts +13 -0
- package/core/link/interfaces/IAccount.d.ts.map +1 -0
- package/core/link/interfaces/IAccount.js +2 -0
- package/core/link/interfaces/IFile.d.ts +7 -0
- package/core/link/interfaces/IFile.d.ts.map +1 -0
- package/core/link/interfaces/IFile.js +2 -0
- package/core/link/interfaces/ProofOfWork.d.ts +9 -0
- package/core/link/interfaces/ProofOfWork.d.ts.map +1 -0
- package/core/link/interfaces/ProofOfWork.js +12 -0
- package/core/link/interfaces/index.d.ts +4 -0
- package/core/link/interfaces/index.d.ts.map +1 -0
- package/core/link/interfaces/index.js +19 -0
- package/core/link/phantasmaLink.d.ts +41 -0
- package/core/link/phantasmaLink.d.ts.map +1 -0
- package/core/link/phantasmaLink.js +479 -0
- package/core/rpc/index.d.ts +3 -0
- package/core/rpc/index.d.ts.map +1 -0
- package/core/rpc/index.js +18 -0
- package/core/rpc/interfaces/ABIContract.d.ts +6 -0
- package/core/rpc/interfaces/ABIContract.d.ts.map +1 -0
- package/core/rpc/interfaces/ABIContract.js +2 -0
- package/core/rpc/interfaces/ABIEvent.d.ts +7 -0
- package/core/rpc/interfaces/ABIEvent.d.ts.map +1 -0
- package/core/rpc/interfaces/ABIEvent.js +2 -0
- package/core/rpc/interfaces/ABIMethod.d.ts +7 -0
- package/core/rpc/interfaces/ABIMethod.d.ts.map +1 -0
- package/core/rpc/interfaces/ABIMethod.js +2 -0
- package/core/rpc/interfaces/ABIParameter.d.ts +5 -0
- package/core/rpc/interfaces/ABIParameter.d.ts.map +1 -0
- package/core/rpc/interfaces/ABIParameter.js +2 -0
- package/core/rpc/interfaces/Account.d.ts +16 -0
- package/core/rpc/interfaces/Account.d.ts.map +1 -0
- package/core/rpc/interfaces/Account.js +2 -0
- package/core/rpc/interfaces/AccountTransactions.d.ts +6 -0
- package/core/rpc/interfaces/AccountTransactions.d.ts.map +1 -0
- package/core/rpc/interfaces/AccountTransactions.js +2 -0
- package/core/rpc/interfaces/Archive.d.ts +11 -0
- package/core/rpc/interfaces/Archive.d.ts.map +1 -0
- package/core/rpc/interfaces/Archive.js +2 -0
- package/core/rpc/interfaces/Auction.d.ts +13 -0
- package/core/rpc/interfaces/Auction.d.ts.map +1 -0
- package/core/rpc/interfaces/Auction.js +2 -0
- package/core/rpc/interfaces/Balance.d.ts +8 -0
- package/core/rpc/interfaces/Balance.d.ts.map +1 -0
- package/core/rpc/interfaces/Balance.js +2 -0
- package/core/rpc/interfaces/Block.d.ts +17 -0
- package/core/rpc/interfaces/Block.d.ts.map +1 -0
- package/core/rpc/interfaces/Block.js +2 -0
- package/core/rpc/interfaces/Chain.d.ts +10 -0
- package/core/rpc/interfaces/Chain.d.ts.map +1 -0
- package/core/rpc/interfaces/Chain.js +2 -0
- package/core/rpc/interfaces/Channel.d.ts +13 -0
- package/core/rpc/interfaces/Channel.d.ts.map +1 -0
- package/core/rpc/interfaces/Channel.js +2 -0
- package/core/rpc/interfaces/Contract.d.ts +11 -0
- package/core/rpc/interfaces/Contract.d.ts.map +1 -0
- package/core/rpc/interfaces/Contract.js +2 -0
- package/core/rpc/interfaces/Dapp.d.ts +6 -0
- package/core/rpc/interfaces/Dapp.d.ts.map +1 -0
- package/core/rpc/interfaces/Dapp.js +2 -0
- package/core/rpc/interfaces/Event.d.ts +7 -0
- package/core/rpc/interfaces/Event.d.ts.map +1 -0
- package/core/rpc/interfaces/Event.js +2 -0
- package/core/rpc/interfaces/Governance.d.ts +5 -0
- package/core/rpc/interfaces/Governance.d.ts.map +1 -0
- package/core/rpc/interfaces/Governance.js +2 -0
- package/core/rpc/interfaces/Interop.d.ts +5 -0
- package/core/rpc/interfaces/Interop.d.ts.map +1 -0
- package/core/rpc/interfaces/Interop.js +2 -0
- package/core/rpc/interfaces/KeyValue.d.ts +5 -0
- package/core/rpc/interfaces/KeyValue.d.ts.map +1 -0
- package/core/rpc/interfaces/KeyValue.js +2 -0
- package/core/rpc/interfaces/Leaderboard.d.ts +6 -0
- package/core/rpc/interfaces/Leaderboard.d.ts.map +1 -0
- package/core/rpc/interfaces/Leaderboard.js +2 -0
- package/core/rpc/interfaces/LeaderboardRow.d.ts +5 -0
- package/core/rpc/interfaces/LeaderboardRow.d.ts.map +1 -0
- package/core/rpc/interfaces/LeaderboardRow.js +2 -0
- package/core/rpc/interfaces/NFT.d.ts +14 -0
- package/core/rpc/interfaces/NFT.d.ts.map +1 -0
- package/core/rpc/interfaces/NFT.js +2 -0
- package/core/rpc/interfaces/Nexus.d.ts +14 -0
- package/core/rpc/interfaces/Nexus.d.ts.map +1 -0
- package/core/rpc/interfaces/Nexus.js +2 -0
- package/core/rpc/interfaces/Oracle.d.ts +5 -0
- package/core/rpc/interfaces/Oracle.d.ts.map +1 -0
- package/core/rpc/interfaces/Oracle.js +2 -0
- package/core/rpc/interfaces/Organization.d.ts +6 -0
- package/core/rpc/interfaces/Organization.d.ts.map +1 -0
- package/core/rpc/interfaces/Organization.js +2 -0
- package/core/rpc/interfaces/Paginated.d.ts +8 -0
- package/core/rpc/interfaces/Paginated.d.ts.map +1 -0
- package/core/rpc/interfaces/Paginated.js +2 -0
- package/core/rpc/interfaces/Peer.d.ts +8 -0
- package/core/rpc/interfaces/Peer.d.ts.map +1 -0
- package/core/rpc/interfaces/Peer.js +2 -0
- package/core/rpc/interfaces/Platform.d.ts +9 -0
- package/core/rpc/interfaces/Platform.d.ts.map +1 -0
- package/core/rpc/interfaces/Platform.js +2 -0
- package/core/rpc/interfaces/Receipt.d.ts +10 -0
- package/core/rpc/interfaces/Receipt.d.ts.map +1 -0
- package/core/rpc/interfaces/Receipt.js +2 -0
- package/core/rpc/interfaces/Script.d.ts +9 -0
- package/core/rpc/interfaces/Script.d.ts.map +1 -0
- package/core/rpc/interfaces/Script.js +2 -0
- package/core/rpc/interfaces/SendRawTx.d.ts +5 -0
- package/core/rpc/interfaces/SendRawTx.d.ts.map +1 -0
- package/core/rpc/interfaces/SendRawTx.js +2 -0
- package/core/rpc/interfaces/SignatureResult.d.ts +5 -0
- package/core/rpc/interfaces/SignatureResult.d.ts.map +1 -0
- package/core/rpc/interfaces/SignatureResult.js +2 -0
- package/core/rpc/interfaces/Stake.d.ts +6 -0
- package/core/rpc/interfaces/Stake.d.ts.map +1 -0
- package/core/rpc/interfaces/Stake.js +2 -0
- package/core/rpc/interfaces/Storage.d.ts +8 -0
- package/core/rpc/interfaces/Storage.d.ts.map +1 -0
- package/core/rpc/interfaces/Storage.js +2 -0
- package/core/rpc/interfaces/Swap.d.ts +13 -0
- package/core/rpc/interfaces/Swap.d.ts.map +1 -0
- package/core/rpc/interfaces/Swap.js +2 -0
- package/core/rpc/interfaces/Token.d.ts +19 -0
- package/core/rpc/interfaces/Token.d.ts.map +1 -0
- package/core/rpc/interfaces/Token.js +2 -0
- package/core/rpc/interfaces/TokenData.d.ts +13 -0
- package/core/rpc/interfaces/TokenData.d.ts.map +1 -0
- package/core/rpc/interfaces/TokenData.js +2 -0
- package/core/rpc/interfaces/TokenExternal.d.ts +5 -0
- package/core/rpc/interfaces/TokenExternal.d.ts.map +1 -0
- package/core/rpc/interfaces/TokenExternal.js +2 -0
- package/core/rpc/interfaces/TokenPrice.d.ts +8 -0
- package/core/rpc/interfaces/TokenPrice.d.ts.map +1 -0
- package/core/rpc/interfaces/TokenPrice.js +2 -0
- package/core/rpc/interfaces/TokenSeries.d.ts +12 -0
- package/core/rpc/interfaces/TokenSeries.d.ts.map +1 -0
- package/core/rpc/interfaces/TokenSeries.js +2 -0
- package/core/rpc/interfaces/TransactionData.d.ts +23 -0
- package/core/rpc/interfaces/TransactionData.d.ts.map +1 -0
- package/core/rpc/interfaces/TransactionData.js +2 -0
- package/core/rpc/interfaces/Validator.d.ts +5 -0
- package/core/rpc/interfaces/Validator.d.ts.map +1 -0
- package/core/rpc/interfaces/Validator.js +2 -0
- package/core/rpc/interfaces/index.d.ts +42 -0
- package/core/rpc/interfaces/index.d.ts.map +1 -0
- package/core/rpc/interfaces/index.js +57 -0
- package/core/rpc/phantasma.d.ts +89 -0
- package/core/rpc/phantasma.d.ts.map +1 -0
- package/core/rpc/phantasma.js +900 -0
- package/core/tx/SignatureKind.js +9 -0
- package/core/tx/Transaction.d.ts +28 -0
- package/core/tx/Transaction.d.ts.map +1 -0
- package/core/tx/Transaction.js +209 -0
- package/core/tx/index.d.ts +3 -0
- package/core/tx/index.d.ts.map +1 -0
- package/core/tx/index.js +18 -0
- package/core/tx/utils.d.ts +10 -0
- package/core/tx/utils.d.ts.map +1 -0
- package/core/tx/utils.js +147 -0
- package/core/types/Address.d.ts +41 -0
- package/core/types/Address.d.ts.map +1 -0
- package/core/types/Address.js +276 -0
- package/core/types/Consensus.d.ts +61 -0
- package/core/types/Consensus.d.ts.map +1 -0
- package/core/types/Consensus.js +151 -0
- package/core/types/Contract.d.ts +60 -0
- package/core/types/Contract.d.ts.map +1 -0
- package/core/types/Contract.js +342 -0
- package/core/types/DomainSettings.d.ts +87 -0
- package/core/types/DomainSettings.d.ts.map +1 -0
- package/core/types/DomainSettings.js +107 -0
- package/core/types/Ed25519Signature.d.ts +16 -0
- package/core/types/Ed25519Signature.d.ts.map +1 -0
- package/core/types/Ed25519Signature.js +78 -0
- package/core/types/Entropy.d.ts +5 -0
- package/core/types/Entropy.d.ts.map +1 -0
- package/core/types/Entropy.js +24 -0
- package/core/types/Extensions/Base16.d.ts +7 -0
- package/core/types/Extensions/Base16.d.ts.map +1 -0
- package/core/types/Extensions/Base16.js +36 -0
- package/core/types/Extensions/BinaryReader.d.ts +17 -0
- package/core/types/Extensions/BinaryReader.d.ts.map +1 -0
- package/core/types/Extensions/BinaryReader.js +192 -0
- package/core/types/Extensions/BinaryWriter.d.ts +25 -0
- package/core/types/Extensions/BinaryWriter.d.ts.map +1 -0
- package/core/types/Extensions/BinaryWriter.js +191 -0
- package/core/types/Extensions/Describer.d.ts +5 -0
- package/core/types/Extensions/Describer.d.ts.map +1 -0
- package/core/types/Extensions/Describer.js +25 -0
- package/core/types/Extensions/PBinaryReader.d.ts +42 -0
- package/core/types/Extensions/PBinaryReader.d.ts.map +1 -0
- package/core/types/Extensions/PBinaryReader.js +269 -0
- package/core/types/Extensions/PBinaryWriter.d.ts +49 -0
- package/core/types/Extensions/PBinaryWriter.d.ts.map +1 -0
- package/core/types/Extensions/PBinaryWriter.js +250 -0
- package/core/types/Extensions/TableColumns.d.ts +5 -0
- package/core/types/Extensions/TableColumns.d.ts.map +1 -0
- package/core/types/Extensions/TableColumns.js +22 -0
- package/core/types/Extensions/index.d.ts +5 -0
- package/core/types/Extensions/index.d.ts.map +1 -0
- package/core/types/Extensions/index.js +20 -0
- package/core/types/PhantasmaKeys.d.ts +19 -0
- package/core/types/PhantasmaKeys.d.ts.map +1 -0
- package/core/types/PhantasmaKeys.js +92 -0
- package/core/types/Serialization.d.ts +22 -0
- package/core/types/Serialization.d.ts.map +1 -0
- package/core/types/Serialization.js +195 -0
- package/core/types/Stack.d.ts +16 -0
- package/core/types/Stack.d.ts.map +1 -0
- package/core/types/Stack.js +42 -0
- package/core/types/Timestamp.d.ts +26 -0
- package/core/types/Timestamp.d.ts.map +1 -0
- package/core/types/Timestamp.js +74 -0
- package/core/types/index.d.ts +12 -0
- package/core/types/index.d.ts.map +1 -0
- package/core/types/index.js +27 -0
- package/core/utils/index.d.ts +25 -0
- package/core/utils/index.d.ts.map +1 -0
- package/core/utils/index.js +236 -0
- package/core/vm/Contracts.d.ts +17 -0
- package/core/vm/Contracts.d.ts.map +1 -0
- package/core/vm/Contracts.js +20 -0
- package/core/vm/Decoder.d.ts +19 -0
- package/core/vm/Decoder.d.ts.map +1 -0
- package/core/vm/Decoder.js +175 -0
- package/core/vm/EventData.d.ts +97 -0
- package/core/vm/EventData.d.ts.map +1 -0
- package/core/vm/EventData.js +134 -0
- package/core/vm/Opcode.d.ts +57 -0
- package/core/vm/Opcode.d.ts.map +1 -0
- package/core/vm/Opcode.js +69 -0
- package/core/vm/ScriptBuilder.d.ts +65 -0
- package/core/vm/ScriptBuilder.d.ts.map +1 -0
- package/core/vm/ScriptBuilder.js +592 -0
- package/core/vm/VMObject.d.ts +55 -0
- package/core/vm/VMObject.d.ts.map +1 -0
- package/core/vm/VMObject.js +1101 -0
- package/core/vm/VMType.d.ts +12 -0
- package/core/vm/VMType.d.ts.map +1 -0
- package/core/vm/VMType.js +15 -0
- package/core/vm/index.d.ts +8 -0
- package/core/vm/index.d.ts.map +1 -0
- package/core/vm/index.js +23 -0
- package/html/TestWebPage.html +187 -0
- package/html/phantasma.js +60504 -0
- package/index.d.ts +5 -0
- package/index.d.ts.map +1 -0
- package/index.js +36 -0
- package/jest.config.js +5 -0
- package/package.json +67 -0
- package/src/core/index.ts +9 -0
- package/src/core/interfaces/IContract.ts +28 -0
- package/src/core/interfaces/IKeyPair.ts +14 -0
- package/src/core/interfaces/ISerializable.ts +6 -0
- package/src/core/interfaces/IStack.ts +6 -0
- package/src/core/interfaces/IToken.ts +31 -0
- package/src/core/interfaces/Signature.ts +32 -0
- package/src/core/interfaces/index.ts +6 -0
- package/src/core/ledger/Address-Transcode.ts +44 -0
- package/src/core/ledger/Ledger-Commands.ts +463 -0
- package/src/core/ledger/Ledger-Utils.ts +549 -0
- package/src/core/ledger/Mnemonic.ts +79 -0
- package/src/core/ledger/Transaction-Sign.ts +126 -0
- package/src/core/ledger/Transaction-Transcode.ts +56 -0
- package/src/core/ledger/index.ts +8 -0
- package/src/core/ledger/interfaces/ApplicationNameResponse.ts +5 -0
- package/src/core/ledger/interfaces/Device.ts +6 -0
- package/src/core/ledger/interfaces/DeviceResponse.ts +6 -0
- package/src/core/ledger/interfaces/Ledger.ts +10 -0
- package/src/core/ledger/interfaces/LedgerBalanceFromLedgerResponse.ts +9 -0
- package/src/core/ledger/interfaces/LedgerConfig.ts +17 -0
- package/src/core/ledger/interfaces/LedgerDeviceInfoResponse.ts +7 -0
- package/src/core/ledger/interfaces/LedgerSendTransactionResponse.ts +4 -0
- package/src/core/ledger/interfaces/LedgerSigner.ts +6 -0
- package/src/core/ledger/interfaces/LedgerSignerData.ts +8 -0
- package/src/core/ledger/interfaces/PublicKeyResponse.ts +5 -0
- package/src/core/ledger/interfaces/SignResponse.ts +5 -0
- package/src/core/ledger/interfaces/VersionResponse.ts +5 -0
- package/src/core/ledger/interfaces/index.ts +13 -0
- package/src/core/link/easyConnect.ts +214 -0
- package/src/core/link/easyScript.ts +67 -0
- package/src/core/link/index.ts +1 -0
- package/src/core/link/interfaces/IAccount.ts +13 -0
- package/src/core/link/interfaces/IFile.ts +6 -0
- package/src/core/link/interfaces/ProofOfWork.ts +8 -0
- package/src/core/link/interfaces/index.ts +3 -0
- package/src/core/link/phantasmaLink.ts +561 -0
- package/src/core/rpc/index.ts +2 -0
- package/src/core/rpc/interfaces/ABIContract.ts +6 -0
- package/src/core/rpc/interfaces/ABIEvent.ts +6 -0
- package/src/core/rpc/interfaces/ABIMethod.ts +7 -0
- package/src/core/rpc/interfaces/ABIParameter.ts +4 -0
- package/src/core/rpc/interfaces/Account.ts +16 -0
- package/src/core/rpc/interfaces/AccountTransactions.ts +6 -0
- package/src/core/rpc/interfaces/Archive.ts +10 -0
- package/src/core/rpc/interfaces/Auction.ts +12 -0
- package/src/core/rpc/interfaces/Balance.ts +7 -0
- package/src/core/rpc/interfaces/Block.ts +17 -0
- package/src/core/rpc/interfaces/Chain.ts +9 -0
- package/src/core/rpc/interfaces/Channel.ts +12 -0
- package/src/core/rpc/interfaces/Contract.ts +11 -0
- package/src/core/rpc/interfaces/Dapp.ts +5 -0
- package/src/core/rpc/interfaces/Event.ts +6 -0
- package/src/core/rpc/interfaces/Governance.ts +4 -0
- package/src/core/rpc/interfaces/Interop.ts +4 -0
- package/src/core/rpc/interfaces/KeyValue.ts +4 -0
- package/src/core/rpc/interfaces/Leaderboard.ts +6 -0
- package/src/core/rpc/interfaces/LeaderboardRow.ts +4 -0
- package/src/core/rpc/interfaces/NFT.ts +14 -0
- package/src/core/rpc/interfaces/Nexus.ts +14 -0
- package/src/core/rpc/interfaces/Oracle.ts +4 -0
- package/src/core/rpc/interfaces/Organization.ts +5 -0
- package/src/core/rpc/interfaces/Paginated.ts +7 -0
- package/src/core/rpc/interfaces/Peer.ts +7 -0
- package/src/core/rpc/interfaces/Platform.ts +9 -0
- package/src/core/rpc/interfaces/Receipt.ts +9 -0
- package/src/core/rpc/interfaces/Script.ts +9 -0
- package/src/core/rpc/interfaces/SendRawTx.ts +4 -0
- package/src/core/rpc/interfaces/SignatureResult.ts +4 -0
- package/src/core/rpc/interfaces/Stake.ts +5 -0
- package/src/core/rpc/interfaces/Storage.ts +8 -0
- package/src/core/rpc/interfaces/Swap.ts +12 -0
- package/src/core/rpc/interfaces/Token.ts +19 -0
- package/src/core/rpc/interfaces/TokenData.ts +12 -0
- package/src/core/rpc/interfaces/TokenExternal.ts +4 -0
- package/src/core/rpc/interfaces/TokenPrice.ts +7 -0
- package/src/core/rpc/interfaces/TokenSeries.ts +12 -0
- package/src/core/rpc/interfaces/TransactionData.ts +23 -0
- package/src/core/rpc/interfaces/Validator.ts +4 -0
- package/src/core/rpc/interfaces/index.ts +41 -0
- package/src/core/rpc/phantasma.ts +466 -0
- package/src/core/tx/Transaction.ts +258 -0
- package/src/core/tx/index.ts +2 -0
- package/src/core/tx/utils.ts +106 -0
- package/src/core/types/Address.ts +290 -0
- package/src/core/types/Consensus.ts +181 -0
- package/src/core/types/Contract.ts +324 -0
- package/src/core/types/DomainSettings.ts +128 -0
- package/src/core/types/Ed25519Signature.ts +78 -0
- package/src/core/types/Entropy.ts +16 -0
- package/src/core/types/Extensions/Base16.ts +36 -0
- package/src/core/types/Extensions/Describer.ts +17 -0
- package/src/core/types/Extensions/PBinaryReader.ts +247 -0
- package/src/core/types/Extensions/PBinaryWriter.ts +278 -0
- package/src/core/types/Extensions/index.ts +4 -0
- package/src/core/types/PhantasmaKeys.ts +119 -0
- package/src/core/types/Serialization.ts +211 -0
- package/src/core/types/Stack.ts +46 -0
- package/src/core/types/Timestamp.ts +93 -0
- package/src/core/types/index.ts +11 -0
- package/src/core/utils/index.ts +206 -0
- package/src/core/vm/Contracts.ts +17 -0
- package/src/core/vm/Decoder.ts +162 -0
- package/src/core/vm/Disassembler.ts +1 -0
- package/src/core/vm/EventData.ts +135 -0
- package/src/core/vm/Opcode.ts +74 -0
- package/src/core/vm/ScriptBuilder.ts +588 -0
- package/src/core/vm/VMObject.ts +1162 -0
- package/src/core/vm/VMType.ts +11 -0
- package/src/core/vm/index.ts +7 -0
- package/src/core/vm/utils/DisasmMethodCall.ts +22 -0
- package/src/core/vm/utils/DisasmUtils.ts +89 -0
- package/src/core/vm/utils/index.ts +2 -0
- package/src/index.ts +7 -0
- package/tests/VMObject.test.ts +146 -0
- package/tests/ledger/Address-Transacode.test.ts +26 -0
- package/tests/tx/Transaction.test.ts +274 -0
- package/tests/types/Address.test.ts +26 -0
- package/tests/types/Consensus.test.ts +67 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
+
};
|
|
27
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
28
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.PBinaryReader = void 0;
|
|
32
|
+
var big_integer_1 = __importDefault(require("big-integer"));
|
|
33
|
+
var csharp_binary_stream_1 = require("csharp-binary-stream");
|
|
34
|
+
var interfaces_1 = require("../../interfaces");
|
|
35
|
+
var utils_1 = require("../../utils");
|
|
36
|
+
var vm_1 = require("../../vm");
|
|
37
|
+
var Ed25519Signature_1 = require("../Ed25519Signature");
|
|
38
|
+
var Timestamp_1 = require("../Timestamp");
|
|
39
|
+
var PBinaryReader = /** @class */ (function () {
|
|
40
|
+
function PBinaryReader(arg1) {
|
|
41
|
+
this.reader = new csharp_binary_stream_1.BinaryReader(arg1);
|
|
42
|
+
}
|
|
43
|
+
Object.defineProperty(PBinaryReader.prototype, "length", {
|
|
44
|
+
get: function () {
|
|
45
|
+
return this.reader.length;
|
|
46
|
+
},
|
|
47
|
+
enumerable: false,
|
|
48
|
+
configurable: true
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(PBinaryReader.prototype, "position", {
|
|
51
|
+
get: function () {
|
|
52
|
+
return this.reader.position;
|
|
53
|
+
},
|
|
54
|
+
set: function (value) {
|
|
55
|
+
this.reader.position = value;
|
|
56
|
+
},
|
|
57
|
+
enumerable: false,
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(PBinaryReader.prototype, "isEndOfStream", {
|
|
61
|
+
get: function () {
|
|
62
|
+
return this.reader.isEndOfStream;
|
|
63
|
+
},
|
|
64
|
+
enumerable: false,
|
|
65
|
+
configurable: true
|
|
66
|
+
});
|
|
67
|
+
PBinaryReader.prototype.readBoolean = function () {
|
|
68
|
+
return this.reader.readBoolean();
|
|
69
|
+
};
|
|
70
|
+
PBinaryReader.prototype.readByte = function () {
|
|
71
|
+
return this.reader.readByte();
|
|
72
|
+
};
|
|
73
|
+
PBinaryReader.prototype.readBytes = function (bytesToRead) {
|
|
74
|
+
return this.reader.readBytes(bytesToRead);
|
|
75
|
+
};
|
|
76
|
+
PBinaryReader.prototype.readSignedByte = function () {
|
|
77
|
+
return this.reader.readSignedByte();
|
|
78
|
+
};
|
|
79
|
+
PBinaryReader.prototype.readShort = function () {
|
|
80
|
+
return this.reader.readShort();
|
|
81
|
+
};
|
|
82
|
+
PBinaryReader.prototype.readUnsignedShort = function () {
|
|
83
|
+
return this.reader.readUnsignedShort();
|
|
84
|
+
};
|
|
85
|
+
PBinaryReader.prototype.readInt = function () {
|
|
86
|
+
return this.reader.readInt();
|
|
87
|
+
};
|
|
88
|
+
PBinaryReader.prototype.readUnsignedInt = function () {
|
|
89
|
+
return this.reader.readUnsignedInt();
|
|
90
|
+
};
|
|
91
|
+
PBinaryReader.prototype.readLongString = function () {
|
|
92
|
+
return this.reader.readLongString();
|
|
93
|
+
};
|
|
94
|
+
PBinaryReader.prototype.readLong = function () {
|
|
95
|
+
return this.reader.readLong();
|
|
96
|
+
};
|
|
97
|
+
PBinaryReader.prototype.readUnsignedLongString = function () {
|
|
98
|
+
return this.reader.readUnsignedLongString();
|
|
99
|
+
};
|
|
100
|
+
PBinaryReader.prototype.readUnsignedLong = function () {
|
|
101
|
+
return this.reader.readUnsignedLong();
|
|
102
|
+
};
|
|
103
|
+
PBinaryReader.prototype.readFloat = function () {
|
|
104
|
+
return this.reader.readFloat();
|
|
105
|
+
};
|
|
106
|
+
PBinaryReader.prototype.readDouble = function () {
|
|
107
|
+
return this.reader.readDouble();
|
|
108
|
+
};
|
|
109
|
+
PBinaryReader.prototype.readChar = function (encoding) {
|
|
110
|
+
return this.reader.readChar(encoding);
|
|
111
|
+
};
|
|
112
|
+
PBinaryReader.prototype.readChars = function (charactersToRead, encoding) {
|
|
113
|
+
return this.reader.readChars(charactersToRead, encoding);
|
|
114
|
+
};
|
|
115
|
+
PBinaryReader.prototype.readCharBytes = function (bytesToRead, encoding) {
|
|
116
|
+
return this.reader.readCharBytes(bytesToRead, encoding);
|
|
117
|
+
};
|
|
118
|
+
PBinaryReader.prototype.read = function (numBytes) {
|
|
119
|
+
var res = (0, utils_1.byteArrayToHex)(this.readBytes(numBytes)).substr(0, numBytes * 2);
|
|
120
|
+
//this.position += numBytes;
|
|
121
|
+
return res;
|
|
122
|
+
};
|
|
123
|
+
PBinaryReader.prototype.readString = function () {
|
|
124
|
+
var len = this.readVarInt();
|
|
125
|
+
return this.readStringBytes(len);
|
|
126
|
+
};
|
|
127
|
+
PBinaryReader.prototype.readStringBytes = function (numBytes) {
|
|
128
|
+
var res = "";
|
|
129
|
+
for (var i = 0; i < numBytes; ++i) {
|
|
130
|
+
res += String.fromCharCode(this.readByte());
|
|
131
|
+
}
|
|
132
|
+
return res;
|
|
133
|
+
};
|
|
134
|
+
PBinaryReader.prototype.readBigInteger = function () {
|
|
135
|
+
// TO DO: implement negative numbers
|
|
136
|
+
var len = this.readVarInt();
|
|
137
|
+
var res = 0;
|
|
138
|
+
var stringBytes = this.read(len);
|
|
139
|
+
__spreadArray([], __read(stringBytes.match(/.{1,2}/g)), false).reverse()
|
|
140
|
+
.forEach(function (c) { return (res = res * 256 + parseInt(c, 16)); });
|
|
141
|
+
var bigInt = BigInt(res);
|
|
142
|
+
return bigInt;
|
|
143
|
+
};
|
|
144
|
+
PBinaryReader.prototype.readBigIntAccurate = function () {
|
|
145
|
+
var len = this.readVarInt();
|
|
146
|
+
var res = (0, big_integer_1.default)();
|
|
147
|
+
var stringBytes = this.read(len);
|
|
148
|
+
__spreadArray([], __read(stringBytes.match(/.{1,2}/g)), false).reverse().forEach(function (c) {
|
|
149
|
+
res = res.times(256).plus(parseInt(c, 16));
|
|
150
|
+
});
|
|
151
|
+
return res.toString();
|
|
152
|
+
};
|
|
153
|
+
PBinaryReader.prototype.readSignatureV2 = function () {
|
|
154
|
+
var kind = this.readByte();
|
|
155
|
+
var curve;
|
|
156
|
+
var signature = new Ed25519Signature_1.Ed25519Signature();
|
|
157
|
+
switch (kind) {
|
|
158
|
+
case interfaces_1.SignatureKind.None:
|
|
159
|
+
return null;
|
|
160
|
+
case interfaces_1.SignatureKind.Ed25519:
|
|
161
|
+
var len = this.readVarInt();
|
|
162
|
+
signature.Bytes = (0, utils_1.stringToUint8Array)(this.read(len));
|
|
163
|
+
break;
|
|
164
|
+
case interfaces_1.SignatureKind.ECDSA:
|
|
165
|
+
curve = this.readByte();
|
|
166
|
+
signature.Bytes = (0, utils_1.stringToUint8Array)(this.readString());
|
|
167
|
+
break;
|
|
168
|
+
default:
|
|
169
|
+
throw "read signature: " + kind;
|
|
170
|
+
}
|
|
171
|
+
return signature;
|
|
172
|
+
};
|
|
173
|
+
PBinaryReader.prototype.readSignature = function () {
|
|
174
|
+
var kind = this.readByte();
|
|
175
|
+
var signature = new Ed25519Signature_1.Ed25519Signature();
|
|
176
|
+
var curve;
|
|
177
|
+
signature.Kind = kind;
|
|
178
|
+
switch (kind) {
|
|
179
|
+
case interfaces_1.SignatureKind.None:
|
|
180
|
+
return null;
|
|
181
|
+
case interfaces_1.SignatureKind.Ed25519:
|
|
182
|
+
var len = this.readVarInt();
|
|
183
|
+
signature.Bytes = (0, utils_1.stringToUint8Array)(this.read(len));
|
|
184
|
+
break;
|
|
185
|
+
case interfaces_1.SignatureKind.ECDSA:
|
|
186
|
+
curve = this.readByte();
|
|
187
|
+
signature.Bytes = (0, utils_1.stringToUint8Array)(this.readString());
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
throw "read signature: " + kind;
|
|
191
|
+
}
|
|
192
|
+
return signature;
|
|
193
|
+
};
|
|
194
|
+
PBinaryReader.prototype.readByteArray = function () {
|
|
195
|
+
var res;
|
|
196
|
+
var length = this.readVarInt();
|
|
197
|
+
if (length == 0)
|
|
198
|
+
return [];
|
|
199
|
+
res = this.read(length);
|
|
200
|
+
return res;
|
|
201
|
+
};
|
|
202
|
+
PBinaryReader.prototype.readTimestamp = function () {
|
|
203
|
+
//var len = this.readByte();
|
|
204
|
+
var result = 0;
|
|
205
|
+
var bytes = this.read(4);
|
|
206
|
+
//[...(bytes.match(/.{1,2}/g) as any)];
|
|
207
|
+
bytes
|
|
208
|
+
.match(/.{1,2}/g)
|
|
209
|
+
.reverse()
|
|
210
|
+
.forEach(function (c) { return (result = result * 256 + parseInt(c, 16)); });
|
|
211
|
+
var timestamp = new Timestamp_1.Timestamp(result);
|
|
212
|
+
return timestamp;
|
|
213
|
+
};
|
|
214
|
+
PBinaryReader.prototype.readVarInt = function () {
|
|
215
|
+
var len = this.readByte();
|
|
216
|
+
var res = 0;
|
|
217
|
+
if (len === 0xfd) {
|
|
218
|
+
__spreadArray([], __read(this.read(2).match(/.{1,2}/g)), false).reverse()
|
|
219
|
+
.forEach(function (c) { return (res = res * 256 + parseInt(c, 16)); });
|
|
220
|
+
return res;
|
|
221
|
+
}
|
|
222
|
+
else if (len === 0xfe) {
|
|
223
|
+
__spreadArray([], __read(this.read(4).match(/.{1,2}/g)), false).reverse()
|
|
224
|
+
.forEach(function (c) { return (res = res * 256 + parseInt(c, 16)); });
|
|
225
|
+
return res;
|
|
226
|
+
}
|
|
227
|
+
else if (len === 0xff) {
|
|
228
|
+
__spreadArray([], __read(this.read(8).match(/.{1,2}/g)), false).reverse()
|
|
229
|
+
.forEach(function (c) { return (res = res * 256 + parseInt(c, 16)); });
|
|
230
|
+
return res;
|
|
231
|
+
}
|
|
232
|
+
return len;
|
|
233
|
+
};
|
|
234
|
+
PBinaryReader.prototype.readVarString = function () {
|
|
235
|
+
var len = this.readVarInt();
|
|
236
|
+
if (len == 0)
|
|
237
|
+
return "";
|
|
238
|
+
return this.readStringBytes(len);
|
|
239
|
+
};
|
|
240
|
+
PBinaryReader.prototype.readVmObject = function () {
|
|
241
|
+
var type = this.readByte();
|
|
242
|
+
switch (type) {
|
|
243
|
+
case vm_1.VMType.String:
|
|
244
|
+
return this.readString();
|
|
245
|
+
case vm_1.VMType.Number:
|
|
246
|
+
return this.readBigIntAccurate();
|
|
247
|
+
case vm_1.VMType.Bool:
|
|
248
|
+
return this.readByte() != 0;
|
|
249
|
+
case vm_1.VMType.Struct:
|
|
250
|
+
var numFields = this.readVarInt();
|
|
251
|
+
var res = {};
|
|
252
|
+
for (var i = 0; i < numFields; ++i) {
|
|
253
|
+
var key = this.readVmObject();
|
|
254
|
+
var value = this.readVmObject();
|
|
255
|
+
res[key] = value;
|
|
256
|
+
}
|
|
257
|
+
return res;
|
|
258
|
+
case vm_1.VMType.Enum:
|
|
259
|
+
return this.readVarInt();
|
|
260
|
+
case vm_1.VMType.Object:
|
|
261
|
+
var numBytes = this.readVarInt();
|
|
262
|
+
return this.read(numBytes);
|
|
263
|
+
default:
|
|
264
|
+
return "unsupported type " + type;
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
return PBinaryReader;
|
|
268
|
+
}());
|
|
269
|
+
exports.PBinaryReader = PBinaryReader;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Encoding } from "csharp-binary-stream";
|
|
3
|
+
import { Signature } from "../../interfaces";
|
|
4
|
+
import { Timestamp } from "../Timestamp";
|
|
5
|
+
type byte = number;
|
|
6
|
+
export declare class PBinaryWriter {
|
|
7
|
+
private writer;
|
|
8
|
+
_buffer: Buffer;
|
|
9
|
+
_position: number;
|
|
10
|
+
_length: number;
|
|
11
|
+
constructor(arg1?: undefined | Buffer | Uint8Array | null);
|
|
12
|
+
get length(): number;
|
|
13
|
+
get position(): number;
|
|
14
|
+
set position(value: number);
|
|
15
|
+
writeBoolean(value: boolean): void;
|
|
16
|
+
writeByte(value: number): void;
|
|
17
|
+
writeSameByte(value: number, repeats: number): void;
|
|
18
|
+
writeSignedByte(value: number): void;
|
|
19
|
+
writeShort(value: number): void;
|
|
20
|
+
writeUnsignedShort(value: number): void;
|
|
21
|
+
writeInt(value: number): void;
|
|
22
|
+
writeUnsignedInt(value: number): void;
|
|
23
|
+
writeLong(value: string | number): void;
|
|
24
|
+
writeUnsignedLong(value: string | number): void;
|
|
25
|
+
writeFloat(value: number): void;
|
|
26
|
+
writeDouble(value: number): void;
|
|
27
|
+
writeChar(character: string | number, encoding: Encoding): void;
|
|
28
|
+
writeChars(characters: string | number[], encoding: Encoding): void;
|
|
29
|
+
clear(): void;
|
|
30
|
+
toArray(): number[];
|
|
31
|
+
toUint8Array(): Uint8Array;
|
|
32
|
+
appendByte(value: number): this;
|
|
33
|
+
appendBytes(bytes: byte[]): void;
|
|
34
|
+
writeEnum(value: number): this;
|
|
35
|
+
writeBytes(bytes: byte[]): this;
|
|
36
|
+
writeVarInt(value: number): this;
|
|
37
|
+
writeTimestamp(obj: Timestamp): this;
|
|
38
|
+
writeDateTime(obj: Date): this;
|
|
39
|
+
rawString(value: string): number[];
|
|
40
|
+
writeByteArray(bytes: number[] | Uint8Array): this;
|
|
41
|
+
writeString(text: string): this;
|
|
42
|
+
emitUInt32(value: number): this;
|
|
43
|
+
writeBigInteger(value: BigInt): this;
|
|
44
|
+
writeBigIntegerString(value: string): this;
|
|
45
|
+
writeSignature(signature: Signature): this;
|
|
46
|
+
AppendHexEncoded(bytes: string): this;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=PBinaryWriter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PBinaryWriter.d.ts","sourceRoot":"","sources":["../../../src/core/types/Extensions/PBinaryWriter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAgB,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAO9D,OAAO,EAAc,SAAS,EAAiB,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,KAAK,IAAI,GAAG,MAAM,CAAC;AAEnB,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;gBACJ,IAAI,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI;IAIzD,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,IAAI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAEzB;IAED,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAIlC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAG9B,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAGnD,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGpC,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAG/B,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGvC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAG7B,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGrC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAGvC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAG/C,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAG/B,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAGhC,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAG/D,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAGnE,KAAK,IAAI,IAAI;IAGb,OAAO,IAAI,MAAM,EAAE;IAGnB,YAAY,IAAI,UAAU;IAInB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK/B,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE;IAQzB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAarC,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAOxB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAuChC,cAAc,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI;IAapC,aAAa,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI;IAarC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE;IAQ3B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,UAAU;IAS3C,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAO/B,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAkB/B,eAAe,CAAC,KAAK,EAAE,MAAM;IAI7B,qBAAqB,CAAC,KAAK,EAAE,MAAM;IAuBnC,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAU1C,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAY7C"}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PBinaryWriter = void 0;
|
|
4
|
+
var csharp_binary_stream_1 = require("csharp-binary-stream");
|
|
5
|
+
var __1 = require("../..");
|
|
6
|
+
var interfaces_1 = require("../../interfaces");
|
|
7
|
+
var PBinaryWriter = /** @class */ (function () {
|
|
8
|
+
function PBinaryWriter(arg1) {
|
|
9
|
+
this.writer = new csharp_binary_stream_1.BinaryWriter(arg1);
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(PBinaryWriter.prototype, "length", {
|
|
12
|
+
get: function () {
|
|
13
|
+
return this.writer.length;
|
|
14
|
+
},
|
|
15
|
+
enumerable: false,
|
|
16
|
+
configurable: true
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(PBinaryWriter.prototype, "position", {
|
|
19
|
+
get: function () {
|
|
20
|
+
return this.writer.position;
|
|
21
|
+
},
|
|
22
|
+
set: function (value) {
|
|
23
|
+
this.writer.position = value;
|
|
24
|
+
},
|
|
25
|
+
enumerable: false,
|
|
26
|
+
configurable: true
|
|
27
|
+
});
|
|
28
|
+
PBinaryWriter.prototype.writeBoolean = function (value) {
|
|
29
|
+
this.writer.writeBoolean(value);
|
|
30
|
+
};
|
|
31
|
+
PBinaryWriter.prototype.writeByte = function (value) {
|
|
32
|
+
this.writer.writeByte(value);
|
|
33
|
+
};
|
|
34
|
+
PBinaryWriter.prototype.writeSameByte = function (value, repeats) {
|
|
35
|
+
this.writer.writeSameByte(value, repeats);
|
|
36
|
+
};
|
|
37
|
+
PBinaryWriter.prototype.writeSignedByte = function (value) {
|
|
38
|
+
this.writer.writeSignedByte(value);
|
|
39
|
+
};
|
|
40
|
+
PBinaryWriter.prototype.writeShort = function (value) {
|
|
41
|
+
this.writer.writeShort(value);
|
|
42
|
+
};
|
|
43
|
+
PBinaryWriter.prototype.writeUnsignedShort = function (value) {
|
|
44
|
+
this.writer.writeUnsignedShort(value);
|
|
45
|
+
};
|
|
46
|
+
PBinaryWriter.prototype.writeInt = function (value) {
|
|
47
|
+
this.writer.writeInt(value);
|
|
48
|
+
};
|
|
49
|
+
PBinaryWriter.prototype.writeUnsignedInt = function (value) {
|
|
50
|
+
this.writer.writeUnsignedInt(value);
|
|
51
|
+
};
|
|
52
|
+
PBinaryWriter.prototype.writeLong = function (value) {
|
|
53
|
+
this.writer.writeLong(value);
|
|
54
|
+
};
|
|
55
|
+
PBinaryWriter.prototype.writeUnsignedLong = function (value) {
|
|
56
|
+
this.writer.writeUnsignedLong(value);
|
|
57
|
+
};
|
|
58
|
+
PBinaryWriter.prototype.writeFloat = function (value) {
|
|
59
|
+
this.writer.writeFloat(value);
|
|
60
|
+
};
|
|
61
|
+
PBinaryWriter.prototype.writeDouble = function (value) {
|
|
62
|
+
this.writer.writeDouble(value);
|
|
63
|
+
};
|
|
64
|
+
PBinaryWriter.prototype.writeChar = function (character, encoding) {
|
|
65
|
+
this.writer.writeChar(character, encoding);
|
|
66
|
+
};
|
|
67
|
+
PBinaryWriter.prototype.writeChars = function (characters, encoding) {
|
|
68
|
+
this.writer.writeChars(characters, encoding);
|
|
69
|
+
};
|
|
70
|
+
PBinaryWriter.prototype.clear = function () {
|
|
71
|
+
this.writer.clear();
|
|
72
|
+
};
|
|
73
|
+
PBinaryWriter.prototype.toArray = function () {
|
|
74
|
+
return this.writer.toArray();
|
|
75
|
+
};
|
|
76
|
+
PBinaryWriter.prototype.toUint8Array = function () {
|
|
77
|
+
return this.writer.toUint8Array();
|
|
78
|
+
};
|
|
79
|
+
PBinaryWriter.prototype.appendByte = function (value) {
|
|
80
|
+
this.writeByte(value);
|
|
81
|
+
return this;
|
|
82
|
+
};
|
|
83
|
+
PBinaryWriter.prototype.appendBytes = function (bytes) {
|
|
84
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
85
|
+
if (!Number.isNaN(bytes[i])) {
|
|
86
|
+
this.appendByte(bytes[i]);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
PBinaryWriter.prototype.writeEnum = function (value) {
|
|
91
|
+
//this.writeUnsignedInt(value);
|
|
92
|
+
var bytes = [0, 0, 0, 0];
|
|
93
|
+
for (var i = 0; i < bytes.length; i++) {
|
|
94
|
+
var byte = value & 0xff;
|
|
95
|
+
bytes[i] = byte;
|
|
96
|
+
value = (value - byte) / 256;
|
|
97
|
+
}
|
|
98
|
+
this.appendBytes(bytes);
|
|
99
|
+
return this;
|
|
100
|
+
};
|
|
101
|
+
PBinaryWriter.prototype.writeBytes = function (bytes) {
|
|
102
|
+
for (var i = 0; i < bytes.length; i++)
|
|
103
|
+
this.appendByte(bytes[i]);
|
|
104
|
+
// writer.Write(bytes);
|
|
105
|
+
return this;
|
|
106
|
+
};
|
|
107
|
+
PBinaryWriter.prototype.writeVarInt = function (value) {
|
|
108
|
+
if (value < 0)
|
|
109
|
+
throw "negative value invalid";
|
|
110
|
+
if (value < 0xfd) {
|
|
111
|
+
this.appendByte(value);
|
|
112
|
+
}
|
|
113
|
+
else if (value <= 0xffff) {
|
|
114
|
+
var B = (value & 0x0000ff00) >> 8;
|
|
115
|
+
var A = value & 0x000000ff;
|
|
116
|
+
// TODO check if the endianess is correct, might have to reverse order of appends
|
|
117
|
+
this.appendByte(0xfd);
|
|
118
|
+
this.appendByte(A);
|
|
119
|
+
this.appendByte(B);
|
|
120
|
+
}
|
|
121
|
+
else if (value <= 0xffffffff) {
|
|
122
|
+
var C = (value & 0x00ff0000) >> 16;
|
|
123
|
+
var B = (value & 0x0000ff00) >> 8;
|
|
124
|
+
var A = value & 0x000000ff;
|
|
125
|
+
// TODO check if the endianess is correct, might have to reverse order of appends
|
|
126
|
+
this.appendByte(0xfe);
|
|
127
|
+
this.appendByte(A);
|
|
128
|
+
this.appendByte(B);
|
|
129
|
+
this.appendByte(C);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
var D = (value & 0xff000000) >> 24;
|
|
133
|
+
var C = (value & 0x00ff0000) >> 16;
|
|
134
|
+
var B = (value & 0x0000ff00) >> 8;
|
|
135
|
+
var A = value & 0x000000ff;
|
|
136
|
+
// TODO check if the endianess is correct, might have to reverse order of appends
|
|
137
|
+
this.appendByte(0xff);
|
|
138
|
+
this.appendByte(A);
|
|
139
|
+
this.appendByte(B);
|
|
140
|
+
this.appendByte(C);
|
|
141
|
+
this.appendByte(D);
|
|
142
|
+
}
|
|
143
|
+
return this;
|
|
144
|
+
};
|
|
145
|
+
PBinaryWriter.prototype.writeTimestamp = function (obj) {
|
|
146
|
+
var num = obj.value;
|
|
147
|
+
var a = (num & 0xff000000) >> 24;
|
|
148
|
+
var b = (num & 0x00ff0000) >> 16;
|
|
149
|
+
var c = (num & 0x0000ff00) >> 8;
|
|
150
|
+
var d = num & 0x000000ff;
|
|
151
|
+
var bytes = [d, c, b, a];
|
|
152
|
+
this.appendBytes(bytes);
|
|
153
|
+
return this;
|
|
154
|
+
};
|
|
155
|
+
PBinaryWriter.prototype.writeDateTime = function (obj) {
|
|
156
|
+
var num = (obj.getTime() / 1000) | 0;
|
|
157
|
+
var a = (num & 0xff000000) >> 24;
|
|
158
|
+
var b = (num & 0x00ff0000) >> 16;
|
|
159
|
+
var c = (num & 0x0000ff00) >> 8;
|
|
160
|
+
var d = num & 0x000000ff;
|
|
161
|
+
var bytes = [d, c, b, a];
|
|
162
|
+
this.appendBytes(bytes);
|
|
163
|
+
return this;
|
|
164
|
+
};
|
|
165
|
+
PBinaryWriter.prototype.rawString = function (value) {
|
|
166
|
+
var data = [];
|
|
167
|
+
for (var i = 0; i < value.length; i++) {
|
|
168
|
+
data.push(value.charCodeAt(i));
|
|
169
|
+
}
|
|
170
|
+
return data;
|
|
171
|
+
};
|
|
172
|
+
PBinaryWriter.prototype.writeByteArray = function (bytes) {
|
|
173
|
+
if (bytes instanceof Uint8Array) {
|
|
174
|
+
bytes = Array.from(bytes);
|
|
175
|
+
}
|
|
176
|
+
this.writeVarInt(bytes.length);
|
|
177
|
+
this.writeBytes(bytes);
|
|
178
|
+
return this;
|
|
179
|
+
};
|
|
180
|
+
PBinaryWriter.prototype.writeString = function (text) {
|
|
181
|
+
var bytes = this.rawString(text);
|
|
182
|
+
this.writeVarInt(bytes.length);
|
|
183
|
+
this.writeBytes(bytes);
|
|
184
|
+
return this;
|
|
185
|
+
};
|
|
186
|
+
PBinaryWriter.prototype.emitUInt32 = function (value) {
|
|
187
|
+
if (value < 0)
|
|
188
|
+
throw "negative value invalid";
|
|
189
|
+
var D = (value & 0xff000000) >> 24;
|
|
190
|
+
var C = (value & 0x00ff0000) >> 16;
|
|
191
|
+
var B = (value & 0x0000ff00) >> 8;
|
|
192
|
+
var A = value & 0x000000ff;
|
|
193
|
+
// TODO check if the endianess is correct, might have to reverse order of appends
|
|
194
|
+
this.appendByte(0xff);
|
|
195
|
+
this.appendByte(A);
|
|
196
|
+
this.appendByte(B);
|
|
197
|
+
this.appendByte(C);
|
|
198
|
+
this.appendByte(D);
|
|
199
|
+
return this;
|
|
200
|
+
};
|
|
201
|
+
PBinaryWriter.prototype.writeBigInteger = function (value) {
|
|
202
|
+
return this.writeBigIntegerString(value.toString());
|
|
203
|
+
};
|
|
204
|
+
PBinaryWriter.prototype.writeBigIntegerString = function (value) {
|
|
205
|
+
var bytes = [];
|
|
206
|
+
if (value == "0") {
|
|
207
|
+
bytes = [0];
|
|
208
|
+
}
|
|
209
|
+
else if (value.startsWith("-1")) {
|
|
210
|
+
throw new Error("Unsigned bigint serialization not suppoted");
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
var hex = BigInt(value).toString(16);
|
|
214
|
+
if (hex.length % 2)
|
|
215
|
+
hex = "0" + hex;
|
|
216
|
+
var len = hex.length / 2;
|
|
217
|
+
var i = 0;
|
|
218
|
+
var j = 0;
|
|
219
|
+
while (i < len) {
|
|
220
|
+
bytes.unshift(parseInt(hex.slice(j, j + 2), 16)); // little endian
|
|
221
|
+
i += 1;
|
|
222
|
+
j += 2;
|
|
223
|
+
}
|
|
224
|
+
bytes.push(0); // add sign at the end
|
|
225
|
+
}
|
|
226
|
+
return this.writeByteArray(bytes);
|
|
227
|
+
};
|
|
228
|
+
PBinaryWriter.prototype.writeSignature = function (signature) {
|
|
229
|
+
if (!signature) {
|
|
230
|
+
this.writeByte(interfaces_1.SignatureKind.None);
|
|
231
|
+
return this;
|
|
232
|
+
}
|
|
233
|
+
this.writeByte(signature.Kind);
|
|
234
|
+
signature.SerializeData(this);
|
|
235
|
+
return this;
|
|
236
|
+
};
|
|
237
|
+
PBinaryWriter.prototype.AppendHexEncoded = function (bytes) {
|
|
238
|
+
var localEncoded = (0, __1.hexStringToBytes)(bytes);
|
|
239
|
+
this.writeVarInt(localEncoded.length);
|
|
240
|
+
/*for (let i = 0; i < localEncoded.length; i++) {
|
|
241
|
+
if (!Number.isNaN(localEncoded[i])) {
|
|
242
|
+
this.appendByte(localEncoded[i]);
|
|
243
|
+
}
|
|
244
|
+
}*/
|
|
245
|
+
this.appendBytes(localEncoded);
|
|
246
|
+
return this;
|
|
247
|
+
};
|
|
248
|
+
return PBinaryWriter;
|
|
249
|
+
}());
|
|
250
|
+
exports.PBinaryWriter = PBinaryWriter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableColumns.d.ts","sourceRoot":"","sources":["../../../src/core/types/Extensions/TableColumns.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAuC;IAC5D,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,UAAQ,GAAG,MAAM,EAAE;CAWzD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Describer = void 0;
|
|
4
|
+
var Describer = /** @class */ (function () {
|
|
5
|
+
function Describer() {
|
|
6
|
+
}
|
|
7
|
+
Describer.describe = function (val, parent) {
|
|
8
|
+
if (parent === void 0) { parent = false; }
|
|
9
|
+
var result = [];
|
|
10
|
+
if (parent) {
|
|
11
|
+
var proto = Object.getPrototypeOf(val.prototype);
|
|
12
|
+
if (proto) {
|
|
13
|
+
result = result.concat(this.describe(proto.constructor, parent));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
result = result.concat(val.toString().match(this.FRegEx) || []);
|
|
17
|
+
return result;
|
|
18
|
+
};
|
|
19
|
+
Describer.FRegEx = new RegExp(/(?:this\.)(.+?(?= ))/g);
|
|
20
|
+
return Describer;
|
|
21
|
+
}());
|
|
22
|
+
exports.Describer = Describer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/Extensions/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./PBinaryReader"), exports);
|
|
18
|
+
__exportStar(require("./PBinaryWriter"), exports);
|
|
19
|
+
__exportStar(require("./Base16"), exports);
|
|
20
|
+
__exportStar(require("./Describer"), exports);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { IKeyPair } from "../interfaces/IKeyPair";
|
|
2
|
+
import { Address } from "./Address";
|
|
3
|
+
import { Signature } from "../interfaces/Signature";
|
|
4
|
+
export declare class PhantasmaKeys implements IKeyPair {
|
|
5
|
+
private _privateKey;
|
|
6
|
+
get PrivateKey(): Uint8Array;
|
|
7
|
+
private _publicKey;
|
|
8
|
+
get PublicKey(): Uint8Array;
|
|
9
|
+
readonly Address: Address;
|
|
10
|
+
static readonly PrivateKeyLength = 32;
|
|
11
|
+
constructor(privateKey: Uint8Array);
|
|
12
|
+
toString(): string;
|
|
13
|
+
static generate(): PhantasmaKeys;
|
|
14
|
+
static fromWIF(wif: string): PhantasmaKeys;
|
|
15
|
+
toWIF(): string;
|
|
16
|
+
static xor(x: Uint8Array, y: Uint8Array): Uint8Array;
|
|
17
|
+
Sign(msg: Uint8Array, customSignFunction?: (msg: Uint8Array, privateKey: Uint8Array, publicKey: Uint8Array) => Uint8Array): Signature;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=PhantasmaKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhantasmaKeys.d.ts","sourceRoot":"","sources":["../../src/core/types/PhantasmaKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAqBpD,qBAAa,aAAc,YAAW,QAAQ;IAC5C,OAAO,CAAC,WAAW,CAAa;IAChC,IAAW,UAAU,eAEpB;IACD,OAAO,CAAC,UAAU,CAAa;IAC/B,IAAW,SAAS,eAEnB;IACD,SAAgB,OAAO,EAAE,OAAO,CAAC;IAEjC,gBAAuB,gBAAgB,MAAM;gBAEjC,UAAU,EAAE,UAAU;IAuB3B,QAAQ;WAID,QAAQ,IAAI,aAAa;WAOzB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa;IAkB1C,KAAK,IAAI,MAAM;WAOR,GAAG,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,UAAU;IAWpD,IAAI,CACT,GAAG,EAAE,UAAU,EACf,kBAAkB,CAAC,EAAE,CACnB,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,UAAU,KAClB,UAAU,GACd,SAAS;CAGb"}
|