@airgap/tezos 0.13.7-beta.22 → 0.13.7-beta.26

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.
Files changed (998) hide show
  1. package/airgap-coinlib-tezos.min.js +35555 -22872
  2. package/index.d.ts +1 -46
  3. package/index.js +15 -100
  4. package/index.js.map +1 -1
  5. package/package.json +5 -3
  6. package/{actions → v0/actions}/GetKtAccountsAction.d.ts +0 -0
  7. package/v0/actions/GetKtAccountsAction.js +87 -0
  8. package/v0/actions/GetKtAccountsAction.js.map +1 -0
  9. package/{constants.d.ts → v0/constants.d.ts} +0 -0
  10. package/{constants.js → v0/constants.js} +0 -0
  11. package/v0/constants.js.map +1 -0
  12. package/v0/index.d.ts +46 -0
  13. package/v0/index.js +146 -0
  14. package/v0/index.js.map +1 -0
  15. package/{protocol → v0/protocol}/TezosAddress.d.ts +0 -0
  16. package/v0/protocol/TezosAddress.js +106 -0
  17. package/v0/protocol/TezosAddress.js.map +1 -0
  18. package/{protocol → v0/protocol}/TezosCryptoClient.d.ts +0 -0
  19. package/v0/protocol/TezosCryptoClient.js +158 -0
  20. package/v0/protocol/TezosCryptoClient.js.map +1 -0
  21. package/{protocol → v0/protocol}/TezosProtocol.d.ts +0 -0
  22. package/v0/protocol/TezosProtocol.js +1859 -0
  23. package/v0/protocol/TezosProtocol.js.map +1 -0
  24. package/{protocol → v0/protocol}/TezosProtocolOptions.d.ts +0 -0
  25. package/v0/protocol/TezosProtocolOptions.js +116 -0
  26. package/v0/protocol/TezosProtocolOptions.js.map +1 -0
  27. package/{protocol → v0/protocol}/TezosUtils.d.ts +0 -0
  28. package/v0/protocol/TezosUtils.js +300 -0
  29. package/v0/protocol/TezosUtils.js.map +1 -0
  30. package/{protocol → v0/protocol}/contract/TezosContract.d.ts +0 -0
  31. package/v0/protocol/contract/TezosContract.js +510 -0
  32. package/v0/protocol/contract/TezosContract.js.map +1 -0
  33. package/v0/protocol/contract/TezosContractCall.d.ts +11 -0
  34. package/{protocol → v0/protocol}/contract/TezosContractCall.js +0 -0
  35. package/v0/protocol/contract/TezosContractCall.js.map +1 -0
  36. package/{protocol → v0/protocol}/contract/TezosContractEntrypoint.d.ts +0 -0
  37. package/v0/protocol/contract/TezosContractEntrypoint.js +27 -0
  38. package/v0/protocol/contract/TezosContractEntrypoint.js.map +1 -0
  39. package/{protocol → v0/protocol}/contract/TezosContractStorage.d.ts +0 -0
  40. package/{protocol → v0/protocol}/contract/TezosContractStorage.js +0 -0
  41. package/v0/protocol/contract/TezosContractStorage.js.map +1 -0
  42. package/{protocol → v0/protocol}/contract/remote-data/TezosContractRemoteDataFactory.d.ts +0 -0
  43. package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +36 -0
  44. package/v0/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -0
  45. package/{protocol → v0/protocol}/contract/remote-data/TezosStorageRemoteData.d.ts +0 -0
  46. package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js +152 -0
  47. package/v0/protocol/contract/remote-data/TezosStorageRemoteData.js.map +1 -0
  48. package/{protocol → v0/protocol}/domains/TezosDomains.d.ts +0 -0
  49. package/v0/protocol/domains/TezosDomains.js +306 -0
  50. package/v0/protocol/domains/TezosDomains.js.map +1 -0
  51. package/{protocol → v0/protocol}/fa/TezosBTC.d.ts +0 -0
  52. package/v0/protocol/fa/TezosBTC.js +109 -0
  53. package/v0/protocol/fa/TezosBTC.js.map +1 -0
  54. package/{protocol → v0/protocol}/fa/TezosBTCtez.d.ts +0 -0
  55. package/v0/protocol/fa/TezosBTCtez.js +56 -0
  56. package/v0/protocol/fa/TezosBTCtez.js.map +1 -0
  57. package/{protocol → v0/protocol}/fa/TezosCTez.d.ts +0 -0
  58. package/v0/protocol/fa/TezosCTez.js +53 -0
  59. package/v0/protocol/fa/TezosCTez.js.map +1 -0
  60. package/{protocol → v0/protocol}/fa/TezosDOGA.d.ts +0 -0
  61. package/v0/protocol/fa/TezosDOGA.js +53 -0
  62. package/v0/protocol/fa/TezosDOGA.js.map +1 -0
  63. package/{protocol → v0/protocol}/fa/TezosETHtz.d.ts +0 -0
  64. package/v0/protocol/fa/TezosETHtz.js +74 -0
  65. package/v0/protocol/fa/TezosETHtz.js.map +1 -0
  66. package/{protocol → v0/protocol}/fa/TezosFA1Protocol.d.ts +0 -0
  67. package/v0/protocol/fa/TezosFA1Protocol.js +312 -0
  68. package/v0/protocol/fa/TezosFA1Protocol.js.map +1 -0
  69. package/{protocol → v0/protocol}/fa/TezosFA1p2Protocol.d.ts +0 -0
  70. package/v0/protocol/fa/TezosFA1p2Protocol.js +119 -0
  71. package/v0/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
  72. package/{protocol → v0/protocol}/fa/TezosFA2Protocol.d.ts +0 -0
  73. package/v0/protocol/fa/TezosFA2Protocol.js +451 -0
  74. package/v0/protocol/fa/TezosFA2Protocol.js.map +1 -0
  75. package/{protocol → v0/protocol}/fa/TezosFAProtocol.d.ts +0 -0
  76. package/v0/protocol/fa/TezosFAProtocol.js +513 -0
  77. package/v0/protocol/fa/TezosFAProtocol.js.map +1 -0
  78. package/{protocol → v0/protocol}/fa/TezosFAProtocolOptions.d.ts +0 -0
  79. package/v0/protocol/fa/TezosFAProtocolOptions.js +230 -0
  80. package/v0/protocol/fa/TezosFAProtocolOptions.js.map +1 -0
  81. package/{protocol → v0/protocol}/fa/TezosKolibriUSD.d.ts +0 -0
  82. package/v0/protocol/fa/TezosKolibriUSD.js +76 -0
  83. package/v0/protocol/fa/TezosKolibriUSD.js.map +1 -0
  84. package/{protocol → v0/protocol}/fa/TezosPlanty.d.ts +0 -0
  85. package/v0/protocol/fa/TezosPlanty.js +53 -0
  86. package/v0/protocol/fa/TezosPlanty.js.map +1 -0
  87. package/{protocol → v0/protocol}/fa/TezosQUIPU.d.ts +0 -0
  88. package/v0/protocol/fa/TezosQUIPU.js +56 -0
  89. package/v0/protocol/fa/TezosQUIPU.js.map +1 -0
  90. package/{protocol → v0/protocol}/fa/TezosSIRS.d.ts +0 -0
  91. package/v0/protocol/fa/TezosSIRS.js +53 -0
  92. package/v0/protocol/fa/TezosSIRS.js.map +1 -0
  93. package/{protocol → v0/protocol}/fa/TezosStaker.d.ts +0 -0
  94. package/v0/protocol/fa/TezosStaker.js +76 -0
  95. package/v0/protocol/fa/TezosStaker.js.map +1 -0
  96. package/{protocol → v0/protocol}/fa/TezosUBTC.d.ts +0 -0
  97. package/v0/protocol/fa/TezosUBTC.js +56 -0
  98. package/v0/protocol/fa/TezosUBTC.js.map +1 -0
  99. package/{protocol → v0/protocol}/fa/TezosUDEFI.d.ts +0 -0
  100. package/v0/protocol/fa/TezosUDEFI.js +56 -0
  101. package/v0/protocol/fa/TezosUDEFI.js.map +1 -0
  102. package/{protocol → v0/protocol}/fa/TezosUSD.d.ts +0 -0
  103. package/v0/protocol/fa/TezosUSD.js +76 -0
  104. package/v0/protocol/fa/TezosUSD.js.map +1 -0
  105. package/{protocol → v0/protocol}/fa/TezosUSDT.d.ts +0 -0
  106. package/v0/protocol/fa/TezosUSDT.js +56 -0
  107. package/v0/protocol/fa/TezosUSDT.js.map +1 -0
  108. package/{protocol → v0/protocol}/fa/TezosUUSD.d.ts +0 -0
  109. package/v0/protocol/fa/TezosUUSD.js +33 -0
  110. package/v0/protocol/fa/TezosUUSD.js.map +1 -0
  111. package/{protocol → v0/protocol}/fa/TezosWRAP.d.ts +0 -0
  112. package/v0/protocol/fa/TezosWRAP.js +56 -0
  113. package/v0/protocol/fa/TezosWRAP.js.map +1 -0
  114. package/{protocol → v0/protocol}/fa/TezosWrapped.d.ts +0 -0
  115. package/v0/protocol/fa/TezosWrapped.js +76 -0
  116. package/v0/protocol/fa/TezosWrapped.js.map +1 -0
  117. package/{protocol → v0/protocol}/fa/TezosYOU.d.ts +0 -0
  118. package/v0/protocol/fa/TezosYOU.js +33 -0
  119. package/v0/protocol/fa/TezosYOU.js.map +1 -0
  120. package/{protocol → v0/protocol}/indexerClient/TezosIndexerClient.d.ts +0 -0
  121. package/v0/protocol/indexerClient/TezosIndexerClient.js +269 -0
  122. package/v0/protocol/indexerClient/TezosIndexerClient.js.map +1 -0
  123. package/{protocol → v0/protocol}/indexerClient/TezosProtocolIndexerClient.d.ts +0 -0
  124. package/{protocol → v0/protocol}/indexerClient/TezosProtocolIndexerClient.js +0 -0
  125. package/v0/protocol/indexerClient/TezosProtocolIndexerClient.js.map +1 -0
  126. package/{protocol → v0/protocol}/kt/TezosKtAddress.d.ts +0 -0
  127. package/v0/protocol/kt/TezosKtAddress.js +74 -0
  128. package/v0/protocol/kt/TezosKtAddress.js.map +1 -0
  129. package/{protocol → v0/protocol}/kt/TezosKtProtocol.d.ts +0 -0
  130. package/v0/protocol/kt/TezosKtProtocol.js +320 -0
  131. package/v0/protocol/kt/TezosKtProtocol.js.map +1 -0
  132. package/{protocol → v0/protocol}/sapling/TezosSaplingAddress.d.ts +0 -0
  133. package/v0/protocol/sapling/TezosSaplingAddress.js +140 -0
  134. package/v0/protocol/sapling/TezosSaplingAddress.js.map +1 -0
  135. package/{protocol → v0/protocol}/sapling/TezosSaplingCryptoClient.d.ts +0 -0
  136. package/v0/protocol/sapling/TezosSaplingCryptoClient.js +248 -0
  137. package/v0/protocol/sapling/TezosSaplingCryptoClient.js.map +1 -0
  138. package/{protocol → v0/protocol}/sapling/TezosSaplingProtocol.d.ts +0 -0
  139. package/v0/protocol/sapling/TezosSaplingProtocol.js +1184 -0
  140. package/v0/protocol/sapling/TezosSaplingProtocol.js.map +1 -0
  141. package/{protocol → v0/protocol}/sapling/TezosSaplingProtocolOptions.d.ts +0 -0
  142. package/v0/protocol/sapling/TezosSaplingProtocolOptions.js +81 -0
  143. package/v0/protocol/sapling/TezosSaplingProtocolOptions.js.map +1 -0
  144. package/{protocol → v0/protocol}/sapling/TezosShieldedTezProtocol.d.ts +0 -0
  145. package/v0/protocol/sapling/TezosShieldedTezProtocol.js +142 -0
  146. package/v0/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -0
  147. package/{protocol → v0/protocol}/sapling/injector/TezosSaplingInjectorClient.d.ts +0 -0
  148. package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js +68 -0
  149. package/v0/protocol/sapling/injector/TezosSaplingInjectorClient.js.map +1 -0
  150. package/{protocol → v0/protocol}/sapling/node/TezosSaplingNodeClient.d.ts +0 -0
  151. package/v0/protocol/sapling/node/TezosSaplingNodeClient.js +78 -0
  152. package/v0/protocol/sapling/node/TezosSaplingNodeClient.js.map +1 -0
  153. package/{protocol → v0/protocol}/sapling/utils/TezosSaplingBookkeeper.d.ts +0 -0
  154. package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js +591 -0
  155. package/v0/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +1 -0
  156. package/{protocol → v0/protocol}/sapling/utils/TezosSaplingEncoder.d.ts +0 -0
  157. package/v0/protocol/sapling/utils/TezosSaplingEncoder.js +158 -0
  158. package/v0/protocol/sapling/utils/TezosSaplingEncoder.js.map +1 -0
  159. package/{protocol → v0/protocol}/sapling/utils/TezosSaplingForger.d.ts +0 -0
  160. package/v0/protocol/sapling/utils/TezosSaplingForger.js +284 -0
  161. package/v0/protocol/sapling/utils/TezosSaplingForger.js.map +1 -0
  162. package/{protocol → v0/protocol}/sapling/utils/TezosSaplingState.d.ts +0 -0
  163. package/v0/protocol/sapling/utils/TezosSaplingState.js +266 -0
  164. package/v0/protocol/sapling/utils/TezosSaplingState.js.map +1 -0
  165. package/{protocol → v0/protocol}/types/TezosAddressCursor.d.ts +0 -0
  166. package/{protocol → v0/protocol}/types/TezosAddressCursor.js +0 -0
  167. package/v0/protocol/types/TezosAddressCursor.js.map +1 -0
  168. package/{protocol → v0/protocol}/types/TezosAddressResult.d.ts +0 -0
  169. package/{protocol → v0/protocol}/types/TezosAddressResult.js +0 -0
  170. package/v0/protocol/types/TezosAddressResult.js.map +1 -0
  171. package/{protocol → v0/protocol}/types/TezosBlockHeader.d.ts +0 -0
  172. package/{protocol → v0/protocol}/types/TezosBlockHeader.js +0 -0
  173. package/v0/protocol/types/TezosBlockHeader.js.map +1 -0
  174. package/{protocol → v0/protocol}/types/TezosBlockMetadata.d.ts +0 -0
  175. package/{protocol → v0/protocol}/types/TezosBlockMetadata.js +0 -0
  176. package/v0/protocol/types/TezosBlockMetadata.js.map +1 -0
  177. package/{protocol → v0/protocol}/types/TezosContractCode.d.ts +0 -0
  178. package/{protocol → v0/protocol}/types/TezosContractCode.js +0 -0
  179. package/v0/protocol/types/TezosContractCode.js.map +1 -0
  180. package/{protocol → v0/protocol}/types/TezosOperationType.d.ts +0 -0
  181. package/{protocol → v0/protocol}/types/TezosOperationType.js +0 -0
  182. package/v0/protocol/types/TezosOperationType.js.map +1 -0
  183. package/{protocol → v0/protocol}/types/TezosTransactionCursor.d.ts +0 -0
  184. package/{protocol → v0/protocol}/types/TezosTransactionCursor.js +0 -0
  185. package/v0/protocol/types/TezosTransactionCursor.js.map +1 -0
  186. package/{protocol → v0/protocol}/types/TezosTransactionResult.d.ts +0 -0
  187. package/{protocol → v0/protocol}/types/TezosTransactionResult.js +0 -0
  188. package/v0/protocol/types/TezosTransactionResult.js.map +1 -0
  189. package/{protocol → v0/protocol}/types/TezosWrappedOperation.d.ts +0 -0
  190. package/{protocol → v0/protocol}/types/TezosWrappedOperation.js +0 -0
  191. package/v0/protocol/types/TezosWrappedOperation.js.map +1 -0
  192. package/{protocol → v0/protocol}/types/contract/BigMap.d.ts +0 -0
  193. package/{protocol → v0/protocol}/types/contract/BigMap.js +0 -0
  194. package/v0/protocol/types/contract/BigMap.js.map +1 -0
  195. package/{protocol → v0/protocol}/types/contract/BigMapEnrtyFilter.d.ts +0 -0
  196. package/{protocol → v0/protocol}/types/contract/BigMapEnrtyFilter.js +0 -0
  197. package/v0/protocol/types/contract/BigMapEnrtyFilter.js.map +1 -0
  198. package/{protocol → v0/protocol}/types/contract/BigMapEntry.d.ts +0 -0
  199. package/{protocol → v0/protocol}/types/contract/BigMapEntry.js +0 -0
  200. package/v0/protocol/types/contract/BigMapEntry.js.map +1 -0
  201. package/{protocol → v0/protocol}/types/contract/BigMapRequest.d.ts +0 -0
  202. package/{protocol → v0/protocol}/types/contract/BigMapRequest.js +0 -0
  203. package/v0/protocol/types/contract/BigMapRequest.js.map +1 -0
  204. package/{protocol → v0/protocol}/types/contract/TezosContractMetadata.d.ts +0 -0
  205. package/{protocol → v0/protocol}/types/contract/TezosContractMetadata.js +0 -0
  206. package/v0/protocol/types/contract/TezosContractMetadata.js.map +1 -0
  207. package/{protocol → v0/protocol}/types/domains/TezosDomainsRecord.d.ts +0 -0
  208. package/{protocol → v0/protocol}/types/domains/TezosDomainsRecord.js +0 -0
  209. package/v0/protocol/types/domains/TezosDomainsRecord.js.map +1 -0
  210. package/{protocol → v0/protocol}/types/domains/TezosDomainsReverseRecord.d.ts +0 -0
  211. package/{protocol → v0/protocol}/types/domains/TezosDomainsReverseRecord.js +0 -0
  212. package/v0/protocol/types/domains/TezosDomainsReverseRecord.js.map +1 -0
  213. package/{protocol → v0/protocol}/types/fa/TezosFA2BalanceOfRequest.d.ts +0 -0
  214. package/{protocol → v0/protocol}/types/fa/TezosFA2BalanceOfRequest.js +0 -0
  215. package/v0/protocol/types/fa/TezosFA2BalanceOfRequest.js.map +1 -0
  216. package/{protocol → v0/protocol}/types/fa/TezosFA2BalanceOfResponse.d.ts +0 -0
  217. package/{protocol → v0/protocol}/types/fa/TezosFA2BalanceOfResponse.js +0 -0
  218. package/v0/protocol/types/fa/TezosFA2BalanceOfResponse.js.map +1 -0
  219. package/{protocol → v0/protocol}/types/fa/TezosFA2TransferRequest.d.ts +0 -0
  220. package/{protocol → v0/protocol}/types/fa/TezosFA2TransferRequest.js +0 -0
  221. package/v0/protocol/types/fa/TezosFA2TransferRequest.js.map +1 -0
  222. package/{protocol → v0/protocol}/types/fa/TezosFA2UpdateOperatorRequest.d.ts +0 -0
  223. package/{protocol → v0/protocol}/types/fa/TezosFA2UpdateOperatorRequest.js +0 -0
  224. package/v0/protocol/types/fa/TezosFA2UpdateOperatorRequest.js.map +1 -0
  225. package/{protocol → v0/protocol}/types/fa/TezosFATokenMetadata.d.ts +0 -0
  226. package/{protocol → v0/protocol}/types/fa/TezosFATokenMetadata.js +0 -0
  227. package/v0/protocol/types/fa/TezosFATokenMetadata.js.map +1 -0
  228. package/{protocol → v0/protocol}/types/kt/TezosKtAddressCursor.d.ts +0 -0
  229. package/{protocol → v0/protocol}/types/kt/TezosKtAddressCursor.js +0 -0
  230. package/v0/protocol/types/kt/TezosKtAddressCursor.js.map +1 -0
  231. package/{protocol → v0/protocol}/types/kt/TezosKtAddressResult.d.ts +0 -0
  232. package/{protocol → v0/protocol}/types/kt/TezosKtAddressResult.js +0 -0
  233. package/v0/protocol/types/kt/TezosKtAddressResult.js.map +1 -0
  234. package/{protocol → v0/protocol}/types/micheline/MichelineNode.d.ts +0 -0
  235. package/{protocol → v0/protocol}/types/micheline/MichelineNode.js +0 -0
  236. package/v0/protocol/types/micheline/MichelineNode.js.map +1 -0
  237. package/{protocol → v0/protocol}/types/micheline/MichelineNodeUtils.d.ts +0 -0
  238. package/v0/protocol/types/micheline/MichelineNodeUtils.js +40 -0
  239. package/v0/protocol/types/micheline/MichelineNodeUtils.js.map +1 -0
  240. package/{protocol → v0/protocol}/types/michelson/MichelsonType.d.ts +0 -0
  241. package/{protocol → v0/protocol}/types/michelson/MichelsonType.js +0 -0
  242. package/v0/protocol/types/michelson/MichelsonType.js.map +1 -0
  243. package/{protocol → v0/protocol}/types/michelson/MichelsonTypeMeta.d.ts +0 -0
  244. package/v0/protocol/types/michelson/MichelsonTypeMeta.js +136 -0
  245. package/v0/protocol/types/michelson/MichelsonTypeMeta.js.map +1 -0
  246. package/{protocol → v0/protocol}/types/michelson/MichelsonTypeUtils.d.ts +0 -0
  247. package/v0/protocol/types/michelson/MichelsonTypeUtils.js +251 -0
  248. package/v0/protocol/types/michelson/MichelsonTypeUtils.js.map +1 -0
  249. package/{protocol → v0/protocol}/types/michelson/generics/MichelsonList.d.ts +0 -0
  250. package/v0/protocol/types/michelson/generics/MichelsonList.js +70 -0
  251. package/v0/protocol/types/michelson/generics/MichelsonList.js.map +1 -0
  252. package/{protocol → v0/protocol}/types/michelson/generics/MichelsonMap.d.ts +0 -0
  253. package/v0/protocol/types/michelson/generics/MichelsonMap.js +120 -0
  254. package/v0/protocol/types/michelson/generics/MichelsonMap.js.map +1 -0
  255. package/{protocol → v0/protocol}/types/michelson/generics/MichelsonOption.d.ts +0 -0
  256. package/v0/protocol/types/michelson/generics/MichelsonOption.js +121 -0
  257. package/v0/protocol/types/michelson/generics/MichelsonOption.js.map +1 -0
  258. package/{protocol → v0/protocol}/types/michelson/generics/MichelsonOr.d.ts +0 -0
  259. package/v0/protocol/types/michelson/generics/MichelsonOr.js +134 -0
  260. package/v0/protocol/types/michelson/generics/MichelsonOr.js.map +1 -0
  261. package/{protocol → v0/protocol}/types/michelson/generics/MichelsonPair.d.ts +0 -0
  262. package/v0/protocol/types/michelson/generics/MichelsonPair.js +139 -0
  263. package/v0/protocol/types/michelson/generics/MichelsonPair.js.map +1 -0
  264. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarData.d.ts +0 -0
  265. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarData.js +0 -0
  266. package/v0/protocol/types/michelson/grammar/MichelsonGrammarData.js.map +1 -0
  267. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +0 -0
  268. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarInstruction.js +0 -0
  269. package/v0/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js.map +1 -0
  270. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarType.d.ts +0 -0
  271. package/{protocol → v0/protocol}/types/michelson/grammar/MichelsonGrammarType.js +0 -0
  272. package/v0/protocol/types/michelson/grammar/MichelsonGrammarType.js.map +1 -0
  273. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonAddress.d.ts +0 -0
  274. package/v0/protocol/types/michelson/primitives/MichelsonAddress.js +74 -0
  275. package/v0/protocol/types/michelson/primitives/MichelsonAddress.js.map +1 -0
  276. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonBool.d.ts +0 -0
  277. package/v0/protocol/types/michelson/primitives/MichelsonBool.js +59 -0
  278. package/v0/protocol/types/michelson/primitives/MichelsonBool.js.map +1 -0
  279. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonBytes.d.ts +0 -0
  280. package/v0/protocol/types/michelson/primitives/MichelsonBytes.js +77 -0
  281. package/v0/protocol/types/michelson/primitives/MichelsonBytes.js.map +1 -0
  282. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonInt.d.ts +0 -0
  283. package/v0/protocol/types/michelson/primitives/MichelsonInt.js +74 -0
  284. package/v0/protocol/types/michelson/primitives/MichelsonInt.js.map +1 -0
  285. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonString.d.ts +0 -0
  286. package/v0/protocol/types/michelson/primitives/MichelsonString.js +76 -0
  287. package/v0/protocol/types/michelson/primitives/MichelsonString.js.map +1 -0
  288. package/{protocol → v0/protocol}/types/michelson/primitives/MichelsonUnit.d.ts +0 -0
  289. package/v0/protocol/types/michelson/primitives/MichelsonUnit.js +55 -0
  290. package/v0/protocol/types/michelson/primitives/MichelsonUnit.js.map +1 -0
  291. package/{protocol → v0/protocol}/types/operations/ActivateAccount.d.ts +0 -0
  292. package/{protocol → v0/protocol}/types/operations/ActivateAccount.js +0 -0
  293. package/v0/protocol/types/operations/ActivateAccount.js.map +1 -0
  294. package/{protocol → v0/protocol}/types/operations/Ballot.d.ts +0 -0
  295. package/{protocol → v0/protocol}/types/operations/Ballot.js +0 -0
  296. package/v0/protocol/types/operations/Ballot.js.map +1 -0
  297. package/{protocol → v0/protocol}/types/operations/Delegation.d.ts +0 -0
  298. package/{protocol → v0/protocol}/types/operations/Delegation.js +0 -0
  299. package/v0/protocol/types/operations/Delegation.js.map +1 -0
  300. package/{protocol → v0/protocol}/types/operations/DoubleBakingEvidence.d.ts +0 -0
  301. package/{protocol → v0/protocol}/types/operations/DoubleBakingEvidence.js +0 -0
  302. package/v0/protocol/types/operations/DoubleBakingEvidence.js.map +1 -0
  303. package/{protocol → v0/protocol}/types/operations/DoubleEndorsementEvidence.d.ts +0 -0
  304. package/{protocol → v0/protocol}/types/operations/DoubleEndorsementEvidence.js +0 -0
  305. package/v0/protocol/types/operations/DoubleEndorsementEvidence.js.map +1 -0
  306. package/{protocol → v0/protocol}/types/operations/Endorsement.d.ts +0 -0
  307. package/{protocol → v0/protocol}/types/operations/Endorsement.js +0 -0
  308. package/v0/protocol/types/operations/Endorsement.js.map +1 -0
  309. package/{protocol → v0/protocol}/types/operations/Origination.d.ts +0 -0
  310. package/{protocol → v0/protocol}/types/operations/Origination.js +0 -0
  311. package/v0/protocol/types/operations/Origination.js.map +1 -0
  312. package/{protocol → v0/protocol}/types/operations/Proposal.d.ts +0 -0
  313. package/{protocol → v0/protocol}/types/operations/Proposal.js +0 -0
  314. package/v0/protocol/types/operations/Proposal.js.map +1 -0
  315. package/{protocol → v0/protocol}/types/operations/Reveal.d.ts +0 -0
  316. package/{protocol → v0/protocol}/types/operations/Reveal.js +0 -0
  317. package/v0/protocol/types/operations/Reveal.js.map +1 -0
  318. package/{protocol → v0/protocol}/types/operations/SeedNonceRevelation.d.ts +0 -0
  319. package/{protocol → v0/protocol}/types/operations/SeedNonceRevelation.js +0 -0
  320. package/v0/protocol/types/operations/SeedNonceRevelation.js.map +1 -0
  321. package/{protocol → v0/protocol}/types/operations/TezosOperation.d.ts +0 -0
  322. package/{protocol → v0/protocol}/types/operations/TezosOperation.js +0 -0
  323. package/v0/protocol/types/operations/TezosOperation.js.map +1 -0
  324. package/{protocol → v0/protocol}/types/operations/Transaction.d.ts +0 -0
  325. package/{protocol → v0/protocol}/types/operations/Transaction.js +0 -0
  326. package/v0/protocol/types/operations/Transaction.js.map +1 -0
  327. package/{protocol → v0/protocol}/types/sapling/TezosSaplingAddressCursor.d.ts +0 -0
  328. package/{protocol → v0/protocol}/types/sapling/TezosSaplingAddressCursor.js +0 -0
  329. package/v0/protocol/types/sapling/TezosSaplingAddressCursor.js.map +1 -0
  330. package/{protocol → v0/protocol}/types/sapling/TezosSaplingAddressResult.d.ts +0 -0
  331. package/{protocol → v0/protocol}/types/sapling/TezosSaplingAddressResult.js +0 -0
  332. package/v0/protocol/types/sapling/TezosSaplingAddressResult.js.map +1 -0
  333. package/{protocol → v0/protocol}/types/sapling/TezosSaplingCiphertext.d.ts +0 -0
  334. package/{protocol → v0/protocol}/types/sapling/TezosSaplingCiphertext.js +0 -0
  335. package/v0/protocol/types/sapling/TezosSaplingCiphertext.js.map +1 -0
  336. package/{protocol → v0/protocol}/types/sapling/TezosSaplingInput.d.ts +0 -0
  337. package/{protocol → v0/protocol}/types/sapling/TezosSaplingInput.js +0 -0
  338. package/v0/protocol/types/sapling/TezosSaplingInput.js.map +1 -0
  339. package/{protocol → v0/protocol}/types/sapling/TezosSaplingOutput.d.ts +0 -0
  340. package/{protocol → v0/protocol}/types/sapling/TezosSaplingOutput.js +0 -0
  341. package/v0/protocol/types/sapling/TezosSaplingOutput.js.map +1 -0
  342. package/{protocol → v0/protocol}/types/sapling/TezosSaplingStateDiff.d.ts +0 -0
  343. package/{protocol → v0/protocol}/types/sapling/TezosSaplingStateDiff.js +0 -0
  344. package/v0/protocol/types/sapling/TezosSaplingStateDiff.js.map +1 -0
  345. package/{protocol → v0/protocol}/types/sapling/TezosSaplingStateTree.d.ts +0 -0
  346. package/{protocol → v0/protocol}/types/sapling/TezosSaplingStateTree.js +0 -0
  347. package/v0/protocol/types/sapling/TezosSaplingStateTree.js.map +1 -0
  348. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransaction.d.ts +0 -0
  349. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransaction.js +0 -0
  350. package/v0/protocol/types/sapling/TezosSaplingTransaction.js.map +1 -0
  351. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransactionCursor.d.ts +0 -0
  352. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransactionCursor.js +0 -0
  353. package/v0/protocol/types/sapling/TezosSaplingTransactionCursor.js.map +1 -0
  354. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransactionResult.d.ts +0 -0
  355. package/{protocol → v0/protocol}/types/sapling/TezosSaplingTransactionResult.js +0 -0
  356. package/v0/protocol/types/sapling/TezosSaplingTransactionResult.js.map +1 -0
  357. package/{protocol → v0/protocol}/types/utils.d.ts +0 -0
  358. package/{protocol → v0/protocol}/types/utils.js +0 -0
  359. package/v0/protocol/types/utils.js.map +1 -0
  360. package/v0/serializer/schemas/v2/transaction-sign-request-tezos-sapling.json +127 -0
  361. package/v0/serializer/schemas/v2/transaction-sign-request-tezos.json +29 -0
  362. package/v0/serializer/schemas/v2/transaction-sign-response-tezos-sapling.json +19 -0
  363. package/v0/serializer/schemas/v2/transaction-sign-response-tezos.json +19 -0
  364. package/v0/serializer/schemas/v3/transaction-sign-request-tezos-sapling.json +133 -0
  365. package/v0/serializer/schemas/v3/transaction-sign-request-tezos.json +29 -0
  366. package/v0/serializer/schemas/v3/transaction-sign-response-tezos-sapling.json +19 -0
  367. package/v0/serializer/schemas/v3/transaction-sign-response-tezos.json +19 -0
  368. package/v0/serializer/validators/transaction-validator.d.ts +15 -0
  369. package/v0/serializer/validators/transaction-validator.js +107 -0
  370. package/v0/serializer/validators/transaction-validator.js.map +1 -0
  371. package/v0/serializer/validators/transaction-xtz-btc-validator.d.ts +18 -0
  372. package/v0/serializer/validators/transaction-xtz-btc-validator.js +170 -0
  373. package/v0/serializer/validators/transaction-xtz-btc-validator.js.map +1 -0
  374. package/v0/serializer/validators/validators.d.ts +1 -0
  375. package/v0/serializer/validators/validators.js +115 -0
  376. package/v0/serializer/validators/validators.js.map +1 -0
  377. package/v0/types/signed-transaction-tezos-sapling.d.ts +3 -0
  378. package/{types → v0/types}/signed-transaction-tezos-sapling.js +0 -0
  379. package/v0/types/signed-transaction-tezos-sapling.js.map +1 -0
  380. package/v0/types/signed-transaction-tezos.d.ts +5 -0
  381. package/{types → v0/types}/signed-transaction-tezos.js +0 -0
  382. package/v0/types/signed-transaction-tezos.js.map +1 -0
  383. package/{types → v0/types}/transaction-tezos.d.ts +0 -0
  384. package/{types → v0/types}/transaction-tezos.js +0 -0
  385. package/v0/types/transaction-tezos.js.map +1 -0
  386. package/v0/types/unsigned-transaction-tezos-sapling.d.ts +38 -0
  387. package/{types → v0/types}/unsigned-transaction-tezos-sapling.js +0 -0
  388. package/v0/types/unsigned-transaction-tezos-sapling.js.map +1 -0
  389. package/v0/types/unsigned-transaction-tezos.d.ts +8 -0
  390. package/{types → v0/types}/unsigned-transaction-tezos.js +0 -0
  391. package/v0/types/unsigned-transaction-tezos.js.map +1 -0
  392. package/v1/block-explorer/TzKTBlockExplorer.d.ts +9 -0
  393. package/v1/block-explorer/TzKTBlockExplorer.js +72 -0
  394. package/v1/block-explorer/TzKTBlockExplorer.js.map +1 -0
  395. package/v1/block-explorer/factory.d.ts +3 -0
  396. package/v1/block-explorer/factory.js +17 -0
  397. package/v1/block-explorer/factory.js.map +1 -0
  398. package/v1/contract/TezosContract.d.ts +52 -0
  399. package/v1/contract/TezosContract.js +510 -0
  400. package/v1/contract/TezosContract.js.map +1 -0
  401. package/v1/contract/TezosContractCall.d.ts +11 -0
  402. package/v1/contract/TezosContractCall.js +23 -0
  403. package/v1/contract/TezosContractCall.js.map +1 -0
  404. package/v1/contract/TezosContractEntrypoint.d.ts +9 -0
  405. package/v1/contract/TezosContractEntrypoint.js +27 -0
  406. package/v1/contract/TezosContractEntrypoint.js.map +1 -0
  407. package/v1/contract/TezosContractStorage.d.ts +7 -0
  408. package/v1/contract/TezosContractStorage.js +16 -0
  409. package/v1/contract/TezosContractStorage.js.map +1 -0
  410. package/v1/contract/remote-data/TezosContractRemoteDataFactory.d.ts +11 -0
  411. package/v1/contract/remote-data/TezosContractRemoteDataFactory.js +36 -0
  412. package/v1/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -0
  413. package/v1/contract/remote-data/TezosStorageRemoteData.d.ts +12 -0
  414. package/v1/contract/remote-data/TezosStorageRemoteData.js +152 -0
  415. package/v1/contract/remote-data/TezosStorageRemoteData.js.map +1 -0
  416. package/v1/crypto/TezosCryptoClient.d.ts +13 -0
  417. package/v1/crypto/TezosCryptoClient.js +152 -0
  418. package/v1/crypto/TezosCryptoClient.js.map +1 -0
  419. package/v1/crypto/TezosSaplingCryptoClient.d.ts +25 -0
  420. package/v1/crypto/TezosSaplingCryptoClient.js +222 -0
  421. package/v1/crypto/TezosSaplingCryptoClient.js.map +1 -0
  422. package/v1/data/TezosAddress.d.ts +9 -0
  423. package/v1/data/TezosAddress.js +27 -0
  424. package/v1/data/TezosAddress.js.map +1 -0
  425. package/v1/data/TezosSaplingAddress.d.ts +14 -0
  426. package/v1/data/TezosSaplingAddress.js +105 -0
  427. package/v1/data/TezosSaplingAddress.js.map +1 -0
  428. package/v1/index.d.ts +53 -0
  429. package/v1/index.js +84 -0
  430. package/v1/index.js.map +1 -0
  431. package/v1/indexer/TezosIndexerClient.d.ts +31 -0
  432. package/v1/indexer/TezosIndexerClient.js +3 -0
  433. package/v1/indexer/TezosIndexerClient.js.map +1 -0
  434. package/v1/indexer/TzKTIndexerClient.d.ts +30 -0
  435. package/v1/indexer/TzKTIndexerClient.js +277 -0
  436. package/v1/indexer/TzKTIndexerClient.js.map +1 -0
  437. package/v1/indexer/factory.d.ts +3 -0
  438. package/v1/indexer/factory.js +17 -0
  439. package/v1/indexer/factory.js.map +1 -0
  440. package/v1/injector/TezosSaplingInjectorClient.d.ts +6 -0
  441. package/v1/injector/TezosSaplingInjectorClient.js +68 -0
  442. package/v1/injector/TezosSaplingInjectorClient.js.map +1 -0
  443. package/v1/module/TezosKtModule.d.ts +8 -0
  444. package/v1/module/TezosKtModule.js +87 -0
  445. package/v1/module/TezosKtModule.js.map +1 -0
  446. package/v1/module/TezosModule.d.ts +8 -0
  447. package/v1/module/TezosModule.js +86 -0
  448. package/v1/module/TezosModule.js.map +1 -0
  449. package/v1/module/TezosShieldedTezModule.d.ts +8 -0
  450. package/v1/module/TezosShieldedTezModule.js +86 -0
  451. package/v1/module/TezosShieldedTezModule.js.map +1 -0
  452. package/v1/node/TezosSaplingNodeClient.d.ts +8 -0
  453. package/v1/node/TezosSaplingNodeClient.js +78 -0
  454. package/v1/node/TezosSaplingNodeClient.js.map +1 -0
  455. package/v1/protocol/TezosProtocol.d.ts +72 -0
  456. package/v1/protocol/TezosProtocol.js +967 -0
  457. package/v1/protocol/TezosProtocol.js.map +1 -0
  458. package/v1/protocol/fa/TezosFA1Protocol.d.ts +30 -0
  459. package/v1/protocol/fa/TezosFA1Protocol.js +200 -0
  460. package/v1/protocol/fa/TezosFA1Protocol.js.map +1 -0
  461. package/v1/protocol/fa/TezosFA1p2Protocol.d.ts +18 -0
  462. package/v1/protocol/fa/TezosFA1p2Protocol.js +121 -0
  463. package/v1/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
  464. package/v1/protocol/fa/TezosFA2Protocol.d.ts +39 -0
  465. package/v1/protocol/fa/TezosFA2Protocol.js +303 -0
  466. package/v1/protocol/fa/TezosFA2Protocol.js.map +1 -0
  467. package/v1/protocol/fa/TezosFAProtocol.d.ts +76 -0
  468. package/v1/protocol/fa/TezosFAProtocol.js +623 -0
  469. package/v1/protocol/fa/TezosFAProtocol.js.map +1 -0
  470. package/v1/protocol/fa/tokens/BTCTezProtocol.d.ts +14 -0
  471. package/v1/protocol/fa/tokens/BTCTezProtocol.js +76 -0
  472. package/v1/protocol/fa/tokens/BTCTezProtocol.js.map +1 -0
  473. package/v1/protocol/fa/tokens/CTezProtocol.d.ts +14 -0
  474. package/v1/protocol/fa/tokens/CTezProtocol.js +77 -0
  475. package/v1/protocol/fa/tokens/CTezProtocol.js.map +1 -0
  476. package/v1/protocol/fa/tokens/DogamiProtocol.d.ts +14 -0
  477. package/v1/protocol/fa/tokens/DogamiProtocol.js +77 -0
  478. package/v1/protocol/fa/tokens/DogamiProtocol.js.map +1 -0
  479. package/v1/protocol/fa/tokens/ETHTezProtocol.d.ts +18 -0
  480. package/v1/protocol/fa/tokens/ETHTezProtocol.js +120 -0
  481. package/v1/protocol/fa/tokens/ETHTezProtocol.js.map +1 -0
  482. package/v1/protocol/fa/tokens/KolibriUSDProtocol.d.ts +18 -0
  483. package/v1/protocol/fa/tokens/KolibriUSDProtocol.js +120 -0
  484. package/v1/protocol/fa/tokens/KolibriUSDProtocol.js.map +1 -0
  485. package/v1/protocol/fa/tokens/PlentyProtocol.d.ts +18 -0
  486. package/v1/protocol/fa/tokens/PlentyProtocol.js +120 -0
  487. package/v1/protocol/fa/tokens/PlentyProtocol.js.map +1 -0
  488. package/v1/protocol/fa/tokens/QuipuswapProtocol.d.ts +14 -0
  489. package/v1/protocol/fa/tokens/QuipuswapProtocol.js +76 -0
  490. package/v1/protocol/fa/tokens/QuipuswapProtocol.js.map +1 -0
  491. package/v1/protocol/fa/tokens/SiriusProtocol.d.ts +14 -0
  492. package/v1/protocol/fa/tokens/SiriusProtocol.js +77 -0
  493. package/v1/protocol/fa/tokens/SiriusProtocol.js.map +1 -0
  494. package/v1/protocol/fa/tokens/StakerProtocol.d.ts +18 -0
  495. package/v1/protocol/fa/tokens/StakerProtocol.js +120 -0
  496. package/v1/protocol/fa/tokens/StakerProtocol.js.map +1 -0
  497. package/v1/protocol/fa/tokens/TetherUSDProtocol.d.ts +14 -0
  498. package/v1/protocol/fa/tokens/TetherUSDProtocol.js +76 -0
  499. package/v1/protocol/fa/tokens/TetherUSDProtocol.js.map +1 -0
  500. package/v1/protocol/fa/tokens/TzBTCProtocol.d.ts +14 -0
  501. package/v1/protocol/fa/tokens/TzBTCProtocol.js +77 -0
  502. package/v1/protocol/fa/tokens/TzBTCProtocol.js.map +1 -0
  503. package/v1/protocol/fa/tokens/UBTCProtocol.d.ts +14 -0
  504. package/v1/protocol/fa/tokens/UBTCProtocol.js +76 -0
  505. package/v1/protocol/fa/tokens/UBTCProtocol.js.map +1 -0
  506. package/v1/protocol/fa/tokens/UDEFIProtocol.d.ts +14 -0
  507. package/v1/protocol/fa/tokens/UDEFIProtocol.js +76 -0
  508. package/v1/protocol/fa/tokens/UDEFIProtocol.js.map +1 -0
  509. package/v1/protocol/fa/tokens/USDTezProtocol.d.ts +14 -0
  510. package/v1/protocol/fa/tokens/USDTezProtocol.js +77 -0
  511. package/v1/protocol/fa/tokens/USDTezProtocol.js.map +1 -0
  512. package/v1/protocol/fa/tokens/UUSDProtocol.d.ts +14 -0
  513. package/v1/protocol/fa/tokens/UUSDProtocol.js +76 -0
  514. package/v1/protocol/fa/tokens/UUSDProtocol.js.map +1 -0
  515. package/v1/protocol/fa/tokens/WrapProtocol.d.ts +14 -0
  516. package/v1/protocol/fa/tokens/WrapProtocol.js +76 -0
  517. package/v1/protocol/fa/tokens/WrapProtocol.js.map +1 -0
  518. package/v1/protocol/fa/tokens/WrappedTezosProtocol.d.ts +14 -0
  519. package/v1/protocol/fa/tokens/WrappedTezosProtocol.js +77 -0
  520. package/v1/protocol/fa/tokens/WrappedTezosProtocol.js.map +1 -0
  521. package/v1/protocol/fa/tokens/YouProtocol.d.ts +14 -0
  522. package/v1/protocol/fa/tokens/YouProtocol.js +76 -0
  523. package/v1/protocol/fa/tokens/YouProtocol.js.map +1 -0
  524. package/v1/protocol/kt/TezosKtProtocol.d.ts +17 -0
  525. package/v1/protocol/kt/TezosKtProtocol.js +494 -0
  526. package/v1/protocol/kt/TezosKtProtocol.js.map +1 -0
  527. package/v1/protocol/sapling/TezosSaplingProtocol.d.ts +103 -0
  528. package/v1/protocol/sapling/TezosSaplingProtocol.js +1030 -0
  529. package/v1/protocol/sapling/TezosSaplingProtocol.js.map +1 -0
  530. package/v1/protocol/sapling/TezosShieldedTezProtocol.d.ts +19 -0
  531. package/v1/protocol/sapling/TezosShieldedTezProtocol.js +185 -0
  532. package/v1/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -0
  533. package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +13 -0
  534. package/v1/serializer/v3/schemas/converter/transaction-converter.js +37 -0
  535. package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
  536. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.d.ts +4 -0
  537. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.js +3 -0
  538. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos-sapling.js.map +1 -0
  539. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.d.ts +4 -0
  540. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.js +3 -0
  541. package/v1/serializer/v3/schemas/definitions/transaction-sign-request-tezos.js.map +1 -0
  542. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.d.ts +3 -0
  543. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.js +3 -0
  544. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos-sapling.js.map +1 -0
  545. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.d.ts +3 -0
  546. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.js +3 -0
  547. package/v1/serializer/v3/schemas/definitions/transaction-sign-response-tezos.js.map +1 -0
  548. package/v1/serializer/v3/schemas/generated/transaction-sign-request-tezos-sapling.json +152 -0
  549. package/v1/serializer/v3/schemas/generated/transaction-sign-request-tezos.json +36 -0
  550. package/v1/serializer/v3/schemas/generated/transaction-sign-response-tezos-sapling.json +19 -0
  551. package/v1/serializer/v3/schemas/generated/transaction-sign-response-tezos.json +19 -0
  552. package/v1/serializer/v3/validators/transaction-validator.d.ts +20 -0
  553. package/v1/serializer/v3/validators/transaction-validator.js +197 -0
  554. package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
  555. package/v1/serializer/v3/validators/validators.d.ts +4 -0
  556. package/v1/serializer/v3/validators/validators.js +108 -0
  557. package/v1/serializer/v3/validators/validators.js.map +1 -0
  558. package/v1/types/address.d.ts +7 -0
  559. package/v1/types/address.js +3 -0
  560. package/v1/types/address.js.map +1 -0
  561. package/v1/types/block/TezosBlockHeader.d.ts +13 -0
  562. package/v1/types/block/TezosBlockHeader.js +3 -0
  563. package/v1/types/block/TezosBlockHeader.js.map +1 -0
  564. package/v1/types/block-explorer.d.ts +6 -0
  565. package/v1/types/block-explorer.js +3 -0
  566. package/v1/types/block-explorer.js.map +1 -0
  567. package/v1/types/contract/TezosContractCode.d.ts +5 -0
  568. package/v1/types/contract/TezosContractCode.js +3 -0
  569. package/v1/types/contract/TezosContractCode.js.map +1 -0
  570. package/v1/types/contract/TezosContractMetadata.d.ts +61 -0
  571. package/v1/types/contract/TezosContractMetadata.js +3 -0
  572. package/v1/types/contract/TezosContractMetadata.js.map +1 -0
  573. package/v1/types/contract/bigmap/BigMap.d.ts +7 -0
  574. package/v1/types/contract/bigmap/BigMap.js +3 -0
  575. package/v1/types/contract/bigmap/BigMap.js.map +1 -0
  576. package/v1/types/contract/bigmap/BigMapEnrtyFilter.d.ts +5 -0
  577. package/v1/types/contract/bigmap/BigMapEnrtyFilter.js +3 -0
  578. package/v1/types/contract/bigmap/BigMapEnrtyFilter.js.map +1 -0
  579. package/v1/types/contract/bigmap/BigMapEntry.d.ts +7 -0
  580. package/v1/types/contract/bigmap/BigMapEntry.js +3 -0
  581. package/v1/types/contract/bigmap/BigMapEntry.js.map +1 -0
  582. package/v1/types/contract/bigmap/BigMapRequest.d.ts +8 -0
  583. package/v1/types/contract/bigmap/BigMapRequest.js +3 -0
  584. package/v1/types/contract/bigmap/BigMapRequest.js.map +1 -0
  585. package/v1/types/fa/TezosFA1ContractEntrypoint.d.ts +1 -0
  586. package/v1/types/fa/TezosFA1ContractEntrypoint.js +3 -0
  587. package/v1/types/fa/TezosFA1ContractEntrypoint.js.map +1 -0
  588. package/v1/types/fa/TezosFA1p2ContractEntrypoint.d.ts +2 -0
  589. package/v1/types/fa/TezosFA1p2ContractEntrypoint.js +3 -0
  590. package/v1/types/fa/TezosFA1p2ContractEntrypoint.js.map +1 -0
  591. package/v1/types/fa/TezosFA2BalanceOfRequest.d.ts +4 -0
  592. package/v1/types/fa/TezosFA2BalanceOfRequest.js +3 -0
  593. package/v1/types/fa/TezosFA2BalanceOfRequest.js.map +1 -0
  594. package/v1/types/fa/TezosFA2BalanceOfResponse.d.ts +5 -0
  595. package/v1/types/fa/TezosFA2BalanceOfResponse.js +3 -0
  596. package/v1/types/fa/TezosFA2BalanceOfResponse.js.map +1 -0
  597. package/v1/types/fa/TezosFA2ContractEntrypoint.d.ts +1 -0
  598. package/v1/types/fa/TezosFA2ContractEntrypoint.js +3 -0
  599. package/v1/types/fa/TezosFA2ContractEntrypoint.js.map +1 -0
  600. package/v1/types/fa/TezosFA2TransferRequest.d.ts +8 -0
  601. package/v1/types/fa/TezosFA2TransferRequest.js +3 -0
  602. package/v1/types/fa/TezosFA2TransferRequest.js.map +1 -0
  603. package/v1/types/fa/TezosFA2UpdateOperatorRequest.d.ts +6 -0
  604. package/v1/types/fa/TezosFA2UpdateOperatorRequest.js +3 -0
  605. package/v1/types/fa/TezosFA2UpdateOperatorRequest.js.map +1 -0
  606. package/v1/types/fa/TezosFATokenMetadata.d.ts +6 -0
  607. package/v1/types/fa/TezosFATokenMetadata.js +3 -0
  608. package/v1/types/fa/TezosFATokenMetadata.js.map +1 -0
  609. package/v1/types/indexer.d.ts +6 -0
  610. package/v1/types/indexer.js +3 -0
  611. package/v1/types/indexer.js.map +1 -0
  612. package/v1/types/micheline/MichelineNode.d.ts +15 -0
  613. package/v1/types/micheline/MichelineNode.js +5 -0
  614. package/v1/types/micheline/MichelineNode.js.map +1 -0
  615. package/v1/types/micheline/MichelineNodeUtils.d.ts +6 -0
  616. package/v1/types/micheline/MichelineNodeUtils.js +40 -0
  617. package/v1/types/micheline/MichelineNodeUtils.js.map +1 -0
  618. package/v1/types/michelson/MichelsonType.d.ts +11 -0
  619. package/v1/types/michelson/MichelsonType.js +22 -0
  620. package/v1/types/michelson/MichelsonType.js.map +1 -0
  621. package/v1/types/michelson/MichelsonTypeMeta.d.ts +33 -0
  622. package/v1/types/michelson/MichelsonTypeMeta.js +136 -0
  623. package/v1/types/michelson/MichelsonTypeMeta.js.map +1 -0
  624. package/v1/types/michelson/MichelsonTypeUtils.d.ts +19 -0
  625. package/v1/types/michelson/MichelsonTypeUtils.js +251 -0
  626. package/v1/types/michelson/MichelsonTypeUtils.js.map +1 -0
  627. package/v1/types/michelson/generics/MichelsonList.d.ts +11 -0
  628. package/v1/types/michelson/generics/MichelsonList.js +70 -0
  629. package/v1/types/michelson/generics/MichelsonList.js.map +1 -0
  630. package/v1/types/michelson/generics/MichelsonMap.d.ts +14 -0
  631. package/v1/types/michelson/generics/MichelsonMap.js +120 -0
  632. package/v1/types/michelson/generics/MichelsonMap.js.map +1 -0
  633. package/v1/types/michelson/generics/MichelsonOption.d.ts +25 -0
  634. package/v1/types/michelson/generics/MichelsonOption.js +121 -0
  635. package/v1/types/michelson/generics/MichelsonOption.js.map +1 -0
  636. package/v1/types/michelson/generics/MichelsonOr.d.ts +25 -0
  637. package/v1/types/michelson/generics/MichelsonOr.js +134 -0
  638. package/v1/types/michelson/generics/MichelsonOr.js.map +1 -0
  639. package/v1/types/michelson/generics/MichelsonPair.d.ts +17 -0
  640. package/v1/types/michelson/generics/MichelsonPair.js +139 -0
  641. package/v1/types/michelson/generics/MichelsonPair.js.map +1 -0
  642. package/v1/types/michelson/grammar/MichelsonGrammarData.d.ts +2 -0
  643. package/v1/types/michelson/grammar/MichelsonGrammarData.js +4 -0
  644. package/v1/types/michelson/grammar/MichelsonGrammarData.js.map +1 -0
  645. package/v1/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -0
  646. package/v1/types/michelson/grammar/MichelsonGrammarInstruction.js +4 -0
  647. package/v1/types/michelson/grammar/MichelsonGrammarInstruction.js.map +1 -0
  648. package/v1/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -0
  649. package/v1/types/michelson/grammar/MichelsonGrammarType.js +4 -0
  650. package/v1/types/michelson/grammar/MichelsonGrammarType.js.map +1 -0
  651. package/v1/types/michelson/primitives/MichelsonAddress.d.ts +15 -0
  652. package/v1/types/michelson/primitives/MichelsonAddress.js +74 -0
  653. package/v1/types/michelson/primitives/MichelsonAddress.js.map +1 -0
  654. package/v1/types/michelson/primitives/MichelsonBool.d.ts +12 -0
  655. package/v1/types/michelson/primitives/MichelsonBool.js +59 -0
  656. package/v1/types/michelson/primitives/MichelsonBool.js.map +1 -0
  657. package/v1/types/michelson/primitives/MichelsonBytes.d.ts +14 -0
  658. package/v1/types/michelson/primitives/MichelsonBytes.js +77 -0
  659. package/v1/types/michelson/primitives/MichelsonBytes.js.map +1 -0
  660. package/v1/types/michelson/primitives/MichelsonInt.d.ts +14 -0
  661. package/v1/types/michelson/primitives/MichelsonInt.js +74 -0
  662. package/v1/types/michelson/primitives/MichelsonInt.js.map +1 -0
  663. package/v1/types/michelson/primitives/MichelsonString.d.ts +14 -0
  664. package/v1/types/michelson/primitives/MichelsonString.js +76 -0
  665. package/v1/types/michelson/primitives/MichelsonString.js.map +1 -0
  666. package/v1/types/michelson/primitives/MichelsonUnit.d.ts +9 -0
  667. package/v1/types/michelson/primitives/MichelsonUnit.js +55 -0
  668. package/v1/types/michelson/primitives/MichelsonUnit.js.map +1 -0
  669. package/v1/types/network.d.ts +4 -0
  670. package/v1/types/network.js +9 -0
  671. package/v1/types/network.js.map +1 -0
  672. package/v1/types/node.d.ts +78 -0
  673. package/v1/types/node.js +3 -0
  674. package/v1/types/node.js.map +1 -0
  675. package/v1/types/operations/TezosOperationType.d.ts +13 -0
  676. package/v1/types/operations/TezosOperationType.js +18 -0
  677. package/v1/types/operations/TezosOperationType.js.map +1 -0
  678. package/v1/types/operations/TezosWrappedOperation.d.ts +5 -0
  679. package/v1/types/operations/TezosWrappedOperation.js +3 -0
  680. package/v1/types/operations/TezosWrappedOperation.js.map +1 -0
  681. package/v1/types/operations/kinds/ActivateAccount.d.ts +7 -0
  682. package/v1/types/operations/kinds/ActivateAccount.js +3 -0
  683. package/v1/types/operations/kinds/ActivateAccount.js.map +1 -0
  684. package/v1/types/operations/kinds/Ballot.d.ts +9 -0
  685. package/v1/types/operations/kinds/Ballot.js +3 -0
  686. package/v1/types/operations/kinds/Ballot.js.map +1 -0
  687. package/v1/types/operations/kinds/Delegation.d.ts +11 -0
  688. package/v1/types/operations/kinds/Delegation.js +3 -0
  689. package/v1/types/operations/kinds/Delegation.js.map +1 -0
  690. package/v1/types/operations/kinds/DoubleBakingEvidence.d.ts +8 -0
  691. package/v1/types/operations/kinds/DoubleBakingEvidence.js +3 -0
  692. package/v1/types/operations/kinds/DoubleBakingEvidence.js.map +1 -0
  693. package/v1/types/operations/kinds/DoubleEndorsementEvidence.d.ts +16 -0
  694. package/v1/types/operations/kinds/DoubleEndorsementEvidence.js +3 -0
  695. package/v1/types/operations/kinds/DoubleEndorsementEvidence.js.map +1 -0
  696. package/v1/types/operations/kinds/Endorsement.d.ts +6 -0
  697. package/v1/types/operations/kinds/Endorsement.js +3 -0
  698. package/v1/types/operations/kinds/Endorsement.js.map +1 -0
  699. package/v1/types/operations/kinds/Origination.d.ts +13 -0
  700. package/v1/types/operations/kinds/Origination.js +3 -0
  701. package/v1/types/operations/kinds/Origination.js.map +1 -0
  702. package/v1/types/operations/kinds/Proposal.d.ts +7 -0
  703. package/v1/types/operations/kinds/Proposal.js +3 -0
  704. package/v1/types/operations/kinds/Proposal.js.map +1 -0
  705. package/v1/types/operations/kinds/Reveal.d.ts +11 -0
  706. package/v1/types/operations/kinds/Reveal.js +3 -0
  707. package/v1/types/operations/kinds/Reveal.js.map +1 -0
  708. package/v1/types/operations/kinds/SeedNonceRevelation.d.ts +7 -0
  709. package/v1/types/operations/kinds/SeedNonceRevelation.js +3 -0
  710. package/v1/types/operations/kinds/SeedNonceRevelation.js.map +1 -0
  711. package/v1/types/operations/kinds/TezosOperation.d.ts +4 -0
  712. package/v1/types/operations/kinds/TezosOperation.js +3 -0
  713. package/v1/types/operations/kinds/TezosOperation.js.map +1 -0
  714. package/v1/types/operations/kinds/Transaction.d.ts +24 -0
  715. package/v1/types/operations/kinds/Transaction.js +3 -0
  716. package/v1/types/operations/kinds/Transaction.js.map +1 -0
  717. package/v1/types/protocol.d.ts +61 -0
  718. package/v1/types/protocol.js +3 -0
  719. package/v1/types/protocol.js.map +1 -0
  720. package/v1/types/sapling/TezosSaplingCiphertext.d.ts +8 -0
  721. package/v1/types/sapling/TezosSaplingCiphertext.js +3 -0
  722. package/v1/types/sapling/TezosSaplingCiphertext.js.map +1 -0
  723. package/v1/types/sapling/TezosSaplingExternalMethodProvider.d.ts +10 -0
  724. package/v1/types/sapling/TezosSaplingExternalMethodProvider.js +3 -0
  725. package/v1/types/sapling/TezosSaplingExternalMethodProvider.js.map +1 -0
  726. package/v1/types/sapling/TezosSaplingInput.d.ts +6 -0
  727. package/v1/types/sapling/TezosSaplingInput.js +3 -0
  728. package/v1/types/sapling/TezosSaplingInput.js.map +1 -0
  729. package/v1/types/sapling/TezosSaplingOutput.d.ts +6 -0
  730. package/v1/types/sapling/TezosSaplingOutput.js +3 -0
  731. package/v1/types/sapling/TezosSaplingOutput.js.map +1 -0
  732. package/v1/types/sapling/TezosSaplingStateDiff.d.ts +6 -0
  733. package/v1/types/sapling/TezosSaplingStateDiff.js +3 -0
  734. package/v1/types/sapling/TezosSaplingStateDiff.js.map +1 -0
  735. package/v1/types/sapling/TezosSaplingStateTree.d.ts +7 -0
  736. package/v1/types/sapling/TezosSaplingStateTree.js +3 -0
  737. package/v1/types/sapling/TezosSaplingStateTree.js.map +1 -0
  738. package/v1/types/sapling/TezosSaplingTransaction.d.ts +23 -0
  739. package/v1/types/sapling/TezosSaplingTransaction.js +3 -0
  740. package/v1/types/sapling/TezosSaplingTransaction.js.map +1 -0
  741. package/v1/types/sapling/TezosSaplingTransactionCursor.d.ts +3 -0
  742. package/v1/types/sapling/TezosSaplingTransactionCursor.js +3 -0
  743. package/v1/types/sapling/TezosSaplingTransactionCursor.js.map +1 -0
  744. package/v1/types/sapling/TezosSaplingTransactionResult.d.ts +6 -0
  745. package/v1/types/sapling/TezosSaplingTransactionResult.js +3 -0
  746. package/v1/types/sapling/TezosSaplingTransactionResult.js.map +1 -0
  747. package/v1/types/transaction.d.ts +30 -0
  748. package/v1/types/transaction.js +3 -0
  749. package/v1/types/transaction.js.map +1 -0
  750. package/v1/utils/address.d.ts +2 -0
  751. package/v1/utils/address.js +13 -0
  752. package/v1/utils/address.js.map +1 -0
  753. package/v1/utils/bip.d.ts +2 -0
  754. package/v1/utils/bip.js +13 -0
  755. package/v1/utils/bip.js.map +1 -0
  756. package/v1/utils/convert.d.ts +4 -0
  757. package/v1/utils/convert.js +33 -0
  758. package/v1/utils/convert.js.map +1 -0
  759. package/v1/utils/encoding.d.ts +52 -0
  760. package/v1/utils/encoding.js +103 -0
  761. package/v1/utils/encoding.js.map +1 -0
  762. package/v1/utils/fa.d.ts +2 -0
  763. package/v1/utils/fa.js +13 -0
  764. package/v1/utils/fa.js.map +1 -0
  765. package/v1/utils/key.d.ts +4 -0
  766. package/v1/utils/key.js +43 -0
  767. package/v1/utils/key.js.map +1 -0
  768. package/v1/utils/micheline.d.ts +8 -0
  769. package/v1/utils/micheline.js +41 -0
  770. package/v1/utils/micheline.js.map +1 -0
  771. package/v1/utils/operations.d.ts +12 -0
  772. package/v1/utils/operations.js +72 -0
  773. package/v1/utils/operations.js.map +1 -0
  774. package/v1/utils/pack.d.ts +10 -0
  775. package/v1/utils/pack.js +252 -0
  776. package/v1/utils/pack.js.map +1 -0
  777. package/v1/utils/protocol/fa/TezosFA1Accountant.d.ts +9 -0
  778. package/v1/utils/protocol/fa/TezosFA1Accountant.js +76 -0
  779. package/v1/utils/protocol/fa/TezosFA1Accountant.js.map +1 -0
  780. package/v1/utils/protocol/fa/TezosFA2Accountant.d.ts +12 -0
  781. package/v1/utils/protocol/fa/TezosFA2Accountant.js +113 -0
  782. package/v1/utils/protocol/fa/TezosFA2Accountant.js.map +1 -0
  783. package/v1/utils/protocol/fa/TezosFAAccountant.d.ts +8 -0
  784. package/v1/utils/protocol/fa/TezosFAAccountant.js +95 -0
  785. package/v1/utils/protocol/fa/TezosFAAccountant.js.map +1 -0
  786. package/v1/utils/protocol/sapling/TezosSaplingAccountant.d.ts +32 -0
  787. package/v1/utils/protocol/sapling/TezosSaplingAccountant.js +589 -0
  788. package/v1/utils/protocol/sapling/TezosSaplingAccountant.js.map +1 -0
  789. package/v1/utils/protocol/sapling/TezosSaplingEncoder.d.ts +22 -0
  790. package/v1/utils/protocol/sapling/TezosSaplingEncoder.js +158 -0
  791. package/v1/utils/protocol/sapling/TezosSaplingEncoder.js.map +1 -0
  792. package/v1/utils/protocol/sapling/TezosSaplingForger.d.ts +26 -0
  793. package/v1/utils/protocol/sapling/TezosSaplingForger.js +284 -0
  794. package/v1/utils/protocol/sapling/TezosSaplingForger.js.map +1 -0
  795. package/v1/utils/protocol/sapling/TezosSaplingState.d.ts +17 -0
  796. package/v1/utils/protocol/sapling/TezosSaplingState.js +266 -0
  797. package/v1/utils/protocol/sapling/TezosSaplingState.js.map +1 -0
  798. package/v1/utils/protocol/tezos/TezosAccountant.d.ts +13 -0
  799. package/v1/utils/protocol/tezos/TezosAccountant.js +173 -0
  800. package/v1/utils/protocol/tezos/TezosAccountant.js.map +1 -0
  801. package/v1/utils/protocol/tezos/TezosForger.d.ts +6 -0
  802. package/v1/utils/protocol/tezos/TezosForger.js +82 -0
  803. package/v1/utils/protocol/tezos/TezosForger.js.map +1 -0
  804. package/v1/utils/signature.d.ts +2 -0
  805. package/v1/utils/signature.js +23 -0
  806. package/v1/utils/signature.js.map +1 -0
  807. package/v1/utils/transaction.d.ts +9 -0
  808. package/v1/utils/transaction.js +26 -0
  809. package/v1/utils/transaction.js.map +1 -0
  810. package/actions/GetKtAccountsAction.js +0 -85
  811. package/actions/GetKtAccountsAction.js.map +0 -1
  812. package/constants.js.map +0 -1
  813. package/protocol/TezosAddress.js +0 -102
  814. package/protocol/TezosAddress.js.map +0 -1
  815. package/protocol/TezosCryptoClient.js +0 -152
  816. package/protocol/TezosCryptoClient.js.map +0 -1
  817. package/protocol/TezosProtocol.js +0 -1853
  818. package/protocol/TezosProtocol.js.map +0 -1
  819. package/protocol/TezosProtocolOptions.js +0 -114
  820. package/protocol/TezosProtocolOptions.js.map +0 -1
  821. package/protocol/TezosUtils.js +0 -296
  822. package/protocol/TezosUtils.js.map +0 -1
  823. package/protocol/contract/TezosContract.js +0 -509
  824. package/protocol/contract/TezosContract.js.map +0 -1
  825. package/protocol/contract/TezosContractCall.d.ts +0 -10
  826. package/protocol/contract/TezosContractCall.js.map +0 -1
  827. package/protocol/contract/TezosContractEntrypoint.js +0 -27
  828. package/protocol/contract/TezosContractEntrypoint.js.map +0 -1
  829. package/protocol/contract/TezosContractStorage.js.map +0 -1
  830. package/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +0 -34
  831. package/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +0 -1
  832. package/protocol/contract/remote-data/TezosStorageRemoteData.js +0 -151
  833. package/protocol/contract/remote-data/TezosStorageRemoteData.js.map +0 -1
  834. package/protocol/domains/TezosDomains.js +0 -306
  835. package/protocol/domains/TezosDomains.js.map +0 -1
  836. package/protocol/fa/TezosBTC.js +0 -107
  837. package/protocol/fa/TezosBTC.js.map +0 -1
  838. package/protocol/fa/TezosBTCtez.js +0 -54
  839. package/protocol/fa/TezosBTCtez.js.map +0 -1
  840. package/protocol/fa/TezosCTez.js +0 -51
  841. package/protocol/fa/TezosCTez.js.map +0 -1
  842. package/protocol/fa/TezosDOGA.js +0 -51
  843. package/protocol/fa/TezosDOGA.js.map +0 -1
  844. package/protocol/fa/TezosETHtz.js +0 -72
  845. package/protocol/fa/TezosETHtz.js.map +0 -1
  846. package/protocol/fa/TezosFA1Protocol.js +0 -310
  847. package/protocol/fa/TezosFA1Protocol.js.map +0 -1
  848. package/protocol/fa/TezosFA1p2Protocol.js +0 -117
  849. package/protocol/fa/TezosFA1p2Protocol.js.map +0 -1
  850. package/protocol/fa/TezosFA2Protocol.js +0 -449
  851. package/protocol/fa/TezosFA2Protocol.js.map +0 -1
  852. package/protocol/fa/TezosFAProtocol.js +0 -510
  853. package/protocol/fa/TezosFAProtocol.js.map +0 -1
  854. package/protocol/fa/TezosFAProtocolOptions.js +0 -228
  855. package/protocol/fa/TezosFAProtocolOptions.js.map +0 -1
  856. package/protocol/fa/TezosKolibriUSD.js +0 -74
  857. package/protocol/fa/TezosKolibriUSD.js.map +0 -1
  858. package/protocol/fa/TezosPlanty.js +0 -51
  859. package/protocol/fa/TezosPlanty.js.map +0 -1
  860. package/protocol/fa/TezosQUIPU.js +0 -54
  861. package/protocol/fa/TezosQUIPU.js.map +0 -1
  862. package/protocol/fa/TezosSIRS.js +0 -51
  863. package/protocol/fa/TezosSIRS.js.map +0 -1
  864. package/protocol/fa/TezosStaker.js +0 -74
  865. package/protocol/fa/TezosStaker.js.map +0 -1
  866. package/protocol/fa/TezosUBTC.js +0 -54
  867. package/protocol/fa/TezosUBTC.js.map +0 -1
  868. package/protocol/fa/TezosUDEFI.js +0 -54
  869. package/protocol/fa/TezosUDEFI.js.map +0 -1
  870. package/protocol/fa/TezosUSD.js +0 -74
  871. package/protocol/fa/TezosUSD.js.map +0 -1
  872. package/protocol/fa/TezosUSDT.js +0 -54
  873. package/protocol/fa/TezosUSDT.js.map +0 -1
  874. package/protocol/fa/TezosUUSD.js +0 -31
  875. package/protocol/fa/TezosUUSD.js.map +0 -1
  876. package/protocol/fa/TezosWRAP.js +0 -54
  877. package/protocol/fa/TezosWRAP.js.map +0 -1
  878. package/protocol/fa/TezosWrapped.js +0 -74
  879. package/protocol/fa/TezosWrapped.js.map +0 -1
  880. package/protocol/fa/TezosYOU.js +0 -31
  881. package/protocol/fa/TezosYOU.js.map +0 -1
  882. package/protocol/indexerClient/TezosIndexerClient.js +0 -269
  883. package/protocol/indexerClient/TezosIndexerClient.js.map +0 -1
  884. package/protocol/indexerClient/TezosProtocolIndexerClient.js.map +0 -1
  885. package/protocol/kt/TezosKtAddress.js +0 -72
  886. package/protocol/kt/TezosKtAddress.js.map +0 -1
  887. package/protocol/kt/TezosKtProtocol.js +0 -317
  888. package/protocol/kt/TezosKtProtocol.js.map +0 -1
  889. package/protocol/sapling/TezosSaplingAddress.js +0 -134
  890. package/protocol/sapling/TezosSaplingAddress.js.map +0 -1
  891. package/protocol/sapling/TezosSaplingCryptoClient.js +0 -242
  892. package/protocol/sapling/TezosSaplingCryptoClient.js.map +0 -1
  893. package/protocol/sapling/TezosSaplingProtocol.js +0 -1175
  894. package/protocol/sapling/TezosSaplingProtocol.js.map +0 -1
  895. package/protocol/sapling/TezosSaplingProtocolOptions.js +0 -79
  896. package/protocol/sapling/TezosSaplingProtocolOptions.js.map +0 -1
  897. package/protocol/sapling/TezosShieldedTezProtocol.js +0 -133
  898. package/protocol/sapling/TezosShieldedTezProtocol.js.map +0 -1
  899. package/protocol/sapling/injector/TezosSaplingInjectorClient.js +0 -68
  900. package/protocol/sapling/injector/TezosSaplingInjectorClient.js.map +0 -1
  901. package/protocol/sapling/node/TezosSaplingNodeClient.js +0 -78
  902. package/protocol/sapling/node/TezosSaplingNodeClient.js.map +0 -1
  903. package/protocol/sapling/utils/TezosSaplingBookkeeper.js +0 -586
  904. package/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +0 -1
  905. package/protocol/sapling/utils/TezosSaplingEncoder.js +0 -158
  906. package/protocol/sapling/utils/TezosSaplingEncoder.js.map +0 -1
  907. package/protocol/sapling/utils/TezosSaplingForger.js +0 -278
  908. package/protocol/sapling/utils/TezosSaplingForger.js.map +0 -1
  909. package/protocol/sapling/utils/TezosSaplingState.js +0 -260
  910. package/protocol/sapling/utils/TezosSaplingState.js.map +0 -1
  911. package/protocol/types/TezosAddressCursor.js.map +0 -1
  912. package/protocol/types/TezosAddressResult.js.map +0 -1
  913. package/protocol/types/TezosBlockHeader.js.map +0 -1
  914. package/protocol/types/TezosBlockMetadata.js.map +0 -1
  915. package/protocol/types/TezosContractCode.js.map +0 -1
  916. package/protocol/types/TezosOperationType.js.map +0 -1
  917. package/protocol/types/TezosTransactionCursor.js.map +0 -1
  918. package/protocol/types/TezosTransactionResult.js.map +0 -1
  919. package/protocol/types/TezosWrappedOperation.js.map +0 -1
  920. package/protocol/types/contract/BigMap.js.map +0 -1
  921. package/protocol/types/contract/BigMapEnrtyFilter.js.map +0 -1
  922. package/protocol/types/contract/BigMapEntry.js.map +0 -1
  923. package/protocol/types/contract/BigMapRequest.js.map +0 -1
  924. package/protocol/types/contract/TezosContractMetadata.js.map +0 -1
  925. package/protocol/types/domains/TezosDomainsRecord.js.map +0 -1
  926. package/protocol/types/domains/TezosDomainsReverseRecord.js.map +0 -1
  927. package/protocol/types/fa/TezosFA2BalanceOfRequest.js.map +0 -1
  928. package/protocol/types/fa/TezosFA2BalanceOfResponse.js.map +0 -1
  929. package/protocol/types/fa/TezosFA2TransferRequest.js.map +0 -1
  930. package/protocol/types/fa/TezosFA2UpdateOperatorRequest.js.map +0 -1
  931. package/protocol/types/fa/TezosFATokenMetadata.js.map +0 -1
  932. package/protocol/types/kt/TezosKtAddressCursor.js.map +0 -1
  933. package/protocol/types/kt/TezosKtAddressResult.js.map +0 -1
  934. package/protocol/types/micheline/MichelineNode.js.map +0 -1
  935. package/protocol/types/micheline/MichelineNodeUtils.js +0 -40
  936. package/protocol/types/micheline/MichelineNodeUtils.js.map +0 -1
  937. package/protocol/types/michelson/MichelsonType.js.map +0 -1
  938. package/protocol/types/michelson/MichelsonTypeMeta.js +0 -132
  939. package/protocol/types/michelson/MichelsonTypeMeta.js.map +0 -1
  940. package/protocol/types/michelson/MichelsonTypeUtils.js +0 -249
  941. package/protocol/types/michelson/MichelsonTypeUtils.js.map +0 -1
  942. package/protocol/types/michelson/generics/MichelsonList.js +0 -68
  943. package/protocol/types/michelson/generics/MichelsonList.js.map +0 -1
  944. package/protocol/types/michelson/generics/MichelsonMap.js +0 -118
  945. package/protocol/types/michelson/generics/MichelsonMap.js.map +0 -1
  946. package/protocol/types/michelson/generics/MichelsonOption.js +0 -119
  947. package/protocol/types/michelson/generics/MichelsonOption.js.map +0 -1
  948. package/protocol/types/michelson/generics/MichelsonOr.js +0 -132
  949. package/protocol/types/michelson/generics/MichelsonOr.js.map +0 -1
  950. package/protocol/types/michelson/generics/MichelsonPair.js +0 -135
  951. package/protocol/types/michelson/generics/MichelsonPair.js.map +0 -1
  952. package/protocol/types/michelson/grammar/MichelsonGrammarData.js.map +0 -1
  953. package/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js.map +0 -1
  954. package/protocol/types/michelson/grammar/MichelsonGrammarType.js.map +0 -1
  955. package/protocol/types/michelson/primitives/MichelsonAddress.js +0 -72
  956. package/protocol/types/michelson/primitives/MichelsonAddress.js.map +0 -1
  957. package/protocol/types/michelson/primitives/MichelsonBool.js +0 -57
  958. package/protocol/types/michelson/primitives/MichelsonBool.js.map +0 -1
  959. package/protocol/types/michelson/primitives/MichelsonBytes.js +0 -75
  960. package/protocol/types/michelson/primitives/MichelsonBytes.js.map +0 -1
  961. package/protocol/types/michelson/primitives/MichelsonInt.js +0 -72
  962. package/protocol/types/michelson/primitives/MichelsonInt.js.map +0 -1
  963. package/protocol/types/michelson/primitives/MichelsonString.js +0 -74
  964. package/protocol/types/michelson/primitives/MichelsonString.js.map +0 -1
  965. package/protocol/types/michelson/primitives/MichelsonUnit.js +0 -53
  966. package/protocol/types/michelson/primitives/MichelsonUnit.js.map +0 -1
  967. package/protocol/types/operations/ActivateAccount.js.map +0 -1
  968. package/protocol/types/operations/Ballot.js.map +0 -1
  969. package/protocol/types/operations/Delegation.js.map +0 -1
  970. package/protocol/types/operations/DoubleBakingEvidence.js.map +0 -1
  971. package/protocol/types/operations/DoubleEndorsementEvidence.js.map +0 -1
  972. package/protocol/types/operations/Endorsement.js.map +0 -1
  973. package/protocol/types/operations/Origination.js.map +0 -1
  974. package/protocol/types/operations/Proposal.js.map +0 -1
  975. package/protocol/types/operations/Reveal.js.map +0 -1
  976. package/protocol/types/operations/SeedNonceRevelation.js.map +0 -1
  977. package/protocol/types/operations/TezosOperation.js.map +0 -1
  978. package/protocol/types/operations/Transaction.js.map +0 -1
  979. package/protocol/types/sapling/TezosSaplingAddressCursor.js.map +0 -1
  980. package/protocol/types/sapling/TezosSaplingAddressResult.js.map +0 -1
  981. package/protocol/types/sapling/TezosSaplingCiphertext.js.map +0 -1
  982. package/protocol/types/sapling/TezosSaplingInput.js.map +0 -1
  983. package/protocol/types/sapling/TezosSaplingOutput.js.map +0 -1
  984. package/protocol/types/sapling/TezosSaplingStateDiff.js.map +0 -1
  985. package/protocol/types/sapling/TezosSaplingStateTree.js.map +0 -1
  986. package/protocol/types/sapling/TezosSaplingTransaction.js.map +0 -1
  987. package/protocol/types/sapling/TezosSaplingTransactionCursor.js.map +0 -1
  988. package/protocol/types/sapling/TezosSaplingTransactionResult.js.map +0 -1
  989. package/protocol/types/utils.js.map +0 -1
  990. package/types/signed-transaction-tezos-sapling.d.ts +0 -3
  991. package/types/signed-transaction-tezos-sapling.js.map +0 -1
  992. package/types/signed-transaction-tezos.d.ts +0 -5
  993. package/types/signed-transaction-tezos.js.map +0 -1
  994. package/types/transaction-tezos.js.map +0 -1
  995. package/types/unsigned-transaction-tezos-sapling.d.ts +0 -38
  996. package/types/unsigned-transaction-tezos-sapling.js.map +0 -1
  997. package/types/unsigned-transaction-tezos.d.ts +0 -8
  998. package/types/unsigned-transaction-tezos.js.map +0 -1
