@cheqd/sdk 5.3.2 → 5.3.3-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 (112) hide show
  1. package/README.md +310 -0
  2. package/build/cjs/index.d.ts +92 -1
  3. package/build/cjs/index.d.ts.map +1 -1
  4. package/build/cjs/index.js +75 -2
  5. package/build/cjs/index.js.map +1 -1
  6. package/build/cjs/modules/_.d.ts +61 -0
  7. package/build/cjs/modules/_.d.ts.map +1 -1
  8. package/build/cjs/modules/_.js +50 -0
  9. package/build/cjs/modules/_.js.map +1 -1
  10. package/build/cjs/modules/did.d.ts +278 -0
  11. package/build/cjs/modules/did.d.ts.map +1 -1
  12. package/build/cjs/modules/did.js +242 -0
  13. package/build/cjs/modules/did.js.map +1 -1
  14. package/build/cjs/modules/feeabstraction.d.ts +297 -2
  15. package/build/cjs/modules/feeabstraction.d.ts.map +1 -1
  16. package/build/cjs/modules/feeabstraction.js +235 -4
  17. package/build/cjs/modules/feeabstraction.js.map +1 -1
  18. package/build/cjs/modules/feemarket.d.ts +154 -21
  19. package/build/cjs/modules/feemarket.d.ts.map +1 -1
  20. package/build/cjs/modules/feemarket.js +133 -22
  21. package/build/cjs/modules/feemarket.js.map +1 -1
  22. package/build/cjs/modules/resource.d.ts +143 -0
  23. package/build/cjs/modules/resource.d.ts.map +1 -1
  24. package/build/cjs/modules/resource.js +131 -0
  25. package/build/cjs/modules/resource.js.map +1 -1
  26. package/build/cjs/querier.d.ts +50 -0
  27. package/build/cjs/querier.d.ts.map +1 -1
  28. package/build/cjs/querier.js +50 -0
  29. package/build/cjs/querier.js.map +1 -1
  30. package/build/cjs/registry.d.ts +14 -0
  31. package/build/cjs/registry.d.ts.map +1 -1
  32. package/build/cjs/registry.js +14 -0
  33. package/build/cjs/registry.js.map +1 -1
  34. package/build/cjs/signer.d.ts +172 -1
  35. package/build/cjs/signer.d.ts.map +1 -1
  36. package/build/cjs/signer.js +172 -1
  37. package/build/cjs/signer.js.map +1 -1
  38. package/build/cjs/types.d.ts +91 -0
  39. package/build/cjs/types.d.ts.map +1 -1
  40. package/build/cjs/types.js +17 -0
  41. package/build/cjs/types.js.map +1 -1
  42. package/build/cjs/utils.d.ts +191 -3
  43. package/build/cjs/utils.d.ts.map +1 -1
  44. package/build/cjs/utils.js +196 -0
  45. package/build/cjs/utils.js.map +1 -1
  46. package/build/esm/index.d.ts +92 -1
  47. package/build/esm/index.d.ts.map +1 -1
  48. package/build/esm/index.js +74 -1
  49. package/build/esm/index.js.map +1 -1
  50. package/build/esm/modules/_.d.ts +42 -0
  51. package/build/esm/modules/_.d.ts.map +1 -1
  52. package/build/esm/modules/_.js +32 -0
  53. package/build/esm/modules/_.js.map +1 -1
  54. package/build/esm/modules/did.d.ts +274 -0
  55. package/build/esm/modules/did.d.ts.map +1 -1
  56. package/build/esm/modules/did.js +242 -0
  57. package/build/esm/modules/did.js.map +1 -1
  58. package/build/esm/modules/feeabstraction.d.ts +277 -2
  59. package/build/esm/modules/feeabstraction.d.ts.map +1 -1
  60. package/build/esm/modules/feeabstraction.js +221 -2
  61. package/build/esm/modules/feeabstraction.js.map +1 -1
  62. package/build/esm/modules/feemarket.d.ts +152 -21
  63. package/build/esm/modules/feemarket.d.ts.map +1 -1
  64. package/build/esm/modules/feemarket.js +131 -21
  65. package/build/esm/modules/feemarket.js.map +1 -1
  66. package/build/esm/modules/resource.d.ts +142 -0
  67. package/build/esm/modules/resource.d.ts.map +1 -1
  68. package/build/esm/modules/resource.js +130 -0
  69. package/build/esm/modules/resource.js.map +1 -1
  70. package/build/esm/querier.d.ts +50 -0
  71. package/build/esm/querier.d.ts.map +1 -1
  72. package/build/esm/querier.js +50 -0
  73. package/build/esm/querier.js.map +1 -1
  74. package/build/esm/registry.d.ts +14 -0
  75. package/build/esm/registry.d.ts.map +1 -1
  76. package/build/esm/registry.js +14 -0
  77. package/build/esm/registry.js.map +1 -1
  78. package/build/esm/signer.d.ts +122 -0
  79. package/build/esm/signer.d.ts.map +1 -1
  80. package/build/esm/signer.js +122 -0
  81. package/build/esm/signer.js.map +1 -1
  82. package/build/esm/types.d.ts +92 -0
  83. package/build/esm/types.d.ts.map +1 -1
  84. package/build/esm/types.js +17 -0
  85. package/build/esm/types.js.map +1 -1
  86. package/build/esm/utils.d.ts +181 -3
  87. package/build/esm/utils.d.ts.map +1 -1
  88. package/build/esm/utils.js +172 -0
  89. package/build/esm/utils.js.map +1 -1
  90. package/build/types/index.d.ts +92 -1
  91. package/build/types/index.d.ts.map +1 -1
  92. package/build/types/modules/_.d.ts +42 -0
  93. package/build/types/modules/_.d.ts.map +1 -1
  94. package/build/types/modules/did.d.ts +274 -0
  95. package/build/types/modules/did.d.ts.map +1 -1
  96. package/build/types/modules/feeabstraction.d.ts +277 -2
  97. package/build/types/modules/feeabstraction.d.ts.map +1 -1
  98. package/build/types/modules/feemarket.d.ts +152 -21
  99. package/build/types/modules/feemarket.d.ts.map +1 -1
  100. package/build/types/modules/resource.d.ts +142 -0
  101. package/build/types/modules/resource.d.ts.map +1 -1
  102. package/build/types/querier.d.ts +50 -0
  103. package/build/types/querier.d.ts.map +1 -1
  104. package/build/types/registry.d.ts +14 -0
  105. package/build/types/registry.d.ts.map +1 -1
  106. package/build/types/signer.d.ts +122 -0
  107. package/build/types/signer.d.ts.map +1 -1
  108. package/build/types/types.d.ts +92 -0
  109. package/build/types/types.d.ts.map +1 -1
  110. package/build/types/utils.d.ts +181 -3
  111. package/build/types/utils.d.ts.map +1 -1
  112. package/package.json +4 -4
