@airgap/tezos 0.13.45-beta.2 → 0.13.45-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/v0/actions/GetKtAccountsAction.js +11 -81
- 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 +0 -1
- package/v0/protocol/TezosAddress.js +41 -81
- package/v0/protocol/TezosAddress.js.map +1 -1
- package/v0/protocol/TezosCryptoClient.d.ts +0 -1
- package/v0/protocol/TezosCryptoClient.js +68 -123
- package/v0/protocol/TezosCryptoClient.js.map +1 -1
- package/v0/protocol/TezosProtocol.js +978 -1631
- package/v0/protocol/TezosProtocol.js.map +1 -1
- package/v0/protocol/TezosProtocolOptions.d.ts +1 -1
- package/v0/protocol/TezosProtocolOptions.js +26 -98
- package/v0/protocol/TezosProtocolOptions.js.map +1 -1
- package/v0/protocol/TezosUtils.d.ts +0 -1
- package/v0/protocol/TezosUtils.js +131 -165
- package/v0/protocol/TezosUtils.js.map +1 -1
- package/v0/protocol/contract/TezosContract.js +243 -472
- package/v0/protocol/contract/TezosContract.js.map +1 -1
- package/v0/protocol/contract/TezosContractCall.js +8 -10
- package/v0/protocol/contract/TezosContractCall.js.map +1 -1
- package/v0/protocol/contract/TezosContractEntrypoint.js +14 -19
- package/v0/protocol/contract/TezosContractEntrypoint.js.map +1 -1
- package/v0/protocol/contract/TezosContractStorage.js +8 -9
- package/v0/protocol/contract/TezosContractStorage.js.map +1 -1
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +8 -25
- package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -1
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js +39 -113
- package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js.map +1 -1
- package/v0/protocol/domains/TezosDomains.js +165 -270
- package/v0/protocol/domains/TezosDomains.js.map +1 -1
- package/v0/protocol/fa/TezosBTC.js +19 -98
- package/v0/protocol/fa/TezosBTC.js.map +1 -1
- package/v0/protocol/fa/TezosBTCtez.js +17 -48
- package/v0/protocol/fa/TezosBTCtez.js.map +1 -1
- package/v0/protocol/fa/TezosCTez.js +17 -45
- package/v0/protocol/fa/TezosCTez.js.map +1 -1
- package/v0/protocol/fa/TezosDOGA.js +17 -45
- package/v0/protocol/fa/TezosDOGA.js.map +1 -1
- package/v0/protocol/fa/TezosETHtz.js +10 -68
- package/v0/protocol/fa/TezosETHtz.js.map +1 -1
- package/v0/protocol/fa/TezosFA1Protocol.js +119 -276
- package/v0/protocol/fa/TezosFA1Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFA1p2Protocol.js +22 -101
- package/v0/protocol/fa/TezosFA1p2Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFA2Protocol.js +213 -402
- package/v0/protocol/fa/TezosFA2Protocol.js.map +1 -1
- package/v0/protocol/fa/TezosFAProtocol.js +211 -418
- package/v0/protocol/fa/TezosFAProtocol.js.map +1 -1
- package/v0/protocol/fa/TezosFAProtocolOptions.d.ts +2 -2
- package/v0/protocol/fa/TezosFAProtocolOptions.js +92 -195
- package/v0/protocol/fa/TezosFAProtocolOptions.js.map +1 -1
- package/v0/protocol/fa/TezosKolibriUSD.js +11 -70
- package/v0/protocol/fa/TezosKolibriUSD.js.map +1 -1
- package/v0/protocol/fa/TezosPlanty.js +17 -45
- package/v0/protocol/fa/TezosPlanty.js.map +1 -1
- package/v0/protocol/fa/TezosQUIPU.js +17 -48
- package/v0/protocol/fa/TezosQUIPU.js.map +1 -1
- package/v0/protocol/fa/TezosSIRS.js +17 -45
- package/v0/protocol/fa/TezosSIRS.js.map +1 -1
- package/v0/protocol/fa/TezosStaker.js +11 -70
- package/v0/protocol/fa/TezosStaker.js.map +1 -1
- package/v0/protocol/fa/TezosUBTC.js +17 -48
- package/v0/protocol/fa/TezosUBTC.js.map +1 -1
- package/v0/protocol/fa/TezosUDEFI.js +17 -48
- package/v0/protocol/fa/TezosUDEFI.js.map +1 -1
- package/v0/protocol/fa/TezosUSD.js +11 -70
- package/v0/protocol/fa/TezosUSD.js.map +1 -1
- package/v0/protocol/fa/TezosUSDT.js +17 -48
- package/v0/protocol/fa/TezosUSDT.js.map +1 -1
- package/v0/protocol/fa/TezosUUSD.js +8 -27
- package/v0/protocol/fa/TezosUUSD.js.map +1 -1
- package/v0/protocol/fa/TezosUXTZ.js +17 -48
- package/v0/protocol/fa/TezosUXTZ.js.map +1 -1
- package/v0/protocol/fa/TezosWRAP.js +17 -48
- package/v0/protocol/fa/TezosWRAP.js.map +1 -1
- package/v0/protocol/fa/TezosWrapped.js +11 -70
- package/v0/protocol/fa/TezosWrapped.js.map +1 -1
- package/v0/protocol/fa/TezosYOU.js +8 -27
- package/v0/protocol/fa/TezosYOU.js.map +1 -1
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js +84 -162
- package/v0/protocol/fa/metadata/BigMapTokenMetadataIndexer.js.map +1 -1
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js +37 -87
- package/v0/protocol/fa/metadata/ObjktTokenMetadataIndexer.js.map +1 -1
- package/v0/protocol/indexerClient/TezosIndexerClient.js +115 -259
- package/v0/protocol/indexerClient/TezosIndexerClient.js.map +1 -1
- package/v0/protocol/kt/TezosKtAddress.js +7 -67
- package/v0/protocol/kt/TezosKtAddress.js.map +1 -1
- package/v0/protocol/kt/TezosKtProtocol.js +161 -309
- package/v0/protocol/kt/TezosKtProtocol.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingAddress.d.ts +0 -1
- package/v0/protocol/sapling/TezosSaplingAddress.js +46 -117
- package/v0/protocol/sapling/TezosSaplingAddress.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingCryptoClient.d.ts +0 -1
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js +125 -220
- package/v0/protocol/sapling/TezosSaplingCryptoClient.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingProtocol.d.ts +0 -1
- package/v0/protocol/sapling/TezosSaplingProtocol.js +600 -1127
- package/v0/protocol/sapling/TezosSaplingProtocol.js.map +1 -1
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.d.ts +0 -1
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js +32 -61
- package/v0/protocol/sapling/TezosSaplingProtocolOptions.js.map +1 -1
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js +50 -134
- package/v0/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -1
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js +10 -56
- package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js.map +1 -1
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js +12 -67
- package/v0/protocol/sapling/node/TezosSaplingNodeClient.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.d.ts +0 -1
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js +221 -539
- package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.d.ts +0 -1
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js +101 -104
- package/v0/protocol/sapling/utils/TezosSaplingEncoder.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingForger.d.ts +0 -1
- package/v0/protocol/sapling/utils/TezosSaplingForger.js +107 -266
- package/v0/protocol/sapling/utils/TezosSaplingForger.js.map +1 -1
- package/v0/protocol/sapling/utils/TezosSaplingState.js +110 -239
- 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 +9 -13
- package/v0/protocol/types/micheline/MichelineNodeUtils.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonType.d.ts +0 -1
- package/v0/protocol/types/michelson/MichelsonType.js +11 -12
- package/v0/protocol/types/michelson/MichelsonType.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js +45 -92
- package/v0/protocol/types/michelson/MichelsonTypeMeta.js.map +1 -1
- package/v0/protocol/types/michelson/MichelsonTypeUtils.d.ts +0 -1
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js +58 -219
- package/v0/protocol/types/michelson/MichelsonTypeUtils.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonList.js +24 -43
- package/v0/protocol/types/michelson/generics/MichelsonList.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonMap.js +39 -61
- 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 +46 -75
- 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 +50 -76
- package/v0/protocol/types/michelson/generics/MichelsonOr.js.map +1 -1
- package/v0/protocol/types/michelson/generics/MichelsonPair.js +52 -85
- 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 +0 -1
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js +28 -47
- package/v0/protocol/types/michelson/primitives/MichelsonAddress.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js +20 -39
- package/v0/protocol/types/michelson/primitives/MichelsonBool.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.d.ts +0 -1
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js +35 -54
- package/v0/protocol/types/michelson/primitives/MichelsonBytes.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonInt.d.ts +0 -1
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js +30 -49
- package/v0/protocol/types/michelson/primitives/MichelsonInt.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonString.d.ts +0 -1
- package/v0/protocol/types/michelson/primitives/MichelsonString.js +33 -52
- package/v0/protocol/types/michelson/primitives/MichelsonString.js.map +1 -1
- package/v0/protocol/types/michelson/primitives/MichelsonUnit.js +14 -34
- 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 +0 -1
- package/v0/protocol/types/utils.js +8 -10
- package/v0/protocol/types/utils.js.map +1 -1
- package/v0/serializer/validators/transaction-validator.js +29 -78
- package/v0/serializer/validators/transaction-validator.js.map +1 -1
- package/v0/serializer/validators/transaction-xtz-btc-validator.js +55 -129
- package/v0/serializer/validators/transaction-xtz-btc-validator.js.map +1 -1
- package/v0/serializer/validators/validators.js +43 -103
- package/v0/serializer/validators/validators.js.map +1 -1
- package/v1/block-explorer/TzKTBlockExplorer.js +12 -61
- package/v1/block-explorer/TzKTBlockExplorer.js.map +1 -1
- package/v1/block-explorer/factory.js +4 -5
- package/v1/block-explorer/factory.js.map +1 -1
- package/v1/contract/TezosContract.js +242 -471
- package/v1/contract/TezosContract.js.map +1 -1
- package/v1/contract/TezosContractCall.js +8 -10
- package/v1/contract/TezosContractCall.js.map +1 -1
- package/v1/contract/TezosContractEntrypoint.d.ts +1 -1
- package/v1/contract/TezosContractEntrypoint.js +14 -19
- package/v1/contract/TezosContractEntrypoint.js.map +1 -1
- package/v1/contract/TezosContractStorage.js +8 -9
- package/v1/contract/TezosContractStorage.js.map +1 -1
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js +8 -25
- package/v1/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -1
- package/v1/contract/remote-data/TezosStorageRemoteData.js +39 -113
- package/v1/contract/remote-data/TezosStorageRemoteData.js.map +1 -1
- package/v1/crypto/TezosCryptoClient.d.ts +0 -1
- package/v1/crypto/TezosCryptoClient.js +64 -117
- package/v1/crypto/TezosCryptoClient.js.map +1 -1
- package/v1/crypto/TezosSaplingCryptoClient.d.ts +0 -1
- package/v1/crypto/TezosSaplingCryptoClient.js +116 -194
- package/v1/crypto/TezosSaplingCryptoClient.js.map +1 -1
- package/v1/data/TezosAddress.js +13 -14
- package/v1/data/TezosAddress.js.map +1 -1
- package/v1/data/TezosSaplingAddress.d.ts +0 -1
- package/v1/data/TezosSaplingAddress.js +29 -94
- package/v1/data/TezosSaplingAddress.js.map +1 -1
- package/v1/domains/TezosDomains.js +165 -270
- 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 +126 -270
- package/v1/indexer/TzKTIndexerClient.js.map +1 -1
- package/v1/indexer/factory.js +4 -5
- package/v1/indexer/factory.js.map +1 -1
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js +83 -161
- package/v1/indexer/token-metadata/BigMapTokenMetadataIndexerClient.js.map +1 -1
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js +36 -85
- package/v1/indexer/token-metadata/ObjktTokenMetadataIndexerClient.js.map +1 -1
- package/v1/injector/TezosSaplingInjectorClient.js +10 -56
- package/v1/injector/TezosSaplingInjectorClient.js.map +1 -1
- package/v1/module/TezosModule.js +88 -155
- package/v1/module/TezosModule.js.map +1 -1
- package/v1/module.js +2 -3
- package/v1/module.js.map +1 -1
- package/v1/node/TezosSaplingNodeClient.js +12 -67
- package/v1/node/TezosSaplingNodeClient.js.map +1 -1
- package/v1/protocol/TezosProtocol.js +848 -1385
- package/v1/protocol/TezosProtocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1Protocol.js +81 -205
- package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA1p2Protocol.js +32 -111
- package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFA2Protocol.js +174 -332
- package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -1
- package/v1/protocol/fa/TezosFAProtocol.js +255 -528
- 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 +30 -47
- 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 +27 -47
- 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 +27 -47
- 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 +30 -90
- 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 +30 -90
- 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 +30 -90
- 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 +30 -47
- 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 +27 -47
- 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 +30 -90
- 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 +30 -47
- 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 +27 -47
- 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 +30 -47
- 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 +30 -47
- 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 +27 -47
- 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 +30 -47
- 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 +30 -47
- 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 +30 -47
- 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 +27 -47
- 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 +30 -47
- 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 +30 -47
- package/v1/protocol/fa/tokens/stXTZProtocol.js.map +1 -1
- package/v1/protocol/kt/TezosKtProtocol.js +254 -498
- package/v1/protocol/kt/TezosKtProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +0 -1
- package/v1/protocol/sapling/TezosSaplingProtocol.js +532 -933
- package/v1/protocol/sapling/TezosSaplingProtocol.js.map +1 -1
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js +72 -164
- package/v1/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -1
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +14 -26
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -1
- package/v1/serializer/v3/serializer-companion.js +103 -188
- package/v1/serializer/v3/serializer-companion.js.map +1 -1
- package/v1/serializer/v3/validators/transaction-validator.js +54 -143
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -1
- package/v1/serializer/v3/validators/validators.js +40 -100
- 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 +9 -13
- package/v1/types/micheline/MichelineNodeUtils.js.map +1 -1
- package/v1/types/michelson/MichelsonType.d.ts +0 -1
- package/v1/types/michelson/MichelsonType.js +11 -12
- package/v1/types/michelson/MichelsonType.js.map +1 -1
- package/v1/types/michelson/MichelsonTypeMeta.js +45 -92
- package/v1/types/michelson/MichelsonTypeMeta.js.map +1 -1
- package/v1/types/michelson/MichelsonTypeUtils.d.ts +0 -1
- package/v1/types/michelson/MichelsonTypeUtils.js +58 -219
- package/v1/types/michelson/MichelsonTypeUtils.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonList.js +24 -43
- package/v1/types/michelson/generics/MichelsonList.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonMap.js +39 -61
- 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 +46 -75
- 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 +50 -76
- package/v1/types/michelson/generics/MichelsonOr.js.map +1 -1
- package/v1/types/michelson/generics/MichelsonPair.js +52 -85
- 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 +0 -1
- package/v1/types/michelson/primitives/MichelsonAddress.js +28 -47
- package/v1/types/michelson/primitives/MichelsonAddress.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonBool.js +20 -39
- package/v1/types/michelson/primitives/MichelsonBool.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonBytes.d.ts +0 -1
- package/v1/types/michelson/primitives/MichelsonBytes.js +35 -54
- package/v1/types/michelson/primitives/MichelsonBytes.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonInt.d.ts +0 -1
- package/v1/types/michelson/primitives/MichelsonInt.js +30 -49
- package/v1/types/michelson/primitives/MichelsonInt.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonString.d.ts +0 -1
- package/v1/types/michelson/primitives/MichelsonString.js +33 -52
- package/v1/types/michelson/primitives/MichelsonString.js.map +1 -1
- package/v1/types/michelson/primitives/MichelsonUnit.js +14 -34
- 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 +0 -1
- package/v1/types/sapling/TezosSaplingStateTree.d.ts +1 -1
- package/v1/types/sapling/TezosSaplingTransaction.d.ts +0 -1
- package/v1/types/staking/TezosDelegatorAction.js +1 -1
- package/v1/types/staking/TezosDelegatorAction.js.map +1 -1
- package/v1/utils/address.js +6 -7
- package/v1/utils/address.js.map +1 -1
- package/v1/utils/bip.d.ts +0 -1
- package/v1/utils/bip.js +6 -7
- package/v1/utils/bip.js.map +1 -1
- package/v1/utils/convert.js +7 -8
- package/v1/utils/convert.js.map +1 -1
- package/v1/utils/encoding.d.ts +0 -1
- package/v1/utils/encoding.js +74 -64
- package/v1/utils/encoding.js.map +1 -1
- package/v1/utils/fa.js +2 -3
- package/v1/utils/fa.js.map +1 -1
- package/v1/utils/key.js +9 -12
- package/v1/utils/key.js.map +1 -1
- package/v1/utils/micheline.js +8 -10
- package/v1/utils/micheline.js.map +1 -1
- package/v1/utils/operations.js +21 -22
- package/v1/utils/operations.js.map +1 -1
- package/v1/utils/pack.d.ts +0 -1
- package/v1/utils/pack.js +65 -107
- package/v1/utils/pack.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFA1Accountant.js +24 -52
- package/v1/utils/protocol/fa/TezosFA1Accountant.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFA2Accountant.js +40 -77
- package/v1/utils/protocol/fa/TezosFA2Accountant.js.map +1 -1
- package/v1/utils/protocol/fa/TezosFAAccountant.js +21 -89
- package/v1/utils/protocol/fa/TezosFAAccountant.js.map +1 -1
- package/v1/utils/protocol/instance.js +90 -26
- package/v1/utils/protocol/instance.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.d.ts +0 -1
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js +221 -539
- package/v1/utils/protocol/sapling/TezosSaplingAccountant.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.d.ts +0 -1
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js +101 -104
- package/v1/utils/protocol/sapling/TezosSaplingEncoder.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingForger.d.ts +0 -1
- package/v1/utils/protocol/sapling/TezosSaplingForger.js +107 -266
- package/v1/utils/protocol/sapling/TezosSaplingForger.js.map +1 -1
- package/v1/utils/protocol/sapling/TezosSaplingState.js +110 -239
- package/v1/utils/protocol/sapling/TezosSaplingState.js.map +1 -1
- package/v1/utils/protocol/tezos/TezosAccountant.js +97 -166
- package/v1/utils/protocol/tezos/TezosAccountant.js.map +1 -1
- package/v1/utils/protocol/tezos/TezosForger.js +21 -76
- package/v1/utils/protocol/tezos/TezosForger.js.map +1 -1
- package/v1/utils/signature.js +5 -6
- package/v1/utils/signature.js.map +1 -1
- package/v1/utils/transaction.d.ts +4 -5
- package/v1/utils/transaction.js +3 -3
- package/v1/utils/transaction.js.map +1 -1
|
@@ -1,196 +1,83 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
4
|
};
|
|
67
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
6
|
exports.TezosFA2Protocol = void 0;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
7
|
+
const bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
|
|
8
|
+
const errors_1 = require("@airgap/coinlib-core/errors");
|
|
9
|
+
const coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
|
|
10
|
+
const hex_1 = require("@airgap/coinlib-core/utils/hex");
|
|
11
|
+
const TezosProtocol_1 = require("../TezosProtocol");
|
|
12
|
+
const TezosUtils_1 = require("../TezosUtils");
|
|
13
|
+
const MichelsonList_1 = require("../types/michelson/generics/MichelsonList");
|
|
14
|
+
const MichelsonPair_1 = require("../types/michelson/generics/MichelsonPair");
|
|
15
|
+
const MichelsonAddress_1 = require("../types/michelson/primitives/MichelsonAddress");
|
|
16
|
+
const MichelsonInt_1 = require("../types/michelson/primitives/MichelsonInt");
|
|
17
|
+
const MichelsonString_1 = require("../types/michelson/primitives/MichelsonString");
|
|
18
|
+
const TezosOperationType_1 = require("../types/TezosOperationType");
|
|
19
|
+
const utils_1 = require("../types/utils");
|
|
20
|
+
const TezosFAProtocol_1 = require("./TezosFAProtocol");
|
|
83
21
|
var TezosFA2ContractEntrypoint;
|
|
84
22
|
(function (TezosFA2ContractEntrypoint) {
|
|
85
23
|
TezosFA2ContractEntrypoint["BALANCE"] = "balance_of";
|
|
86
24
|
TezosFA2ContractEntrypoint["TRANSFER"] = "transfer";
|
|
87
25
|
TezosFA2ContractEntrypoint["UPDATE_OPERATORS"] = "update_operators";
|
|
88
26
|
})(TezosFA2ContractEntrypoint || (TezosFA2ContractEntrypoint = {}));
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
_c),
|
|
103
|
-
_a);
|
|
104
|
-
return _this;
|
|
27
|
+
class TezosFA2Protocol extends TezosFAProtocol_1.TezosFAProtocol {
|
|
28
|
+
constructor(options) {
|
|
29
|
+
super(options);
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.tokenID = options.config.defaultTokenID;
|
|
32
|
+
this.defaultCallbackContract = {
|
|
33
|
+
[TezosProtocol_1.TezosNetwork.MAINNET]: {
|
|
34
|
+
[TezosFA2ContractEntrypoint.BALANCE]: 'KT1LyHDYnML5eCuTEVCTynUpivwG6ns6khiG'
|
|
35
|
+
},
|
|
36
|
+
[TezosProtocol_1.TezosNetwork.GHOSTNET]: {
|
|
37
|
+
[TezosFA2ContractEntrypoint.BALANCE]: 'KT1D1vHAyMVqfVJoufp6eYTJcJWEFigR3yjr'
|
|
38
|
+
}
|
|
39
|
+
};
|
|
105
40
|
}
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
case 1:
|
|
147
|
-
results = _a.sent();
|
|
148
|
-
return [2 /*return*/, results.reduce(function (sum, next) { return sum.plus(next.amount); }, new bignumber_1.default(0)).toFixed()];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
TezosFA2Protocol.prototype.estimateFeeDefaultsFromPublicKey = function (publicKey, recipients, values, data) {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
var transferCall, operation;
|
|
156
|
-
return __generator(this, function (_a) {
|
|
157
|
-
switch (_a.label) {
|
|
158
|
-
case 0:
|
|
159
|
-
// return this.feeDefaults
|
|
160
|
-
if (recipients.length !== values.length) {
|
|
161
|
-
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
|
|
162
|
-
}
|
|
163
|
-
return [4 /*yield*/, this.createTransferCall(publicKey, recipients, values, this.feeDefaults.medium, data)];
|
|
164
|
-
case 1:
|
|
165
|
-
transferCall = _a.sent();
|
|
166
|
-
operation = {
|
|
167
|
-
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
168
|
-
amount: '0',
|
|
169
|
-
destination: this.contractAddress,
|
|
170
|
-
parameters: transferCall.toJSON(),
|
|
171
|
-
fee: '0'
|
|
172
|
-
};
|
|
173
|
-
return [2 /*return*/, this.estimateFeeDefaultsForOperations(publicKey, [operation])];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
TezosFA2Protocol.prototype.prepareTransactionFromPublicKey = function (publicKey, recipients, values, fee, data) {
|
|
179
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
180
|
-
var transferCall;
|
|
181
|
-
return __generator(this, function (_a) {
|
|
182
|
-
switch (_a.label) {
|
|
183
|
-
case 0: return [4 /*yield*/, this.createTransferCall(publicKey, recipients, values, fee, data)];
|
|
184
|
-
case 1:
|
|
185
|
-
transferCall = _a.sent();
|
|
186
|
-
return [2 /*return*/, this.prepareContractCall([transferCall], fee, publicKey)];
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
TezosFA2Protocol.prototype.transactionDetailsFromParameters = function (parameters) {
|
|
192
|
-
var _this = this;
|
|
193
|
-
var defaultDetails = {
|
|
41
|
+
async getOptions() {
|
|
42
|
+
return this.options;
|
|
43
|
+
}
|
|
44
|
+
async getBalanceOfPublicKey(publicKey, data) {
|
|
45
|
+
const address = await this.getAddressFromPublicKey(publicKey);
|
|
46
|
+
return this.getBalanceOfAddresses([address.address], data);
|
|
47
|
+
}
|
|
48
|
+
async getAvailableBalanceOfAddresses(addresses, data) {
|
|
49
|
+
return this.getBalanceOfAddresses(addresses, data);
|
|
50
|
+
}
|
|
51
|
+
async getBalanceOfAddresses(addresses, data) {
|
|
52
|
+
const results = await this.balanceOf(addresses.map((address) => {
|
|
53
|
+
return {
|
|
54
|
+
address,
|
|
55
|
+
tokenID: data?.assetID ?? this.tokenID ?? 0
|
|
56
|
+
};
|
|
57
|
+
}, this.defaultSourceAddress));
|
|
58
|
+
return results.reduce((sum, next) => sum.plus(next.amount), new bignumber_1.default(0)).toFixed();
|
|
59
|
+
}
|
|
60
|
+
async estimateFeeDefaultsFromPublicKey(publicKey, recipients, values, data) {
|
|
61
|
+
// return this.feeDefaults
|
|
62
|
+
if (recipients.length !== values.length) {
|
|
63
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
|
|
64
|
+
}
|
|
65
|
+
const transferCall = await this.createTransferCall(publicKey, recipients, values, this.feeDefaults.medium, data);
|
|
66
|
+
const operation = {
|
|
67
|
+
kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
|
|
68
|
+
amount: '0',
|
|
69
|
+
destination: this.contractAddress,
|
|
70
|
+
parameters: transferCall.toJSON(),
|
|
71
|
+
fee: '0'
|
|
72
|
+
};
|
|
73
|
+
return this.estimateFeeDefaultsForOperations(publicKey, [operation]);
|
|
74
|
+
}
|
|
75
|
+
async prepareTransactionFromPublicKey(publicKey, recipients, values, fee, data) {
|
|
76
|
+
const transferCall = await this.createTransferCall(publicKey, recipients, values, fee, data);
|
|
77
|
+
return this.prepareContractCall([transferCall], fee, publicKey);
|
|
78
|
+
}
|
|
79
|
+
transactionDetailsFromParameters(parameters) {
|
|
80
|
+
const defaultDetails = {
|
|
194
81
|
extra: {
|
|
195
82
|
type: parameters.entrypoint
|
|
196
83
|
}
|
|
@@ -200,253 +87,177 @@ var TezosFA2Protocol = /** @class */ (function (_super) {
|
|
|
200
87
|
return [defaultDetails];
|
|
201
88
|
}
|
|
202
89
|
try {
|
|
203
|
-
|
|
204
|
-
return MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, function (fromJSON) { return MichelsonAddress_1.MichelsonAddress.from(fromJSON, 'from_'); }, function (txsJSON) {
|
|
205
|
-
return MichelsonList_1.MichelsonList.from(txsJSON, function (pairJSON) {
|
|
206
|
-
return MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, function (toJSON) { return MichelsonAddress_1.MichelsonAddress.from(toJSON, 'to_'); }, function (pairJSON) {
|
|
207
|
-
return MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, function (tokenJSON) { return MichelsonInt_1.MichelsonInt.from(tokenJSON, 'token_id'); }, function (amountJSON) { return MichelsonInt_1.MichelsonInt.from(amountJSON, 'amount'); });
|
|
208
|
-
});
|
|
209
|
-
}, 'txs');
|
|
210
|
-
});
|
|
211
|
-
}).asRawValue();
|
|
90
|
+
const callArgumentsList = MichelsonList_1.MichelsonList.from(parameters.value, (pairJSON) => MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, (fromJSON) => MichelsonAddress_1.MichelsonAddress.from(fromJSON, 'from_'), (txsJSON) => MichelsonList_1.MichelsonList.from(txsJSON, (pairJSON) => MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, (toJSON) => MichelsonAddress_1.MichelsonAddress.from(toJSON, 'to_'), (pairJSON) => MichelsonPair_1.MichelsonPair.from(pairJSON, undefined, (tokenJSON) => MichelsonInt_1.MichelsonInt.from(tokenJSON, 'token_id'), (amountJSON) => MichelsonInt_1.MichelsonInt.from(amountJSON, 'amount'))), 'txs'))).asRawValue();
|
|
212
91
|
return Array.isArray(callArgumentsList)
|
|
213
92
|
? callArgumentsList
|
|
214
|
-
.map(
|
|
215
|
-
if (!
|
|
93
|
+
.map((callArguments) => {
|
|
94
|
+
if (!this.isTransferRequest(callArguments)) {
|
|
216
95
|
return [];
|
|
217
96
|
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
97
|
+
const from = (0, hex_1.isHex)(callArguments.from_) ? TezosUtils_1.TezosUtils.parseAddress(callArguments.from_) : callArguments.from_;
|
|
98
|
+
const transferDetails = callArguments.txs.map((tx) => {
|
|
99
|
+
const to = (0, hex_1.isHex)(tx.to_) ? TezosUtils_1.TezosUtils.parseAddress(tx.to_) : tx.to_;
|
|
221
100
|
return [to, tx.token_id, tx.amount];
|
|
222
101
|
});
|
|
223
102
|
return transferDetails
|
|
224
|
-
.map(
|
|
225
|
-
|
|
226
|
-
if (_this.tokenID !== undefined && !tokenID.eq(_this.tokenID)) {
|
|
103
|
+
.map(([to, tokenID, amount]) => {
|
|
104
|
+
if (this.tokenID !== undefined && !tokenID.eq(this.tokenID)) {
|
|
227
105
|
return undefined;
|
|
228
106
|
}
|
|
229
|
-
return
|
|
107
|
+
return {
|
|
108
|
+
...defaultDetails,
|
|
109
|
+
amount: amount.toFixed(),
|
|
110
|
+
from: [from],
|
|
111
|
+
to: [to],
|
|
112
|
+
extra: {
|
|
230
113
|
type: parameters.entrypoint,
|
|
231
114
|
assetID: tokenID.toNumber()
|
|
232
|
-
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
233
117
|
})
|
|
234
|
-
.filter(
|
|
118
|
+
.filter((partialDetails) => partialDetails !== undefined);
|
|
235
119
|
})
|
|
236
|
-
.reduce(
|
|
120
|
+
.reduce((flatten, next) => flatten.concat(next), [])
|
|
237
121
|
: [defaultDetails];
|
|
238
122
|
}
|
|
239
|
-
catch
|
|
123
|
+
catch {
|
|
240
124
|
return [defaultDetails];
|
|
241
125
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
owner: request.address,
|
|
253
|
-
token_id: typeof request.tokenID === 'string' ? parseInt(request.tokenID, 10) : request.tokenID
|
|
254
|
-
};
|
|
255
|
-
}),
|
|
256
|
-
callback: callbackContract
|
|
257
|
-
})];
|
|
258
|
-
case 1:
|
|
259
|
-
balanceOfCall = _a.sent();
|
|
260
|
-
return [4 /*yield*/, this.runContractCall(balanceOfCall, this.requireSource(source))];
|
|
261
|
-
case 2:
|
|
262
|
-
results = _a.sent();
|
|
263
|
-
if ((0, utils_1.isMichelineSequence)(results)) {
|
|
264
|
-
return [2 /*return*/, results
|
|
265
|
-
.map(function (node) {
|
|
266
|
-
try {
|
|
267
|
-
var pair = MichelsonPair_1.MichelsonPair.from(node, undefined, function (value) { return MichelsonPair_1.MichelsonPair.from(value, undefined, MichelsonAddress_1.MichelsonAddress.from, MichelsonInt_1.MichelsonInt.from); }, MichelsonInt_1.MichelsonInt.from);
|
|
268
|
-
var accountWithTokenID = MichelsonPair_1.MichelsonPair.from(pair.items[0].get());
|
|
269
|
-
var account = MichelsonAddress_1.MichelsonAddress.from(accountWithTokenID.items[0].get());
|
|
270
|
-
var tokenID = MichelsonInt_1.MichelsonInt.from(accountWithTokenID.items[1].get());
|
|
271
|
-
var amount = MichelsonInt_1.MichelsonInt.from(pair.items[1].get());
|
|
272
|
-
return {
|
|
273
|
-
address: account.address instanceof MichelsonString_1.MichelsonString ? account.address.value : TezosUtils_1.TezosUtils.parseAddress(account.address.value),
|
|
274
|
-
tokenID: tokenID.value.toNumber(),
|
|
275
|
-
amount: amount.value.toFixed()
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
catch (error) {
|
|
279
|
-
console.warn(error);
|
|
280
|
-
return undefined;
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
|
-
.filter(function (balanceOfResults) { return balanceOfResults !== undefined; })];
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
286
|
-
return [2 /*return*/, []];
|
|
287
|
-
}
|
|
288
|
-
return [2 /*return*/];
|
|
289
|
-
}
|
|
290
|
-
});
|
|
126
|
+
}
|
|
127
|
+
async balanceOf(balanceRequests, source, callbackContract = this.callbackContract(TezosFA2ContractEntrypoint.BALANCE)) {
|
|
128
|
+
const balanceOfCall = await this.contract.createContractCall(TezosFA2ContractEntrypoint.BALANCE, {
|
|
129
|
+
requests: balanceRequests.map((request) => {
|
|
130
|
+
return {
|
|
131
|
+
owner: request.address,
|
|
132
|
+
token_id: typeof request.tokenID === 'string' ? parseInt(request.tokenID, 10) : request.tokenID
|
|
133
|
+
};
|
|
134
|
+
}),
|
|
135
|
+
callback: callbackContract
|
|
291
136
|
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
})
|
|
308
|
-
};
|
|
309
|
-
}))];
|
|
310
|
-
case 1:
|
|
311
|
-
transferCall = _a.sent();
|
|
312
|
-
return [2 /*return*/, this.prepareContractCall([transferCall], fee, publicKey)];
|
|
137
|
+
const results = await this.runContractCall(balanceOfCall, this.requireSource(source));
|
|
138
|
+
if ((0, utils_1.isMichelineSequence)(results)) {
|
|
139
|
+
return results
|
|
140
|
+
.map((node) => {
|
|
141
|
+
try {
|
|
142
|
+
const pair = MichelsonPair_1.MichelsonPair.from(node, undefined, (value) => MichelsonPair_1.MichelsonPair.from(value, undefined, MichelsonAddress_1.MichelsonAddress.from, MichelsonInt_1.MichelsonInt.from), MichelsonInt_1.MichelsonInt.from);
|
|
143
|
+
const accountWithTokenID = MichelsonPair_1.MichelsonPair.from(pair.items[0].get());
|
|
144
|
+
const account = MichelsonAddress_1.MichelsonAddress.from(accountWithTokenID.items[0].get());
|
|
145
|
+
const tokenID = MichelsonInt_1.MichelsonInt.from(accountWithTokenID.items[1].get());
|
|
146
|
+
const amount = MichelsonInt_1.MichelsonInt.from(pair.items[1].get());
|
|
147
|
+
return {
|
|
148
|
+
address: account.address instanceof MichelsonString_1.MichelsonString ? account.address.value : TezosUtils_1.TezosUtils.parseAddress(account.address.value),
|
|
149
|
+
tokenID: tokenID.value.toNumber(),
|
|
150
|
+
amount: amount.value.toFixed()
|
|
151
|
+
};
|
|
313
152
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
TezosFA2Protocol.prototype.updateOperators = function (updateRequests, fee, publicKey) {
|
|
318
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
319
|
-
var updateCall;
|
|
320
|
-
return __generator(this, function (_a) {
|
|
321
|
-
switch (_a.label) {
|
|
322
|
-
case 0: return [4 /*yield*/, this.contract.createContractCall(TezosFA2ContractEntrypoint.UPDATE_OPERATORS, updateRequests.map(function (request) {
|
|
323
|
-
var _a;
|
|
324
|
-
var args = (_a = {},
|
|
325
|
-
_a["".concat(request.operation, "_operator")] = {
|
|
326
|
-
owner: request.owner,
|
|
327
|
-
operator: request.operator,
|
|
328
|
-
token_id: request.tokenId
|
|
329
|
-
},
|
|
330
|
-
_a);
|
|
331
|
-
return [request.operation === 'add' ? 'Left' : 'Right', args];
|
|
332
|
-
}))];
|
|
333
|
-
case 1:
|
|
334
|
-
updateCall = _a.sent();
|
|
335
|
-
return [2 /*return*/, this.prepareContractCall([updateCall], fee, publicKey)];
|
|
153
|
+
catch (error) {
|
|
154
|
+
console.warn(error);
|
|
155
|
+
return undefined;
|
|
336
156
|
}
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
case 1:
|
|
367
|
-
bigMaps = _b.sent();
|
|
368
|
-
bigMapIndex = this.options.config.totalSupplyBigMapID;
|
|
369
|
-
bigMap = undefined;
|
|
370
|
-
if (bigMapIndex !== undefined) {
|
|
371
|
-
bigMap = bigMaps.find(function (bigMap) { return bigMap.id === bigMapIndex; });
|
|
372
|
-
}
|
|
373
|
-
else {
|
|
374
|
-
bigMap = bigMaps.find(function (bigMap) {
|
|
375
|
-
return (bigMap.path === 'total_supply' || bigMap.path.endsWith('.total_supply')) &&
|
|
376
|
-
(0, utils_1.isMichelinePrimitiveApplication)('nat', bigMap.keyType) &&
|
|
377
|
-
(0, utils_1.isMichelinePrimitiveApplication)('nat', bigMap.valueType);
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
return [4 /*yield*/, this.contract.getBigMapValue({
|
|
381
|
-
bigMap: bigMap,
|
|
382
|
-
key: "".concat((_a = tokenID !== null && tokenID !== void 0 ? tokenID : this.tokenID) !== null && _a !== void 0 ? _a : 0),
|
|
383
|
-
resultType: 'micheline'
|
|
384
|
-
})];
|
|
385
|
-
case 2:
|
|
386
|
-
result = _b.sent();
|
|
387
|
-
if (result !== undefined && (0, utils_1.isMichelinePrimitive)('int', result.value)) {
|
|
388
|
-
return [2 /*return*/, result.value.int];
|
|
389
|
-
}
|
|
390
|
-
return [2 /*return*/, '0'];
|
|
157
|
+
})
|
|
158
|
+
.filter((balanceOfResults) => balanceOfResults !== undefined);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
return [];
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
async transfer(transferRequests, fee, publicKey) {
|
|
165
|
+
const transferCall = await this.contract.createContractCall(TezosFA2ContractEntrypoint.TRANSFER, transferRequests.map((request) => {
|
|
166
|
+
return {
|
|
167
|
+
from_: request.from,
|
|
168
|
+
txs: request.txs.map((tx) => {
|
|
169
|
+
return {
|
|
170
|
+
to_: tx.to,
|
|
171
|
+
token_id: tx.tokenID,
|
|
172
|
+
amount: tx.amount
|
|
173
|
+
};
|
|
174
|
+
})
|
|
175
|
+
};
|
|
176
|
+
}));
|
|
177
|
+
return this.prepareContractCall([transferCall], fee, publicKey);
|
|
178
|
+
}
|
|
179
|
+
async updateOperators(updateRequests, fee, publicKey) {
|
|
180
|
+
const updateCall = await this.contract.createContractCall(TezosFA2ContractEntrypoint.UPDATE_OPERATORS, updateRequests.map((request) => {
|
|
181
|
+
const args = {
|
|
182
|
+
[`${request.operation}_operator`]: {
|
|
183
|
+
owner: request.owner,
|
|
184
|
+
operator: request.operator,
|
|
185
|
+
token_id: request.tokenId
|
|
391
186
|
}
|
|
392
|
-
}
|
|
187
|
+
};
|
|
188
|
+
return [request.operation === 'add' ? 'Left' : 'Right', args];
|
|
189
|
+
}));
|
|
190
|
+
return this.prepareContractCall([updateCall], fee, publicKey);
|
|
191
|
+
}
|
|
192
|
+
async getTokenMetadata(tokenID) {
|
|
193
|
+
return this.getTokenMetadataForTokenID(tokenID ?? this.tokenID ?? 0);
|
|
194
|
+
}
|
|
195
|
+
async fetchTokenHolders(tokenID) {
|
|
196
|
+
return this.contract.network.extras.indexerClient.getTokenBalances({
|
|
197
|
+
contractAddress: this.contract.address,
|
|
198
|
+
id: tokenID ?? this.tokenID ?? 0
|
|
393
199
|
});
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
throw new errors_1.NotFoundError(coinlib_error_1.Domain.TEZOSFA, "no kt-address with index ".concat(addressIndex, " exists"));
|
|
412
|
-
}
|
|
413
|
-
fromAddress = addresses[addressIndex];
|
|
414
|
-
recipientsWithValues = recipients.map(function (recipient, index) { return [recipient, values[index]]; });
|
|
415
|
-
return [4 /*yield*/, this.contract.createContractCall(TezosFA2ContractEntrypoint.TRANSFER, [
|
|
416
|
-
{
|
|
417
|
-
from_: fromAddress,
|
|
418
|
-
txs: recipientsWithValues.map(function (_a) {
|
|
419
|
-
var recipient = _a[0], value = _a[1];
|
|
420
|
-
return {
|
|
421
|
-
to_: recipient,
|
|
422
|
-
token_id: tokenID,
|
|
423
|
-
amount: value
|
|
424
|
-
};
|
|
425
|
-
})
|
|
426
|
-
}
|
|
427
|
-
])];
|
|
428
|
-
case 2:
|
|
429
|
-
transferCall = _d.sent();
|
|
430
|
-
return [2 /*return*/, transferCall];
|
|
431
|
-
}
|
|
432
|
-
});
|
|
200
|
+
}
|
|
201
|
+
async getTotalSupply(tokenID) {
|
|
202
|
+
const bigMaps = await this.contract.getBigMaps();
|
|
203
|
+
const bigMapIndex = this.options.config.totalSupplyBigMapID;
|
|
204
|
+
let bigMap = undefined;
|
|
205
|
+
if (bigMapIndex !== undefined) {
|
|
206
|
+
bigMap = bigMaps.find((bigMap) => bigMap.id === bigMapIndex);
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
bigMap = bigMaps.find((bigMap) => (bigMap.path === 'total_supply' || bigMap.path.endsWith('.total_supply')) &&
|
|
210
|
+
(0, utils_1.isMichelinePrimitiveApplication)('nat', bigMap.keyType) &&
|
|
211
|
+
(0, utils_1.isMichelinePrimitiveApplication)('nat', bigMap.valueType));
|
|
212
|
+
}
|
|
213
|
+
const result = await this.contract.getBigMapValue({
|
|
214
|
+
bigMap,
|
|
215
|
+
key: `${tokenID ?? this.tokenID ?? 0}`,
|
|
216
|
+
resultType: 'micheline'
|
|
433
217
|
});
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
218
|
+
if (result !== undefined && (0, utils_1.isMichelinePrimitive)('int', result.value)) {
|
|
219
|
+
return result.value.int;
|
|
220
|
+
}
|
|
221
|
+
return '0';
|
|
222
|
+
}
|
|
223
|
+
async createTransferCall(publicKey, recipients, values, fee, data) {
|
|
224
|
+
if (recipients.length !== values.length) {
|
|
225
|
+
throw new errors_1.ConditionViolationError(coinlib_error_1.Domain.TEZOSFA, 'length of recipients and values does not match!');
|
|
226
|
+
}
|
|
227
|
+
const addressIndex = data?.addressIndex ?? 0;
|
|
228
|
+
const tokenID = data?.assetID ?? this.tokenID ?? 0;
|
|
229
|
+
const addresses = (await this.getAddressesFromPublicKey(publicKey)).map((address) => address.address);
|
|
230
|
+
if (!addresses[addressIndex]) {
|
|
231
|
+
throw new errors_1.NotFoundError(coinlib_error_1.Domain.TEZOSFA, `no kt-address with index ${addressIndex} exists`);
|
|
232
|
+
}
|
|
233
|
+
const fromAddress = addresses[addressIndex];
|
|
234
|
+
const recipientsWithValues = recipients.map((recipient, index) => [recipient, values[index]]);
|
|
235
|
+
const transferCall = await this.contract.createContractCall(TezosFA2ContractEntrypoint.TRANSFER, [
|
|
236
|
+
{
|
|
237
|
+
from_: fromAddress,
|
|
238
|
+
txs: recipientsWithValues.map(([recipient, value]) => {
|
|
239
|
+
return {
|
|
240
|
+
to_: recipient,
|
|
241
|
+
token_id: tokenID,
|
|
242
|
+
amount: value
|
|
243
|
+
};
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
]);
|
|
247
|
+
return transferCall;
|
|
248
|
+
}
|
|
249
|
+
callbackContract(entrypoint) {
|
|
250
|
+
const networkCallbacks = this.defaultCallbackContract[this.options.network.extras.network];
|
|
251
|
+
const callback = networkCallbacks ? networkCallbacks[entrypoint] : undefined;
|
|
252
|
+
return callback ?? '';
|
|
253
|
+
}
|
|
254
|
+
isTransferRequest(obj) {
|
|
255
|
+
const anyObj = obj;
|
|
442
256
|
return (anyObj instanceof Object &&
|
|
443
257
|
typeof anyObj.from_ === 'string' &&
|
|
444
258
|
Array.isArray(anyObj.txs) &&
|
|
445
|
-
anyObj.txs.every(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
};
|
|
449
|
-
return TezosFA2Protocol;
|
|
450
|
-
}(TezosFAProtocol_1.TezosFAProtocol));
|
|
259
|
+
anyObj.txs.every((tx) => tx instanceof Object && typeof tx.to_ === 'string' && bignumber_1.default.isBigNumber(tx.token_id) && bignumber_1.default.isBigNumber(tx.amount)));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
451
262
|
exports.TezosFA2Protocol = TezosFA2Protocol;
|
|
452
263
|
//# sourceMappingURL=TezosFA2Protocol.js.map
|