@typus/typus-sdk 0.6.3 → 1.0.0

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 (212) hide show
  1. package/lib/config.json +17 -20
  2. package/lib/constants.d.ts +9 -7
  3. package/lib/constants.js +10 -8
  4. package/lib/test/authorized/testAuthorizedNewPortfolioVault.js +82 -0
  5. package/lib/test/{testClaim.js → authorized/testAuthorizedUpdateUpcomingVaultConfig.js} +19 -30
  6. package/lib/test/authorized/testAuthorizedUpdateWarmupVaultConfig.js +68 -0
  7. package/lib/test/getVaultData.js +1 -1
  8. package/lib/test/getWhiteListFromRegistry.js +1 -1
  9. package/lib/test/helper/getAuctionMaxSize.js +76 -0
  10. package/lib/test/helper/getUserStatus.js +75 -0
  11. package/lib/test/{testWithdraw.js → user/testClaim.js} +14 -17
  12. package/lib/test/{getMakersShares.js → user/testCompound.js} +20 -6
  13. package/lib/test/{testUnsubscribe.js → user/testDeposit.js} +28 -37
  14. package/lib/test/{getUsersShares.js → user/testHarvest.js} +20 -6
  15. package/lib/test/user/testNewBid.js +77 -0
  16. package/lib/test/user/testUnsubscribe.d.ts +1 -0
  17. package/lib/test/user/testUnsubscribe.js +69 -0
  18. package/lib/test/user/testWithdraw.d.ts +1 -0
  19. package/lib/test/{testDeposit.js → user/testWithdraw.js} +15 -19
  20. package/lib/utils/fetchData.d.ts +72 -61
  21. package/lib/utils/fetchData.js +26 -197
  22. package/lib/utils/getVaultData.d.ts +2 -2
  23. package/lib/utils/getVaultData.js +123 -161
  24. package/lib/utils/getWhiteListFromRegistry.js +0 -1
  25. package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.d.ts +1 -1
  26. package/lib/utils/portfolio/authorized/getAuthorizedAddPortfolioVaultAuthorizedUserTx.js +2 -2
  27. package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.d.ts +4 -3
  28. package/lib/utils/portfolio/authorized/getAuthorizedNewPortfolioVaultTx.js +5 -3
  29. package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.d.ts +1 -1
  30. package/lib/utils/portfolio/authorized/getAuthorizedRemovePortfolioVaultAuthorizedUserTx.js +2 -2
  31. package/lib/utils/portfolio/authorized/getAuthorizedUpdateUpcomingVaultConfigTx.d.ts +4 -0
  32. package/lib/utils/portfolio/authorized/{getAuthorizedUpdateNextVaultConfigTx.js → getAuthorizedUpdateUpcomingVaultConfigTx.js} +5 -5
  33. package/lib/utils/portfolio/authorized/getAuthorizedUpdateWarmupVaultConfigTx.d.ts +1 -0
  34. package/lib/utils/portfolio/{manager/getUpdateVaultConfigTx.js → authorized/getAuthorizedUpdateWarmupVaultConfigTx.js} +4 -5
  35. package/lib/utils/portfolio/helper/getAuctionMaxSize.d.ts +8 -0
  36. package/lib/utils/portfolio/{manager/getLastEvolutionTx.js → helper/getAuctionMaxSize.js} +11 -7
  37. package/lib/utils/portfolio/helper/getUserStatus.d.ts +29 -0
  38. package/lib/utils/portfolio/{authorized/getAuthorizedEvolutionTx.js → helper/getUserStatus.js} +50 -9
  39. package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.d.ts +8 -1
  40. package/lib/utils/portfolio/manager/getAddAuthorizedUserTx.js +9 -2
  41. package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.d.ts +6 -0
  42. package/lib/utils/portfolio/manager/getAddPortfolioVaultAuthorizedUserTx.js +6 -0
  43. package/lib/utils/portfolio/manager/getEvolutionTx.d.ts +15 -1
  44. package/lib/utils/portfolio/manager/getEvolutionTx.js +14 -0
  45. package/lib/utils/portfolio/manager/getNewManagerTx.d.ts +8 -1
  46. package/lib/utils/portfolio/manager/getNewManagerTx.js +9 -2
  47. package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.d.ts +5 -5
  48. package/lib/utils/portfolio/manager/getNewPortfolioVaultTx.js +5 -5
  49. package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.d.ts +7 -0
  50. package/lib/utils/portfolio/manager/getRemoveAuthorizedUserTx.js +7 -0
  51. package/lib/utils/portfolio/manager/getRemoveManagerTx.d.ts +5 -0
  52. package/lib/utils/portfolio/manager/getRemoveManagerTx.js +5 -0
  53. package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.d.ts +7 -1
  54. package/lib/utils/portfolio/manager/getRemovePortfolioVaultAuthorizedUserTx.js +7 -1
  55. package/lib/utils/portfolio/user/getClaimAndHarvestTx.d.ts +9 -1
  56. package/lib/utils/portfolio/user/getClaimAndHarvestTx.js +11 -3
  57. package/lib/utils/portfolio/user/getClaimTx.d.ts +9 -1
  58. package/lib/utils/portfolio/user/getClaimTx.js +8 -0
  59. package/lib/utils/portfolio/user/getCompoundTx.d.ts +9 -0
  60. package/lib/utils/portfolio/{authorized/getAuthorizedLastEvolutionTx.js → user/getCompoundTx.js} +12 -6
  61. package/lib/utils/portfolio/user/getDepositTx.d.ts +10 -0
  62. package/lib/utils/portfolio/user/getDepositTx.js +10 -0
  63. package/lib/utils/portfolio/user/getHarvestTx.d.ts +9 -1
  64. package/lib/utils/portfolio/user/getHarvestTx.js +8 -0
  65. package/lib/utils/portfolio/user/getNewBidTx.d.ts +13 -1
  66. package/lib/utils/portfolio/user/getNewBidTx.js +12 -0
  67. package/lib/utils/portfolio/user/getUnsubscribeTx.d.ts +10 -1
  68. package/lib/utils/portfolio/user/getUnsubscribeTx.js +9 -0
  69. package/lib/utils/portfolio/user/getWithdrawTx.d.ts +10 -1
  70. package/lib/utils/portfolio/user/getWithdrawTx.js +9 -0
  71. package/package.json +1 -1
  72. package/lib/test/eventListener.d.ts +0 -5
  73. package/lib/test/eventListener.js +0 -397
  74. package/lib/test/testDepositV2.d.ts +0 -0
  75. package/lib/test/testDepositV2.js +0 -64
  76. package/lib/test/testNewAuction.js +0 -94
  77. package/lib/test/testNewVault.js +0 -153
  78. package/lib/test/testOracle.js +0 -94
  79. package/lib/test/testSettle.js +0 -590
  80. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.d.ts +0 -1
  81. package/lib/utils/authorized/getAuthorizedAddAuthorizedUserTx.js +0 -56
  82. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
  83. package/lib/utils/authorized/getAuthorizedAddCoveredCallVaultAuthorizedUserTx.js +0 -56
  84. package/lib/utils/authorized/getAuthorizedDeliveryTx.d.ts +0 -1
  85. package/lib/utils/authorized/getAuthorizedDeliveryTx.js +0 -56
  86. package/lib/utils/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
  87. package/lib/utils/authorized/getAuthorizedEvolutionTx.js +0 -56
  88. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
  89. package/lib/utils/authorized/getAuthorizedLastEvolutionTx.js +0 -56
  90. package/lib/utils/authorized/getAuthorizedNewAuctionTx.d.ts +0 -1
  91. package/lib/utils/authorized/getAuthorizedNewAuctionTx.js +0 -56
  92. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.d.ts +0 -1
  93. package/lib/utils/authorized/getAuthorizedNewCoveredCallVaultTx.js +0 -76
  94. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.d.ts +0 -1
  95. package/lib/utils/authorized/getAuthorizedRemoveAuthorizedUserTx.js +0 -56
  96. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
  97. package/lib/utils/authorized/getAuthorizedRemoveCoveredCallVaultAuthorizedUserTx.js +0 -56
  98. package/lib/utils/authorized/getAuthorizedSettleTx.d.ts +0 -1
  99. package/lib/utils/authorized/getAuthorizedSettleTx.js +0 -56
  100. package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.d.ts +0 -1
  101. package/lib/utils/authorized/getAuthorizedUpdateCapacityTx.js +0 -56
  102. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -1
  103. package/lib/utils/authorized/getAuthorizedUpdateNextVaultConfigTx.js +0 -65
  104. package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
  105. package/lib/utils/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
  106. package/lib/utils/coveredCall/createPriceOracle.d.ts +0 -1
  107. package/lib/utils/coveredCall/createPriceOracle.js +0 -93
  108. package/lib/utils/coveredCall/createTimeOracle.d.ts +0 -1
  109. package/lib/utils/coveredCall/createTimeOracle.js +0 -92
  110. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
  111. package/lib/utils/coveredCall/getAddCoveredCallVaultAuthorizedUserTx.js +0 -61
  112. package/lib/utils/coveredCall/getClaimAllTx.d.ts +0 -1
  113. package/lib/utils/coveredCall/getClaimAllTx.js +0 -59
  114. package/lib/utils/coveredCall/getClaimTx.d.ts +0 -1
  115. package/lib/utils/coveredCall/getClaimTx.js +0 -59
  116. package/lib/utils/coveredCall/getCloseAuctionTx.d.ts +0 -1
  117. package/lib/utils/coveredCall/getCloseAuctionTx.js +0 -61
  118. package/lib/utils/coveredCall/getCloseVaultTx.d.ts +0 -1
  119. package/lib/utils/coveredCall/getCloseVaultTx.js +0 -60
  120. package/lib/utils/coveredCall/getDeliveryTx.d.ts +0 -1
  121. package/lib/utils/coveredCall/getDeliveryTx.js +0 -61
  122. package/lib/utils/coveredCall/getDepositTx.d.ts +0 -1
  123. package/lib/utils/coveredCall/getDepositTx.js +0 -65
  124. package/lib/utils/coveredCall/getEvolutionTx.d.ts +0 -1
  125. package/lib/utils/coveredCall/getEvolutionTx.js +0 -64
  126. package/lib/utils/coveredCall/getLastEvolutionTx.d.ts +0 -1
  127. package/lib/utils/coveredCall/getLastEvolutionTx.js +0 -63
  128. package/lib/utils/coveredCall/getMakerClaimAllTx.d.ts +0 -1
  129. package/lib/utils/coveredCall/getMakerClaimAllTx.js +0 -59
  130. package/lib/utils/coveredCall/getMakerClaimTx.d.ts +0 -1
  131. package/lib/utils/coveredCall/getMakerClaimTx.js +0 -59
  132. package/lib/utils/coveredCall/getNewAuctionTx.d.ts +0 -1
  133. package/lib/utils/coveredCall/getNewAuctionTx.js +0 -66
  134. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.d.ts +0 -1
  135. package/lib/utils/coveredCall/getNewAuctionWithNextCoveredCallVaultTx.js +0 -64
  136. package/lib/utils/coveredCall/getNewBidTx.d.ts +0 -1
  137. package/lib/utils/coveredCall/getNewBidTx.js +0 -62
  138. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.d.ts +0 -1
  139. package/lib/utils/coveredCall/getNewCoveredCallVaultTx.js +0 -77
  140. package/lib/utils/coveredCall/getNewManagerTx.d.ts +0 -1
  141. package/lib/utils/coveredCall/getNewManagerTx.js +0 -59
  142. package/lib/utils/coveredCall/getRefundTx.d.ts +0 -1
  143. package/lib/utils/coveredCall/getRefundTx.js +0 -59
  144. package/lib/utils/coveredCall/getRemoveBidTx.d.ts +0 -1
  145. package/lib/utils/coveredCall/getRemoveBidTx.js +0 -60
  146. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.d.ts +0 -1
  147. package/lib/utils/coveredCall/getRemoveCoveredCallVaultAuthorizedUserTx.js +0 -61
  148. package/lib/utils/coveredCall/getRemoveManagerTx.d.ts +0 -1
  149. package/lib/utils/coveredCall/getRemoveManagerTx.js +0 -58
  150. package/lib/utils/coveredCall/getRollOverTx.d.ts +0 -1
  151. package/lib/utils/coveredCall/getRollOverTx.js +0 -60
  152. package/lib/utils/coveredCall/getSettleTx.d.ts +0 -1
  153. package/lib/utils/coveredCall/getSettleTx.js +0 -62
  154. package/lib/utils/coveredCall/getSettleWithRollOverTx.d.ts +0 -1
  155. package/lib/utils/coveredCall/getSettleWithRollOverTx.js +0 -62
  156. package/lib/utils/coveredCall/getSubscribeTx.d.ts +0 -1
  157. package/lib/utils/coveredCall/getSubscribeTx.js +0 -60
  158. package/lib/utils/coveredCall/getUnsubscribeTx.d.ts +0 -1
  159. package/lib/utils/coveredCall/getUnsubscribeTx.js +0 -63
  160. package/lib/utils/coveredCall/getUpdateCapacityTx.d.ts +0 -1
  161. package/lib/utils/coveredCall/getUpdateCapacityTx.js +0 -61
  162. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.d.ts +0 -1
  163. package/lib/utils/coveredCall/getUpdateNextVaultConfigTx.js +0 -66
  164. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.d.ts +0 -1
  165. package/lib/utils/coveredCall/getUpdatePayoffConfigTx.js +0 -62
  166. package/lib/utils/coveredCall/getUpdateVaultConfigTx.d.ts +0 -1
  167. package/lib/utils/coveredCall/getUpdateVaultConfigTx.js +0 -65
  168. package/lib/utils/coveredCall/getWithdrawTx.d.ts +0 -1
  169. package/lib/utils/coveredCall/getWithdrawTx.js +0 -60
  170. package/lib/utils/fetchPortfolioData.d.ts +0 -93
  171. package/lib/utils/fetchPortfolioData.js +0 -205
  172. package/lib/utils/getCreateTokenRegistryTx.d.ts +0 -1
  173. package/lib/utils/getCreateTokenRegistryTx.js +0 -59
  174. package/lib/utils/getMakersShares.d.ts +0 -8
  175. package/lib/utils/getMakersShares.js +0 -145
  176. package/lib/utils/getNewOracleTx.d.ts +0 -1
  177. package/lib/utils/getNewOracleTx.js +0 -59
  178. package/lib/utils/getNewTimeOracleTx.d.ts +0 -1
  179. package/lib/utils/getNewTimeOracleTx.js +0 -56
  180. package/lib/utils/getUpdateOracleTx.d.ts +0 -1
  181. package/lib/utils/getUpdateOracleTx.js +0 -64
  182. package/lib/utils/getUpdateTimeOracleTx.d.ts +0 -1
  183. package/lib/utils/getUpdateTimeOracleTx.js +0 -60
  184. package/lib/utils/getUsersShares.d.ts +0 -9
  185. package/lib/utils/getUsersShares.js +0 -148
  186. package/lib/utils/getVaultIndexInRegistry.d.ts +0 -1
  187. package/lib/utils/getVaultIndexInRegistry.js +0 -61
  188. package/lib/utils/isObjAvailable.d.ts +0 -0
  189. package/lib/utils/isObjAvailable.js +0 -14
  190. package/lib/utils/loadUsersDepositData.d.ts +0 -8
  191. package/lib/utils/loadUsersDepositData.js +0 -160
  192. package/lib/utils/portfolio/authorized/getAuthorizedEvolutionTx.d.ts +0 -1
  193. package/lib/utils/portfolio/authorized/getAuthorizedLastEvolutionTx.d.ts +0 -1
  194. package/lib/utils/portfolio/authorized/getAuthorizedUpdateNextVaultConfigTx.d.ts +0 -4
  195. package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.d.ts +0 -1
  196. package/lib/utils/portfolio/authorized/getAuthorizedUpdateVaultConfigTx.js +0 -64
  197. package/lib/utils/portfolio/manager/getLastEvolutionTx.d.ts +0 -1
  198. package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.d.ts +0 -4
  199. package/lib/utils/portfolio/manager/getUpdateNextVaultConfigTx.js +0 -71
  200. package/lib/utils/portfolio/manager/getUpdateVaultConfigTx.d.ts +0 -1
  201. package/lib/utils/portfolio/user/getCompoundPremiumTx.d.ts +0 -1
  202. package/lib/utils/portfolio/user/getCompoundPremiumTx.js +0 -60
  203. /package/lib/test/{getMakersShares.d.ts → authorized/testAuthorizedNewPortfolioVault.d.ts} +0 -0
  204. /package/lib/test/{getUsersShares.d.ts → authorized/testAuthorizedUpdateUpcomingVaultConfig.d.ts} +0 -0
  205. /package/lib/test/{testClaim.d.ts → authorized/testAuthorizedUpdateWarmupVaultConfig.d.ts} +0 -0
  206. /package/lib/test/{testDeposit.d.ts → helper/getAuctionMaxSize.d.ts} +0 -0
  207. /package/lib/test/{testNewAuction.d.ts → helper/getUserStatus.d.ts} +0 -0
  208. /package/lib/test/{testNewVault.d.ts → user/testClaim.d.ts} +0 -0
  209. /package/lib/test/{testOracle.d.ts → user/testCompound.d.ts} +0 -0
  210. /package/lib/test/{testSettle.d.ts → user/testDeposit.d.ts} +0 -0
  211. /package/lib/test/{testUnsubscribe.d.ts → user/testHarvest.d.ts} +0 -0
  212. /package/lib/test/{testWithdraw.d.ts → user/testNewBid.d.ts} +0 -0