@@ -0,0 +1,1859 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
29
+ if (k2 === undefined) k2 = k;
30
+ var desc = Object.getOwnPropertyDescriptor(m, k);
31
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
32
+ desc = { enumerable: true, get: function() { return m[k]; } };
33
+ }
34
+ Object.defineProperty(o, k2, desc);
35
+ }) : (function(o, m, k, k2) {
36
+ if (k2 === undefined) k2 = k;
37
+ o[k2] = m[k];
38
+ }));
39
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
40
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
41
+ }) : function(o, v) {
42
+ o["default"] = v;
43
+ });
44
+ var __importStar = (this && this.__importStar) || function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
52
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
53
+ return new (P || (P = Promise))(function (resolve, reject) {
54
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
55
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
56
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
57
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
58
+ });
59
+ };
60
+ var __generator = (this && this.__generator) || function (thisArg, body) {
61
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
62
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
63
+ function verb(n) { return function (v) { return step([n, v]); }; }
64
+ function step(op) {
65
+ if (f) throw new TypeError("Generator is already executing.");
66
+ while (_) try {
67
+ 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;
68
+ if (y = 0, t) op = [op[0] & 2, t.value];
69
+ switch (op[0]) {
70
+ case 0: case 1: t = op; break;
71
+ case 4: _.label++; return { value: op[1], done: false };
72
+ case 5: _.label++; y = op[1]; op = [0]; continue;
73
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
74
+ default:
75
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
76
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
77
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
78
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
79
+ if (t[2]) _.ops.pop();
80
+ _.trys.pop(); continue;
81
+ }
82
+ op = body.call(thisArg, _);
83
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
84
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
85
+ }
86
+ };
87
+ var __importDefault = (this && this.__importDefault) || function (mod) {
88
+ return (mod && mod.__esModule) ? mod : { "default": mod };
89
+ };
90
+ var _a, _b;
91
+ Object.defineProperty(exports, "__esModule", { value: true });
92
+ exports.TezosProtocol = exports.TezosNetwork = exports.TezosDelegatorAction = void 0;
93
+ var taquito_local_forging_1 = require("@airgap/coinlib-core/dependencies/src/@taquito/local-forging-8.0.1-beta.1/packages/taquito-local-forging/src/taquito-local-forging");
94
+ var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
95
+ var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
96
+ var index_2 = require("@airgap/coinlib-core/dependencies/src/bip39-2.5.0/index");
97
+ var bs58check = __importStar(require("@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index"));
98
+ var index_3 = require("@airgap/coinlib-core/dependencies/src/hd-wallet-js-b216450e56954a6e82ace0aade9474673de5d9d5/src/index");
99
+ var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
100
+ var index_4 = require("@airgap/coinlib-core/errors/index");
101
+ var NonExtendedProtocol_1 = require("@airgap/coinlib-core/protocols/NonExtendedProtocol");
102
+ var assert_1 = require("@airgap/coinlib-core/utils/assert");
103
+ var ProtocolSymbols_1 = require("@airgap/coinlib-core/utils/ProtocolSymbols");
104
+ var TezosAddress_1 = require("./TezosAddress");
105
+ var TezosCryptoClient_1 = require("./TezosCryptoClient");
106
+ var TezosProtocolOptions_1 = require("./TezosProtocolOptions");
107
+ var TezosUtils_1 = require("./TezosUtils");
108
+ var TezosOperationType_1 = require("./types/TezosOperationType");
109
+ var MAX_OPERATIONS_PER_GROUP = 200;
110
+ var MAX_GAS_PER_BLOCK = 5200000;
111
+ var GAS_LIMIT_PLACEHOLDER = '1040000';
112
+ var STORAGE_LIMIT_PLACEHOLDER = '60000';
113
+ var FEE_PLACEHOLDER = '0';
114
+ var MINIMAL_FEE = 100;
115
+ var MINIMAL_FEE_PER_GAS_UNIT = 0.1;
116
+ var MINIMAL_FEE_PER_BYTE = 1;
117
+ var TezosDelegatorAction;
118
+ (function (TezosDelegatorAction) {
119
+ TezosDelegatorAction["DELEGATE"] = "delegate";
120
+ TezosDelegatorAction["UNDELEGATE"] = "undelegate";
121
+ TezosDelegatorAction["CHANGE_BAKER"] = "change_baker";
122
+ })(TezosDelegatorAction = exports.TezosDelegatorAction || (exports.TezosDelegatorAction = {}));
123
+ // 8.25%
124
+ var SELF_BOND_REQUIREMENT = 0.0825;
125
+ var TezosNetwork;
126
+ (function (TezosNetwork) {
127
+ TezosNetwork["MAINNET"] = "mainnet";
128
+ TezosNetwork["GHOSTNET"] = "ghostnet";
129
+ })(TezosNetwork = exports.TezosNetwork || (exports.TezosNetwork = {}));
130
+ var TezosProtocol = /** @class */ (function (_super) {
131
+ __extends(TezosProtocol, _super);
132
+ function TezosProtocol(options) {
133
+ if (options === void 0) { options = new TezosProtocolOptions_1.TezosProtocolOptions(); }
134
+ var _this = _super.call(this) || this;
135
+ _this.options = options;
136
+ _this.symbol = 'XTZ';
137
+ _this.name = 'Tezos';
138
+ _this.marketSymbol = 'xtz';
139
+ _this.feeSymbol = 'xtz';
140
+ _this.decimals = 6;
141
+ _this.feeDecimals = 6; // micro tez is the smallest, 1000000 microtez is 1 tez
142
+ _this.identifier = ProtocolSymbols_1.MainProtocolSymbols.XTZ;
143
+ // tezbox default
144
+ _this.feeDefaults = {
145
+ low: '0.001420',
146
+ medium: '0.001520',
147
+ high: '0.003000'
148
+ };
149
+ _this.units = [
150
+ {
151
+ unitSymbol: 'XTZ',
152
+ factor: '1'
153
+ }
154
+ ];
155
+ _this.supportsHD = false;
156
+ _this.standardDerivationPath = "m/44h/1729h/0h/0h";
157
+ _this.addressIsCaseSensitive = true;
158
+ _this.addressValidationPattern = '^((tz1|tz2|tz3|KT1)[1-9A-Za-z]{33}|zet1[1-9A-Za-z]{65})$';
159
+ _this.addressPlaceholder = 'tz1...';
160
+ // https://gitlab.com/tezos/tezos/-/blob/master/docs/whitedoc/proof_of_stake.rst
161
+ // cycle has 4096 blocks, which are at least one minute apart
162
+ _this.minCycleDuration = 4096 * 60 * 1000; // ms
163
+ _this.transactionFee = new bignumber_1.default('1400');
164
+ _this.originationSize = new bignumber_1.default('257');
165
+ _this.storageCostPerByte = new bignumber_1.default('1000');
166
+ _this.revealFee = new bignumber_1.default('1300');
167
+ _this.activationBurn = _this.originationSize.times(_this.storageCostPerByte);
168
+ _this.originationBurn = _this.originationSize.times(_this.storageCostPerByte); // https://tezos.stackexchange.com/a/787
169
+ _this.cryptoClient = new TezosCryptoClient_1.TezosCryptoClient(TezosUtils_1.TezosUtils.tezosPrefixes.edsig);
170
+ return _this;
171
+ }
172
+ Object.defineProperty(TezosProtocol.prototype, "jsonRPCAPI", {
173
+ // TODO: Should we remove these getters and replace the calls to `this.options.network...`?
174
+ get: function () {
175
+ return this.options.network.rpcUrl;
176
+ },
177
+ enumerable: false,
178
+ configurable: true
179
+ });
180
+ TezosProtocol.prototype.getSymbol = function () {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ return __generator(this, function (_a) {
183
+ return [2 /*return*/, this.symbol];
184
+ });
185
+ });
186
+ };
187
+ TezosProtocol.prototype.getName = function () {
188
+ return __awaiter(this, void 0, void 0, function () {
189
+ return __generator(this, function (_a) {
190
+ return [2 /*return*/, this.name];
191
+ });
192
+ });
193
+ };
194
+ TezosProtocol.prototype.getMarketSymbol = function () {
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ return __generator(this, function (_a) {
197
+ return [2 /*return*/, this.marketSymbol];
198
+ });
199
+ });
200
+ };
201
+ TezosProtocol.prototype.getFeeSymbol = function () {
202
+ return __awaiter(this, void 0, void 0, function () {
203
+ return __generator(this, function (_a) {
204
+ return [2 /*return*/, this.feeSymbol];
205
+ });
206
+ });
207
+ };
208
+ TezosProtocol.prototype.getDecimals = function () {
209
+ return __awaiter(this, void 0, void 0, function () {
210
+ return __generator(this, function (_a) {
211
+ return [2 /*return*/, this.decimals];
212
+ });
213
+ });
214
+ };
215
+ TezosProtocol.prototype.getFeeDecimals = function () {
216
+ return __awaiter(this, void 0, void 0, function () {
217
+ return __generator(this, function (_a) {
218
+ return [2 /*return*/, this.feeDecimals];
219
+ });
220
+ });
221
+ };
222
+ TezosProtocol.prototype.getIdentifier = function () {
223
+ return __awaiter(this, void 0, void 0, function () {
224
+ return __generator(this, function (_a) {
225
+ return [2 /*return*/, this.identifier];
226
+ });
227
+ });
228
+ };
229
+ TezosProtocol.prototype.getFeeDefaults = function () {
230
+ return __awaiter(this, void 0, void 0, function () {
231
+ return __generator(this, function (_a) {
232
+ return [2 /*return*/, this.feeDefaults];
233
+ });
234
+ });
235
+ };
236
+ TezosProtocol.prototype.getUnits = function () {
237
+ return __awaiter(this, void 0, void 0, function () {
238
+ return __generator(this, function (_a) {
239
+ return [2 /*return*/, this.units];
240
+ });
241
+ });
242
+ };
243
+ TezosProtocol.prototype.getSupportsHD = function () {
244
+ return __awaiter(this, void 0, void 0, function () {
245
+ return __generator(this, function (_a) {
246
+ return [2 /*return*/, this.supportsHD];
247
+ });
248
+ });
249
+ };
250
+ TezosProtocol.prototype.getStandardDerivationPath = function () {
251
+ return __awaiter(this, void 0, void 0, function () {
252
+ return __generator(this, function (_a) {
253
+ return [2 /*return*/, this.standardDerivationPath];
254
+ });
255
+ });
256
+ };
257
+ TezosProtocol.prototype.getAddressIsCaseSensitive = function () {
258
+ return __awaiter(this, void 0, void 0, function () {
259
+ return __generator(this, function (_a) {
260
+ return [2 /*return*/, this.addressIsCaseSensitive];
261
+ });
262
+ });
263
+ };
264
+ TezosProtocol.prototype.getAddressValidationPattern = function () {
265
+ return __awaiter(this, void 0, void 0, function () {
266
+ return __generator(this, function (_a) {
267
+ return [2 /*return*/, this.addressValidationPattern];
268
+ });
269
+ });
270
+ };
271
+ TezosProtocol.prototype.getAddressPlaceholder = function () {
272
+ return __awaiter(this, void 0, void 0, function () {
273
+ return __generator(this, function (_a) {
274
+ return [2 /*return*/, this.addressPlaceholder];
275
+ });
276
+ });
277
+ };
278
+ TezosProtocol.prototype.getOptions = function () {
279
+ return __awaiter(this, void 0, void 0, function () {
280
+ return __generator(this, function (_a) {
281
+ return [2 /*return*/, this.options];
282
+ });
283
+ });
284
+ };
285
+ TezosProtocol.prototype.getBlockExplorerLinkForAddress = function (address) {
286
+ return __awaiter(this, void 0, void 0, function () {
287
+ return __generator(this, function (_a) {
288
+ return [2 /*return*/, this.options.network.blockExplorer.getAddressLink(address)];
289
+ });
290
+ });
291
+ };
292
+ TezosProtocol.prototype.getBlockExplorerLinkForTxId = function (txId) {
293
+ return __awaiter(this, void 0, void 0, function () {
294
+ return __generator(this, function (_a) {
295
+ return [2 /*return*/, this.options.network.blockExplorer.getTransactionLink(txId)];
296
+ });
297
+ });
298
+ };
299
+ TezosProtocol.prototype.getPublicKeyFromMnemonic = function (mnemonic, derivationPath, password) {
300
+ return __awaiter(this, void 0, void 0, function () {
301
+ var secret;
302
+ return __generator(this, function (_a) {
303
+ secret = (0, index_2.mnemonicToSeed)(mnemonic, password);
304
+ return [2 /*return*/, this.getPublicKeyFromHexSecret(secret, derivationPath)];
305
+ });
306
+ });
307
+ };
308
+ TezosProtocol.prototype.getPrivateKeyFromMnemonic = function (mnemonic, derivationPath, password) {
309
+ return __awaiter(this, void 0, void 0, function () {
310
+ var secret;
311
+ return __generator(this, function (_a) {
312
+ secret = (0, index_2.mnemonicToSeed)(mnemonic, password);
313
+ return [2 /*return*/, this.getPrivateKeyFromHexSecret(secret, derivationPath)];
314
+ });
315
+ });
316
+ };
317
+ /**
318
+ * Returns the PublicKey as String, derived from a supplied hex-string
319
+ * @param secret HEX-Secret from BIP39
320
+ * @param derivationPath DerivationPath for Key
321
+ */
322
+ TezosProtocol.prototype.getPublicKeyFromHexSecret = function (secret, derivationPath) {
323
+ return __awaiter(this, void 0, void 0, function () {
324
+ var publicKey;
325
+ return __generator(this, function (_a) {
326
+ publicKey = (0, index_3.generateWalletUsingDerivationPath)(Buffer.from(secret, 'hex'), derivationPath) // TODO: Look into typings
327
+ .publicKey;
328
+ return [2 /*return*/, Buffer.from(publicKey).toString('hex')];
329
+ });
330
+ });
331
+ };
332
+ /**
333
+ * Returns the PrivateKey as Buffer, derived from a supplied hex-string
334
+ * @param secret HEX-Secret from BIP39
335
+ * @param derivationPath DerivationPath for Key
336
+ */
337
+ TezosProtocol.prototype.getPrivateKeyFromHexSecret = function (secret, derivationPath) {
338
+ return __awaiter(this, void 0, void 0, function () {
339
+ var secretKey;
340
+ return __generator(this, function (_a) {
341
+ secretKey = (0, index_3.generateWalletUsingDerivationPath)(Buffer.from(secret, 'hex'), derivationPath) // TODO: Look into typings
342
+ .secretKey;
343
+ return [2 /*return*/, Buffer.from(secretKey).toString('hex')];
344
+ });
345
+ });
346
+ };
347
+ TezosProtocol.prototype.getAddressFromPublicKey = function (publicKey, cursor) {
348
+ return __awaiter(this, void 0, void 0, function () {
349
+ var address;
350
+ return __generator(this, function (_a) {
351
+ switch (_a.label) {
352
+ case 0: return [4 /*yield*/, TezosAddress_1.TezosAddress.fromPublicKey(publicKey)];
353
+ case 1:
354
+ address = _a.sent();
355
+ return [2 /*return*/, {
356
+ address: address.asString(),
357
+ cursor: { hasNext: false }
358
+ }];
359
+ }
360
+ });
361
+ });
362
+ };
363
+ TezosProtocol.prototype.getAddressesFromPublicKey = function (publicKey, cursor) {
364
+ return __awaiter(this, void 0, void 0, function () {
365
+ var address;
366
+ return __generator(this, function (_a) {
367
+ switch (_a.label) {
368
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey, cursor)];
369
+ case 1:
370
+ address = _a.sent();
371
+ return [2 /*return*/, [address]];
372
+ }
373
+ });
374
+ });
375
+ };
376
+ TezosProtocol.prototype.getTransactionsFromPublicKey = function (publicKey, limit, cursor) {
377
+ return __awaiter(this, void 0, void 0, function () {
378
+ var addresses;
379
+ return __generator(this, function (_a) {
380
+ switch (_a.label) {
381
+ case 0: return [4 /*yield*/, this.getAddressesFromPublicKey(publicKey).then(function (addresses) {
382
+ return addresses.map(function (address) { return address.address; });
383
+ })];
384
+ case 1:
385
+ addresses = _a.sent();
386
+ return [2 /*return*/, this.getTransactionsFromAddresses(addresses, limit, cursor)];
387
+ }
388
+ });
389
+ });
390
+ };
391
+ TezosProtocol.prototype.getTransactionsFromAddresses = function (addresses, limit, cursor) {
392
+ var _a;
393
+ return __awaiter(this, void 0, void 0, function () {
394
+ var address, results;
395
+ var _this = this;
396
+ return __generator(this, function (_b) {
397
+ switch (_b.label) {
398
+ case 0:
399
+ address = addresses[0];
400
+ return [4 /*yield*/, this.options.network.extras.indexerClient.getTransactions(address, limit, cursor === null || cursor === void 0 ? void 0 : cursor.offset)];
401
+ case 1:
402
+ results = _b.sent();
403
+ return [2 /*return*/, {
404
+ transactions: results.map(function (transaction) { return (__assign(__assign({}, transaction), { protocolIdentifier: _this.identifier, network: _this.options.network })); }),
405
+ cursor: { offset: ((_a = cursor === null || cursor === void 0 ? void 0 : cursor.offset) !== null && _a !== void 0 ? _a : 0) + results.length }
406
+ }];
407
+ }
408
+ });
409
+ });
410
+ };
411
+ TezosProtocol.prototype.signWithPrivateKey = function (privateKey, transaction) {
412
+ return __awaiter(this, void 0, void 0, function () {
413
+ var opSignature, signedOpBytes;
414
+ return __generator(this, function (_a) {
415
+ switch (_a.label) {
416
+ case 0: return [4 /*yield*/, this.cryptoClient.operationSignature(Buffer.from(privateKey, 'hex'), transaction)];
417
+ case 1:
418
+ opSignature = _a.sent();
419
+ signedOpBytes = Buffer.concat([Buffer.from(transaction.binaryTransaction, 'hex'), Buffer.from(opSignature)]);
420
+ return [2 /*return*/, signedOpBytes.toString('hex')];
421
+ }
422
+ });
423
+ });
424
+ };
425
+ TezosProtocol.prototype.getTransactionDetails = function (unsignedTx) {
426
+ return __awaiter(this, void 0, void 0, function () {
427
+ var binaryTransaction, wrappedOperations;
428
+ return __generator(this, function (_a) {
429
+ switch (_a.label) {
430
+ case 0:
431
+ binaryTransaction = unsignedTx.transaction.binaryTransaction;
432
+ return [4 /*yield*/, this.unforgeUnsignedTezosWrappedOperation(binaryTransaction)];
433
+ case 1:
434
+ wrappedOperations = _a.sent();
435
+ return [2 /*return*/, this.getAirGapTxFromWrappedOperations(wrappedOperations)];
436
+ }
437
+ });
438
+ });
439
+ };
440
+ TezosProtocol.prototype.getTransactionDetailsFromSigned = function (signedTx) {
441
+ return __awaiter(this, void 0, void 0, function () {
442
+ var binaryTransaction, wrappedOperations;
443
+ return __generator(this, function (_a) {
444
+ switch (_a.label) {
445
+ case 0:
446
+ binaryTransaction = signedTx.transaction;
447
+ return [4 /*yield*/, this.unforgeSignedTezosWrappedOperation(binaryTransaction)];
448
+ case 1:
449
+ wrappedOperations = _a.sent();
450
+ return [2 /*return*/, this.getAirGapTxFromWrappedOperations(wrappedOperations)];
451
+ }
452
+ });
453
+ });
454
+ };
455
+ TezosProtocol.prototype.getAirGapTxFromWrappedOperations = function (wrappedOperations) {
456
+ return __awaiter(this, void 0, void 0, function () {
457
+ var assertNever;
458
+ var _this = this;
459
+ return __generator(this, function (_a) {
460
+ assertNever = function (_x) { return undefined; };
461
+ return [2 /*return*/, Promise.all(wrappedOperations.contents.map(function (tezosOperation) { return __awaiter(_this, void 0, void 0, function () {
462
+ var operation, partialTxs, _a, tezosSpendOperation_1, tezosOriginationOperation, delegate, delegate;
463
+ var _this = this;
464
+ return __generator(this, function (_b) {
465
+ switch (_b.label) {
466
+ case 0:
467
+ partialTxs = [];
468
+ _a = tezosOperation.kind;
469
+ switch (_a) {
470
+ case TezosOperationType_1.TezosOperationType.REVEAL: return [3 /*break*/, 1];
471
+ case TezosOperationType_1.TezosOperationType.TRANSACTION: return [3 /*break*/, 2];
472
+ case TezosOperationType_1.TezosOperationType.ORIGINATION: return [3 /*break*/, 4];
473
+ case TezosOperationType_1.TezosOperationType.DELEGATION: return [3 /*break*/, 5];
474
+ case TezosOperationType_1.TezosOperationType.ENDORSEMENT: return [3 /*break*/, 6];
475
+ case TezosOperationType_1.TezosOperationType.SEED_NONCE_REVELATION: return [3 /*break*/, 6];
476
+ case TezosOperationType_1.TezosOperationType.DOUBLE_ENDORSEMENT_EVIDENCE: return [3 /*break*/, 6];
477
+ case TezosOperationType_1.TezosOperationType.DOUBLE_BAKING_EVIDENCE: return [3 /*break*/, 6];
478
+ case TezosOperationType_1.TezosOperationType.ACTIVATE_ACCOUNT: return [3 /*break*/, 6];
479
+ case TezosOperationType_1.TezosOperationType.PROPOSALS: return [3 /*break*/, 6];
480
+ case TezosOperationType_1.TezosOperationType.BALLOT: return [3 /*break*/, 6];
481
+ }
482
+ return [3 /*break*/, 7];
483
+ case 1:
484
+ operation = tezosOperation;
485
+ partialTxs = [
486
+ {
487
+ from: [operation.source],
488
+ to: ['Reveal']
489
+ }
490
+ ];
491
+ return [3 /*break*/, 8];
492
+ case 2:
493
+ tezosSpendOperation_1 = tezosOperation;
494
+ operation = tezosSpendOperation_1;
495
+ return [4 /*yield*/, this.getTransactionOperationDetails(tezosSpendOperation_1)];
496
+ case 3:
497
+ partialTxs = (_b.sent()).map(function (tx) { return (__assign(__assign({}, tx), { extra: __assign(__assign({}, tx.extra), { parameters: tezosSpendOperation_1.parameters }) })); });
498
+ return [3 /*break*/, 8];
499
+ case 4:
500
+ {
501
+ tezosOriginationOperation = tezosOperation;
502
+ operation = tezosOriginationOperation;
503
+ delegate = tezosOriginationOperation.delegate;
504
+ partialTxs = [
505
+ {
506
+ from: [operation.source],
507
+ amount: new bignumber_1.default(tezosOriginationOperation.balance).toFixed(),
508
+ to: [delegate ? "Delegate: ".concat(delegate) : 'Origination']
509
+ }
510
+ ];
511
+ }
512
+ return [3 /*break*/, 8];
513
+ case 5:
514
+ {
515
+ operation = tezosOperation;
516
+ delegate = operation.delegate;
517
+ partialTxs = [
518
+ {
519
+ from: [operation.source],
520
+ to: [delegate ? delegate : 'Undelegate']
521
+ }
522
+ ];
523
+ }
524
+ return [3 /*break*/, 8];
525
+ case 6: throw new index_4.UnsupportedError(coinlib_error_1.Domain.TEZOS, 'operation not supported: ' + JSON.stringify(tezosOperation.kind));
526
+ case 7:
527
+ // Exhaustive switch
528
+ assertNever(tezosOperation.kind);
529
+ throw new index_4.NotFoundError(coinlib_error_1.Domain.TEZOS, 'no operation to unforge found');
530
+ case 8: return [2 /*return*/, partialTxs.map(function (partialTx) {
531
+ return __assign({ amount: '0', fee: operation !== undefined ? new bignumber_1.default(operation.fee).toString(10) : '0', from: [], isInbound: false, protocolIdentifier: _this.identifier, network: _this.options.network, to: [], transactionDetails: tezosOperation }, partialTx);
532
+ })];
533
+ }
534
+ });
535
+ }); })).then(function (airGapTxs) {
536
+ return airGapTxs.reduce(function (flatten, next) { return flatten.concat(next); }, []);
537
+ })];
538
+ });
539
+ });
540
+ };
541
+ TezosProtocol.prototype.getBalanceOfAddresses = function (addresses, _data) {
542
+ return __awaiter(this, void 0, void 0, function () {
543
+ var balance, _i, addresses_1, address, data, error_1;
544
+ return __generator(this, function (_a) {
545
+ switch (_a.label) {
546
+ case 0:
547
+ balance = new bignumber_1.default(0);
548
+ _i = 0, addresses_1 = addresses;
549
+ _a.label = 1;
550
+ case 1:
551
+ if (!(_i < addresses_1.length)) return [3 /*break*/, 6];
552
+ address = addresses_1[_i];
553
+ _a.label = 2;
554
+ case 2:
555
+ _a.trys.push([2, 4, , 5]);
556
+ return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/balance"))];
557
+ case 3:
558
+ data = (_a.sent()).data;
559
+ balance = balance.plus(new bignumber_1.default(data));
560
+ return [3 /*break*/, 5];
561
+ case 4:
562
+ error_1 = _a.sent();
563
+ // if node returns 404 (which means 'no account found'), go with 0 balance
564
+ if (error_1.response && error_1.response.status !== 404) {
565
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error_1);
566
+ }
567
+ return [3 /*break*/, 5];
568
+ case 5:
569
+ _i++;
570
+ return [3 /*break*/, 1];
571
+ case 6: return [2 /*return*/, balance.toString(10)];
572
+ }
573
+ });
574
+ });
575
+ };
576
+ TezosProtocol.prototype.getBalanceOfPublicKey = function (publicKey, data) {
577
+ return __awaiter(this, void 0, void 0, function () {
578
+ var address;
579
+ return __generator(this, function (_a) {
580
+ switch (_a.label) {
581
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
582
+ case 1:
583
+ address = _a.sent();
584
+ return [2 /*return*/, this.getBalanceOfAddresses([address.address], data)];
585
+ }
586
+ });
587
+ });
588
+ };
589
+ TezosProtocol.prototype.getBalanceOfPublicKeyForSubProtocols = function (publicKey, subProtocols) {
590
+ return __awaiter(this, void 0, void 0, function () {
591
+ return __generator(this, function (_a) {
592
+ return [2 /*return*/, Promise.all(subProtocols.map(function (subProtocol) { return subProtocol.getBalanceOfPublicKey(publicKey).catch(function () { return '0'; }); }))];
593
+ });
594
+ });
595
+ };
596
+ TezosProtocol.prototype.getAvailableBalanceOfAddresses = function (addresses, data) {
597
+ return __awaiter(this, void 0, void 0, function () {
598
+ return __generator(this, function (_a) {
599
+ return [2 /*return*/, this.getBalanceOfAddresses(addresses, data)];
600
+ });
601
+ });
602
+ };
603
+ TezosProtocol.prototype.estimateMaxTransactionValueFromPublicKey = function (publicKey, recipients, fee) {
604
+ return __awaiter(this, void 0, void 0, function () {
605
+ var balance, balanceWrapper;
606
+ return __generator(this, function (_a) {
607
+ switch (_a.label) {
608
+ case 0: return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
609
+ case 1:
610
+ balance = _a.sent();
611
+ balanceWrapper = new bignumber_1.default(balance).minus(1) // Tezos accounts can never be empty. We must leave at least 1 mutez behind.
612
+ ;
613
+ return [2 /*return*/, this.estimateMaxTansactionValueWithBalance(publicKey, balanceWrapper, recipients, fee)];
614
+ }
615
+ });
616
+ });
617
+ };
618
+ TezosProtocol.prototype.estimateMaxTansactionValueWithBalance = function (publicKey, balance, recipients, fee) {
619
+ return __awaiter(this, void 0, void 0, function () {
620
+ var maxFee, estimatedFeeDefaults, error_2, rpcErrors, balanceTooLowError, excess, newMaxBalance, amountWithoutFees;
621
+ return __generator(this, function (_a) {
622
+ switch (_a.label) {
623
+ case 0:
624
+ maxFee = new bignumber_1.default(0);
625
+ if (!(fee !== undefined)) return [3 /*break*/, 1];
626
+ maxFee = new bignumber_1.default(fee);
627
+ return [3 /*break*/, 4];
628
+ case 1:
629
+ _a.trys.push([1, 3, , 4]);
630
+ return [4 /*yield*/, this.estimateFeeDefaultsFromPublicKey(publicKey, recipients, [balance.toFixed()])];
631
+ case 2:
632
+ estimatedFeeDefaults = _a.sent();
633
+ maxFee = new bignumber_1.default(estimatedFeeDefaults.medium).shiftedBy(this.decimals);
634
+ if (maxFee.gte(balance)) {
635
+ maxFee = new bignumber_1.default(0);
636
+ }
637
+ return [3 /*break*/, 4];
638
+ case 3:
639
+ error_2 = _a.sent();
640
+ if (error_2.code !== undefined && error_2.code === index_4.ProtocolErrorType.TRANSACTION_FAILED && Array.isArray(error_2.data)) {
641
+ rpcErrors = error_2.data;
642
+ balanceTooLowError = rpcErrors.find(function (error) { return error.id.endsWith('.contract.balance_too_low'); });
643
+ if (balanceTooLowError !== undefined && balanceTooLowError.amount !== undefined && balanceTooLowError.balance !== undefined) {
644
+ excess = new bignumber_1.default(balanceTooLowError.amount).minus(new bignumber_1.default(balanceTooLowError.balance).minus(1));
645
+ newMaxBalance = balance.minus(excess);
646
+ if (newMaxBalance.gt(0)) {
647
+ return [2 /*return*/, this.estimateMaxTansactionValueWithBalance(publicKey, newMaxBalance, recipients, fee)];
648
+ }
649
+ }
650
+ }
651
+ throw error_2;
652
+ case 4:
653
+ amountWithoutFees = balance.minus(maxFee);
654
+ if (amountWithoutFees.isNegative()) {
655
+ amountWithoutFees = new bignumber_1.default(0);
656
+ }
657
+ return [2 /*return*/, amountWithoutFees.toFixed()];
658
+ }
659
+ });
660
+ });
661
+ };
662
+ TezosProtocol.prototype.estimateFeeDefaultsFromPublicKey = function (publicKey, recipients, values, _data) {
663
+ return __awaiter(this, void 0, void 0, function () {
664
+ var operations, i, recipient, transaction;
665
+ return __generator(this, function (_a) {
666
+ if (recipients.length !== values.length) {
667
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
668
+ }
669
+ operations = [];
670
+ for (i = 0; i < values.length; ++i) {
671
+ recipient = recipients[i];
672
+ transaction = {
673
+ kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
674
+ amount: values[i],
675
+ destination: recipient,
676
+ fee: '0'
677
+ };
678
+ operations.push(transaction);
679
+ }
680
+ if (recipients.length === 0) {
681
+ return [2 /*return*/, this.feeDefaults];
682
+ }
683
+ return [2 /*return*/, this.estimateFeeDefaultsForOperations(publicKey, operations)];
684
+ });
685
+ });
686
+ };
687
+ TezosProtocol.prototype.estimateFeeDefaultsForOperations = function (publicKey, operations) {
688
+ return __awaiter(this, void 0, void 0, function () {
689
+ var estimated, hasReveal, estimatedFee, feeStepFactor, lowFee, mediumFee, highFee;
690
+ return __generator(this, function (_a) {
691
+ switch (_a.label) {
692
+ case 0: return [4 /*yield*/, this.prepareOperations(publicKey, operations)];
693
+ case 1:
694
+ estimated = _a.sent();
695
+ hasReveal = estimated.contents.some(function (op) { return op.kind === TezosOperationType_1.TezosOperationType.REVEAL; });
696
+ estimatedFee = estimated.contents
697
+ .reduce(function (current, next) {
698
+ if (next.fee !== undefined) {
699
+ return current.plus(new bignumber_1.default(next.fee));
700
+ }
701
+ return current;
702
+ }, new bignumber_1.default(0))
703
+ .minus(hasReveal ? this.revealFee : 0)
704
+ .div(hasReveal ? estimated.contents.length - 1 : estimated.contents.length);
705
+ feeStepFactor = new bignumber_1.default(0.2);
706
+ lowFee = estimatedFee;
707
+ mediumFee = lowFee.plus(lowFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
708
+ highFee = mediumFee.plus(mediumFee.times(feeStepFactor).integerValue(bignumber_1.default.ROUND_FLOOR));
709
+ return [2 /*return*/, {
710
+ low: lowFee.shiftedBy(-this.feeDecimals).toFixed(),
711
+ medium: mediumFee.shiftedBy(-this.feeDecimals).toFixed(),
712
+ high: highFee.shiftedBy(-this.feeDecimals).toFixed()
713
+ }];
714
+ }
715
+ });
716
+ });
717
+ };
718
+ TezosProtocol.prototype.prepareTransactionFromPublicKey = function (publicKey, recipients, values, fee, data) {
719
+ return __awaiter(this, void 0, void 0, function () {
720
+ var transactions;
721
+ return __generator(this, function (_a) {
722
+ switch (_a.label) {
723
+ case 0:
724
+ if (recipients.length !== values.length) {
725
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
726
+ }
727
+ if (recipients.length > MAX_OPERATIONS_PER_GROUP) {
728
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, "this transaction exceeds the maximum allowed number of transactions per operation (".concat(MAX_OPERATIONS_PER_GROUP, "). Please use the \"prepareTransactionsFromPublicKey\" method instead."));
729
+ }
730
+ return [4 /*yield*/, this.prepareTransactionsFromPublicKey(publicKey, recipients, values, fee, data)];
731
+ case 1:
732
+ transactions = _a.sent();
733
+ if (transactions.length === 1) {
734
+ return [2 /*return*/, transactions[0]];
735
+ }
736
+ else {
737
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'Transaction could not be prepared. More or less than 1 operations have been generated.');
738
+ }
739
+ return [2 /*return*/];
740
+ }
741
+ });
742
+ });
743
+ };
744
+ TezosProtocol.prototype.prepareTransactionsFromPublicKey = function (publicKey, recipients, values, fee, data, operationsPerGroup) {
745
+ if (operationsPerGroup === void 0) { operationsPerGroup = MAX_OPERATIONS_PER_GROUP; }
746
+ return __awaiter(this, void 0, void 0, function () {
747
+ var wrappedValues, wrappedFee, operations, addressIndex, addresses, address, results, currentCounter, counter, branch, accountManager, _a, _b, balance, _c, wrappedOperations, allOperations, numberOfGroups, startingCounter, i, start, end, operationsGroup, wrappedOperationWithEstimatedGas, _d, _e;
748
+ return __generator(this, function (_f) {
749
+ switch (_f.label) {
750
+ case 0:
751
+ wrappedValues = values.map(function (value) { return new bignumber_1.default(value); });
752
+ wrappedFee = new bignumber_1.default(fee);
753
+ if (recipients.length !== wrappedValues.length) {
754
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'length of recipients and values does not match!');
755
+ }
756
+ operations = [];
757
+ addressIndex = data && data.addressIndex ? data.addressIndex : 0;
758
+ return [4 /*yield*/, this.getAddressesFromPublicKey(publicKey).then(function (addresses) {
759
+ return addresses.map(function (address) { return address.address; });
760
+ })];
761
+ case 1:
762
+ addresses = _f.sent();
763
+ if (!addresses[addressIndex]) {
764
+ throw new index_4.NotFoundError(coinlib_error_1.Domain.TEZOS, 'no kt-address with this index exists');
765
+ }
766
+ address = addresses[addressIndex];
767
+ return [4 /*yield*/, Promise.all([
768
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/counter")),
769
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
770
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/manager_key"))
771
+ ]).catch(function (error) {
772
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
773
+ })];
774
+ case 2:
775
+ results = _f.sent();
776
+ currentCounter = new bignumber_1.default(results[0].data);
777
+ counter = currentCounter.plus(1);
778
+ branch = results[1].data;
779
+ accountManager = results[2].data;
780
+ if (!!accountManager) return [3 /*break*/, 4];
781
+ _b = (_a = operations).push;
782
+ return [4 /*yield*/, this.createRevealOperation(counter, publicKey, address)];
783
+ case 3:
784
+ _b.apply(_a, [_f.sent()]);
785
+ counter = counter.plus(1);
786
+ _f.label = 4;
787
+ case 4:
788
+ _c = bignumber_1.default.bind;
789
+ return [4 /*yield*/, this.getBalanceOfPublicKey(publicKey)];
790
+ case 5:
791
+ balance = new (_c.apply(bignumber_1.default, [void 0, _f.sent()]))();
792
+ wrappedOperations = [];
793
+ return [4 /*yield*/, this.createTransactionOperations(operations, recipients, wrappedValues, wrappedFee, address, counter, balance)];
794
+ case 6:
795
+ allOperations = _f.sent();
796
+ allOperations = operations.concat(allOperations); // if we have a reveal in operations, we need to make sure it is present in the allOperations array
797
+ numberOfGroups = Math.ceil(allOperations.length / operationsPerGroup);
798
+ startingCounter = numberOfGroups > 1 ? currentCounter.plus(1) : undefined;
799
+ i = 0;
800
+ _f.label = 7;
801
+ case 7:
802
+ if (!(i < numberOfGroups)) return [3 /*break*/, 11];
803
+ start = i * operationsPerGroup;
804
+ end = start + operationsPerGroup;
805
+ operationsGroup = allOperations.slice(start, end);
806
+ return [4 /*yield*/, this.estimateAndReplaceLimitsAndFee({
807
+ branch: branch,
808
+ contents: operationsGroup
809
+ }, false, startingCounter)];
810
+ case 8:
811
+ wrappedOperationWithEstimatedGas = _f.sent();
812
+ _e = (_d = wrappedOperations).push;
813
+ return [4 /*yield*/, this.forgeAndWrapOperations(wrappedOperationWithEstimatedGas)];
814
+ case 9:
815
+ _e.apply(_d, [_f.sent()]);
816
+ _f.label = 10;
817
+ case 10:
818
+ i++;
819
+ return [3 /*break*/, 7];
820
+ case 11: return [2 /*return*/, wrappedOperations];
821
+ }
822
+ });
823
+ });
824
+ };
825
+ TezosProtocol.prototype.getTransactionOperationDetails = function (transactionOperation) {
826
+ return __awaiter(this, void 0, void 0, function () {
827
+ return __generator(this, function (_a) {
828
+ return [2 /*return*/, [
829
+ {
830
+ from: [transactionOperation.source],
831
+ amount: new bignumber_1.default(transactionOperation.amount).toFixed(),
832
+ to: [transactionOperation.destination] // contract destination but should be the address of actual receiver
833
+ }
834
+ ]];
835
+ });
836
+ });
837
+ };
838
+ TezosProtocol.prototype.createTransactionOperations = function (previousOperations, recipients, wrappedValues, wrappedFee, address, counter, balance) {
839
+ return __awaiter(this, void 0, void 0, function () {
840
+ var amountUsedByPreviousOperations, operations, i, receivingBalance, _a, spendOperation;
841
+ return __generator(this, function (_b) {
842
+ switch (_b.label) {
843
+ case 0:
844
+ amountUsedByPreviousOperations = this.getAmountUsedByPreviousOperations(previousOperations);
845
+ operations = [];
846
+ if (!amountUsedByPreviousOperations.isZero()) {
847
+ if (balance.isLessThan(wrappedValues[0].plus(wrappedFee).plus(amountUsedByPreviousOperations))) {
848
+ // if not, make room for the init fee
849
+ wrappedValues[0] = wrappedValues[0].minus(amountUsedByPreviousOperations); // deduct fee from balance
850
+ }
851
+ }
852
+ i = 0;
853
+ _b.label = 1;
854
+ case 1:
855
+ if (!(i < recipients.length)) return [3 /*break*/, 4];
856
+ _a = bignumber_1.default.bind;
857
+ return [4 /*yield*/, this.getBalanceOfAddresses([recipients[i]])];
858
+ case 2:
859
+ receivingBalance = new (_a.apply(bignumber_1.default, [void 0, _b.sent()]))();
860
+ // if our receiver has 0 balance, the account is not activated yet.
861
+ if (receivingBalance.isZero() && recipients[i].toLowerCase().startsWith('tz')) {
862
+ // We have to supply an additional 0.257 XTZ fee for storage_limit costs, which gets automatically deducted from the sender so we just have to make sure enough balance is around
863
+ if (balance.isLessThan(this.activationBurn.plus(wrappedFee))) {
864
+ // If we don't have enough funds to pay the activation + fee, we throw an error
865
+ throw new index_4.BalanceError(coinlib_error_1.Domain.TEZOS, 'Insufficient balance to pay activation burn!');
866
+ }
867
+ else if (balance.isLessThan(wrappedValues[i].plus(wrappedFee).plus(this.activationBurn))) {
868
+ // Check whether the sender has enough to cover the amount to send + fee + activation
869
+ // If not, we deduct it from amount sent to make room for the activation burn
870
+ wrappedValues[i] = wrappedValues[i].minus(this.activationBurn); // deduct fee from balance
871
+ }
872
+ }
873
+ if (balance.isEqualTo(wrappedValues[i].plus(wrappedFee))) {
874
+ // Tezos accounts can never be empty. If user tries to send everything, we must leave 1 mutez behind.
875
+ wrappedValues[i] = wrappedValues[i].minus(1);
876
+ }
877
+ else if (balance.isLessThan(wrappedValues[i].plus(wrappedFee))) {
878
+ throw new index_4.BalanceError(coinlib_error_1.Domain.TEZOS, 'not enough balance');
879
+ }
880
+ spendOperation = {
881
+ kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
882
+ fee: wrappedFee.toFixed(),
883
+ gas_limit: GAS_LIMIT_PLACEHOLDER,
884
+ storage_limit: STORAGE_LIMIT_PLACEHOLDER,
885
+ amount: wrappedValues[i].toFixed(),
886
+ counter: counter.plus(i).toFixed(),
887
+ destination: recipients[i],
888
+ source: address
889
+ };
890
+ operations.push(spendOperation);
891
+ _b.label = 3;
892
+ case 3:
893
+ i++;
894
+ return [3 /*break*/, 1];
895
+ case 4: return [2 /*return*/, operations];
896
+ }
897
+ });
898
+ });
899
+ };
900
+ TezosProtocol.prototype.forgeAndWrapOperations = function (tezosWrappedOperation) {
901
+ return __awaiter(this, void 0, void 0, function () {
902
+ var binaryTx, error_3;
903
+ return __generator(this, function (_a) {
904
+ switch (_a.label) {
905
+ case 0:
906
+ _a.trys.push([0, 2, , 3]);
907
+ return [4 /*yield*/, this.forgeTezosOperation(tezosWrappedOperation)];
908
+ case 1:
909
+ binaryTx = _a.sent();
910
+ return [2 /*return*/, { binaryTransaction: binaryTx }];
911
+ case 2:
912
+ error_3 = _a.sent();
913
+ throw new index_4.OperationFailedError(coinlib_error_1.Domain.TEZOS, "Forging Tezos TX failed with ".concat(JSON.stringify(error_3.message)));
914
+ case 3: return [2 /*return*/];
915
+ }
916
+ });
917
+ });
918
+ };
919
+ TezosProtocol.prototype.getDefaultDelegatee = function () {
920
+ return __awaiter(this, void 0, void 0, function () {
921
+ var activeBakers;
922
+ return __generator(this, function (_a) {
923
+ switch (_a.label) {
924
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates?active"))];
925
+ case 1:
926
+ activeBakers = (_a.sent()).data;
927
+ return [2 /*return*/, activeBakers[0] || ''];
928
+ }
929
+ });
930
+ });
931
+ };
932
+ TezosProtocol.prototype.getCurrentDelegateesForPublicKey = function (publicKey) {
933
+ return __awaiter(this, void 0, void 0, function () {
934
+ var address;
935
+ return __generator(this, function (_a) {
936
+ switch (_a.label) {
937
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
938
+ case 1:
939
+ address = _a.sent();
940
+ return [2 /*return*/, this.getCurrentDelegateesForAddress(address.address)];
941
+ }
942
+ });
943
+ });
944
+ };
945
+ TezosProtocol.prototype.getCurrentDelegateesForAddress = function (address) {
946
+ return __awaiter(this, void 0, void 0, function () {
947
+ var data;
948
+ return __generator(this, function (_a) {
949
+ switch (_a.label) {
950
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))];
951
+ case 1:
952
+ data = (_a.sent()).data;
953
+ return [2 /*return*/, data.delegate ? [data.delegate] : []];
954
+ }
955
+ });
956
+ });
957
+ };
958
+ TezosProtocol.prototype.getDelegateeDetails = function (address) {
959
+ return __awaiter(this, void 0, void 0, function () {
960
+ var response, isBakingActive;
961
+ return __generator(this, function (_a) {
962
+ switch (_a.label) {
963
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(address, "/deactivated"))];
964
+ case 1:
965
+ response = _a.sent();
966
+ isBakingActive = !response.data;
967
+ return [2 /*return*/, {
968
+ status: isBakingActive ? 'Active' : 'Inactive',
969
+ address: address
970
+ }];
971
+ }
972
+ });
973
+ });
974
+ };
975
+ TezosProtocol.prototype.isPublicKeyDelegating = function (publicKey) {
976
+ return __awaiter(this, void 0, void 0, function () {
977
+ var address;
978
+ return __generator(this, function (_a) {
979
+ switch (_a.label) {
980
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
981
+ case 1:
982
+ address = _a.sent();
983
+ return [2 /*return*/, this.isAddressDelegating(address.address)];
984
+ }
985
+ });
986
+ });
987
+ };
988
+ TezosProtocol.prototype.isAddressDelegating = function (address) {
989
+ return __awaiter(this, void 0, void 0, function () {
990
+ var data;
991
+ return __generator(this, function (_a) {
992
+ switch (_a.label) {
993
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))];
994
+ case 1:
995
+ data = (_a.sent()).data;
996
+ return [2 /*return*/, !!data.delegate];
997
+ }
998
+ });
999
+ });
1000
+ };
1001
+ TezosProtocol.prototype.getDelegatorDetailsFromPublicKey = function (publicKey) {
1002
+ return __awaiter(this, void 0, void 0, function () {
1003
+ var address;
1004
+ return __generator(this, function (_a) {
1005
+ switch (_a.label) {
1006
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
1007
+ case 1:
1008
+ address = _a.sent();
1009
+ return [2 /*return*/, this.getDelegatorDetailsFromAddress(address.address)];
1010
+ }
1011
+ });
1012
+ });
1013
+ };
1014
+ TezosProtocol.prototype.getDelegatorDetailsFromAddress = function (address) {
1015
+ return __awaiter(this, void 0, void 0, function () {
1016
+ return __generator(this, function (_a) {
1017
+ return [2 /*return*/, this.getDelegatorDetails(address)];
1018
+ });
1019
+ });
1020
+ };
1021
+ TezosProtocol.prototype.getDelegationDetailsFromPublicKey = function (publicKey, delegatees) {
1022
+ return __awaiter(this, void 0, void 0, function () {
1023
+ var address;
1024
+ return __generator(this, function (_a) {
1025
+ switch (_a.label) {
1026
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey)];
1027
+ case 1:
1028
+ address = _a.sent();
1029
+ return [2 /*return*/, this.getDelegationDetailsFromAddress(address.address, delegatees)];
1030
+ }
1031
+ });
1032
+ });
1033
+ };
1034
+ TezosProtocol.prototype.getDelegationDetailsFromAddress = function (address, delegatees) {
1035
+ return __awaiter(this, void 0, void 0, function () {
1036
+ var bakerAddress, results, delegatorDetails, bakerDetails;
1037
+ return __generator(this, function (_a) {
1038
+ switch (_a.label) {
1039
+ case 0:
1040
+ if (delegatees.length > 1) {
1041
+ return [2 /*return*/, Promise.reject('Multiple delegation is not supported.')];
1042
+ }
1043
+ bakerAddress = delegatees[0];
1044
+ return [4 /*yield*/, Promise.all([this.getDelegatorDetails(address, bakerAddress), this.getDelegateeDetails(bakerAddress)])];
1045
+ case 1:
1046
+ results = _a.sent();
1047
+ delegatorDetails = results[0];
1048
+ bakerDetails = results[1];
1049
+ return [2 /*return*/, {
1050
+ delegator: delegatorDetails,
1051
+ delegatees: [bakerDetails]
1052
+ }];
1053
+ }
1054
+ });
1055
+ });
1056
+ };
1057
+ TezosProtocol.prototype.getDelegatorDetails = function (address, bakerAddress) {
1058
+ return __awaiter(this, void 0, void 0, function () {
1059
+ var results, accountDetails, balance, isDelegating, availableActions;
1060
+ return __generator(this, function (_a) {
1061
+ switch (_a.label) {
1062
+ case 0: return [4 /*yield*/, Promise.all([
1063
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address))
1064
+ // this.getDelegationRewardsForAddress(address).catch(() => [] as DelegationRewardInfo[])
1065
+ ])];
1066
+ case 1:
1067
+ results = _a.sent();
1068
+ accountDetails = results[0].data;
1069
+ balance = accountDetails.balance;
1070
+ isDelegating = !!accountDetails.delegate;
1071
+ availableActions = [];
1072
+ if (!isDelegating) {
1073
+ availableActions.push({
1074
+ type: TezosDelegatorAction.DELEGATE,
1075
+ args: ['delegate']
1076
+ });
1077
+ }
1078
+ else if (!bakerAddress || accountDetails.delegate === bakerAddress) {
1079
+ availableActions.push({
1080
+ type: TezosDelegatorAction.UNDELEGATE
1081
+ });
1082
+ }
1083
+ else {
1084
+ availableActions.push({
1085
+ type: TezosDelegatorAction.CHANGE_BAKER,
1086
+ args: ['delegate']
1087
+ });
1088
+ }
1089
+ // const rewards = isDelegating
1090
+ // ? rewardInfo.map((reward) => ({
1091
+ // index: reward.cycle,
1092
+ // amount: reward.reward.toFixed(),
1093
+ // collected: reward.payout < new Date(),
1094
+ // timestamp: reward.payout.getTime()
1095
+ // }))
1096
+ // : []
1097
+ return [2 /*return*/, {
1098
+ address: address,
1099
+ balance: balance,
1100
+ delegatees: [accountDetails.delegate],
1101
+ availableActions: availableActions
1102
+ // rewards
1103
+ }];
1104
+ }
1105
+ });
1106
+ });
1107
+ };
1108
+ TezosProtocol.prototype.prepareDelegatorActionFromPublicKey = function (publicKey, type, data) {
1109
+ return __awaiter(this, void 0, void 0, function () {
1110
+ var _a;
1111
+ return __generator(this, function (_b) {
1112
+ switch (_b.label) {
1113
+ case 0:
1114
+ _a = type;
1115
+ switch (_a) {
1116
+ case TezosDelegatorAction.DELEGATE: return [3 /*break*/, 1];
1117
+ case TezosDelegatorAction.CHANGE_BAKER: return [3 /*break*/, 1];
1118
+ case TezosDelegatorAction.UNDELEGATE: return [3 /*break*/, 3];
1119
+ }
1120
+ return [3 /*break*/, 5];
1121
+ case 1:
1122
+ if (!data || !data.delegate) {
1123
+ return [2 /*return*/, Promise.reject("Invalid arguments passed for ".concat(type, " action, delegate is missing."))];
1124
+ }
1125
+ return [4 /*yield*/, this.delegate(publicKey, data.delegate)];
1126
+ case 2: return [2 /*return*/, [_b.sent()]];
1127
+ case 3: return [4 /*yield*/, this.undelegate(publicKey)];
1128
+ case 4: return [2 /*return*/, [_b.sent()]];
1129
+ case 5: return [2 /*return*/, Promise.reject('Unsupported delegator action.')];
1130
+ }
1131
+ });
1132
+ });
1133
+ };
1134
+ TezosProtocol.prototype.prepareOperations = function (publicKey, operationRequests, overrideParameters) {
1135
+ if (overrideParameters === void 0) { overrideParameters = true; }
1136
+ return __awaiter(this, void 0, void 0, function () {
1137
+ var counter, branch, operations, address, results, accountManager, hasRevealInOperationRequests, _a, _b, operationPromises, _c, _d, _e, tezosWrappedOperation;
1138
+ var _this = this;
1139
+ return __generator(this, function (_f) {
1140
+ switch (_f.label) {
1141
+ case 0:
1142
+ counter = new bignumber_1.default(1);
1143
+ operations = [];
1144
+ return [4 /*yield*/, this.getAddressFromPublicKey(publicKey).then(function (address) { return address.address; })];
1145
+ case 1:
1146
+ address = _f.sent();
1147
+ return [4 /*yield*/, Promise.all([
1148
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/counter")),
1149
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
1150
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(address, "/manager_key"))
1151
+ ]).catch(function (error) {
1152
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1153
+ })];
1154
+ case 2:
1155
+ results = _f.sent();
1156
+ counter = new bignumber_1.default(results[0].data).plus(1);
1157
+ branch = results[1].data;
1158
+ accountManager = results[2].data;
1159
+ hasRevealInOperationRequests = operationRequests.some(function (request) { return request.kind === TezosOperationType_1.TezosOperationType.REVEAL; });
1160
+ if (!(!accountManager && !hasRevealInOperationRequests)) return [3 /*break*/, 4];
1161
+ _b = (_a = operations).push;
1162
+ return [4 /*yield*/, this.createRevealOperation(counter, publicKey, address)];
1163
+ case 3:
1164
+ _b.apply(_a, [_f.sent()]);
1165
+ counter = counter.plus(1);
1166
+ _f.label = 4;
1167
+ case 4:
1168
+ operationPromises = operationRequests.map(function (operationRequest, index) { return __awaiter(_this, void 0, void 0, function () {
1169
+ var recipient, receivingBalance, _a, defaultCounter, defaultFee, defaultGasLimit, defaultStorageLimit, revealOperation, delegationOperation, transactionOperation, originationOperation;
1170
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
1171
+ return __generator(this, function (_y) {
1172
+ switch (_y.label) {
1173
+ case 0:
1174
+ // TODO: Handle activation burn
1175
+ if (!operationRequest.kind) {
1176
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "kind" was not defined');
1177
+ }
1178
+ recipient = operationRequest.destination;
1179
+ if (!(recipient && recipient.toLowerCase().startsWith('tz'))) return [3 /*break*/, 2];
1180
+ _a = bignumber_1.default.bind;
1181
+ return [4 /*yield*/, this.getBalanceOfAddresses([recipient])];
1182
+ case 1:
1183
+ receivingBalance = new (_a.apply(bignumber_1.default, [void 0, _y.sent()]))();
1184
+ _y.label = 2;
1185
+ case 2:
1186
+ defaultCounter = counter.plus(index).toFixed() // TODO: Handle counter if we have some operations without counters in the array
1187
+ ;
1188
+ defaultFee = FEE_PLACEHOLDER;
1189
+ defaultGasLimit = '10300';
1190
+ defaultStorageLimit = receivingBalance && receivingBalance.isZero() && recipient && recipient.toLowerCase().startsWith('tz') ? '300' : '0' // taken from eztz
1191
+ ;
1192
+ switch (operationRequest.kind) {
1193
+ // TODO: Handle if the dApp already provides a reveal operation
1194
+ case TezosOperationType_1.TezosOperationType.REVEAL:
1195
+ revealOperation = operationRequest;
1196
+ if (!revealOperation.public_key) {
1197
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "public_key" was not defined');
1198
+ }
1199
+ revealOperation.source = (_b = revealOperation.source) !== null && _b !== void 0 ? _b : address;
1200
+ revealOperation.counter = (_c = revealOperation.counter) !== null && _c !== void 0 ? _c : defaultCounter;
1201
+ revealOperation.fee = (_d = revealOperation.fee) !== null && _d !== void 0 ? _d : defaultFee;
1202
+ revealOperation.gas_limit = (_e = revealOperation.gas_limit) !== null && _e !== void 0 ? _e : defaultGasLimit;
1203
+ revealOperation.storage_limit = (_f = revealOperation.storage_limit) !== null && _f !== void 0 ? _f : defaultStorageLimit;
1204
+ return [2 /*return*/, revealOperation];
1205
+ case TezosOperationType_1.TezosOperationType.DELEGATION:
1206
+ delegationOperation = operationRequest;
1207
+ // The delegate property is optional, so we don't have any mandatory properties to check for
1208
+ delegationOperation.source = (_g = delegationOperation.source) !== null && _g !== void 0 ? _g : address;
1209
+ delegationOperation.counter = (_h = delegationOperation.counter) !== null && _h !== void 0 ? _h : defaultCounter;
1210
+ delegationOperation.fee = (_j = delegationOperation.fee) !== null && _j !== void 0 ? _j : defaultFee;
1211
+ delegationOperation.gas_limit = (_k = delegationOperation.gas_limit) !== null && _k !== void 0 ? _k : defaultGasLimit;
1212
+ delegationOperation.storage_limit = (_l = delegationOperation.storage_limit) !== null && _l !== void 0 ? _l : defaultStorageLimit;
1213
+ return [2 /*return*/, delegationOperation];
1214
+ case TezosOperationType_1.TezosOperationType.TRANSACTION:
1215
+ transactionOperation = operationRequest;
1216
+ if (!transactionOperation.amount) {
1217
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "amount" was not defined');
1218
+ }
1219
+ if (!transactionOperation.destination) {
1220
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "destination" was not defined');
1221
+ }
1222
+ transactionOperation.source = (_m = transactionOperation.source) !== null && _m !== void 0 ? _m : address;
1223
+ transactionOperation.counter = (_o = transactionOperation.counter) !== null && _o !== void 0 ? _o : defaultCounter;
1224
+ transactionOperation.fee = (_p = transactionOperation.fee) !== null && _p !== void 0 ? _p : defaultFee;
1225
+ transactionOperation.gas_limit = (_q = transactionOperation.gas_limit) !== null && _q !== void 0 ? _q : GAS_LIMIT_PLACEHOLDER;
1226
+ transactionOperation.storage_limit = (_r = transactionOperation.storage_limit) !== null && _r !== void 0 ? _r : STORAGE_LIMIT_PLACEHOLDER;
1227
+ return [2 /*return*/, transactionOperation];
1228
+ case TezosOperationType_1.TezosOperationType.ORIGINATION:
1229
+ originationOperation = operationRequest;
1230
+ if (!originationOperation.balance) {
1231
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "balance" was not defined');
1232
+ }
1233
+ if (!originationOperation.script) {
1234
+ throw new index_4.PropertyUndefinedError(coinlib_error_1.Domain.TEZOS, 'property "script" was not defined');
1235
+ }
1236
+ originationOperation.source = (_s = originationOperation.source) !== null && _s !== void 0 ? _s : address;
1237
+ originationOperation.counter = (_t = originationOperation.counter) !== null && _t !== void 0 ? _t : defaultCounter;
1238
+ originationOperation.fee = (_u = originationOperation.fee) !== null && _u !== void 0 ? _u : defaultFee;
1239
+ originationOperation.gas_limit = (_v = originationOperation.gas_limit) !== null && _v !== void 0 ? _v : GAS_LIMIT_PLACEHOLDER;
1240
+ originationOperation.storage_limit = (_w = originationOperation.storage_limit) !== null && _w !== void 0 ? _w : STORAGE_LIMIT_PLACEHOLDER;
1241
+ return [2 /*return*/, originationOperation];
1242
+ case TezosOperationType_1.TezosOperationType.ENDORSEMENT:
1243
+ case TezosOperationType_1.TezosOperationType.SEED_NONCE_REVELATION:
1244
+ case TezosOperationType_1.TezosOperationType.DOUBLE_ENDORSEMENT_EVIDENCE:
1245
+ case TezosOperationType_1.TezosOperationType.DOUBLE_BAKING_EVIDENCE:
1246
+ case TezosOperationType_1.TezosOperationType.ACTIVATE_ACCOUNT:
1247
+ case TezosOperationType_1.TezosOperationType.PROPOSALS:
1248
+ case TezosOperationType_1.TezosOperationType.BALLOT:
1249
+ // Do not change anything
1250
+ return [2 /*return*/, operationRequest];
1251
+ default:
1252
+ (0, assert_1.assertNever)(operationRequest.kind);
1253
+ throw new index_4.UnsupportedError(coinlib_error_1.Domain.TEZOS, "unsupported operation type \"".concat(JSON.stringify(operationRequest.kind), "\""));
1254
+ }
1255
+ return [2 /*return*/];
1256
+ }
1257
+ });
1258
+ }); });
1259
+ _d = (_c = operations.push).apply;
1260
+ _e = [operations];
1261
+ return [4 /*yield*/, Promise.all(operationPromises)];
1262
+ case 5:
1263
+ _d.apply(_c, _e.concat([(_f.sent())]));
1264
+ tezosWrappedOperation = {
1265
+ branch: branch,
1266
+ contents: operations
1267
+ };
1268
+ return [4 /*yield*/, this.estimateAndReplaceLimitsAndFee(tezosWrappedOperation, overrideParameters)];
1269
+ case 6: return [2 /*return*/, _f.sent()];
1270
+ }
1271
+ });
1272
+ });
1273
+ };
1274
+ TezosProtocol.prototype.estimateAndReplaceLimitsAndFee = function (tezosWrappedOperation, overrideParameters, startingCounter) {
1275
+ if (overrideParameters === void 0) { overrideParameters = true; }
1276
+ return __awaiter(this, void 0, void 0, function () {
1277
+ var fakeSignature, opKinds, contents, block, body, forgedOperation, gasLimitTotal, response, fee, nonRevealOperations, feePerOperation_1;
1278
+ return __generator(this, function (_a) {
1279
+ switch (_a.label) {
1280
+ case 0:
1281
+ fakeSignature = 'sigUHx32f9wesZ1n2BWpixXz4AQaZggEtchaQNHYGRCoWNAXx45WGW2ua3apUUUAGMLPwAU41QoaFCzVSL61VaessLg4YbbP';
1282
+ opKinds = [
1283
+ TezosOperationType_1.TezosOperationType.TRANSACTION,
1284
+ TezosOperationType_1.TezosOperationType.REVEAL,
1285
+ TezosOperationType_1.TezosOperationType.ORIGINATION,
1286
+ TezosOperationType_1.TezosOperationType.DELEGATION
1287
+ ];
1288
+ contents = tezosWrappedOperation.contents.map(function (operation, i) {
1289
+ if (!opKinds.includes(operation.kind)) {
1290
+ return operation;
1291
+ }
1292
+ var op = operation;
1293
+ var gasValue = new bignumber_1.default(MAX_GAS_PER_BLOCK).dividedToIntegerBy(tezosWrappedOperation.contents.length);
1294
+ var gas_limit = new bignumber_1.default(GAS_LIMIT_PLACEHOLDER).gt(gasValue) ? gasValue : GAS_LIMIT_PLACEHOLDER;
1295
+ var counter = startingCounter ? startingCounter.plus(i).toString() : op.counter;
1296
+ return __assign(__assign({}, operation), { gas_limit: gas_limit, counter: counter });
1297
+ });
1298
+ return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head"))];
1299
+ case 1:
1300
+ block = (_a.sent()).data;
1301
+ body = {
1302
+ chain_id: block.chain_id,
1303
+ operation: {
1304
+ branch: tezosWrappedOperation.branch,
1305
+ contents: contents,
1306
+ signature: fakeSignature // signature will not be checked, so it is ok to always use this one
1307
+ }
1308
+ };
1309
+ return [4 /*yield*/, this.forgeTezosOperation(tezosWrappedOperation)];
1310
+ case 2:
1311
+ forgedOperation = _a.sent();
1312
+ gasLimitTotal = 0;
1313
+ return [4 /*yield*/, index_1.default
1314
+ .post("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/helpers/scripts/run_operation"), body, {
1315
+ headers: { 'Content-Type': 'application/json' }
1316
+ })
1317
+ .catch(function (runOperationError) {
1318
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, runOperationError);
1319
+ })];
1320
+ case 3:
1321
+ response = _a.sent();
1322
+ if (tezosWrappedOperation.contents.length !== response.data.contents.length) {
1323
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, "Run Operation did not return same number of operations. Locally we have ".concat(tezosWrappedOperation.contents.length, ", but got back ").concat(response.data.contents.length));
1324
+ }
1325
+ tezosWrappedOperation.contents.forEach(function (content, i) {
1326
+ var metadata = response.data.contents[i].metadata;
1327
+ if (metadata.operation_result) {
1328
+ var operation = content;
1329
+ var result = metadata.operation_result;
1330
+ var gasLimit_1 = 0;
1331
+ var storageLimit_1 = 0;
1332
+ // If there are internal operations, we first add gas and storage used of internal operations
1333
+ if (metadata.internal_operation_results) {
1334
+ metadata.internal_operation_results.forEach(function (internalOperation) {
1335
+ if (internalOperation === null || internalOperation === void 0 ? void 0 : internalOperation.result) {
1336
+ if (internalOperation.result.errors) {
1337
+ throw new index_4.TransactionError(coinlib_error_1.Domain.TEZOS, 'An internal operation produced an error', internalOperation.result.errors);
1338
+ }
1339
+ gasLimit_1 += Math.ceil(Number(internalOperation.result.consumed_milligas) / 1000);
1340
+ if (internalOperation.result.paid_storage_size_diff) {
1341
+ storageLimit_1 += Number(internalOperation.result.paid_storage_size_diff);
1342
+ }
1343
+ if (internalOperation.result.originated_contracts) {
1344
+ storageLimit_1 += internalOperation.result.originated_contracts.length * 257;
1345
+ }
1346
+ if (internalOperation.result.allocated_destination_contract) {
1347
+ storageLimit_1 += 257;
1348
+ }
1349
+ }
1350
+ });
1351
+ }
1352
+ if (result.errors) {
1353
+ throw new index_4.TransactionError(coinlib_error_1.Domain.TEZOS, 'The operation produced an error', result.errors);
1354
+ }
1355
+ // Add gas and storage used by operation
1356
+ gasLimit_1 += Math.ceil(Number(result.consumed_milligas) / 1000);
1357
+ if (result.paid_storage_size_diff) {
1358
+ storageLimit_1 += Number(result.paid_storage_size_diff);
1359
+ }
1360
+ if (result.originated_contracts) {
1361
+ storageLimit_1 += result.originated_contracts.length * 257;
1362
+ }
1363
+ if (result.allocated_destination_contract) {
1364
+ storageLimit_1 += 257;
1365
+ }
1366
+ // in prepareTransactionsFromPublicKey() we invoke this method with overrideParameters = false
1367
+ if ((operation.gas_limit && overrideParameters) || operation.gas_limit === GAS_LIMIT_PLACEHOLDER) {
1368
+ ;
1369
+ operation.gas_limit = gasLimit_1.toString();
1370
+ }
1371
+ if ((operation.storage_limit && overrideParameters) || operation.storage_limit === STORAGE_LIMIT_PLACEHOLDER) {
1372
+ ;
1373
+ operation.storage_limit = storageLimit_1.toString();
1374
+ }
1375
+ gasLimitTotal += gasLimit_1;
1376
+ }
1377
+ });
1378
+ if (overrideParameters || tezosWrappedOperation.contents.some(function (operation) { return (operation === null || operation === void 0 ? void 0 : operation.fee) === FEE_PLACEHOLDER; })) {
1379
+ fee = MINIMAL_FEE +
1380
+ MINIMAL_FEE_PER_BYTE * Math.ceil((forgedOperation.length + 128) / 2) + // 128 is the length of a hex signature
1381
+ MINIMAL_FEE_PER_GAS_UNIT * gasLimitTotal +
1382
+ 100 // add 100 for safety
1383
+ ;
1384
+ nonRevealOperations = tezosWrappedOperation.contents.filter(function (operation) { return operation.kind !== 'reveal'; });
1385
+ feePerOperation_1 = Math.ceil(fee / nonRevealOperations.length);
1386
+ tezosWrappedOperation.contents.forEach(function (operation) {
1387
+ if (operation.fee && operation.kind !== 'reveal') {
1388
+ ;
1389
+ operation.fee = feePerOperation_1.toString();
1390
+ }
1391
+ });
1392
+ }
1393
+ return [2 /*return*/, tezosWrappedOperation];
1394
+ }
1395
+ });
1396
+ });
1397
+ };
1398
+ TezosProtocol.prototype.getDelegationInfo = function (delegatedAddress, fetchExtraInfo) {
1399
+ if (fetchExtraInfo === void 0) { fetchExtraInfo = true; }
1400
+ return __awaiter(this, void 0, void 0, function () {
1401
+ var data, delegatedOpLevel, delegatedDate, recentTransactionData;
1402
+ return __generator(this, function (_a) {
1403
+ switch (_a.label) {
1404
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(delegatedAddress))];
1405
+ case 1:
1406
+ data = (_a.sent()).data;
1407
+ if (!(data.delegate && fetchExtraInfo)) return [3 /*break*/, 3];
1408
+ return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegationInfo(delegatedAddress)];
1409
+ case 2:
1410
+ recentTransactionData = _a.sent();
1411
+ if (recentTransactionData) {
1412
+ delegatedDate = recentTransactionData.date;
1413
+ delegatedOpLevel = recentTransactionData.level;
1414
+ }
1415
+ _a.label = 3;
1416
+ case 3: return [2 /*return*/, {
1417
+ isDelegated: data.delegate ? true : false,
1418
+ value: data.delegate,
1419
+ delegatedDate: delegatedDate,
1420
+ delegatedOpLevel: delegatedOpLevel
1421
+ }];
1422
+ }
1423
+ });
1424
+ });
1425
+ };
1426
+ TezosProtocol.prototype.bakerInfo = function (tzAddress) {
1427
+ var _a, _b, _c, _d;
1428
+ return __awaiter(this, void 0, void 0, function () {
1429
+ var results, tzBalance, delegatedBalance, stakingBalance, selfBond, stakingCapacity, bakerInfo;
1430
+ return __generator(this, function (_e) {
1431
+ switch (_e.label) {
1432
+ case 0:
1433
+ if (!tzAddress ||
1434
+ !(tzAddress.toLowerCase().startsWith('tz1') || tzAddress.toLowerCase().startsWith('tz2') || tzAddress.toLowerCase().startsWith('tz3'))) {
1435
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'non tz-address supplied');
1436
+ }
1437
+ return [4 /*yield*/, Promise.all([
1438
+ index_1.default
1439
+ .get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(tzAddress, "/balance"))
1440
+ .catch(function (_error) { return undefined; }),
1441
+ index_1.default
1442
+ .get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(tzAddress, "/full_balance"))
1443
+ .catch(function (_error) { return undefined; }),
1444
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(tzAddress, "/delegated_balance")),
1445
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/delegates/").concat(tzAddress, "/staking_balance"))
1446
+ ]).catch(function (error) {
1447
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1448
+ })];
1449
+ case 1:
1450
+ results = _e.sent();
1451
+ tzBalance = new bignumber_1.default((_b = ((_a = results[0]) !== null && _a !== void 0 ? _a : results[1])) === null || _b === void 0 ? void 0 : _b.data);
1452
+ delegatedBalance = new bignumber_1.default((_c = results[2]) === null || _c === void 0 ? void 0 : _c.data);
1453
+ stakingBalance = new bignumber_1.default((_d = results[3]) === null || _d === void 0 ? void 0 : _d.data);
1454
+ selfBond = stakingBalance.minus(delegatedBalance);
1455
+ stakingCapacity = stakingBalance.div(selfBond.div(SELF_BOND_REQUIREMENT));
1456
+ bakerInfo = {
1457
+ balance: tzBalance,
1458
+ delegatedBalance: delegatedBalance,
1459
+ stakingBalance: stakingBalance,
1460
+ selfBond: selfBond,
1461
+ bakerCapacity: stakingBalance.div(stakingCapacity),
1462
+ bakerUsage: stakingCapacity
1463
+ };
1464
+ return [2 /*return*/, bakerInfo];
1465
+ }
1466
+ });
1467
+ });
1468
+ };
1469
+ TezosProtocol.prototype.getDelegationRewardsForAddress = function (address) {
1470
+ return __awaiter(this, void 0, void 0, function () {
1471
+ var status;
1472
+ return __generator(this, function (_a) {
1473
+ switch (_a.label) {
1474
+ case 0: return [4 /*yield*/, this.getDelegationInfo(address)];
1475
+ case 1:
1476
+ status = _a.sent();
1477
+ if (!status.isDelegated || !status.value) {
1478
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'address not delegated');
1479
+ }
1480
+ return [2 /*return*/, this.getDelegationRewards(status.value, address)];
1481
+ }
1482
+ });
1483
+ });
1484
+ };
1485
+ TezosProtocol.prototype.getDelegationRewards = function (bakerAddress, delegatorAddress) {
1486
+ return __awaiter(this, void 0, void 0, function () {
1487
+ return __generator(this, function (_a) {
1488
+ // TODO: use the adapt logic for ithaca upgrade
1489
+ return [2 /*return*/, []
1490
+ // const { data: frozenBalance }: AxiosResponse<TezosFrozenBalance[]> = await axios.get(
1491
+ // `${this.options.network.rpcUrl}/chains/main/blocks/head/context/delegates/${bakerAddress}/frozen_balance_by_cycle`
1492
+ // )
1493
+ // const lastConfirmedCycle: number = frozenBalance[0].cycle - 1
1494
+ // const mostRecentCycle: number = frozenBalance[frozenBalance.length - 1].cycle
1495
+ // const { data: mostRecentBlock } = await axios.get(
1496
+ // `${this.options.network.rpcUrl}/chains/main/blocks/${this.cycleToBlockLevel(mostRecentCycle)}`
1497
+ // )
1498
+ // const timestamp: Date = new Date(mostRecentBlock.header.timestamp)
1499
+ // const address = delegatorAddress ?? bakerAddress
1500
+ // const delegationInfo: DelegationRewardInfo[] = await Promise.all(
1501
+ // frozenBalance.slice(0, 5).map(async (obj) => {
1502
+ // const rewards = await this.calculateRewards(bakerAddress, obj.cycle, mostRecentCycle, false)
1503
+ // let delegatedBalance = '0'
1504
+ // let payoutAmount = '0'
1505
+ // if (rewards.delegatedContracts.includes(address)) {
1506
+ // const payout = await this.calculatePayout(address, rewards)
1507
+ // delegatedBalance = payout.balance
1508
+ // payoutAmount = payout.payout
1509
+ // }
1510
+ // return {
1511
+ // cycle: obj.cycle,
1512
+ // totalRewards: new BigNumber(obj.rewards),
1513
+ // totalFees: new BigNumber(obj.fees),
1514
+ // deposit: new BigNumber(obj.deposit ?? obj.deposits),
1515
+ // delegatedBalance: new BigNumber(delegatedBalance),
1516
+ // stakingBalance: new BigNumber(rewards.stakingBalance),
1517
+ // reward: new BigNumber(payoutAmount),
1518
+ // payout: new Date(timestamp.getTime() + this.timeIntervalBetweenCycles(lastConfirmedCycle, obj.cycle))
1519
+ // }
1520
+ // })
1521
+ // )
1522
+ // return delegationInfo
1523
+ ];
1524
+ });
1525
+ });
1526
+ };
1527
+ TezosProtocol.prototype.undelegate = function (publicKey) {
1528
+ return __awaiter(this, void 0, void 0, function () {
1529
+ return __generator(this, function (_a) {
1530
+ return [2 /*return*/, this.delegate(publicKey)];
1531
+ });
1532
+ });
1533
+ };
1534
+ TezosProtocol.prototype.delegate = function (publicKey, delegate) {
1535
+ return __awaiter(this, void 0, void 0, function () {
1536
+ var counter, branch, operations, tzAddress, results, accountManager, _a, _b, balance, _c, fee, delegationOperation, tezosWrappedOperation, binaryTx, error_4;
1537
+ return __generator(this, function (_d) {
1538
+ switch (_d.label) {
1539
+ case 0:
1540
+ counter = new bignumber_1.default(1);
1541
+ branch = '';
1542
+ operations = [];
1543
+ return [4 /*yield*/, this.getAddressFromPublicKey(publicKey).then(function (address) { return address.address; })];
1544
+ case 1:
1545
+ tzAddress = _d.sent();
1546
+ return [4 /*yield*/, Promise.all([
1547
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(tzAddress, "/counter")),
1548
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head~2/hash")),
1549
+ index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/head/context/contracts/").concat(tzAddress, "/manager_key"))
1550
+ ]).catch(function (error) {
1551
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1552
+ })];
1553
+ case 2:
1554
+ results = _d.sent();
1555
+ counter = new bignumber_1.default(results[0].data).plus(1);
1556
+ branch = results[1].data;
1557
+ accountManager = results[2].data;
1558
+ if (!!accountManager) return [3 /*break*/, 4];
1559
+ _b = (_a = operations).push;
1560
+ return [4 /*yield*/, this.createRevealOperation(counter, publicKey, tzAddress)];
1561
+ case 3:
1562
+ _b.apply(_a, [_d.sent()]);
1563
+ counter = counter.plus(1);
1564
+ _d.label = 4;
1565
+ case 4:
1566
+ _c = bignumber_1.default.bind;
1567
+ return [4 /*yield*/, this.getBalanceOfAddresses([tzAddress])];
1568
+ case 5:
1569
+ balance = new (_c.apply(bignumber_1.default, [void 0, _d.sent()]))();
1570
+ fee = new bignumber_1.default(1420);
1571
+ if (balance.isLessThan(fee)) {
1572
+ throw new index_4.BalanceError(coinlib_error_1.Domain.TEZOS, 'not enough balance');
1573
+ }
1574
+ delegationOperation = {
1575
+ kind: TezosOperationType_1.TezosOperationType.DELEGATION,
1576
+ source: tzAddress,
1577
+ fee: fee.toFixed(),
1578
+ counter: counter.toFixed(),
1579
+ gas_limit: '10000',
1580
+ storage_limit: '0',
1581
+ delegate: Array.isArray(delegate) ? delegate[0] : delegate
1582
+ };
1583
+ operations.push(delegationOperation);
1584
+ _d.label = 6;
1585
+ case 6:
1586
+ _d.trys.push([6, 8, , 9]);
1587
+ tezosWrappedOperation = {
1588
+ branch: branch,
1589
+ contents: operations
1590
+ };
1591
+ return [4 /*yield*/, this.forgeTezosOperation(tezosWrappedOperation)];
1592
+ case 7:
1593
+ binaryTx = _d.sent();
1594
+ return [2 /*return*/, { binaryTransaction: binaryTx }];
1595
+ case 8:
1596
+ error_4 = _d.sent();
1597
+ throw new index_4.OperationFailedError(coinlib_error_1.Domain.TEZOS, "Forging Tezos TX failed with ".concat(JSON.stringify(error_4.message)));
1598
+ case 9: return [2 /*return*/];
1599
+ }
1600
+ });
1601
+ });
1602
+ };
1603
+ TezosProtocol.prototype.getAmountUsedByPreviousOperations = function (operations) {
1604
+ var amountUsed = new bignumber_1.default(0);
1605
+ operations.forEach(function (operation) {
1606
+ switch (operation.kind) {
1607
+ case TezosOperationType_1.TezosOperationType.REVEAL:
1608
+ var revealOperation = operation;
1609
+ amountUsed = amountUsed.plus(revealOperation.fee);
1610
+ break;
1611
+ case TezosOperationType_1.TezosOperationType.ORIGINATION:
1612
+ var originationOperation = operation;
1613
+ amountUsed = amountUsed.plus(originationOperation.fee);
1614
+ amountUsed = amountUsed.plus(originationOperation.balance);
1615
+ break;
1616
+ case TezosOperationType_1.TezosOperationType.DELEGATION:
1617
+ var delegationOperation = operation;
1618
+ amountUsed = amountUsed.plus(delegationOperation.fee);
1619
+ break;
1620
+ case TezosOperationType_1.TezosOperationType.TRANSACTION:
1621
+ var spendOperation = operation;
1622
+ amountUsed = amountUsed.plus(spendOperation.fee);
1623
+ amountUsed = amountUsed.plus(spendOperation.amount);
1624
+ break;
1625
+ case TezosOperationType_1.TezosOperationType.ENDORSEMENT:
1626
+ case TezosOperationType_1.TezosOperationType.SEED_NONCE_REVELATION:
1627
+ case TezosOperationType_1.TezosOperationType.DOUBLE_ENDORSEMENT_EVIDENCE:
1628
+ case TezosOperationType_1.TezosOperationType.DOUBLE_BAKING_EVIDENCE:
1629
+ case TezosOperationType_1.TezosOperationType.ACTIVATE_ACCOUNT:
1630
+ case TezosOperationType_1.TezosOperationType.PROPOSALS:
1631
+ case TezosOperationType_1.TezosOperationType.BALLOT:
1632
+ break;
1633
+ default:
1634
+ // Exhaustive switch
1635
+ (0, assert_1.assertNever)(operation.kind);
1636
+ throw new index_4.UnsupportedError(coinlib_error_1.Domain.TEZOS, "operation type not supported ".concat(JSON.stringify(operation.kind)));
1637
+ }
1638
+ });
1639
+ return amountUsed;
1640
+ };
1641
+ TezosProtocol.prototype.broadcastTransaction = function (rawTransaction) {
1642
+ return __awaiter(this, void 0, void 0, function () {
1643
+ var payload, injectionResponse;
1644
+ return __generator(this, function (_a) {
1645
+ switch (_a.label) {
1646
+ case 0:
1647
+ payload = rawTransaction;
1648
+ return [4 /*yield*/, index_1.default
1649
+ .post("".concat(this.options.network.rpcUrl, "/injection/operation?chain=main"), JSON.stringify(payload), {
1650
+ headers: { 'content-type': 'application/json' }
1651
+ })
1652
+ .catch(function (error) {
1653
+ throw new index_4.NetworkError(coinlib_error_1.Domain.TEZOS, error);
1654
+ })
1655
+ // returns hash if successful
1656
+ ];
1657
+ case 1:
1658
+ injectionResponse = (_a.sent()).data;
1659
+ // returns hash if successful
1660
+ return [2 /*return*/, injectionResponse];
1661
+ }
1662
+ });
1663
+ });
1664
+ };
1665
+ TezosProtocol.prototype.checkAndRemovePrefixToHex = function (base58CheckEncodedPayload, tezosPrefix) {
1666
+ var prefixHex = Buffer.from(tezosPrefix).toString('hex');
1667
+ var payload = bs58check.decode(base58CheckEncodedPayload).toString('hex');
1668
+ if (payload.startsWith(prefixHex)) {
1669
+ return payload.substring(tezosPrefix.length * 2);
1670
+ }
1671
+ else {
1672
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, "payload did not match prefix: ".concat(prefixHex));
1673
+ }
1674
+ };
1675
+ TezosProtocol.prototype.unforgeSignedTezosWrappedOperation = function (hexString) {
1676
+ return __awaiter(this, void 0, void 0, function () {
1677
+ return __generator(this, function (_a) {
1678
+ if (hexString.length <= 128) {
1679
+ throw new index_4.ConditionViolationError(coinlib_error_1.Domain.TEZOS, 'Not a valid signed transaction');
1680
+ }
1681
+ return [2 /*return*/, this.unforgeUnsignedTezosWrappedOperation(hexString.substring(0, hexString.length - 128))];
1682
+ });
1683
+ });
1684
+ };
1685
+ TezosProtocol.prototype.unforgeUnsignedTezosWrappedOperation = function (hexString) {
1686
+ return __awaiter(this, void 0, void 0, function () {
1687
+ return __generator(this, function (_a) {
1688
+ return [2 /*return*/, taquito_local_forging_1.localForger.parse(hexString)];
1689
+ });
1690
+ });
1691
+ };
1692
+ TezosProtocol.prototype.forgeTezosOperation = function (tezosWrappedOperation) {
1693
+ return __awaiter(this, void 0, void 0, function () {
1694
+ return __generator(this, function (_a) {
1695
+ return [2 /*return*/, taquito_local_forging_1.localForger.forge(tezosWrappedOperation)];
1696
+ });
1697
+ });
1698
+ };
1699
+ TezosProtocol.prototype.createRevealOperation = function (counter, publicKey, address, fee) {
1700
+ if (fee === void 0) { fee = this.revealFee.toFixed(); }
1701
+ return __awaiter(this, void 0, void 0, function () {
1702
+ var operation;
1703
+ return __generator(this, function (_a) {
1704
+ operation = {
1705
+ kind: TezosOperationType_1.TezosOperationType.REVEAL,
1706
+ fee: fee,
1707
+ gas_limit: '10000',
1708
+ storage_limit: '0',
1709
+ counter: counter.toFixed(),
1710
+ public_key: bs58check.encode(Buffer.concat([TezosUtils_1.TezosUtils.tezosPrefixes.edpk, Buffer.from(publicKey, 'hex')])),
1711
+ source: address
1712
+ };
1713
+ return [2 /*return*/, operation];
1714
+ });
1715
+ });
1716
+ };
1717
+ TezosProtocol.prototype.getTezosVotingInfo = function (blockHash) {
1718
+ return __awaiter(this, void 0, void 0, function () {
1719
+ var response;
1720
+ return __generator(this, function (_a) {
1721
+ switch (_a.label) {
1722
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/").concat(blockHash, "/votes/listings"))];
1723
+ case 1:
1724
+ response = _a.sent();
1725
+ return [2 /*return*/, response.data];
1726
+ }
1727
+ });
1728
+ });
1729
+ };
1730
+ TezosProtocol.prototype.fetchCurrentCycle = function () {
1731
+ return __awaiter(this, void 0, void 0, function () {
1732
+ var headMetadata, currentCycle;
1733
+ return __generator(this, function (_a) {
1734
+ switch (_a.label) {
1735
+ case 0: return [4 /*yield*/, this.fetchBlockMetadata('head')];
1736
+ case 1:
1737
+ headMetadata = _a.sent();
1738
+ currentCycle = headMetadata.level_info.cycle;
1739
+ return [2 /*return*/, currentCycle];
1740
+ }
1741
+ });
1742
+ });
1743
+ };
1744
+ TezosProtocol.prototype.timeIntervalBetweenCycles = function (fromCycle, toCycle) {
1745
+ var cycle1 = Math.min(fromCycle, toCycle);
1746
+ var cycle2 = Math.max(fromCycle, toCycle);
1747
+ var timeBetweenBlocks = TezosProtocol.TIME_BETWEEN_BLOCKS[this.options.network.extras.network];
1748
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1749
+ if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle2 > TezosProtocol.FIRST_010_CYCLE) {
1750
+ if (cycle1 < TezosProtocol.FIRST_010_CYCLE) {
1751
+ return (((TezosProtocol.FIRST_010_CYCLE - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] +
1752
+ (cycle2 - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] * timeBetweenBlocks[1]) *
1753
+ 1000);
1754
+ }
1755
+ return (cycle2 - cycle1) * blocksPerCycle[1] * timeBetweenBlocks[1] * 1000;
1756
+ }
1757
+ return (cycle2 - cycle1) * blocksPerCycle[0] * timeBetweenBlocks[0] * 1000;
1758
+ };
1759
+ TezosProtocol.prototype.cycleToBlockLevel = function (cycle) {
1760
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1761
+ if (this.options.network.extras.network === TezosNetwork.MAINNET && cycle > TezosProtocol.FIRST_010_CYCLE) {
1762
+ return TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0] + (cycle - TezosProtocol.FIRST_010_CYCLE) * blocksPerCycle[1] + 1;
1763
+ }
1764
+ return cycle * blocksPerCycle[0] + 1;
1765
+ };
1766
+ TezosProtocol.prototype.blockLevelToCycle = function (blockLevel) {
1767
+ var blocksPerCycle = TezosProtocol.BLOCKS_PER_CYCLE[this.options.network.extras.network];
1768
+ if (this.options.network.extras.network === TezosNetwork.MAINNET) {
1769
+ var last009BlockLevel = TezosProtocol.FIRST_010_CYCLE * blocksPerCycle[0];
1770
+ if (blockLevel > last009BlockLevel) {
1771
+ var deltaLevels = blockLevel - last009BlockLevel;
1772
+ var deltaCycles = Math.floor(deltaLevels / blocksPerCycle[1]);
1773
+ if (deltaLevels % blocksPerCycle[1] === 0) {
1774
+ deltaCycles -= 1;
1775
+ }
1776
+ return TezosProtocol.FIRST_010_CYCLE + deltaCycles;
1777
+ }
1778
+ }
1779
+ var cycle = Math.floor(blockLevel / blocksPerCycle[0]);
1780
+ if (blockLevel % blocksPerCycle[0] === 0) {
1781
+ cycle -= 1;
1782
+ }
1783
+ return cycle;
1784
+ };
1785
+ TezosProtocol.prototype.fetchBlockMetadata = function (block) {
1786
+ return __awaiter(this, void 0, void 0, function () {
1787
+ var result;
1788
+ return __generator(this, function (_a) {
1789
+ switch (_a.label) {
1790
+ case 0: return [4 /*yield*/, index_1.default.get("".concat(this.options.network.rpcUrl, "/chains/main/blocks/").concat(block, "/metadata"))];
1791
+ case 1:
1792
+ result = _a.sent();
1793
+ return [2 /*return*/, result.data];
1794
+ }
1795
+ });
1796
+ });
1797
+ };
1798
+ TezosProtocol.prototype.signMessage = function (message, keypair) {
1799
+ return __awaiter(this, void 0, void 0, function () {
1800
+ return __generator(this, function (_a) {
1801
+ return [2 /*return*/, this.cryptoClient.signMessage(message, keypair)];
1802
+ });
1803
+ });
1804
+ };
1805
+ TezosProtocol.prototype.verifyMessage = function (message, signature, publicKey) {
1806
+ return __awaiter(this, void 0, void 0, function () {
1807
+ return __generator(this, function (_a) {
1808
+ return [2 /*return*/, this.cryptoClient.verifyMessage(message, signature, publicKey)];
1809
+ });
1810
+ });
1811
+ };
1812
+ TezosProtocol.prototype.encryptAsymmetric = function (message, publicKey) {
1813
+ return __awaiter(this, void 0, void 0, function () {
1814
+ return __generator(this, function (_a) {
1815
+ return [2 /*return*/, this.cryptoClient.encryptAsymmetric(message, publicKey)];
1816
+ });
1817
+ });
1818
+ };
1819
+ TezosProtocol.prototype.decryptAsymmetric = function (message, keypair) {
1820
+ return __awaiter(this, void 0, void 0, function () {
1821
+ return __generator(this, function (_a) {
1822
+ return [2 /*return*/, this.cryptoClient.decryptAsymmetric(message, keypair)];
1823
+ });
1824
+ });
1825
+ };
1826
+ TezosProtocol.prototype.encryptAES = function (message, privateKey) {
1827
+ return __awaiter(this, void 0, void 0, function () {
1828
+ return __generator(this, function (_a) {
1829
+ return [2 /*return*/, this.cryptoClient.encryptAES(message, privateKey)];
1830
+ });
1831
+ });
1832
+ };
1833
+ TezosProtocol.prototype.decryptAES = function (message, privateKey) {
1834
+ return __awaiter(this, void 0, void 0, function () {
1835
+ return __generator(this, function (_a) {
1836
+ return [2 /*return*/, this.cryptoClient.decryptAES(message, privateKey)];
1837
+ });
1838
+ });
1839
+ };
1840
+ TezosProtocol.prototype.getTransactionStatuses = function (transactionHashes) {
1841
+ return __awaiter(this, void 0, void 0, function () {
1842
+ return __generator(this, function (_a) {
1843
+ throw new Error('Method not implemented.');
1844
+ });
1845
+ });
1846
+ };
1847
+ TezosProtocol.FIRST_010_CYCLE = 388;
1848
+ TezosProtocol.BLOCKS_PER_CYCLE = (_a = {},
1849
+ _a[TezosNetwork.MAINNET] = [4096, 8192],
1850
+ _a[TezosNetwork.GHOSTNET] = [4096],
1851
+ _a);
1852
+ TezosProtocol.TIME_BETWEEN_BLOCKS = (_b = {},
1853
+ _b[TezosNetwork.MAINNET] = [60, 30],
1854
+ _b[TezosNetwork.GHOSTNET] = [30],
1855
+ _b);
1856
+ return TezosProtocol;
1857
+ }(NonExtendedProtocol_1.NonExtendedProtocol));
1858
+ exports.TezosProtocol = TezosProtocol;
1859
+ //# sourceMappingURL=TezosProtocol.js.map