@airgap/tezos 0.13.7-beta.11

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 (370) hide show
  1. package/LICENSE.md +7 -0
  2. package/actions/GetKtAccountsAction.d.ts +8 -0
  3. package/actions/GetKtAccountsAction.js +85 -0
  4. package/actions/GetKtAccountsAction.js.map +1 -0
  5. package/airgap-coinlib-tezos.min.js +103587 -0
  6. package/constants.d.ts +18 -0
  7. package/constants.js +28 -0
  8. package/constants.js.map +1 -0
  9. package/index.d.ts +46 -0
  10. package/index.js +103 -0
  11. package/index.js.map +1 -0
  12. package/package.json +70 -0
  13. package/protocol/TezosAddress.d.ts +11 -0
  14. package/protocol/TezosAddress.js +102 -0
  15. package/protocol/TezosAddress.js.map +1 -0
  16. package/protocol/TezosCryptoClient.d.ts +15 -0
  17. package/protocol/TezosCryptoClient.js +152 -0
  18. package/protocol/TezosCryptoClient.js.map +1 -0
  19. package/protocol/TezosProtocol.d.ts +349 -0
  20. package/protocol/TezosProtocol.js +1853 -0
  21. package/protocol/TezosProtocol.js.map +1 -0
  22. package/protocol/TezosProtocolOptions.d.ts +29 -0
  23. package/protocol/TezosProtocolOptions.js +114 -0
  24. package/protocol/TezosProtocolOptions.js.map +1 -0
  25. package/protocol/TezosUtils.d.ts +40 -0
  26. package/protocol/TezosUtils.js +296 -0
  27. package/protocol/TezosUtils.js.map +1 -0
  28. package/protocol/contract/TezosContract.d.ts +52 -0
  29. package/protocol/contract/TezosContract.js +509 -0
  30. package/protocol/contract/TezosContract.js.map +1 -0
  31. package/protocol/contract/TezosContractCall.d.ts +10 -0
  32. package/protocol/contract/TezosContractCall.js +23 -0
  33. package/protocol/contract/TezosContractCall.js.map +1 -0
  34. package/protocol/contract/TezosContractEntrypoint.d.ts +8 -0
  35. package/protocol/contract/TezosContractEntrypoint.js +27 -0
  36. package/protocol/contract/TezosContractEntrypoint.js.map +1 -0
  37. package/protocol/contract/TezosContractStorage.d.ts +7 -0
  38. package/protocol/contract/TezosContractStorage.js +16 -0
  39. package/protocol/contract/TezosContractStorage.js.map +1 -0
  40. package/protocol/contract/remote-data/TezosContractRemoteDataFactory.d.ts +11 -0
  41. package/protocol/contract/remote-data/TezosContractRemoteDataFactory.js +34 -0
  42. package/protocol/contract/remote-data/TezosContractRemoteDataFactory.js.map +1 -0
  43. package/protocol/contract/remote-data/TezosStorageRemoteData.d.ts +12 -0
  44. package/protocol/contract/remote-data/TezosStorageRemoteData.js +151 -0
  45. package/protocol/contract/remote-data/TezosStorageRemoteData.js.map +1 -0
  46. package/protocol/domains/TezosDomains.d.ts +20 -0
  47. package/protocol/domains/TezosDomains.js +306 -0
  48. package/protocol/domains/TezosDomains.js.map +1 -0
  49. package/protocol/fa/TezosBTC.d.ts +12 -0
  50. package/protocol/fa/TezosBTC.js +107 -0
  51. package/protocol/fa/TezosBTC.js.map +1 -0
  52. package/protocol/fa/TezosBTCtez.d.ts +10 -0
  53. package/protocol/fa/TezosBTCtez.js +54 -0
  54. package/protocol/fa/TezosBTCtez.js.map +1 -0
  55. package/protocol/fa/TezosCTez.d.ts +10 -0
  56. package/protocol/fa/TezosCTez.js +51 -0
  57. package/protocol/fa/TezosCTez.js.map +1 -0
  58. package/protocol/fa/TezosDOGA.d.ts +10 -0
  59. package/protocol/fa/TezosDOGA.js +51 -0
  60. package/protocol/fa/TezosDOGA.js.map +1 -0
  61. package/protocol/fa/TezosETHtz.d.ts +9 -0
  62. package/protocol/fa/TezosETHtz.js +72 -0
  63. package/protocol/fa/TezosETHtz.js.map +1 -0
  64. package/protocol/fa/TezosFA1Protocol.d.ts +27 -0
  65. package/protocol/fa/TezosFA1Protocol.js +310 -0
  66. package/protocol/fa/TezosFA1Protocol.js.map +1 -0
  67. package/protocol/fa/TezosFA1p2Protocol.d.ts +8 -0
  68. package/protocol/fa/TezosFA1p2Protocol.js +117 -0
  69. package/protocol/fa/TezosFA1p2Protocol.js.map +1 -0
  70. package/protocol/fa/TezosFA2Protocol.d.ts +58 -0
  71. package/protocol/fa/TezosFA2Protocol.js +449 -0
  72. package/protocol/fa/TezosFA2Protocol.js.map +1 -0
  73. package/protocol/fa/TezosFAProtocol.d.ts +65 -0
  74. package/protocol/fa/TezosFAProtocol.js +510 -0
  75. package/protocol/fa/TezosFAProtocol.js.map +1 -0
  76. package/protocol/fa/TezosFAProtocolOptions.d.ts +54 -0
  77. package/protocol/fa/TezosFAProtocolOptions.js +228 -0
  78. package/protocol/fa/TezosFAProtocolOptions.js.map +1 -0
  79. package/protocol/fa/TezosKolibriUSD.d.ts +10 -0
  80. package/protocol/fa/TezosKolibriUSD.js +74 -0
  81. package/protocol/fa/TezosKolibriUSD.js.map +1 -0
  82. package/protocol/fa/TezosPlanty.d.ts +10 -0
  83. package/protocol/fa/TezosPlanty.js +51 -0
  84. package/protocol/fa/TezosPlanty.js.map +1 -0
  85. package/protocol/fa/TezosQUIPU.d.ts +10 -0
  86. package/protocol/fa/TezosQUIPU.js +54 -0
  87. package/protocol/fa/TezosQUIPU.js.map +1 -0
  88. package/protocol/fa/TezosSIRS.d.ts +10 -0
  89. package/protocol/fa/TezosSIRS.js +51 -0
  90. package/protocol/fa/TezosSIRS.js.map +1 -0
  91. package/protocol/fa/TezosStaker.d.ts +10 -0
  92. package/protocol/fa/TezosStaker.js +74 -0
  93. package/protocol/fa/TezosStaker.js.map +1 -0
  94. package/protocol/fa/TezosUBTC.d.ts +10 -0
  95. package/protocol/fa/TezosUBTC.js +54 -0
  96. package/protocol/fa/TezosUBTC.js.map +1 -0
  97. package/protocol/fa/TezosUDEFI.d.ts +10 -0
  98. package/protocol/fa/TezosUDEFI.js +54 -0
  99. package/protocol/fa/TezosUDEFI.js.map +1 -0
  100. package/protocol/fa/TezosUSD.d.ts +10 -0
  101. package/protocol/fa/TezosUSD.js +74 -0
  102. package/protocol/fa/TezosUSD.js.map +1 -0
  103. package/protocol/fa/TezosUSDT.d.ts +10 -0
  104. package/protocol/fa/TezosUSDT.js +54 -0
  105. package/protocol/fa/TezosUSDT.js.map +1 -0
  106. package/protocol/fa/TezosUUSD.d.ts +6 -0
  107. package/protocol/fa/TezosUUSD.js +31 -0
  108. package/protocol/fa/TezosUUSD.js.map +1 -0
  109. package/protocol/fa/TezosWRAP.d.ts +10 -0
  110. package/protocol/fa/TezosWRAP.js +54 -0
  111. package/protocol/fa/TezosWRAP.js.map +1 -0
  112. package/protocol/fa/TezosWrapped.d.ts +10 -0
  113. package/protocol/fa/TezosWrapped.js +74 -0
  114. package/protocol/fa/TezosWrapped.js.map +1 -0
  115. package/protocol/fa/TezosYOU.d.ts +6 -0
  116. package/protocol/fa/TezosYOU.js +31 -0
  117. package/protocol/fa/TezosYOU.js.map +1 -0
  118. package/protocol/indexerClient/TezosIndexerClient.d.ts +25 -0
  119. package/protocol/indexerClient/TezosIndexerClient.js +251 -0
  120. package/protocol/indexerClient/TezosIndexerClient.js.map +1 -0
  121. package/protocol/indexerClient/TezosProtocolIndexerClient.d.ts +26 -0
  122. package/protocol/indexerClient/TezosProtocolIndexerClient.js +3 -0
  123. package/protocol/indexerClient/TezosProtocolIndexerClient.js.map +1 -0
  124. package/protocol/kt/TezosKtAddress.d.ts +5 -0
  125. package/protocol/kt/TezosKtAddress.js +72 -0
  126. package/protocol/kt/TezosKtAddress.js.map +1 -0
  127. package/protocol/kt/TezosKtProtocol.d.ts +30 -0
  128. package/protocol/kt/TezosKtProtocol.js +317 -0
  129. package/protocol/kt/TezosKtProtocol.js.map +1 -0
  130. package/protocol/sapling/TezosSaplingAddress.d.ts +12 -0
  131. package/protocol/sapling/TezosSaplingAddress.js +134 -0
  132. package/protocol/sapling/TezosSaplingAddress.js.map +1 -0
  133. package/protocol/sapling/TezosSaplingCryptoClient.d.ts +34 -0
  134. package/protocol/sapling/TezosSaplingCryptoClient.js +241 -0
  135. package/protocol/sapling/TezosSaplingCryptoClient.js.map +1 -0
  136. package/protocol/sapling/TezosSaplingProtocol.d.ts +130 -0
  137. package/protocol/sapling/TezosSaplingProtocol.js +1101 -0
  138. package/protocol/sapling/TezosSaplingProtocol.js.map +1 -0
  139. package/protocol/sapling/TezosSaplingProtocolOptions.d.ts +43 -0
  140. package/protocol/sapling/TezosSaplingProtocolOptions.js +78 -0
  141. package/protocol/sapling/TezosSaplingProtocolOptions.js.map +1 -0
  142. package/protocol/sapling/TezosShieldedTezProtocol.d.ts +9 -0
  143. package/protocol/sapling/TezosShieldedTezProtocol.js +109 -0
  144. package/protocol/sapling/TezosShieldedTezProtocol.js.map +1 -0
  145. package/protocol/sapling/node/TezosSaplingNodeClient.d.ts +8 -0
  146. package/protocol/sapling/node/TezosSaplingNodeClient.js +78 -0
  147. package/protocol/sapling/node/TezosSaplingNodeClient.js.map +1 -0
  148. package/protocol/sapling/utils/TezosSaplingBookkeeper.d.ts +34 -0
  149. package/protocol/sapling/utils/TezosSaplingBookkeeper.js +586 -0
  150. package/protocol/sapling/utils/TezosSaplingBookkeeper.js.map +1 -0
  151. package/protocol/sapling/utils/TezosSaplingEncoder.d.ts +22 -0
  152. package/protocol/sapling/utils/TezosSaplingEncoder.js +158 -0
  153. package/protocol/sapling/utils/TezosSaplingEncoder.js.map +1 -0
  154. package/protocol/sapling/utils/TezosSaplingForger.d.ts +26 -0
  155. package/protocol/sapling/utils/TezosSaplingForger.js +278 -0
  156. package/protocol/sapling/utils/TezosSaplingForger.js.map +1 -0
  157. package/protocol/sapling/utils/TezosSaplingState.d.ts +17 -0
  158. package/protocol/sapling/utils/TezosSaplingState.js +260 -0
  159. package/protocol/sapling/utils/TezosSaplingState.js.map +1 -0
  160. package/protocol/types/TezosAddressCursor.d.ts +3 -0
  161. package/protocol/types/TezosAddressCursor.js +3 -0
  162. package/protocol/types/TezosAddressCursor.js.map +1 -0
  163. package/protocol/types/TezosAddressResult.d.ts +4 -0
  164. package/protocol/types/TezosAddressResult.js +3 -0
  165. package/protocol/types/TezosAddressResult.js.map +1 -0
  166. package/protocol/types/TezosBlockHeader.d.ts +13 -0
  167. package/protocol/types/TezosBlockHeader.js +3 -0
  168. package/protocol/types/TezosBlockHeader.js.map +1 -0
  169. package/protocol/types/TezosBlockMetadata.d.ts +7 -0
  170. package/protocol/types/TezosBlockMetadata.js +3 -0
  171. package/protocol/types/TezosBlockMetadata.js.map +1 -0
  172. package/protocol/types/TezosContractCode.d.ts +5 -0
  173. package/protocol/types/TezosContractCode.js +3 -0
  174. package/protocol/types/TezosContractCode.js.map +1 -0
  175. package/protocol/types/TezosOperationType.d.ts +13 -0
  176. package/protocol/types/TezosOperationType.js +18 -0
  177. package/protocol/types/TezosOperationType.js.map +1 -0
  178. package/protocol/types/TezosTransactionCursor.d.ts +3 -0
  179. package/protocol/types/TezosTransactionCursor.js +3 -0
  180. package/protocol/types/TezosTransactionCursor.js.map +1 -0
  181. package/protocol/types/TezosTransactionResult.d.ts +6 -0
  182. package/protocol/types/TezosTransactionResult.js +3 -0
  183. package/protocol/types/TezosTransactionResult.js.map +1 -0
  184. package/protocol/types/TezosWrappedOperation.d.ts +5 -0
  185. package/protocol/types/TezosWrappedOperation.js +3 -0
  186. package/protocol/types/TezosWrappedOperation.js.map +1 -0
  187. package/protocol/types/contract/BigMap.d.ts +7 -0
  188. package/protocol/types/contract/BigMap.js +3 -0
  189. package/protocol/types/contract/BigMap.js.map +1 -0
  190. package/protocol/types/contract/BigMapEnrtyFilter.d.ts +5 -0
  191. package/protocol/types/contract/BigMapEnrtyFilter.js +3 -0
  192. package/protocol/types/contract/BigMapEnrtyFilter.js.map +1 -0
  193. package/protocol/types/contract/BigMapEntry.d.ts +7 -0
  194. package/protocol/types/contract/BigMapEntry.js +3 -0
  195. package/protocol/types/contract/BigMapEntry.js.map +1 -0
  196. package/protocol/types/contract/BigMapRequest.d.ts +8 -0
  197. package/protocol/types/contract/BigMapRequest.js +3 -0
  198. package/protocol/types/contract/BigMapRequest.js.map +1 -0
  199. package/protocol/types/contract/TezosContractMetadata.d.ts +61 -0
  200. package/protocol/types/contract/TezosContractMetadata.js +3 -0
  201. package/protocol/types/contract/TezosContractMetadata.js.map +1 -0
  202. package/protocol/types/domains/TezosDomainsRecord.d.ts +8 -0
  203. package/protocol/types/domains/TezosDomainsRecord.js +3 -0
  204. package/protocol/types/domains/TezosDomainsRecord.js.map +1 -0
  205. package/protocol/types/domains/TezosDomainsReverseRecord.d.ts +5 -0
  206. package/protocol/types/domains/TezosDomainsReverseRecord.js +3 -0
  207. package/protocol/types/domains/TezosDomainsReverseRecord.js.map +1 -0
  208. package/protocol/types/fa/TezosFA2BalanceOfRequest.d.ts +4 -0
  209. package/protocol/types/fa/TezosFA2BalanceOfRequest.js +3 -0
  210. package/protocol/types/fa/TezosFA2BalanceOfRequest.js.map +1 -0
  211. package/protocol/types/fa/TezosFA2BalanceOfResponse.d.ts +5 -0
  212. package/protocol/types/fa/TezosFA2BalanceOfResponse.js +3 -0
  213. package/protocol/types/fa/TezosFA2BalanceOfResponse.js.map +1 -0
  214. package/protocol/types/fa/TezosFA2TransferRequest.d.ts +8 -0
  215. package/protocol/types/fa/TezosFA2TransferRequest.js +3 -0
  216. package/protocol/types/fa/TezosFA2TransferRequest.js.map +1 -0
  217. package/protocol/types/fa/TezosFA2UpdateOperatorRequest.d.ts +6 -0
  218. package/protocol/types/fa/TezosFA2UpdateOperatorRequest.js +3 -0
  219. package/protocol/types/fa/TezosFA2UpdateOperatorRequest.js.map +1 -0
  220. package/protocol/types/fa/TezosFATokenMetadata.d.ts +6 -0
  221. package/protocol/types/fa/TezosFATokenMetadata.js +3 -0
  222. package/protocol/types/fa/TezosFATokenMetadata.js.map +1 -0
  223. package/protocol/types/kt/TezosKtAddressCursor.d.ts +4 -0
  224. package/protocol/types/kt/TezosKtAddressCursor.js +3 -0
  225. package/protocol/types/kt/TezosKtAddressCursor.js.map +1 -0
  226. package/protocol/types/kt/TezosKtAddressResult.d.ts +5 -0
  227. package/protocol/types/kt/TezosKtAddressResult.js +3 -0
  228. package/protocol/types/kt/TezosKtAddressResult.js.map +1 -0
  229. package/protocol/types/micheline/MichelineNode.d.ts +15 -0
  230. package/protocol/types/micheline/MichelineNode.js +5 -0
  231. package/protocol/types/micheline/MichelineNode.js.map +1 -0
  232. package/protocol/types/micheline/MichelineNodeUtils.d.ts +6 -0
  233. package/protocol/types/micheline/MichelineNodeUtils.js +40 -0
  234. package/protocol/types/micheline/MichelineNodeUtils.js.map +1 -0
  235. package/protocol/types/michelson/MichelsonType.d.ts +11 -0
  236. package/protocol/types/michelson/MichelsonType.js +22 -0
  237. package/protocol/types/michelson/MichelsonType.js.map +1 -0
  238. package/protocol/types/michelson/MichelsonTypeMeta.d.ts +33 -0
  239. package/protocol/types/michelson/MichelsonTypeMeta.js +132 -0
  240. package/protocol/types/michelson/MichelsonTypeMeta.js.map +1 -0
  241. package/protocol/types/michelson/MichelsonTypeUtils.d.ts +19 -0
  242. package/protocol/types/michelson/MichelsonTypeUtils.js +249 -0
  243. package/protocol/types/michelson/MichelsonTypeUtils.js.map +1 -0
  244. package/protocol/types/michelson/generics/MichelsonList.d.ts +11 -0
  245. package/protocol/types/michelson/generics/MichelsonList.js +68 -0
  246. package/protocol/types/michelson/generics/MichelsonList.js.map +1 -0
  247. package/protocol/types/michelson/generics/MichelsonMap.d.ts +14 -0
  248. package/protocol/types/michelson/generics/MichelsonMap.js +118 -0
  249. package/protocol/types/michelson/generics/MichelsonMap.js.map +1 -0
  250. package/protocol/types/michelson/generics/MichelsonOption.d.ts +25 -0
  251. package/protocol/types/michelson/generics/MichelsonOption.js +119 -0
  252. package/protocol/types/michelson/generics/MichelsonOption.js.map +1 -0
  253. package/protocol/types/michelson/generics/MichelsonOr.d.ts +25 -0
  254. package/protocol/types/michelson/generics/MichelsonOr.js +132 -0
  255. package/protocol/types/michelson/generics/MichelsonOr.js.map +1 -0
  256. package/protocol/types/michelson/generics/MichelsonPair.d.ts +17 -0
  257. package/protocol/types/michelson/generics/MichelsonPair.js +135 -0
  258. package/protocol/types/michelson/generics/MichelsonPair.js.map +1 -0
  259. package/protocol/types/michelson/grammar/MichelsonGrammarData.d.ts +2 -0
  260. package/protocol/types/michelson/grammar/MichelsonGrammarData.js +4 -0
  261. package/protocol/types/michelson/grammar/MichelsonGrammarData.js.map +1 -0
  262. package/protocol/types/michelson/grammar/MichelsonGrammarInstruction.d.ts +1 -0
  263. package/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js +4 -0
  264. package/protocol/types/michelson/grammar/MichelsonGrammarInstruction.js.map +1 -0
  265. package/protocol/types/michelson/grammar/MichelsonGrammarType.d.ts +1 -0
  266. package/protocol/types/michelson/grammar/MichelsonGrammarType.js +4 -0
  267. package/protocol/types/michelson/grammar/MichelsonGrammarType.js.map +1 -0
  268. package/protocol/types/michelson/primitives/MichelsonAddress.d.ts +15 -0
  269. package/protocol/types/michelson/primitives/MichelsonAddress.js +72 -0
  270. package/protocol/types/michelson/primitives/MichelsonAddress.js.map +1 -0
  271. package/protocol/types/michelson/primitives/MichelsonBool.d.ts +12 -0
  272. package/protocol/types/michelson/primitives/MichelsonBool.js +57 -0
  273. package/protocol/types/michelson/primitives/MichelsonBool.js.map +1 -0
  274. package/protocol/types/michelson/primitives/MichelsonBytes.d.ts +14 -0
  275. package/protocol/types/michelson/primitives/MichelsonBytes.js +75 -0
  276. package/protocol/types/michelson/primitives/MichelsonBytes.js.map +1 -0
  277. package/protocol/types/michelson/primitives/MichelsonInt.d.ts +14 -0
  278. package/protocol/types/michelson/primitives/MichelsonInt.js +72 -0
  279. package/protocol/types/michelson/primitives/MichelsonInt.js.map +1 -0
  280. package/protocol/types/michelson/primitives/MichelsonString.d.ts +14 -0
  281. package/protocol/types/michelson/primitives/MichelsonString.js +74 -0
  282. package/protocol/types/michelson/primitives/MichelsonString.js.map +1 -0
  283. package/protocol/types/michelson/primitives/MichelsonUnit.d.ts +9 -0
  284. package/protocol/types/michelson/primitives/MichelsonUnit.js +53 -0
  285. package/protocol/types/michelson/primitives/MichelsonUnit.js.map +1 -0
  286. package/protocol/types/operations/ActivateAccount.d.ts +7 -0
  287. package/protocol/types/operations/ActivateAccount.js +3 -0
  288. package/protocol/types/operations/ActivateAccount.js.map +1 -0
  289. package/protocol/types/operations/Ballot.d.ts +9 -0
  290. package/protocol/types/operations/Ballot.js +3 -0
  291. package/protocol/types/operations/Ballot.js.map +1 -0
  292. package/protocol/types/operations/Delegation.d.ts +11 -0
  293. package/protocol/types/operations/Delegation.js +3 -0
  294. package/protocol/types/operations/Delegation.js.map +1 -0
  295. package/protocol/types/operations/DoubleBakingEvidence.d.ts +8 -0
  296. package/protocol/types/operations/DoubleBakingEvidence.js +3 -0
  297. package/protocol/types/operations/DoubleBakingEvidence.js.map +1 -0
  298. package/protocol/types/operations/DoubleEndorsementEvidence.d.ts +16 -0
  299. package/protocol/types/operations/DoubleEndorsementEvidence.js +3 -0
  300. package/protocol/types/operations/DoubleEndorsementEvidence.js.map +1 -0
  301. package/protocol/types/operations/Endorsement.d.ts +6 -0
  302. package/protocol/types/operations/Endorsement.js +3 -0
  303. package/protocol/types/operations/Endorsement.js.map +1 -0
  304. package/protocol/types/operations/Origination.d.ts +13 -0
  305. package/protocol/types/operations/Origination.js +3 -0
  306. package/protocol/types/operations/Origination.js.map +1 -0
  307. package/protocol/types/operations/Proposal.d.ts +7 -0
  308. package/protocol/types/operations/Proposal.js +3 -0
  309. package/protocol/types/operations/Proposal.js.map +1 -0
  310. package/protocol/types/operations/Reveal.d.ts +11 -0
  311. package/protocol/types/operations/Reveal.js +3 -0
  312. package/protocol/types/operations/Reveal.js.map +1 -0
  313. package/protocol/types/operations/SeedNonceRevelation.d.ts +7 -0
  314. package/protocol/types/operations/SeedNonceRevelation.js +3 -0
  315. package/protocol/types/operations/SeedNonceRevelation.js.map +1 -0
  316. package/protocol/types/operations/TezosOperation.d.ts +4 -0
  317. package/protocol/types/operations/TezosOperation.js +3 -0
  318. package/protocol/types/operations/TezosOperation.js.map +1 -0
  319. package/protocol/types/operations/Transaction.d.ts +23 -0
  320. package/protocol/types/operations/Transaction.js +3 -0
  321. package/protocol/types/operations/Transaction.js.map +1 -0
  322. package/protocol/types/sapling/TezosSaplingAddressCursor.d.ts +4 -0
  323. package/protocol/types/sapling/TezosSaplingAddressCursor.js +3 -0
  324. package/protocol/types/sapling/TezosSaplingAddressCursor.js.map +1 -0
  325. package/protocol/types/sapling/TezosSaplingAddressResult.d.ts +4 -0
  326. package/protocol/types/sapling/TezosSaplingAddressResult.js +3 -0
  327. package/protocol/types/sapling/TezosSaplingAddressResult.js.map +1 -0
  328. package/protocol/types/sapling/TezosSaplingCiphertext.d.ts +8 -0
  329. package/protocol/types/sapling/TezosSaplingCiphertext.js +3 -0
  330. package/protocol/types/sapling/TezosSaplingCiphertext.js.map +1 -0
  331. package/protocol/types/sapling/TezosSaplingInput.d.ts +6 -0
  332. package/protocol/types/sapling/TezosSaplingInput.js +3 -0
  333. package/protocol/types/sapling/TezosSaplingInput.js.map +1 -0
  334. package/protocol/types/sapling/TezosSaplingOutput.d.ts +6 -0
  335. package/protocol/types/sapling/TezosSaplingOutput.js +3 -0
  336. package/protocol/types/sapling/TezosSaplingOutput.js.map +1 -0
  337. package/protocol/types/sapling/TezosSaplingStateDiff.d.ts +6 -0
  338. package/protocol/types/sapling/TezosSaplingStateDiff.js +3 -0
  339. package/protocol/types/sapling/TezosSaplingStateDiff.js.map +1 -0
  340. package/protocol/types/sapling/TezosSaplingStateTree.d.ts +7 -0
  341. package/protocol/types/sapling/TezosSaplingStateTree.js +3 -0
  342. package/protocol/types/sapling/TezosSaplingStateTree.js.map +1 -0
  343. package/protocol/types/sapling/TezosSaplingTransaction.d.ts +23 -0
  344. package/protocol/types/sapling/TezosSaplingTransaction.js +3 -0
  345. package/protocol/types/sapling/TezosSaplingTransaction.js.map +1 -0
  346. package/protocol/types/sapling/TezosSaplingTransactionCursor.d.ts +3 -0
  347. package/protocol/types/sapling/TezosSaplingTransactionCursor.js +3 -0
  348. package/protocol/types/sapling/TezosSaplingTransactionCursor.js.map +1 -0
  349. package/protocol/types/sapling/TezosSaplingTransactionResult.d.ts +6 -0
  350. package/protocol/types/sapling/TezosSaplingTransactionResult.js +3 -0
  351. package/protocol/types/sapling/TezosSaplingTransactionResult.js.map +1 -0
  352. package/protocol/types/utils.d.ts +8 -0
  353. package/protocol/types/utils.js +41 -0
  354. package/protocol/types/utils.js.map +1 -0
  355. package/readme.md +121 -0
  356. package/types/signed-transaction-tezos-sapling.d.ts +3 -0
  357. package/types/signed-transaction-tezos-sapling.js +3 -0
  358. package/types/signed-transaction-tezos-sapling.js.map +1 -0
  359. package/types/signed-transaction-tezos.d.ts +5 -0
  360. package/types/signed-transaction-tezos.js +3 -0
  361. package/types/signed-transaction-tezos.js.map +1 -0
  362. package/types/transaction-tezos.d.ts +14 -0
  363. package/types/transaction-tezos.js +3 -0
  364. package/types/transaction-tezos.js.map +1 -0
  365. package/types/unsigned-transaction-tezos-sapling.d.ts +38 -0
  366. package/types/unsigned-transaction-tezos-sapling.js +3 -0
  367. package/types/unsigned-transaction-tezos-sapling.js.map +1 -0
  368. package/types/unsigned-transaction-tezos.d.ts +8 -0
  369. package/types/unsigned-transaction-tezos.js +3 -0
  370. package/types/unsigned-transaction-tezos.js.map +1 -0
