@airgap/tezos 0.13.45-beta.3 → 0.13.45-beta.4
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/package.json +5 -5
- package/v0/actions/GetKtAccountsAction.js +81 -11
- package/v0/actions/GetKtAccountsAction.js.map +1 -1
- package/v0/constants.js +6 -6
- package/v0/constants.js.map +1 -1
- package/v0/index.js +38 -38
- package/v0/index.js.map +1 -1
- package/v0/protocol/TezosAddress.d.ts +1 -0
- package/v0/protocol/TezosAddress.js +81 -41
- package/v0/protocol/TezosAddress.js.map +1 -1
- package/v0/protocol/TezosCryptoClient.d.ts +1 -0
- package/v0/protocol/TezosCryptoClient.js +123 -68
- package/v0/protocol/TezosCryptoClient.js.map +1 -1
- package/v0/protocol/TezosProtocol.js +1631 -978
- package/v0/protocol/TezosProtocol.js.map +1 -1
- package/v0/protocol/TezosProtocolOptions.d.ts +1 -1
- package/v0/protocol/TezosProtocolOptions.js +98 -26
- package/v0/protocol/TezosProtocolOptions.js.map +1 -1
- package/v0/protocol/TezosUtils.d.ts +1 -0
- package/v0/protocol/TezosUtils.js +165 -131
- package/v0/protocol/TezosUtils.js.map +1 -1
- package/v0/protocol/contract/TezosContract.js +472 -243
- package/v0/protocol/contract/TezosContract.js.map +1 -1
- package/v0/protocol/contract/TezosContractCall.js +10 -8
- package/v0/protocol/contract/TezosContractCall.js.map +1 -1
- package/v0/protocol/contract/TezosContractEntrypoint.js +19 -14
- package/v0/protocol/contract/TezosContractEntrypoint.js.map +1 -1
- package/v0/protocol/contract/TezosContractStorage.js +9 -8
- package/v0/protocol/contract/TezosContractStorage.js.map +1 -1
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +25 -8
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -1
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js +113 -39
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js.map +1 -1
- package/v0/protocol/domains/TezosDomains.js +270 -165
- package/v0/protocol/domains/TezosDomains.js.map +1 -1
- package/v0/protocol/fa/TezosBTC.js +98 -19
- package/v0/protocol/fa/TezosBTC.js.map +1 -1
- package/v0/protocol/fa/TezosBTCtez.js +48 -17
- package/v0/protocol/fa/TezosBTCtez.js.map +1 -1
- package/v0/protocol/fa/TezosCTez.js +45 -17
- package/v0/protocol/fa/TezosCTez.js.map +1 -1
- package/v0/protocol/fa/TezosDOGA.js +45 -17
- package/v0/protocol/fa/TezosDOGA.js.map +1 -1
- package/v0/protocol/fa/TezosETHtz.js +68 -10
- package/v0/protocol/fa/TezosETHtz.js.map +1 -1
- package/v0/protocol/fa/TezosFA1Protocol.js +276 -119
- package/v0/protocol/fa/TezosFA1Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFA1p2Protocol.js +101 -22
- package/v0/protocol/fa/TezosFA1p2Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFA2Protocol.js +402 -213
- package/v0/protocol/fa/TezosFA2Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFAProtocol.js +418 -211
- package/v0/protocol/fa/TezosFAProtocol.js.map +1 -1
- package/v0/protocol/fa/TezosFAProtocolOptions.d.ts +2 -2
- package/v0/protocol/fa/TezosFAProtocolOptions.js +195 -92
- package/v0/protocol/fa/TezosFAProtocolOptions.js.map +1 -1
- package/v0/protocol/fa/TezosKolibriUSD.js +70 -11
- package/v0/protocol/fa/TezosKolibriUSD.js.map +1 -1
- package/v0/protocol/fa/TezosPlanty.js +45 -17
- package/v0/protocol/fa/TezosPlanty.js.map +1 -1
- package/v0/protocol/fa/TezosQUIPU.js +48 -17
- package/v0/protocol/fa/TezosQUIPU.js.map +1 -1
- package/v0/protocol/fa/TezosSIRS.js +45 -17
- package/v0/protocol/fa/TezosSIRS.js.map +1 -1
- package/v0/protocol/fa/TezosStaker.js +70 -11
- package/v0/protocol/fa/TezosStaker.js.map +1 -1
- package/v0/protocol/fa/TezosUBTC.js +48 -17
- package/v0/protocol/fa/TezosUBTC.js.map +1 -1
- package/v0/protocol/fa/TezosUDEFI.js +48 -17
- package/v0/protocol/fa/TezosUDEFI.js.map +1 -1
- package/v0/protocol/fa/TezosUSD.js +70 -11
- package/v0/protocol/fa/TezosUSD.js.map +1 -1
- package/v0/protocol/fa/TezosUSDT.js +48 -17
- package/v0/protocol/fa/TezosUSDT.js.map +1 -1
- package/v0/protocol/fa/TezosUUSD.js +27 -8
- package/v0/protocol/fa/TezosUUSD.js.map +1 -1
- package/v0/protocol/fa/TezosUXTZ.js +48 -17
- package/v0/protocol/fa/TezosUXTZ.js.map +1 -1
- package/v0/protocol/fa/TezosWRAP.js +48 -17
- package/v0/protocol/fa/TezosWRAP.js.map +1 -1
- package/v0/protocol/fa/TezosWrapped.js +70 -11
- package/v0/protocol/fa/TezosWrapped.js.map +1 -1
- package/v0/protocol/fa/TezosYOU.js +27 -8
- package/v0/protocol/fa/TezosYOU.js.map +1 -1
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js +162 -84
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js.map +1 -1
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js +87 -37
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js.map +1 -1
- package/v0/protocol/indexerClient/TezosIndexerClient.js +259 -115
- package/v0/protocol/indexerClient/TezosIndexerClient.js.map +1 -1
- package/v0/protocol/kt/TezosKtAddress.js +67 -7
- package/v0/protocol/kt/TezosKtAddress.js.map +1 -1
- package/v0/protocol/kt/TezosKtProtocol.js +309 -161
- package/v0/protocol/kt/TezosKtProtocol.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingAddress.d.ts +1 -0
- package/v0/protocol/sapling/TezosSaplingAddress.js +117 -46
- package/v0/protocol/sapling/TezosSaplingAddress.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingCryptoClient.d.ts +1 -0
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js +220 -125
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingProtocol.d.ts +1 -0
- package/v0/protocol/sapling/TezosSaplingProtocol.js +1127 -600
- package/v0/protocol/sapling/TezosSaplingProtocol.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.d.ts +1 -0
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js +61 -32
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js.map +1 -1
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js +134 -50
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -1
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js +56 -10
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js.map +1 -1
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js +67 -12
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.d.ts +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js +539 -221
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.d.ts +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js +104 -101
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingForger.d.ts +1 -0
- package/v0/protocol/sapling/utils/TezosSaplingForger.js +266 -107
- package/v0/protocol/sapling/utils/TezosSaplingForger.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingState.js +239 -110
- package/v0/protocol/sapling/utils/TezosSaplingState.js.map +1 -1
- package/v0/protocol/types/TezosOperationType.js +1 -1
- package/v0/protocol/types/TezosOperationType.js.map +1 -1
- package/v0/protocol/types/contract/BigMapEntry.d.ts +1 -1
- package/v0/protocol/types/contract/TezosContractMetadata.d.ts +2 -2
- package/v0/protocol/types/micheline/MichelineNode.d.ts +7 -7
- package/v0/protocol/types/micheline/MichelineNodeUtils.js +13 -9
- package/v0/protocol/types/micheline/MichelineNodeUtils.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonType.d.ts +1 -0
- package/v0/protocol/types/michelson/MichelsonType.js +12 -11
- package/v0/protocol/types/michelson/MichelsonType.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js +92 -45
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonTypeUtils.d.ts +1 -0
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js +219 -58
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonList.js +43 -24
- package/v0/protocol/types/michelson/generics/MichelsonList.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonMap.js +61 -39
- package/v0/protocol/types/michelson/generics/MichelsonMap.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonOption.d.ts +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonOption.js +75 -46
- package/v0/protocol/types/michelson/generics/MichelsonOption.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonOr.d.ts +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonOr.js +76 -50
- package/v0/protocol/types/michelson/generics/MichelsonOr.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonPair.js +85 -52
- package/v0/protocol/types/michelson/generics/MichelsonPair.js.map +1 -1
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarData.d.ts +1 -1
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -1
- package/v0/protocol/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.d.ts +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js +47 -28
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js +39 -20
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.d.ts +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js +54 -35
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonInt.d.ts +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js +49 -30
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonString.d.ts +1 -0
- package/v0/protocol/types/michelson/primitives/MichelsonString.js +52 -33
- package/v0/protocol/types/michelson/primitives/MichelsonString.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.js +34 -14
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.js.map +1 -1
- package/v0/protocol/types/sapling/TezosSaplingStateTree.d.ts +1 -1
- package/v0/protocol/types/sapling/TezosSaplingTransaction.d.ts +1 -0
- package/v0/protocol/types/utils.js +10 -8
- package/v0/protocol/types/utils.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +78 -29
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/transaction-xtz-btc-validator.js +129 -55
- package/v0/serializer/validators/transaction-xtz-btc-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +103 -43
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/TzKTBlockExplorer.js +61 -12
- package/v1/block-explorer/TzKTBlockExplorer.js.map +1 -1
- package/v1/block-explorer/factory.js +5 -4
- package/v1/block-explorer/factory.js.map +1 -1
- package/v1/contract/TezosContract.js +471 -242
- package/v1/contract/TezosContract.js.map +1 -1
- package/v1/contract/TezosContractCall.js +10 -8
- package/v1/contract/TezosContractCall.js.map +1 -1
- package/v1/contract/TezosContractEntrypoint.d.ts +1 -1
- package/v1/contract/TezosContractEntrypoint.js +19 -14
- package/v1/contract/TezosContractEntrypoint.js.map +1 -1
- package/v1/contract/TezosContractStorage.js +9 -8
- package/v1/contract/TezosContractStorage.js.map +1 -1
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js +25 -8
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -1
- package/v1/contract/remote-data/TezosStorageRemoteData.js +113 -39
- package/v1/contract/remote-data/TezosStorageRemoteData.js.map +1 -1
- package/v1/crypto/TezosCryptoClient.d.ts +1 -0
- package/v1/crypto/TezosCryptoClient.js +117 -64
- package/v1/crypto/TezosCryptoClient.js.map +1 -1
- package/v1/crypto/TezosSaplingCryptoClient.d.ts +1 -0
- package/v1/crypto/TezosSaplingCryptoClient.js +194 -116
- package/v1/crypto/TezosSaplingCryptoClient.js.map +1 -1
- package/v1/data/TezosAddress.js +14 -13
- package/v1/data/TezosAddress.js.map +1 -1
- package/v1/data/TezosSaplingAddress.d.ts +1 -0
- package/v1/data/TezosSaplingAddress.js +94 -29
- package/v1/data/TezosSaplingAddress.js.map +1 -1
- package/v1/domains/TezosDomains.js +270 -165
- package/v1/domains/TezosDomains.js.map +1 -1
- package/v1/index.js +39 -39
- package/v1/index.js.map +1 -1
- package/v1/indexer/TzKTIndexerClient.js +270 -126
- package/v1/indexer/TzKTIndexerClient.js.map +1 -1
- package/v1/indexer/factory.js +5 -4
- package/v1/indexer/factory.js.map +1 -1
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js +161 -83
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js.map +1 -1
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js +85 -36
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js.map +1 -1
- package/v1/injector/TezosSaplingInjectorClient.js +56 -10
- package/v1/injector/TezosSaplingInjectorClient.js.map +1 -1
- package/v1/module/TezosModule.js +155 -88
- package/v1/module/TezosModule.js.map +1 -1
- package/v1/module.js +3 -2
- package/v1/module.js.map +1 -1
- package/v1/node/TezosSaplingNodeClient.js +67 -12
- package/v1/node/TezosSaplingNodeClient.js.map +1 -1
- package/v1/protocol/TezosProtocol.js +1385 -848
- package/v1/protocol/TezosProtocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1Protocol.js +205 -81
- package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1p2Protocol.js +111 -32
- package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA2Protocol.js +332 -174
- package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFAProtocol.js +528 -255
- package/v1/protocol/fa/TezosFAProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/BTCTezProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/BTCTezProtocol.js +47 -30
- package/v1/protocol/fa/tokens/BTCTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/CTezProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/CTezProtocol.js +47 -27
- package/v1/protocol/fa/tokens/CTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/DogamiProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/DogamiProtocol.js +47 -27
- package/v1/protocol/fa/tokens/DogamiProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/ETHTezProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/ETHTezProtocol.js +90 -30
- package/v1/protocol/fa/tokens/ETHTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js +90 -30
- package/v1/protocol/fa/tokens/KolibriUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/PlentyProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/PlentyProtocol.js +90 -30
- package/v1/protocol/fa/tokens/PlentyProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/QuipuswapProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js +47 -30
- package/v1/protocol/fa/tokens/QuipuswapProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/SiriusProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/SiriusProtocol.js +47 -27
- package/v1/protocol/fa/tokens/SiriusProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/StakerProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/StakerProtocol.js +90 -30
- package/v1/protocol/fa/tokens/StakerProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/TetherUSDProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js +47 -30
- package/v1/protocol/fa/tokens/TetherUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/TzBTCProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/TzBTCProtocol.js +47 -27
- package/v1/protocol/fa/tokens/TzBTCProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UBTCProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/UBTCProtocol.js +47 -30
- package/v1/protocol/fa/tokens/UBTCProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UDEFIProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/UDEFIProtocol.js +47 -30
- package/v1/protocol/fa/tokens/UDEFIProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/USDTezProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/USDTezProtocol.js +47 -27
- package/v1/protocol/fa/tokens/USDTezProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UUSDProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/UUSDProtocol.js +47 -30
- package/v1/protocol/fa/tokens/UUSDProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/UXTZProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/UXTZProtocol.js +47 -30
- package/v1/protocol/fa/tokens/UXTZProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/WrapProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/WrapProtocol.js +47 -30
- package/v1/protocol/fa/tokens/WrapProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js +47 -27
- package/v1/protocol/fa/tokens/WrappedTezosProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/YouProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/YouProtocol.js +47 -30
- package/v1/protocol/fa/tokens/YouProtocol.js.map +1 -1
- package/v1/protocol/fa/tokens/stXTZProtocol.d.ts +2 -2
- package/v1/protocol/fa/tokens/stXTZProtocol.js +47 -30
- package/v1/protocol/fa/tokens/stXTZProtocol.js.map +1 -1
- package/v1/protocol/kt/TezosKtProtocol.js +498 -254
- package/v1/protocol/kt/TezosKtProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +1 -0
- package/v1/protocol/sapling/TezosSaplingProtocol.js +933 -532
- package/v1/protocol/sapling/TezosSaplingProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js +164 -72
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +26 -14
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +188 -103
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +143 -54
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +100 -40
- package/v1/serializer/v3/validators/validators.js.map +1 -1
- package/v1/types/block-explorer.d.ts +1 -1
- package/v1/types/contract/TezosContractMetadata.d.ts +2 -2
- package/v1/types/contract/bigmap/BigMapEntry.d.ts +1 -1
- package/v1/types/crypto.d.ts +2 -2
- package/v1/types/fa/TezosFA1ContractEntrypoint.d.ts +1 -1
- package/v1/types/fa/TezosFA1p2ContractEntrypoint.d.ts +1 -1
- package/v1/types/fa/TezosFA2ContractEntrypoint.d.ts +1 -1
- package/v1/types/indexer.d.ts +1 -1
- package/v1/types/micheline/MichelineNode.d.ts +7 -7
- package/v1/types/micheline/MichelineNodeUtils.js +13 -9
- package/v1/types/micheline/MichelineNodeUtils.js.map +1 -1
- package/v1/types/michelson/MichelsonType.d.ts +1 -0
- package/v1/types/michelson/MichelsonType.js +12 -11
- package/v1/types/michelson/MichelsonType.js.map +1 -1
- package/v1/types/michelson/MichelsonTypeMeta.js +92 -45
- package/v1/types/michelson/MichelsonTypeMeta.js.map +1 -1
- package/v1/types/michelson/MichelsonTypeUtils.d.ts +1 -0
- package/v1/types/michelson/MichelsonTypeUtils.js +219 -58
- package/v1/types/michelson/MichelsonTypeUtils.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonList.js +43 -24
- package/v1/types/michelson/generics/MichelsonList.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonMap.js +61 -39
- package/v1/types/michelson/generics/MichelsonMap.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonOption.d.ts +1 -1
- package/v1/types/michelson/generics/MichelsonOption.js +75 -46
- package/v1/types/michelson/generics/MichelsonOption.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonOr.d.ts +1 -1
- package/v1/types/michelson/generics/MichelsonOr.js +76 -50
- package/v1/types/michelson/generics/MichelsonOr.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonPair.js +85 -52
- package/v1/types/michelson/generics/MichelsonPair.js.map +1 -1
- package/v1/types/michelson/grammar/MichelsonGrammarData.d.ts +1 -1
- package/v1/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -1
- package/v1/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -1
- package/v1/types/michelson/primitives/MichelsonAddress.d.ts +1 -0
- package/v1/types/michelson/primitives/MichelsonAddress.js +47 -28
- package/v1/types/michelson/primitives/MichelsonAddress.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonBool.js +39 -20
- package/v1/types/michelson/primitives/MichelsonBool.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonBytes.d.ts +1 -0
- package/v1/types/michelson/primitives/MichelsonBytes.js +54 -35
- package/v1/types/michelson/primitives/MichelsonBytes.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonInt.d.ts +1 -0
- package/v1/types/michelson/primitives/MichelsonInt.js +49 -30
- package/v1/types/michelson/primitives/MichelsonInt.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonString.d.ts +1 -0
- package/v1/types/michelson/primitives/MichelsonString.js +52 -33
- package/v1/types/michelson/primitives/MichelsonString.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonUnit.js +34 -14
- package/v1/types/michelson/primitives/MichelsonUnit.js.map +1 -1
- package/v1/types/network.js +1 -1
- package/v1/types/network.js.map +1 -1
- package/v1/types/operations/TezosOperationType.js +1 -1
- package/v1/types/operations/TezosOperationType.js.map +1 -1
- package/v1/types/protocol.d.ts +3 -3
- package/v1/types/sapling/TezosSaplingExternalMethodProvider.d.ts +1 -0
- package/v1/types/sapling/TezosSaplingStateTree.d.ts +1 -1
- package/v1/types/sapling/TezosSaplingTransaction.d.ts +1 -0
- package/v1/types/staking/TezosDelegatorAction.js +1 -1
- package/v1/types/staking/TezosDelegatorAction.js.map +1 -1
- package/v1/utils/address.js +7 -6
- package/v1/utils/address.js.map +1 -1
- package/v1/utils/bip.d.ts +1 -0
- package/v1/utils/bip.js +7 -6
- package/v1/utils/bip.js.map +1 -1
- package/v1/utils/convert.js +8 -7
- package/v1/utils/convert.js.map +1 -1
- package/v1/utils/encoding.d.ts +1 -0
- package/v1/utils/encoding.js +64 -74
- package/v1/utils/encoding.js.map +1 -1
- package/v1/utils/fa.js +3 -2
- package/v1/utils/fa.js.map +1 -1
- package/v1/utils/key.js +12 -9
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/micheline.js +10 -8
- package/v1/utils/micheline.js.map +1 -1
- package/v1/utils/operations.js +22 -21
- package/v1/utils/operations.js.map +1 -1
- package/v1/utils/pack.d.ts +1 -0
- package/v1/utils/pack.js +107 -65
- package/v1/utils/pack.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFA1Accountant.js +52 -24
- package/v1/utils/protocol/fa/TezosFA1Accountant.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFA2Accountant.js +77 -40
- package/v1/utils/protocol/fa/TezosFA2Accountant.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFAAccountant.js +89 -21
- package/v1/utils/protocol/fa/TezosFAAccountant.js.map +1 -1
- package/v1/utils/protocol/instance.js +26 -90
- package/v1/utils/protocol/instance.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.d.ts +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js +539 -221
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.d.ts +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js +104 -101
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingForger.d.ts +1 -0
- package/v1/utils/protocol/sapling/TezosSaplingForger.js +266 -107
- package/v1/utils/protocol/sapling/TezosSaplingForger.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingState.js +239 -110
- package/v1/utils/protocol/sapling/TezosSaplingState.js.map +1 -1
- package/v1/utils/protocol/tezos/TezosAccountant.js +166 -97
- package/v1/utils/protocol/tezos/TezosAccountant.js.map +1 -1
- package/v1/utils/protocol/tezos/TezosForger.js +76 -21
- package/v1/utils/protocol/tezos/TezosForger.js.map +1 -1
- package/v1/utils/signature.js +6 -5
- package/v1/utils/signature.js.map +1 -1
- package/v1/utils/transaction.d.ts +5 -4
- package/v1/utils/transaction.js +3 -3
- package/v1/utils/transaction.js.map +1 -1
|
@@ -1,25 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
2
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
51
|
};
|
|
5
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TEZOS_FA_MAINNET_PROTOCOL_NETWORK = exports.TezosFAProtocolImpl = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const TezosProtocol_1 = require("../TezosProtocol");
|
|
53
|
+
exports.createTezosFAProtocolOptions = exports.TEZOS_FA_MAINNET_PROTOCOL_NETWORK = exports.TezosFAProtocolImpl = void 0;
|
|
54
|
+
var coinlib_core_1 = require("@airgap/coinlib-core");
|
|
55
|
+
var axios_0_19_0_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0"));
|
|
56
|
+
var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
57
|
+
var errors_1 = require("@airgap/coinlib-core/errors");
|
|
58
|
+
var module_kit_1 = require("@airgap/module-kit");
|
|
59
|
+
var TezosContract_1 = require("../../contract/TezosContract");
|
|
60
|
+
var factory_1 = require("../../indexer/factory");
|
|
61
|
+
var BigMapTokenMetadataIndexerClient_1 = require("../../indexer/token-metadata/BigMapTokenMetadataIndexerClient");
|
|
62
|
+
var ObjktTokenMetadataIndexerClient_1 = require("../../indexer/token-metadata/ObjktTokenMetadataIndexerClient");
|
|
63
|
+
var TezosOperationType_1 = require("../../types/operations/TezosOperationType");
|
|
64
|
+
var micheline_1 = require("../../utils/micheline");
|
|
65
|
+
var TezosProtocol_1 = require("../TezosProtocol");
|
|
20
66
|
// Implementation
|
|
21
|
-
|
|
22
|
-
|
|
67
|
+
var TezosFAProtocolImpl = /** @class */ (function () {
|
|
68
|
+
function TezosFAProtocolImpl(options, accountant) {
|
|
23
69
|
this.isTezosFAProtocol = true;
|
|
24
70
|
this.options = options;
|
|
25
71
|
this.tezos = new TezosProtocol_1.TezosProtocolImpl({ network: options.network });
|
|
@@ -42,251 +88,481 @@ class TezosFAProtocolImpl {
|
|
|
42
88
|
};
|
|
43
89
|
}
|
|
44
90
|
// SubProtocol
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return this
|
|
68
|
-
|
|
91
|
+
TezosFAProtocolImpl.prototype.getType = function () {
|
|
92
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
return [2 /*return*/, 'token'];
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
TezosFAProtocolImpl.prototype.mainProtocol = function () {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
return [2 /*return*/, coinlib_core_1.MainProtocolSymbols.XTZ];
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
TezosFAProtocolImpl.prototype.getContractAddress = function () {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
return [2 /*return*/, this.options.network.contractAddress];
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
TezosFAProtocolImpl.prototype.getMetadata = function () {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
return [2 /*return*/, this.metadata];
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
TezosFAProtocolImpl.prototype.getAddressFromPublicKey = function (publicKey) {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
return [2 /*return*/, this.tezos.getAddressFromPublicKey(publicKey)];
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
TezosFAProtocolImpl.prototype.getDetailsFromTransaction = function (transaction, publicKey) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
return __generator(this, function (_a) {
|
|
129
|
+
return [2 /*return*/, this.accountant.getDetailsFromTransaction(transaction)];
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
TezosFAProtocolImpl.prototype.verifyMessageWithPublicKey = function (message, signature, publicKey) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
+
return __generator(this, function (_a) {
|
|
136
|
+
return [2 /*return*/, this.tezos.verifyMessageWithPublicKey(message, signature, publicKey)];
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
TezosFAProtocolImpl.prototype.encryptAsymmetricWithPublicKey = function (payload, publicKey) {
|
|
141
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
return [2 /*return*/, this.tezos.encryptAsymmetricWithPublicKey(payload, publicKey)];
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
};
|
|
69
147
|
// Offline
|
|
70
|
-
|
|
71
|
-
return this
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
148
|
+
TezosFAProtocolImpl.prototype.getCryptoConfiguration = function () {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
150
|
+
return __generator(this, function (_a) {
|
|
151
|
+
return [2 /*return*/, this.tezos.getCryptoConfiguration()];
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
TezosFAProtocolImpl.prototype.getKeyPairFromDerivative = function (derivative) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
return [2 /*return*/, this.tezos.getKeyPairFromDerivative(derivative)];
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
TezosFAProtocolImpl.prototype.signTransactionWithSecretKey = function (transaction, secretKey) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
164
|
+
return __generator(this, function (_a) {
|
|
165
|
+
return [2 /*return*/, this.tezos.signTransactionWithSecretKey(transaction, secretKey)];
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
TezosFAProtocolImpl.prototype.signMessageWithKeyPair = function (message, keyPair) {
|
|
170
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
171
|
+
return __generator(this, function (_a) {
|
|
172
|
+
return [2 /*return*/, this.tezos.signMessageWithKeyPair(message, keyPair)];
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
};
|
|
176
|
+
TezosFAProtocolImpl.prototype.decryptAsymmetricWithKeyPair = function (payload, keyPair) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
178
|
+
return __generator(this, function (_a) {
|
|
179
|
+
return [2 /*return*/, this.tezos.decryptAsymmetricWithKeyPair(payload, keyPair)];
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
};
|
|
183
|
+
TezosFAProtocolImpl.prototype.encryptAESWithSecretKey = function (payload, secretKey) {
|
|
184
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
+
return __generator(this, function (_a) {
|
|
186
|
+
return [2 /*return*/, this.tezos.encryptAESWithSecretKey(payload, secretKey)];
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
TezosFAProtocolImpl.prototype.decryptAESWithSecretKey = function (payload, secretKey) {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
192
|
+
return __generator(this, function (_a) {
|
|
193
|
+
return [2 /*return*/, this.tezos.decryptAESWithSecretKey(payload, secretKey)];
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
};
|
|
91
197
|
// Online
|
|
92
|
-
|
|
93
|
-
return this
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
return this.getTransactionsForAddress(address, limit, cursor);
|
|
98
|
-
}
|
|
99
|
-
async getTransactionsForAddress(address, limit, cursor) {
|
|
100
|
-
const transactions = await this.indexer.getTokenTransactionsForAddress({ contractAddress: this.contract.address, id: 0 }, address, limit, cursor?.offset);
|
|
101
|
-
return {
|
|
102
|
-
transactions: transactions.map((transaction) => ({
|
|
103
|
-
...transaction,
|
|
104
|
-
network: this.options.network
|
|
105
|
-
})),
|
|
106
|
-
cursor: {
|
|
107
|
-
hasNext: transactions.length >= limit,
|
|
108
|
-
offset: (cursor?.offset ?? 0) + transactions.length
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
async getBalanceOfPublicKey(publicKey) {
|
|
113
|
-
const address = await this.getAddressFromPublicKey(publicKey);
|
|
114
|
-
return this.getBalanceOfAddress(address);
|
|
115
|
-
}
|
|
116
|
-
async getTransactionMaxAmountWithPublicKey(publicKey, _to, _configuration) {
|
|
117
|
-
const balance = await this.getBalanceOfPublicKey(publicKey);
|
|
118
|
-
return balance.transferable ?? balance.total;
|
|
119
|
-
}
|
|
120
|
-
async getTransactionFeeWithPublicKey(publicKey, details, configuration) {
|
|
121
|
-
const transferCalls = await this.createTransferCalls(publicKey, details, configuration);
|
|
122
|
-
const operations = transferCalls.map((transferCall) => {
|
|
123
|
-
return {
|
|
124
|
-
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
125
|
-
amount: '0',
|
|
126
|
-
destination: this.options.network.contractAddress,
|
|
127
|
-
parameters: transferCall.toJSON(),
|
|
128
|
-
fee: '0'
|
|
129
|
-
};
|
|
198
|
+
TezosFAProtocolImpl.prototype.getNetwork = function () {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
200
|
+
return __generator(this, function (_a) {
|
|
201
|
+
return [2 /*return*/, this.options.network];
|
|
202
|
+
});
|
|
130
203
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
204
|
+
};
|
|
205
|
+
TezosFAProtocolImpl.prototype.getTransactionsForPublicKey = function (publicKey, limit, cursor) {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
var address;
|
|
208
|
+
return __generator(this, function (_a) {
|
|
209
|
+
switch (_a.label) {
|
|
210
|
+
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
211
|
+
case 1:
|
|
212
|
+
address = _a.sent();
|
|
213
|
+
return [2 /*return*/, this.getTransactionsForAddress(address, limit, cursor)];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
TezosFAProtocolImpl.prototype.getTransactionsForAddress = function (address, limit, cursor) {
|
|
219
|
+
var _a;
|
|
220
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
221
|
+
var transactions;
|
|
222
|
+
var _this = this;
|
|
223
|
+
return __generator(this, function (_b) {
|
|
224
|
+
switch (_b.label) {
|
|
225
|
+
case 0: return [4 /*yield*/, this.indexer.getTokenTransactionsForAddress({ contractAddress: this.contract.address, id: 0 }, address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
|
|
226
|
+
case 1:
|
|
227
|
+
transactions = _b.sent();
|
|
228
|
+
return [2 /*return*/, {
|
|
229
|
+
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { network: _this.options.network })); }),
|
|
230
|
+
cursor: {
|
|
231
|
+
hasNext: transactions.length >= limit,
|
|
232
|
+
offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + transactions.length
|
|
233
|
+
}
|
|
234
|
+
}];
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
};
|
|
239
|
+
TezosFAProtocolImpl.prototype.getBalanceOfPublicKey = function (publicKey) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
241
|
+
var address;
|
|
242
|
+
return __generator(this, function (_a) {
|
|
243
|
+
switch (_a.label) {
|
|
244
|
+
case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
|
|
245
|
+
case 1:
|
|
246
|
+
address = _a.sent();
|
|
247
|
+
return [2 /*return*/, this.getBalanceOfAddress(address)];
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
TezosFAProtocolImpl.prototype.getTransactionMaxAmountWithPublicKey = function (publicKey, _to, _configuration) {
|
|
253
|
+
var _a;
|
|
254
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
255
|
+
var balance;
|
|
256
|
+
return __generator(this, function (_b) {
|
|
257
|
+
switch (_b.label) {
|
|
258
|
+
case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
|
|
259
|
+
case 1:
|
|
260
|
+
balance = _b.sent();
|
|
261
|
+
return [2 /*return*/, (_a = balance.transferable) !== null && _a !== void 0 ? _a : balance.total];
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
TezosFAProtocolImpl.prototype.getTransactionFeeWithPublicKey = function (publicKey, details, configuration) {
|
|
267
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
268
|
+
var transferCalls, operations;
|
|
269
|
+
var _this = this;
|
|
270
|
+
return __generator(this, function (_a) {
|
|
271
|
+
switch (_a.label) {
|
|
272
|
+
case 0: return [4 /*yield*/, this.createTransferCalls(publicKey, details, configuration)];
|
|
273
|
+
case 1:
|
|
274
|
+
transferCalls = _a.sent();
|
|
275
|
+
operations = transferCalls.map(function (transferCall) {
|
|
276
|
+
return {
|
|
277
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
278
|
+
amount: '0',
|
|
279
|
+
destination: _this.options.network.contractAddress,
|
|
280
|
+
parameters: transferCall.toJSON(),
|
|
281
|
+
fee: '0'
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
return [2 /*return*/, this.tezos.getOperationFeeDefaults(publicKey, operations)];
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
};
|
|
289
|
+
TezosFAProtocolImpl.prototype.prepareTransactionWithPublicKey = function (publicKey, details, configuration) {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
291
|
+
var fee, estimatedFee, transferCalls;
|
|
292
|
+
return __generator(this, function (_a) {
|
|
293
|
+
switch (_a.label) {
|
|
294
|
+
case 0:
|
|
295
|
+
if (!((configuration === null || configuration === void 0 ? void 0 : configuration.fee) !== undefined)) return [3 /*break*/, 1];
|
|
296
|
+
fee = configuration.fee;
|
|
297
|
+
return [3 /*break*/, 3];
|
|
298
|
+
case 1: return [4 /*yield*/, this.getTransactionFeeWithPublicKey(publicKey, details)];
|
|
299
|
+
case 2:
|
|
300
|
+
estimatedFee = _a.sent();
|
|
301
|
+
fee = estimatedFee.medium;
|
|
302
|
+
_a.label = 3;
|
|
303
|
+
case 3: return [4 /*yield*/, this.createTransferCalls(publicKey, details, configuration)];
|
|
304
|
+
case 4:
|
|
305
|
+
transferCalls = _a.sent();
|
|
306
|
+
return [2 /*return*/, this.prepareContractCall(transferCalls, fee, publicKey)];
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
};
|
|
311
|
+
TezosFAProtocolImpl.prototype.broadcastTransaction = function (transaction) {
|
|
312
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
313
|
+
return __generator(this, function (_a) {
|
|
314
|
+
return [2 /*return*/, this.tezos.broadcastTransaction(transaction)];
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
};
|
|
148
318
|
// Custom
|
|
149
|
-
|
|
150
|
-
return this
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
319
|
+
TezosFAProtocolImpl.prototype.contractMetadata = function (networkResolver) {
|
|
320
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
321
|
+
return __generator(this, function (_a) {
|
|
322
|
+
return [2 /*return*/, this.contract.metadata(networkResolver)];
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
};
|
|
326
|
+
TezosFAProtocolImpl.prototype.getAllTokenMetadata = function () {
|
|
327
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
328
|
+
var objktMetadata, missingTokenIDs, bigMapMetadata, _a;
|
|
329
|
+
return __generator(this, function (_b) {
|
|
330
|
+
switch (_b.label) {
|
|
331
|
+
case 0: return [4 /*yield*/, this.objktTokenMetadataIndexerClient.getTokenMetadata()];
|
|
332
|
+
case 1:
|
|
333
|
+
objktMetadata = _b.sent();
|
|
334
|
+
missingTokenIDs = objktMetadata !== undefined
|
|
335
|
+
? new Set(Object.entries(objktMetadata)
|
|
336
|
+
.filter(function (_a) {
|
|
337
|
+
var _ = _a[0], metadata = _a[1];
|
|
338
|
+
return !metadata.symbol && !metadata.name && !metadata.decimals;
|
|
339
|
+
})
|
|
340
|
+
.map(function (_a) {
|
|
341
|
+
var tokenID = _a[0], _ = _a[1];
|
|
342
|
+
return parseInt(tokenID, 10);
|
|
343
|
+
}))
|
|
344
|
+
: undefined;
|
|
345
|
+
if (!(missingTokenIDs === undefined || missingTokenIDs.size > 0)) return [3 /*break*/, 3];
|
|
346
|
+
return [4 /*yield*/, this.bigMapTokenMetadataIndexerClient.getTokenMetadata(missingTokenIDs ? Array.from(missingTokenIDs) : undefined)];
|
|
347
|
+
case 2:
|
|
348
|
+
_a = _b.sent();
|
|
349
|
+
return [3 /*break*/, 4];
|
|
350
|
+
case 3:
|
|
351
|
+
_a = undefined;
|
|
352
|
+
_b.label = 4;
|
|
353
|
+
case 4:
|
|
354
|
+
bigMapMetadata = _a;
|
|
355
|
+
if (objktMetadata === undefined && bigMapMetadata === undefined) {
|
|
356
|
+
return [2 /*return*/, undefined];
|
|
357
|
+
}
|
|
358
|
+
return [2 /*return*/, Object.entries(objktMetadata !== null && objktMetadata !== void 0 ? objktMetadata : {})
|
|
359
|
+
.filter(function (_a) {
|
|
360
|
+
var _b;
|
|
361
|
+
var tokenID = _a[0], _ = _a[1];
|
|
362
|
+
return !((_b = missingTokenIDs === null || missingTokenIDs === void 0 ? void 0 : missingTokenIDs.has(parseInt(tokenID, 10))) !== null && _b !== void 0 ? _b : false);
|
|
363
|
+
})
|
|
364
|
+
.concat(Object.entries(bigMapMetadata !== null && bigMapMetadata !== void 0 ? bigMapMetadata : {}))
|
|
365
|
+
.reduce(function (obj, _a) {
|
|
366
|
+
var _b;
|
|
367
|
+
var _c, _d, _e;
|
|
368
|
+
var tokenID = _a[0], metadata = _a[1];
|
|
369
|
+
return Object.assign(obj, (_b = {},
|
|
370
|
+
_b[parseInt(tokenID, 10)] = {
|
|
371
|
+
symbol: (_c = metadata.symbol) !== null && _c !== void 0 ? _c : '',
|
|
372
|
+
name: (_d = metadata.name) !== null && _d !== void 0 ? _d : '',
|
|
373
|
+
decimals: (_e = metadata.decimals) !== null && _e !== void 0 ? _e : 0
|
|
374
|
+
},
|
|
375
|
+
_b));
|
|
376
|
+
}, {})];
|
|
174
377
|
}
|
|
175
378
|
});
|
|
176
|
-
}, {});
|
|
177
|
-
}
|
|
178
|
-
async getTokenMetadataForTokenId(tokenId) {
|
|
179
|
-
const tokenMetadata = await this.getAllTokenMetadata();
|
|
180
|
-
return tokenMetadata ? tokenMetadata[tokenId] : undefined;
|
|
181
|
-
}
|
|
182
|
-
async bigMapValue(key, isKeyHash = false, bigMapId) {
|
|
183
|
-
const bigMaps = await this.contract.getBigMaps();
|
|
184
|
-
const bigMap = bigMapId !== undefined ? bigMaps.find((bigMap) => bigMap.id === bigMapId) : bigMaps[0];
|
|
185
|
-
if (!bigMap) {
|
|
186
|
-
return undefined;
|
|
187
|
-
}
|
|
188
|
-
const result = await this.contract.getBigMapValue({
|
|
189
|
-
bigMap,
|
|
190
|
-
key,
|
|
191
|
-
resultType: 'micheline'
|
|
192
379
|
});
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
380
|
+
};
|
|
381
|
+
TezosFAProtocolImpl.prototype.getTokenMetadataForTokenId = function (tokenId) {
|
|
382
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
383
|
+
var tokenMetadata;
|
|
384
|
+
return __generator(this, function (_a) {
|
|
385
|
+
switch (_a.label) {
|
|
386
|
+
case 0: return [4 /*yield*/, this.getAllTokenMetadata()];
|
|
387
|
+
case 1:
|
|
388
|
+
tokenMetadata = _a.sent();
|
|
389
|
+
return [2 /*return*/, tokenMetadata ? tokenMetadata[tokenId] : undefined];
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
});
|
|
393
|
+
};
|
|
394
|
+
TezosFAProtocolImpl.prototype.bigMapValue = function (key, isKeyHash, bigMapId) {
|
|
395
|
+
if (isKeyHash === void 0) { isKeyHash = false; }
|
|
396
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
397
|
+
var bigMaps, bigMap, result;
|
|
398
|
+
return __generator(this, function (_a) {
|
|
399
|
+
switch (_a.label) {
|
|
400
|
+
case 0: return [4 /*yield*/, this.contract.getBigMaps()];
|
|
401
|
+
case 1:
|
|
402
|
+
bigMaps = _a.sent();
|
|
403
|
+
bigMap = bigMapId !== undefined ? bigMaps.find(function (bigMap) { return bigMap.id === bigMapId; }) : bigMaps[0];
|
|
404
|
+
if (!bigMap) {
|
|
405
|
+
return [2 /*return*/, undefined];
|
|
406
|
+
}
|
|
407
|
+
return [4 /*yield*/, this.contract.getBigMapValue({
|
|
408
|
+
bigMap: bigMap,
|
|
409
|
+
key: key,
|
|
410
|
+
resultType: 'micheline'
|
|
411
|
+
})];
|
|
412
|
+
case 2:
|
|
413
|
+
result = _a.sent();
|
|
414
|
+
return [2 /*return*/, result === null || result === void 0 ? void 0 : result.value];
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
};
|
|
419
|
+
TezosFAProtocolImpl.prototype.normalizeTransactionParameters = function (parameters, fallbackEntrypointName) {
|
|
420
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
421
|
+
var parsedParameters;
|
|
422
|
+
return __generator(this, function (_a) {
|
|
423
|
+
parsedParameters = this.parseParameters(parameters);
|
|
424
|
+
if (!(parsedParameters instanceof Object && 'value' in parsedParameters) && !(0, micheline_1.isMichelineNode)(parsedParameters)) {
|
|
425
|
+
throw new errors_1.InvalidValueError(coinlib_core_1.Domain.TEZOSFA, "Invalid parameters: ".concat(JSON.stringify(parsedParameters)));
|
|
426
|
+
}
|
|
427
|
+
return [2 /*return*/, this.contract.normalizeContractCallParameters(parsedParameters, fallbackEntrypointName)];
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
};
|
|
431
|
+
TezosFAProtocolImpl.prototype.parseParameters = function (parameters) {
|
|
432
|
+
var toBeRemoved = 'Unparsable code: ';
|
|
204
433
|
if (parameters.startsWith(toBeRemoved)) {
|
|
205
434
|
parameters = parameters.slice(toBeRemoved.length);
|
|
206
435
|
}
|
|
207
436
|
return JSON.parse(parameters);
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
return {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
amount: '0',
|
|
229
|
-
destination: this.options.network.contractAddress,
|
|
230
|
-
parameters: contractCall.toJSON()
|
|
231
|
-
};
|
|
232
|
-
}));
|
|
233
|
-
try {
|
|
234
|
-
const tezosWrappedOperation = await this.tezos.prepareOperations(publicKey, operations, false);
|
|
235
|
-
const binaryTx = await this.tezos.forgeOperation(tezosWrappedOperation);
|
|
236
|
-
return (0, module_kit_1.newUnsignedTransaction)({ binary: binaryTx });
|
|
237
|
-
}
|
|
238
|
-
catch (error) {
|
|
239
|
-
console.error(error.message);
|
|
240
|
-
throw new errors_1.OperationFailedError(coinlib_core_1.Domain.TEZOSFA, 'Forging Tezos TX failed.');
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
async runContractCall(contractCall, source) {
|
|
244
|
-
const results = await Promise.all([
|
|
245
|
-
axios_0_19_0_1.default.get(this.url(`/chains/main/blocks/head/context/contracts/${source}/counter`)),
|
|
246
|
-
axios_0_19_0_1.default.get(this.url('/chains/main/blocks/head/header'))
|
|
247
|
-
]).catch((error) => {
|
|
248
|
-
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
437
|
+
};
|
|
438
|
+
TezosFAProtocolImpl.prototype.getTransactions = function (limit, cursor) {
|
|
439
|
+
var _a;
|
|
440
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
441
|
+
var transactions;
|
|
442
|
+
var _this = this;
|
|
443
|
+
return __generator(this, function (_b) {
|
|
444
|
+
switch (_b.label) {
|
|
445
|
+
case 0: return [4 /*yield*/, this.indexer.getTokenTransactions({ contractAddress: this.contract.address, id: 0 }, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
|
|
446
|
+
case 1:
|
|
447
|
+
transactions = _b.sent();
|
|
448
|
+
return [2 /*return*/, {
|
|
449
|
+
transactions: transactions.map(function (transaction) { return (__assign(__assign({}, transaction), { network: _this.options.network })); }),
|
|
450
|
+
cursor: {
|
|
451
|
+
hasNext: transactions.length >= limit,
|
|
452
|
+
offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + transactions.length
|
|
453
|
+
}
|
|
454
|
+
}];
|
|
455
|
+
}
|
|
456
|
+
});
|
|
249
457
|
});
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
458
|
+
};
|
|
459
|
+
TezosFAProtocolImpl.prototype.prepareContractCall = function (contractCalls, fee, publicKey) {
|
|
460
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
461
|
+
var tezosMetadata, operations, tezosWrappedOperation, binaryTx, error_1;
|
|
462
|
+
var _this = this;
|
|
463
|
+
return __generator(this, function (_a) {
|
|
464
|
+
switch (_a.label) {
|
|
465
|
+
case 0: return [4 /*yield*/, this.tezos.getMetadata()];
|
|
466
|
+
case 1:
|
|
467
|
+
tezosMetadata = _a.sent();
|
|
468
|
+
return [4 /*yield*/, Promise.all(contractCalls.map(function (contractCall) { return __awaiter(_this, void 0, void 0, function () {
|
|
469
|
+
return __generator(this, function (_a) {
|
|
470
|
+
return [2 /*return*/, {
|
|
471
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
472
|
+
fee: (0, module_kit_1.newAmount)(fee).blockchain(tezosMetadata.units).value,
|
|
473
|
+
amount: '0',
|
|
474
|
+
destination: this.options.network.contractAddress,
|
|
475
|
+
parameters: contractCall.toJSON()
|
|
476
|
+
}];
|
|
477
|
+
});
|
|
478
|
+
}); }))];
|
|
479
|
+
case 2:
|
|
480
|
+
operations = _a.sent();
|
|
481
|
+
_a.label = 3;
|
|
482
|
+
case 3:
|
|
483
|
+
_a.trys.push([3, 6, , 7]);
|
|
484
|
+
return [4 /*yield*/, this.tezos.prepareOperations(publicKey, operations, false)];
|
|
485
|
+
case 4:
|
|
486
|
+
tezosWrappedOperation = _a.sent();
|
|
487
|
+
return [4 /*yield*/, this.tezos.forgeOperation(tezosWrappedOperation)];
|
|
488
|
+
case 5:
|
|
489
|
+
binaryTx = _a.sent();
|
|
490
|
+
return [2 /*return*/, (0, module_kit_1.newUnsignedTransaction)({ binary: binaryTx })];
|
|
491
|
+
case 6:
|
|
492
|
+
error_1 = _a.sent();
|
|
493
|
+
console.error(error_1.message);
|
|
494
|
+
throw new errors_1.OperationFailedError(coinlib_core_1.Domain.TEZOSFA, 'Forging Tezos TX failed.');
|
|
495
|
+
case 7: return [2 /*return*/];
|
|
496
|
+
}
|
|
257
497
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
498
|
+
});
|
|
499
|
+
};
|
|
500
|
+
TezosFAProtocolImpl.prototype.runContractCall = function (contractCall, source) {
|
|
501
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
502
|
+
var results, counter, branch, chainId, body, response, metadata, runOperationError_1;
|
|
503
|
+
return __generator(this, function (_a) {
|
|
504
|
+
switch (_a.label) {
|
|
505
|
+
case 0: return [4 /*yield*/, Promise.all([
|
|
506
|
+
axios_0_19_0_1.default.get(this.url("/chains/main/blocks/head/context/contracts/".concat(source, "/counter"))),
|
|
507
|
+
axios_0_19_0_1.default.get(this.url('/chains/main/blocks/head/header'))
|
|
508
|
+
]).catch(function (error) {
|
|
509
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOS, error);
|
|
510
|
+
})];
|
|
511
|
+
case 1:
|
|
512
|
+
results = _a.sent();
|
|
513
|
+
counter = new bignumber_1.default(results[0].data).plus(1);
|
|
514
|
+
branch = results[1].data.hash;
|
|
515
|
+
chainId = results[1].data.chain_id;
|
|
516
|
+
body = this.prepareMockContractCall(contractCall, chainId, branch, counter, source, this.options.network.contractAddress);
|
|
517
|
+
_a.label = 2;
|
|
518
|
+
case 2:
|
|
519
|
+
_a.trys.push([2, 4, , 5]);
|
|
520
|
+
return [4 /*yield*/, axios_0_19_0_1.default.post(this.url('/chains/main/blocks/head/helpers/scripts/run_operation'), body, {
|
|
521
|
+
headers: { 'Content-Type': 'application/json' }
|
|
522
|
+
})];
|
|
523
|
+
case 3:
|
|
524
|
+
response = _a.sent();
|
|
525
|
+
metadata = response.data.contents[0].metadata;
|
|
526
|
+
if (metadata.internal_operation_results !== undefined && metadata.operation_result.status === 'applied') {
|
|
527
|
+
return [2 /*return*/, metadata.internal_operation_results[0].parameters.value];
|
|
528
|
+
}
|
|
529
|
+
else {
|
|
530
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOSFA, { response: response });
|
|
531
|
+
}
|
|
532
|
+
return [3 /*break*/, 5];
|
|
533
|
+
case 4:
|
|
534
|
+
runOperationError_1 = _a.sent();
|
|
535
|
+
throw new errors_1.NetworkError(coinlib_core_1.Domain.TEZOSFA, runOperationError_1);
|
|
536
|
+
case 5: return [2 /*return*/];
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
};
|
|
541
|
+
TezosFAProtocolImpl.prototype.requireSource = function (source, defaultSource) {
|
|
542
|
+
var excludedPrefixes = [];
|
|
543
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
544
|
+
excludedPrefixes[_i - 2] = arguments[_i];
|
|
268
545
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
const _source = source ?? defaultSource;
|
|
272
|
-
return _source === undefined || excludedPrefixes.some((excluded) => _source.toLowerCase().startsWith(excluded.toLowerCase()))
|
|
546
|
+
var _source = source !== null && source !== void 0 ? source : defaultSource;
|
|
547
|
+
return _source === undefined || excludedPrefixes.some(function (excluded) { return _source.toLowerCase().startsWith(excluded.toLowerCase()); })
|
|
273
548
|
? this.options.network.defaultSourceAddress
|
|
274
549
|
: _source;
|
|
275
|
-
}
|
|
276
|
-
prepareMockContractCall(contractCall, chainId, branch, counter, source, contractAddress, fee
|
|
550
|
+
};
|
|
551
|
+
TezosFAProtocolImpl.prototype.prepareMockContractCall = function (contractCall, chainId, branch, counter, source, contractAddress, fee) {
|
|
552
|
+
if (fee === void 0) { fee = '0'; }
|
|
277
553
|
return {
|
|
278
554
|
chain_id: chainId,
|
|
279
555
|
operation: {
|
|
280
|
-
branch,
|
|
281
|
-
signature: 'sigUHx32f9wesZ1n2BWpixXz4AQaZggEtchaQNHYGRCoWNAXx45WGW2ua3apUUUAGMLPwAU41QoaFCzVSL61VaessLg4YbbP',
|
|
556
|
+
branch: branch,
|
|
557
|
+
signature: 'sigUHx32f9wesZ1n2BWpixXz4AQaZggEtchaQNHYGRCoWNAXx45WGW2ua3apUUUAGMLPwAU41QoaFCzVSL61VaessLg4YbbP',
|
|
282
558
|
contents: [
|
|
283
559
|
{
|
|
284
560
|
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
285
561
|
counter: counter.toFixed(),
|
|
286
562
|
amount: '0',
|
|
287
|
-
source,
|
|
563
|
+
source: source,
|
|
288
564
|
destination: contractAddress,
|
|
289
|
-
fee,
|
|
565
|
+
fee: fee,
|
|
290
566
|
gas_limit: '400000',
|
|
291
567
|
storage_limit: '60000',
|
|
292
568
|
parameters: contractCall.toJSON()
|
|
@@ -294,29 +570,26 @@ class TezosFAProtocolImpl {
|
|
|
294
570
|
]
|
|
295
571
|
}
|
|
296
572
|
};
|
|
297
|
-
}
|
|
298
|
-
url(path) {
|
|
299
|
-
return
|
|
300
|
-
}
|
|
301
|
-
|
|
573
|
+
};
|
|
574
|
+
TezosFAProtocolImpl.prototype.url = function (path) {
|
|
575
|
+
return "".concat(this.options.network.rpcUrl).concat(path);
|
|
576
|
+
};
|
|
577
|
+
return TezosFAProtocolImpl;
|
|
578
|
+
}());
|
|
302
579
|
exports.TezosFAProtocolImpl = TezosFAProtocolImpl;
|
|
303
580
|
// Factory
|
|
304
|
-
exports.TEZOS_FA_MAINNET_PROTOCOL_NETWORK = {
|
|
305
|
-
...TezosProtocol_1.TEZOS_MAINNET_PROTOCOL_NETWORK,
|
|
306
|
-
defaultSourceAddress: 'tz1Mj7RzPmMAqDUNFBn5t5VbXmWW4cSUAdtT',
|
|
307
|
-
objktApiUrl: 'https://data.objkt.com/v3/graphql'
|
|
308
|
-
};
|
|
581
|
+
exports.TEZOS_FA_MAINNET_PROTOCOL_NETWORK = __assign(__assign({}, TezosProtocol_1.TEZOS_MAINNET_PROTOCOL_NETWORK), { defaultSourceAddress: 'tz1Mj7RzPmMAqDUNFBn5t5VbXmWW4cSUAdtT', objktApiUrl: 'https://data.objkt.com/v3/graphql' });
|
|
309
582
|
function createTezosFAProtocolOptions(network, identifier, name, units, mainUnit, feeDefaults) {
|
|
310
583
|
return {
|
|
311
|
-
network,
|
|
312
|
-
identifier,
|
|
313
|
-
name: name
|
|
314
|
-
units: units
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
feeDefaults
|
|
584
|
+
network: network,
|
|
585
|
+
identifier: identifier,
|
|
586
|
+
name: name !== null && name !== void 0 ? name : 'Generic FA2',
|
|
587
|
+
units: units !== null && units !== void 0 ? units : {
|
|
588
|
+
tez: TezosProtocol_1.TEZOS_UNITS.tez
|
|
589
|
+
},
|
|
590
|
+
mainUnit: mainUnit !== null && mainUnit !== void 0 ? mainUnit : 'tez',
|
|
591
|
+
feeDefaults: feeDefaults
|
|
320
592
|
};
|
|
321
593
|
}
|
|
594
|
+
exports.createTezosFAProtocolOptions = createTezosFAProtocolOptions;
|
|
322
595
|
//# sourceMappingURL=TezosFAProtocol.js.map
|