@airgap/tezos 0.13.10 → 0.13.11-beta.1

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