@@ -36,21 +36,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getAuthorizedLastEvolutionTx = void 0;
40
- function getAuthorizedLastEvolutionTx(gasBudget, packageId, registry, typeArguments, index, priceOracle, timeOracle) {
39
+ exports.getCompoundTx = void 0;
40
+ /**
41
+ public entry fun compound<TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ ctx: &mut TxContext,
45
+ )
46
+ * @param typeArguments [TOKEN, O_TOKEN]
47
+ */
48
+ function getCompoundTx(gasBudget, packageId, registry, typeArguments, index) {
41
49
  return __awaiter(this, void 0, void 0, function () {
42
50
  var tx;
43
51
  return __generator(this, function (_a) {
44
52
  tx = {
45
53
  packageObjectId: packageId,
46
54
  module: 'portfolio',
47
- function: 'authorized_last_evolution',
55
+ function: 'compound',
48
56
  typeArguments: typeArguments,
49
57
  arguments: [
50
58
  registry,
51
59
  index,
52
- priceOracle,
53
- timeOracle,
54
60
  ],
55
61
  gasBudget: gasBudget,
56
62
  };
@@ -58,4 +64,4 @@ function getAuthorizedLastEvolutionTx(gasBudget, packageId, registry, typeArgume
58
64
  });
59
65
  });
60
66
  }
61
- exports.getAuthorizedLastEvolutionTx = getAuthorizedLastEvolutionTx;
67
+ exports.getCompoundTx = getCompoundTx;
@@ -1 +1,11 @@
1
+ /**
2
+ public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
3
+ registry: &mut Registry,
4
+ index: u64,
5
+ coins: vector<Coin<D_TOKEN>>,
6
+ amount: u64,
7
+ ctx: &mut TxContext
8
+ )
9
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
10
+ */
1
11
  export declare function getDepositTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], vaultIndex: string, coins: string[], amount: string): Promise<any>;
