@cheqd/sdk 5.3.7 → 5.4.0-develop.2

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 (200) hide show
  1. package/build/cjs/index.d.ts +4 -2
  2. package/build/cjs/index.d.ts.map +1 -1
  3. package/build/cjs/index.js +36 -2
  4. package/build/cjs/index.js.map +1 -1
  5. package/build/cjs/modules/did.d.ts +109 -7
  6. package/build/cjs/modules/did.d.ts.map +1 -1
  7. package/build/cjs/modules/did.js +225 -28
  8. package/build/cjs/modules/did.js.map +1 -1
  9. package/build/cjs/modules/oracle.d.ts +563 -0
  10. package/build/cjs/modules/oracle.d.ts.map +1 -0
  11. package/build/cjs/modules/oracle.js +798 -0
  12. package/build/cjs/modules/oracle.js.map +1 -0
  13. package/build/cjs/modules/resource.d.ts +132 -7
  14. package/build/cjs/modules/resource.d.ts.map +1 -1
  15. package/build/cjs/modules/resource.js +283 -40
  16. package/build/cjs/modules/resource.js.map +1 -1
  17. package/build/cjs/package.json +1 -1
  18. package/build/cjs/types.d.ts +27 -1
  19. package/build/cjs/types.d.ts.map +1 -1
  20. package/build/cjs/types.js.map +1 -1
  21. package/build/esm/cjs/src/index.d.ts +142 -0
  22. package/build/esm/cjs/src/index.d.ts.map +1 -0
  23. package/build/esm/cjs/src/index.js +184 -0
  24. package/build/esm/cjs/src/index.js.map +1 -0
  25. package/build/esm/cjs/src/modules/_.d.ts +81 -0
  26. package/build/esm/cjs/src/modules/_.d.ts.map +1 -0
  27. package/build/esm/cjs/src/modules/_.js +93 -0
  28. package/build/esm/cjs/src/modules/_.js.map +1 -0
  29. package/build/esm/cjs/src/modules/did.d.ts +488 -0
  30. package/build/esm/cjs/src/modules/did.d.ts.map +1 -0
  31. package/build/esm/cjs/src/modules/did.js +1255 -0
  32. package/build/esm/cjs/src/modules/did.js.map +1 -0
  33. package/build/esm/cjs/src/modules/feeabstraction.d.ts +429 -0
  34. package/build/esm/cjs/src/modules/feeabstraction.d.ts.map +1 -0
  35. package/build/esm/cjs/src/modules/feeabstraction.js +474 -0
  36. package/build/esm/cjs/src/modules/feeabstraction.js.map +1 -0
  37. package/build/esm/cjs/src/modules/feemarket.d.ts +244 -0
  38. package/build/esm/cjs/src/modules/feemarket.d.ts.map +1 -0
  39. package/build/esm/cjs/src/modules/feemarket.js +297 -0
  40. package/build/esm/cjs/src/modules/feemarket.js.map +1 -0
  41. package/build/esm/cjs/src/modules/oracle.d.ts +563 -0
  42. package/build/esm/cjs/src/modules/oracle.d.ts.map +1 -0
  43. package/build/esm/cjs/src/modules/oracle.js +784 -0
  44. package/build/esm/cjs/src/modules/oracle.js.map +1 -0
  45. package/build/esm/cjs/src/modules/resource.d.ts +330 -0
  46. package/build/esm/cjs/src/modules/resource.d.ts.map +1 -0
  47. package/build/esm/cjs/src/modules/resource.js +556 -0
  48. package/build/esm/cjs/src/modules/resource.js.map +1 -0
  49. package/build/esm/cjs/src/querier.d.ts +62 -0
  50. package/build/esm/cjs/src/querier.d.ts.map +1 -0
  51. package/build/esm/cjs/src/querier.js +87 -0
  52. package/build/esm/cjs/src/querier.js.map +1 -0
  53. package/build/esm/cjs/src/registry.d.ts +18 -0
  54. package/build/esm/cjs/src/registry.d.ts.map +1 -0
  55. package/build/esm/cjs/src/registry.js +23 -0
  56. package/build/esm/cjs/src/registry.js.map +1 -0
  57. package/build/esm/cjs/src/signer.d.ts +250 -0
  58. package/build/esm/cjs/src/signer.d.ts.map +1 -0
  59. package/build/esm/cjs/src/signer.js +617 -0
  60. package/build/esm/cjs/src/signer.js.map +1 -0
  61. package/build/esm/cjs/src/types.d.ts +221 -0
  62. package/build/esm/cjs/src/types.d.ts.map +1 -0
  63. package/build/esm/cjs/src/types.js.map +1 -0
  64. package/build/esm/cjs/src/utils.d.ts +233 -0
  65. package/build/esm/cjs/src/utils.d.ts.map +1 -0
  66. package/build/esm/cjs/src/utils.js +571 -0
  67. package/build/esm/cjs/src/utils.js.map +1 -0
  68. package/build/esm/{index.d.ts → esm/src/index.d.ts} +7 -3
  69. package/build/esm/esm/src/index.d.ts.map +1 -0
  70. package/build/esm/{index.js → esm/src/index.js} +3 -1
  71. package/build/esm/esm/src/index.js.map +1 -0
  72. package/build/esm/esm/src/modules/_.d.ts.map +1 -0
  73. package/build/esm/esm/src/modules/_.js.map +1 -0
  74. package/build/esm/{modules → esm/src/modules}/did.d.ts +109 -7
  75. package/build/esm/esm/src/modules/did.d.ts.map +1 -0
  76. package/build/esm/{modules → esm/src/modules}/did.js +220 -8
  77. package/build/esm/esm/src/modules/did.js.map +1 -0
  78. package/build/esm/esm/src/modules/feeabstraction.d.ts.map +1 -0
  79. package/build/esm/esm/src/modules/feeabstraction.js.map +1 -0
  80. package/build/esm/esm/src/modules/feemarket.d.ts.map +1 -0
  81. package/build/esm/esm/src/modules/feemarket.js.map +1 -0
  82. package/build/esm/esm/src/modules/oracle.d.ts +563 -0
  83. package/build/esm/esm/src/modules/oracle.d.ts.map +1 -0
  84. package/build/esm/esm/src/modules/oracle.js +784 -0
  85. package/build/esm/esm/src/modules/oracle.js.map +1 -0
  86. package/build/esm/{modules → esm/src/modules}/resource.d.ts +132 -6
  87. package/build/esm/esm/src/modules/resource.d.ts.map +1 -0
  88. package/build/esm/esm/src/modules/resource.js +556 -0
  89. package/build/esm/esm/src/modules/resource.js.map +1 -0
  90. package/build/esm/esm/src/querier.d.ts.map +1 -0
  91. package/build/esm/esm/src/querier.js.map +1 -0
  92. package/build/esm/esm/src/registry.d.ts.map +1 -0
  93. package/build/esm/esm/src/registry.js.map +1 -0
  94. package/build/esm/esm/src/signer.d.ts.map +1 -0
  95. package/build/esm/esm/src/signer.js.map +1 -0
  96. package/build/{types → esm/esm/src}/types.d.ts +27 -1
  97. package/build/esm/esm/src/types.d.ts.map +1 -0
  98. package/build/esm/esm/src/types.js +43 -0
  99. package/build/esm/esm/src/types.js.map +1 -0
  100. package/build/esm/esm/src/utils.d.ts.map +1 -0
  101. package/build/esm/esm/src/utils.js.map +1 -0
  102. package/build/esm/package.json +2 -2
  103. package/build/types/cjs/src/index.d.ts +142 -0
  104. package/build/types/cjs/src/index.d.ts.map +1 -0
  105. package/build/types/cjs/src/modules/_.d.ts +81 -0
  106. package/build/types/cjs/src/modules/_.d.ts.map +1 -0
  107. package/build/types/cjs/src/modules/did.d.ts +488 -0
  108. package/build/types/cjs/src/modules/did.d.ts.map +1 -0
  109. package/build/types/cjs/src/modules/feeabstraction.d.ts +429 -0
  110. package/build/types/cjs/src/modules/feeabstraction.d.ts.map +1 -0
  111. package/build/types/cjs/src/modules/feemarket.d.ts +244 -0
  112. package/build/types/cjs/src/modules/feemarket.d.ts.map +1 -0
  113. package/build/types/cjs/src/modules/oracle.d.ts +563 -0
  114. package/build/types/cjs/src/modules/oracle.d.ts.map +1 -0
  115. package/build/types/cjs/src/modules/resource.d.ts +330 -0
  116. package/build/types/cjs/src/modules/resource.d.ts.map +1 -0
  117. package/build/types/cjs/src/querier.d.ts +62 -0
  118. package/build/types/cjs/src/querier.d.ts.map +1 -0
  119. package/build/types/cjs/src/registry.d.ts +18 -0
  120. package/build/types/cjs/src/registry.d.ts.map +1 -0
  121. package/build/types/cjs/src/signer.d.ts +250 -0
  122. package/build/types/cjs/src/signer.d.ts.map +1 -0
  123. package/build/types/cjs/src/types.d.ts +221 -0
  124. package/build/types/cjs/src/types.d.ts.map +1 -0
  125. package/build/types/cjs/src/utils.d.ts +233 -0
  126. package/build/types/cjs/src/utils.d.ts.map +1 -0
  127. package/build/types/{index.d.ts → esm/src/index.d.ts} +7 -3
  128. package/build/types/esm/src/index.d.ts.map +1 -0
  129. package/build/types/esm/src/modules/_.d.ts.map +1 -0
  130. package/build/types/{modules → esm/src/modules}/did.d.ts +109 -7
  131. package/build/types/esm/src/modules/did.d.ts.map +1 -0
  132. package/build/types/esm/src/modules/feeabstraction.d.ts.map +1 -0
  133. package/build/types/esm/src/modules/feemarket.d.ts.map +1 -0
  134. package/build/types/esm/src/modules/oracle.d.ts +563 -0
  135. package/build/types/esm/src/modules/oracle.d.ts.map +1 -0
  136. package/build/types/{modules → esm/src/modules}/resource.d.ts +132 -6
  137. package/build/types/esm/src/modules/resource.d.ts.map +1 -0
  138. package/build/types/esm/src/querier.d.ts.map +1 -0
  139. package/build/types/esm/src/registry.d.ts.map +1 -0
  140. package/build/types/esm/src/signer.d.ts.map +1 -0
  141. package/build/{esm → types/esm/src}/types.d.ts +27 -1
  142. package/build/types/esm/src/types.d.ts.map +1 -0
  143. package/build/types/esm/src/utils.d.ts.map +1 -0
  144. package/package.json +3 -3
  145. package/build/esm/index.d.ts.map +0 -1
  146. package/build/esm/index.js.map +0 -1
  147. package/build/esm/modules/_.d.ts.map +0 -1
  148. package/build/esm/modules/_.js.map +0 -1
  149. package/build/esm/modules/did.d.ts.map +0 -1
  150. package/build/esm/modules/did.js.map +0 -1
  151. package/build/esm/modules/feeabstraction.d.ts.map +0 -1
  152. package/build/esm/modules/feeabstraction.js.map +0 -1
  153. package/build/esm/modules/feemarket.d.ts.map +0 -1
  154. package/build/esm/modules/feemarket.js.map +0 -1
  155. package/build/esm/modules/resource.d.ts.map +0 -1
  156. package/build/esm/modules/resource.js +0 -297
  157. package/build/esm/modules/resource.js.map +0 -1
  158. package/build/esm/querier.d.ts.map +0 -1
  159. package/build/esm/querier.js.map +0 -1
  160. package/build/esm/registry.d.ts.map +0 -1
  161. package/build/esm/registry.js.map +0 -1
  162. package/build/esm/signer.d.ts.map +0 -1
  163. package/build/esm/signer.js.map +0 -1
  164. package/build/esm/types.d.ts.map +0 -1
  165. package/build/esm/types.js.map +0 -1
  166. package/build/esm/utils.d.ts.map +0 -1
  167. package/build/esm/utils.js.map +0 -1
  168. package/build/types/index.d.ts.map +0 -1
  169. package/build/types/modules/_.d.ts.map +0 -1
  170. package/build/types/modules/did.d.ts.map +0 -1
  171. package/build/types/modules/feeabstraction.d.ts.map +0 -1
  172. package/build/types/modules/feemarket.d.ts.map +0 -1
  173. package/build/types/modules/resource.d.ts.map +0 -1
  174. package/build/types/querier.d.ts.map +0 -1
  175. package/build/types/registry.d.ts.map +0 -1
  176. package/build/types/signer.d.ts.map +0 -1
  177. package/build/types/types.d.ts.map +0 -1
  178. package/build/types/utils.d.ts.map +0 -1
  179. /package/build/esm/{types.js → cjs/src/types.js} +0 -0
  180. /package/build/esm/{modules → esm/src/modules}/_.d.ts +0 -0
  181. /package/build/esm/{modules → esm/src/modules}/_.js +0 -0
  182. /package/build/esm/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
  183. /package/build/esm/{modules → esm/src/modules}/feeabstraction.js +0 -0
  184. /package/build/esm/{modules → esm/src/modules}/feemarket.d.ts +0 -0
  185. /package/build/esm/{modules → esm/src/modules}/feemarket.js +0 -0
  186. /package/build/esm/{querier.d.ts → esm/src/querier.d.ts} +0 -0
  187. /package/build/esm/{querier.js → esm/src/querier.js} +0 -0
  188. /package/build/esm/{registry.d.ts → esm/src/registry.d.ts} +0 -0
  189. /package/build/esm/{registry.js → esm/src/registry.js} +0 -0
  190. /package/build/esm/{signer.d.ts → esm/src/signer.d.ts} +0 -0
  191. /package/build/esm/{signer.js → esm/src/signer.js} +0 -0
  192. /package/build/esm/{utils.d.ts → esm/src/utils.d.ts} +0 -0
  193. /package/build/esm/{utils.js → esm/src/utils.js} +0 -0
  194. /package/build/types/{modules → esm/src/modules}/_.d.ts +0 -0
  195. /package/build/types/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
  196. /package/build/types/{modules → esm/src/modules}/feemarket.d.ts +0 -0
  197. /package/build/types/{querier.d.ts → esm/src/querier.d.ts} +0 -0
  198. /package/build/types/{registry.d.ts → esm/src/registry.d.ts} +0 -0
  199. /package/build/types/{signer.d.ts → esm/src/signer.d.ts} +0 -0
  200. /package/build/types/{utils.d.ts → esm/src/utils.d.ts} +0 -0
