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,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// coin used by ledger nano s.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.GetBip44Path = exports.GetPoltergeistMnemonic = exports.GetPrivateKeyFromSeed = exports.GetPrivateKeyFromMnemonic = exports.SOUL_COIN = void 0;
|
|
5
|
+
var utils_1 = require("../utils");
|
|
6
|
+
// 60 | 0x80000273 | SOUL | [Phantasma](https://phantasma.io/)
|
|
7
|
+
exports.SOUL_COIN = 60;
|
|
8
|
+
/**
|
|
9
|
+
* converts a mnemonic into a private key, using the phantasma coin's bip44 path.
|
|
10
|
+
*
|
|
11
|
+
* @param config the config
|
|
12
|
+
* @param mnemonic the mnemonic
|
|
13
|
+
* @param index the bip44 index
|
|
14
|
+
* @return returns the private key, hex encoded, upper case.
|
|
15
|
+
*/
|
|
16
|
+
var GetPrivateKeyFromMnemonic = function (config, mnemonic, index) {
|
|
17
|
+
var bip39 = config.Bip39;
|
|
18
|
+
var seedBytes = bip39.mnemonicToSeedSync(mnemonic);
|
|
19
|
+
var seed = (0, utils_1.bufferToHex)(seedBytes);
|
|
20
|
+
return (0, exports.GetPrivateKeyFromSeed)(config, seed, index);
|
|
21
|
+
};
|
|
22
|
+
exports.GetPrivateKeyFromMnemonic = GetPrivateKeyFromMnemonic;
|
|
23
|
+
/**
|
|
24
|
+
* converts a mnemonic into a seed.
|
|
25
|
+
*
|
|
26
|
+
* @param config the config
|
|
27
|
+
* @param seed the seed
|
|
28
|
+
* @param index the bip44 index
|
|
29
|
+
* @return returns the seed, hex encoded, upper case.
|
|
30
|
+
*/
|
|
31
|
+
var GetPrivateKeyFromSeed = function (config, seed, index) {
|
|
32
|
+
var bip32Factory = config.Bip32Factory;
|
|
33
|
+
var curve = config.Curve;
|
|
34
|
+
var seedBytes = (0, utils_1.hexToBuffer)(seed);
|
|
35
|
+
var bip32 = bip32Factory(curve);
|
|
36
|
+
var bip32node = bip32.fromSeed(seedBytes);
|
|
37
|
+
var bip44path = (0, exports.GetBip44Path)(index);
|
|
38
|
+
var bip32child = bip32node.derivePath(bip44path);
|
|
39
|
+
return Buffer.from(bip32child.privateKey).toString('hex').toUpperCase();
|
|
40
|
+
};
|
|
41
|
+
exports.GetPrivateKeyFromSeed = GetPrivateKeyFromSeed;
|
|
42
|
+
/**
|
|
43
|
+
* converts a mnemonic into a Poltergeist mnemonic, using the phantasma coin's bip44 path.
|
|
44
|
+
*
|
|
45
|
+
* @param config the config
|
|
46
|
+
* @param mnemonic the mnemonic
|
|
47
|
+
* @param index the index
|
|
48
|
+
* @return returns the private key, hex encoded, upper case.
|
|
49
|
+
*/
|
|
50
|
+
var GetPoltergeistMnemonic = function (config, mnemonic, index) {
|
|
51
|
+
var bip39 = config.Bip39;
|
|
52
|
+
var privateKey = (0, exports.GetPrivateKeyFromMnemonic)(config, mnemonic, index);
|
|
53
|
+
var poltergeistMnemonic = bip39.entropyToMnemonic(privateKey);
|
|
54
|
+
return poltergeistMnemonic;
|
|
55
|
+
};
|
|
56
|
+
exports.GetPoltergeistMnemonic = GetPoltergeistMnemonic;
|
|
57
|
+
/**
|
|
58
|
+
* @param index the index
|
|
59
|
+
* @return returns the bip44 path.
|
|
60
|
+
*/
|
|
61
|
+
var GetBip44Path = function (index) {
|
|
62
|
+
var bip44path = "m/44'/".concat(exports.SOUL_COIN, "'/0'/0/").concat(index);
|
|
63
|
+
return bip44path;
|
|
64
|
+
};
|
|
65
|
+
exports.GetBip44Path = GetBip44Path;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare const PrivateToDer: (privateKeyHex: string) => Buffer;
|
|
3
|
+
export declare const PublicToDer: (publicKeyHex: string) => Buffer;
|
|
4
|
+
export declare const PublicToPem: (publicKeyHex: string) => string;
|
|
5
|
+
export declare const SignBytes: (hash: Buffer, privateKey: Buffer) => string;
|
|
6
|
+
export declare const GetHash: (encodedTx: string, debug?: boolean) => Buffer;
|
|
7
|
+
export declare const Sign: (encodedTx: string, privateKeyHex: string) => string;
|
|
8
|
+
export declare const Verify: (encodedTx: string, signatureHex: string, publicKeyHex: string) => boolean;
|
|
9
|
+
export declare const GetPublicFromPrivate: (privateKey: string) => string;
|
|
10
|
+
//# sourceMappingURL=Transaction-Sign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction-Sign.d.ts","sourceRoot":"","sources":["../../src/core/ledger/Transaction-Sign.ts"],"names":[],"mappings":";AAKA,eAAO,MAAM,YAAY,kBAAmB,MAAM,KAAG,MASpD,CAAC;AAEF,eAAO,MAAM,WAAW,iBAAkB,MAAM,KAAG,MAGlD,CAAC;AAEF,eAAO,MAAM,WAAW,iBAAkB,MAAM,KAAG,MAIlD,CAAC;AAEF,eAAO,MAAM,SAAS,SAAU,MAAM,cAAc,MAAM,KAAG,MAoB5D,CAAC;AAEF,eAAO,MAAM,OAAO,cAAe,MAAM,UAAU,OAAO,KAAG,MAE5D,CAAC;AAEF,eAAO,MAAM,IAAI,cAAe,MAAM,iBAAiB,MAAM,KAAG,MAkB/D,CAAC;AAEF,eAAO,MAAM,MAAM,cAAe,MAAM,gBAAgB,MAAM,gBAAgB,MAAM,KAAG,OAqBtF,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,MAAM,KAAG,MA6BzD,CAAC"}
|
|
@@ -0,0 +1,149 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.GetPublicFromPrivate = exports.Verify = exports.Sign = exports.GetHash = exports.SignBytes = exports.PublicToPem = exports.PublicToDer = exports.PrivateToDer = void 0;
|
|
27
|
+
var crypto = __importStar(require("crypto"));
|
|
28
|
+
var PUBLIC_KEY_PREFIX = '302A300506032B6570032100';
|
|
29
|
+
var DEBUG = false;
|
|
30
|
+
var PrivateToDer = function (privateKeyHex) {
|
|
31
|
+
if (DEBUG) {
|
|
32
|
+
console.log('privateToDer', 'privateKeyHex', privateKeyHex);
|
|
33
|
+
}
|
|
34
|
+
var derHex = "302e020100300506032b657004220420".concat(privateKeyHex);
|
|
35
|
+
if (DEBUG) {
|
|
36
|
+
console.log('privateToDer', 'derHex', derHex);
|
|
37
|
+
}
|
|
38
|
+
return Buffer.from(derHex, 'hex');
|
|
39
|
+
};
|
|
40
|
+
exports.PrivateToDer = PrivateToDer;
|
|
41
|
+
var PublicToDer = function (publicKeyHex) {
|
|
42
|
+
var publicKeyDerHex = "".concat(PUBLIC_KEY_PREFIX).concat(publicKeyHex);
|
|
43
|
+
return Buffer.from(publicKeyDerHex, 'hex');
|
|
44
|
+
};
|
|
45
|
+
exports.PublicToDer = PublicToDer;
|
|
46
|
+
var PublicToPem = function (publicKeyHex) {
|
|
47
|
+
var publicKeyDer = (0, exports.PublicToDer)(publicKeyHex);
|
|
48
|
+
var publicKeyDerBase64 = publicKeyDer.toString('base64');
|
|
49
|
+
return "-----BEGIN PUBLIC KEY-----\n".concat(publicKeyDerBase64, "\n-----END PUBLIC KEY-----");
|
|
50
|
+
};
|
|
51
|
+
exports.PublicToPem = PublicToPem;
|
|
52
|
+
var SignBytes = function (hash, privateKey) {
|
|
53
|
+
if (DEBUG) {
|
|
54
|
+
console.log('signBytes.hash', hash);
|
|
55
|
+
console.log('signBytes.privateKey', privateKey);
|
|
56
|
+
}
|
|
57
|
+
var privateKeyDer = (0, exports.PrivateToDer)(privateKey.toString('hex'));
|
|
58
|
+
if (DEBUG) {
|
|
59
|
+
console.log('signBytes.privateKeyDer', privateKeyDer);
|
|
60
|
+
}
|
|
61
|
+
var privateKeyObj = crypto.createPrivateKey({
|
|
62
|
+
key: privateKeyDer,
|
|
63
|
+
format: 'der',
|
|
64
|
+
type: 'pkcs8',
|
|
65
|
+
});
|
|
66
|
+
var signature = crypto.sign(undefined, hash, privateKeyObj);
|
|
67
|
+
var signatureHex = signature.toString('hex');
|
|
68
|
+
if (DEBUG) {
|
|
69
|
+
console.log('signatureHex', signatureHex);
|
|
70
|
+
}
|
|
71
|
+
return signatureHex;
|
|
72
|
+
};
|
|
73
|
+
exports.SignBytes = SignBytes;
|
|
74
|
+
var GetHash = function (encodedTx, debug) {
|
|
75
|
+
return Buffer.from(encodedTx, 'hex');
|
|
76
|
+
};
|
|
77
|
+
exports.GetHash = GetHash;
|
|
78
|
+
var Sign = function (encodedTx, privateKeyHex) {
|
|
79
|
+
if (DEBUG) {
|
|
80
|
+
console.log('sign', 'encodedTx', encodedTx);
|
|
81
|
+
}
|
|
82
|
+
var privateKey = Buffer.from(privateKeyHex, 'hex');
|
|
83
|
+
if (DEBUG) {
|
|
84
|
+
console.log('sign', 'privateKey', privateKey.toString('hex'));
|
|
85
|
+
}
|
|
86
|
+
var hash = (0, exports.GetHash)(encodedTx);
|
|
87
|
+
if (DEBUG) {
|
|
88
|
+
console.log('sign', 'hash', hash.toString('hex'));
|
|
89
|
+
}
|
|
90
|
+
var signature = (0, exports.SignBytes)(hash, privateKey);
|
|
91
|
+
if (DEBUG) {
|
|
92
|
+
console.log('sign', 'signature', signature);
|
|
93
|
+
}
|
|
94
|
+
return signature.toLowerCase();
|
|
95
|
+
};
|
|
96
|
+
exports.Sign = Sign;
|
|
97
|
+
var Verify = function (encodedTx, signatureHex, publicKeyHex) {
|
|
98
|
+
if (DEBUG) {
|
|
99
|
+
console.log('verify', 'encodedTx', encodedTx);
|
|
100
|
+
console.log('verify', 'signatureHex', signatureHex);
|
|
101
|
+
console.log('verify', 'publicKeyHex', publicKeyHex);
|
|
102
|
+
}
|
|
103
|
+
var publicKeyPem = (0, exports.PublicToPem)(publicKeyHex);
|
|
104
|
+
if (DEBUG) {
|
|
105
|
+
console.log('verify', 'publicKeyPem', publicKeyPem);
|
|
106
|
+
}
|
|
107
|
+
var publicKeyObj = crypto.createPublicKey({
|
|
108
|
+
key: publicKeyPem,
|
|
109
|
+
format: 'pem',
|
|
110
|
+
type: 'spki',
|
|
111
|
+
});
|
|
112
|
+
var signature = Buffer.from(signatureHex, 'hex');
|
|
113
|
+
var hash = (0, exports.GetHash)(encodedTx);
|
|
114
|
+
if (DEBUG) {
|
|
115
|
+
console.log('verify', 'hash', hash.toString('hex'));
|
|
116
|
+
}
|
|
117
|
+
return crypto.verify(undefined, hash, publicKeyObj, signature);
|
|
118
|
+
};
|
|
119
|
+
exports.Verify = Verify;
|
|
120
|
+
var GetPublicFromPrivate = function (privateKey) {
|
|
121
|
+
var privateKeyDer = (0, exports.PrivateToDer)(privateKey);
|
|
122
|
+
var privateKeyObj = crypto.createPrivateKey({
|
|
123
|
+
key: privateKeyDer,
|
|
124
|
+
format: 'der',
|
|
125
|
+
type: 'pkcs8',
|
|
126
|
+
});
|
|
127
|
+
var privateKeyString = privateKeyObj.export({ format: 'der', type: 'pkcs8' });
|
|
128
|
+
/*const publicKeyObj = crypto.createPublicKey({
|
|
129
|
+
key: privateKeyObj,
|
|
130
|
+
format: 'pem',
|
|
131
|
+
type: 'sec1',
|
|
132
|
+
});*/
|
|
133
|
+
var publicKeyObj = crypto.createPublicKey({
|
|
134
|
+
key: privateKeyString,
|
|
135
|
+
format: 'pem',
|
|
136
|
+
type: 'spki',
|
|
137
|
+
});
|
|
138
|
+
var encodedHex = publicKeyObj
|
|
139
|
+
.export({ format: 'der', type: 'spki' })
|
|
140
|
+
.toString('hex')
|
|
141
|
+
.toUpperCase();
|
|
142
|
+
if (encodedHex.startsWith(PUBLIC_KEY_PREFIX)) {
|
|
143
|
+
return encodedHex.substring(PUBLIC_KEY_PREFIX.length);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
throw new Error("unknown prefix, expecting '".concat(PUBLIC_KEY_PREFIX, "' cannot decode public key '").concat(encodedHex, "'"));
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
exports.GetPublicFromPrivate = GetPublicFromPrivate;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Expiration Date is in UTC Seconds
|
|
3
|
+
* @param expirationDate
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare const GetDateAsUTCSeconds: (expirationDate: any) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Get Expiration Date
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
export declare const GetExpirationDate: () => Date;
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param transaction
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
export declare const EncodeSendTxWithSignature: (transaction: any) => any;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param transaction
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const EncodeSendTxWithoutSignature: (transaction: any) => any;
|
|
24
|
+
//# sourceMappingURL=Transaction-Transcode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transaction-Transcode.d.ts","sourceRoot":"","sources":["../../src/core/ledger/Transaction-Transcode.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,iCAU/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAK7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,2BAKrC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,2BAIxC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EncodeSendTxWithoutSignature = exports.EncodeSendTxWithSignature = exports.GetExpirationDate = exports.GetDateAsUTCSeconds = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Expiration Date is in UTC Seconds
|
|
6
|
+
* @param expirationDate
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
var GetDateAsUTCSeconds = function (expirationDate) {
|
|
10
|
+
var expirationDateUTCms = Date.UTC(expirationDate.getUTCFullYear(), expirationDate.getUTCMonth(), expirationDate.getUTCDate(), expirationDate.getUTCHours(), expirationDate.getUTCMinutes(), expirationDate.getUTCSeconds());
|
|
11
|
+
return expirationDateUTCms / 1000;
|
|
12
|
+
};
|
|
13
|
+
exports.GetDateAsUTCSeconds = GetDateAsUTCSeconds;
|
|
14
|
+
/**
|
|
15
|
+
* Get Expiration Date
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
var GetExpirationDate = function () {
|
|
19
|
+
// TODO: make expirationDate configurable.
|
|
20
|
+
var expirationMinutes = 5; // This is in minutes
|
|
21
|
+
var expirationDate = new Date(Date.now() + expirationMinutes * 60000);
|
|
22
|
+
return expirationDate;
|
|
23
|
+
};
|
|
24
|
+
exports.GetExpirationDate = GetExpirationDate;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param transaction
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
var EncodeSendTxWithSignature = function (transaction) {
|
|
31
|
+
// console.log('encodeSendTx', 'transaction', transaction);
|
|
32
|
+
var sendTx = transaction.toString(true);
|
|
33
|
+
// console.log('encodeSendTx', 'sendTx', sendTx);
|
|
34
|
+
return sendTx;
|
|
35
|
+
};
|
|
36
|
+
exports.EncodeSendTxWithSignature = EncodeSendTxWithSignature;
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param transaction
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
var EncodeSendTxWithoutSignature = function (transaction) {
|
|
43
|
+
var sendTx = transaction.toString(false);
|
|
44
|
+
// console.log('encodeSendTx', 'sendTx', sendTx);
|
|
45
|
+
return sendTx;
|
|
46
|
+
};
|
|
47
|
+
exports.EncodeSendTxWithoutSignature = EncodeSendTxWithoutSignature;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Mnemonic';
|
|
2
|
+
export * from './Address-Transcode';
|
|
3
|
+
export * from './interfaces/LedgerConfig';
|
|
4
|
+
export * from './Ledger-Utils';
|
|
5
|
+
export * from './Ledger-Commands';
|
|
6
|
+
export * from './Transaction-Transcode';
|
|
7
|
+
export * from './Transaction-Sign';
|
|
8
|
+
export * from './interfaces/index';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/ledger/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
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("./Mnemonic"), exports);
|
|
18
|
+
__exportStar(require("./Address-Transcode"), exports);
|
|
19
|
+
__exportStar(require("./interfaces/LedgerConfig"), exports);
|
|
20
|
+
__exportStar(require("./Ledger-Utils"), exports);
|
|
21
|
+
__exportStar(require("./Ledger-Commands"), exports);
|
|
22
|
+
__exportStar(require("./Transaction-Transcode"), exports);
|
|
23
|
+
__exportStar(require("./Transaction-Sign"), exports);
|
|
24
|
+
__exportStar(require("./interfaces/index"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApplicationNameResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/ApplicationNameResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/Device.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeviceResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/DeviceResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,GAAG,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Ledger.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/Ledger.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Address } from '../../types';
|
|
2
|
+
export interface LedgerBalanceFromLedgerResponse {
|
|
3
|
+
success: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
publicKey?: string;
|
|
6
|
+
address?: Address;
|
|
7
|
+
balances?: Map<string, {
|
|
8
|
+
amount: number;
|
|
9
|
+
decimals: number;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=LedgerBalanceFromLedgerResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerBalanceFromLedgerResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerBalanceFromLedgerResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PhantasmaAPI } from '../../rpc/phantasma';
|
|
2
|
+
export interface LedgerConfig {
|
|
3
|
+
Debug: boolean;
|
|
4
|
+
Transport: any;
|
|
5
|
+
Bip39: any;
|
|
6
|
+
Bip32Factory: any;
|
|
7
|
+
Curve: any;
|
|
8
|
+
NexusName: string;
|
|
9
|
+
ChainName: string;
|
|
10
|
+
Payload: string;
|
|
11
|
+
TokenNames: string[];
|
|
12
|
+
RPC: PhantasmaAPI;
|
|
13
|
+
GasPrice: number;
|
|
14
|
+
GasLimit: number;
|
|
15
|
+
VerifyResponse: boolean;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=LedgerConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerConfig.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,GAAG,CAAC;IACf,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,CAAC;IAClB,KAAK,EAAE,GAAG,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,EAAE,YAAY,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { VersionResponse } from './VersionResponse';
|
|
2
|
+
import { ApplicationNameResponse } from './ApplicationNameResponse';
|
|
3
|
+
export interface LedgerDeviceInfoResponse {
|
|
4
|
+
version: VersionResponse;
|
|
5
|
+
applicationName: ApplicationNameResponse;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=LedgerDeviceInfoResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerDeviceInfoResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerDeviceInfoResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,eAAe,CAAC;IACzB,eAAe,EAAE,uBAAuB,CAAC;CAC1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerSendTransactionResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerSendTransactionResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerSigner.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,YAAY;IAC3B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,OAAO,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LedgerSignerData.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/LedgerSignerData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicKeyResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/PublicKeyResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/SignResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VersionResponse.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/VersionResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './ApplicationNameResponse';
|
|
2
|
+
export * from './Device';
|
|
3
|
+
export * from './DeviceResponse';
|
|
4
|
+
export * from './Ledger';
|
|
5
|
+
export * from './LedgerConfig';
|
|
6
|
+
export * from './LedgerDeviceInfoResponse';
|
|
7
|
+
export * from './PublicKeyResponse';
|
|
8
|
+
export * from './SignResponse';
|
|
9
|
+
export * from './VersionResponse';
|
|
10
|
+
export * from './LedgerBalanceFromLedgerResponse';
|
|
11
|
+
export * from './LedgerSigner';
|
|
12
|
+
export * from './LedgerSignerData';
|
|
13
|
+
export * from './LedgerSendTransactionResponse';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/ledger/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mCAAmC,CAAC;AAClD,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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("./ApplicationNameResponse"), exports);
|
|
18
|
+
__exportStar(require("./Device"), exports);
|
|
19
|
+
__exportStar(require("./DeviceResponse"), exports);
|
|
20
|
+
__exportStar(require("./Ledger"), exports);
|
|
21
|
+
__exportStar(require("./LedgerConfig"), exports);
|
|
22
|
+
__exportStar(require("./LedgerDeviceInfoResponse"), exports);
|
|
23
|
+
__exportStar(require("./PublicKeyResponse"), exports);
|
|
24
|
+
__exportStar(require("./SignResponse"), exports);
|
|
25
|
+
__exportStar(require("./VersionResponse"), exports);
|
|
26
|
+
__exportStar(require("./LedgerBalanceFromLedgerResponse"), exports);
|
|
27
|
+
__exportStar(require("./LedgerSigner"), exports);
|
|
28
|
+
__exportStar(require("./LedgerSignerData"), exports);
|
|
29
|
+
__exportStar(require("./LedgerSendTransactionResponse"), exports);
|