@@ -37,6 +37,16 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getDepositTx = void 0;
40
+ /**
41
+ public(friend) entry fun deposit<D_TOKEN, B_TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ coins: vector<Coin<D_TOKEN>>,
45
+ amount: u64,
46
+ ctx: &mut TxContext
47
+ )
48
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
49
+ */
40
50
  function getDepositTx(gasBudget, packageId, registry, typeArguments, vaultIndex, coins, amount) {
41
51
  return __awaiter(this, void 0, void 0, function () {
42
52
  var tx;
@@ -1 +1,9 @@
1
- export declare function getHarvestTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string[]): Promise<any>;
1
+ /**
2
+ public(friend) entry fun harvest<D_TOKEN, B_TOKEN, O_TOKEN>(
3
+ registry: &mut Registry,
4
+ index: u64,
5
+ ctx: &mut TxContext
6
+ )
7
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
8
+ */
9
+ export declare function getHarvestTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string): Promise<any>;
@@ -37,6 +37,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getHarvestTx = void 0;
40
+ /**
41
+ public(friend) entry fun harvest<D_TOKEN, B_TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ ctx: &mut TxContext
45
+ )
46
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
47
+ */
40
48
  function getHarvestTx(gasBudget, packageId, registry, typeArguments, index) {
41
49
  return __awaiter(this, void 0, void 0, function () {
42
50
  var tx;
@@ -1 +1,13 @@
1
- export declare function getNewBidTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string[], priceOracle: string, timeOracle: string, coins: string[], size: string): Promise<any>;
1
+ /**
2
+ public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
3
+ registry: &mut Registry,
4
+ index: u64,
5
+ price_oracle: &Oracle<O_TOKEN>,
6
+ time: &Time,
7
+ coins: vector<Coin<B_TOKEN>>,
8
+ size: u64,
9
+ ctx: &mut TxContext,
10
+ )
11
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
12
+ */
13
+ export declare function getNewBidTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string, priceOracle: string, timeOracle: string, coins: string[], size: string): Promise<any>;
@@ -37,6 +37,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getNewBidTx = void 0;
40
+ /**
41
+ public(friend) entry fun new_bid<D_TOKEN, B_TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ price_oracle: &Oracle<O_TOKEN>,
45
+ time: &Time,
46
+ coins: vector<Coin<B_TOKEN>>,
47
+ size: u64,
48
+ ctx: &mut TxContext,
49
+ )
50
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
51
+ */
40
52
  function getNewBidTx(gasBudget, packageId, registry, typeArguments, index, priceOracle, timeOracle, coins, size) {
41
53
  return __awaiter(this, void 0, void 0, function () {
42
54
  var tx;
@@ -1 +1,10 @@
1
- export declare function getUnsubscribeTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string, share: string): Promise<any>;
1
+ /**
2
+ public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN, O_TOKEN>(
3
+ registry: &mut Registry,
4
+ index: u64,
5
+ share: Option<u64>,
6
+ ctx: &mut TxContext
7
+ )
8
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
9
+ */
10
+ export declare function getUnsubscribeTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], index: string, share: string[]): Promise<any>;
@@ -37,6 +37,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getUnsubscribeTx = void 0;
40
+ /**
41
+ public(friend) entry fun unsubscribe<D_TOKEN, B_TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ share: Option<u64>,
45
+ ctx: &mut TxContext
46
+ )
47
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
48
+ */
40
49
  function getUnsubscribeTx(gasBudget, packageId, registry, typeArguments, index, share) {
41
50
  return __awaiter(this, void 0, void 0, function () {
42
51
  var tx;
@@ -1 +1,10 @@
1
- export declare function getWithdrawTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], vaultIndex: string, share: string): Promise<any>;
1
+ /**
2
+ public(friend) entry fun withdraw<D_TOKEN, B_TOKEN, O_TOKEN>(
3
+ registry: &mut Registry,
4
+ index: u64,
5
+ share: Option<u64>,
6
+ ctx: &mut TxContext
7
+ )
8
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
9
+ */
10
+ export declare function getWithdrawTx(gasBudget: number, packageId: string, registry: string, typeArguments: string[], vaultIndex: string, share: string[]): Promise<any>;
@@ -37,6 +37,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.getWithdrawTx = void 0;
40
+ /**
41
+ public(friend) entry fun withdraw<D_TOKEN, B_TOKEN, O_TOKEN>(
42
+ registry: &mut Registry,
43
+ index: u64,
44
+ share: Option<u64>,
45
+ ctx: &mut TxContext
46
+ )
47
+ * @param typeArguments [D_TOKEN, B_TOKEN, O_TOKEN]
48
+ */
40
49
  function getWithdrawTx(gasBudget, packageId, registry, typeArguments, vaultIndex, share) {
41
50
  return __awaiter(this, void 0, void 0, function () {
42
51
  var tx;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typus/typus-sdk",
3
3
  "author": "Typus",
4
4
  "description": "typus sdk",
5
- "version": "0.6.3",
5
+ "version": "1.0.0",
6
6
  "dependencies": {
7
7
  "@mysten/sui.js": "^0.27.0",
8
8
  "@types/node": "^17.0.0",
@@ -1,5 +0,0 @@
1
- import { JsonRpcProvider } from '@mysten/sui.js';
2
- export declare function getBidEventsCranker(type: string, renewSec: number, provider: JsonRpcProvider): Promise<void>;
3
- export declare function getNewAuctionEventsCranker(type: string, renewSec: number, provider: JsonRpcProvider): Promise<void>;
4
- export declare function getEndAuctionEventsCranker(type: string, renewSec: number, provider: JsonRpcProvider): Promise<void>;
5
- export declare function sendEventToTelegramChannel(text: any): Promise<void>;
@@ -1,397 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __values = (this && this.__values) || function(o) {
39
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
40
- if (m) return m.call(o);
41
- if (o && typeof o.length === "number") return {
42
- next: function () {
43
- if (o && i >= o.length) o = void 0;
44
- return { value: o && o[i++], done: !o };
45
- }
46
- };
47
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.sendEventToTelegramChannel = exports.getEndAuctionEventsCranker = exports.getNewAuctionEventsCranker = exports.getBidEventsCranker = void 0;
54
- var constants_1 = require("../constants");
55
- var sui_js_1 = require("@mysten/sui.js");
56
- var getVaultData_1 = require("../utils/getVaultData");
57
- var node_cron_1 = __importDefault(require("node-cron"));
58
- var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
59
- var moment_1 = __importDefault(require("moment"));
60
- var decimal_js_1 = __importDefault(require("decimal.js"));
61
- var provider = new sui_js_1.JsonRpcProvider(sui_js_1.Network.DEVNET); //for read only operations
62
- var apiToken = process.env.API_TOKEN;
63
- var chatId = process.env.CHAT_ID;
64
- /*
65
- 「https://api.telegram.org/botTOKEN/getUpdates」,change TOKEN to token from botFather
66
- */
67
- (function () { return __awaiter(void 0, void 0, void 0, function () {
68
- var bidTypes, newAuctionType, endAuctionType, renewSec;
69
- return __generator(this, function (_a) {
70
- switch (_a.label) {
71
- case 0:
72
- bidTypes = [
73
- constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>",
74
- constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::btc::BTC>",
75
- constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::sui::SUI>",
76
- constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::doge::DOGE>",
77
- constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewBid<" + constants_1.TOKEN_PACKAGE + "::apt::APT>",
78
- ];
79
- newAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::NewAuction";
80
- endAuctionType = constants_1.COVERED_CALL_PACKAGE + "::covered_call::Delivery<" + constants_1.TOKEN_PACKAGE + "::eth::ETH>";
81
- renewSec = 5;
82
- // let vault = await getVaultDataFromRegistry(COVERED_CALL_REGISTRY, provider);
83
- bidTypes.map(function (bidType) { return __awaiter(void 0, void 0, void 0, function () {
84
- return __generator(this, function (_a) {
85
- switch (_a.label) {
86
- case 0: return [4 /*yield*/, getBidEventsCranker(bidType, renewSec, provider)]; //new_bid
87
- case 1:
88
- _a.sent(); //new_bid
89
- return [2 /*return*/];
90
- }
91
- });
92
- }); });
93
- return [4 /*yield*/, getNewAuctionEventsCranker(newAuctionType, renewSec, provider)]; //evolution
94
- case 1:
95
- _a.sent(); //evolution
96
- return [4 /*yield*/, getEndAuctionEventsCranker(endAuctionType, renewSec, provider)];
97
- case 2:
98
- _a.sent();
99
- return [2 /*return*/];
100
- }
101
- });
102
- }); })();
103
- function twoObjArrAreSame(x, y) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- return __generator(this, function (_a) {
106
- if (JSON.stringify(x) === JSON.stringify(y)) {
107
- return [2 /*return*/, true];
108
- }
109
- else {
110
- return [2 /*return*/, false];
111
- }
112
- return [2 /*return*/];
113
- });
114
- });
115
- }
116
- function generateBidId(vault) {
117
- return __awaiter(this, void 0, void 0, function () {
118
- var liveVault, res;
119
- return __generator(this, function (_a) {
120
- liveVault = vault === null || vault === void 0 ? void 0 : vault.filter(function (v) {
121
- var start = moment_1.default.unix(Number(v.config.activationTsMs) / 1000);
122
- var settled = v.vault.ableToDeposit === false && v.vault.ableToWithdraw === true;
123
- return start.isBefore((0, moment_1.default)()) && !settled;
124
- });
125
- res = liveVault.map(function (v) {
126
- var time = v.config.expirationTsMs;
127
- var expiration = moment_1.default
128
- .unix(Number(time) / 1000)
129
- .format("DDMMMYY");
130
- var bidId = "".concat(v.asset, "-").concat(expiration, "-").concat(v.config.payoffConfig.strike, "-C");
131
- var period = (v.config.period);
132
- var vaultIdx = v.vaultIdx;
133
- var obj = {
134
- bidFormat: bidId,
135
- bidTime: Number(time),
136
- period: period,
137
- vaultIdx: vaultIdx,
138
- asset: v.asset,
139
- expiration: expiration,
140
- strike: v.config.payoffConfig.strike
141
- };
142
- return obj;
143
- });
144
- return [2 /*return*/, res];
145
- });
146
- });
147
- }
148
- function getBidEventsCranker(type, renewSec, provider) {
149
- return __awaiter(this, void 0, void 0, function () {
150
- var res, isFirstTime;
151
- var _this = this;
152
- return __generator(this, function (_a) {
153
- res = [];
154
- isFirstTime = true;
155
- node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
156
- var events, newRes, newBidHappened, newBid, format_1, vault, bidIds_1, telegramText;
157
- var _this = this;
158
- return __generator(this, function (_a) {
159
- switch (_a.label) {
160
- case 0: return [4 /*yield*/, provider.getEvents({ MoveEvent: type }, null, null)];
161
- case 1:
162
- events = _a.sent();
163
- newRes = events.data;
164
- newBidHappened = newRes.length != res.length;
165
- if (!newBidHappened) return [3 /*break*/, 4];
166
- newBid = newRes.filter(function (_a) {
167
- var id1 = _a.timestamp;
168
- return !res.some(function (_a) {
169
- var id2 = _a.timestamp;
170
- return id2 === id1;
171
- });
172
- });
173
- format_1 = "";
174
- return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.COVERED_CALL_REGISTRY, provider)];
175
- case 2:
176
- vault = _a.sent();
177
- return [4 /*yield*/, generateBidId(vault)];
178
- case 3:
179
- bidIds_1 = _a.sent();
180
- newBid.map(function (e) { return __awaiter(_this, void 0, void 0, function () {
181
- var newBidVaultIdx, bidId, size, period;
182
- return __generator(this, function (_a) {
183
- newBidVaultIdx = e.event.moveEvent.fields.index;
184
- bidId = bidIds_1.find(function (bidId) { return bidId.vaultIdx == newBidVaultIdx; });
185
- if (bidId) {
186
- size = (Number(e.event.moveEvent.fields.size) / (Math.pow(10, constants_1.TOKEN_DECIMAL))).toString();
187
- period = (bidId.period == "0") ? "Daily " : (bidId.period == "1") ? "Weekly " : (bidId.period == "2") ? "Monthly " : "- ";
188
- format_1 += period + bidId.bidFormat + " is bid with " + size + " " + bidId.bidFormat.split("-")[0] + "! \n";
189
- }
190
- return [2 /*return*/];
191
- });
192
- }); });
193
- telegramText = format_1;
194
- console.log(telegramText);
195
- if (!isFirstTime) {
196
- sendEventToTelegramChannel(telegramText);
197
- }
198
- res = newRes;
199
- _a.label = 4;
200
- case 4:
201
- isFirstTime = false;
202
- return [2 /*return*/];
203
- }
204
- });
205
- }); });
206
- return [2 /*return*/];
207
- });
208
- });
209
- }
210
- exports.getBidEventsCranker = getBidEventsCranker;
211
- function getNewAuctionEventsCranker(type, renewSec, provider) {
212
- return __awaiter(this, void 0, void 0, function () {
213
- var res, bidIds, isFirstTime;
214
- var _this = this;
215
- return __generator(this, function (_a) {
216
- res = [];
217
- bidIds = [];
218
- isFirstTime = true;
219
- node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
220
- var events, newRes, format_2, vault, newBidIds, _loop_1, TOKEN_NAME_1, TOKEN_NAME_1_1, asset, telegramText;
221
- var e_1, _a;
222
- return __generator(this, function (_b) {
223
- switch (_b.label) {
224
- case 0: return [4 /*yield*/, provider.getEvents({ MoveEvent: type }, null, null)];
225
- case 1:
226
- events = _b.sent();
227
- newRes = events.data;
228
- return [4 /*yield*/, twoObjArrAreSame(newRes, res)];
229
- case 2:
230
- if (!!(_b.sent())) return [3 /*break*/, 5];
231
- format_2 = "Typus Auction is live! ";
232
- format_2 += '<a href="https://devnet.typus.finance/auction">Bid now </a>' + "! \n";
233
- return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.COVERED_CALL_REGISTRY, provider)];
234
- case 3:
235
- vault = _b.sent();
236
- return [4 /*yield*/, generateBidId(vault)];
237
- case 4:
238
- newBidIds = _b.sent();
239
- //compare newBidIds to bidIds
240
- newBidIds = newBidIds.filter(function (e) {
241
- return !bidIds.find(function (tmp) { return tmp.bidFormat == e.bidFormat; });
242
- });
243
- //filter auction not started
244
- newBidIds = newBidIds.filter(function (e) {
245
- return e.strike != "0";
246
- });
247
- _loop_1 = function (asset) {
248
- var targetBids = newBidIds.filter(function (bidId) {
249
- return bidId.bidFormat.toString().includes(asset);
250
- });
251
- if (targetBids.length) {
252
- format_2 += "* " + asset + " Options \n";
253
- targetBids.map(function (bidId) {
254
- var period = (bidId.period == "0") ? "Daily " : (bidId.period == "1") ? "Weekly " : (bidId.period == "2") ? "Monthly " : "- ";
255
- format_2 += "\t" + period + "Covered Call-" + bidId.bidFormat + " \n";
256
- format_2 += " \n";
257
- });
258
- }
259
- };
260
- try {
261
- for (TOKEN_NAME_1 = __values(constants_1.TOKEN_NAME), TOKEN_NAME_1_1 = TOKEN_NAME_1.next(); !TOKEN_NAME_1_1.done; TOKEN_NAME_1_1 = TOKEN_NAME_1.next()) {
262
- asset = TOKEN_NAME_1_1.value;
263
- _loop_1(asset);
264
- }
265
- }
266
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
267
- finally {
268
- try {
269
- if (TOKEN_NAME_1_1 && !TOKEN_NAME_1_1.done && (_a = TOKEN_NAME_1.return)) _a.call(TOKEN_NAME_1);
270
- }
271
- finally { if (e_1) throw e_1.error; }
272
- }
273
- telegramText = format_2;
274
- console.log(telegramText);
275
- if (!isFirstTime) {
276
- sendEventToTelegramChannel(telegramText);
277
- }
278
- res = newRes;
279
- bidIds = newBidIds;
280
- _b.label = 5;
281
- case 5:
282
- isFirstTime = false;
283
- return [2 /*return*/];
284
- }
285
- });
286
- }); });
287
- return [2 /*return*/];
288
- });
289
- });
290
- }
291
- exports.getNewAuctionEventsCranker = getNewAuctionEventsCranker;
292
- function getEndAuctionEventsCranker(type, renewSec, provider) {
293
- return __awaiter(this, void 0, void 0, function () {
294
- var res, bidIds, isFirstTime;
295
- var _this = this;
296
- return __generator(this, function (_a) {
297
- res = [];
298
- bidIds = [];
299
- isFirstTime = true;
300
- node_cron_1.default.schedule('*/' + renewSec.toString() + ' * * * * *', function () { return __awaiter(_this, void 0, void 0, function () {
301
- var events, newRes, format_3, vault_1, newBidIds, _loop_2, TOKEN_NAME_2, TOKEN_NAME_2_1, asset, telegramText;
302
- var e_2, _a;
303
- var _this = this;
304
- return __generator(this, function (_b) {
305
- switch (_b.label) {
306
- case 0: return [4 /*yield*/, provider.getEvents({ MoveEvent: type }, null, null)];
307
- case 1:
308
- events = _b.sent();
309
- newRes = events.data;
310
- return [4 /*yield*/, twoObjArrAreSame(newRes, res)];
311
- case 2:
312
- if (!!(_b.sent())) return [3 /*break*/, 5];
313
- format_3 = "";
314
- return [4 /*yield*/, (0, getVaultData_1.getVaultDataFromRegistry)(constants_1.COVERED_CALL_REGISTRY, provider)];
315
- case 3:
316
- vault_1 = _b.sent();
317
- return [4 /*yield*/, generateBidId(vault_1)];
318
- case 4:
319
- newBidIds = _b.sent();
320
- // console.log("new bid ids before filter:")
321
- console.log(newBidIds);
322
- //compare newBidIds to bidIds
323
- newBidIds = newBidIds.filter(function (e) {
324
- return !bidIds.find(function (tmp) { return tmp.bidFormat == e.bidFormat; });
325
- });
326
- // console.log("new bid ids after filter:")
327
- console.log(newBidIds);
328
- _loop_2 = function (asset) {
329
- var targetBids = newBidIds.filter(function (bidId) {
330
- return bidId.bidFormat.toString().includes(asset);
331
- });
332
- if (targetBids.length) {
333
- targetBids.map(function (bidId) { return __awaiter(_this, void 0, void 0, function () {
334
- var vaultIdx, targetVault, totalAuctioned, clearingPrice, period;
335
- return __generator(this, function (_a) {
336
- vaultIdx = bidId.vaultIdx;
337
- targetVault = vault_1.find(function (e) { return e.vaultIdx == vaultIdx; });
338
- totalAuctioned = "-";
339
- clearingPrice = "-";
340
- if (JSON.stringify(targetVault === null || targetVault === void 0 ? void 0 : targetVault.deliveryInfo) != '{}') {
341
- totalAuctioned = (new decimal_js_1.default(targetVault === null || targetVault === void 0 ? void 0 : targetVault.deliveryInfo.deliverySize).div(new decimal_js_1.default(Math.pow(10, constants_1.TOKEN_DECIMAL)))).toFixed(2);
342
- clearingPrice = (new decimal_js_1.default(targetVault === null || targetVault === void 0 ? void 0 : targetVault.deliveryInfo.deliveryPrice).div(new decimal_js_1.default(Math.pow(10, 5)))).toFixed(4);
343
- period = (bidId.period == "0") ? "Daily " : (bidId.period == "1") ? "Weekly " : (bidId.period == "2") ? "Monthly " : "- ";
344
- format_3 += "* " + period + "Covered Call-" + bidId.bidFormat + " auction is closed! Total auctioned " + totalAuctioned +
345
- " " + asset + " at a clearing price of " + clearingPrice + " " + asset + " \n";
346
- format_3 += " \n";
347
- }
348
- return [2 /*return*/];
349
- });
350
- }); });
351
- }
352
- };
353
- try {
354
- for (TOKEN_NAME_2 = __values(constants_1.TOKEN_NAME), TOKEN_NAME_2_1 = TOKEN_NAME_2.next(); !TOKEN_NAME_2_1.done; TOKEN_NAME_2_1 = TOKEN_NAME_2.next()) {
355
- asset = TOKEN_NAME_2_1.value;
356
- _loop_2(asset);
357
- }
358
- }
359
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
360
- finally {
361
- try {
362
- if (TOKEN_NAME_2_1 && !TOKEN_NAME_2_1.done && (_a = TOKEN_NAME_2.return)) _a.call(TOKEN_NAME_2);
363
- }
364
- finally { if (e_2) throw e_2.error; }
365
- }
366
- telegramText = format_3;
367
- console.log(telegramText);
368
- if (!isFirstTime) {
369
- sendEventToTelegramChannel(telegramText);
370
- }
371
- res = newRes;
372
- bidIds = newBidIds;
373
- _b.label = 5;
374
- case 5:
375
- isFirstTime = false;
376
- return [2 /*return*/];
377
- }
378
- });
379
- }); });
380
- return [2 /*return*/];
381
- });
382
- });
383
- }
384
- exports.getEndAuctionEventsCranker = getEndAuctionEventsCranker;
385
- function sendEventToTelegramChannel(text) {
386
- return __awaiter(this, void 0, void 0, function () {
387
- var urlString, request;
388
- return __generator(this, function (_a) {
389
- urlString = "https://api.telegram.org/bot".concat(apiToken, "/sendMessage?chat_id=").concat(chatId, "&text=").concat(text, "&parse_mode=HTML");
390
- request = new XMLHttpRequest();
391
- request.open("GET", urlString);
392
- request.send();
393
- return [2 /*return*/];
394
- });
395
- });
396
- }
397
- exports.sendEventToTelegramChannel = sendEventToTelegramChannel;
File without changes