@cheqd/sdk-esm 5.3.7-develop.1 → 5.4.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/build/cjs/src/index.d.ts +142 -0
  2. package/build/cjs/src/index.d.ts.map +1 -0
  3. package/build/cjs/src/index.js +184 -0
  4. package/build/cjs/src/index.js.map +1 -0
  5. package/build/cjs/src/modules/_.d.ts +81 -0
  6. package/build/cjs/src/modules/_.d.ts.map +1 -0
  7. package/build/cjs/src/modules/_.js +93 -0
  8. package/build/cjs/src/modules/_.js.map +1 -0
  9. package/build/cjs/src/modules/did.d.ts +488 -0
  10. package/build/cjs/src/modules/did.d.ts.map +1 -0
  11. package/build/cjs/src/modules/did.js +1249 -0
  12. package/build/cjs/src/modules/did.js.map +1 -0
  13. package/build/cjs/src/modules/feeabstraction.d.ts +429 -0
  14. package/build/cjs/src/modules/feeabstraction.d.ts.map +1 -0
  15. package/build/cjs/src/modules/feeabstraction.js +474 -0
  16. package/build/cjs/src/modules/feeabstraction.js.map +1 -0
  17. package/build/cjs/src/modules/feemarket.d.ts +244 -0
  18. package/build/cjs/src/modules/feemarket.d.ts.map +1 -0
  19. package/build/cjs/src/modules/feemarket.js +297 -0
  20. package/build/cjs/src/modules/feemarket.js.map +1 -0
  21. package/build/cjs/src/modules/oracle.d.ts +563 -0
  22. package/build/cjs/src/modules/oracle.d.ts.map +1 -0
  23. package/build/cjs/src/modules/oracle.js +784 -0
  24. package/build/cjs/src/modules/oracle.js.map +1 -0
  25. package/build/cjs/src/modules/resource.d.ts +330 -0
  26. package/build/cjs/src/modules/resource.d.ts.map +1 -0
  27. package/build/cjs/src/modules/resource.js +556 -0
  28. package/build/cjs/src/modules/resource.js.map +1 -0
  29. package/build/cjs/src/querier.d.ts +62 -0
  30. package/build/cjs/src/querier.d.ts.map +1 -0
  31. package/build/cjs/src/querier.js +87 -0
  32. package/build/cjs/src/querier.js.map +1 -0
  33. package/build/cjs/src/registry.d.ts +18 -0
  34. package/build/cjs/src/registry.d.ts.map +1 -0
  35. package/build/cjs/src/registry.js +23 -0
  36. package/build/cjs/src/registry.js.map +1 -0
  37. package/build/cjs/src/signer.d.ts +250 -0
  38. package/build/cjs/src/signer.d.ts.map +1 -0
  39. package/build/cjs/src/signer.js +617 -0
  40. package/build/cjs/src/signer.js.map +1 -0
  41. package/build/cjs/src/types.d.ts +221 -0
  42. package/build/cjs/src/types.d.ts.map +1 -0
  43. package/build/cjs/src/types.js.map +1 -0
  44. package/build/cjs/src/utils.d.ts +233 -0
  45. package/build/cjs/src/utils.d.ts.map +1 -0
  46. package/build/cjs/src/utils.js +571 -0
  47. package/build/cjs/src/utils.js.map +1 -0
  48. package/build/{index.d.ts → esm/src/index.d.ts} +7 -3
  49. package/build/esm/src/index.d.ts.map +1 -0
  50. package/build/{index.js → esm/src/index.js} +3 -1
  51. package/build/esm/src/index.js.map +1 -0
  52. package/build/esm/src/modules/_.d.ts.map +1 -0
  53. package/build/esm/src/modules/_.js.map +1 -0
  54. package/build/{modules → esm/src/modules}/did.d.ts +109 -7
  55. package/build/esm/src/modules/did.d.ts.map +1 -0
  56. package/build/{modules → esm/src/modules}/did.js +212 -6
  57. package/build/esm/src/modules/did.js.map +1 -0
  58. package/build/esm/src/modules/feeabstraction.d.ts.map +1 -0
  59. package/build/esm/src/modules/feeabstraction.js.map +1 -0
  60. package/build/esm/src/modules/feemarket.d.ts.map +1 -0
  61. package/build/esm/src/modules/feemarket.js.map +1 -0
  62. package/build/esm/src/modules/oracle.d.ts +563 -0
  63. package/build/esm/src/modules/oracle.d.ts.map +1 -0
  64. package/build/esm/src/modules/oracle.js +784 -0
  65. package/build/esm/src/modules/oracle.js.map +1 -0
  66. package/build/{modules → esm/src/modules}/resource.d.ts +132 -6
  67. package/build/esm/src/modules/resource.d.ts.map +1 -0
  68. package/build/esm/src/modules/resource.js +556 -0
  69. package/build/esm/src/modules/resource.js.map +1 -0
  70. package/build/esm/src/querier.d.ts.map +1 -0
  71. package/build/esm/src/querier.js.map +1 -0
  72. package/build/esm/src/registry.d.ts.map +1 -0
  73. package/build/esm/src/registry.js.map +1 -0
  74. package/build/esm/src/signer.d.ts.map +1 -0
  75. package/build/esm/src/signer.js.map +1 -0
  76. package/build/{types → esm/src}/types.d.ts +27 -1
  77. package/build/esm/src/types.d.ts.map +1 -0
  78. package/build/esm/src/types.js +43 -0
  79. package/build/esm/src/types.js.map +1 -0
  80. package/build/esm/src/utils.d.ts.map +1 -0
  81. package/build/esm/src/utils.js.map +1 -0
  82. package/build/types/cjs/src/index.d.ts +142 -0
  83. package/build/types/cjs/src/index.d.ts.map +1 -0
  84. package/build/types/cjs/src/modules/_.d.ts +81 -0
  85. package/build/types/cjs/src/modules/_.d.ts.map +1 -0
  86. package/build/types/cjs/src/modules/did.d.ts +488 -0
  87. package/build/types/cjs/src/modules/did.d.ts.map +1 -0
  88. package/build/types/cjs/src/modules/feeabstraction.d.ts +429 -0
  89. package/build/types/cjs/src/modules/feeabstraction.d.ts.map +1 -0
  90. package/build/types/cjs/src/modules/feemarket.d.ts +244 -0
  91. package/build/types/cjs/src/modules/feemarket.d.ts.map +1 -0
  92. package/build/types/cjs/src/modules/oracle.d.ts +563 -0
  93. package/build/types/cjs/src/modules/oracle.d.ts.map +1 -0
  94. package/build/types/cjs/src/modules/resource.d.ts +330 -0
  95. package/build/types/cjs/src/modules/resource.d.ts.map +1 -0
  96. package/build/types/cjs/src/querier.d.ts +62 -0
  97. package/build/types/cjs/src/querier.d.ts.map +1 -0
  98. package/build/types/cjs/src/registry.d.ts +18 -0
  99. package/build/types/cjs/src/registry.d.ts.map +1 -0
  100. package/build/types/cjs/src/signer.d.ts +250 -0
  101. package/build/types/cjs/src/signer.d.ts.map +1 -0
  102. package/build/types/cjs/src/types.d.ts +221 -0
  103. package/build/types/cjs/src/types.d.ts.map +1 -0
  104. package/build/types/cjs/src/utils.d.ts +233 -0
  105. package/build/types/cjs/src/utils.d.ts.map +1 -0
  106. package/build/types/{index.d.ts → esm/src/index.d.ts} +7 -3
  107. package/build/types/esm/src/index.d.ts.map +1 -0
  108. package/build/types/esm/src/modules/_.d.ts.map +1 -0
  109. package/build/types/{modules → esm/src/modules}/did.d.ts +109 -7
  110. package/build/types/esm/src/modules/did.d.ts.map +1 -0
  111. package/build/types/esm/src/modules/feeabstraction.d.ts.map +1 -0
  112. package/build/types/esm/src/modules/feemarket.d.ts.map +1 -0
  113. package/build/types/esm/src/modules/oracle.d.ts +563 -0
  114. package/build/types/esm/src/modules/oracle.d.ts.map +1 -0
  115. package/build/types/{modules → esm/src/modules}/resource.d.ts +132 -6
  116. package/build/types/esm/src/modules/resource.d.ts.map +1 -0
  117. package/build/types/esm/src/querier.d.ts.map +1 -0
  118. package/build/types/esm/src/registry.d.ts.map +1 -0
  119. package/build/types/esm/src/signer.d.ts.map +1 -0
  120. package/build/{types.d.ts → types/esm/src/types.d.ts} +27 -1
  121. package/build/types/esm/src/types.d.ts.map +1 -0
  122. package/build/types/esm/src/utils.d.ts.map +1 -0
  123. package/package.json +2 -2
  124. package/build/index.d.ts.map +0 -1
  125. package/build/index.js.map +0 -1
  126. package/build/modules/_.d.ts.map +0 -1
  127. package/build/modules/_.js.map +0 -1
  128. package/build/modules/did.d.ts.map +0 -1
  129. package/build/modules/did.js.map +0 -1
  130. package/build/modules/feeabstraction.d.ts.map +0 -1
  131. package/build/modules/feeabstraction.js.map +0 -1
  132. package/build/modules/feemarket.d.ts.map +0 -1
  133. package/build/modules/feemarket.js.map +0 -1
  134. package/build/modules/resource.d.ts.map +0 -1
  135. package/build/modules/resource.js +0 -297
  136. package/build/modules/resource.js.map +0 -1
  137. package/build/querier.d.ts.map +0 -1
  138. package/build/querier.js.map +0 -1
  139. package/build/registry.d.ts.map +0 -1
  140. package/build/registry.js.map +0 -1
  141. package/build/signer.d.ts.map +0 -1
  142. package/build/signer.js.map +0 -1
  143. package/build/types/index.d.ts.map +0 -1
  144. package/build/types/modules/_.d.ts.map +0 -1
  145. package/build/types/modules/did.d.ts.map +0 -1
  146. package/build/types/modules/feeabstraction.d.ts.map +0 -1
  147. package/build/types/modules/feemarket.d.ts.map +0 -1
  148. package/build/types/modules/resource.d.ts.map +0 -1
  149. package/build/types/querier.d.ts.map +0 -1
  150. package/build/types/registry.d.ts.map +0 -1
  151. package/build/types/signer.d.ts.map +0 -1
  152. package/build/types/types.d.ts.map +0 -1
  153. package/build/types/utils.d.ts.map +0 -1
  154. package/build/types.d.ts.map +0 -1
  155. package/build/types.js.map +0 -1
  156. package/build/utils.d.ts.map +0 -1
  157. package/build/utils.js.map +0 -1
  158. /package/build/{types.js → cjs/src/types.js} +0 -0
  159. /package/build/{modules → esm/src/modules}/_.d.ts +0 -0
  160. /package/build/{modules → esm/src/modules}/_.js +0 -0
  161. /package/build/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
  162. /package/build/{modules → esm/src/modules}/feeabstraction.js +0 -0
  163. /package/build/{modules → esm/src/modules}/feemarket.d.ts +0 -0
  164. /package/build/{modules → esm/src/modules}/feemarket.js +0 -0
  165. /package/build/{querier.d.ts → esm/src/querier.d.ts} +0 -0
  166. /package/build/{querier.js → esm/src/querier.js} +0 -0
  167. /package/build/{registry.d.ts → esm/src/registry.d.ts} +0 -0
  168. /package/build/{registry.js → esm/src/registry.js} +0 -0
  169. /package/build/{signer.d.ts → esm/src/signer.d.ts} +0 -0
  170. /package/build/{signer.js → esm/src/signer.js} +0 -0
  171. /package/build/{types → esm/src}/utils.d.ts +0 -0
  172. /package/build/{utils.js → esm/src/utils.js} +0 -0
  173. /package/build/types/{modules → esm/src/modules}/_.d.ts +0 -0
  174. /package/build/types/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
  175. /package/build/types/{modules → esm/src/modules}/feemarket.d.ts +0 -0
  176. /package/build/types/{querier.d.ts → esm/src/querier.d.ts} +0 -0
  177. /package/build/types/{registry.d.ts → esm/src/registry.d.ts} +0 -0
  178. /package/build/types/{signer.d.ts → esm/src/signer.d.ts} +0 -0
  179. /package/build/{utils.d.ts → types/esm/src/utils.d.ts} +0 -0