@@ -1,4 +1,18 @@
1
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
+ */
2
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
+ */
3
17
  export declare const CheqdRegistry: Registry;
4
18
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +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,wBAAgB,0BAA0B,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,QAAQ,CAGpG;AAED,eAAO,MAAM,aAAa,UAAqC,CAAC"}
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"}
@@ -4,10 +4,24 @@ exports.CheqdRegistry = void 0;
4
4
  exports.createDefaultCheqdRegistry = createDefaultCheqdRegistry;
5
5
  const proto_signing_cjs_1 = require("@cosmjs/proto-signing-cjs");
6
6
  const stargate_cjs_1 = require("@cosmjs/stargate-cjs");
7
+ /**
8
+ * Creates a default Cheqd registry with optional custom types.
9
+ * The registry is used for encoding and decoding protobuf messages in blockchain transactions.
10
+ * It includes all default Stargate types and any additional custom types provided.
11
+ *
12
+ * @param customTypes - Optional iterable of custom type mappings to add to the registry.
13
+ * Each entry should be a tuple of [typeUrl, GeneratedType].
14
+ * @returns A configured Registry instance with default and custom types
15
+ */
7
16
  function createDefaultCheqdRegistry(customTypes) {
8
17
  if (!customTypes)
9
18
  customTypes = [];
10
19
  return new proto_signing_cjs_1.Registry([...stargate_cjs_1.defaultRegistryTypes, ...customTypes]);
11
20
  }
