@airgap/tezos 0.13.11-beta.1 → 0.13.11-beta.3
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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +1 -5
- package/v0/actions/GetKtAccountsAction.d.ts +8 -0
- package/v0/actions/GetKtAccountsAction.js +87 -0
- package/v0/actions/GetKtAccountsAction.js.map +1 -0
- package/v0/constants.d.ts +18 -0
- package/v0/constants.js +28 -0
- package/v0/constants.js.map +1 -0
- package/v0/index.d.ts +46 -0
- package/v0/index.js +146 -0
- package/v0/index.js.map +1 -0
- package/v0/protocol/TezosAddress.d.ts +11 -0
- package/v0/protocol/TezosAddress.js +107 -0
- package/v0/protocol/TezosAddress.js.map +1 -0
- package/v0/protocol/TezosCryptoClient.d.ts +15 -0
- package/v0/protocol/TezosCryptoClient.js +160 -0
- package/v0/protocol/TezosCryptoClient.js.map +1 -0
- package/v0/protocol/TezosProtocol.d.ts +349 -0
- package/v0/protocol/TezosProtocol.js +1861 -0
- package/v0/protocol/TezosProtocol.js.map +1 -0
- package/v0/protocol/TezosProtocolOptions.d.ts +29 -0
- package/v0/protocol/TezosProtocolOptions.js +116 -0
- package/v0/protocol/TezosProtocolOptions.js.map +1 -0
- package/v0/protocol/TezosUtils.d.ts +40 -0
- package/v0/protocol/TezosUtils.js +301 -0
- package/v0/protocol/TezosUtils.js.map +1 -0
- package/v0/protocol/contract/TezosContract.d.ts +52 -0
- package/v0/protocol/contract/TezosContract.js +508 -0
- package/v0/protocol/contract/TezosContract.js.map +1 -0
- package/v0/protocol/contract/TezosContractCall.d.ts +11 -0
- package/v0/protocol/contract/TezosContractCall.js +23 -0
- package/v0/protocol/contract/TezosContractCall.js.map +1 -0
- package/v0/protocol/contract/TezosContractEntrypoint.d.ts +8 -0
- package/v0/protocol/contract/TezosContractEntrypoint.js +27 -0
- package/v0/protocol/contract/TezosContractEntrypoint.js.map +1 -0
- package/v0/protocol/contract/TezosContractStorage.d.ts +7 -0
- package/v0/protocol/contract/TezosContractStorage.js +16 -0
- package/v0/protocol/contract/TezosContractStorage.js.map +1 -0
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.d.ts +11 -0
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +36 -0
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -0
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.d.ts +12 -0
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js +152 -0
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js.map +1 -0
- package/v0/protocol/domains/TezosDomains.d.ts +20 -0
- package/v0/protocol/domains/TezosDomains.js +310 -0
- package/v0/protocol/domains/TezosDomains.js.map +1 -0
- package/v0/protocol/fa/TezosBTC.d.ts +12 -0
- package/v0/protocol/fa/TezosBTC.js +109 -0
- package/v0/protocol/fa/TezosBTC.js.map +1 -0
- package/v0/protocol/fa/TezosBTCtez.d.ts +10 -0
- package/v0/protocol/fa/TezosBTCtez.js +56 -0
- package/v0/protocol/fa/TezosBTCtez.js.map +1 -0
- package/v0/protocol/fa/TezosCTez.d.ts +10 -0
- package/v0/protocol/fa/TezosCTez.js +53 -0
- package/v0/protocol/fa/TezosCTez.js.map +1 -0
- package/v0/protocol/fa/TezosDOGA.d.ts +10 -0
- package/v0/protocol/fa/TezosDOGA.js +53 -0
- package/v0/protocol/fa/TezosDOGA.js.map +1 -0
- package/v0/protocol/fa/TezosETHtz.d.ts +9 -0
- package/v0/protocol/fa/TezosETHtz.js +74 -0
- package/v0/protocol/fa/TezosETHtz.js.map +1 -0
- package/v0/protocol/fa/TezosFA1Protocol.d.ts +27 -0
- package/v0/protocol/fa/TezosFA1Protocol.js +312 -0
- package/v0/protocol/fa/TezosFA1Protocol.js.map +1 -0
- package/v0/protocol/fa/TezosFA1p2Protocol.d.ts +8 -0
- package/v0/protocol/fa/TezosFA1p2Protocol.js +119 -0
- package/v0/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
- package/v0/protocol/fa/TezosFA2Protocol.d.ts +58 -0
- package/v0/protocol/fa/TezosFA2Protocol.js +452 -0
- package/v0/protocol/fa/TezosFA2Protocol.js.map +1 -0
- package/v0/protocol/fa/TezosFAProtocol.d.ts +65 -0
- package/v0/protocol/fa/TezosFAProtocol.js +455 -0
- package/v0/protocol/fa/TezosFAProtocol.js.map +1 -0
- package/v0/protocol/fa/TezosFAProtocolOptions.d.ts +54 -0
- package/v0/protocol/fa/TezosFAProtocolOptions.js +230 -0
- package/v0/protocol/fa/TezosFAProtocolOptions.js.map +1 -0
- package/v0/protocol/fa/TezosKolibriUSD.d.ts +10 -0
- package/v0/protocol/fa/TezosKolibriUSD.js +76 -0
- package/v0/protocol/fa/TezosKolibriUSD.js.map +1 -0
- package/v0/protocol/fa/TezosPlanty.d.ts +10 -0
- package/v0/protocol/fa/TezosPlanty.js +53 -0
- package/v0/protocol/fa/TezosPlanty.js.map +1 -0
- package/v0/protocol/fa/TezosQUIPU.d.ts +10 -0
- package/v0/protocol/fa/TezosQUIPU.js +56 -0
- package/v0/protocol/fa/TezosQUIPU.js.map +1 -0
- package/v0/protocol/fa/TezosSIRS.d.ts +10 -0
- package/v0/protocol/fa/TezosSIRS.js +53 -0
- package/v0/protocol/fa/TezosSIRS.js.map +1 -0
- package/v0/protocol/fa/TezosStaker.d.ts +10 -0
- package/v0/protocol/fa/TezosStaker.js +76 -0
- package/v0/protocol/fa/TezosStaker.js.map +1 -0
- package/v0/protocol/fa/TezosUBTC.d.ts +10 -0
- package/v0/protocol/fa/TezosUBTC.js +56 -0
- package/v0/protocol/fa/TezosUBTC.js.map +1 -0
- package/v0/protocol/fa/TezosUDEFI.d.ts +10 -0
- package/v0/protocol/fa/TezosUDEFI.js +56 -0
- package/v0/protocol/fa/TezosUDEFI.js.map +1 -0
- package/v0/protocol/fa/TezosUSD.d.ts +10 -0
- package/v0/protocol/fa/TezosUSD.js +76 -0
- package/v0/protocol/fa/TezosUSD.js.map +1 -0
- package/v0/protocol/fa/TezosUSDT.d.ts +10 -0
- package/v0/protocol/fa/TezosUSDT.js +56 -0
- package/v0/protocol/fa/TezosUSDT.js.map +1 -0
- package/v0/protocol/fa/TezosUUSD.d.ts +6 -0
- package/v0/protocol/fa/TezosUUSD.js +33 -0
- package/v0/protocol/fa/TezosUUSD.js.map +1 -0
- package/v0/protocol/fa/TezosWRAP.d.ts +10 -0
- package/v0/protocol/fa/TezosWRAP.js +56 -0
- package/v0/protocol/fa/TezosWRAP.js.map +1 -0
- package/v0/protocol/fa/TezosWrapped.d.ts +10 -0
- package/v0/protocol/fa/TezosWrapped.js +76 -0
- package/v0/protocol/fa/TezosWrapped.js.map +1 -0
- package/v0/protocol/fa/TezosYOU.d.ts +6 -0
- package/v0/protocol/fa/TezosYOU.js +33 -0
- package/v0/protocol/fa/TezosYOU.js.map +1 -0
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.d.ts +13 -0
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js +180 -0
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js.map +1 -0
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.d.ts +8 -0
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js +97 -0
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js.map +1 -0
- package/v0/protocol/fa/metadata/TokenMetadataIndexer.d.ts +4 -0
- package/v0/protocol/fa/metadata/TokenMetadataIndexer.js +3 -0
- package/v0/protocol/fa/metadata/TokenMetadataIndexer.js.map +1 -0
- package/v0/protocol/indexerClient/TezosIndexerClient.d.ts +29 -0
- package/v0/protocol/indexerClient/TezosIndexerClient.js +269 -0
- package/v0/protocol/indexerClient/TezosIndexerClient.js.map +1 -0
- package/v0/protocol/indexerClient/TezosProtocolIndexerClient.d.ts +30 -0
- package/v0/protocol/indexerClient/TezosProtocolIndexerClient.js +3 -0
- package/v0/protocol/indexerClient/TezosProtocolIndexerClient.js.map +1 -0
- package/v0/protocol/kt/TezosKtAddress.d.ts +5 -0
- package/v0/protocol/kt/TezosKtAddress.js +74 -0
- package/v0/protocol/kt/TezosKtAddress.js.map +1 -0
- package/v0/protocol/kt/TezosKtProtocol.d.ts +30 -0
- package/v0/protocol/kt/TezosKtProtocol.js +320 -0
- package/v0/protocol/kt/TezosKtProtocol.js.map +1 -0
- package/v0/protocol/sapling/TezosSaplingAddress.d.ts +12 -0
- package/v0/protocol/sapling/TezosSaplingAddress.js +141 -0
- package/v0/protocol/sapling/TezosSaplingAddress.js.map +1 -0
- package/v0/protocol/sapling/TezosSaplingCryptoClient.d.ts +34 -0
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js +248 -0
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js.map +1 -0
- package/v0/protocol/sapling/TezosSaplingProtocol.d.ts +135 -0
- package/v0/protocol/sapling/TezosSaplingProtocol.js +1182 -0
- package/v0/protocol/sapling/TezosSaplingProtocol.js.map +1 -0
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.d.ts +45 -0
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js +73 -0
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js.map +1 -0
- package/v0/protocol/sapling/TezosShieldedTezProtocol.d.ts +12 -0
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js +144 -0
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -0
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.d.ts +6 -0
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js +68 -0
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js.map +1 -0
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.d.ts +8 -0
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js +78 -0
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js.map +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.d.ts +34 -0
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js +591 -0
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.d.ts +22 -0
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js +158 -0
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js.map +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingForger.d.ts +27 -0
- package/v0/protocol/sapling/utils/TezosSaplingForger.js +304 -0
- package/v0/protocol/sapling/utils/TezosSaplingForger.js.map +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingState.d.ts +17 -0
- package/v0/protocol/sapling/utils/TezosSaplingState.js +266 -0
- package/v0/protocol/sapling/utils/TezosSaplingState.js.map +1 -0
- package/v0/protocol/types/TezosAddressCursor.d.ts +3 -0
- package/v0/protocol/types/TezosAddressCursor.js +3 -0
- package/v0/protocol/types/TezosAddressCursor.js.map +1 -0
- package/v0/protocol/types/TezosAddressResult.d.ts +4 -0
- package/v0/protocol/types/TezosAddressResult.js +3 -0
- package/v0/protocol/types/TezosAddressResult.js.map +1 -0
- package/v0/protocol/types/TezosBlockHeader.d.ts +13 -0
- package/v0/protocol/types/TezosBlockHeader.js +3 -0
- package/v0/protocol/types/TezosBlockHeader.js.map +1 -0
- package/v0/protocol/types/TezosBlockMetadata.d.ts +7 -0
- package/v0/protocol/types/TezosBlockMetadata.js +3 -0
- package/v0/protocol/types/TezosBlockMetadata.js.map +1 -0
- package/v0/protocol/types/TezosContractCode.d.ts +5 -0
- package/v0/protocol/types/TezosContractCode.js +3 -0
- package/v0/protocol/types/TezosContractCode.js.map +1 -0
- package/v0/protocol/types/TezosOperationType.d.ts +13 -0
- package/v0/protocol/types/TezosOperationType.js +18 -0
- package/v0/protocol/types/TezosOperationType.js.map +1 -0
- package/v0/protocol/types/TezosTransactionCursor.d.ts +3 -0
- package/v0/protocol/types/TezosTransactionCursor.js +3 -0
- package/v0/protocol/types/TezosTransactionCursor.js.map +1 -0
- package/v0/protocol/types/TezosTransactionResult.d.ts +6 -0
- package/v0/protocol/types/TezosTransactionResult.js +3 -0
- package/v0/protocol/types/TezosTransactionResult.js.map +1 -0
- package/v0/protocol/types/TezosWrappedOperation.d.ts +5 -0
- package/v0/protocol/types/TezosWrappedOperation.js +3 -0
- package/v0/protocol/types/TezosWrappedOperation.js.map +1 -0
- package/v0/protocol/types/contract/BigMap.d.ts +7 -0
- package/v0/protocol/types/contract/BigMap.js +3 -0
- package/v0/protocol/types/contract/BigMap.js.map +1 -0
- package/v0/protocol/types/contract/BigMapEntry.d.ts +8 -0
- package/v0/protocol/types/contract/BigMapEntry.js +3 -0
- package/v0/protocol/types/contract/BigMapEntry.js.map +1 -0
- package/v0/protocol/types/contract/BigMapEntryFilter.d.ts +5 -0
- package/v0/protocol/types/contract/BigMapEntryFilter.js +3 -0
- package/v0/protocol/types/contract/BigMapEntryFilter.js.map +1 -0
- package/v0/protocol/types/contract/BigMapRequest.d.ts +10 -0
- package/v0/protocol/types/contract/BigMapRequest.js +3 -0
- package/v0/protocol/types/contract/BigMapRequest.js.map +1 -0
- package/v0/protocol/types/contract/TezosContractMetadata.d.ts +61 -0
- package/v0/protocol/types/contract/TezosContractMetadata.js +3 -0
- package/v0/protocol/types/contract/TezosContractMetadata.js.map +1 -0
- package/v0/protocol/types/domains/TezosDomainsRecord.d.ts +8 -0
- package/v0/protocol/types/domains/TezosDomainsRecord.js +3 -0
- package/v0/protocol/types/domains/TezosDomainsRecord.js.map +1 -0
- package/v0/protocol/types/domains/TezosDomainsReverseRecord.d.ts +5 -0
- package/v0/protocol/types/domains/TezosDomainsReverseRecord.js +3 -0
- package/v0/protocol/types/domains/TezosDomainsReverseRecord.js.map +1 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfRequest.d.ts +4 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfRequest.js +3 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfRequest.js.map +1 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfResponse.d.ts +5 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfResponse.js +3 -0
- package/v0/protocol/types/fa/TezosFA2BalanceOfResponse.js.map +1 -0
- package/v0/protocol/types/fa/TezosFA2TransferRequest.d.ts +8 -0
- package/v0/protocol/types/fa/TezosFA2TransferRequest.js +3 -0
- package/v0/protocol/types/fa/TezosFA2TransferRequest.js.map +1 -0
- package/v0/protocol/types/fa/TezosFA2UpdateOperatorRequest.d.ts +6 -0
- package/v0/protocol/types/fa/TezosFA2UpdateOperatorRequest.js +3 -0
- package/v0/protocol/types/fa/TezosFA2UpdateOperatorRequest.js.map +1 -0
- package/v0/protocol/types/fa/TezosFATokenMetadata.d.ts +6 -0
- package/v0/protocol/types/fa/TezosFATokenMetadata.js +3 -0
- package/v0/protocol/types/fa/TezosFATokenMetadata.js.map +1 -0
- package/v0/protocol/types/kt/TezosKtAddressCursor.d.ts +4 -0
- package/v0/protocol/types/kt/TezosKtAddressCursor.js +3 -0
- package/v0/protocol/types/kt/TezosKtAddressCursor.js.map +1 -0
- package/v0/protocol/types/kt/TezosKtAddressResult.d.ts +5 -0
- package/v0/protocol/types/kt/TezosKtAddressResult.js +3 -0
- package/v0/protocol/types/kt/TezosKtAddressResult.js.map +1 -0
- package/v0/protocol/types/micheline/MichelineNode.d.ts +15 -0
- package/v0/protocol/types/micheline/MichelineNode.js +5 -0
- package/v0/protocol/types/micheline/MichelineNode.js.map +1 -0
- package/v0/protocol/types/micheline/MichelineNodeUtils.d.ts +6 -0
- package/v0/protocol/types/micheline/MichelineNodeUtils.js +40 -0
- package/v0/protocol/types/micheline/MichelineNodeUtils.js.map +1 -0
- package/v0/protocol/types/michelson/MichelsonType.d.ts +11 -0
- package/v0/protocol/types/michelson/MichelsonType.js +22 -0
- package/v0/protocol/types/michelson/MichelsonType.js.map +1 -0
- package/v0/protocol/types/michelson/MichelsonTypeMeta.d.ts +33 -0
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js +136 -0
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js.map +1 -0
- package/v0/protocol/types/michelson/MichelsonTypeUtils.d.ts +19 -0
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js +251 -0
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js.map +1 -0
- package/v0/protocol/types/michelson/generics/MichelsonList.d.ts +11 -0
- package/v0/protocol/types/michelson/generics/MichelsonList.js +70 -0
- package/v0/protocol/types/michelson/generics/MichelsonList.js.map +1 -0
- package/v0/protocol/types/michelson/generics/MichelsonMap.d.ts +14 -0
- package/v0/protocol/types/michelson/generics/MichelsonMap.js +120 -0
- package/v0/protocol/types/michelson/generics/MichelsonMap.js.map +1 -0
- package/v0/protocol/types/michelson/generics/MichelsonOption.d.ts +25 -0
- package/v0/protocol/types/michelson/generics/MichelsonOption.js +121 -0
- package/v0/protocol/types/michelson/generics/MichelsonOption.js.map +1 -0
- package/v0/protocol/types/michelson/generics/MichelsonOr.d.ts +25 -0
- package/v0/protocol/types/michelson/generics/MichelsonOr.js +134 -0
- package/v0/protocol/types/michelson/generics/MichelsonOr.js.map +1 -0
- package/v0/protocol/types/michelson/generics/MichelsonPair.d.ts +17 -0
- package/v0/protocol/types/michelson/generics/MichelsonPair.js +139 -0
- package/v0/protocol/types/michelson/generics/MichelsonPair.js.map +1 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarData.d.ts +2 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarData.js +4 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarData.js.map +1 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js +4 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js.map +1 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarType.js +4 -0
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarType.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.d.ts +15 -0
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js +74 -0
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBool.d.ts +12 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js +59 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.d.ts +14 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js +77 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonInt.d.ts +14 -0
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js +74 -0
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonString.d.ts +14 -0
- package/v0/protocol/types/michelson/primitives/MichelsonString.js +76 -0
- package/v0/protocol/types/michelson/primitives/MichelsonString.js.map +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.d.ts +9 -0
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.js +55 -0
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.js.map +1 -0
- package/v0/protocol/types/operations/ActivateAccount.d.ts +7 -0
- package/v0/protocol/types/operations/ActivateAccount.js +3 -0
- package/v0/protocol/types/operations/ActivateAccount.js.map +1 -0
- package/v0/protocol/types/operations/Ballot.d.ts +9 -0
- package/v0/protocol/types/operations/Ballot.js +3 -0
- package/v0/protocol/types/operations/Ballot.js.map +1 -0
- package/v0/protocol/types/operations/Delegation.d.ts +11 -0
- package/v0/protocol/types/operations/Delegation.js +3 -0
- package/v0/protocol/types/operations/Delegation.js.map +1 -0
- package/v0/protocol/types/operations/DoubleBakingEvidence.d.ts +8 -0
- package/v0/protocol/types/operations/DoubleBakingEvidence.js +3 -0
- package/v0/protocol/types/operations/DoubleBakingEvidence.js.map +1 -0
- package/v0/protocol/types/operations/DoubleEndorsementEvidence.d.ts +16 -0
- package/v0/protocol/types/operations/DoubleEndorsementEvidence.js +3 -0
- package/v0/protocol/types/operations/DoubleEndorsementEvidence.js.map +1 -0
- package/v0/protocol/types/operations/Endorsement.d.ts +6 -0
- package/v0/protocol/types/operations/Endorsement.js +3 -0
- package/v0/protocol/types/operations/Endorsement.js.map +1 -0
- package/v0/protocol/types/operations/Origination.d.ts +13 -0
- package/v0/protocol/types/operations/Origination.js +3 -0
- package/v0/protocol/types/operations/Origination.js.map +1 -0
- package/v0/protocol/types/operations/Proposal.d.ts +7 -0
- package/v0/protocol/types/operations/Proposal.js +3 -0
- package/v0/protocol/types/operations/Proposal.js.map +1 -0
- package/v0/protocol/types/operations/Reveal.d.ts +11 -0
- package/v0/protocol/types/operations/Reveal.js +3 -0
- package/v0/protocol/types/operations/Reveal.js.map +1 -0
- package/v0/protocol/types/operations/SeedNonceRevelation.d.ts +7 -0
- package/v0/protocol/types/operations/SeedNonceRevelation.js +3 -0
- package/v0/protocol/types/operations/SeedNonceRevelation.js.map +1 -0
- package/v0/protocol/types/operations/TezosOperation.d.ts +4 -0
- package/v0/protocol/types/operations/TezosOperation.js +3 -0
- package/v0/protocol/types/operations/TezosOperation.js.map +1 -0
- package/v0/protocol/types/operations/Transaction.d.ts +23 -0
- package/v0/protocol/types/operations/Transaction.js +3 -0
- package/v0/protocol/types/operations/Transaction.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressCursor.d.ts +4 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressCursor.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressCursor.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressResult.d.ts +4 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressResult.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingAddressResult.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingCiphertext.d.ts +8 -0
- package/v0/protocol/types/sapling/TezosSaplingCiphertext.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingCiphertext.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingInput.d.ts +6 -0
- package/v0/protocol/types/sapling/TezosSaplingInput.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingInput.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingOutput.d.ts +6 -0
- package/v0/protocol/types/sapling/TezosSaplingOutput.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingOutput.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingStateDiff.d.ts +6 -0
- package/v0/protocol/types/sapling/TezosSaplingStateDiff.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingStateDiff.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingStateTree.d.ts +7 -0
- package/v0/protocol/types/sapling/TezosSaplingStateTree.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingStateTree.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingTransaction.d.ts +23 -0
- package/v0/protocol/types/sapling/TezosSaplingTransaction.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingTransaction.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionCursor.d.ts +3 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionCursor.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionCursor.js.map +1 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionResult.d.ts +6 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionResult.js +3 -0
- package/v0/protocol/types/sapling/TezosSaplingTransactionResult.js.map +1 -0
- package/v0/protocol/types/utils.d.ts +8 -0
- package/v0/protocol/types/utils.js +41 -0
- package/v0/protocol/types/utils.js.map +1 -0
- package/v0/serializer/schemas/v2/transaction-sign-request-tezos-sapling.json +127 -0
- package/v0/serializer/schemas/v2/transaction-sign-request-tezos.json +29 -0
- package/v0/serializer/schemas/v2/transaction-sign-response-tezos-sapling.json +19 -0
- package/v0/serializer/schemas/v2/transaction-sign-response-tezos.json +19 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-tezos-sapling.json +133 -0
- package/v0/serializer/schemas/v3/transaction-sign-request-tezos.json +29 -0
- package/v0/serializer/schemas/v3/transaction-sign-response-tezos-sapling.json +19 -0
- package/v0/serializer/schemas/v3/transaction-sign-response-tezos.json +19 -0
- package/v0/serializer/validators/transaction-validator.d.ts +15 -0
- package/v0/serializer/validators/transaction-validator.js +107 -0
- package/v0/serializer/validators/transaction-validator.js.map +1 -0
- package/v0/serializer/validators/transaction-xtz-btc-validator.d.ts +18 -0
- package/v0/serializer/validators/transaction-xtz-btc-validator.js +170 -0
- package/v0/serializer/validators/transaction-xtz-btc-validator.js.map +1 -0
- package/v0/serializer/validators/validators.d.ts +1 -0
- package/v0/serializer/validators/validators.js +115 -0
- package/v0/serializer/validators/validators.js.map +1 -0
- package/v0/types/signed-transaction-tezos-sapling.d.ts +3 -0
- package/v0/types/signed-transaction-tezos-sapling.js +3 -0
- package/v0/types/signed-transaction-tezos-sapling.js.map +1 -0
- package/v0/types/signed-transaction-tezos.d.ts +5 -0
- package/v0/types/signed-transaction-tezos.js +3 -0
- package/v0/types/signed-transaction-tezos.js.map +1 -0
- package/v0/types/transaction-tezos.d.ts +14 -0
- package/v0/types/transaction-tezos.js +3 -0
- package/v0/types/transaction-tezos.js.map +1 -0
- package/v0/types/unsigned-transaction-tezos-sapling.d.ts +38 -0
- package/v0/types/unsigned-transaction-tezos-sapling.js +3 -0
- package/v0/types/unsigned-transaction-tezos-sapling.js.map +1 -0
- package/v0/types/unsigned-transaction-tezos.d.ts +8 -0
- package/v0/types/unsigned-transaction-tezos.js +3 -0
- package/v0/types/unsigned-transaction-tezos.js.map +1 -0
- package/v1/block-explorer/TzKTBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/TzKTBlockExplorer.js +72 -0
- package/v1/block-explorer/TzKTBlockExplorer.js.map +1 -0
- package/v1/block-explorer/factory.d.ts +3 -0
- package/v1/block-explorer/factory.js +17 -0
- package/v1/block-explorer/factory.js.map +1 -0
- package/v1/contract/TezosContract.d.ts +52 -0
- package/v1/contract/TezosContract.js +508 -0
- package/v1/contract/TezosContract.js.map +1 -0
- package/v1/contract/TezosContractCall.d.ts +11 -0
- package/v1/contract/TezosContractCall.js +23 -0
- package/v1/contract/TezosContractCall.js.map +1 -0
- package/v1/contract/TezosContractEntrypoint.d.ts +9 -0
- package/v1/contract/TezosContractEntrypoint.js +27 -0
- package/v1/contract/TezosContractEntrypoint.js.map +1 -0
- package/v1/contract/TezosContractStorage.d.ts +7 -0
- package/v1/contract/TezosContractStorage.js +16 -0
- package/v1/contract/TezosContractStorage.js.map +1 -0
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.d.ts +11 -0
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js +36 -0
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -0
- package/v1/contract/remote-data/TezosStorageRemoteData.d.ts +12 -0
- package/v1/contract/remote-data/TezosStorageRemoteData.js +152 -0
- package/v1/contract/remote-data/TezosStorageRemoteData.js.map +1 -0
- package/v1/crypto/TezosCryptoClient.d.ts +13 -0
- package/v1/crypto/TezosCryptoClient.js +153 -0
- package/v1/crypto/TezosCryptoClient.js.map +1 -0
- package/v1/crypto/TezosSaplingCryptoClient.d.ts +25 -0
- package/v1/crypto/TezosSaplingCryptoClient.js +222 -0
- package/v1/crypto/TezosSaplingCryptoClient.js.map +1 -0
- package/v1/data/TezosAddress.d.ts +9 -0
- package/v1/data/TezosAddress.js +27 -0
- package/v1/data/TezosAddress.js.map +1 -0
- package/v1/data/TezosSaplingAddress.d.ts +14 -0
- package/v1/data/TezosSaplingAddress.js +105 -0
- package/v1/data/TezosSaplingAddress.js.map +1 -0
- package/v1/index.d.ts +53 -0
- package/v1/index.js +82 -0
- package/v1/index.js.map +1 -0
- package/v1/indexer/TezosIndexerClient.d.ts +31 -0
- package/v1/indexer/TezosIndexerClient.js +3 -0
- package/v1/indexer/TezosIndexerClient.js.map +1 -0
- package/v1/indexer/TzKTIndexerClient.d.ts +31 -0
- package/v1/indexer/TzKTIndexerClient.js +283 -0
- package/v1/indexer/TzKTIndexerClient.js.map +1 -0
- package/v1/indexer/factory.d.ts +3 -0
- package/v1/indexer/factory.js +17 -0
- package/v1/indexer/factory.js.map +1 -0
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.d.ts +12 -0
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js +178 -0
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js.map +1 -0
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.d.ts +8 -0
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js +95 -0
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js.map +1 -0
- package/v1/indexer/token-metadata/TokenMetadataIndexerClient.d.ts +4 -0
- package/v1/indexer/token-metadata/TokenMetadataIndexerClient.js +3 -0
- package/v1/indexer/token-metadata/TokenMetadataIndexerClient.js.map +1 -0
- package/v1/injector/TezosSaplingInjectorClient.d.ts +6 -0
- package/v1/injector/TezosSaplingInjectorClient.js +68 -0
- package/v1/injector/TezosSaplingInjectorClient.js.map +1 -0
- package/v1/module/TezosModule.d.ts +11 -0
- package/v1/module/TezosModule.js +202 -0
- package/v1/module/TezosModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/node/TezosSaplingNodeClient.d.ts +8 -0
- package/v1/node/TezosSaplingNodeClient.js +78 -0
- package/v1/node/TezosSaplingNodeClient.js.map +1 -0
- package/v1/protocol/TezosProtocol.d.ts +74 -0
- package/v1/protocol/TezosProtocol.js +948 -0
- package/v1/protocol/TezosProtocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA1Protocol.d.ts +30 -0
- package/v1/protocol/fa/TezosFA1Protocol.js +211 -0
- package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.d.ts +19 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.js +122 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA2Protocol.d.ts +40 -0
- package/v1/protocol/fa/TezosFA2Protocol.js +305 -0
- package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFAProtocol.d.ts +79 -0
- package/v1/protocol/fa/TezosFAProtocol.js +581 -0
- package/v1/protocol/fa/TezosFAProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/BTCTezProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/BTCTezProtocol.js +74 -0
- package/v1/protocol/fa/tokens/BTCTezProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/CTezProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/CTezProtocol.js +74 -0
- package/v1/protocol/fa/tokens/CTezProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/DogamiProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/DogamiProtocol.js +74 -0
- package/v1/protocol/fa/tokens/DogamiProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/ETHTezProtocol.d.ts +18 -0
- package/v1/protocol/fa/tokens/ETHTezProtocol.js +117 -0
- package/v1/protocol/fa/tokens/ETHTezProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.d.ts +18 -0
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js +117 -0
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/PlentyProtocol.d.ts +18 -0
- package/v1/protocol/fa/tokens/PlentyProtocol.js +117 -0
- package/v1/protocol/fa/tokens/PlentyProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/QuipuswapProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js +74 -0
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/SiriusProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/SiriusProtocol.js +74 -0
- package/v1/protocol/fa/tokens/SiriusProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/StakerProtocol.d.ts +18 -0
- package/v1/protocol/fa/tokens/StakerProtocol.js +117 -0
- package/v1/protocol/fa/tokens/StakerProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/TetherUSDProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js +74 -0
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/TzBTCProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/TzBTCProtocol.js +74 -0
- package/v1/protocol/fa/tokens/TzBTCProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/UBTCProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/UBTCProtocol.js +74 -0
- package/v1/protocol/fa/tokens/UBTCProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/UDEFIProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/UDEFIProtocol.js +74 -0
- package/v1/protocol/fa/tokens/UDEFIProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/USDTezProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/USDTezProtocol.js +74 -0
- package/v1/protocol/fa/tokens/USDTezProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/UUSDProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/UUSDProtocol.js +74 -0
- package/v1/protocol/fa/tokens/UUSDProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/WrapProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/WrapProtocol.js +74 -0
- package/v1/protocol/fa/tokens/WrapProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js +74 -0
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js.map +1 -0
- package/v1/protocol/fa/tokens/YouProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/YouProtocol.js +74 -0
- package/v1/protocol/fa/tokens/YouProtocol.js.map +1 -0
- package/v1/protocol/kt/TezosKtProtocol.d.ts +19 -0
- package/v1/protocol/kt/TezosKtProtocol.js +508 -0
- package/v1/protocol/kt/TezosKtProtocol.js.map +1 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +105 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.js +1010 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.js.map +1 -0
- package/v1/protocol/sapling/TezosShieldedTezProtocol.d.ts +17 -0
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js +188 -0
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +13 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +59 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.d.ts +8 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-tezos-sapling.json +145 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-tezos.json +29 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-tezos-sapling.json +19 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-tezos.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +15 -0
- package/v1/serializer/v3/serializer-companion.js +521 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +14 -0
- package/v1/serializer/v3/validators/transaction-validator.js +179 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +4 -0
- package/v1/serializer/v3/validators/validators.js +108 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/address.d.ts +7 -0
- package/v1/types/address.js +3 -0
- package/v1/types/address.js.map +1 -0
- package/v1/types/block/TezosBlockHeader.d.ts +13 -0
- package/v1/types/block/TezosBlockHeader.js +3 -0
- package/v1/types/block/TezosBlockHeader.js.map +1 -0
- package/v1/types/block-explorer.d.ts +6 -0
- package/v1/types/block-explorer.js +3 -0
- package/v1/types/block-explorer.js.map +1 -0
- package/v1/types/contract/TezosContractCode.d.ts +5 -0
- package/v1/types/contract/TezosContractCode.js +3 -0
- package/v1/types/contract/TezosContractCode.js.map +1 -0
- package/v1/types/contract/TezosContractMetadata.d.ts +61 -0
- package/v1/types/contract/TezosContractMetadata.js +3 -0
- package/v1/types/contract/TezosContractMetadata.js.map +1 -0
- package/v1/types/contract/bigmap/BigMap.d.ts +7 -0
- package/v1/types/contract/bigmap/BigMap.js +3 -0
- package/v1/types/contract/bigmap/BigMap.js.map +1 -0
- package/v1/types/contract/bigmap/BigMapEnrtyFilter.d.ts +5 -0
- package/v1/types/contract/bigmap/BigMapEnrtyFilter.js +3 -0
- package/v1/types/contract/bigmap/BigMapEnrtyFilter.js.map +1 -0
- package/v1/types/contract/bigmap/BigMapEntry.d.ts +8 -0
- package/v1/types/contract/bigmap/BigMapEntry.js +3 -0
- package/v1/types/contract/bigmap/BigMapEntry.js.map +1 -0
- package/v1/types/contract/bigmap/BigMapRequest.d.ts +10 -0
- package/v1/types/contract/bigmap/BigMapRequest.js +3 -0
- package/v1/types/contract/bigmap/BigMapRequest.js.map +1 -0
- package/v1/types/crypto.d.ts +3 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/fa/TezosFA1ContractEntrypoint.d.ts +1 -0
- package/v1/types/fa/TezosFA1ContractEntrypoint.js +3 -0
- package/v1/types/fa/TezosFA1ContractEntrypoint.js.map +1 -0
- package/v1/types/fa/TezosFA1p2ContractEntrypoint.d.ts +2 -0
- package/v1/types/fa/TezosFA1p2ContractEntrypoint.js +3 -0
- package/v1/types/fa/TezosFA1p2ContractEntrypoint.js.map +1 -0
- package/v1/types/fa/TezosFA2BalanceOfRequest.d.ts +4 -0
- package/v1/types/fa/TezosFA2BalanceOfRequest.js +3 -0
- package/v1/types/fa/TezosFA2BalanceOfRequest.js.map +1 -0
- package/v1/types/fa/TezosFA2BalanceOfResponse.d.ts +5 -0
- package/v1/types/fa/TezosFA2BalanceOfResponse.js +3 -0
- package/v1/types/fa/TezosFA2BalanceOfResponse.js.map +1 -0
- package/v1/types/fa/TezosFA2ContractEntrypoint.d.ts +1 -0
- package/v1/types/fa/TezosFA2ContractEntrypoint.js +3 -0
- package/v1/types/fa/TezosFA2ContractEntrypoint.js.map +1 -0
- package/v1/types/fa/TezosFA2TransferRequest.d.ts +8 -0
- package/v1/types/fa/TezosFA2TransferRequest.js +3 -0
- package/v1/types/fa/TezosFA2TransferRequest.js.map +1 -0
- package/v1/types/fa/TezosFA2UpdateOperatorRequest.d.ts +6 -0
- package/v1/types/fa/TezosFA2UpdateOperatorRequest.js +3 -0
- package/v1/types/fa/TezosFA2UpdateOperatorRequest.js.map +1 -0
- package/v1/types/fa/TezosFATokenMetadata.d.ts +6 -0
- package/v1/types/fa/TezosFATokenMetadata.js +3 -0
- package/v1/types/fa/TezosFATokenMetadata.js.map +1 -0
- package/v1/types/indexer.d.ts +6 -0
- package/v1/types/indexer.js +3 -0
- package/v1/types/indexer.js.map +1 -0
- package/v1/types/micheline/MichelineNode.d.ts +15 -0
- package/v1/types/micheline/MichelineNode.js +5 -0
- package/v1/types/micheline/MichelineNode.js.map +1 -0
- package/v1/types/micheline/MichelineNodeUtils.d.ts +6 -0
- package/v1/types/micheline/MichelineNodeUtils.js +40 -0
- package/v1/types/micheline/MichelineNodeUtils.js.map +1 -0
- package/v1/types/michelson/MichelsonType.d.ts +11 -0
- package/v1/types/michelson/MichelsonType.js +22 -0
- package/v1/types/michelson/MichelsonType.js.map +1 -0
- package/v1/types/michelson/MichelsonTypeMeta.d.ts +33 -0
- package/v1/types/michelson/MichelsonTypeMeta.js +136 -0
- package/v1/types/michelson/MichelsonTypeMeta.js.map +1 -0
- package/v1/types/michelson/MichelsonTypeUtils.d.ts +19 -0
- package/v1/types/michelson/MichelsonTypeUtils.js +251 -0
- package/v1/types/michelson/MichelsonTypeUtils.js.map +1 -0
- package/v1/types/michelson/generics/MichelsonList.d.ts +11 -0
- package/v1/types/michelson/generics/MichelsonList.js +70 -0
- package/v1/types/michelson/generics/MichelsonList.js.map +1 -0
- package/v1/types/michelson/generics/MichelsonMap.d.ts +14 -0
- package/v1/types/michelson/generics/MichelsonMap.js +120 -0
- package/v1/types/michelson/generics/MichelsonMap.js.map +1 -0
- package/v1/types/michelson/generics/MichelsonOption.d.ts +25 -0
- package/v1/types/michelson/generics/MichelsonOption.js +121 -0
- package/v1/types/michelson/generics/MichelsonOption.js.map +1 -0
- package/v1/types/michelson/generics/MichelsonOr.d.ts +25 -0
- package/v1/types/michelson/generics/MichelsonOr.js +134 -0
- package/v1/types/michelson/generics/MichelsonOr.js.map +1 -0
- package/v1/types/michelson/generics/MichelsonPair.d.ts +17 -0
- package/v1/types/michelson/generics/MichelsonPair.js +139 -0
- package/v1/types/michelson/generics/MichelsonPair.js.map +1 -0
- package/v1/types/michelson/grammar/MichelsonGrammarData.d.ts +2 -0
- package/v1/types/michelson/grammar/MichelsonGrammarData.js +4 -0
- package/v1/types/michelson/grammar/MichelsonGrammarData.js.map +1 -0
- package/v1/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -0
- package/v1/types/michelson/grammar/MichelsonGrammarInstruction.js +4 -0
- package/v1/types/michelson/grammar/MichelsonGrammarInstruction.js.map +1 -0
- package/v1/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -0
- package/v1/types/michelson/grammar/MichelsonGrammarType.js +4 -0
- package/v1/types/michelson/grammar/MichelsonGrammarType.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonAddress.d.ts +15 -0
- package/v1/types/michelson/primitives/MichelsonAddress.js +74 -0
- package/v1/types/michelson/primitives/MichelsonAddress.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonBool.d.ts +12 -0
- package/v1/types/michelson/primitives/MichelsonBool.js +59 -0
- package/v1/types/michelson/primitives/MichelsonBool.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonBytes.d.ts +14 -0
- package/v1/types/michelson/primitives/MichelsonBytes.js +77 -0
- package/v1/types/michelson/primitives/MichelsonBytes.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonInt.d.ts +14 -0
- package/v1/types/michelson/primitives/MichelsonInt.js +74 -0
- package/v1/types/michelson/primitives/MichelsonInt.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonString.d.ts +14 -0
- package/v1/types/michelson/primitives/MichelsonString.js +76 -0
- package/v1/types/michelson/primitives/MichelsonString.js.map +1 -0
- package/v1/types/michelson/primitives/MichelsonUnit.d.ts +9 -0
- package/v1/types/michelson/primitives/MichelsonUnit.js +55 -0
- package/v1/types/michelson/primitives/MichelsonUnit.js.map +1 -0
- package/v1/types/network.d.ts +4 -0
- package/v1/types/network.js +9 -0
- package/v1/types/network.js.map +1 -0
- package/v1/types/node.d.ts +78 -0
- package/v1/types/node.js +3 -0
- package/v1/types/node.js.map +1 -0
- package/v1/types/operations/TezosOperationType.d.ts +13 -0
- package/v1/types/operations/TezosOperationType.js +18 -0
- package/v1/types/operations/TezosOperationType.js.map +1 -0
- package/v1/types/operations/TezosWrappedOperation.d.ts +5 -0
- package/v1/types/operations/TezosWrappedOperation.js +3 -0
- package/v1/types/operations/TezosWrappedOperation.js.map +1 -0
- package/v1/types/operations/kinds/ActivateAccount.d.ts +7 -0
- package/v1/types/operations/kinds/ActivateAccount.js +3 -0
- package/v1/types/operations/kinds/ActivateAccount.js.map +1 -0
- package/v1/types/operations/kinds/Ballot.d.ts +9 -0
- package/v1/types/operations/kinds/Ballot.js +3 -0
- package/v1/types/operations/kinds/Ballot.js.map +1 -0
- package/v1/types/operations/kinds/Delegation.d.ts +11 -0
- package/v1/types/operations/kinds/Delegation.js +3 -0
- package/v1/types/operations/kinds/Delegation.js.map +1 -0
- package/v1/types/operations/kinds/DoubleBakingEvidence.d.ts +8 -0
- package/v1/types/operations/kinds/DoubleBakingEvidence.js +3 -0
- package/v1/types/operations/kinds/DoubleBakingEvidence.js.map +1 -0
- package/v1/types/operations/kinds/DoubleEndorsementEvidence.d.ts +16 -0
- package/v1/types/operations/kinds/DoubleEndorsementEvidence.js +3 -0
- package/v1/types/operations/kinds/DoubleEndorsementEvidence.js.map +1 -0
- package/v1/types/operations/kinds/Endorsement.d.ts +6 -0
- package/v1/types/operations/kinds/Endorsement.js +3 -0
- package/v1/types/operations/kinds/Endorsement.js.map +1 -0
- package/v1/types/operations/kinds/Origination.d.ts +13 -0
- package/v1/types/operations/kinds/Origination.js +3 -0
- package/v1/types/operations/kinds/Origination.js.map +1 -0
- package/v1/types/operations/kinds/Proposal.d.ts +7 -0
- package/v1/types/operations/kinds/Proposal.js +3 -0
- package/v1/types/operations/kinds/Proposal.js.map +1 -0
- package/v1/types/operations/kinds/Reveal.d.ts +11 -0
- package/v1/types/operations/kinds/Reveal.js +3 -0
- package/v1/types/operations/kinds/Reveal.js.map +1 -0
- package/v1/types/operations/kinds/SeedNonceRevelation.d.ts +7 -0
- package/v1/types/operations/kinds/SeedNonceRevelation.js +3 -0
- package/v1/types/operations/kinds/SeedNonceRevelation.js.map +1 -0
- package/v1/types/operations/kinds/TezosOperation.d.ts +4 -0
- package/v1/types/operations/kinds/TezosOperation.js +3 -0
- package/v1/types/operations/kinds/TezosOperation.js.map +1 -0
- package/v1/types/operations/kinds/Transaction.d.ts +24 -0
- package/v1/types/operations/kinds/Transaction.js +3 -0
- package/v1/types/operations/kinds/Transaction.js.map +1 -0
- package/v1/types/protocol.d.ts +62 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/sapling/TezosSaplingCiphertext.d.ts +8 -0
- package/v1/types/sapling/TezosSaplingCiphertext.js +3 -0
- package/v1/types/sapling/TezosSaplingCiphertext.js.map +1 -0
- package/v1/types/sapling/TezosSaplingExternalMethodProvider.d.ts +10 -0
- package/v1/types/sapling/TezosSaplingExternalMethodProvider.js +3 -0
- package/v1/types/sapling/TezosSaplingExternalMethodProvider.js.map +1 -0
- package/v1/types/sapling/TezosSaplingInput.d.ts +6 -0
- package/v1/types/sapling/TezosSaplingInput.js +3 -0
- package/v1/types/sapling/TezosSaplingInput.js.map +1 -0
- package/v1/types/sapling/TezosSaplingOutput.d.ts +6 -0
- package/v1/types/sapling/TezosSaplingOutput.js +3 -0
- package/v1/types/sapling/TezosSaplingOutput.js.map +1 -0
- package/v1/types/sapling/TezosSaplingStateDiff.d.ts +6 -0
- package/v1/types/sapling/TezosSaplingStateDiff.js +3 -0
- package/v1/types/sapling/TezosSaplingStateDiff.js.map +1 -0
- package/v1/types/sapling/TezosSaplingStateTree.d.ts +7 -0
- package/v1/types/sapling/TezosSaplingStateTree.js +3 -0
- package/v1/types/sapling/TezosSaplingStateTree.js.map +1 -0
- package/v1/types/sapling/TezosSaplingTransaction.d.ts +23 -0
- package/v1/types/sapling/TezosSaplingTransaction.js +3 -0
- package/v1/types/sapling/TezosSaplingTransaction.js.map +1 -0
- package/v1/types/sapling/TezosSaplingTransactionCursor.d.ts +3 -0
- package/v1/types/sapling/TezosSaplingTransactionCursor.js +3 -0
- package/v1/types/sapling/TezosSaplingTransactionCursor.js.map +1 -0
- package/v1/types/sapling/TezosSaplingTransactionResult.d.ts +6 -0
- package/v1/types/sapling/TezosSaplingTransactionResult.js +3 -0
- package/v1/types/sapling/TezosSaplingTransactionResult.js.map +1 -0
- package/v1/types/transaction.d.ts +30 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/address.d.ts +2 -0
- package/v1/utils/address.js +13 -0
- package/v1/utils/address.js.map +1 -0
- package/v1/utils/bip.d.ts +2 -0
- package/v1/utils/bip.js +14 -0
- package/v1/utils/bip.js.map +1 -0
- package/v1/utils/convert.d.ts +4 -0
- package/v1/utils/convert.js +33 -0
- package/v1/utils/convert.js.map +1 -0
- package/v1/utils/encoding.d.ts +52 -0
- package/v1/utils/encoding.js +104 -0
- package/v1/utils/encoding.js.map +1 -0
- package/v1/utils/fa.d.ts +2 -0
- package/v1/utils/fa.js +13 -0
- package/v1/utils/fa.js.map +1 -0
- package/v1/utils/key.d.ts +4 -0
- package/v1/utils/key.js +43 -0
- package/v1/utils/key.js.map +1 -0
- package/v1/utils/micheline.d.ts +8 -0
- package/v1/utils/micheline.js +41 -0
- package/v1/utils/micheline.js.map +1 -0
- package/v1/utils/operations.d.ts +12 -0
- package/v1/utils/operations.js +72 -0
- package/v1/utils/operations.js.map +1 -0
- package/v1/utils/pack.d.ts +10 -0
- package/v1/utils/pack.js +252 -0
- package/v1/utils/pack.js.map +1 -0
- package/v1/utils/protocol/fa/TezosFA1Accountant.d.ts +9 -0
- package/v1/utils/protocol/fa/TezosFA1Accountant.js +76 -0
- package/v1/utils/protocol/fa/TezosFA1Accountant.js.map +1 -0
- package/v1/utils/protocol/fa/TezosFA2Accountant.d.ts +12 -0
- package/v1/utils/protocol/fa/TezosFA2Accountant.js +113 -0
- package/v1/utils/protocol/fa/TezosFA2Accountant.js.map +1 -0
- package/v1/utils/protocol/fa/TezosFAAccountant.d.ts +8 -0
- package/v1/utils/protocol/fa/TezosFAAccountant.js +95 -0
- package/v1/utils/protocol/fa/TezosFAAccountant.js.map +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.d.ts +32 -0
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js +589 -0
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js.map +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.d.ts +22 -0
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js +158 -0
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js.map +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingForger.d.ts +27 -0
- package/v1/utils/protocol/sapling/TezosSaplingForger.js +304 -0
- package/v1/utils/protocol/sapling/TezosSaplingForger.js.map +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingState.d.ts +17 -0
- package/v1/utils/protocol/sapling/TezosSaplingState.js +266 -0
- package/v1/utils/protocol/sapling/TezosSaplingState.js.map +1 -0
- package/v1/utils/protocol/tezos/TezosAccountant.d.ts +13 -0
- package/v1/utils/protocol/tezos/TezosAccountant.js +177 -0
- package/v1/utils/protocol/tezos/TezosAccountant.js.map +1 -0
- package/v1/utils/protocol/tezos/TezosForger.d.ts +6 -0
- package/v1/utils/protocol/tezos/TezosForger.js +82 -0
- package/v1/utils/protocol/tezos/TezosForger.js.map +1 -0
- package/v1/utils/signature.d.ts +2 -0
- package/v1/utils/signature.js +23 -0
- package/v1/utils/signature.js.map +1 -0
- package/v1/utils/transaction.d.ts +9 -0
- package/v1/utils/transaction.js +26 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1,948 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
52
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
+
exports.createTezosProtocolOptions = exports.TEZOS_GHOSTNET_PROTOCOL_NETWORK = exports.TEZOS_MAINNET_PROTOCOL_NETWORK = exports.createTezosProtocol = exports.TezosProtocolImpl = exports.TEZOS_ACCOUNT_METADATA = exports.TEZOS_DERIVATION_PATH = exports.TEZOS_UNITS = void 0;
|
|
54
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
55
|
+
var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
|
|
56
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
57
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
58
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
59
|
+
var TezosCryptoClient_1 = require("../crypto/TezosCryptoClient");
|
|
60
|
+
var TezosAddress_1 = require("../data/TezosAddress");
|
|
61
|
+
var factory_1 = require("../indexer/factory");
|
|
62
|
+
var network_1 = require("../types/network");
|
|
63
|
+
var TezosOperationType_1 = require("../types/operations/TezosOperationType");
|
|
64
|
+
var key_1 = require("../utils/key");
|
|
65
|
+
var operations_1 = require("../utils/operations");
|
|
66
|
+
var TezosAccountant_1 = require("../utils/protocol/tezos/TezosAccountant");
|
|
67
|
+
var TezosForger_1 = require("../utils/protocol/tezos/TezosForger");
|
|
68
|
+
var signature_1 = require("../utils/signature");
|
|
69
|
+
// Implementation
|
|
70
|
+
var MAX_OPERATIONS_PER_GROUP = 200;
|
|
71
|
+
var MAX_GAS_PER_BLOCK = 5200000;
|
|
72
|
+
var GAS_LIMIT_PLACEHOLDER = '1040000';
|
|
73
|
+
var STORAGE_LIMIT_PLACEHOLDER = '60000';
|
|
74
|
+
var FEE_PLACEHOLDER = '0';
|
|
75
|
+
var MINIMAL_FEE = 100;
|
|
76
|
+
var MINIMAL_FEE_PER_GAS_UNIT = 0.1;
|
|
77
|
+
var MINIMAL_FEE_PER_BYTE = 1;
|
|
78
|
+
exports.TEZOS_UNITS = {
|
|
79
|
+
tez: {
|
|
80
|
+
symbol: { value: 'XTZ', market: 'xtz' },
|
|
81
|
+
decimals: 6
|
|
82
|
+
},
|
|
83
|
+
mutez: {
|
|
84
|
+
symbol: { value: 'mutez' },
|
|
85
|
+
decimals: 0
|
|
86
|
+
},
|
|
87
|
+
nanotez: {
|
|
88
|
+
symbol: { value: 'nanotez' },
|
|
89
|
+
decimals: -3
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
exports.TEZOS_DERIVATION_PATH = "m/44h/1729h/0h/0h";
|
|
93
|
+
exports.TEZOS_ACCOUNT_METADATA = {
|
|
94
|
+
standardDerivationPath: exports.TEZOS_DERIVATION_PATH,
|
|
95
|
+
address: {
|
|
96
|
+
isCaseSensitive: true,
|
|
97
|
+
placeholder: 'tz1...',
|
|
98
|
+
regex: '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$'
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var TezosProtocolImpl = /** @class */ (function () {
|
|
102
|
+
function TezosProtocolImpl(options) {
|
|
103
|
+
// Common
|
|
104
|
+
this.units = exports.TEZOS_UNITS;
|
|
105
|
+
this.feeDefaults = {
|
|
106
|
+
low: (0, module_kit_1.newAmount)(0.00142, 'tez').blockchain(this.units),
|
|
107
|
+
medium: (0, module_kit_1.newAmount)(0.00152, 'tez').blockchain(this.units),
|
|
108
|
+
high: (0, module_kit_1.newAmount)(0.003, 'tez').blockchain(this.units)
|
|
109
|
+
};
|
|
110
|
+
this.metadata = {
|
|
111
|
+
identifier: coinlib_core_1.MainProtocolSymbols.XTZ,
|
|
112
|
+
name: 'Tezos',
|
|
113
|
+
units: this.units,
|
|
114
|
+
mainUnit: 'tez',
|
|
115
|
+
fee: {
|
|
116
|
+
defaults: this.feeDefaults
|
|
117
|
+
},
|
|
118
|
+
account: exports.TEZOS_ACCOUNT_METADATA
|
|
119
|
+
};
|
|
120
|
+
// Offline
|
|
121
|
+
this.cryptoConfiguration = {
|
|
122
|
+
algorithm: 'ed25519'
|
|
123
|
+
};
|
|
124
|
+
this.options = createTezosProtocolOptions(options.network);
|
|
125
|
+
this.forger = new TezosForger_1.TezosForger();
|
|
126
|
+
this.accountant = new TezosAccountant_1.TezosAccountant(this.forger, this.options.network);
|
|
127
|
+
this.indexerClient = (0, factory_1.createTezosIndexerClient)(this.options.network.indexer);
|
|
128
|
+
this.cryptoClient = new TezosCryptoClient_1.TezosCryptoClient();
|
|
129
|
+
}
|
|
130
|
+
TezosProtocolImpl.prototype.getMetadata = function () {
|
|
131
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
return [2 /*return*/, this.metadata];
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
TezosProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
return [2 /*return*/, TezosAddress_1.TezosAddress.fromPublicKey(publicKey).asString()];
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
};
|
|
144
|
+
TezosProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, _publicKey) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
146
|
+
return __generator(this, function (_a) {
|
|
147
|
+
return [2 /*return*/, this.accountant.getDetailsFromTransaction(transaction)];
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
TezosProtocolImpl.prototype.verifyMessageWithPublicKey = function (message, signature, publicKey) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
153
|
+
var encodedSignature, hexPublicKey;
|
|
154
|
+
return __generator(this, function (_a) {
|
|
155
|
+
encodedSignature = (0, signature_1.convertSignature)(signature, 'encoded');
|
|
156
|
+
hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
|
|
157
|
+
return [2 /*return*/, this.cryptoClient.verifyMessage(message, encodedSignature.value, hexPublicKey.value)];
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
TezosProtocolImpl.prototype.encryptAsymmetricWithPublicKey = function (payload, publicKey) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
163
|
+
var hexPublicKey;
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex');
|
|
166
|
+
return [2 /*return*/, this.cryptoClient.encryptAsymmetric(payload, hexPublicKey.value)];
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
TezosProtocolImpl.prototype.getCryptoConfiguration = function () {
|
|
171
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
172
|
+
return __generator(this, function (_a) {
|
|
173
|
+
return [2 /*return*/, this.cryptoConfiguration];
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
};
|
|
177
|
+
TezosProtocolImpl.prototype.getKeyPairFromDerivative = function (derivative) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
179
|
+
return __generator(this, function (_a) {
|
|
180
|
+
// should we maybe return encoded keys, i.e. edsk... and edpk... strings?
|
|
181
|
+
return [2 /*return*/, {
|
|
182
|
+
secretKey: (0, module_kit_1.newSecretKey)(Buffer.concat([Buffer.from(derivative.secretKey, 'hex'), Buffer.from(derivative.publicKey, 'hex')]).toString('hex'), 'hex'),
|
|
183
|
+
publicKey: (0, module_kit_1.newPublicKey)(derivative.publicKey, 'hex')
|
|
184
|
+
}];
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
TezosProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
190
|
+
var hexSecretKey, binaryTransaction, opSignature, signedOp;
|
|
191
|
+
return __generator(this, function (_a) {
|
|
192
|
+
hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
|
|
193
|
+
binaryTransaction = Buffer.from(transaction.binary, 'hex');
|
|
194
|
+
opSignature = this.cryptoClient.operationSignature(Buffer.from(hexSecretKey.value, 'hex'), binaryTransaction);
|
|
195
|
+
signedOp = Buffer.concat([binaryTransaction, opSignature]);
|
|
196
|
+
return [2 /*return*/, (0, module_kit_1.newSignedTransaction)({ binary: signedOp.toString('hex') })];
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
TezosProtocolImpl.prototype.signMessageWithKeyPair = function (message, keyPair) {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
202
|
+
var hexSecretKey, signature;
|
|
203
|
+
return __generator(this, function (_a) {
|
|
204
|
+
switch (_a.label) {
|
|
205
|
+
case 0:
|
|
206
|
+
hexSecretKey = (0, key_1.convertSecretKey)(keyPair.secretKey, 'hex');
|
|
207
|
+
return [4 /*yield*/, this.cryptoClient.signMessage(message, { privateKey: hexSecretKey.value })];
|
|
208
|
+
case 1:
|
|
209
|
+
signature = _a.sent();
|
|
210
|
+
return [2 /*return*/, (0, module_kit_1.newSignature)(signature, 'encoded')];
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
TezosProtocolImpl.prototype.decryptAsymmetricWithKeyPair = function (payload, keyPair) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
+
var hexSecretKey, hexPublicKey;
|
|
218
|
+
return __generator(this, function (_a) {
|
|
219
|
+
hexSecretKey = (0, key_1.convertSecretKey)(keyPair.secretKey, 'hex');
|
|
220
|
+
hexPublicKey = (0, key_1.convertPublicKey)(keyPair.publicKey, 'hex');
|
|
221
|
+
return [2 /*return*/, this.cryptoClient.decryptAsymmetric(payload, { publicKey: hexPublicKey.value, privateKey: hexSecretKey.value })];
|
|
222
|
+
});
|
|
223
|
+
});
|
|
224
|
+
};
|
|
225
|
+
TezosProtocolImpl.prototype.encryptAESWithSecretKey = function (payload, secretKey) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
227
|
+
var hexSecretKey;
|
|
228
|
+
return __generator(this, function (_a) {
|
|
229
|
+
hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
|
|
230
|
+
return [2 /*return*/, this.cryptoClient.encryptAES(payload, hexSecretKey.value)];
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
};
|
|
234
|
+
TezosProtocolImpl.prototype.decryptAESWithSecretKey = function (payload, secretKey) {
|
|
235
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
+
var hexSecretKey;
|
|
237
|
+
return __generator(this, function (_a) {
|
|
238
|
+
hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex');
|
|
239
|
+
return [2 /*return*/, this.cryptoClient.decryptAES(payload, hexSecretKey.value)];
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
// Online
|
|
244
|
+
TezosProtocolImpl.prototype.getNetwork = function () {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
246
|
+
return __generator(this, function (_a) {
|
|
247
|
+
return [2 /*return*/, this.options.network];
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
TezosProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
|
|
252
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
253
|
+
var address;
|
|
254
|
+
return __generator(this, function (_a) {
|
|
255
|
+
switch (_a.label) {
|
|
256
|
+
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
257
|
+
case 1:
|
|
258
|
+
address = _a.sent();
|
|
259
|
+
return [2 /*return*/, this.getTransactionsForAddress(address, limit, cursor)];
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
TezosProtocolImpl.prototype.getTransactionsForAddress = function (address, limit, cursor) {
|
|
265
|
+
var _a;
|
|
266
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
267
|
+
var transactions;
|
|
268
|
+
var _this = this;
|
|
269
|
+
return __generator(this, function (_b) {
|
|
270
|
+
switch (_b.label) {
|
|
271
|
+
case 0: return [4 /*yield*/, this.indexerClient.getTransactions(address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
|
|
272
|
+
case 1:
|
|
273
|
+
transactions = _b.sent();
|
|
274
|
+
return [2 /*return*/, {
|
|
275
|
+
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { network: _this.options.network })); }),
|
|
276
|
+
cursor: {
|
|
277
|
+
hasNext: transactions.length >= limit,
|
|
278
|
+
offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + transactions.length
|
|
279
|
+
}
|
|
280
|
+
}];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
TezosProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
286
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
287
|
+
var address;
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
291
|
+
case 1:
|
|
292
|
+
address = _a.sent();
|
|
293
|
+
return [2 /*return*/, this.getBalanceOfAddress(address)];
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
};
|
|
298
|
+
TezosProtocolImpl.prototype.getBalanceOfAddress = function (address) {
|
|
299
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
300
|
+
var balance, data, error_1;
|
|
301
|
+
return __generator(this, function (_a) {
|
|
302
|
+
switch (_a.label) {
|
|
303
|
+
case 0:
|
|
304
|
+
balance = new bignumber_1.default(0);
|
|
305
|
+
_a.label = 1;
|
|
306
|
+
case 1:
|
|
307
|
+
_a.trys.push([1, 3, , 4]);
|
|
308
|
+
return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/balance"))];
|
|
309
|
+
case 2:
|
|
310
|
+
data = (_a.sent()).data;
|
|
311
|
+
balance = new bignumber_1.default(data);
|
|
312
|
+
return [3 /*break*/, 4];
|
|
313
|
+
case 3:
|
|
314
|
+
error_1 = _a.sent();
|
|
315
|
+
// if node returns 404 (which means 'no account found'), go with 0 balance
|
|
316
|
+
if (error_1.response && error_1.response.status !== 404) {
|
|
317
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error_1);
|
|
318
|
+
}
|
|
319
|
+
return [3 /*break*/, 4];
|
|
320
|
+
case 4: return [2 /*return*/, { total: (0, module_kit_1.newAmount)(balance, 'blockchain') }];
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
});
|
|
324
|
+
};
|
|
325
|
+
TezosProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, to, configuration) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
327
|
+
var total, adjustedTotal;
|
|
328
|
+
return __generator(this, function (_a) {
|
|
329
|
+
switch (_a.label) {
|
|
330
|
+
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
331
|
+
case 1:
|
|
332
|
+
total = (_a.sent()).total;
|
|
333
|
+
adjustedTotal = new bignumber_1.default((0, module_kit_1.newAmount)(total).convert('mutez', this.units).value).minus(1) // Tezos accounts can never be empty. We must leave at least 1 mutez behind.
|
|
334
|
+
;
|
|
335
|
+
return [2 /*return*/, this.getTansactionMaxAmountWithBalance(publicKey, adjustedTotal, to, configuration === null || configuration === void 0 ? void 0 : configuration.fee)];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
TezosProtocolImpl.prototype.getTansactionMaxAmountWithBalance = function (publicKey, balance, to, fee) {
|
|
341
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
342
|
+
var maxFee, estimatedFee, error_2, rpcErrors, balanceTooLowError, excess, newMaxBalance, amountWithoutFees;
|
|
343
|
+
return __generator(this, function (_a) {
|
|
344
|
+
switch (_a.label) {
|
|
345
|
+
case 0:
|
|
346
|
+
if (!(fee !== undefined)) return [3 /*break*/, 1];
|
|
347
|
+
maxFee = fee;
|
|
348
|
+
return [3 /*break*/, 4];
|
|
349
|
+
case 1:
|
|
350
|
+
_a.trys.push([1, 3, , 4]);
|
|
351
|
+
return [4 /*yield*/, this.getTransactionFeeWithPublicKey(publicKey, to.map(function (recipient) { return ({
|
|
352
|
+
to: recipient,
|
|
353
|
+
amount: (0, module_kit_1.newAmount)(balance.div(to.length).decimalPlaces(0, bignumber_1.default.ROUND_CEIL), 'blockchain')
|
|
354
|
+
}); }))];
|
|
355
|
+
case 2:
|
|
356
|
+
estimatedFee = _a.sent();
|
|
357
|
+
maxFee = (0, module_kit_1.newAmount)(estimatedFee.medium).blockchain(this.units);
|
|
358
|
+
if (balance.lte(maxFee.value)) {
|
|
359
|
+
maxFee = (0, module_kit_1.newAmount)(0, 'blockchain');
|
|
360
|
+
}
|
|
361
|
+
return [3 /*break*/, 4];
|
|
362
|
+
case 3:
|
|
363
|
+
error_2 = _a.sent();
|
|
364
|
+
if (error_2.code !== undefined && error_2.code === errors_1.ProtocolErrorType.TRANSACTION_FAILED && Array.isArray(error_2.data)) {
|
|
365
|
+
rpcErrors = error_2.data;
|
|
366
|
+
balanceTooLowError = rpcErrors.find(function (error) { return error.id.endsWith('.contract.balance_too_low'); });
|
|
367
|
+
if (balanceTooLowError !== undefined && balanceTooLowError.amount !== undefined && balanceTooLowError.balance !== undefined) {
|
|
368
|
+
excess = new bignumber_1.default(balanceTooLowError.amount).minus(new bignumber_1.default(balanceTooLowError.balance).minus(1));
|
|
369
|
+
newMaxBalance = balance.minus(excess);
|
|
370
|
+
if (newMaxBalance.gt(0)) {
|
|
371
|
+
return [2 /*return*/, this.getTansactionMaxAmountWithBalance(publicKey, newMaxBalance, to, fee)];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
throw error_2;
|
|
376
|
+
case 4:
|
|
377
|
+
maxFee = (0, module_kit_1.newAmount)(maxFee).blockchain(this.units);
|
|
378
|
+
amountWithoutFees = balance.minus(maxFee.value);
|
|
379
|
+
if (amountWithoutFees.isNegative()) {
|
|
380
|
+
amountWithoutFees = new bignumber_1.default(0);
|
|
381
|
+
}
|
|
382
|
+
return [2 /*return*/, (0, module_kit_1.newAmount)(amountWithoutFees, 'blockchain')];
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
};
|
|
387
|
+
TezosProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details) {
|
|
388
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
389
|
+
var operations, i, recipient, transaction;
|
|
390
|
+
return __generator(this, function (_a) {
|
|
391
|
+
if (details.length === 0) {
|
|
392
|
+
return [2 /*return*/, this.feeDefaults];
|
|
393
|
+
}
|
|
394
|
+
operations = [];
|
|
395
|
+
for (i = 0; i < details.length; ++i) {
|
|
396
|
+
recipient = details[i].to;
|
|
397
|
+
transaction = {
|
|
398
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
399
|
+
amount: (0, module_kit_1.newAmount)(details[i].amount).blockchain(this.units).value,
|
|
400
|
+
destination: recipient,
|
|
401
|
+
fee: '0'
|
|
402
|
+
};
|
|
403
|
+
operations.push(transaction);
|
|
404
|
+
}
|
|
405
|
+
return [2 /*return*/, this.getOperationFeeDefaults(publicKey, operations)];
|
|
406
|
+
});
|
|
407
|
+
});
|
|
408
|
+
};
|
|
409
|
+
TezosProtocolImpl.prototype.getOperationFeeDefaults = function (publicKey, operations) {
|
|
410
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
411
|
+
var estimated, hasReveal, estimatedFee, feeStepFactor, lowFee, mediumFee, highFee;
|
|
412
|
+
return __generator(this, function (_a) {
|
|
413
|
+
switch (_a.label) {
|
|
414
|
+
case 0: return [4 /*yield*/, this.prepareOperations(publicKey, operations)];
|
|
415
|
+
case 1:
|
|
416
|
+
estimated = _a.sent();
|
|
417
|
+
hasReveal = estimated.contents.some(function (op) { return op.kind === TezosOperationType_1.TezosOperationType.REVEAL; });
|
|
418
|
+
estimatedFee = estimated.contents
|
|
419
|
+
.reduce(function (current, next) {
|
|
420
|
+
if (next.fee !== undefined) {
|
|
421
|
+
return current.plus(new bignumber_1.default(next.fee));
|
|
422
|
+
}
|
|
423
|
+
return current;
|
|
424
|
+
}, new bignumber_1.default(0))
|
|
425
|
+
.minus(hasReveal ? operations_1.REVEAL_FEE : 0)
|
|
426
|
+
.div(hasReveal ? estimated.contents.length - 1 : estimated.contents.length);
|
|
427
|
+
feeStepFactor = new bignumber_1.default(0.2);
|
|
428
|
+
lowFee = estimatedFee;
|
|
429
|
+
mediumFee = lowFee.plus(lowFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
430
|
+
highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
|
|
431
|
+
return [2 /*return*/, {
|
|
432
|
+
low: (0, module_kit_1.newAmount)(lowFee, 'blockchain'),
|
|
433
|
+
medium: (0, module_kit_1.newAmount)(mediumFee, 'blockchain'),
|
|
434
|
+
high: (0, module_kit_1.newAmount)(highFee, 'blockchain')
|
|
435
|
+
}];
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
};
|
|
440
|
+
TezosProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
|
|
441
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
442
|
+
var transactions;
|
|
443
|
+
return __generator(this, function (_a) {
|
|
444
|
+
switch (_a.label) {
|
|
445
|
+
case 0:
|
|
446
|
+
if (details.length > MAX_OPERATIONS_PER_GROUP) {
|
|
447
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, "this transaction exceeds the maximum allowed number of transactions per operation (".concat(MAX_OPERATIONS_PER_GROUP, "). Please use the \"prepareTransactionsFromPublicKey\" method instead."));
|
|
448
|
+
}
|
|
449
|
+
return [4 /*yield*/, this.prepareTransactionsWithPublicKey(publicKey, details, configuration)];
|
|
450
|
+
case 1:
|
|
451
|
+
transactions = _a.sent();
|
|
452
|
+
if (transactions.length === 1) {
|
|
453
|
+
return [2 /*return*/, transactions[0]];
|
|
454
|
+
}
|
|
455
|
+
else {
|
|
456
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, 'Transaction could not be prepared. More or less than 1 operations have been generated.');
|
|
457
|
+
}
|
|
458
|
+
return [2 /*return*/];
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
};
|
|
463
|
+
TezosProtocolImpl.prototype.broadcastTransaction = function (transaction) {
|
|
464
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
465
|
+
var injectionResponse;
|
|
466
|
+
return __generator(this, function (_a) {
|
|
467
|
+
switch (_a.label) {
|
|
468
|
+
case 0: return [4 /*yield*/, index_1.default
|
|
469
|
+
.post("".concat(this.options.network.rpcUrl, "/injection/operation?chain=main"), JSON.stringify(transaction.binary), {
|
|
470
|
+
headers: { 'content-type': 'application/json' }
|
|
471
|
+
})
|
|
472
|
+
.catch(function (error) {
|
|
473
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
474
|
+
})
|
|
475
|
+
// returns hash if successful
|
|
476
|
+
];
|
|
477
|
+
case 1:
|
|
478
|
+
injectionResponse = (_a.sent()).data;
|
|
479
|
+
// returns hash if successful
|
|
480
|
+
return [2 /*return*/, injectionResponse];
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
// Custom
|
|
486
|
+
TezosProtocolImpl.prototype.forgeOperation = function (wrappedOperation) {
|
|
487
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
488
|
+
return __generator(this, function (_a) {
|
|
489
|
+
return [2 /*return*/, this.forger.forgeOperation(wrappedOperation)];
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
};
|
|
493
|
+
TezosProtocolImpl.prototype.unforgeOperation = function (forged, type) {
|
|
494
|
+
if (type === void 0) { type = 'unsigned'; }
|
|
495
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
496
|
+
return __generator(this, function (_a) {
|
|
497
|
+
return [2 /*return*/, this.forger.unforgeOperation(forged, type)];
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
TezosProtocolImpl.prototype.prepareTransactionsWithPublicKey = function (publicKey, details, configuration) {
|
|
502
|
+
var _a;
|
|
503
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
504
|
+
var operationsPerGroup, fee, estimatedFee, wrappedFee, address, operations, results, currentCounter, counter, branch, accountManager, _b, total, transferable, balance, transactions, allOperations, numberOfGroups, startingCounter, i, start, end, operationsGroup, wrappedOperationWithEstimatedGas, forged;
|
|
505
|
+
return __generator(this, function (_c) {
|
|
506
|
+
switch (_c.label) {
|
|
507
|
+
case 0:
|
|
508
|
+
operationsPerGroup = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.operationsPerGroup) !== null && _a !== void 0 ? _a : MAX_OPERATIONS_PER_GROUP;
|
|
509
|
+
if (!((configuration === null || configuration === void 0 ? void 0 : configuration.fee) !== undefined)) return [3 /*break*/, 1];
|
|
510
|
+
fee = configuration.fee;
|
|
511
|
+
return [3 /*break*/, 3];
|
|
512
|
+
case 1: return [4 /*yield*/, this.getTransactionFeeWithPublicKey(publicKey, details)];
|
|
513
|
+
case 2:
|
|
514
|
+
estimatedFee = _c.sent();
|
|
515
|
+
fee = estimatedFee.medium;
|
|
516
|
+
_c.label = 3;
|
|
517
|
+
case 3:
|
|
518
|
+
wrappedFee = new bignumber_1.default((0, module_kit_1.newAmount)(fee).blockchain(this.units).value);
|
|
519
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
520
|
+
case 4:
|
|
521
|
+
address = _c.sent();
|
|
522
|
+
operations = [];
|
|
523
|
+
return [4 /*yield*/, Promise.all([
|
|
524
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/counter")),
|
|
525
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
|
|
526
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/manager_key"))
|
|
527
|
+
]).catch(function (error) {
|
|
528
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
529
|
+
})];
|
|
530
|
+
case 5:
|
|
531
|
+
results = _c.sent();
|
|
532
|
+
currentCounter = new bignumber_1.default(results[0].data);
|
|
533
|
+
counter = currentCounter.plus(1);
|
|
534
|
+
branch = results[1].data;
|
|
535
|
+
accountManager = results[2].data;
|
|
536
|
+
// check if we have revealed the address already
|
|
537
|
+
if (!accountManager) {
|
|
538
|
+
operations.push((0, operations_1.createRevealOperation)(counter, publicKey, address));
|
|
539
|
+
counter = counter.plus(1);
|
|
540
|
+
}
|
|
541
|
+
return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
542
|
+
case 6:
|
|
543
|
+
_b = _c.sent(), total = _b.total, transferable = _b.transferable;
|
|
544
|
+
balance = new bignumber_1.default((0, module_kit_1.newAmount)(transferable !== null && transferable !== void 0 ? transferable : total).blockchain(this.units).value);
|
|
545
|
+
transactions = [];
|
|
546
|
+
return [4 /*yield*/, this.createTransactionOperations(operations, details, wrappedFee, address, counter, balance)];
|
|
547
|
+
case 7:
|
|
548
|
+
allOperations = _c.sent();
|
|
549
|
+
allOperations = operations.concat(allOperations); // if we have a reveal in operations, we need to make sure it is present in the allOperations array
|
|
550
|
+
numberOfGroups = Math.ceil(allOperations.length / operationsPerGroup);
|
|
551
|
+
startingCounter = numberOfGroups > 1 ? currentCounter.plus(1) : undefined;
|
|
552
|
+
i = 0;
|
|
553
|
+
_c.label = 8;
|
|
554
|
+
case 8:
|
|
555
|
+
if (!(i < numberOfGroups)) return [3 /*break*/, 12];
|
|
556
|
+
start = i * operationsPerGroup;
|
|
557
|
+
end = start + operationsPerGroup;
|
|
558
|
+
operationsGroup = allOperations.slice(start, end);
|
|
559
|
+
return [4 /*yield*/, this.estimateAndReplaceLimitsAndFee({
|
|
560
|
+
branch: branch,
|
|
561
|
+
contents: operationsGroup
|
|
562
|
+
}, false, startingCounter)];
|
|
563
|
+
case 9:
|
|
564
|
+
wrappedOperationWithEstimatedGas = _c.sent();
|
|
565
|
+
return [4 /*yield*/, this.forgeOperation(wrappedOperationWithEstimatedGas)];
|
|
566
|
+
case 10:
|
|
567
|
+
forged = _c.sent();
|
|
568
|
+
transactions.push((0, module_kit_1.newUnsignedTransaction)({ binary: forged }));
|
|
569
|
+
_c.label = 11;
|
|
570
|
+
case 11:
|
|
571
|
+
i++;
|
|
572
|
+
return [3 /*break*/, 8];
|
|
573
|
+
case 12: return [2 /*return*/, transactions];
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
};
|
|
578
|
+
TezosProtocolImpl.prototype.prepareOperations = function (publicKey, operationRequests, overrideParameters) {
|
|
579
|
+
if (overrideParameters === void 0) { overrideParameters = true; }
|
|
580
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
581
|
+
var counter, branch, operations, address, results, accountManager, hasRevealInOperationRequests, operationPromises, _a, _b, _c, wrappedOperation;
|
|
582
|
+
var _this = this;
|
|
583
|
+
return __generator(this, function (_d) {
|
|
584
|
+
switch (_d.label) {
|
|
585
|
+
case 0:
|
|
586
|
+
counter = new bignumber_1.default(1);
|
|
587
|
+
operations = [];
|
|
588
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
589
|
+
case 1:
|
|
590
|
+
address = _d.sent();
|
|
591
|
+
return [4 /*yield*/, Promise.all([
|
|
592
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/counter")),
|
|
593
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
|
|
594
|
+
index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/manager_key"))
|
|
595
|
+
]).catch(function (error) {
|
|
596
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
597
|
+
})];
|
|
598
|
+
case 2:
|
|
599
|
+
results = _d.sent();
|
|
600
|
+
counter = new bignumber_1.default(results[0].data).plus(1);
|
|
601
|
+
branch = results[1].data;
|
|
602
|
+
accountManager = results[2].data;
|
|
603
|
+
hasRevealInOperationRequests = operationRequests.some(function (request) { return request.kind === TezosOperationType_1.TezosOperationType.REVEAL; });
|
|
604
|
+
// check if we have revealed the address already
|
|
605
|
+
if (!accountManager && !hasRevealInOperationRequests) {
|
|
606
|
+
operations.push((0, operations_1.createRevealOperation)(counter, publicKey, address));
|
|
607
|
+
counter = counter.plus(1);
|
|
608
|
+
}
|
|
609
|
+
operationPromises = operationRequests.map(function (operationRequest, index) { return __awaiter(_this, void 0, void 0, function () {
|
|
610
|
+
var recipient, receivingBalance, total, defaultCounter, defaultFee, defaultGasLimit, defaultStorageLimit, revealOperation, delegationOperation, transactionOperation, originationOperation;
|
|
611
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
612
|
+
return __generator(this, function (_w) {
|
|
613
|
+
switch (_w.label) {
|
|
614
|
+
case 0:
|
|
615
|
+
// TODO: Handle activation burn
|
|
616
|
+
if (!operationRequest.kind) {
|
|
617
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "kind" was not defined');
|
|
618
|
+
}
|
|
619
|
+
recipient = operationRequest.destination;
|
|
620
|
+
if (!(recipient && recipient.toLowerCase().startsWith('tz'))) return [3 /*break*/, 2];
|
|
621
|
+
return [4 /*yield*/, this.getBalanceOfAddress(recipient)];
|
|
622
|
+
case 1:
|
|
623
|
+
total = (_w.sent()).total;
|
|
624
|
+
receivingBalance = new bignumber_1.default((0, module_kit_1.newAmount)(total).blockchain(this.units).value);
|
|
625
|
+
_w.label = 2;
|
|
626
|
+
case 2:
|
|
627
|
+
defaultCounter = counter.plus(index).toFixed() // TODO: Handle counter if we have some operations without counters in the array
|
|
628
|
+
;
|
|
629
|
+
defaultFee = FEE_PLACEHOLDER;
|
|
630
|
+
defaultGasLimit = '10300';
|
|
631
|
+
defaultStorageLimit = receivingBalance && receivingBalance.isZero() && recipient && recipient.toLowerCase().startsWith('tz') ? '300' : '0' // taken from eztz
|
|
632
|
+
;
|
|
633
|
+
switch (operationRequest.kind) {
|
|
634
|
+
// TODO: Handle if the dApp already provides a reveal operation
|
|
635
|
+
case TezosOperationType_1.TezosOperationType.REVEAL:
|
|
636
|
+
revealOperation = operationRequest;
|
|
637
|
+
if (!revealOperation.public_key) {
|
|
638
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "public_key" was not defined');
|
|
639
|
+
}
|
|
640
|
+
revealOperation.source = (_a = revealOperation.source) !== null && _a !== void 0 ? _a : address;
|
|
641
|
+
revealOperation.counter = (_b = revealOperation.counter) !== null && _b !== void 0 ? _b : defaultCounter;
|
|
642
|
+
revealOperation.fee = (_c = revealOperation.fee) !== null && _c !== void 0 ? _c : defaultFee;
|
|
643
|
+
revealOperation.gas_limit = (_d = revealOperation.gas_limit) !== null && _d !== void 0 ? _d : defaultGasLimit;
|
|
644
|
+
revealOperation.storage_limit = (_e = revealOperation.storage_limit) !== null && _e !== void 0 ? _e : defaultStorageLimit;
|
|
645
|
+
return [2 /*return*/, revealOperation];
|
|
646
|
+
case TezosOperationType_1.TezosOperationType.DELEGATION:
|
|
647
|
+
delegationOperation = operationRequest;
|
|
648
|
+
// The delegate property is optional, so we don't have any mandatory properties to check for
|
|
649
|
+
delegationOperation.source = (_f = delegationOperation.source) !== null && _f !== void 0 ? _f : address;
|
|
650
|
+
delegationOperation.counter = (_g = delegationOperation.counter) !== null && _g !== void 0 ? _g : defaultCounter;
|
|
651
|
+
delegationOperation.fee = (_h = delegationOperation.fee) !== null && _h !== void 0 ? _h : defaultFee;
|
|
652
|
+
delegationOperation.gas_limit = (_j = delegationOperation.gas_limit) !== null && _j !== void 0 ? _j : defaultGasLimit;
|
|
653
|
+
delegationOperation.storage_limit = (_k = delegationOperation.storage_limit) !== null && _k !== void 0 ? _k : defaultStorageLimit;
|
|
654
|
+
return [2 /*return*/, delegationOperation];
|
|
655
|
+
case TezosOperationType_1.TezosOperationType.TRANSACTION:
|
|
656
|
+
transactionOperation = operationRequest;
|
|
657
|
+
if (!transactionOperation.amount) {
|
|
658
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "amount" was not defined');
|
|
659
|
+
}
|
|
660
|
+
if (!transactionOperation.destination) {
|
|
661
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "destination" was not defined');
|
|
662
|
+
}
|
|
663
|
+
transactionOperation.source = (_l = transactionOperation.source) !== null && _l !== void 0 ? _l : address;
|
|
664
|
+
transactionOperation.counter = (_m = transactionOperation.counter) !== null && _m !== void 0 ? _m : defaultCounter;
|
|
665
|
+
transactionOperation.fee = (_o = transactionOperation.fee) !== null && _o !== void 0 ? _o : defaultFee;
|
|
666
|
+
transactionOperation.gas_limit = (_p = transactionOperation.gas_limit) !== null && _p !== void 0 ? _p : GAS_LIMIT_PLACEHOLDER;
|
|
667
|
+
transactionOperation.storage_limit = (_q = transactionOperation.storage_limit) !== null && _q !== void 0 ? _q : STORAGE_LIMIT_PLACEHOLDER;
|
|
668
|
+
return [2 /*return*/, transactionOperation];
|
|
669
|
+
case TezosOperationType_1.TezosOperationType.ORIGINATION:
|
|
670
|
+
originationOperation = operationRequest;
|
|
671
|
+
if (!originationOperation.balance) {
|
|
672
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "balance" was not defined');
|
|
673
|
+
}
|
|
674
|
+
if (!originationOperation.script) {
|
|
675
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'property "script" was not defined');
|
|
676
|
+
}
|
|
677
|
+
originationOperation.source = (_r = originationOperation.source) !== null && _r !== void 0 ? _r : address;
|
|
678
|
+
originationOperation.counter = (_s = originationOperation.counter) !== null && _s !== void 0 ? _s : defaultCounter;
|
|
679
|
+
originationOperation.fee = (_t = originationOperation.fee) !== null && _t !== void 0 ? _t : defaultFee;
|
|
680
|
+
originationOperation.gas_limit = (_u = originationOperation.gas_limit) !== null && _u !== void 0 ? _u : GAS_LIMIT_PLACEHOLDER;
|
|
681
|
+
originationOperation.storage_limit = (_v = originationOperation.storage_limit) !== null && _v !== void 0 ? _v : STORAGE_LIMIT_PLACEHOLDER;
|
|
682
|
+
return [2 /*return*/, originationOperation];
|
|
683
|
+
case TezosOperationType_1.TezosOperationType.ENDORSEMENT:
|
|
684
|
+
case TezosOperationType_1.TezosOperationType.SEED_NONCE_REVELATION:
|
|
685
|
+
case TezosOperationType_1.TezosOperationType.DOUBLE_ENDORSEMENT_EVIDENCE:
|
|
686
|
+
case TezosOperationType_1.TezosOperationType.DOUBLE_BAKING_EVIDENCE:
|
|
687
|
+
case TezosOperationType_1.TezosOperationType.ACTIVATE_ACCOUNT:
|
|
688
|
+
case TezosOperationType_1.TezosOperationType.PROPOSALS:
|
|
689
|
+
case TezosOperationType_1.TezosOperationType.BALLOT:
|
|
690
|
+
// Do not change anything
|
|
691
|
+
return [2 /*return*/, operationRequest];
|
|
692
|
+
default:
|
|
693
|
+
(0, coinlib_core_1.assertNever)(operationRequest.kind);
|
|
694
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, "unsupported operation type \"".concat(JSON.stringify(operationRequest.kind), "\""));
|
|
695
|
+
}
|
|
696
|
+
return [2 /*return*/];
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
}); });
|
|
700
|
+
_b = (_a = operations.push).apply;
|
|
701
|
+
_c = [operations];
|
|
702
|
+
return [4 /*yield*/, Promise.all(operationPromises)];
|
|
703
|
+
case 3:
|
|
704
|
+
_b.apply(_a, _c.concat([(_d.sent())]));
|
|
705
|
+
wrappedOperation = {
|
|
706
|
+
branch: branch,
|
|
707
|
+
contents: operations
|
|
708
|
+
};
|
|
709
|
+
return [2 /*return*/, this.estimateAndReplaceLimitsAndFee(wrappedOperation, overrideParameters)];
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
});
|
|
713
|
+
};
|
|
714
|
+
TezosProtocolImpl.prototype.estimateAndReplaceLimitsAndFee = function (wrappedOperation, overrideParameters, startingCounter) {
|
|
715
|
+
if (overrideParameters === void 0) { overrideParameters = true; }
|
|
716
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
717
|
+
var fakeSignature, opKinds, contents, block, body, forgedOperation, gasLimitTotal, response, fee, nonRevealOperations, feePerOperation_1;
|
|
718
|
+
return __generator(this, function (_a) {
|
|
719
|
+
switch (_a.label) {
|
|
720
|
+
case 0:
|
|
721
|
+
fakeSignature = 'sigUHx32f9wesZ1n2BWpixXz4AQaZggEtchaQNHYGRCoWNAXx45WGW2ua3apUUUAGMLPwAU41QoaFCzVSL61VaessLg4YbbP';
|
|
722
|
+
opKinds = [
|
|
723
|
+
TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
724
|
+
TezosOperationType_1.TezosOperationType.REVEAL,
|
|
725
|
+
TezosOperationType_1.TezosOperationType.ORIGINATION,
|
|
726
|
+
TezosOperationType_1.TezosOperationType.DELEGATION
|
|
727
|
+
];
|
|
728
|
+
contents = wrappedOperation.contents.map(function (operation, i) {
|
|
729
|
+
if (!opKinds.includes(operation.kind)) {
|
|
730
|
+
return operation;
|
|
731
|
+
}
|
|
732
|
+
var op = operation;
|
|
733
|
+
var gasValue = new bignumber_1.default(MAX_GAS_PER_BLOCK).dividedToIntegerBy(wrappedOperation.contents.length);
|
|
734
|
+
var gas_limit = new bignumber_1.default(GAS_LIMIT_PLACEHOLDER).gt(gasValue) ? gasValue : GAS_LIMIT_PLACEHOLDER;
|
|
735
|
+
var counter = startingCounter ? startingCounter.plus(i).toString() : op.counter;
|
|
736
|
+
return __assign(__assign({}, operation), { gas_limit: gas_limit, counter: counter });
|
|
737
|
+
});
|
|
738
|
+
return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head"))];
|
|
739
|
+
case 1:
|
|
740
|
+
block = (_a.sent()).data;
|
|
741
|
+
body = {
|
|
742
|
+
chain_id: block.chain_id,
|
|
743
|
+
operation: {
|
|
744
|
+
branch: wrappedOperation.branch,
|
|
745
|
+
contents: contents,
|
|
746
|
+
signature: fakeSignature // signature will not be checked, so it is ok to always use this one
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
return [4 /*yield*/, this.forgeOperation(wrappedOperation)];
|
|
750
|
+
case 2:
|
|
751
|
+
forgedOperation = _a.sent();
|
|
752
|
+
gasLimitTotal = 0;
|
|
753
|
+
return [4 /*yield*/, index_1.default
|
|
754
|
+
.post("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/helpers/scripts/run_operation"), body, {
|
|
755
|
+
headers: { 'Content-Type': 'application/json' }
|
|
756
|
+
})
|
|
757
|
+
.catch(function (runOperationError) {
|
|
758
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, runOperationError);
|
|
759
|
+
})];
|
|
760
|
+
case 3:
|
|
761
|
+
response = _a.sent();
|
|
762
|
+
if (wrappedOperation.contents.length !== response.data.contents.length) {
|
|
763
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, "Run Operation did not return same number of operations. Locally we have ".concat(wrappedOperation.contents.length, ", but got back ").concat(response.data.contents.length));
|
|
764
|
+
}
|
|
765
|
+
wrappedOperation.contents.forEach(function (content, i) {
|
|
766
|
+
var metadata = response.data.contents[i].metadata;
|
|
767
|
+
if (metadata.operation_result) {
|
|
768
|
+
var result = metadata.operation_result;
|
|
769
|
+
var gasLimit_1 = 0;
|
|
770
|
+
var storageLimit_1 = 0;
|
|
771
|
+
// If there are internal operations, we first add gas and storage used of internal operations
|
|
772
|
+
if (metadata.internal_operation_results) {
|
|
773
|
+
metadata.internal_operation_results.forEach(function (internalOperation) {
|
|
774
|
+
if (internalOperation === null || internalOperation === void 0 ? void 0 : internalOperation.result) {
|
|
775
|
+
if (internalOperation.result.errors) {
|
|
776
|
+
throw new errors_1.TransactionError(coinlib_core_1.Domain.TEZOS, 'An internal operation produced an error', internalOperation.result.errors);
|
|
777
|
+
}
|
|
778
|
+
gasLimit_1 += Math.ceil(Number(internalOperation.result.consumed_milligas) / 1000);
|
|
779
|
+
if (internalOperation.result.paid_storage_size_diff) {
|
|
780
|
+
storageLimit_1 += Number(internalOperation.result.paid_storage_size_diff);
|
|
781
|
+
}
|
|
782
|
+
if (internalOperation.result.originated_contracts) {
|
|
783
|
+
storageLimit_1 += internalOperation.result.originated_contracts.length * 257;
|
|
784
|
+
}
|
|
785
|
+
if (internalOperation.result.allocated_destination_contract) {
|
|
786
|
+
storageLimit_1 += 257;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
if (result.errors) {
|
|
792
|
+
throw new errors_1.TransactionError(coinlib_core_1.Domain.TEZOS, 'The operation produced an error', result.errors);
|
|
793
|
+
}
|
|
794
|
+
// Add gas and storage used by operation
|
|
795
|
+
gasLimit_1 += Math.ceil(Number(result.consumed_milligas) / 1000);
|
|
796
|
+
if (result.paid_storage_size_diff) {
|
|
797
|
+
storageLimit_1 += Number(result.paid_storage_size_diff);
|
|
798
|
+
}
|
|
799
|
+
if (result.originated_contracts) {
|
|
800
|
+
storageLimit_1 += result.originated_contracts.length * 257;
|
|
801
|
+
}
|
|
802
|
+
if (result.allocated_destination_contract) {
|
|
803
|
+
storageLimit_1 += 257;
|
|
804
|
+
}
|
|
805
|
+
// in prepareTransactionsFromPublicKey() we invoke this method with overrideParameters = false
|
|
806
|
+
if ((content.gas_limit && overrideParameters) || content.gas_limit === GAS_LIMIT_PLACEHOLDER) {
|
|
807
|
+
;
|
|
808
|
+
content.gas_limit = gasLimit_1.toString();
|
|
809
|
+
}
|
|
810
|
+
if ((content.storage_limit && overrideParameters) || content.storage_limit === STORAGE_LIMIT_PLACEHOLDER) {
|
|
811
|
+
;
|
|
812
|
+
content.storage_limit = storageLimit_1.toString();
|
|
813
|
+
}
|
|
814
|
+
gasLimitTotal += gasLimit_1;
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
if (overrideParameters || wrappedOperation.contents.some(function (operation) { return (operation === null || operation === void 0 ? void 0 : operation.fee) === FEE_PLACEHOLDER; })) {
|
|
818
|
+
fee = MINIMAL_FEE +
|
|
819
|
+
MINIMAL_FEE_PER_BYTE * Math.ceil((forgedOperation.length + 128) / 2) + // 128 is the length of a hex signature
|
|
820
|
+
MINIMAL_FEE_PER_GAS_UNIT * gasLimitTotal +
|
|
821
|
+
100 // add 100 for safety
|
|
822
|
+
;
|
|
823
|
+
nonRevealOperations = wrappedOperation.contents.filter(function (operation) { return operation.kind !== 'reveal'; });
|
|
824
|
+
feePerOperation_1 = Math.ceil(fee / nonRevealOperations.length);
|
|
825
|
+
wrappedOperation.contents.forEach(function (content) {
|
|
826
|
+
if (content.fee && content.kind !== 'reveal') {
|
|
827
|
+
;
|
|
828
|
+
content.fee = feePerOperation_1.toString();
|
|
829
|
+
}
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
return [2 /*return*/, wrappedOperation];
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
});
|
|
836
|
+
};
|
|
837
|
+
TezosProtocolImpl.prototype.createTransactionOperations = function (previousOperations, details, fee, address, counter, balance) {
|
|
838
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
839
|
+
var amountUsedByPreviousOperations, operations, firstValue, i, recipient, value, _a, total, transferable, receivingBalance, spendOperation;
|
|
840
|
+
return __generator(this, function (_b) {
|
|
841
|
+
switch (_b.label) {
|
|
842
|
+
case 0:
|
|
843
|
+
amountUsedByPreviousOperations = (0, operations_1.getAmountUsedByPreviousOperations)(previousOperations);
|
|
844
|
+
operations = [];
|
|
845
|
+
if (!amountUsedByPreviousOperations.isZero()) {
|
|
846
|
+
firstValue = new bignumber_1.default((0, module_kit_1.newAmount)(details[0].amount).blockchain(this.units).value);
|
|
847
|
+
if (balance.isLessThan(firstValue.plus(fee).plus(amountUsedByPreviousOperations))) {
|
|
848
|
+
// if not, make room for the init fee
|
|
849
|
+
details[0] = __assign(__assign({}, details[0]), { amount: (0, module_kit_1.newAmount)(firstValue.minus(amountUsedByPreviousOperations), 'blockchain') // deduct fee from balance
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
i = 0;
|
|
854
|
+
_b.label = 1;
|
|
855
|
+
case 1:
|
|
856
|
+
if (!(i < details.length)) return [3 /*break*/, 4];
|
|
857
|
+
recipient = details[i].to;
|
|
858
|
+
value = new bignumber_1.default((0, module_kit_1.newAmount)(details[i].amount).blockchain(this.units).value);
|
|
859
|
+
return [4 /*yield*/, this.getBalanceOfAddress(recipient)];
|
|
860
|
+
case 2:
|
|
861
|
+
_a = _b.sent(), total = _a.total, transferable = _a.transferable;
|
|
862
|
+
receivingBalance = new bignumber_1.default((0, module_kit_1.newAmount)(transferable !== null && transferable !== void 0 ? transferable : total).blockchain(this.units).value);
|
|
863
|
+
// if our receiver has 0 balance, the account is not activated yet.
|
|
864
|
+
if (receivingBalance.isZero() && recipient.toLowerCase().startsWith('tz')) {
|
|
865
|
+
// We have to supply an additional 0.257 XTZ fee for storage_limit costs, which gets automatically deducted from the sender so we just have to make sure enough balance is around
|
|
866
|
+
if (balance.isLessThan(fee.plus(operations_1.ACTIVATION_BURN))) {
|
|
867
|
+
// If we don't have enough funds to pay the activation + fee, we throw an error
|
|
868
|
+
throw new errors_1.BalanceError(coinlib_core_1.Domain.TEZOS, 'Insufficient balance to pay activation burn!');
|
|
869
|
+
}
|
|
870
|
+
else if (balance.isLessThan(value.plus(fee).plus(operations_1.ACTIVATION_BURN))) {
|
|
871
|
+
// Check whether the sender has enough to cover the amount to send + fee + activation
|
|
872
|
+
// If not, we deduct it from amount sent to make room for the activation burn
|
|
873
|
+
value = value.minus(operations_1.ACTIVATION_BURN); // deduct fee from balance
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
if (balance.isEqualTo(value.plus(fee))) {
|
|
877
|
+
// Tezos accounts can never be empty. If user tries to send everything, we must leave 1 mutez behind.
|
|
878
|
+
value = value.minus(1);
|
|
879
|
+
}
|
|
880
|
+
else if (balance.isLessThan(value.plus(fee))) {
|
|
881
|
+
throw new errors_1.BalanceError(coinlib_core_1.Domain.TEZOS, 'not enough balance');
|
|
882
|
+
}
|
|
883
|
+
spendOperation = {
|
|
884
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
885
|
+
fee: fee.toFixed(),
|
|
886
|
+
gas_limit: GAS_LIMIT_PLACEHOLDER,
|
|
887
|
+
storage_limit: STORAGE_LIMIT_PLACEHOLDER,
|
|
888
|
+
amount: value.toFixed(),
|
|
889
|
+
counter: counter.plus(i).toFixed(),
|
|
890
|
+
destination: recipient,
|
|
891
|
+
source: address
|
|
892
|
+
};
|
|
893
|
+
operations.push(spendOperation);
|
|
894
|
+
_b.label = 3;
|
|
895
|
+
case 3:
|
|
896
|
+
i++;
|
|
897
|
+
return [3 /*break*/, 1];
|
|
898
|
+
case 4: return [2 /*return*/, operations];
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
});
|
|
902
|
+
};
|
|
903
|
+
return TezosProtocolImpl;
|
|
904
|
+
}());
|
|
905
|
+
exports.TezosProtocolImpl = TezosProtocolImpl;
|
|
906
|
+
// Factory
|
|
907
|
+
function createTezosProtocol(options) {
|
|
908
|
+
if (options === void 0) { options = {}; }
|
|
909
|
+
return new TezosProtocolImpl(options);
|
|
910
|
+
}
|
|
911
|
+
exports.createTezosProtocol = createTezosProtocol;
|
|
912
|
+
exports.TEZOS_MAINNET_PROTOCOL_NETWORK = {
|
|
913
|
+
name: 'Mainnet',
|
|
914
|
+
type: 'mainnet',
|
|
915
|
+
rpcUrl: 'https://tezos-node.prod.gke.papers.tech',
|
|
916
|
+
network: network_1.TezosNetwork.MAINNET,
|
|
917
|
+
blockExplorer: {
|
|
918
|
+
type: 'tzkt',
|
|
919
|
+
url: 'https://tzkt.io'
|
|
920
|
+
},
|
|
921
|
+
indexer: {
|
|
922
|
+
type: 'tzkt',
|
|
923
|
+
apiUrl: 'https://tezos-mainnet-indexer.prod.gke.papers.tech'
|
|
924
|
+
}
|
|
925
|
+
};
|
|
926
|
+
exports.TEZOS_GHOSTNET_PROTOCOL_NETWORK = {
|
|
927
|
+
name: 'Ghostnet',
|
|
928
|
+
type: 'testnet',
|
|
929
|
+
rpcUrl: 'https://tezos-ghostnet-node.prod.gke.papers.tech',
|
|
930
|
+
network: network_1.TezosNetwork.GHOSTNET,
|
|
931
|
+
blockExplorer: {
|
|
932
|
+
type: 'tzkt',
|
|
933
|
+
url: 'https://ghostnet.tzkt.io'
|
|
934
|
+
},
|
|
935
|
+
indexer: {
|
|
936
|
+
type: 'tzkt',
|
|
937
|
+
apiUrl: 'https://tezos-ghostnet-indexer.prod.gke.papers.tech'
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
var DEFAULT_TEZOS_PROTOCOL_NETWORK = exports.TEZOS_MAINNET_PROTOCOL_NETWORK;
|
|
941
|
+
function createTezosProtocolOptions(network) {
|
|
942
|
+
if (network === void 0) { network = {}; }
|
|
943
|
+
return {
|
|
944
|
+
network: __assign(__assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK), network), { blockExplorer: __assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK.blockExplorer), network.blockExplorer), indexer: __assign(__assign({}, DEFAULT_TEZOS_PROTOCOL_NETWORK.indexer), network.indexer) })
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
exports.createTezosProtocolOptions = createTezosProtocolOptions;
|
|
948
|
+
//# sourceMappingURL=TezosProtocol.js.map
|