@wallfree-dev/tezos 0.13.42
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/LICENSE.md +7 -0
- package/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +70 -0
- package/readme.md +121 -0
- 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 +47 -0
- package/v0/index.js +148 -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 +342 -0
- package/v0/protocol/TezosProtocol.js +1750 -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/TezosUXTZ.d.ts +10 -0
- package/v0/protocol/fa/TezosUXTZ.js +56 -0
- package/v0/protocol/fa/TezosUXTZ.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 +136 -0
- package/v0/protocol/sapling/TezosSaplingProtocol.js +1189 -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/domains/TezosDomains.d.ts +20 -0
- package/v1/domains/TezosDomains.js +309 -0
- package/v1/domains/TezosDomains.js.map +1 -0
- package/v1/index.d.ts +74 -0
- package/v1/index.js +110 -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 +14 -0
- package/v1/module/TezosModule.js +214 -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 +114 -0
- package/v1/protocol/TezosProtocol.js +1492 -0
- package/v1/protocol/TezosProtocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA1Protocol.d.ts +43 -0
- package/v1/protocol/fa/TezosFA1Protocol.js +224 -0
- package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.d.ts +32 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.js +128 -0
- package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFA2Protocol.d.ts +56 -0
- package/v1/protocol/fa/TezosFA2Protocol.js +354 -0
- package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -0
- package/v1/protocol/fa/TezosFAProtocol.d.ts +82 -0
- package/v1/protocol/fa/TezosFAProtocol.js +595 -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/UXTZProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/UXTZProtocol.js +74 -0
- package/v1/protocol/fa/tokens/UXTZProtocol.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/fa/tokens/stXTZProtocol.d.ts +14 -0
- package/v1/protocol/fa/tokens/stXTZProtocol.js +74 -0
- package/v1/protocol/fa/tokens/stXTZProtocol.js.map +1 -0
- package/v1/protocol/kt/TezosKtProtocol.d.ts +19 -0
- package/v1/protocol/kt/TezosKtProtocol.js +521 -0
- package/v1/protocol/kt/TezosKtProtocol.js.map +1 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +108 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.js +1021 -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 +437 -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 +1 -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/domains/TezosDomainsRecord.d.ts +8 -0
- package/v1/types/domains/TezosDomainsRecord.js +3 -0
- package/v1/types/domains/TezosDomainsRecord.js.map +1 -0
- package/v1/types/domains/TezosDomainsReverseRecord.d.ts +5 -0
- package/v1/types/domains/TezosDomainsReverseRecord.js +3 -0
- package/v1/types/domains/TezosDomainsReverseRecord.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 +1 -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 +77 -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/staking/BakerDetails.d.ts +11 -0
- package/v1/types/staking/BakerDetails.js +3 -0
- package/v1/types/staking/BakerDetails.js.map +1 -0
- package/v1/types/staking/TezosDelegatorAction.d.ts +8 -0
- package/v1/types/staking/TezosDelegatorAction.js +13 -0
- package/v1/types/staking/TezosDelegatorAction.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 +251 -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/instance.d.ts +19 -0
- package/v1/utils/protocol/instance.js +49 -0
- package/v1/utils/protocol/instance.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 +14 -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 +84 -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,1021 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
37
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
38
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
39
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
40
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
41
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
42
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
46
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
47
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
48
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
49
|
+
function step(op) {
|
|
50
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
51
|
+
while (_) try {
|
|
52
|
+
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;
|
|
53
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
54
|
+
switch (op[0]) {
|
|
55
|
+
case 0: case 1: t = op; break;
|
|
56
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
57
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
58
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
59
|
+
default:
|
|
60
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
61
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
62
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
63
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
64
|
+
if (t[2]) _.ops.pop();
|
|
65
|
+
_.trys.pop(); continue;
|
|
66
|
+
}
|
|
67
|
+
op = body.call(thisArg, _);
|
|
68
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
69
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
73
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
74
|
+
if (ar || !(i in from)) {
|
|
75
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
76
|
+
ar[i] = from[i];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
80
|
+
};
|
|
81
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
82
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
|
+
};
|
|
84
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
+
exports.TezosSaplingProtocolImpl = void 0;
|
|
86
|
+
var coinlib_core_1 = require("@wallfree-dev/coinlib-core");
|
|
87
|
+
var bignumber_1 = __importDefault(require("@wallfree-dev/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
88
|
+
var errors_1 = require("@wallfree-dev/coinlib-core/errors");
|
|
89
|
+
var array_1 = require("@wallfree-dev/coinlib-core/utils/array");
|
|
90
|
+
var crypto_1 = require("@wallfree-dev/crypto");
|
|
91
|
+
var module_kit_1 = require("@wallfree-dev/module-kit");
|
|
92
|
+
var sapling = __importStar(require("@wallfree-dev/sapling-wasm"));
|
|
93
|
+
var random_1 = require("@stablelib/random");
|
|
94
|
+
var TezosContract_1 = require("../../contract/TezosContract");
|
|
95
|
+
var TezosSaplingCryptoClient_1 = require("../../crypto/TezosSaplingCryptoClient");
|
|
96
|
+
var TezosAddress_1 = require("../../data/TezosAddress");
|
|
97
|
+
var TezosSaplingAddress_1 = require("../../data/TezosSaplingAddress");
|
|
98
|
+
var TezosSaplingInjectorClient_1 = require("../../injector/TezosSaplingInjectorClient");
|
|
99
|
+
var TezosSaplingNodeClient_1 = require("../../node/TezosSaplingNodeClient");
|
|
100
|
+
var MichelsonAddress_1 = require("../../types/michelson/primitives/MichelsonAddress");
|
|
101
|
+
var TezosOperationType_1 = require("../../types/operations/TezosOperationType");
|
|
102
|
+
var key_1 = require("../../utils/key");
|
|
103
|
+
var pack_1 = require("../../utils/pack");
|
|
104
|
+
var TezosSaplingAccountant_1 = require("../../utils/protocol/sapling/TezosSaplingAccountant");
|
|
105
|
+
var TezosSaplingEncoder_1 = require("../../utils/protocol/sapling/TezosSaplingEncoder");
|
|
106
|
+
var TezosSaplingForger_1 = require("../../utils/protocol/sapling/TezosSaplingForger");
|
|
107
|
+
var TezosSaplingState_1 = require("../../utils/protocol/sapling/TezosSaplingState");
|
|
108
|
+
var transaction_1 = require("../../utils/transaction");
|
|
109
|
+
var TezosProtocol_1 = require("../TezosProtocol");
|
|
110
|
+
// Implementation
|
|
111
|
+
var TezosSaplingProtocolImpl = /** @class */ (function () {
|
|
112
|
+
function TezosSaplingProtocolImpl(options) {
|
|
113
|
+
var _a;
|
|
114
|
+
this.isTezosSaplingProtocol = true;
|
|
115
|
+
// Offline
|
|
116
|
+
this.cryptoConfiguration = {
|
|
117
|
+
algorithm: 'sapling',
|
|
118
|
+
secretType: 'miniSecretXor'
|
|
119
|
+
};
|
|
120
|
+
this.metadata = __assign(__assign({}, options.metadata), { fee: __assign(__assign({}, ((_a = options.metadata.fee) !== null && _a !== void 0 ? _a : {})), { units: TezosProtocol_1.TEZOS_UNITS, mainUnit: 'tez' }), account: {
|
|
121
|
+
standardDerivationPath: options.metadata.account.standardDerivationPath,
|
|
122
|
+
address: {
|
|
123
|
+
isCaseSensitive: true,
|
|
124
|
+
placeholder: 'zet1...',
|
|
125
|
+
regex: '^(zet1[1-9A-Za-z]{65}|tz1[1-9A-Za-z]{33})$'
|
|
126
|
+
}
|
|
127
|
+
} });
|
|
128
|
+
this.network = options.network;
|
|
129
|
+
this.memoSize = options.memoSize;
|
|
130
|
+
this.tezos = (0, TezosProtocol_1.createTezosProtocol)({ network: options.network });
|
|
131
|
+
this.externalProvider = options.externalProvider;
|
|
132
|
+
this.cryptoClient = new TezosSaplingCryptoClient_1.TezosSaplingCryptoClient();
|
|
133
|
+
this.state = new TezosSaplingState_1.TezosSaplingState(options.merkleTreeHeight);
|
|
134
|
+
this.encoder = new TezosSaplingEncoder_1.TezosSaplingEncoder();
|
|
135
|
+
this.forger = new TezosSaplingForger_1.TezosSaplingForger(this.cryptoClient, this.state, this.encoder, this.externalProvider);
|
|
136
|
+
this.accountant = new TezosSaplingAccountant_1.TezosSaplingAccountant(this.network, this.cryptoClient, this.encoder);
|
|
137
|
+
this.nodeClient = this.network.contractAddress
|
|
138
|
+
? new TezosSaplingNodeClient_1.TezosSaplingNodeClient(this.network.rpcUrl, this.network.contractAddress)
|
|
139
|
+
: undefined;
|
|
140
|
+
this.contract = this.network.contractAddress ? new TezosContract_1.TezosContract(this.network.contractAddress, this.network) : undefined;
|
|
141
|
+
this.injectorClient =
|
|
142
|
+
this.network.injectorUrl && this.network.contractAddress
|
|
143
|
+
? new TezosSaplingInjectorClient_1.TezosSaplingInjectorClient(this.network.injectorUrl, this.network.contractAddress)
|
|
144
|
+
: undefined;
|
|
145
|
+
}
|
|
146
|
+
TezosSaplingProtocolImpl.prototype.getMetadata = function () {
|
|
147
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
148
|
+
return __generator(this, function (_a) {
|
|
149
|
+
return [2 /*return*/, this.metadata];
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
TezosSaplingProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var address;
|
|
156
|
+
return __generator(this, function (_a) {
|
|
157
|
+
switch (_a.label) {
|
|
158
|
+
case 0: return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.fromViewingKey(publicKey)];
|
|
159
|
+
case 1:
|
|
160
|
+
address = _a.sent();
|
|
161
|
+
return [2 /*return*/, {
|
|
162
|
+
address: address.asString(),
|
|
163
|
+
cursor: {
|
|
164
|
+
hasNext: address.diversifierIndex !== undefined,
|
|
165
|
+
diversifierIndex: address.diversifierIndex
|
|
166
|
+
}
|
|
167
|
+
}];
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
TezosSaplingProtocolImpl.prototype.getInitialAddressesFromPublicKey = function (publicKey) {
|
|
173
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
176
|
+
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
177
|
+
case 1: return [2 /*return*/, [_a.sent()]];
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
TezosSaplingProtocolImpl.prototype.getNextAddressFromPublicKey = function (publicKey, cursor) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var current, next;
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
switch (_a.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
if (!cursor.hasNext) {
|
|
189
|
+
return [2 /*return*/, undefined];
|
|
190
|
+
}
|
|
191
|
+
return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.fromViewingKey(publicKey, cursor.diversifierIndex)];
|
|
192
|
+
case 1:
|
|
193
|
+
current = _a.sent();
|
|
194
|
+
return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.next(publicKey, current)];
|
|
195
|
+
case 2:
|
|
196
|
+
next = _a.sent();
|
|
197
|
+
return [2 /*return*/, {
|
|
198
|
+
address: next.asString(),
|
|
199
|
+
cursor: {
|
|
200
|
+
hasNext: next.diversifierIndex !== undefined,
|
|
201
|
+
diversifierIndex: next.diversifierIndex
|
|
202
|
+
}
|
|
203
|
+
}];
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
TezosSaplingProtocolImpl.prototype.getContractAddress = function () {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
210
|
+
return __generator(this, function (_a) {
|
|
211
|
+
return [2 /*return*/, this.network.contractAddress];
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
};
|
|
215
|
+
TezosSaplingProtocolImpl.prototype.setContractAddress = function (address) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
217
|
+
return __generator(this, function (_a) {
|
|
218
|
+
this.network.contractAddress = address;
|
|
219
|
+
this.contract = new TezosContract_1.TezosContract(address, this.network);
|
|
220
|
+
this.nodeClient = new TezosSaplingNodeClient_1.TezosSaplingNodeClient(this.network.rpcUrl, address);
|
|
221
|
+
if (this.network.injectorUrl !== undefined) {
|
|
222
|
+
this.injectorClient = new TezosSaplingInjectorClient_1.TezosSaplingInjectorClient(this.network.injectorUrl, address);
|
|
223
|
+
}
|
|
224
|
+
return [2 /*return*/];
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
};
|
|
228
|
+
TezosSaplingProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, publicKey, knownViewingKeys) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
230
|
+
return __generator(this, function (_a) {
|
|
231
|
+
switch (transaction.type) {
|
|
232
|
+
case 'signed':
|
|
233
|
+
return [2 /*return*/, this.getDetailsFromSignedTransaction(transaction, knownViewingKeys)];
|
|
234
|
+
case 'unsigned':
|
|
235
|
+
return [2 /*return*/, this.getDetailsFromUnsignedTransaction(transaction, publicKey, knownViewingKeys)];
|
|
236
|
+
default:
|
|
237
|
+
(0, coinlib_core_1.assertNever)(transaction);
|
|
238
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, 'Unsupported transaction type.');
|
|
239
|
+
}
|
|
240
|
+
return [2 /*return*/];
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
TezosSaplingProtocolImpl.prototype.getDetailsFromSignedTransaction = function (transaction, knownViewingKeys) {
|
|
245
|
+
var _a;
|
|
246
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
+
var airGapTxs, binary, defaultDetails, partialDetails, wrappedOperation, _b, _c, _d, _e, partialDetails;
|
|
248
|
+
return __generator(this, function (_f) {
|
|
249
|
+
switch (_f.label) {
|
|
250
|
+
case 0:
|
|
251
|
+
airGapTxs = [];
|
|
252
|
+
binary = transaction.binary;
|
|
253
|
+
defaultDetails = {
|
|
254
|
+
from: ['Shielded Pool'],
|
|
255
|
+
to: ['Shielded Pool'],
|
|
256
|
+
isInbound: false,
|
|
257
|
+
amount: (0, module_kit_1.newAmount)(0, 'blockchain'),
|
|
258
|
+
fee: (0, module_kit_1.newAmount)(0, 'blockchain'),
|
|
259
|
+
network: this.network
|
|
260
|
+
};
|
|
261
|
+
if (!((_a = this.contract) === null || _a === void 0 ? void 0 : _a.areValidParameters(binary))) return [3 /*break*/, 2];
|
|
262
|
+
return [4 /*yield*/, this.getPartialDetailsFromContractParameters(binary, knownViewingKeys)];
|
|
263
|
+
case 1:
|
|
264
|
+
partialDetails = _f.sent();
|
|
265
|
+
airGapTxs.push.apply(airGapTxs, partialDetails.map(function (partial) { return (__assign(__assign({}, defaultDetails), partial)); }));
|
|
266
|
+
return [3 /*break*/, 7];
|
|
267
|
+
case 2:
|
|
268
|
+
_f.trys.push([2, 5, , 7]);
|
|
269
|
+
return [4 /*yield*/, this.tezos.unforgeOperation(binary, 'signed')];
|
|
270
|
+
case 3:
|
|
271
|
+
wrappedOperation = _f.sent();
|
|
272
|
+
_c = (_b = airGapTxs.push).apply;
|
|
273
|
+
_d = [airGapTxs];
|
|
274
|
+
return [4 /*yield*/, this.getDetailsFromWrappedOperation(wrappedOperation, knownViewingKeys)];
|
|
275
|
+
case 4:
|
|
276
|
+
_c.apply(_b, _d.concat([(_f.sent())]));
|
|
277
|
+
return [3 /*break*/, 7];
|
|
278
|
+
case 5:
|
|
279
|
+
_e = _f.sent();
|
|
280
|
+
return [4 /*yield*/, this.accountant.getTransactionsPartialDetails([binary], knownViewingKeys)];
|
|
281
|
+
case 6:
|
|
282
|
+
partialDetails = _f.sent();
|
|
283
|
+
airGapTxs.push.apply(airGapTxs, partialDetails.map(function (partial) { return (__assign(__assign({}, defaultDetails), partial)); }));
|
|
284
|
+
return [3 /*break*/, 7];
|
|
285
|
+
case 7: return [2 /*return*/, this.filterOutPaybacks(airGapTxs)];
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
});
|
|
289
|
+
};
|
|
290
|
+
TezosSaplingProtocolImpl.prototype.getDetailsFromUnsignedTransaction = function (transaction, viewingKey, knownViewingKeys) {
|
|
291
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
292
|
+
var airGapTxs, unshieldTarget, from, details, wrappedOperation, _a, _b, _c;
|
|
293
|
+
return __generator(this, function (_d) {
|
|
294
|
+
switch (_d.label) {
|
|
295
|
+
case 0:
|
|
296
|
+
airGapTxs = [];
|
|
297
|
+
if (!(0, transaction_1.isUnsignedSaplingTransaction)(transaction)) return [3 /*break*/, 2];
|
|
298
|
+
unshieldTarget = transaction.unshieldTarget.length > 0 ? transaction.unshieldTarget : undefined;
|
|
299
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(viewingKey).then(function (address) {
|
|
300
|
+
return TezosSaplingAddress_1.TezosSaplingAddress.fromValue(address.address, address.cursor.diversifierIndex);
|
|
301
|
+
})];
|
|
302
|
+
case 1:
|
|
303
|
+
from = _d.sent();
|
|
304
|
+
details = this.accountant
|
|
305
|
+
.getUnsignedTransactionDetails(from, transaction.ins, transaction.outs, unshieldTarget)
|
|
306
|
+
.map(function (details) {
|
|
307
|
+
var _a;
|
|
308
|
+
return (__assign(__assign({}, details), { extra: __assign(__assign({}, ((_a = details.extra) !== null && _a !== void 0 ? _a : {})), { destination: transaction.contractAddress, chainId: transaction.chainId }) }));
|
|
309
|
+
});
|
|
310
|
+
airGapTxs.push.apply(airGapTxs, details);
|
|
311
|
+
return [3 /*break*/, 5];
|
|
312
|
+
case 2: return [4 /*yield*/, this.tezos.unforgeOperation(transaction.binary, 'unsigned')];
|
|
313
|
+
case 3:
|
|
314
|
+
wrappedOperation = _d.sent();
|
|
315
|
+
_b = (_a = airGapTxs.push).apply;
|
|
316
|
+
_c = [airGapTxs];
|
|
317
|
+
return [4 /*yield*/, this.getDetailsFromWrappedOperation(wrappedOperation, knownViewingKeys)];
|
|
318
|
+
case 4:
|
|
319
|
+
_b.apply(_a, _c.concat([(_d.sent())]));
|
|
320
|
+
_d.label = 5;
|
|
321
|
+
case 5: return [2 /*return*/, this.filterOutPaybacks(airGapTxs)];
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
TezosSaplingProtocolImpl.prototype.getDetailsFromWrappedOperation = function (operation, knownViewingKeys) {
|
|
327
|
+
if (knownViewingKeys === void 0) { knownViewingKeys = []; }
|
|
328
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
329
|
+
var contractOperations, details;
|
|
330
|
+
var _this = this;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0:
|
|
334
|
+
contractOperations = operation.contents.filter(function (content) {
|
|
335
|
+
return content.kind === TezosOperationType_1.TezosOperationType.TRANSACTION && content.parameters !== undefined;
|
|
336
|
+
});
|
|
337
|
+
return [4 /*yield*/, Promise.all(contractOperations.map(function (operation) { return __awaiter(_this, void 0, void 0, function () {
|
|
338
|
+
var saplingDetails;
|
|
339
|
+
var _this = this;
|
|
340
|
+
return __generator(this, function (_a) {
|
|
341
|
+
switch (_a.label) {
|
|
342
|
+
case 0: return [4 /*yield*/, this.getPartialDetailsFromContractParameters(operation.parameters, knownViewingKeys)];
|
|
343
|
+
case 1:
|
|
344
|
+
saplingDetails = _a.sent();
|
|
345
|
+
return [2 /*return*/, saplingDetails.map(function (partials) { return (__assign(__assign({ from: [operation.source], to: ['Shielded Pool'], isInbound: false, amount: (0, module_kit_1.newAmount)(operation.amount, 'blockchain'), fee: (0, module_kit_1.newAmount)(operation.fee, 'blockchain'), network: _this.network }, partials), { transactionDetails: operation })); })];
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}); }))];
|
|
349
|
+
case 1:
|
|
350
|
+
details = _a.sent();
|
|
351
|
+
return [2 /*return*/, (0, array_1.flattenArray)(details)];
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
TezosSaplingProtocolImpl.prototype.getPartialDetailsFromContractParameters = function (rawOrParsed, knownViewingKeys) {
|
|
357
|
+
if (knownViewingKeys === void 0) { knownViewingKeys = []; }
|
|
358
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
359
|
+
var parameters, txs;
|
|
360
|
+
return __generator(this, function (_a) {
|
|
361
|
+
switch (_a.label) {
|
|
362
|
+
case 0:
|
|
363
|
+
parameters = typeof rawOrParsed === 'string' ? (this.contract ? this.contract.parseParameters(rawOrParsed) : JSON.parse(rawOrParsed)) : rawOrParsed;
|
|
364
|
+
return [4 /*yield*/, this.parseParameters(parameters)];
|
|
365
|
+
case 1:
|
|
366
|
+
txs = _a.sent();
|
|
367
|
+
return [2 /*return*/, this.accountant.getTransactionsPartialDetails(txs, knownViewingKeys)];
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
TezosSaplingProtocolImpl.prototype.filterOutPaybacks = function (airGapTxs) {
|
|
373
|
+
var filtered = airGapTxs.filter(function (details) {
|
|
374
|
+
if (details.from.length !== details.to.length) {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
var fromSet = new Set(details.from);
|
|
378
|
+
var toSet = new Set(details.to);
|
|
379
|
+
return Array.from(fromSet).some(function (address) { return !toSet.has(address); });
|
|
380
|
+
});
|
|
381
|
+
return filtered.length > 0 ? filtered : airGapTxs;
|
|
382
|
+
};
|
|
383
|
+
TezosSaplingProtocolImpl.prototype.getCryptoConfiguration = function () {
|
|
384
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
385
|
+
return __generator(this, function (_a) {
|
|
386
|
+
return [2 /*return*/, this.cryptoConfiguration];
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
TezosSaplingProtocolImpl.prototype.getKeyPairFromDerivative = function (derivative) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
392
|
+
var zip32Node;
|
|
393
|
+
return __generator(this, function (_a) {
|
|
394
|
+
zip32Node = (0, crypto_1.encodeDerivative)('zip32', derivative);
|
|
395
|
+
return [2 /*return*/, {
|
|
396
|
+
secretKey: (0, module_kit_1.newSecretKey)(zip32Node.secretKey, 'hex'),
|
|
397
|
+
publicKey: (0, module_kit_1.newPublicKey)(zip32Node.publicKey, 'hex')
|
|
398
|
+
}];
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
TezosSaplingProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
404
|
+
var hexSecretKey, stateTree, boundData, forgedTransaction;
|
|
405
|
+
return __generator(this, function (_a) {
|
|
406
|
+
switch (_a.label) {
|
|
407
|
+
case 0:
|
|
408
|
+
hexSecretKey = (0, key_1.convertSecretKey)(secretKey, 'hex', 'saplingSpendingKey');
|
|
409
|
+
return [4 /*yield*/, this.state.getStateTreeFromStateDiff(transaction.stateDiff)];
|
|
410
|
+
case 1:
|
|
411
|
+
stateTree = _a.sent();
|
|
412
|
+
boundData = transaction.unshieldTarget && transaction.unshieldTarget.length > 0
|
|
413
|
+
? this.createAddressBoundData(transaction.unshieldTarget)
|
|
414
|
+
: undefined;
|
|
415
|
+
return [4 /*yield*/, this.forger.forgeSaplingTransaction(transaction.ins, transaction.outs, stateTree, this.getAntiReplay(transaction.chainId, transaction.contractAddress), boundData, Buffer.from(hexSecretKey.value, 'hex'))];
|
|
416
|
+
case 2:
|
|
417
|
+
forgedTransaction = _a.sent();
|
|
418
|
+
return [2 /*return*/, (0, module_kit_1.newSignedTransaction)({
|
|
419
|
+
binary: this.encoder.encodeTransaction(forgedTransaction).toString('hex')
|
|
420
|
+
})];
|
|
421
|
+
}
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
// Online
|
|
426
|
+
TezosSaplingProtocolImpl.prototype.getNetwork = function () {
|
|
427
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
428
|
+
return __generator(this, function (_a) {
|
|
429
|
+
return [2 /*return*/, this.network];
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
TezosSaplingProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
|
|
434
|
+
var _a;
|
|
435
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
436
|
+
var hexPublicKey, saplingStateDiff, incoming, outgoing, page, pageStart, pageEnd, hasNext, commitmentsAndCiphertexts, inputs, airGapIncoming, airGapOutgoing;
|
|
437
|
+
var _this = this;
|
|
438
|
+
return __generator(this, function (_b) {
|
|
439
|
+
switch (_b.label) {
|
|
440
|
+
case 0:
|
|
441
|
+
if (this.nodeClient === undefined) {
|
|
442
|
+
return [2 /*return*/, {
|
|
443
|
+
transactions: [],
|
|
444
|
+
cursor: {
|
|
445
|
+
hasNext: false
|
|
446
|
+
}
|
|
447
|
+
}];
|
|
448
|
+
}
|
|
449
|
+
hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex', 'saplingViewingKey');
|
|
450
|
+
return [4 /*yield*/, this.nodeClient.getSaplingStateDiff()];
|
|
451
|
+
case 1:
|
|
452
|
+
saplingStateDiff = _b.sent();
|
|
453
|
+
incoming = [];
|
|
454
|
+
outgoing = [];
|
|
455
|
+
page = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.page) !== null && _a !== void 0 ? _a : 0;
|
|
456
|
+
pageStart = page * limit;
|
|
457
|
+
pageEnd = pageStart + limit;
|
|
458
|
+
hasNext = pageStart < saplingStateDiff.commitments_and_ciphertexts.length;
|
|
459
|
+
_b.label = 2;
|
|
460
|
+
case 2:
|
|
461
|
+
if (!(incoming.length + outgoing.length < limit && hasNext)) return [3 /*break*/, 4];
|
|
462
|
+
commitmentsAndCiphertexts = saplingStateDiff.commitments_and_ciphertexts
|
|
463
|
+
.map(function (_a, index) {
|
|
464
|
+
var commitment = _a[0], ciphertext = _a[1];
|
|
465
|
+
return [commitment, ciphertext, new bignumber_1.default(index)];
|
|
466
|
+
})
|
|
467
|
+
.reverse()
|
|
468
|
+
.slice(pageStart, pageEnd);
|
|
469
|
+
return [4 /*yield*/, Promise.all([
|
|
470
|
+
this.accountant.getIncomingInputs(hexPublicKey.value, commitmentsAndCiphertexts),
|
|
471
|
+
this.accountant.getOutgoingInputs(hexPublicKey.value, commitmentsAndCiphertexts)
|
|
472
|
+
])];
|
|
473
|
+
case 3:
|
|
474
|
+
inputs = _b.sent();
|
|
475
|
+
incoming.push.apply(incoming, inputs[0]);
|
|
476
|
+
outgoing.push.apply(outgoing, inputs[1]);
|
|
477
|
+
page += 1;
|
|
478
|
+
pageStart += limit;
|
|
479
|
+
pageEnd += limit;
|
|
480
|
+
hasNext = pageStart < saplingStateDiff.commitments_and_ciphertexts.length;
|
|
481
|
+
return [3 /*break*/, 2];
|
|
482
|
+
case 4: return [4 /*yield*/, Promise.all(incoming.map(function (input) { return __awaiter(_this, void 0, void 0, function () {
|
|
483
|
+
return __generator(this, function (_a) {
|
|
484
|
+
return [2 /*return*/, ({
|
|
485
|
+
from: ['Shielded Pool'],
|
|
486
|
+
to: [input.address],
|
|
487
|
+
isInbound: true,
|
|
488
|
+
amount: (0, module_kit_1.newAmount)(input.value, 'blockchain'),
|
|
489
|
+
fee: (0, module_kit_1.newAmount)(0, 'blockchain'),
|
|
490
|
+
network: this.network
|
|
491
|
+
})];
|
|
492
|
+
});
|
|
493
|
+
}); }))];
|
|
494
|
+
case 5:
|
|
495
|
+
airGapIncoming = _b.sent();
|
|
496
|
+
return [4 /*yield*/, Promise.all(outgoing.map(function (input) { return __awaiter(_this, void 0, void 0, function () {
|
|
497
|
+
var _a;
|
|
498
|
+
return __generator(this, function (_b) {
|
|
499
|
+
switch (_b.label) {
|
|
500
|
+
case 0:
|
|
501
|
+
_a = {};
|
|
502
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
503
|
+
case 1: return [2 /*return*/, (_a.from = [(_b.sent()).address],
|
|
504
|
+
_a.to = [input.address],
|
|
505
|
+
_a.isInbound = false,
|
|
506
|
+
_a.amount = (0, module_kit_1.newAmount)(input.value, 'blockchain'),
|
|
507
|
+
_a.fee = (0, module_kit_1.newAmount)(0, 'blockchain'),
|
|
508
|
+
_a.network = this.network,
|
|
509
|
+
_a)];
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
}); }))];
|
|
513
|
+
case 6:
|
|
514
|
+
airGapOutgoing = _b.sent();
|
|
515
|
+
return [2 /*return*/, {
|
|
516
|
+
transactions: airGapIncoming.concat(airGapOutgoing),
|
|
517
|
+
cursor: {
|
|
518
|
+
hasNext: hasNext,
|
|
519
|
+
page: hasNext ? page + 1 : undefined
|
|
520
|
+
}
|
|
521
|
+
}];
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
};
|
|
526
|
+
TezosSaplingProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
527
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
528
|
+
var hexPublicKey, saplingStateDiff, unspends, balance;
|
|
529
|
+
return __generator(this, function (_a) {
|
|
530
|
+
switch (_a.label) {
|
|
531
|
+
case 0:
|
|
532
|
+
if (this.nodeClient === undefined) {
|
|
533
|
+
return [2 /*return*/, { total: (0, module_kit_1.newAmount)(0, 'blockchain') }];
|
|
534
|
+
}
|
|
535
|
+
hexPublicKey = (0, key_1.convertPublicKey)(publicKey, 'hex', 'saplingViewingKey');
|
|
536
|
+
return [4 /*yield*/, this.nodeClient.getSaplingStateDiff()];
|
|
537
|
+
case 1:
|
|
538
|
+
saplingStateDiff = _a.sent();
|
|
539
|
+
return [4 /*yield*/, this.accountant.getUnspends(hexPublicKey.value, saplingStateDiff.commitments_and_ciphertexts, saplingStateDiff.nullifiers)];
|
|
540
|
+
case 2:
|
|
541
|
+
unspends = _a.sent();
|
|
542
|
+
balance = unspends.reduce(function (sum, next) { return sum.plus(next.value); }, new bignumber_1.default(0));
|
|
543
|
+
return [2 /*return*/, { total: (0, module_kit_1.newAmount)(balance, 'blockchain') }];
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
};
|
|
548
|
+
TezosSaplingProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, _to, _configuration) {
|
|
549
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
550
|
+
var balance;
|
|
551
|
+
return __generator(this, function (_a) {
|
|
552
|
+
switch (_a.label) {
|
|
553
|
+
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
554
|
+
case 1:
|
|
555
|
+
balance = _a.sent();
|
|
556
|
+
return [2 /*return*/, balance.total];
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
TezosSaplingProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (_publicKey, _details, _configuration) {
|
|
562
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
563
|
+
return __generator(this, function (_a) {
|
|
564
|
+
return [2 /*return*/, undefined];
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
};
|
|
568
|
+
TezosSaplingProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
|
|
569
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
570
|
+
var recipient;
|
|
571
|
+
return __generator(this, function (_a) {
|
|
572
|
+
if (details.length > 1) {
|
|
573
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, 'Multiple sapling transactions are not supported yet');
|
|
574
|
+
}
|
|
575
|
+
recipient = details[0].to;
|
|
576
|
+
if (TezosAddress_1.TezosAddress.isTzAddress(recipient)) {
|
|
577
|
+
return [2 /*return*/, this.prepareUnshieldTransaction(publicKey, details, configuration)];
|
|
578
|
+
}
|
|
579
|
+
else if (TezosSaplingAddress_1.TezosSaplingAddress.isZetAddress(recipient)) {
|
|
580
|
+
return [2 /*return*/, this.prepareSaplingTransaction(publicKey, details, configuration)];
|
|
581
|
+
}
|
|
582
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, "Invalid recpient, expected a 'tz' or 'zet' address, got ".concat(recipient));
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
};
|
|
586
|
+
TezosSaplingProtocolImpl.prototype.broadcastTransaction = function (transaction) {
|
|
587
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
588
|
+
var hash, error_1;
|
|
589
|
+
return __generator(this, function (_a) {
|
|
590
|
+
switch (_a.label) {
|
|
591
|
+
case 0:
|
|
592
|
+
if (!this.injectorClient) {
|
|
593
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, "Can't broadcast a sapling transaction, an injector service URL or contract address has not be set.");
|
|
594
|
+
}
|
|
595
|
+
_a.label = 1;
|
|
596
|
+
case 1:
|
|
597
|
+
_a.trys.push([1, 3, , 4]);
|
|
598
|
+
return [4 /*yield*/, this.injectorClient.injectTransaction(transaction.binary)];
|
|
599
|
+
case 2:
|
|
600
|
+
hash = _a.sent();
|
|
601
|
+
return [2 /*return*/, hash];
|
|
602
|
+
case 3:
|
|
603
|
+
error_1 = _a.sent();
|
|
604
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error_1);
|
|
605
|
+
case 4: return [2 /*return*/];
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
};
|
|
610
|
+
TezosSaplingProtocolImpl.prototype.getInjectorUrl = function () {
|
|
611
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
612
|
+
return __generator(this, function (_a) {
|
|
613
|
+
return [2 /*return*/, this.network.injectorUrl];
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
};
|
|
617
|
+
TezosSaplingProtocolImpl.prototype.setInjectorUrl = function (url) {
|
|
618
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
619
|
+
return __generator(this, function (_a) {
|
|
620
|
+
this.network.injectorUrl = url;
|
|
621
|
+
if (this.network.contractAddress !== undefined) {
|
|
622
|
+
this.injectorClient = new TezosSaplingInjectorClient_1.TezosSaplingInjectorClient(url, this.network.contractAddress);
|
|
623
|
+
}
|
|
624
|
+
return [2 /*return*/];
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
};
|
|
628
|
+
TezosSaplingProtocolImpl.prototype.initParameters = function (spendParams, outputParams) {
|
|
629
|
+
var _a;
|
|
630
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
631
|
+
var externalInitParameters;
|
|
632
|
+
return __generator(this, function (_b) {
|
|
633
|
+
switch (_b.label) {
|
|
634
|
+
case 0:
|
|
635
|
+
externalInitParameters = this.externalProvider ? (_a = this.externalProvider.initParameters) === null || _a === void 0 ? void 0 : _a.bind(this.externalProvider) : undefined;
|
|
636
|
+
if (!(externalInitParameters !== undefined)) return [3 /*break*/, 2];
|
|
637
|
+
return [4 /*yield*/, externalInitParameters(spendParams, outputParams)];
|
|
638
|
+
case 1:
|
|
639
|
+
_b.sent();
|
|
640
|
+
return [3 /*break*/, 4];
|
|
641
|
+
case 2: return [4 /*yield*/, sapling.initParameters(spendParams, outputParams)];
|
|
642
|
+
case 3:
|
|
643
|
+
_b.sent();
|
|
644
|
+
_b.label = 4;
|
|
645
|
+
case 4: return [2 /*return*/];
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
};
|
|
650
|
+
TezosSaplingProtocolImpl.prototype.getAddressFromViewingKey = function (viewingKey, index) {
|
|
651
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
652
|
+
var address;
|
|
653
|
+
return __generator(this, function (_a) {
|
|
654
|
+
switch (_a.label) {
|
|
655
|
+
case 0: return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.fromViewingKey(viewingKey, index)];
|
|
656
|
+
case 1:
|
|
657
|
+
address = _a.sent();
|
|
658
|
+
return [2 /*return*/, {
|
|
659
|
+
address: address.asString(),
|
|
660
|
+
cursor: {
|
|
661
|
+
hasNext: address.diversifierIndex !== undefined,
|
|
662
|
+
diversifierIndex: address.diversifierIndex
|
|
663
|
+
}
|
|
664
|
+
}];
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
});
|
|
668
|
+
};
|
|
669
|
+
TezosSaplingProtocolImpl.prototype.prepareShieldTransaction = function (publicKey, details, configuration) {
|
|
670
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
671
|
+
var recipient, value, encodedTransaction;
|
|
672
|
+
return __generator(this, function (_a) {
|
|
673
|
+
switch (_a.label) {
|
|
674
|
+
case 0:
|
|
675
|
+
if (details.length > 1) {
|
|
676
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, 'Multiple sapling transactions are not supported yet');
|
|
677
|
+
}
|
|
678
|
+
recipient = details[0].to;
|
|
679
|
+
value = (0, module_kit_1.newAmount)(details[0].amount).blockchain(this.metadata.units).value;
|
|
680
|
+
return [4 /*yield*/, this.mint(recipient, value)];
|
|
681
|
+
case 1:
|
|
682
|
+
encodedTransaction = _a.sent();
|
|
683
|
+
return [2 /*return*/, this.wrapSaplingTransactions(publicKey, [encodedTransaction], configuration)];
|
|
684
|
+
}
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
TezosSaplingProtocolImpl.prototype.prepareSaplingTransaction = function (viewingKey, details, configuration) {
|
|
689
|
+
var _a, _b;
|
|
690
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
691
|
+
var recipient, value, dummyInputsAmount, dummyOutputsAmount, _c, stateDiff, chainId, hexViewingKey, _d, inputs, toSpend, address, paymentOutput, _e, paybackOutput, _f, dummyInputs, dummyOutputs;
|
|
692
|
+
var _this = this;
|
|
693
|
+
return __generator(this, function (_g) {
|
|
694
|
+
switch (_g.label) {
|
|
695
|
+
case 0:
|
|
696
|
+
if (details.length > 1) {
|
|
697
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, 'Multiple sapling transactions are not supported yet');
|
|
698
|
+
}
|
|
699
|
+
if (this.nodeClient === undefined || this.network.contractAddress === undefined) {
|
|
700
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'Contract address not set.');
|
|
701
|
+
}
|
|
702
|
+
recipient = details[0].to;
|
|
703
|
+
value = (0, module_kit_1.newAmount)(details[0].amount).blockchain(this.metadata.units).value;
|
|
704
|
+
if (!TezosSaplingAddress_1.TezosSaplingAddress.isZetAddress(recipient)) {
|
|
705
|
+
throw new errors_1.ConditionViolationError(coinlib_core_1.Domain.TEZOS, "Invalid recpient, expected a 'zet' address, got ".concat(recipient));
|
|
706
|
+
}
|
|
707
|
+
dummyInputsAmount = Math.max(new bignumber_1.default((_a = configuration === null || configuration === void 0 ? void 0 : configuration.dummyInputs) !== null && _a !== void 0 ? _a : 0).toNumber(), 0);
|
|
708
|
+
dummyOutputsAmount = Math.max(new bignumber_1.default((_b = configuration === null || configuration === void 0 ? void 0 : configuration.dummyOutputs) !== null && _b !== void 0 ? _b : 0).toNumber(), 0);
|
|
709
|
+
return [4 /*yield*/, Promise.all([
|
|
710
|
+
this.nodeClient.getSaplingStateDiff(),
|
|
711
|
+
this.nodeClient.getChainId()
|
|
712
|
+
])];
|
|
713
|
+
case 1:
|
|
714
|
+
_c = _g.sent(), stateDiff = _c[0], chainId = _c[1];
|
|
715
|
+
hexViewingKey = (0, key_1.convertPublicKey)(viewingKey, 'hex', 'saplingViewingKey');
|
|
716
|
+
return [4 /*yield*/, this.chooseInputs(hexViewingKey.value, stateDiff.commitments_and_ciphertexts, stateDiff.nullifiers, value)];
|
|
717
|
+
case 2:
|
|
718
|
+
_d = _g.sent(), inputs = _d[0], toSpend = _d[1];
|
|
719
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(viewingKey).then(function (address) {
|
|
720
|
+
return TezosSaplingAddress_1.TezosSaplingAddress.fromValue(address.address, address.cursor.diversifierIndex);
|
|
721
|
+
})];
|
|
722
|
+
case 3:
|
|
723
|
+
address = _g.sent();
|
|
724
|
+
_e = this.createPaymentOutput;
|
|
725
|
+
return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.fromValue(recipient)];
|
|
726
|
+
case 4:
|
|
727
|
+
paymentOutput = _e.apply(this, [_g.sent(), value]);
|
|
728
|
+
paybackOutput = this.createPaybackOutput(address, toSpend, value);
|
|
729
|
+
return [4 /*yield*/, Promise.all([
|
|
730
|
+
Promise.all(Array.from({ length: dummyInputsAmount }, function (_v, _k) { return _this.createDummyInput(address); })),
|
|
731
|
+
Promise.all(Array.from({ length: dummyOutputsAmount }, function (_v, _k) { return _this.createDummyOutput(); }))
|
|
732
|
+
])];
|
|
733
|
+
case 5:
|
|
734
|
+
_f = _g.sent(), dummyInputs = _f[0], dummyOutputs = _f[1];
|
|
735
|
+
return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({
|
|
736
|
+
ins: inputs.concat(dummyInputs),
|
|
737
|
+
outs: __spreadArray([paymentOutput, paybackOutput], dummyOutputs, true).filter(function (output) { return output !== undefined; }),
|
|
738
|
+
contractAddress: this.network.contractAddress,
|
|
739
|
+
chainId: chainId,
|
|
740
|
+
stateDiff: stateDiff,
|
|
741
|
+
unshieldTarget: ''
|
|
742
|
+
})];
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
});
|
|
746
|
+
};
|
|
747
|
+
TezosSaplingProtocolImpl.prototype.prepareUnshieldTransaction = function (viewingKey, details, _configuration) {
|
|
748
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
749
|
+
var recipient, value, burnTransaction;
|
|
750
|
+
return __generator(this, function (_a) {
|
|
751
|
+
switch (_a.label) {
|
|
752
|
+
case 0:
|
|
753
|
+
if (details.length > 1) {
|
|
754
|
+
throw new errors_1.UnsupportedError(coinlib_core_1.Domain.TEZOS, 'Multiple sapling transactions are not supported yet');
|
|
755
|
+
}
|
|
756
|
+
recipient = details[0].to;
|
|
757
|
+
value = (0, module_kit_1.newAmount)(details[0].amount).blockchain(this.metadata.units).value;
|
|
758
|
+
return [4 /*yield*/, this.burn(viewingKey, value)];
|
|
759
|
+
case 1:
|
|
760
|
+
burnTransaction = _a.sent();
|
|
761
|
+
return [2 /*return*/, __assign(__assign({}, burnTransaction), { unshieldTarget: recipient })];
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
TezosSaplingProtocolImpl.prototype.wrapSaplingTransactions = function (publicKey, transactions, configuration) {
|
|
767
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
768
|
+
var tezosMetadata, fee, overrideFees, operations, parameters, normalizedTransactions, contractCalls, tezosWrappedOperation, binaryTx, error_2, rpcErrors, cannotPayStorageFee, balanceTooLowError;
|
|
769
|
+
var _this = this;
|
|
770
|
+
return __generator(this, function (_a) {
|
|
771
|
+
switch (_a.label) {
|
|
772
|
+
case 0:
|
|
773
|
+
if (this.contract === undefined) {
|
|
774
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'Contract address not set.');
|
|
775
|
+
}
|
|
776
|
+
return [4 /*yield*/, this.tezos.getMetadata()];
|
|
777
|
+
case 1:
|
|
778
|
+
tezosMetadata = _a.sent();
|
|
779
|
+
fee = (configuration === null || configuration === void 0 ? void 0 : configuration.fee) ? (0, module_kit_1.newAmount)(configuration.fee).blockchain(tezosMetadata.units).value : '0';
|
|
780
|
+
overrideFees = (configuration === null || configuration === void 0 ? void 0 : configuration.fee) === undefined;
|
|
781
|
+
operations = [];
|
|
782
|
+
if (!(typeof transactions === 'string' && this.contract.areValidParameters(transactions))) return [3 /*break*/, 2];
|
|
783
|
+
parameters = this.contract.parseParameters(transactions);
|
|
784
|
+
operations = [this.prepareTezosOperation(parameters, fee)];
|
|
785
|
+
return [3 /*break*/, 4];
|
|
786
|
+
case 2:
|
|
787
|
+
normalizedTransactions = Array.isArray(transactions) ? transactions : [transactions];
|
|
788
|
+
return [4 /*yield*/, this.prepareContractCalls(normalizedTransactions)];
|
|
789
|
+
case 3:
|
|
790
|
+
contractCalls = _a.sent();
|
|
791
|
+
operations = contractCalls.map(function (contractCall) { var _a; return _this.prepareTezosOperation(contractCall.toJSON(), fee, (_a = contractCall.amount) === null || _a === void 0 ? void 0 : _a.toString()); });
|
|
792
|
+
_a.label = 4;
|
|
793
|
+
case 4:
|
|
794
|
+
_a.trys.push([4, 7, , 8]);
|
|
795
|
+
return [4 /*yield*/, this.tezos.prepareOperations(publicKey, operations, overrideFees)];
|
|
796
|
+
case 5:
|
|
797
|
+
tezosWrappedOperation = _a.sent();
|
|
798
|
+
return [4 /*yield*/, this.tezos.forgeOperation(tezosWrappedOperation)];
|
|
799
|
+
case 6:
|
|
800
|
+
binaryTx = _a.sent();
|
|
801
|
+
return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({ binary: binaryTx })];
|
|
802
|
+
case 7:
|
|
803
|
+
error_2 = _a.sent();
|
|
804
|
+
console.error(error_2);
|
|
805
|
+
if (error_2.code !== undefined && error_2.code === errors_1.ProtocolErrorType.TRANSACTION_FAILED) {
|
|
806
|
+
rpcErrors = error_2.data;
|
|
807
|
+
cannotPayStorageFee = rpcErrors.find(function (error) { return error.id.endsWith('.contract.cannot_pay_storage_fee'); });
|
|
808
|
+
if (cannotPayStorageFee) {
|
|
809
|
+
throw new errors_1.BalanceError(coinlib_core_1.Domain.TEZOS, 'Balance too low, cannot pay for storage fee');
|
|
810
|
+
}
|
|
811
|
+
balanceTooLowError = rpcErrors.find(function (error) { return error.id.endsWith('.contract.balance_too_low'); });
|
|
812
|
+
if (balanceTooLowError) {
|
|
813
|
+
throw new errors_1.BalanceError(coinlib_core_1.Domain.TEZOS, 'Balance too low');
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
throw error_2;
|
|
817
|
+
case 8: return [2 /*return*/];
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
};
|
|
822
|
+
TezosSaplingProtocolImpl.prototype.mint = function (recipient, value) {
|
|
823
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
824
|
+
var _a, saplingStateDiff, chainId, output, stateTree, forgedTransaction;
|
|
825
|
+
var _b;
|
|
826
|
+
return __generator(this, function (_c) {
|
|
827
|
+
switch (_c.label) {
|
|
828
|
+
case 0:
|
|
829
|
+
if (this.nodeClient === undefined || this.network.contractAddress === undefined) {
|
|
830
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'Contract address not set.');
|
|
831
|
+
}
|
|
832
|
+
if (!TezosSaplingAddress_1.TezosSaplingAddress.isZetAddress(recipient)) {
|
|
833
|
+
return [2 /*return*/, Promise.reject("Invalid recipient, expected a 'zet' address, got ".concat(recipient))];
|
|
834
|
+
}
|
|
835
|
+
return [4 /*yield*/, Promise.all([
|
|
836
|
+
this.nodeClient.getSaplingStateDiff(),
|
|
837
|
+
this.nodeClient.getChainId()
|
|
838
|
+
])];
|
|
839
|
+
case 1:
|
|
840
|
+
_a = _c.sent(), saplingStateDiff = _a[0], chainId = _a[1];
|
|
841
|
+
_b = {};
|
|
842
|
+
return [4 /*yield*/, TezosSaplingAddress_1.TezosSaplingAddress.fromValue(recipient)];
|
|
843
|
+
case 2:
|
|
844
|
+
output = (_b.address = (_c.sent()).asString(),
|
|
845
|
+
_b.value = value,
|
|
846
|
+
_b.memo = Buffer.alloc(this.memoSize).toString('hex'),
|
|
847
|
+
_b.browsable = true,
|
|
848
|
+
_b);
|
|
849
|
+
return [4 /*yield*/, this.state.getStateTreeFromStateDiff(saplingStateDiff, true)];
|
|
850
|
+
case 3:
|
|
851
|
+
stateTree = _c.sent();
|
|
852
|
+
return [4 /*yield*/, this.forger.forgeSaplingTransaction([], [output], stateTree, this.getAntiReplay(chainId, this.network.contractAddress))];
|
|
853
|
+
case 4:
|
|
854
|
+
forgedTransaction = _c.sent();
|
|
855
|
+
return [2 /*return*/, this.encoder.encodeTransaction(forgedTransaction).toString('hex')];
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
});
|
|
859
|
+
};
|
|
860
|
+
TezosSaplingProtocolImpl.prototype.burn = function (viewingKey, value) {
|
|
861
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
862
|
+
var _a, stateDiff, chainId, hexViewingKey, _b, inputs, toSpend, paybackOutput;
|
|
863
|
+
var _c;
|
|
864
|
+
return __generator(this, function (_d) {
|
|
865
|
+
switch (_d.label) {
|
|
866
|
+
case 0:
|
|
867
|
+
if (this.nodeClient === undefined || this.network.contractAddress === undefined) {
|
|
868
|
+
throw new errors_1.PropertyUndefinedError(coinlib_core_1.Domain.TEZOS, 'Contract address not set.');
|
|
869
|
+
}
|
|
870
|
+
return [4 /*yield*/, Promise.all([
|
|
871
|
+
this.nodeClient.getSaplingStateDiff(),
|
|
872
|
+
this.nodeClient.getChainId()
|
|
873
|
+
])];
|
|
874
|
+
case 1:
|
|
875
|
+
_a = _d.sent(), stateDiff = _a[0], chainId = _a[1];
|
|
876
|
+
hexViewingKey = (0, key_1.convertPublicKey)(viewingKey, 'hex', 'saplingViewingKey');
|
|
877
|
+
return [4 /*yield*/, this.chooseInputs(hexViewingKey.value, stateDiff.commitments_and_ciphertexts, stateDiff.nullifiers, value)];
|
|
878
|
+
case 2:
|
|
879
|
+
_b = _d.sent(), inputs = _b[0], toSpend = _b[1];
|
|
880
|
+
_c = {};
|
|
881
|
+
return [4 /*yield*/, this.getAddressFromPublicKey(viewingKey)];
|
|
882
|
+
case 3:
|
|
883
|
+
paybackOutput = (_c.address = (_d.sent()).address,
|
|
884
|
+
_c.value = toSpend.minus(value).toString(),
|
|
885
|
+
_c.memo = Buffer.alloc(this.memoSize).toString('hex'),
|
|
886
|
+
_c.browsable = true,
|
|
887
|
+
_c);
|
|
888
|
+
return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({
|
|
889
|
+
ins: inputs,
|
|
890
|
+
outs: [paybackOutput],
|
|
891
|
+
contractAddress: this.network.contractAddress,
|
|
892
|
+
chainId: chainId,
|
|
893
|
+
stateDiff: stateDiff,
|
|
894
|
+
unshieldTarget: ''
|
|
895
|
+
})];
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
});
|
|
899
|
+
};
|
|
900
|
+
TezosSaplingProtocolImpl.prototype.chooseInputs = function (viewingKey, commitmentsWithCiphertext, nullifiers, value) {
|
|
901
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
902
|
+
var unspends, balance, chosenUnspends, toSpend, _i, unspends_1, unspend;
|
|
903
|
+
return __generator(this, function (_a) {
|
|
904
|
+
switch (_a.label) {
|
|
905
|
+
case 0: return [4 /*yield*/, this.accountant.getUnspends(viewingKey, commitmentsWithCiphertext, nullifiers)];
|
|
906
|
+
case 1:
|
|
907
|
+
unspends = _a.sent();
|
|
908
|
+
balance = this.accountant.sumNotes(unspends);
|
|
909
|
+
if (balance.lt(value)) {
|
|
910
|
+
return [2 /*return*/, Promise.reject('Not enough balance')];
|
|
911
|
+
}
|
|
912
|
+
chosenUnspends = [];
|
|
913
|
+
toSpend = new bignumber_1.default(0);
|
|
914
|
+
for (_i = 0, unspends_1 = unspends; _i < unspends_1.length; _i++) {
|
|
915
|
+
unspend = unspends_1[_i];
|
|
916
|
+
if (toSpend.gte(value)) {
|
|
917
|
+
break;
|
|
918
|
+
}
|
|
919
|
+
toSpend = toSpend.plus(unspend.value);
|
|
920
|
+
chosenUnspends.push(unspend);
|
|
921
|
+
}
|
|
922
|
+
return [2 /*return*/, [chosenUnspends, toSpend]];
|
|
923
|
+
}
|
|
924
|
+
});
|
|
925
|
+
});
|
|
926
|
+
};
|
|
927
|
+
TezosSaplingProtocolImpl.prototype.createPaymentOutput = function (address, value, memo) {
|
|
928
|
+
if (memo === void 0) { memo = Buffer.alloc(this.memoSize); }
|
|
929
|
+
return {
|
|
930
|
+
address: address.asString(),
|
|
931
|
+
value: new bignumber_1.default(value).toString(),
|
|
932
|
+
memo: memo.toString('hex'),
|
|
933
|
+
browsable: true
|
|
934
|
+
};
|
|
935
|
+
};
|
|
936
|
+
TezosSaplingProtocolImpl.prototype.createPaybackOutput = function (address, toSpend, value, memo) {
|
|
937
|
+
if (memo === void 0) { memo = Buffer.alloc(this.memoSize); }
|
|
938
|
+
var paybackValue = toSpend.minus(value);
|
|
939
|
+
return paybackValue.gt(0)
|
|
940
|
+
? {
|
|
941
|
+
address: address.asString(),
|
|
942
|
+
value: paybackValue.toString(),
|
|
943
|
+
memo: memo.toString('hex'),
|
|
944
|
+
browsable: true
|
|
945
|
+
}
|
|
946
|
+
: undefined;
|
|
947
|
+
};
|
|
948
|
+
TezosSaplingProtocolImpl.prototype.createDummyInput = function (address) {
|
|
949
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
950
|
+
var rcm;
|
|
951
|
+
return __generator(this, function (_a) {
|
|
952
|
+
switch (_a.label) {
|
|
953
|
+
case 0: return [4 /*yield*/, sapling.randR()];
|
|
954
|
+
case 1:
|
|
955
|
+
rcm = _a.sent();
|
|
956
|
+
return [2 /*return*/, {
|
|
957
|
+
rcm: rcm.toString('hex'),
|
|
958
|
+
pos: '0',
|
|
959
|
+
value: '0',
|
|
960
|
+
address: address.asString()
|
|
961
|
+
}];
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
});
|
|
965
|
+
};
|
|
966
|
+
TezosSaplingProtocolImpl.prototype.createDummyOutput = function () {
|
|
967
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
968
|
+
var address, memo;
|
|
969
|
+
return __generator(this, function (_a) {
|
|
970
|
+
switch (_a.label) {
|
|
971
|
+
case 0: return [4 /*yield*/, this.getDummyAddress()];
|
|
972
|
+
case 1:
|
|
973
|
+
address = _a.sent();
|
|
974
|
+
memo = (0, random_1.randomBytes)(this.memoSize);
|
|
975
|
+
return [2 /*return*/, {
|
|
976
|
+
address: address.address,
|
|
977
|
+
value: '0',
|
|
978
|
+
memo: Buffer.from(memo).toString('hex'),
|
|
979
|
+
browsable: false
|
|
980
|
+
}];
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
});
|
|
984
|
+
};
|
|
985
|
+
TezosSaplingProtocolImpl.prototype.getDummyAddress = function () {
|
|
986
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
987
|
+
var seed, xfvk, publicKey;
|
|
988
|
+
return __generator(this, function (_a) {
|
|
989
|
+
switch (_a.label) {
|
|
990
|
+
case 0:
|
|
991
|
+
seed = (0, random_1.randomBytes)(32);
|
|
992
|
+
return [4 /*yield*/, sapling.getExtendedFullViewingKey(seed, this.metadata.account.standardDerivationPath)];
|
|
993
|
+
case 1:
|
|
994
|
+
xfvk = _a.sent();
|
|
995
|
+
publicKey = (0, module_kit_1.newPublicKey)(xfvk.toString('hex'), 'hex');
|
|
996
|
+
return [2 /*return*/, this.getAddressFromPublicKey(publicKey)];
|
|
997
|
+
}
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
};
|
|
1001
|
+
TezosSaplingProtocolImpl.prototype.createAddressBoundData = function (address) {
|
|
1002
|
+
var michelson = MichelsonAddress_1.MichelsonAddress.from((0, pack_1.encodeTzAddress)(address));
|
|
1003
|
+
return (0, pack_1.packMichelsonType)(michelson);
|
|
1004
|
+
};
|
|
1005
|
+
TezosSaplingProtocolImpl.prototype.getAntiReplay = function (chainId, contractAddress) {
|
|
1006
|
+
return contractAddress + chainId;
|
|
1007
|
+
};
|
|
1008
|
+
TezosSaplingProtocolImpl.prototype.prepareTezosOperation = function (parameters, fee, amount) {
|
|
1009
|
+
if (amount === void 0) { amount = '0'; }
|
|
1010
|
+
return {
|
|
1011
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
1012
|
+
fee: fee,
|
|
1013
|
+
amount: amount,
|
|
1014
|
+
destination: this.network.contractAddress,
|
|
1015
|
+
parameters: parameters
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
return TezosSaplingProtocolImpl;
|
|
1019
|
+
}());
|
|
1020
|
+
exports.TezosSaplingProtocolImpl = TezosSaplingProtocolImpl;
|
|
1021
|
+
//# sourceMappingURL=TezosSaplingProtocol.js.map
|