21
+ /**
22
+ * Pre-configured Cheqd registry instance with default Stargate types.
23
+ * This is a ready-to-use registry for basic blockchain operations that don't require
24
+ * custom message types. For applications needing custom types, use createDefaultCheqdRegistry instead.
25
+ */
12
26
  exports.CheqdRegistry = new proto_signing_cjs_1.Registry(stargate_cjs_1.defaultRegistryTypes);
13
27
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../cjs/src/registry.ts"],"names":[],"mappings":";;;AAIA,gEAGC;AAPD,iEAAoE;AAEpE,uDAA4D;AAE5D,SAAgB,0BAA0B,CAAC,WAA+C;IACzF,IAAI,CAAC,WAAW;QAAE,WAAW,GAAG,EAAE,CAAC;IACnC,OAAO,IAAI,4BAAQ,CAAC,CAAC,GAAG,mCAAoB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;AAChE,CAAC;AAEY,QAAA,aAAa,GAAG,IAAI,4BAAQ,CAAC,mCAAoB,CAAC,CAAC"}
1
+ {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../cjs/src/registry.ts"],"names":[],"mappings":";;;AAaA,gEAGC;AAhBD,iEAAoE;AAEpE,uDAA4D;AAE5D;;;;;;;;GAQG;AACH,SAAgB,0BAA0B,CAAC,WAA+C;IACzF,IAAI,CAAC,WAAW;QAAE,WAAW,GAAG,EAAE,CAAC;IACnC,OAAO,IAAI,4BAAQ,CAAC,CAAC,GAAG,mCAAoB,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;GAIG;AACU,QAAA,aAAa,GAAG,IAAI,4BAAQ,CAAC,mCAAoB,CAAC,CAAC"}
@@ -9,29 +9,115 @@ import { SignMode } from 'cosmjs-types-cjs/cosmos/tx/signing/v1beta1/signing';
9
9
  import { Any } from 'cosmjs-types-cjs/google/protobuf/any';
10
10
  import { Coin } from 'cosmjs-types-cjs/cosmos/base/v1beta1/coin';
11
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
+ */
12
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
+ */
13
28
  export declare function makeSignerInfos(signers: ReadonlyArray<{
14
29
  readonly pubkey: Any;
15
30
  readonly sequence: number;
16
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
+ */
17
43
  export declare function makeDidAuthInfoBytes(signers: ReadonlyArray<{
18
44
  readonly pubkey: Any;
19
45
  readonly sequence: number;
20
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
+ */
21
52
  export declare class CheqdSigningStargateClient extends SigningStargateClient {
53
+ /** Map of DID signing algorithms for different verification method types */
22
54
  private didSigners;
55
+ /** Gas price configuration for transaction fee calculation */
23
56
  private readonly _gasPrice;
57
+ /** Offline signer instance for transaction signing */
24
58
  private readonly _signer;
59
+ /** RPC endpoint URL for blockchain communication */
25
60
  private readonly endpoint?;
61
+ /** Maximum gas limit allowed for transactions */
26
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
+ */
27
72
  static connectWithSigner(endpoint: string | HttpEndpoint, signer: OfflineSigner, options?: (SigningStargateClientOptions & {
28
73
  endpoint?: string;
29
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
+ */
30
82
  constructor(cometClient: Tendermint37Client | undefined, signer: OfflineSigner, options?: SigningStargateClientOptions & {
31
83
  endpoint?: string;
32
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
+ */
33
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
+ */
34
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
+ */
35
121
  private _signDirect;
36
122
  /**
37
123
  * Broadcasts a signed transaction to the network and monitors its inclusion in a block,
@@ -56,6 +142,7 @@ export declare class CheqdSigningStargateClient extends SigningStargateClient {
56
142
  broadcastTx(tx: Uint8Array, timeoutMs?: number, pollIntervalMs?: number, maxRetries?: number): Promise<DeliverTxResponse>;
57
143
  /**
58
144
  * Broadcasts a signed transaction to the network without monitoring it.
145
+ * Returns the transaction hash immediately after broadcast submission.
59
146
  *
60
147
  * If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
61
148
  * an error is thrown.
@@ -63,17 +150,101 @@ export declare class CheqdSigningStargateClient extends SigningStargateClient {
63
150
  * If the transaction is broadcasted, a `string` containing the hash of the transaction is returned. The caller then
64
151
  * usually needs to check if the transaction was included in a block and was successful.
65
152
  *
66
- * @returns Returns the hash of the transaction
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
67
156
  */
68
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
+ */
69
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
+ */
70
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
+ */
71
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
+ */
72
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
+ */
73
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
+ */
74
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
+ */
75
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
+ */
76
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
+ */
77
248
  static signIdentityTx(signBytes: Uint8Array, signInputs: ISignInputs[]): Promise<SignInfo[]>;
78
249
  }
79
250
  //# sourceMappingURL=signer.d.ts.map
@@ -1 +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;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EACN,sBAAsB,EACtB,QAAQ,EACR,sBAAsB,EACtB,0BAA0B,EAC1B,kBAAkB,EAElB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACN,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,WAAW,EAEX,MAAM,SAAS,CAAC;AACjB,OAAO,EAA0C,MAAM,EAA6B,MAAM,aAAa,CAAC;AAKxG,OAAO,EAAY,UAAU,EAAE,KAAK,EAAE,MAAM,uCAAuC,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,oDAAoD,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,sCAAsC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,2CAA2C,CAAC;AAEjE,OAAO,EAAE,YAAY,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types-cjs/cosmos/tx/v1beta1/service");
27
27
  const tx_js_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx.js");
28
+ /**
29
+ * Calculates the transaction fee for DID operations using gas limit and gas price.
30
+ *
31
+ * @param gasLimit - Maximum amount of gas units that can be consumed by the transaction
32
+ * @param gasPrice - Price per gas unit, either as a string or GasPrice object
33
+ * @returns DidStdFee object containing the calculated fee structure
34
+ */
28
35
  function calculateDidFee(gasLimit, gasPrice) {
29
36
  return (0, stargate_cjs_1.calculateFee)(gasLimit, gasPrice);
30
37
  }
38
+ /**
39
+ * Creates SignerInfo objects for transaction authentication from signer data.
40
+ * Each signer info contains the public key, sequence number, and signing mode.
41
+ *
42
+ * @param signers - Array of signer objects containing public keys and sequence numbers
43
+ * @param signMode - Signing mode to use (e.g., SIGN_MODE_DIRECT)
44
+ * @returns Array of SignerInfo objects for transaction authentication
45
+ */
31
46
  function makeSignerInfos(signers, signMode) {
32
47
  return signers.map(({ pubkey, sequence }) => ({
33
48
  publicKey: pubkey,
@@ -37,6 +52,17 @@ function makeSignerInfos(signers, signMode) {
37
52
  sequence: long_cjs_1.default.fromNumber(sequence),
38
53
  }));
39
54
  }
55
+ /**
56
+ * Creates encoded AuthInfo bytes for DID transactions with fee payer support.
57
+ * The AuthInfo contains signer information, fee details, and gas limit.
58
+ *
59
+ * @param signers - Array of signer objects with public keys and sequence numbers
60
+ * @param feeAmount - Array of coins representing the transaction fee
61
+ * @param gasLimit - Maximum gas units that can be consumed
62
+ * @param feePayer - Address of the account paying the transaction fees
63
+ * @param signMode - Signing mode to use, defaults to SIGN_MODE_DIRECT
64
+ * @returns Encoded AuthInfo as Uint8Array for transaction construction
65
+ */
40
66
  function makeDidAuthInfoBytes(signers, feeAmount, gasLimit, feePayer, signMode = signing_1.SignMode.SIGN_MODE_DIRECT) {
41
67
  const authInfo = {
42
68
  signerInfos: makeSignerInfos(signers, signMode),
@@ -48,12 +74,31 @@ function makeDidAuthInfoBytes(signers, feeAmount, gasLimit, feePayer, signMode =
48
74
  };
49
75
  return tx_1.AuthInfo.encode(tx_1.AuthInfo.fromPartial(authInfo)).finish();
50
76
  }
77
+ /**
78
+ * Extended SigningStargateClient specifically designed for Cheqd blockchain operations.
79
+ * Provides enhanced transaction signing, broadcasting, and DID-specific functionality
80
+ * with support for custom fee payers and advanced retry mechanisms.
81
+ */
51
82
  class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
83
+ /** Map of DID signing algorithms for different verification method types */
52
84
  didSigners = {};
85
+ /** Gas price configuration for transaction fee calculation */
53
86
  _gasPrice;
87
+ /** Offline signer instance for transaction signing */
54
88
  _signer;
89
+ /** RPC endpoint URL for blockchain communication */
55
90
  endpoint;
91
+ /** Maximum gas limit allowed for transactions */
56
92
  static maxGasLimit = Number.MAX_SAFE_INTEGER;
93
+ /**
94
+ * Creates a new CheqdSigningStargateClient by establishing a connection to the specified endpoint.
95
+ * This is the primary factory method for creating a signing client instance.
96
+ *
97
+ * @param endpoint - RPC endpoint URL or HttpEndpoint object to connect to
98
+ * @param signer - Offline signer for transaction signing
99
+ * @param options - Additional client configuration options including registry and gas price
100
+ * @returns Promise resolving to a connected CheqdSigningStargateClient instance
101
+ */
57
102
  static async connectWithSigner(endpoint, signer, options) {
58
103
  const cometClient = await tendermint_rpc_cjs_1.Tendermint37Client.connect(endpoint);
59
104
  return new CheqdSigningStargateClient(cometClient, signer, {
@@ -66,12 +111,30 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
66
111
  ...options,
67
112
  });
68
113
  }
114
+ /**
115
+ * Constructs a new CheqdSigningStargateClient instance with the provided Comet client and signer.
116
+ *
117
+ * @param cometClient - Tendermint client for blockchain communication
118
+ * @param signer - Offline signer for transaction signing
119
+ * @param options - Additional configuration options including registry, gas price, and endpoint
120
+ */
69
121
  constructor(cometClient, signer, options = {}) {
70
122
  super(cometClient, signer, options);
71
123
  this._signer = signer;
72
124
  this._gasPrice = options.gasPrice;
73
125
  this.endpoint = options.endpoint;
74
126
  }
127
+ /**
128
+ * Signs and broadcasts a transaction to the blockchain network.
129
+ * Supports automatic fee calculation and custom fee payer functionality.
130
+ *
131
+ * @param signerAddress - Address of the account signing the transaction
132
+ * @param messages - Array of messages to include in the transaction
133
+ * @param fee - Fee configuration: 'auto' for automatic calculation, number for multiplier, or DidStdFee object
134
+ * @param memo - Optional transaction memo string
135
+ * @returns Promise resolving to DeliverTxResponse with transaction results
136
+ * @throws Error if gas price is not set when using automatic fee calculation
137
+ */
75
138
  async signAndBroadcast(signerAddress, messages, fee, memo = '') {
76
139
  let usedFee;
77
140
  if (fee == 'auto' || typeof fee === 'number') {
@@ -90,6 +153,17 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
90
153
  const txBytes = tx_1.TxRaw.encode(txRaw).finish();
91
154
  return this.broadcastTx(txBytes, this.broadcastTimeoutMs, this.broadcastPollIntervalMs);
92
155
  }
156
+ /**
157
+ * Signs a transaction without broadcasting it to the network.
158
+ * Creates a signed transaction that can be broadcast later.
159
+ *
160
+ * @param signerAddress - Address of the account signing the transaction
161
+ * @param messages - Array of messages to include in the transaction
162
+ * @param fee - Fee configuration for the transaction
163
+ * @param memo - Transaction memo string
164
+ * @param explicitSignerData - Optional explicit signer data to avoid querying the chain
165
+ * @returns Promise resolving to TxRaw containing the signed transaction
166
+ */
93
167
  async sign(signerAddress, messages, fee, memo, explicitSignerData) {
94
168
  let signerData;
95
169
  if (explicitSignerData) {
@@ -106,6 +180,18 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
106
180
  }
107
181
  return this._signDirect(signerAddress, messages, fee, memo, signerData);
108
182
  }
183
+ /**
184
+ * Internal method for direct signing of transactions using SIGN_MODE_DIRECT.
185
+ * Handles the low-level transaction construction and signing process.
186
+ *
187
+ * @param signerAddress - Address of the account signing the transaction
188
+ * @param messages - Array of messages to include in the transaction
189
+ * @param fee - Fee configuration for the transaction
190
+ * @param memo - Transaction memo string
191
+ * @param signerData - Account data including number, sequence, and chain ID
192
+ * @returns Promise resolving to TxRaw containing the signed transaction
193
+ * @private
194
+ */
109
195
  async _signDirect(signerAddress, messages, fee, memo, { accountNumber, sequence, chainId }) {
110
196
  (0, utils_cjs_1.assert)((0, proto_signing_cjs_1.isOfflineDirectSigner)(this._signer));
111
197
  const accountFromSigner = (await this._signer.getAccounts()).find((account) => account.address === signerAddress);
@@ -223,6 +309,7 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
223
309
  }
224
310
  /**
225
311
  * Broadcasts a signed transaction to the network without monitoring it.
312
+ * Returns the transaction hash immediately after broadcast submission.
226
313
  *
227
314
  * If broadcasting is rejected by the node for some reason (e.g. because of a CheckTx failure),
228
315
  * an error is thrown.
@@ -230,7 +317,9 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
230
317
  * If the transaction is broadcasted, a `string` containing the hash of the transaction is returned. The caller then
231
318
  * usually needs to check if the transaction was included in a block and was successful.
232
319
  *
233
- * @returns Returns the hash of the transaction
320
+ * @param tx - Signed transaction bytes to broadcast
321
+ * @returns Promise resolving to the hash of the transaction
322
+ * @throws BroadcastTxError if the transaction is rejected during CheckTx
234
323
  */
235
324
  async broadcastTxSync(tx) {
236
325
  const broadcasted = await this.forceGetTmClient().broadcastTxSync({ tx });
@@ -240,6 +329,16 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
240
329
  const transactionId = (0, encoding_cjs_1.toHex)(broadcasted.hash).toUpperCase();
241
330
  return transactionId;
242
331
  }
332
+ /**
333
+ * Simulates transaction execution to estimate gas usage.
334
+ * Uses the configured endpoint to query the blockchain for gas estimation.
335
+ *
336
+ * @param signerAddress - Address of the account that would sign the transaction
337
+ * @param messages - Array of messages to simulate
338
+ * @param memo - Transaction memo string
339
+ * @returns Promise resolving to the estimated gas units required
340
+ * @throws Error if endpoint is not configured
341
+ */
243
342
  async simulate(signerAddress, messages, memo) {
244
343
  if (!this.endpoint) {
245
344
  throw new Error('querier: endpoint is not set');
@@ -259,6 +358,13 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
259
358
  (0, utils_cjs_1.assertDefined)(gasInfo);
260
359
  return math_cjs_2.Uint53.fromString(gasInfo.gasUsed.toString()).toNumber();
261
360
  }
361
+ /**
362
+ * Constructs a transaction extension object for simulation and query operations.
363
+ * Provides methods for transaction simulation and retrieval.
364
+ *
365
+ * @param querier - CheqdQuerier instance for blockchain communication
366
+ * @returns Promise resolving to TxExtension with simulation and query capabilities
367
+ */
262
368
  async constructSimulateExtension(querier) {
263
369
  // setup rpc client
264
370
  const rpc = (0, stargate_cjs_1.createProtobufRpcClient)(querier);
@@ -312,6 +418,17 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
312
418
  },
313
419
  };
314
420
  }
421
+ /**
422
+ * Batches multiple messages into optimal groups based on gas limits.
423
+ * Simulates each message individually and groups them to maximize throughput
424
+ * while staying within gas constraints.
425
+ *
426
+ * @param messages - Array of messages to batch
427
+ * @param signerAddress - Address of the account that will sign the transactions
428
+ * @param memo - Optional transaction memo
429
+ * @param maxGasLimit - Maximum gas limit per batch, defaults to 30,000,000
430
+ * @returns Promise resolving to MessageBatch with grouped messages and gas estimates
431
+ */
315
432
  async batchMessages(messages, signerAddress, memo, maxGasLimit = 30000000 // default gas limit, use consensus params if available
316
433
  ) {
317
434
  // simulate
@@ -351,6 +468,14 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
351
468
  gas: gasPerBatch,
352
469
  };
353
470
  }
471
+ /**
472
+ * Validates and initializes DID signers for the provided verification methods.
473
+ * Ensures that all verification method types are supported and assigns appropriate signers.
474
+ *
475
+ * @param verificationMethods - Array of verification methods to validate
476
+ * @returns Promise resolving to the configured signer algorithm map
477
+ * @throws Error if no verification methods are provided or unsupported types are found
478
+ */
354
479
  async checkDidSigners(verificationMethods = []) {
355
480
  if (verificationMethods.length === 0) {
356
481
  throw new Error('No verification methods provided');
@@ -365,6 +490,15 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
365
490
  });
366
491
  return this.didSigners;
367
492
  }
493
+ /**
494
+ * Retrieves the appropriate DID signer for a specific verification method.
495
+ * Looks up the verification method by ID and returns the corresponding signer function.
496
+ *
497
+ * @param verificationMethodId - ID of the verification method to get signer for
498
+ * @param verificationMethods - Array of available verification methods
499
+ * @returns Promise resolving to a signer function that takes a secret key
500
+ * @throws Error if the verification method is not found
501
+ */
368
502
  async getDidSigner(verificationMethodId, verificationMethods) {
369
503
  await this.checkDidSigners(verificationMethods);
370
504
  const verificationMethod = verificationMethods.find((method) => method.id === verificationMethodId)?.verificationMethodType;
@@ -373,6 +507,14 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
373
507
  }
374
508
  return this.didSigners[verificationMethod];
375
509
  }
510
+ /**
511
+ * Signs a CreateDidDoc transaction payload using the provided signing inputs.
512
+ * Validates verification methods and creates signatures for each signing input.
513
+ *
514
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
515
+ * @param payload - CreateDidDoc payload to sign
516
+ * @returns Promise resolving to array of SignInfo objects with signatures
517
+ */
376
518
  async signCreateDidDocTx(signInputs, payload) {
377
519
  await this.checkDidSigners(payload?.verificationMethod);
378
520
  const signBytes = v2_1.MsgCreateDidDocPayload.encode(payload).finish();
@@ -384,6 +526,17 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
384
526
  }));
385
527
  return signInfos;
386
528
  }
529
+ /**
530
+ * Signs an UpdateDidDoc transaction payload using the provided signing inputs.
531
+ * Handles complex verification method resolution including external controllers
532
+ * and previous DID document verification methods.
533
+ *
534
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
535
+ * @param payload - UpdateDidDoc payload to sign
536
+ * @param externalControllers - Optional external controller DID documents
537
+ * @param previousDidDocument - Optional previous version of the DID document
538
+ * @returns Promise resolving to array of SignInfo objects with signatures
539
+ */
387
540
  async signUpdateDidDocTx(signInputs, payload, externalControllers, previousDidDocument) {
388
541
  await this.checkDidSigners(payload?.verificationMethod);
389
542
  const signBytes = v2_1.MsgUpdateDidDocPayload.encode(payload).finish();
@@ -413,6 +566,15 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
413
566
  }));
414
567
  return signInfos;
415
568
  }
569
+ /**
570
+ * Signs a DeactivateDidDoc transaction payload using the provided signing inputs.
571
+ * Validates verification methods and creates signatures for DID deactivation.
572
+ *
573
+ * @param signInputs - Array of signing inputs containing verification method IDs and private keys
574
+ * @param payload - DeactivateDidDoc payload to sign
575
+ * @param verificationMethod - Array of verification methods for signature validation
576
+ * @returns Promise resolving to array of SignInfo objects with signatures
577
+ */
416
578
  async signDeactivateDidDocTx(signInputs, payload, verificationMethod) {
417
579
  await this.checkDidSigners(verificationMethod);
418
580
  const signBytes = v2_1.MsgDeactivateDidDocPayload.encode(payload).finish();
@@ -424,6 +586,15 @@ class CheqdSigningStargateClient extends stargate_cjs_1.SigningStargateClient {
424
586
  }));
425
587
  return signInfos;
426
588
  }
589
+ /**
590
+ * Static method for signing identity transactions with multiple key types.
591
+ * Supports Ed25519, Secp256k1, and P256 signature algorithms.
592
+ *
593
+ * @param signBytes - Raw bytes to sign
594
+ * @param signInputs - Array of signing inputs with key types and private keys
595
+ * @returns Promise resolving to array of SignInfo objects with signatures
596
+ * @throws Error if key type is undefined or unsupported
597
+ */
427
598
  static async signIdentityTx(signBytes, signInputs) {
428
599
  let signInfos = [];
429
600
  for (let signInput of signInputs) {