@@ -0,0 +1,87 @@
1
+ import { QueryClient } from '@cosmjs/stargate-cjs';
2
+ import { Tendermint37Client } from '@cosmjs/tendermint-rpc-cjs';
3
+ /**
4
+ * Extended QueryClient specifically designed for the Cheqd blockchain network.
5
+ * Provides enhanced querying capabilities with support for custom extensions
6
+ * and consensus parameter retrieval.
7
+ */
8
+ export class CheqdQuerier extends QueryClient {
9
+ /**
10
+ * Constructs a new CheqdQuerier instance with the provided Tendermint client.
11
+ *
12
+ * @param tmClient - Tendermint client (v34 or v37) for blockchain communication
13
+ */
14
+ constructor(tmClient) {
15
+ super(tmClient);
16
+ }
17
+ /**
18
+ * Retrieves the consensus parameters from the blockchain network.
19
+ * This method creates a temporary connection to fetch the latest block results
20
+ * and extract consensus update information.
21
+ *
22
+ * @param url - RPC URL of the blockchain node
23
+ * @returns Promise resolving to consensus parameters or undefined if not available
24
+ */
25
+ static async getConsensusParameters(url) {
26
+ // connect to comet rpc
27
+ const cometClient = await Tendermint37Client.connect(url);
28
+ // get block results
29
+ const result = await cometClient.blockResults();
30
+ // disconnect comet client
31
+ cometClient.disconnect();
32
+ // return consensus parameters
33
+ return result.consensusUpdates;
34
+ }
35
+ /**
36
+ * Creates a new CheqdQuerier instance by establishing a connection to the specified RPC URL.
37
+ * This is the primary method for creating a querier instance for blockchain communication.
38
+ *
39
+ * @param url - RPC URL of the blockchain node to connect to
40
+ * @returns Promise resolving to a connected CheqdQuerier instance
41
+ */
42
+ static async connect(url) {
43
+ const tmClient = await Tendermint37Client.connect(url);
44
+ return new CheqdQuerier(tmClient);
45
+ }
46
+ /**
47
+ * Creates a CheqdQuerier instance from an existing Tendermint client.
48
+ * Useful when you already have an established client connection.
49
+ *
50
+ * @param client - Existing Tendermint client (v34 or v37)
51
+ * @returns Promise resolving to a CheqdQuerier instance using the provided client
52
+ */
53
+ static async fromClient(client) {
54
+ return new CheqdQuerier(client);
55
+ }
56
+ /**
57
+ * Creates a CheqdQuerier instance with a single query extension.
58
+ * Extensions provide specialized query capabilities for specific blockchain modules.
59
+ *
60
+ * @param url - RPC URL of the blockchain node to connect to
61
+ * @param extension - Query extension setup to add specialized query functionality
62
+ * @returns Promise resolving to a CheqdQuerier instance with the specified extension
63
+ */
64
+ static async connectWithExtension(url, extension) {
65
+ const tmClient = await Tendermint37Client.connect(url);
66
+ return CheqdQuerier.withExtensions(tmClient, extension);
67
+ }
68
+ /**
69
+ * Creates a CheqdQuerier instance with multiple query extensions.
70
+ * This method supports adding multiple specialized query capabilities for different
71
+ * blockchain modules in a single operation. For single extensions, it delegates
72
+ * to connectWithExtension for efficiency.
73
+ *
74
+ * @param url - RPC URL of the blockchain node to connect to
75
+ * @param extensions - Variable number of query extension setups to add functionality
76
+ * @returns Promise resolving to a CheqdQuerier instance with all specified extensions
77
+ */
78
+ static async connectWithExtensions(url, ...extensions) {
79
+ if (extensions.length === 1) {
80
+ return CheqdQuerier.connectWithExtension(url, extensions[0]);
81
+ }
82
+ const tmClient = await Tendermint37Client.connect(url);
83
+ const tupleLike = extensions;
84
+ return CheqdQuerier.withExtensions(tmClient, ...tupleLike);
85
+ }
86
+ }
87
+ //# sourceMappingURL=querier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"querier.js","sourceRoot":"","sources":["../../../../cjs/src/querier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAsB,kBAAkB,EAAmB,MAAM,4BAA4B,CAAC;AAGrG;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC5C;;;;OAIG;IACH,YAAY,QAAiD;QAC5D,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjB,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC,GAAW;QAC9C,uBAAuB;QACvB,MAAM,WAAW,GAAG,MAAM,kBAAkB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AC;CACD"}
@@ -0,0 +1,18 @@
1
+ import { Registry, GeneratedType } from '@cosmjs/proto-signing-cjs';
2
+ /**
3
+ * Creates a default Cheqd registry with optional custom types.
4
+ * The registry is used for encoding and decoding protobuf messages in blockchain transactions.
5
+ * It includes all default Stargate types and any additional custom types provided.
6
+ *
7
+ * @param customTypes - Optional iterable of custom type mappings to add to the registry.
8
+ * Each entry should be a tuple of [typeUrl, GeneratedType].
9
+ * @returns A configured Registry instance with default and custom types
10
+ */
11
+ export declare function createDefaultCheqdRegistry(customTypes?: Iterable<[string, GeneratedType]>): Registry;
12
+ /**
13
+ * Pre-configured Cheqd registry instance with default Stargate types.
14
+ * This is a ready-to-use registry for basic blockchain operations that don't require
15
+ * custom message types. For applications needing custom types, use createDefaultCheqdRegistry instead.
16
+ */
17
+ export declare const CheqdRegistry: Registry;
18
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../cjs/src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAIpE;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,QAAQ,CAGpG;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,UAAqC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Registry } from '@cosmjs/proto-signing-cjs';
2
+ import { defaultRegistryTypes } from '@cosmjs/stargate-cjs';
3
+ /**
4
+ * Creates a default Cheqd registry with optional custom types.
5
+ * The registry is used for encoding and decoding protobuf messages in blockchain transactions.
6
+ * It includes all default Stargate types and any additional custom types provided.
7
+ *
8
+ * @param customTypes - Optional iterable of custom type mappings to add to the registry.
9
+ * Each entry should be a tuple of [typeUrl, GeneratedType].
10
+ * @returns A configured Registry instance with default and custom types
11
+ */
12
+ export function createDefaultCheqdRegistry(customTypes) {
13
+ if (!customTypes)
14
+ customTypes = [];
15
+ return new Registry([...defaultRegistryTypes, ...customTypes]);
16
+ }
17
+ /**
18
+ * Pre-configured Cheqd registry instance with default Stargate types.
19
+ * This is a ready-to-use registry for basic blockchain operations that don't require
20
+ * custom message types. For applications needing custom types, use createDefaultCheqdRegistry instead.
21
+ */
22
+ export const CheqdRegistry = new Registry(defaultRegistryTypes);
23
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../cjs/src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAiB,MAAM,2BAA2B,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,UAAU,0BAA0B,CAAC,WAA+C;IACzF,IAAI,CAAC,WAAW;QAAE,WAAW,GAAG,EAAE,CAAC;IACnC,OAAO,IAAI,QAAQ,CAAC,CAAC,GAAG,oBAAoB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,QAAQ,CAAC,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,250 @@
1
+ import { EncodeObject, OfflineSigner } from '@cosmjs/proto-signing-cjs';
2
+ import { DeliverTxResponse, GasPrice, HttpEndpoint, SigningStargateClient, SigningStargateClientOptions, SignerData } from '@cosmjs/stargate-cjs';
3
+ import { Tendermint37Client } from '@cosmjs/tendermint-rpc-cjs';
4
+ import { MsgCreateDidDocPayload, SignInfo, MsgUpdateDidDocPayload, MsgDeactivateDidDocPayload, VerificationMethod } from '@cheqd/ts-proto-cjs/cheqd/did/v2';
5
+ import { DIDDocument, DidStdFee, ISignInputs, MessageBatch, TSignerAlgo, TxExtension } from './types';
6
+ import { Signer } from 'did-jwt-cjs';
7
+ import { SignerInfo, TxRaw } from 'cosmjs-types-cjs/cosmos/tx/v1beta1/tx';
8
+ import { SignMode } from 'cosmjs-types-cjs/cosmos/tx/signing/v1beta1/signing';
9
+ import { Any } from 'cosmjs-types-cjs/google/protobuf/any';
10
+ import { Coin } from 'cosmjs-types-cjs/cosmos/base/v1beta1/coin';
11
+ import { CheqdQuerier } from './querier';
12
+ /**
13
+ * Calculates the transaction fee for DID operations using gas limit and gas price.
14
+ *
15
+ * @param gasLimit - Maximum amount of gas units that can be consumed by the transaction
16
+ * @param gasPrice - Price per gas unit, either as a string or GasPrice object
17
+ * @returns DidStdFee object containing the calculated fee structure
18
+ */
19
+ export declare function calculateDidFee(gasLimit: number, gasPrice: string | GasPrice): DidStdFee;
20
+ /**
21
+ * Creates SignerInfo objects for transaction authentication from signer data.
22
+ * Each signer info contains the public key, sequence number, and signing mode.
23
+ *
24
+ * @param signers - Array of signer objects containing public keys and sequence numbers
25
+ * @param signMode - Signing mode to use (e.g., SIGN_MODE_DIRECT)
26
+ * @returns Array of SignerInfo objects for transaction authentication
27
+ */
28
+ export declare function makeSignerInfos(signers: ReadonlyArray<{
29
+ readonly pubkey: Any;
30
+ readonly sequence: number;
31
+ }>, signMode: SignMode): SignerInfo[];
32
+ /**
33
+ * Creates encoded AuthInfo bytes for DID transactions with fee payer support.
34
+ * The AuthInfo contains signer information, fee details, and gas limit.
35
+ *
36
+ * @param signers - Array of signer objects with public keys and sequence numbers
37
+ * @param feeAmount - Array of coins representing the transaction fee
38
+ * @param gasLimit - Maximum gas units that can be consumed
39
+ * @param feePayer - Address of the account paying the transaction fees
40
+ * @param signMode - Signing mode to use, defaults to SIGN_MODE_DIRECT
41
+ * @returns Encoded AuthInfo as Uint8Array for transaction construction
42
+ */
43
+ export declare function makeDidAuthInfoBytes(signers: ReadonlyArray<{
44
+ readonly pubkey: Any;
45
+ readonly sequence: number;
46
+ }>, feeAmount: readonly Coin[], gasLimit: number, feePayer: string, signMode?: SignMode): Uint8Array;
47
+ /**
48
+ * Extended SigningStargateClient specifically designed for Cheqd blockchain operations.
49
+ * Provides enhanced transaction signing, broadcasting, and DID-specific functionality
50
+ * with support for custom fee payers and advanced retry mechanisms.
51
+ */
52
+ export declare class CheqdSigningStargateClient extends SigningStargateClient {
53
+ /** Map of DID signing algorithms for different verification method types */
54
+ private didSigners;
55
+ /** Gas price configuration for transaction fee calculation */
56
+ private readonly _gasPrice;
57
+ /** Offline signer instance for transaction signing */
58
+ private readonly _signer;
59
+ /** RPC endpoint URL for blockchain communication */
60
+ private readonly endpoint?;
61
+ /** Maximum gas limit allowed for transactions */
62
+ static readonly maxGasLimit: number;
63
+ /**
64
+ * Creates a new CheqdSigningStargateClient by establishing a connection to the specified endpoint.
65
+ * This is the primary factory method for creating a signing client instance.
66
+ *
67
+ * @param endpoint - RPC endpoint URL or HttpEndpoint object to connect to
68
+ * @param signer - Offline signer for transaction signing
69
+ * @param options - Additional client configuration options including registry and gas price
70
+ * @returns Promise resolving to a connected CheqdSigningStargateClient instance
71
+ */
72
+ static connectWithSigner(endpoint: string | HttpEndpoint, signer: OfflineSigner, options?: (SigningStargateClientOptions & {
73
+ endpoint?: string;
74
+ }) | undefined): Promise<CheqdSigningStargateClient>;
75
+ /**
76
+ * Constructs a new CheqdSigningStargateClient instance with the provided Comet client and signer.
77
+ *
78
+ * @param cometClient - Tendermint client for blockchain communication
79
+ * @param signer - Offline signer for transaction signing
80
+ * @param options - Additional configuration options including registry, gas price, and endpoint
81
+ */
82
+ constructor(cometClient: Tendermint37Client | undefined, signer: OfflineSigner, options?: SigningStargateClientOptions & {
83
+ endpoint?: string;
84
+ });
85
+ /**
86
+ * Signs and broadcasts a transaction to the blockchain network.
87
+ * Supports automatic fee calculation and custom fee payer functionality.
88
+ *
89
+ * @param signerAddress - Address of the account signing the transaction
90
+ * @param messages - Array of messages to include in the transaction
91
+ * @param fee - Fee configuration: 'auto' for automatic calculation, number for multiplier, or DidStdFee object
92
+ * @param memo - Optional transaction memo string
93
+ * @returns Promise resolving to DeliverTxResponse with transaction results
94
+ * @throws Error if gas price is not set when using automatic fee calculation
95
+ */
96
+ signAndBroadcast(signerAddress: string, messages: readonly EncodeObject[], fee: DidStdFee | 'auto' | number, memo?: string): Promise<DeliverTxResponse>;
97
+ /**
98
+ * Signs a transaction without broadcasting it to the network.
99
+ * Creates a signed transaction that can be broadcast later.
100
+ *
101
+ * @param signerAddress - Address of the account signing the transaction
102
+ * @param messages - Array of messages to include in the transaction
103
+ * @param fee - Fee configuration for the transaction
104
+ * @param memo - Transaction memo string
105
+ * @param explicitSignerData - Optional explicit signer data to avoid querying the chain
106
+ * @returns Promise resolving to TxRaw containing the signed transaction
107
+ */
108
+ sign(signerAddress: string, messages: readonly EncodeObject[], fee: DidStdFee, memo: string, explicitSignerData?: SignerData): Promise<TxRaw>;
109
+ /**
110
+ * Internal method for direct signing of transactions using SIGN_MODE_DIRECT.
111
+ * Handles the low-level transaction construction and signing process.
112
+ *
113
+ * @param signerAddress - Address of the account signing the transaction
114
+ * @param messages - Array of messages to include in the transaction
115
+ * @param fee - Fee configuration for the transaction
116
+ * @param memo - Transaction memo string
117
+ * @param signerData - Account data including number, sequence, and chain ID
118
+ * @returns Promise resolving to TxRaw containing the signed transaction
119
+ * @private
120
+ */
121
+ private _signDirect;
122
+ /**
123
+ * Broadcasts a signed transaction to the network and monitors its inclusion in a block,
124
+ * with support for retrying on failure and graceful timeout handling.
125
+ *
126
+ * ## Optimizations over base implementation:
127
+ * - Implements a retry policy (`maxRetries`, default: 3) to handle transient broadcast errors.
128
+ * - Prevents double spend by reusing the exact same signed transaction (immutable `Uint8Array`).
129
+ * - Tracks and returns the last known transaction hash (`txId`), even in the case of timeout or failure.
130
+ * - Throws a `TimeoutError` if the transaction is not found within `timeoutMs`, attaching the `txHash` if known.
131
+ * - Polling frequency and timeout are customizable via `pollIntervalMs` and `timeoutMs` parameters.
132
+ *
133
+ * @param tx - The signed transaction bytes to broadcast.
134
+ * @param timeoutMs - Maximum duration (in milliseconds) to wait for block inclusion. Defaults to 60,000 ms.
135
+ * @param pollIntervalMs - Polling interval (in milliseconds) when checking for transaction inclusion. Defaults to 3,000 ms.
136
+ * @param maxRetries - Maximum number of times to retry `broadcastTxSync` on failure. Defaults to 3.
137
+ *
138
+ * @returns A `Promise` that resolves to `DeliverTxResponse` upon successful inclusion in a block.
139
+ * @throws `BroadcastTxError` if the transaction is rejected by the node during CheckTx.
140
+ * @throws `TimeoutError` if the transaction is not found on-chain within the timeout window. Includes `txHash` if available.
141
+ */
142
+ broadcastTx(tx: Uint8Array, timeoutMs?: number, pollIntervalMs?: number, maxRetries?: number): Promise<DeliverTxResponse>;
143
+ /**
144
+ * Broadcasts a signed transaction to the network without monitoring it.
145
+ * Returns the transaction hash immediately after broadcast submission.
146
+ *
147
+ * If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
148
+ * an error is thrown.
149
+ *
150
+ * If the transaction is broadcasted, a `string` containing the hash of the transaction is returned. The caller then
151
+ * usually needs to check if the transaction was included in a block and was successful.
152
+ *
153
+ * @param tx - Signed transaction bytes to broadcast
154
+ * @returns Promise resolving to the hash of the transaction
155
+ * @throws BroadcastTxError if the transaction is rejected during CheckTx
156
+ */
157
+ broadcastTxSync(tx: Uint8Array): Promise<string>;
158
+ /**
159
+ * Simulates transaction execution to estimate gas usage.
160
+ * Uses the configured endpoint to query the blockchain for gas estimation.
161
+ *
162
+ * @param signerAddress - Address of the account that would sign the transaction
163
+ * @param messages - Array of messages to simulate
164
+ * @param memo - Transaction memo string
165
+ * @returns Promise resolving to the estimated gas units required
166
+ * @throws Error if endpoint is not configured
167
+ */
168
+ simulate(signerAddress: string, messages: readonly EncodeObject[], memo: string | undefined): Promise<number>;
169
+ /**
170
+ * Constructs a transaction extension object for simulation and query operations.
171
+ * Provides methods for transaction simulation and retrieval.
172
+ *
173
+ * @param querier - CheqdQuerier instance for blockchain communication
174
+ * @returns Promise resolving to TxExtension with simulation and query capabilities
175
+ */
176
+ constructSimulateExtension(querier: CheqdQuerier): Promise<TxExtension>;
177
+ /**
178
+ * Batches multiple messages into optimal groups based on gas limits.
179
+ * Simulates each message individually and groups them to maximize throughput
180
+ * while staying within gas constraints.
181
+ *
182
+ * @param messages - Array of messages to batch
183
+ * @param signerAddress - Address of the account that will sign the transactions
184
+ * @param memo - Optional transaction memo
185
+ * @param maxGasLimit - Maximum gas limit per batch, defaults to 30,000,000
186
+ * @returns Promise resolving to MessageBatch with grouped messages and gas estimates
187
+ */
188
+ batchMessages(messages: readonly EncodeObject[], signerAddress: string, memo?: string, maxGasLimit?: number): Promise<MessageBatch>;
189
+ /**
190
+ * Validates and initializes DID signers for the provided verification methods.
191
+ * Ensures that all verification method types are supported and assigns appropriate signers.
192
+ *
193
+ * @param verificationMethods - Array of verification methods to validate
194
+ * @returns Promise resolving to the configured signer algorithm map
195
+ * @throws Error if no verification methods are provided or unsupported types are found
196
+ */
197
+ checkDidSigners(verificationMethods?: Partial<VerificationMethod>[]): Promise<TSignerAlgo>;
198
+ /**
199
+ * Retrieves the appropriate DID signer for a specific verification method.
200
+ * Looks up the verification method by ID and returns the corresponding signer function.
201
+ *
202
+ * @param verificationMethodId - ID of the verification method to get signer for
203
+ * @param verificationMethods - Array of available verification methods
204
+ * @returns Promise resolving to a signer function that takes a secret key
205
+ * @throws Error if the verification method is not found
206
+ */
207
+ getDidSigner(verificationMethodId: string, verificationMethods: Partial<VerificationMethod>[]): Promise<(secretKey: Uint8Array) => Signer>;
208
+ /**
209
+ * Signs a CreateDidDoc transaction payload using the provided signing inputs.
210
+ * Validates verification methods and creates signatures for each signing input.
211
+ *
212
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
213
+ * @param payload - CreateDidDoc payload to sign
214
+ * @returns Promise resolving to array of SignInfo objects with signatures
215
+ */
216
+ signCreateDidDocTx(signInputs: ISignInputs[], payload: MsgCreateDidDocPayload): Promise<SignInfo[]>;
217
+ /**
218
+ * Signs an UpdateDidDoc transaction payload using the provided signing inputs.
219
+ * Handles complex verification method resolution including external controllers
220
+ * and previous DID document verification methods.
221
+ *
222
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
223
+ * @param payload - UpdateDidDoc payload to sign
224
+ * @param externalControllers - Optional external controller DID documents
225
+ * @param previousDidDocument - Optional previous version of the DID document
226
+ * @returns Promise resolving to array of SignInfo objects with signatures
227
+ */
228
+ signUpdateDidDocTx(signInputs: ISignInputs[], payload: MsgUpdateDidDocPayload, externalControllers?: DIDDocument[], previousDidDocument?: DIDDocument): Promise<SignInfo[]>;
229
+ /**
230
+ * Signs a DeactivateDidDoc transaction payload using the provided signing inputs.
231
+ * Validates verification methods and creates signatures for DID deactivation.
232
+ *
233
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
234
+ * @param payload - DeactivateDidDoc payload to sign
235
+ * @param verificationMethod - Array of verification methods for signature validation
236
+ * @returns Promise resolving to array of SignInfo objects with signatures
237
+ */
238
+ signDeactivateDidDocTx(signInputs: ISignInputs[], payload: MsgDeactivateDidDocPayload, verificationMethod: VerificationMethod[]): Promise<SignInfo[]>;
239
+ /**
240
+ * Static method for signing identity transactions with multiple key types.
241
+ * Supports Ed25519, Secp256k1, and P256 signature algorithms.
242
+ *
243
+ * @param signBytes - Raw bytes to sign
244
+ * @param signInputs - Array of signing inputs with key types and private keys
245
+ * @returns Promise resolving to array of SignInfo objects with signatures
246
+ * @throws Error if key type is undefined or unsupported
247
+ */
248
+ static signIdentityTx(signBytes: Uint8Array, signInputs: ISignInputs[]): Promise<SignInfo[]>;
249
+ }
250
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../../cjs/src/signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EAEZ,aAAa,EAIb,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACN,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,qBAAqB,EACrB,4BAA4B,EAE5B,UAAU,EAIV,MAAM,sBAAsB,CAAC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