@@ -0,0 +1,798 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OracleModule = exports.setupOracleExtension = exports.MovingAverages = exports.WMAStrategies = exports.typeUrlMsgGovCancelUpdateParamPlanResponse = exports.typeUrlMsgGovCancelUpdateParamPlan = exports.typeUrlMsgGovRemoveCurrencyDeviationThresholdsResponse = exports.typeUrlMsgGovRemoveCurrencyDeviationThresholds = exports.typeUrlMsgGovRemoveCurrencyPairProvidersResponse = exports.typeUrlMsgGovRemoveCurrencyPairProviders = exports.typeUrlMsgGovAddDenomsResponse = exports.typeUrlMsgGovAddDenoms = exports.typeUrlMsgGovUpdateParamsResponse = exports.typeUrlMsgGovUpdateParams = exports.typeUrlMsgLegacyGovUpdateParamsResponse = exports.typeUrlMsgLegacyGovUpdateParams = exports.typeUrlMsgDelegateFeedConsentResponse = exports.typeUrlMsgDelegateFeedConsent = exports.typeUrlMsgAggregateExchangeRateVoteResponse = exports.typeUrlMsgAggregateExchangeRateVote = exports.typeUrlMsgAggregateExchangeRatePrevoteResponse = exports.typeUrlMsgAggregateExchangeRatePrevote = exports.protobufLiterals = exports.defaultOracleExtensionKey = void 0;
4
+ exports.isMsgAggregateExchangeRatePrevoteEncodeObject = isMsgAggregateExchangeRatePrevoteEncodeObject;
5
+ exports.isMsgAggregateExchangeRateVoteEncodeObject = isMsgAggregateExchangeRateVoteEncodeObject;
6
+ exports.isMsgDelegateFeedConsentEncodeObject = isMsgDelegateFeedConsentEncodeObject;
7
+ exports.isMsgLegacyGovUpdateParamsEncodeObject = isMsgLegacyGovUpdateParamsEncodeObject;
8
+ exports.isMsgGovUpdateParamsEncodeObject = isMsgGovUpdateParamsEncodeObject;
9
+ exports.isMsgGovAddDenomsEncodeObject = isMsgGovAddDenomsEncodeObject;
10
+ exports.isMsgGovRemoveCurrencyPairProvidersEncodeObject = isMsgGovRemoveCurrencyPairProvidersEncodeObject;
11
+ exports.isMsgGovRemoveCurrencyDeviationThresholdsEncodeObject = isMsgGovRemoveCurrencyDeviationThresholdsEncodeObject;
12
+ exports.isMsgGovCancelUpdateParamPlanEncodeObject = isMsgGovCancelUpdateParamPlanEncodeObject;
13
+ const v2_1 = require("@cheqd/ts-proto/cheqd/oracle/v2");
14
+ const math_1 = require("@cosmjs/math");
15
+ const _1 = require("./_");
16
+ const stargate_1 = require("@cosmjs/stargate");
17
+ const utils_1 = require("@cosmjs/utils");
18
+ const tx_1 = require("cosmjs-types/cosmos/gov/v1/tx");
19
+ /** Default extension key for Oracle-related query operations */
20
+ exports.defaultOracleExtensionKey = 'oracle';
21
+ /**
22
+ * Protobuf message type for Oracle operations.
23
+ * Used for consistent message type identification across the module.
24
+ */
25
+ exports.protobufLiterals = {
26
+ /** Request to fetch exchange rates for specific denoms. */
27
+ QueryExchangeRates: 'QueryExchangeRates',
28
+ /** Response containing the exchange rates payload. */
29
+ QueryExchangeRatesResponse: 'QueryExchangeRatesResponse',
30
+ /** Request to list all active exchange rate denoms. */
31
+ QueryActiveExchangeRates: 'QueryActiveExchangeRates',
32
+ /** Response providing the currently active exchange rate denoms. */
33
+ QueryActiveExchangeRatesResponse: 'QueryActiveExchangeRatesResponse',
34
+ /** Request to retrieve the feeder delegation for a validator. */
35
+ QueryFeederDelegation: 'QueryFeederDelegation',
36
+ /** Response with feeder delegation details. */
37
+ QueryFeederDelegationResponse: 'QueryFeederDelegationResponse',
38
+ /** Request to obtain a validator's miss counter. */
39
+ QueryMissCounter: 'QueryMissCounter',
40
+ /** Response returning the miss counter value. */
41
+ QueryMissCounterResponse: 'QueryMissCounterResponse',
42
+ /** Request to inspect the current slash window information. */
43
+ QuerySlashWindow: 'QuerySlashWindow',
44
+ /** Response detailing the slash window configuration. */
45
+ QuerySlashWindowResponse: 'QuerySlashWindowResponse',
46
+ /** Request for a validator's aggregate prevote. */
47
+ QueryAggregatePrevote: 'QueryAggregatePrevote',
48
+ /** Response containing the aggregate prevote. */
49
+ QueryAggregatePrevoteResponse: 'QueryAggregatePrevoteResponse',
50
+ /** Request for all aggregate prevotes on the network. */
51
+ QueryAggregatePrevotes: 'QueryAggregatePrevotes',
52
+ /** Response listing all aggregate prevotes. */
53
+ QueryAggregatePrevotesResponse: 'QueryAggregatePrevotesResponse',
54
+ /** Request for aggregate votes from a validator. */
55
+ QueryAggregateVotes: 'QueryAggregateVotes',
56
+ /** Response carrying aggregate votes. */
57
+ QueryAggregateVotesResponse: 'QueryAggregateVotesResponse',
58
+ /** Request to fetch the oracle module parameters. */
59
+ QueryParams: 'QueryParams',
60
+ /** Response returning the oracle module parameters. */
61
+ QueryParamsResponse: 'QueryParamsResponse',
62
+ /** Request for price medians across denoms. */
63
+ QueryMedians: 'QueryMedians',
64
+ /** Response containing price medians. */
65
+ QueryMediansResponse: 'QueryMediansResponse',
66
+ /** Request for median deviations to assess volatility. */
67
+ QueryMedianDeviations: 'QueryMedianDeviations',
68
+ /** Response returning median deviation values. */
69
+ QueryMedianDeviationsResponse: 'QueryMedianDeviationsResponse',
70
+ /** Request to fetch the validator reward set. */
71
+ QueryValidatorRewardSet: 'QueryValidatorRewardSet',
72
+ /** Response with validator reward set data. */
73
+ QueryValidatorRewardSetResponse: 'QueryValidatorRewardSetResponse',
74
+ /** Request for an exponential moving average price. */
75
+ QueryEMARequest: 'QueryEMARequest',
76
+ /** Response containing exponential moving average data. */
77
+ QueryEMAResponse: 'QueryEMAResponse',
78
+ /** Request for a weighted moving average price. */
79
+ QueryWMARequest: 'QueryWMARequest',
80
+ /** Response containing weighted moving average data. */
81
+ QueryWMAResponse: 'QueryWMAResponse',
82
+ /** Request for a simple moving average price. */
83
+ QuerySMARequest: 'QuerySMARequest',
84
+ /** Response containing simple moving average data. */
85
+ QuerySMAResponse: 'QuerySMAResponse',
86
+ /** Request to convert a USDC amount into CHEQ. */
87
+ ConvertUSDCtoCHEQRequest: 'ConvertUSDCtoCHEQRequest',
88
+ /** Response returning the converted CHEQ amount. */
89
+ ConvertUSDCtoCHEQResponse: 'ConvertUSDCtoCHEQResponse',
90
+ /** Message to submit an aggregate exchange rate prevote. */
91
+ MsgAggregateExchangeRatePrevote: 'MsgAggregateExchangeRatePrevote',
92
+ /** Message that defines the MsgAggregateExchangeRatePrevote response type. */
93
+ MsgAggregateExchangeRatePrevoteResponse: 'MsgAggregateExchangeRatePrevoteResponse',
94
+ /** Message to submit an aggregate exchange rate vote. */
95
+ MsgAggregateExchangeRateVote: 'MsgAggregateExchangeRateVote',
96
+ /** Message that defines the MsgAggregateExchangeRateVote response type. */
97
+ MsgAggregateExchangeRateVoteResponse: 'MsgAggregateExchangeRateVoteResponse',
98
+ /** Message to delegate oracle voting rights to another address. */
99
+ MsgDelegateFeedConsent: 'MsgDelegateFeedConsent',
100
+ /** Message that defines the MsgDelegateFeedConsent response type. */
101
+ MsgDelegateFeedConsentResponse: 'MsgDelegateFeedConsentResponse',
102
+ /** Message that defines the MsgLegacyGovUpdateParams request type. */
103
+ MsgLegacyGovUpdateParams: 'MsgLegacyGovUpdateParams',
104
+ /** Message that defines the MsgLegacyGovUpdateParams response type. */
105
+ MsgLegacyGovUpdateParamsResponse: 'MsgLegacyGovUpdateParamsResponse',
106
+ /** Message that defines the MsgGovUpdateParams request type. */
107
+ MsgGovUpdateParams: 'MsgGovUpdateParams',
108
+ /** Message that defines the MsgGovUpdateParams response type. */
109
+ MsgGovUpdateParamsResponse: 'MsgGovUpdateParamsResponse',
110
+ /** Message that defines the MsgGovAddDenoms request type. */
111
+ MsgGovAddDenoms: 'MsgGovAddDenoms',
112
+ /** Message that defines the MsgGovAddDenoms response type. */
113
+ MsgGovAddDenomsResponse: 'MsgGovAddDenomsResponse',
114
+ /** Message that defines the MsgGovRemoveCurrencyPairProviders request type. */
115
+ MsgGovRemoveCurrencyPairProviders: 'MsgGovRemoveCurrencyPairProviders',
116
+ /** Message that defines the MsgGovRemoveCurrencyPairProviders response type. */
117
+ MsgGovRemoveCurrencyPairProvidersResponse: 'MsgGovRemoveCurrencyPairProvidersResponse',
118
+ /** Message that defines the MsgGovRemoveCurrencyDeviationThresholds request type. */
119
+ MsgGovRemoveCurrencyDeviationThresholds: 'MsgGovRemoveCurrencyDeviationThresholds',
120
+ /** Message that defines the MsgGovRemoveCurrencyDeviationThresholds response type. */
121
+ MsgGovRemoveCurrencyDeviationThresholdsResponse: 'MsgGovRemoveCurrencyDeviationThresholdsResponse',
122
+ /** Message that defines the MsgGovCancelUpdateParamPlan request type. */
123
+ MsgGovCancelUpdateParamPlan: 'MsgGovCancelUpdateParamPlan',
124
+ /** Message that defines the MsgGovCancelUpdateParamPlan response type. */
125
+ MsgGovCancelUpdateParamPlanResponse: 'MsgGovCancelUpdateParamPlanResponse',
126
+ };
127
+ /** Type URL for MsgAggregateExchangeRatePrevote messages */
128
+ exports.typeUrlMsgAggregateExchangeRatePrevote = `/${v2_1.protobufPackage}.MsgAggregateExchangeRatePrevote`;
129
+ /** Type URL for MsgAggregateExchangeRatePrevoteResponse messages */
130
+ exports.typeUrlMsgAggregateExchangeRatePrevoteResponse = `/${v2_1.protobufPackage}.MsgAggregateExchangeRatePrevoteResponse`;
131
+ /** Type URL for MsgAggregateExchangeRateVote messages */
132
+ exports.typeUrlMsgAggregateExchangeRateVote = `/${v2_1.protobufPackage}.MsgAggregateExchangeRateVote`;
133
+ /** Type URL for MsgAggregateExchangeRateVoteResponse messages */
134
+ exports.typeUrlMsgAggregateExchangeRateVoteResponse = `/${v2_1.protobufPackage}.MsgAggregateExchangeRateVoteResponse`;
135
+ /** Type URL for MsgDelegateFeedConsent messages */
136
+ exports.typeUrlMsgDelegateFeedConsent = `/${v2_1.protobufPackage}.MsgDelegateFeedConsent`;
137
+ /** Type URL for MsgDelegateFeedConsentResponse messages */
138
+ exports.typeUrlMsgDelegateFeedConsentResponse = `/${v2_1.protobufPackage}.MsgDelegateFeedConsentResponse`;
139
+ /** Type URL for MsgLegacyGovUpdateParams messages */
140
+ exports.typeUrlMsgLegacyGovUpdateParams = `/${v2_1.protobufPackage}.MsgLegacyGovUpdateParams`;
141
+ /** Type URL for MsgLegacyGovUpdateParamsResponse messages */
142
+ exports.typeUrlMsgLegacyGovUpdateParamsResponse = `/${v2_1.protobufPackage}.MsgLegacyGovUpdateParamsResponse`;
143
+ /** Type URL for MsgGovUpdateParams messages */
144
+ exports.typeUrlMsgGovUpdateParams = `/${v2_1.protobufPackage}.MsgGovUpdateParams`;
145
+ /** Type URL for MsgGovUpdateParamsResponse messages */
146
+ exports.typeUrlMsgGovUpdateParamsResponse = `/${v2_1.protobufPackage}.MsgGovUpdateParamsResponse`;
147
+ /** Type URL for MsgGovAddDenoms messages */
148
+ exports.typeUrlMsgGovAddDenoms = `/${v2_1.protobufPackage}.MsgGovAddDenoms`;
149
+ /** Type URL for MsgGovAddDenomsResponse messages */
150
+ exports.typeUrlMsgGovAddDenomsResponse = `/${v2_1.protobufPackage}.MsgGovAddDenomsResponse`;
151
+ /** Type URL for MsgGovRemoveCurrencyPairProviders messages */
152
+ exports.typeUrlMsgGovRemoveCurrencyPairProviders = `/${v2_1.protobufPackage}.MsgGovRemoveCurrencyPairProviders`;
153
+ /** Type URL for MsgGovRemoveCurrencyPairProvidersResponse messages */
154
+ exports.typeUrlMsgGovRemoveCurrencyPairProvidersResponse = `/${v2_1.protobufPackage}.MsgGovRemoveCurrencyPairProvidersResponse`;
155
+ /** Type URL for MsgGovRemoveCurrencyDeviationThresholds messages */
156
+ exports.typeUrlMsgGovRemoveCurrencyDeviationThresholds = `/${v2_1.protobufPackage}.MsgGovRemoveCurrencyDeviationThresholds`;
157
+ /** Type URL for MsgGovRemoveCurrencyDeviationThresholdsResponse messages */
158
+ exports.typeUrlMsgGovRemoveCurrencyDeviationThresholdsResponse = `/${v2_1.protobufPackage}.MsgGovRemoveCurrencyDeviationThresholdsResponse`;
159
+ /** Type URL for MsgGovCancelUpdateParamPlan messages */
160
+ exports.typeUrlMsgGovCancelUpdateParamPlan = `/${v2_1.protobufPackage}.MsgGovCancelUpdateParamPlan`;
161
+ /** Type URL for MsgGovCancelUpdateParamPlanResponse messages */
162
+ exports.typeUrlMsgGovCancelUpdateParamPlanResponse = `/${v2_1.protobufPackage}.MsgGovCancelUpdateParamPlanResponse`;
163
+ /**
164
+ * Type guard function to check if an object is a MsgAggregateExchangeRatePrevoteEncodeObject
165
+ * @param obj - EncodeObject to check
166
+ * @returns True if the object is a MsgAggregateExchangeRatePrevoteEncodeObject, false otherwise
167
+ */
168
+ function isMsgAggregateExchangeRatePrevoteEncodeObject(obj) {
169
+ return obj.typeUrl === exports.typeUrlMsgAggregateExchangeRatePrevote;
170
+ }
171
+ /**
172
+ * Type guard function to check if an object is a MsgAggregateExchangeRateVoteEncodeObject
173
+ * @param obj - EncodeObject to check
174
+ * @returns True if the object is a MsgAggregateExchangeRateVoteEncodeObject, false otherwise
175
+ */
176
+ function isMsgAggregateExchangeRateVoteEncodeObject(obj) {
177
+ return obj.typeUrl === exports.typeUrlMsgAggregateExchangeRateVote;
178
+ }
179
+ /**
180
+ * Type guard function to check if an object is a MsgDelegateFeedConsentEncodeObject
181
+ * @param obj - EncodeObject to check
182
+ * @returns True if the object is a MsgDelegateFeedConsentEncodeObject, false otherwise
183
+ */
184
+ function isMsgDelegateFeedConsentEncodeObject(obj) {
185
+ return obj.typeUrl === exports.typeUrlMsgDelegateFeedConsent;
186
+ }
187
+ /**
188
+ * Type guard function to check if an object is a MsgLegacyGovUpdateParamsEncodeObject
189
+ * @param obj - EncodeObject to check
190
+ * @returns True if the object is a MsgLegacyGovUpdateParamsEncodeObject, false otherwise
191
+ */
192
+ function isMsgLegacyGovUpdateParamsEncodeObject(obj) {
193
+ return obj.typeUrl === exports.typeUrlMsgLegacyGovUpdateParams;
194
+ }
195
+ /**
196
+ * Type guard function to check if an object is a MsgGovUpdateParamsEncodeObject
197
+ * @param obj - EncodeObject to check
198
+ * @returns True if the object is a MsgGovUpdateParamsEncodeObject, false otherwise
199
+ */
200
+ function isMsgGovUpdateParamsEncodeObject(obj) {
201
+ return obj.typeUrl === exports.typeUrlMsgGovUpdateParams;
202
+ }
203
+ /**
204
+ * Type guard function to check if an object is a MsgGovAddDenomsEncodeObject
205
+ * @param obj - EncodeObject to check
206
+ * @returns True if the object is a MsgGovAddDenomsEncodeObject, false otherwise
207
+ */
208
+ function isMsgGovAddDenomsEncodeObject(obj) {
209
+ return obj.typeUrl === exports.typeUrlMsgGovAddDenoms;
210
+ }
211
+ /**
212
+ * Type guard function to check if an object is a MsgGovRemoveCurrencyPairProvidersEncodeObject
213
+ * @param obj - EncodeObject to check
214
+ * @returns True if the object is a MsgGovRemoveCurrencyPairProvidersEncodeObject, false otherwise
215
+ */
216
+ function isMsgGovRemoveCurrencyPairProvidersEncodeObject(obj) {
217
+ return obj.typeUrl === exports.typeUrlMsgGovRemoveCurrencyPairProviders;
218
+ }
219
+ /**
220
+ * Type guard function to check if an object is a MsgGovRemoveCurrencyDeviationThresholdsEncodeObject
221
+ * @param obj - EncodeObject to check
222
+ * @returns True if the object is a MsgGovRemoveCurrencyDeviationThresholdsEncodeObject, false otherwise
223
+ */
224
+ function isMsgGovRemoveCurrencyDeviationThresholdsEncodeObject(obj) {
225
+ return obj.typeUrl === exports.typeUrlMsgGovRemoveCurrencyDeviationThresholds;
226
+ }
227
+ /**
228
+ * Type guard function to check if an object is a MsgGovCancelUpdateParamPlanEncodeObject
229
+ * @param obj - EncodeObject to check
230
+ * @returns True if the object is a MsgGovCancelUpdateParamPlanEncodeObject, false otherwise
231
+ */
232
+ function isMsgGovCancelUpdateParamPlanEncodeObject(obj) {
233
+ return obj.typeUrl === exports.typeUrlMsgGovCancelUpdateParamPlan;
234
+ }
235
+ /** Enumeration of WMA strategies */
236
+ exports.WMAStrategies = {
237
+ /** Balanced (linear) strategy */
238
+ BALANCED: 'BALANCED',
239
+ /** Recent (weighted) strategy */
240
+ RECENT: 'RECENT',
241
+ /** Oldest (weighted) strategy */
242
+ OLDEST: 'OLDEST',
243
+ /** Custom weights strategy */
244
+ CUSTOM: 'CUSTOM',
245
+ };
246
+ /** Enumeration of moving averages */
247
+ exports.MovingAverages = {
248
+ /** Exponential Moving Average */
249
+ EMA: 'ema',
250
+ /** Weighted Moving Average */
251
+ WMA: 'wma',
252
+ /** Simple Moving Average */
253
+ SMA: 'sma',
254
+ };
255
+ /** Sets up the Oracle extension for the querier client.
256
+ * Creates and configures the Oracle-specific query methods.
257
+ * @param base - Base QueryClient to extend
258
+ * @returns Configured Oracle extension with query methods
259
+ */
260
+ const setupOracleExtension = (base) => {
261
+ const rpc = (0, stargate_1.createProtobufRpcClient)(base);
262
+ const queryService = new v2_1.QueryClientImpl(rpc);
263
+ return {
264
+ [exports.defaultOracleExtensionKey]: {
265
+ queryExchangeRates: async (denom = '') => {
266
+ const response = await queryService.ExchangeRates({ denom });
267
+ (0, utils_1.assert)(response.exchangeRates, 'Expected exchangeRates in response');
268
+ return response;
269
+ },
270
+ queryActiveExchangeRates: async () => {
271
+ const response = await queryService.ActiveExchangeRates({});
272
+ (0, utils_1.assert)(response.activeRates, 'Expected activeRates in response');
273
+ return response;
274
+ },
275
+ queryFeederDelegation: async (validatorAddr) => {
276
+ const response = await queryService.FeederDelegation({ validatorAddr });
277
+ (0, utils_1.assert)(response.feederAddr, 'Expected feederAddr in response');
278
+ return response;
279
+ },
280
+ queryMissCounter: async (validatorAddr) => {
281
+ const response = await queryService.MissCounter({ validatorAddr });
282
+ (0, utils_1.assert)(response.missCounter, 'Expected missCounter in response');
283
+ return response;
284
+ },
285
+ querySlashWindow: async () => {
286
+ const response = await queryService.SlashWindow({});
287
+ (0, utils_1.assert)(response.windowProgress, 'Expected windowProgress in response');
288
+ return response;
289
+ },
290
+ queryAggregatePrevote: async (validatorAddr) => {
291
+ const response = await queryService.AggregatePrevote({ validatorAddr });
292
+ (0, utils_1.assert)(response.aggregatePrevote, 'Expected aggregatePrevote in response');
293
+ return response;
294
+ },
295
+ queryAggregatePrevotes: async () => {
296
+ const response = await queryService.AggregatePrevotes({});
297
+ (0, utils_1.assert)(response.aggregatePrevotes, 'Expected aggregatePrevotes in response');
298
+ return response;
299
+ },
300
+ queryAggregateVote: async (validatorAddr) => {
301
+ const response = await queryService.AggregateVote({ validatorAddr });
302
+ (0, utils_1.assert)(response.aggregateVote, 'Expected aggregateVote in response');
303
+ return response;
304
+ },
305
+ queryAggregateVotes: async (validatorAddr) => {
306
+ const response = await queryService.AggregateVotes({ validatorAddr });
307
+ (0, utils_1.assert)(response.aggregateVotes, 'Expected aggregateVotes in response');
308
+ return response;
309
+ },
310
+ queryParams: async () => {
311
+ const response = await queryService.Params({});
312
+ (0, utils_1.assert)(response.params, 'Expected params in response');
313
+ return response;
314
+ },
315
+ queryMedians: async (denom, numStamps) => {
316
+ const response = await queryService.Medians({ denom, numStamps });
317
+ (0, utils_1.assert)(response.medians, 'Expected medians in response');
318
+ return response;
319
+ },
320
+ queryMedianDeviations: async (denom) => {
321
+ const response = await queryService.MedianDeviations({ denom });
322
+ (0, utils_1.assert)(response.medianDeviations, 'Expected medianDeviations in response');
323
+ return response;
324
+ },
325
+ queryValidatorRewardSet: async () => {
326
+ const response = await queryService.ValidatorRewardSet({});
327
+ (0, utils_1.assert)(response.validators, 'Expected validators in response');
328
+ return response;
329
+ },
330
+ queryEMA: async (denom) => {
331
+ const response = await queryService.EMA({ denom });
332
+ (0, utils_1.assert)(response.price, 'Expected price in response');
333
+ return response;
334
+ },
335
+ queryWMA: async (denom, strategy = exports.WMAStrategies.BALANCED, weights = []) => {
336
+ const response = await queryService.WMA({ denom, strategy, customWeights: weights });
337
+ (0, utils_1.assert)(response.price, 'Expected price in response');
338
+ return response;
339
+ },
340
+ querySMA: async (denom) => {
341
+ const response = await queryService.SMA({ denom });
342
+ (0, utils_1.assert)(response.price, 'Expected price in response');
343
+ return response;
344
+ },
345
+ convertUSDtoCHEQ: async (usdAmount, movingAverage, wmaStrategy = exports.WMAStrategies.BALANCED, weights = []) => {
346
+ const response = await queryService.ConvertUSDCtoCHEQ({
347
+ amount: `${usdAmount}usd`,
348
+ maType: movingAverage,
349
+ wmaStrategy,
350
+ customWeights: weights.map((w) => Number(w)),
351
+ });
352
+ (0, utils_1.assert)(response.amount, 'Expected amount in response');
353
+ return response;
354
+ },
355
+ },
356
+ };
357
+ };
358
+ exports.setupOracleExtension = setupOracleExtension;
359
+ /**
360
+ * Oracle Module class providing comprehensive access to Oracle functionalities.
361
+ * Handles both querying and transaction operations related to the Oracle module.
362
+ */
363
+ class OracleModule extends _1.AbstractCheqdSDKModule {
364
+ // @ts-expect-error underlying type `GeneratedType` is intentionally wider
365
+ static registryTypes = [
366
+ [exports.typeUrlMsgAggregateExchangeRatePrevote, v2_1.MsgAggregateExchangeRatePrevote],
367
+ [exports.typeUrlMsgAggregateExchangeRatePrevoteResponse, v2_1.MsgAggregateExchangeRatePrevoteResponse],
368
+ [exports.typeUrlMsgAggregateExchangeRateVote, v2_1.MsgAggregateExchangeRateVote],
369
+ [exports.typeUrlMsgDelegateFeedConsent, v2_1.MsgDelegateFeedConsent],
370
+ [exports.typeUrlMsgLegacyGovUpdateParams, v2_1.MsgLegacyGovUpdateParams],
371
+ [exports.typeUrlMsgGovUpdateParams, v2_1.MsgGovUpdateParams],
372
+ [exports.typeUrlMsgGovAddDenoms, v2_1.MsgGovAddDenoms],
373
+ [exports.typeUrlMsgGovRemoveCurrencyPairProviders, v2_1.MsgGovRemoveCurrencyPairProviders],
374
+ [exports.typeUrlMsgGovRemoveCurrencyDeviationThresholds, v2_1.MsgGovRemoveCurrencyDeviationThresholds],
375
+ [exports.typeUrlMsgGovCancelUpdateParamPlan, v2_1.MsgGovCancelUpdateParamPlan],
376
+ ];
377
+ /** Base denomination tickers for Cheqd network Oracle */
378
+ static baseDenomTickers = {
379
+ CHEQ: 'CHEQ',
380
+ USDC: 'USDC',
381
+ USDT: 'USDT',
382
+ };
383
+ /** Querier extension setup function for Oracle operations */
384
+ static querierExtensionSetup = exports.setupOracleExtension;
385
+ /** Querier instance with Oracle extension capabilities */
386
+ querier;
387
+ /**
388
+ * Constructs a new Oracle module instance.
389
+ *
390
+ * @param signer - Signing client for blockchain transactions
391
+ * @param querier - Querier client with Oracle extension for data retrieval
392
+ */
393
+ constructor(signer, querier) {
394
+ super(signer, querier);
395
+ this.querier = querier;
396
+ this.methods = {
397
+ aggregateExchangeRatePrevoteTx: this.aggregateExchangeRatePrevoteTx.bind(this),
398
+ aggregateExchangeRateVoteTx: this.aggregateExchangeRateVoteTx.bind(this),
399
+ delegateFeedConsentTx: this.delegateFeedConsentTx.bind(this),
400
+ legacyGovUpdateParamsTx: this.legacyGovUpdateParamsTx.bind(this),
401
+ govUpdateParamsTx: this.govUpdateParamsTx.bind(this),
402
+ govAddDenomsTx: this.govAddDenomsTx.bind(this),
403
+ govRemoveCurrencyPairProvidersTx: this.govRemoveCurrencyPairProvidersTx.bind(this),
404
+ govRemoveCurrencyDeviationThresholdsTx: this.govRemoveCurrencyDeviationThresholdsTx.bind(this),
405
+ govCancelUpdateParamPlanTx: this.govCancelUpdateParamPlanTx.bind(this),
406
+ queryExchangeRates: this.querier[exports.defaultOracleExtensionKey].queryExchangeRates.bind(this),
407
+ queryActiveExchangeRates: this.querier[exports.defaultOracleExtensionKey].queryActiveExchangeRates.bind(this),
408
+ queryFeederDelegation: this.querier[exports.defaultOracleExtensionKey].queryFeederDelegation.bind(this),
409
+ queryMissCounter: this.querier[exports.defaultOracleExtensionKey].queryMissCounter.bind(this),
410
+ querySlashWindow: this.querier[exports.defaultOracleExtensionKey].querySlashWindow.bind(this),
411
+ queryAggregatePrevote: this.querier[exports.defaultOracleExtensionKey].queryAggregatePrevote.bind(this),
412
+ queryAggregatePrevotes: this.querier[exports.defaultOracleExtensionKey].queryAggregatePrevotes.bind(this),
413
+ queryAggregateVote: this.querier[exports.defaultOracleExtensionKey].queryAggregateVote.bind(this),
414
+ queryAggregateVotes: this.querier[exports.defaultOracleExtensionKey].queryAggregateVotes.bind(this),
415
+ queryParams: this.querier[exports.defaultOracleExtensionKey].queryParams.bind(this),
416
+ queryMedians: this.querier[exports.defaultOracleExtensionKey].queryMedians.bind(this),
417
+ queryMedianDeviations: this.querier[exports.defaultOracleExtensionKey].queryMedianDeviations.bind(this),
418
+ queryValidatorRewardSet: this.querier[exports.defaultOracleExtensionKey].queryValidatorRewardSet.bind(this),
419
+ queryEMA: this.querier[exports.defaultOracleExtensionKey].queryEMA.bind(this),
420
+ queryWMA: this.querier[exports.defaultOracleExtensionKey].queryWMA.bind(this),
421
+ querySMA: this.querier[exports.defaultOracleExtensionKey].querySMA.bind(this),
422
+ convertUSDtoCHEQ: this.querier[exports.defaultOracleExtensionKey].convertUSDtoCHEQ.bind(this),
423
+ };
424
+ }
425
+ /**
426
+ * Gets the registry types for Oracle message encoding/decoding.
427
+ *
428
+ * @returns Iterable of [typeUrl, GeneratedType] pairs for the registry
429
+ */
430
+ getRegistryTypes() {
431
+ return OracleModule.registryTypes;
432
+ }
433
+ /**
434
+ * Gets the querier extension setup for Oracle operations.
435
+ *
436
+ * @returns Query extension setup function for Oracle functionality
437
+ */
438
+ getQuerierExtensionSetup() {
439
+ return OracleModule.querierExtensionSetup;
440
+ }
441
+ /**
442
+ * Queries the module parameters from the blockchain.
443
+ *
444
+ * @returns Promise resolving to the QueryParamsResponse containing module parameters
445
+ */
446
+ async queryParams() {
447
+ return this.querier[exports.defaultOracleExtensionKey].queryParams();
448
+ }
449
+ /**
450
+ * Queries the exchange rate for a specific denom.
451
+ * @param denom - The denomination to query the exchange rate for
452
+ * @returns Promise resolving to the QueryExchangeRatesResponse containing the exchange rate
453
+ */
454
+ async queryExchangeRate(denom) {
455
+ return this.querier[exports.defaultOracleExtensionKey].queryExchangeRates(denom);
456
+ }
457
+ /**
458
+ * Queries all active exchange rate denoms.
459
+ * @returns Promise resolving to the QueryActiveExchangeRatesResponse containing active denoms
460
+ */
461
+ async queryActiveExchangeRates() {
462
+ return this.querier[exports.defaultOracleExtensionKey].queryActiveExchangeRates();
463
+ }
464
+ /**
465
+ * Queries the Exponential Moving Average (EMA) for a given denom.
466
+ * @param denom - The denomination to query the EMA for
467
+ * @returns Promise resolving to the QueryEMAResponse containing the EMA price in string Decimal format
468
+ */
469
+ async queryEMA(denom) {
470
+ const response = await this.querier[exports.defaultOracleExtensionKey].queryEMA(denom);
471
+ return {
472
+ price: math_1.Decimal.fromAtomics(BigInt(response.price).toString(), 18).toString(),
473
+ };
474
+ }
475
+ /**
476
+ * Queries the Weighted Moving Average (WMA) for a given denom.
477
+ * @param denom - The denomination to query the WMA for
478
+ * @param strategy - Optional WMA strategy, defaults to 'BALANCED'
479
+ * @param weights - Optional custom weights for the WMA calculation
480
+ * @returns Promise resolving to the QueryWMAResponse containing the WMA price in string Decimal format
481
+ */
482
+ async queryWMA(denom, strategy, weights) {
483
+ const response = await this.querier[exports.defaultOracleExtensionKey].queryWMA(denom, strategy, weights?.map((w) => BigInt(w)));
484
+ return {
485
+ price: math_1.Decimal.fromAtomics(BigInt(response.price).toString(), 18).toString(),
486
+ };
487
+ }
488
+ /**
489
+ * Queries the Simple Moving Average (SMA) for a given denom.
490
+ * @param denom - The denomination to query the SMA for
491
+ * @returns Promise resolving to the QuerySMAResponse containing the SMA price in string Decimal format
492
+ */
493
+ async querySMA(denom) {
494
+ const response = await this.querier[exports.defaultOracleExtensionKey].querySMA(denom);
495
+ return {
496
+ price: math_1.Decimal.fromAtomics(BigInt(response.price).toString(), 18).toString(),
497
+ };
498
+ }
499
+ /**
500
+ * Converts a USD amount to CHEQ using the specified moving average type.
501
+ * @param usdAmount - The USD amount to convert
502
+ * @param movingAverage - The type of moving average to use for conversion
503
+ * @param wmaStrategy - Optional WMA strategy, defaults to 'BALANCED'
504
+ * @param weights - Optional custom weights for WMA calculation
505
+ * @returns Promise resolving to the ConvertUSDCtoCHEQResponse containing the converted CHEQ amount
506
+ */
507
+ async convertUSDtoCHEQ(usdAmount, movingAverage, wmaStrategy, weights) {
508
+ return this.querier[exports.defaultOracleExtensionKey].convertUSDtoCHEQ(usdAmount, movingAverage, wmaStrategy, weights?.map((w) => BigInt(w)));
509
+ }
510
+ /**
511
+ * Broadcasts an aggregate exchange rate prevote transaction.
512
+ *
513
+ * @param payload - Message payload describing the prevote
514
+ * @param address - Address responsible for paying the transaction fees
515
+ * @param fee - Optional fee configuration, defaults to automatic calculation
516
+ * @param memo - Optional transaction memo
517
+ * @param context - Optional SDK context to lazily resolve signer or wallet
518
+ * @returns Promise resolving to the DeliverTxResponse
519
+ */
520
+ async aggregateExchangeRatePrevoteTx(payload, address, fee, memo = '', context) {
521
+ const encObj = {
522
+ typeUrl: exports.typeUrlMsgAggregateExchangeRatePrevote,
523
+ value: v2_1.MsgAggregateExchangeRatePrevote.fromPartial(payload),
524
+ };
525
+ return this.broadcastOracleTx(encObj, address, fee, memo, context);
526
+ }
527
+ /**
528
+ * Broadcasts an aggregate exchange rate vote transaction.
529
+ *
530
+ * @param payload - Message payload describing the vote
531
+ * @param address - Address responsible for paying the transaction fees
532
+ * @param fee - Optional fee configuration, defaults to automatic calculation
533
+ * @param memo - Optional transaction memo
534
+ * @param context - Optional SDK context to lazily resolve signer or wallet
535
+ * @returns Promise resolving to the DeliverTxResponse
536
+ */
537
+ async aggregateExchangeRateVoteTx(payload, address, fee, memo = '', context) {
538
+ const encObj = {
539
+ typeUrl: exports.typeUrlMsgAggregateExchangeRateVote,
540
+ value: v2_1.MsgAggregateExchangeRateVote.fromPartial(payload),
541
+ };
542
+ return this.broadcastOracleTx(encObj, address, fee, memo, context);
543
+ }
544
+ /**
545
+ * Delegates feed consent between operator and delegate.
546
+ *
547
+ * @param payload - Message payload describing the delegation
548
+ * @param address - Address responsible for paying the transaction fees
549
+ * @param fee - Optional fee configuration, defaults to automatic calculation
550
+ * @param memo - Optional transaction memo
551
+ * @param context - Optional SDK context to lazily resolve signer or wallet
552
+ * @returns Promise resolving to the DeliverTxResponse
553
+ */
554
+ async delegateFeedConsentTx(payload, address, fee, memo = '', context) {
555
+ const encObj = {
556
+ typeUrl: exports.typeUrlMsgDelegateFeedConsent,
557
+ value: v2_1.MsgDelegateFeedConsent.fromPartial(payload),
558
+ };
559
+ return this.broadcastOracleTx(encObj, address, fee, memo, context);
560
+ }
561
+ /**
562
+ * Submits a legacy governance update params transaction via MsgSubmitProposal.
563
+ *
564
+ * @param payload - Legacy governance update parameters payload
565
+ * @param address - Address responsible for paying the transaction fees
566
+ * @param fee - Optional fee configuration, defaults to automatic calculation
567
+ * @param memo - Optional transaction memo
568
+ * @param context - Optional SDK context to lazily resolve signer or wallet
569
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
570
+ * @returns Promise resolving to the DeliverTxResponse
571
+ */
572
+ async legacyGovUpdateParamsTx(payload, address, fee, memo = '', context, proposalOptions) {
573
+ const signerAddress = await this.ensureSignerAddress(address, context);
574
+ const proposalMsg = {
575
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
576
+ value: tx_1.MsgSubmitProposal.fromPartial({
577
+ messages: [
578
+ {
579
+ typeUrl: exports.typeUrlMsgLegacyGovUpdateParams,
580
+ value: v2_1.MsgLegacyGovUpdateParams.encode(payload).finish(),
581
+ },
582
+ ],
583
+ proposer: signerAddress,
584
+ initialDeposit: proposalOptions?.deposit ?? [],
585
+ metadata: proposalOptions?.metadata ?? '',
586
+ title: payload.title ?? '',
587
+ summary: proposalOptions?.summary ?? payload.description ?? '',
588
+ expedited: proposalOptions?.expedited ?? false,
589
+ }),
590
+ };
591
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
592
+ }
593
+ /**
594
+ * Submits a governance update params transaction via MsgSubmitProposal.
595
+ *
596
+ * @param payload - Governance update parameters payload
597
+ * @param address - Address responsible for paying the transaction fees
598
+ * @param fee - Optional fee configuration, defaults to automatic calculation
599
+ * @param memo - Optional transaction memo
600
+ * @param context - Optional SDK context to lazily resolve signer or wallet
601
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
602
+ * @returns Promise resolving to the DeliverTxResponse
603
+ */
604
+ async govUpdateParamsTx(payload, address, fee, memo = '', context, proposalOptions) {
605
+ const signerAddress = await this.ensureSignerAddress(address, context);
606
+ const proposalMsg = {
607
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
608
+ value: tx_1.MsgSubmitProposal.fromPartial({
609
+ messages: [
610
+ {
611
+ typeUrl: exports.typeUrlMsgGovUpdateParams,
612
+ value: v2_1.MsgGovUpdateParams.encode(payload).finish(),
613
+ },
614
+ ],
615
+ proposer: signerAddress,
616
+ initialDeposit: proposalOptions?.deposit ?? [],
617
+ metadata: proposalOptions?.metadata ?? '',
618
+ title: payload.title ?? '',
619
+ summary: proposalOptions?.summary ?? payload.description ?? '',
620
+ expedited: proposalOptions?.expedited ?? false,
621
+ }),
622
+ };
623
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
624
+ }
625
+ /**
626
+ * Adds new denoms to the oracle registry via MsgSubmitProposal.
627
+ *
628
+ * @param payload - Governance proposal payload that describes the new denoms
629
+ * @param address - Address responsible for paying the transaction fees
630
+ * @param fee - Optional fee configuration, defaults to automatic calculation
631
+ * @param memo - Optional transaction memo
632
+ * @param context - Optional SDK context to lazily resolve signer or wallet
633
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
634
+ * @returns Promise resolving to the DeliverTxResponse
635
+ */
636
+ async govAddDenomsTx(payload, address, fee, memo = '', context, proposalOptions) {
637
+ const signerAddress = await this.ensureSignerAddress(address, context);
638
+ const proposalMsg = {
639
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
640
+ value: tx_1.MsgSubmitProposal.fromPartial({
641
+ messages: [
642
+ {
643
+ typeUrl: exports.typeUrlMsgGovAddDenoms,
644
+ value: v2_1.MsgGovAddDenoms.encode(payload).finish(),
645
+ },
646
+ ],
647
+ proposer: signerAddress,
648
+ initialDeposit: proposalOptions?.deposit ?? [],
649
+ metadata: proposalOptions?.metadata ?? '',
650
+ title: payload.title ?? '',
651
+ summary: proposalOptions?.summary ?? payload.description ?? '',
652
+ expedited: proposalOptions?.expedited ?? false,
653
+ }),
654
+ };
655
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
656
+ }
657
+ /**
658
+ * Removes currency pair providers from the oracle configuration via MsgSubmitProposal.
659
+ *
660
+ * @param payload - Governance proposal payload describing providers to remove
661
+ * @param address - Address responsible for paying the transaction fees
662
+ * @param fee - Optional fee configuration, defaults to automatic calculation
663
+ * @param memo - Optional transaction memo
664
+ * @param context - Optional SDK context to lazily resolve signer or wallet
665
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
666
+ * @returns Promise resolving to the DeliverTxResponse
667
+ */
668
+ async govRemoveCurrencyPairProvidersTx(payload, address, fee, memo = '', context, proposalOptions) {
669
+ const signerAddress = await this.ensureSignerAddress(address, context);
670
+ const proposalMsg = {
671
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
672
+ value: tx_1.MsgSubmitProposal.fromPartial({
673
+ messages: [
674
+ {
675
+ typeUrl: exports.typeUrlMsgGovRemoveCurrencyPairProviders,
676
+ value: v2_1.MsgGovRemoveCurrencyPairProviders.encode(payload).finish(),
677
+ },
678
+ ],
679
+ proposer: signerAddress,
680
+ initialDeposit: proposalOptions?.deposit ?? [],
681
+ metadata: proposalOptions?.metadata ?? '',
682
+ title: payload.title ?? '',
683
+ summary: proposalOptions?.summary ?? payload.description ?? '',
684
+ expedited: proposalOptions?.expedited ?? false,
685
+ }),
686
+ };
687
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
688
+ }
689
+ /**
690
+ * Removes currency deviation thresholds via MsgSubmitProposal.
691
+ *
692
+ * @param payload - Governance payload describing currencies to remove
693
+ * @param address - Address responsible for paying the transaction fees
694
+ * @param fee - Optional fee configuration, defaults to automatic calculation
695
+ * @param memo - Optional transaction memo
696
+ * @param context - Optional SDK context to lazily resolve signer or wallet
697
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
698
+ * @returns Promise resolving to the DeliverTxResponse
699
+ */
700
+ async govRemoveCurrencyDeviationThresholdsTx(payload, address, fee, memo = '', context, proposalOptions) {
701
+ const signerAddress = await this.ensureSignerAddress(address, context);
702
+ const proposalMsg = {
703
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
704
+ value: tx_1.MsgSubmitProposal.fromPartial({
705
+ messages: [
706
+ {
707
+ typeUrl: exports.typeUrlMsgGovRemoveCurrencyDeviationThresholds,
708
+ value: v2_1.MsgGovRemoveCurrencyDeviationThresholds.encode(payload).finish(),
709
+ },
710
+ ],
711
+ proposer: signerAddress,
712
+ initialDeposit: proposalOptions?.deposit ?? [],
713
+ metadata: proposalOptions?.metadata ?? '',
714
+ title: payload.title ?? '',
715
+ summary: proposalOptions?.summary ?? payload.description ?? '',
716
+ expedited: proposalOptions?.expedited ?? false,
717
+ }),
718
+ };
719
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
720
+ }
721
+ /**
722
+ * Cancels a pending parameter update plan via MsgSubmitProposal.
723
+ *
724
+ * @param payload - Governance payload containing cancellation details
725
+ * @param address - Address responsible for paying the transaction fees
726
+ * @param fee - Optional fee configuration, defaults to automatic calculation
727
+ * @param memo - Optional transaction memo
728
+ * @param context - Optional SDK context to lazily resolve signer or wallet
729
+ * @param proposalOptions - Optional MsgSubmitProposal configuration such as deposit or metadata
730
+ * @returns Promise resolving to the DeliverTxResponse
731
+ */
732
+ async govCancelUpdateParamPlanTx(payload, address, fee, memo = '', context, proposalOptions) {
733
+ const signerAddress = await this.ensureSignerAddress(address, context);
734
+ const proposalMsg = {
735
+ typeUrl: tx_1.MsgSubmitProposal.typeUrl,
736
+ value: tx_1.MsgSubmitProposal.fromPartial({
737
+ messages: [
738
+ {
739
+ typeUrl: exports.typeUrlMsgGovCancelUpdateParamPlan,
740
+ value: v2_1.MsgGovCancelUpdateParamPlan.encode(payload).finish(),
741
+ },
742
+ ],
743
+ proposer: signerAddress,
744
+ initialDeposit: proposalOptions?.deposit ?? [],
745
+ metadata: proposalOptions?.metadata ?? '',
746
+ title: payload.title ?? '',
747
+ summary: proposalOptions?.summary ?? payload.description ?? '',
748
+ expedited: proposalOptions?.expedited ?? false,
749
+ }),
750
+ };
751
+ return this.broadcastOracleTx(proposalMsg, signerAddress, fee, memo, context);
752
+ }
753
+ /**
754
+ * Ensures a signer client exists and resolves the address to use for broadcasting.
755
+ *
756
+ * @param address - Address provided by the caller (optional)
757
+ * @param context - Optional SDK context used to resolve signer or wallet
758
+ * @returns Resolved signer address
759
+ */
760
+ async ensureSignerAddress(address, context) {
761
+ if (!this._signer) {
762
+ (0, utils_1.assert)(context?.sdk?.signer, 'Signer client is required to broadcast oracle transactions');
763
+ this._signer = context.sdk.signer;
764
+ }
765
+ if (address && address.length > 0) {
766
+ return address;
767
+ }
768
+ (0, utils_1.assert)(context?.sdk?.options?.wallet, 'Wallet context is required when no address is provided');
769
+ const accounts = await context.sdk.options.wallet.getAccounts();
770
+ (0, utils_1.assert)(accounts.length > 0, 'No accounts available in the provided wallet');
771
+ return accounts[0].address;
772
+ }
773
+ /**
774
+ * Signs and broadcasts the provided oracle transaction.
775
+ *
776
+ * @param message - EncodeObject representing the oracle message
777
+ * @param address - Address responsible for the transaction fees
778
+ * @param fee - Optional fee configuration, defaults to automatic calculation
779
+ * @param memo - Optional transaction memo
780
+ * @param context - Optional SDK context used to resolve signer or wallet
781
+ * @returns Promise resolving to the DeliverTxResponse
782
+ */
783
+ async broadcastOracleTx(message, address, fee, memo = '', context) {
784
+ const signerAddress = await this.ensureSignerAddress(address, context);
785
+ return this._signer.signAndBroadcast(signerAddress, [message], fee ?? 'auto', memo);
786
+ }
787
+ /**
788
+ * Parses a decimal price string back into its atomic representation.
789
+ * @param price - Price in decimal string format
790
+ * @returns Promise resolving to the atomic string representation of the price
791
+ */
792
+ static async parseFromDecimalPrice(price) {
793
+ const decimal = math_1.Decimal.fromUserInput(price, 18);
794
+ return decimal.atomics;
795
+ }
796
+ }
797
+ exports.OracleModule = OracleModule;
798
+ //# sourceMappingURL=oracle.js.map