@@ -0,0 +1,317 @@
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
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ var __generator = (this && this.__generator) || function (thisArg, body) {
25
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
26
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
27
+ function verb(n) { return function (v) { return step([n, v]); }; }
28
+ function step(op) {
29
+ if (f) throw new TypeError("Generator is already executing.");
30
+ while (_) try {
31
+ 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;
32
+ if (y = 0, t) op = [op[0] & 2, t.value];
33
+ switch (op[0]) {
34
+ case 0: case 1: t = op; break;
35
+ case 4: _.label++; return { value: op[1], done: false };
36
+ case 5: _.label++; y = op[1]; op = [0]; continue;
37
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
38
+ default:
39
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
40
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
41
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
42
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
43
+ if (t[2]) _.ops.pop();
44
+ _.trys.pop(); continue;
45
+ }
46
+ op = body.call(thisArg, _);
47
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49
+ }
50
+ };
51
+ var __importDefault = (this && this.__importDefault) || function (mod) {
52
+ return (mod && mod.__esModule) ? mod : { "default": mod };
53
+ };
54
+ Object.defineProperty(exports, "__esModule", { value: true });
55
+ exports.TezosKtProtocol = void 0;
56
+ var coinlib_core_1 = require("@airgap/coinlib-core");
57
+ var index_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/axios-0.19.0/index"));
58
+ var bignumber_1 = __importDefault(require("@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber"));
59
+ var errors_1 = require("@airgap/coinlib-core/errors");
60
+ var coinlib_error_1 = require("@airgap/coinlib-core/errors/coinlib-error");
61
+ var TezosProtocol_1 = require("../TezosProtocol");
62
+ var TezosUtils_1 = require("../TezosUtils");
63
+ var TezosOperationType_1 = require("../types/TezosOperationType");
64
+ var TezosKtAddress_1 = require("./TezosKtAddress");
65
+ var INDEX_LIMIT = 10000;
66
+ var TezosKtProtocol = /** @class */ (function (_super) {
67
+ __extends(TezosKtProtocol, _super);
68
+ function TezosKtProtocol() {
69
+ var _this = _super !== null && _super.apply(this, arguments) || this;
70
+ _this.identifier = coinlib_core_1.SubProtocolSymbols.XTZ_KT;
71
+ _this.isSubProtocol = true;
72
+ _this.subProtocolType = coinlib_core_1.SubProtocolType.ACCOUNT;
73
+ _this.addressValidationPattern = '^(tz1|KT1)[1-9A-Za-z]{33}$';
74
+ _this.migrationFee = new bignumber_1.default(5000);
75
+ return _this;
76
+ }
77
+ TezosKtProtocol.prototype.getIsSubProtocol = function () {
78
+ return __awaiter(this, void 0, void 0, function () {
79
+ return __generator(this, function (_a) {
80
+ return [2 /*return*/, this.isSubProtocol];
81
+ });
82
+ });
83
+ };
84
+ TezosKtProtocol.prototype.getSubProtocolType = function () {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ return __generator(this, function (_a) {
87
+ return [2 /*return*/, this.subProtocolType];
88
+ });
89
+ });
90
+ };
91
+ TezosKtProtocol.prototype.getContractAddress = function () {
92
+ return __awaiter(this, void 0, void 0, function () {
93
+ return __generator(this, function (_a) {
94
+ return [2 /*return*/, undefined];
95
+ });
96
+ });
97
+ };
98
+ TezosKtProtocol.prototype.getAddressFromPublicKey = function (publicKey, cursor) {
99
+ var _a;
100
+ return __awaiter(this, void 0, void 0, function () {
101
+ var addresses, index;
102
+ return __generator(this, function (_b) {
103
+ switch (_b.label) {
104
+ case 0: return [4 /*yield*/, this.getAddressesFromPublicKey(publicKey)];
105
+ case 1:
106
+ addresses = _b.sent();
107
+ index = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.index) !== null && _a !== void 0 ? _a : 0;
108
+ if (index >= addresses.length) {
109
+ throw new errors_1.NotFoundError(coinlib_error_1.Domain.TEZOS, 'No address for the specified index exists');
110
+ }
111
+ return [2 /*return*/, addresses[index]];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ TezosKtProtocol.prototype.getAddressesFromPublicKey = function (publicKey, cursor) {
117
+ var _a;
118
+ return __awaiter(this, void 0, void 0, function () {
119
+ var tz1address, startIndex, ktAddresses, addresses;
120
+ var _this = this;
121
+ return __generator(this, function (_b) {
122
+ switch (_b.label) {
123
+ case 0: return [4 /*yield*/, _super.prototype.getAddressFromPublicKey.call(this, publicKey)];
124
+ case 1:
125
+ tz1address = (_b.sent()).address;
126
+ startIndex = (_a = cursor === null || cursor === void 0 ? void 0 : cursor.index) !== null && _a !== void 0 ? _a : 0;
127
+ return [4 /*yield*/, this.options.network.extras.indexerClient.getDelegatorContracts(tz1address, INDEX_LIMIT)];
128
+ case 2:
129
+ ktAddresses = _b.sent();
130
+ return [4 /*yield*/, Promise.all(ktAddresses.reverse().map(function (ktAddress, index) { return __awaiter(_this, void 0, void 0, function () {
131
+ var address;
132
+ return __generator(this, function (_a) {
133
+ switch (_a.label) {
134
+ case 0: return [4 /*yield*/, TezosKtAddress_1.TezosKtAddress.from(ktAddress)];
135
+ case 1:
136
+ address = _a.sent();
137
+ return [2 /*return*/, {
138
+ address: address.asString(),
139
+ cursor: {
140
+ hasNext: index < INDEX_LIMIT - 1,
141
+ index: index
142
+ }
143
+ }];
144
+ }
145
+ });
146
+ }); }))];
147
+ case 3:
148
+ addresses = _b.sent();
149
+ return [2 /*return*/, addresses.slice(startIndex)];
150
+ }
151
+ });
152
+ });
153
+ };
154
+ TezosKtProtocol.prototype.estimateMaxTransactionValueFromPublicKey = function (publicKey, recipients, fee, data) {
155
+ return __awaiter(this, void 0, void 0, function () {
156
+ var address;
157
+ return __generator(this, function (_a) {
158
+ switch (_a.label) {
159
+ case 0: return [4 /*yield*/, this.getAddressFromPublicKey(publicKey, (data === null || data === void 0 ? void 0 : data.addressIndex) ? {
160
+ hasNext: data.addressIndex < INDEX_LIMIT - 1,
161
+ index: data.addressIndex
162
+ }
163
+ : undefined)];
164
+ case 1:
165
+ address = _a.sent();
166
+ return [2 /*return*/, this.getBalanceOfAddresses([address.address])];
167
+ }
168
+ });
169
+ });
170
+ };
171
+ TezosKtProtocol.prototype.estimateFeeDefaultsFromPublicKey = function (publicKey, recipients, values, data) {
172
+ return __awaiter(this, void 0, void 0, function () {
173
+ var fee;
174
+ return __generator(this, function (_a) {
175
+ fee = this.migrationFee.shiftedBy(-this.feeDecimals).toFixed();
176
+ return [2 /*return*/, {
177
+ low: fee,
178
+ medium: fee,
179
+ high: fee
180
+ }];
181
+ });
182
+ });
183
+ };
184
+ TezosKtProtocol.prototype.prepareTransactionFromPublicKey = function (_publicKey, _recipients, _values, _fee, _data) {
185
+ return __awaiter(this, void 0, void 0, function () {
186
+ return __generator(this, function (_a) {
187
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.TEZOS, 'sending funds from KT addresses is not supported. Please use the migration feature.');
188
+ });
189
+ });
190
+ };
191
+ TezosKtProtocol.prototype.originate = function (publicKey, delegate, amount) {
192
+ return __awaiter(this, void 0, void 0, function () {
193
+ return __generator(this, function (_a) {
194
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.TEZOS, 'Originate operation not supported for KT Addresses');
195
+ });
196
+ });
197
+ };
198
+ TezosKtProtocol.prototype.delegate = function (publicKey, delegate) {
199
+ return __awaiter(this, void 0, void 0, function () {
200
+ return __generator(this, function (_a) {
201
+ throw new errors_1.NotImplementedError(coinlib_error_1.Domain.TEZOS, 'Delegate operation not supported for KT Addresses');
202
+ });
203
+ });
204
+ };
205
+ TezosKtProtocol.prototype.migrateKtContract = function (publicKey, destinationContract) {
206
+ return __awaiter(this, void 0, void 0, function () {
207
+ var counter, branch, operations, address, balanceOfManager, _a, amount, _b, results, accountManager, _c, _d, hexDestination, spendOperation, tezosWrappedOperation, binaryTx, error_1;
208
+ return __generator(this, function (_e) {
209
+ switch (_e.label) {
210
+ case 0:
211
+ counter = new bignumber_1.default(1);
212
+ branch = '';
213
+ operations = [];
214
+ return [4 /*yield*/, _super.prototype.getAddressFromPublicKey.call(this, publicKey)];
215
+ case 1:
216
+ address = (_e.sent()).address;
217
+ _a = bignumber_1.default.bind;
218
+ return [4 /*yield*/, _super.prototype.getBalanceOfAddresses.call(this, [address])];
219
+ case 2:
220
+ balanceOfManager = new (_a.apply(bignumber_1.default, [void 0, _e.sent()]))();
221
+ if (balanceOfManager.isLessThan(this.migrationFee)) {
222
+ throw new errors_1.BalanceError(coinlib_error_1.Domain.TEZOS, 'not enough balance on tz address for fee');
223
+ }
224
+ _b = bignumber_1.default.bind;
225
+ return [4 /*yield*/, this.getBalanceOfAddresses([destinationContract])];
226
+ case 3:
227
+ amount = new (_b.apply(bignumber_1.default, [void 0, _e.sent()]))();
228
+ return [4 /*yield*/, Promise.all([
229
+ index_1.default.get(this.jsonRPCAPI + "/chains/main/blocks/head/context/contracts/" + address + "/counter"),
230
+ index_1.default.get(this.jsonRPCAPI + "/chains/main/blocks/head~2/hash"),
231
+ index_1.default.get(this.jsonRPCAPI + "/chains/main/blocks/head/context/contracts/" + address + "/manager_key")
232
+ ]).catch(function (error) {
233
+ if (error.response && error.response.status !== 404) {
234
+ throw new errors_1.NetworkError(coinlib_error_1.Domain.TEZOS, error);
235
+ }
236
+ })];
237
+ case 4:
238
+ results = _e.sent();
239
+ counter = new bignumber_1.default(results[0].data).plus(1);
240
+ branch = results[1].data;
241
+ accountManager = results[2].data;
242
+ if (!!accountManager) return [3 /*break*/, 6];
243
+ _d = (_c = operations).push;
244
+ return [4 /*yield*/, this.createRevealOperation(counter, publicKey, address)];
245
+ case 5:
246
+ _d.apply(_c, [_e.sent()]);
247
+ counter = counter.plus(1);
248
+ _e.label = 6;
249
+ case 6:
250
+ hexDestination = this.checkAndRemovePrefixToHex(address, TezosUtils_1.TezosUtils.tezosPrefixes.tz1);
251
+ if (hexDestination.length > 42) {
252
+ // must be less or equal 21 bytes
253
+ throw new errors_1.InvalidValueError(coinlib_error_1.Domain.TEZOS, 'provided source is invalid');
254
+ }
255
+ while (hexDestination.length !== 42) {
256
+ // fill up with 0s to match 21 bytes
257
+ hexDestination = "0" + hexDestination;
258
+ }
259
+ spendOperation = {
260
+ kind: TezosOperationType_1.TezosOperationType.TRANSACTION,
261
+ fee: this.migrationFee.toFixed(),
262
+ gas_limit: '26283',
263
+ storage_limit: '0',
264
+ amount: '0',
265
+ counter: counter.toFixed(),
266
+ destination: destinationContract,
267
+ source: address,
268
+ parameters: {
269
+ entrypoint: 'do',
270
+ value: [
271
+ { prim: 'DROP' },
272
+ { prim: 'NIL', args: [{ prim: 'operation' }] },
273
+ {
274
+ prim: 'PUSH',
275
+ args: [
276
+ { prim: 'key_hash' },
277
+ {
278
+ bytes: hexDestination
279
+ }
280
+ ]
281
+ },
282
+ { prim: 'IMPLICIT_ACCOUNT' },
283
+ {
284
+ prim: 'PUSH',
285
+ args: [{ prim: 'mutez' }, { int: amount.toString(10) }]
286
+ },
287
+ { prim: 'UNIT' },
288
+ { prim: 'TRANSFER_TOKENS' },
289
+ { prim: 'CONS' }
290
+ ]
291
+ }
292
+ };
293
+ operations.push(spendOperation);
294
+ _e.label = 7;
295
+ case 7:
296
+ _e.trys.push([7, 9, , 10]);
297
+ tezosWrappedOperation = {
298
+ branch: branch,
299
+ contents: operations
300
+ };
301
+ return [4 /*yield*/, this.forgeTezosOperation(tezosWrappedOperation)];
302
+ case 8:
303
+ binaryTx = _e.sent();
304
+ return [2 /*return*/, { binaryTransaction: binaryTx }];
305
+ case 9:
306
+ error_1 = _e.sent();
307
+ console.warn(error_1.message);
308
+ throw new errors_1.OperationFailedError(coinlib_error_1.Domain.TEZOS, 'Forging Tezos TX failed.');
309
+ case 10: return [2 /*return*/];
310
+ }
311
+ });
312
+ });
313
+ };
314
+ return TezosKtProtocol;
315
+ }(TezosProtocol_1.TezosProtocol));
316
+ exports.TezosKtProtocol = TezosKtProtocol;
317
+ //# sourceMappingURL=TezosKtProtocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TezosKtProtocol.js","sourceRoot":"","sources":["../../../src/protocol/kt/TezosKtProtocol.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA0H;AAC1H,mGAA2G;AAC3G,iHAA0F;AAC1F,sDAOoC;AACpC,2EAAkE;AAGlE,kDAAgD;AAChD,4CAA0C;AAK1C,kEAAgE;AAGhE,mDAAiD;AAEjD,IAAM,WAAW,GAAW,KAAK,CAAA;AAEjC;IAAqC,mCAAa;IAAlD;QAAA,qEAkNC;QAjNQ,gBAAU,GAAoB,iCAAkB,CAAC,MAAM,CAAA;QACvD,mBAAa,GAAY,IAAI,CAAA;QAC7B,qBAAe,GAAoB,8BAAe,CAAC,OAAO,CAAA;QAC1D,8BAAwB,GAAW,4BAA4B,CAAA;QAE/D,kBAAY,GAAc,IAAI,mBAAS,CAAC,IAAI,CAAC,CAAA;;IA4MtD,CAAC;IA1Mc,0CAAgB,GAA7B;;;gBACE,sBAAO,IAAI,CAAC,aAAa,EAAA;;;KAC1B;IAEY,4CAAkB,GAA/B;;;gBACE,sBAAO,IAAI,CAAC,eAAe,EAAA;;;KAC5B;IAEY,4CAAkB,GAA/B;;;gBACE,sBAAO,SAAS,EAAA;;;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Address } from '../TezosAddress';
3
+ export declare class TezosSaplingAddress extends TezosAddress {
4
+ readonly raw: Buffer;
5
+ readonly diversifierIndex?: string | undefined;
6
+ private constructor();
7
+ static fromViewingKey(viewingKey: string, index?: Buffer | string | number): Promise<TezosSaplingAddress>;
8
+ static fromRaw(raw: Buffer, diversifierIndex?: Buffer): Promise<TezosSaplingAddress>;
9
+ static fromValue(value: string, diversifierIndex?: string): Promise<TezosSaplingAddress>;
10
+ static next(viewingKey: string, current: TezosSaplingAddress): Promise<TezosSaplingAddress>;
11
+ static isZetAddress(address: string): boolean;
12
+ }
@@ -0,0 +1,134 @@
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
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
18
+ }) : (function(o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ }));
22
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
23
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
24
+ }) : function(o, v) {
25
+ o["default"] = v;
26
+ });
27
+ var __importStar = (this && this.__importStar) || function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
35
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
36
+ return new (P || (P = Promise))(function (resolve, reject) {
37
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
38
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
39
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
40
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
41
+ });
42
+ };
43
+ var __generator = (this && this.__generator) || function (thisArg, body) {
44
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
45
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
46
+ function verb(n) { return function (v) { return step([n, v]); }; }
47
+ function step(op) {
48
+ if (f) throw new TypeError("Generator is already executing.");
49
+ while (_) try {
50
+ 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;
51
+ if (y = 0, t) op = [op[0] & 2, t.value];
52
+ switch (op[0]) {
53
+ case 0: case 1: t = op; break;
54
+ case 4: _.label++; return { value: op[1], done: false };
55
+ case 5: _.label++; y = op[1]; op = [0]; continue;
56
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
57
+ default:
58
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
59
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
60
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
61
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
62
+ if (t[2]) _.ops.pop();
63
+ _.trys.pop(); continue;
64
+ }
65
+ op = body.call(thisArg, _);
66
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
67
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
68
+ }
69
+ };
70
+ Object.defineProperty(exports, "__esModule", { value: true });
71
+ exports.TezosSaplingAddress = void 0;
72
+ var bs58check = __importStar(require("@airgap/coinlib-core/dependencies/src/bs58check-2.1.2/index"));
73
+ var sapling_wasm_1 = require("@airgap/sapling-wasm");
74
+ var TezosAddress_1 = require("../TezosAddress");
75
+ var TezosUtils_1 = require("../TezosUtils");
76
+ var TezosSaplingAddress = /** @class */ (function (_super) {
77
+ __extends(TezosSaplingAddress, _super);
78
+ function TezosSaplingAddress(value, raw, diversifierIndex) {
79
+ var _this = _super.call(this, value) || this;
80
+ _this.raw = raw;
81
+ _this.diversifierIndex = diversifierIndex;
82
+ return _this;
83
+ }
84
+ TezosSaplingAddress.fromViewingKey = function (viewingKey, index) {
85
+ return __awaiter(this, void 0, void 0, function () {
86
+ var paymentAddress;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0: return [4 /*yield*/, sapling_wasm_1.getPaymentAddressFromViewingKey(viewingKey, index)];
90
+ case 1:
91
+ paymentAddress = _a.sent();
92
+ return [2 /*return*/, TezosSaplingAddress.fromRaw(paymentAddress.raw, paymentAddress.index)];
93
+ }
94
+ });
95
+ });
96
+ };
97
+ TezosSaplingAddress.fromRaw = function (raw, diversifierIndex) {
98
+ return __awaiter(this, void 0, void 0, function () {
99
+ return __generator(this, function (_a) {
100
+ return [2 /*return*/, new TezosSaplingAddress(bs58check.encode(Buffer.concat([TezosUtils_1.TezosUtils.tezosPrefixes.zet1, raw])), raw, diversifierIndex === null || diversifierIndex === void 0 ? void 0 : diversifierIndex.toString('hex'))];
101
+ });
102
+ });
103
+ };
104
+ TezosSaplingAddress.fromValue = function (value, diversifierIndex) {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ return __generator(this, function (_a) {
107
+ return [2 /*return*/, new TezosSaplingAddress(value, bs58check.decode(value).slice(TezosUtils_1.TezosUtils.tezosPrefixes.zet1.length), diversifierIndex)];
108
+ });
109
+ });
110
+ };
111
+ TezosSaplingAddress.next = function (viewingKey, current) {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ var nextAddress;
114
+ return __generator(this, function (_a) {
115
+ switch (_a.label) {
116
+ case 0:
117
+ if (current.diversifierIndex === undefined) {
118
+ return [2 /*return*/, Promise.reject("Can't get next address for undefined diversifier index")];
119
+ }
120
+ return [4 /*yield*/, sapling_wasm_1.getNextPaymentAddressFromViewingKey(viewingKey, current.diversifierIndex)];
121
+ case 1:
122
+ nextAddress = _a.sent();
123
+ return [2 /*return*/, TezosSaplingAddress.fromRaw(nextAddress.raw, nextAddress.index)];
124
+ }
125
+ });
126
+ });
127
+ };
128
+ TezosSaplingAddress.isZetAddress = function (address) {
129
+ return address.startsWith('zet1');
130
+ };
131
+ return TezosSaplingAddress;
132
+ }(TezosAddress_1.TezosAddress));
133
+ exports.TezosSaplingAddress = TezosSaplingAddress;
134
+ //# sourceMappingURL=TezosSaplingAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TezosSaplingAddress.js","sourceRoot":"","sources":["../../../src/protocol/sapling/TezosSaplingAddress.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qGAAwF;AACxF,qDAAkI;AAElI,gDAA8C;AAC9C,4CAA0C;AAE1C;IAAyC,uCAAY;IACnD,6BAAoB,KAAa,EAAkB,GAAW,EAAkB,gBAAyB;QAAzG,YACE,kBAAM,KAAK,CAAC,SACb;QAFkD,SAAG,GAAH,GAAG,CAAQ;QAAkB,sBAAgB,GAAhB,gBAAgB,CAAS;;IAEzG,CAAC;IAEmB,kCAAc,GAAlC,UAAmC,UAAkB,EAAE,KAAgC;;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0BAAC;AAAD,CAAC,AApCD,CAAyC,2BAAY,GAoCpD;AApCY,kDAAmB"}
@@ -0,0 +1,34 @@
1
+ /// <reference types="node" />
2
+ import BigNumber from '@airgap/coinlib-core/dependencies/src/bignumber.js-9.0.0/bignumber';
3
+ import { Ed25519CryptoClient } from '@airgap/coinlib-core/protocols/Ed25519CryptoClient';
4
+ import { SaplingPartialOutputDescription } from '@airgap/sapling-wasm';
5
+ import { TezosCryptoClient } from '../TezosCryptoClient';
6
+ import { TezosSaplingCiphertext } from '../types/sapling/TezosSaplingCiphertext';
7
+ import { TezosSaplingOutput } from '../types/sapling/TezosSaplingOutput';
8
+ interface PayloadEnc {
9
+ diversifier: Buffer;
10
+ address: Buffer;
11
+ amount: BigNumber;
12
+ rcm: Buffer;
13
+ memo: Buffer;
14
+ }
15
+ interface PayloadOut {
16
+ pkd: Buffer;
17
+ esk: Buffer;
18
+ }
19
+ export declare class TezosSaplingCryptoClient extends Ed25519CryptoClient {
20
+ private readonly tezosCryptoClient;
21
+ private readonly ockKey;
22
+ private readonly kdfKey;
23
+ constructor(tezosCryptoClient: TezosCryptoClient);
24
+ signMessage(message: string, keypair: {
25
+ publicKey?: string | undefined;
26
+ privateKey: string;
27
+ }): Promise<string>;
28
+ verifyMessage(message: string, signature: string, publicKey: string): Promise<boolean>;
29
+ encryptCiphertext(tezosOutput: TezosSaplingOutput, saplingDescription: SaplingPartialOutputDescription, rcm: Buffer, esk: Buffer, viewingKey?: Buffer): Promise<TezosSaplingCiphertext>;
30
+ decryptCiphertextEnc(viewingKey: Buffer | string, ciphertext: TezosSaplingCiphertext, mode?: 'sender' | 'receiver', commitment?: Buffer | string): Promise<PayloadEnc>;
31
+ decryptCiphertextOut(viewingKey: Buffer | string, ciphertext: TezosSaplingCiphertext, commitment: Buffer | string): Promise<PayloadOut>;
32
+ private getSymmetricKey;
33
+ }
34
+ export {};