@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.
- package/build/cjs/src/index.d.ts +142 -0
- package/build/cjs/src/index.d.ts.map +1 -0
- package/build/cjs/src/index.js +184 -0
- package/build/cjs/src/index.js.map +1 -0
- package/build/cjs/src/modules/_.d.ts +81 -0
- package/build/cjs/src/modules/_.d.ts.map +1 -0
- package/build/cjs/src/modules/_.js +93 -0
- package/build/cjs/src/modules/_.js.map +1 -0
- package/build/cjs/src/modules/did.d.ts +488 -0
- package/build/cjs/src/modules/did.d.ts.map +1 -0
- package/build/cjs/src/modules/did.js +1249 -0
- package/build/cjs/src/modules/did.js.map +1 -0
- package/build/cjs/src/modules/feeabstraction.d.ts +429 -0
- package/build/cjs/src/modules/feeabstraction.d.ts.map +1 -0
- package/build/cjs/src/modules/feeabstraction.js +474 -0
- package/build/cjs/src/modules/feeabstraction.js.map +1 -0
- package/build/cjs/src/modules/feemarket.d.ts +244 -0
- package/build/cjs/src/modules/feemarket.d.ts.map +1 -0
- package/build/cjs/src/modules/feemarket.js +297 -0
- package/build/cjs/src/modules/feemarket.js.map +1 -0
- package/build/cjs/src/modules/oracle.d.ts +563 -0
- package/build/cjs/src/modules/oracle.d.ts.map +1 -0
- package/build/cjs/src/modules/oracle.js +784 -0
- package/build/cjs/src/modules/oracle.js.map +1 -0
- package/build/cjs/src/modules/resource.d.ts +330 -0
- package/build/cjs/src/modules/resource.d.ts.map +1 -0
- package/build/cjs/src/modules/resource.js +556 -0
- package/build/cjs/src/modules/resource.js.map +1 -0
- package/build/cjs/src/querier.d.ts +62 -0
- package/build/cjs/src/querier.d.ts.map +1 -0
- package/build/cjs/src/querier.js +87 -0
- package/build/cjs/src/querier.js.map +1 -0
- package/build/cjs/src/registry.d.ts +18 -0
- package/build/cjs/src/registry.d.ts.map +1 -0
- package/build/cjs/src/registry.js +23 -0
- package/build/cjs/src/registry.js.map +1 -0
- package/build/cjs/src/signer.d.ts +250 -0
- package/build/cjs/src/signer.d.ts.map +1 -0
- package/build/cjs/src/signer.js +617 -0
- package/build/cjs/src/signer.js.map +1 -0
- package/build/cjs/src/types.d.ts +221 -0
- package/build/cjs/src/types.d.ts.map +1 -0
- package/build/cjs/src/types.js.map +1 -0
- package/build/cjs/src/utils.d.ts +233 -0
- package/build/cjs/src/utils.d.ts.map +1 -0
- package/build/cjs/src/utils.js +571 -0
- package/build/cjs/src/utils.js.map +1 -0
- package/build/{index.d.ts → esm/src/index.d.ts} +7 -3
- package/build/esm/src/index.d.ts.map +1 -0
- package/build/{index.js → esm/src/index.js} +3 -1
- package/build/esm/src/index.js.map +1 -0
- package/build/esm/src/modules/_.d.ts.map +1 -0
- package/build/esm/src/modules/_.js.map +1 -0
- package/build/{modules → esm/src/modules}/did.d.ts +109 -7
- package/build/esm/src/modules/did.d.ts.map +1 -0
- package/build/{modules → esm/src/modules}/did.js +212 -6
- package/build/esm/src/modules/did.js.map +1 -0
- package/build/esm/src/modules/feeabstraction.d.ts.map +1 -0
- package/build/esm/src/modules/feeabstraction.js.map +1 -0
- package/build/esm/src/modules/feemarket.d.ts.map +1 -0
- package/build/esm/src/modules/feemarket.js.map +1 -0
- package/build/esm/src/modules/oracle.d.ts +563 -0
- package/build/esm/src/modules/oracle.d.ts.map +1 -0
- package/build/esm/src/modules/oracle.js +784 -0
- package/build/esm/src/modules/oracle.js.map +1 -0
- package/build/{modules → esm/src/modules}/resource.d.ts +132 -6
- package/build/esm/src/modules/resource.d.ts.map +1 -0
- package/build/esm/src/modules/resource.js +556 -0
- package/build/esm/src/modules/resource.js.map +1 -0
- package/build/esm/src/querier.d.ts.map +1 -0
- package/build/esm/src/querier.js.map +1 -0
- package/build/esm/src/registry.d.ts.map +1 -0
- package/build/esm/src/registry.js.map +1 -0
- package/build/esm/src/signer.d.ts.map +1 -0
- package/build/esm/src/signer.js.map +1 -0
- package/build/{types → esm/src}/types.d.ts +27 -1
- package/build/esm/src/types.d.ts.map +1 -0
- package/build/esm/src/types.js +43 -0
- package/build/esm/src/types.js.map +1 -0
- package/build/esm/src/utils.d.ts.map +1 -0
- package/build/esm/src/utils.js.map +1 -0
- package/build/types/cjs/src/index.d.ts +142 -0
- package/build/types/cjs/src/index.d.ts.map +1 -0
- package/build/types/cjs/src/modules/_.d.ts +81 -0
- package/build/types/cjs/src/modules/_.d.ts.map +1 -0
- package/build/types/cjs/src/modules/did.d.ts +488 -0
- package/build/types/cjs/src/modules/did.d.ts.map +1 -0
- package/build/types/cjs/src/modules/feeabstraction.d.ts +429 -0
- package/build/types/cjs/src/modules/feeabstraction.d.ts.map +1 -0
- package/build/types/cjs/src/modules/feemarket.d.ts +244 -0
- package/build/types/cjs/src/modules/feemarket.d.ts.map +1 -0
- package/build/types/cjs/src/modules/oracle.d.ts +563 -0
- package/build/types/cjs/src/modules/oracle.d.ts.map +1 -0
- package/build/types/cjs/src/modules/resource.d.ts +330 -0
- package/build/types/cjs/src/modules/resource.d.ts.map +1 -0
- package/build/types/cjs/src/querier.d.ts +62 -0
- package/build/types/cjs/src/querier.d.ts.map +1 -0
- package/build/types/cjs/src/registry.d.ts +18 -0
- package/build/types/cjs/src/registry.d.ts.map +1 -0
- package/build/types/cjs/src/signer.d.ts +250 -0
- package/build/types/cjs/src/signer.d.ts.map +1 -0
- package/build/types/cjs/src/types.d.ts +221 -0
- package/build/types/cjs/src/types.d.ts.map +1 -0
- package/build/types/cjs/src/utils.d.ts +233 -0
- package/build/types/cjs/src/utils.d.ts.map +1 -0
- package/build/types/{index.d.ts → esm/src/index.d.ts} +7 -3
- package/build/types/esm/src/index.d.ts.map +1 -0
- package/build/types/esm/src/modules/_.d.ts.map +1 -0
- package/build/types/{modules → esm/src/modules}/did.d.ts +109 -7
- package/build/types/esm/src/modules/did.d.ts.map +1 -0
- package/build/types/esm/src/modules/feeabstraction.d.ts.map +1 -0
- package/build/types/esm/src/modules/feemarket.d.ts.map +1 -0
- package/build/types/esm/src/modules/oracle.d.ts +563 -0
- package/build/types/esm/src/modules/oracle.d.ts.map +1 -0
- package/build/types/{modules → esm/src/modules}/resource.d.ts +132 -6
- package/build/types/esm/src/modules/resource.d.ts.map +1 -0
- package/build/types/esm/src/querier.d.ts.map +1 -0
- package/build/types/esm/src/registry.d.ts.map +1 -0
- package/build/types/esm/src/signer.d.ts.map +1 -0
- package/build/{types.d.ts → types/esm/src/types.d.ts} +27 -1
- package/build/types/esm/src/types.d.ts.map +1 -0
- package/build/types/esm/src/utils.d.ts.map +1 -0
- package/package.json +2 -2
- package/build/index.d.ts.map +0 -1
- package/build/index.js.map +0 -1
- package/build/modules/_.d.ts.map +0 -1
- package/build/modules/_.js.map +0 -1
- package/build/modules/did.d.ts.map +0 -1
- package/build/modules/did.js.map +0 -1
- package/build/modules/feeabstraction.d.ts.map +0 -1
- package/build/modules/feeabstraction.js.map +0 -1
- package/build/modules/feemarket.d.ts.map +0 -1
- package/build/modules/feemarket.js.map +0 -1
- package/build/modules/resource.d.ts.map +0 -1
- package/build/modules/resource.js +0 -297
- package/build/modules/resource.js.map +0 -1
- package/build/querier.d.ts.map +0 -1
- package/build/querier.js.map +0 -1
- package/build/registry.d.ts.map +0 -1
- package/build/registry.js.map +0 -1
- package/build/signer.d.ts.map +0 -1
- package/build/signer.js.map +0 -1
- package/build/types/index.d.ts.map +0 -1
- package/build/types/modules/_.d.ts.map +0 -1
- package/build/types/modules/did.d.ts.map +0 -1
- package/build/types/modules/feeabstraction.d.ts.map +0 -1
- package/build/types/modules/feemarket.d.ts.map +0 -1
- package/build/types/modules/resource.d.ts.map +0 -1
- package/build/types/querier.d.ts.map +0 -1
- package/build/types/registry.d.ts.map +0 -1
- package/build/types/signer.d.ts.map +0 -1
- package/build/types/types.d.ts.map +0 -1
- package/build/types/utils.d.ts.map +0 -1
- package/build/types.d.ts.map +0 -1
- package/build/types.js.map +0 -1
- package/build/utils.d.ts.map +0 -1
- package/build/utils.js.map +0 -1
- /package/build/{types.js → cjs/src/types.js} +0 -0
- /package/build/{modules → esm/src/modules}/_.d.ts +0 -0
- /package/build/{modules → esm/src/modules}/_.js +0 -0
- /package/build/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
- /package/build/{modules → esm/src/modules}/feeabstraction.js +0 -0
- /package/build/{modules → esm/src/modules}/feemarket.d.ts +0 -0
- /package/build/{modules → esm/src/modules}/feemarket.js +0 -0
- /package/build/{querier.d.ts → esm/src/querier.d.ts} +0 -0
- /package/build/{querier.js → esm/src/querier.js} +0 -0
- /package/build/{registry.d.ts → esm/src/registry.d.ts} +0 -0
- /package/build/{registry.js → esm/src/registry.js} +0 -0
- /package/build/{signer.d.ts → esm/src/signer.d.ts} +0 -0
- /package/build/{signer.js → esm/src/signer.js} +0 -0
- /package/build/{types → esm/src}/utils.d.ts +0 -0
- /package/build/{utils.js → esm/src/utils.js} +0 -0
- /package/build/types/{modules → esm/src/modules}/_.d.ts +0 -0
- /package/build/types/{modules → esm/src/modules}/feeabstraction.d.ts +0 -0
- /package/build/types/{modules → esm/src/modules}/feemarket.d.ts +0 -0
- /package/build/types/{querier.d.ts → esm/src/querier.d.ts} +0 -0
- /package/build/types/{registry.d.ts → esm/src/registry.d.ts} +0 -0
- /package/build/types/{signer.d.ts → esm/src/signer.d.ts} +0 -0
- /package/build/{utils.d.ts → types/esm/src/utils.d.ts} +0 -0
|
@@ -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;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,YA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C,EAAE,MAAM,EACb,WAAW,GAAE,MAAiB,GAC5B,OAAO,CAAC,YAAY,CAAC;IA+CxB;;;;;;;OAOG;IACG,eAAe,CAAC,mBAAmB,GAAE,OAAO,CAAC,kBAAkB,CAAC,EAAO,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBpG;;;;;;;;OAQG;IACG,YAAY,CACjB,oBAAoB,EAAE,MAAM,EAC5B,mBAAmB,EAAE,OAAO,CAAC,kBAAkB,CAAC,EAAE,GAChD,OAAO,CAAC,CAAC,SAAS,EAAE,UAAU,KAAK,MAAM,CAAC;IAW7C;;;;;;;OAOG;IACG,kBAAkB,CAAC,UAAU,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAoBzG;;;;;;;;;;OAUG;IACG,kBAAkB,CACvB,UAAU,EAAE,WAAW,EAAE,EACzB,OAAO,EAAE,sBAAsB,EAC/B,mBAAmB,CAAC,EAAE,WAAW,EAAE,EACnC,mBAAmB,CAAC,EAAE,WAAW,GAC/B,OAAO,CAAC,QAAQ,EAAE,CAAC;IA6CtB;;;;;;;;OAQG;IACG,sBAAsB,CAC3B,UAAU,EAAE,WAAW,EAAE,EACzB,OAAO,EAAE,0BAA0B,EACnC,kBAAkB,EAAE,kBAAkB,EAAE,GACtC,OAAO,CAAC,QAAQ,EAAE,CAAC;IAoBtB;;;;;;;;OAQG;WACU,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAgClG"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { Service as ProtobufService, VerificationMethod as ProtobufVerificationMethod } from '@cheqd/ts-proto-cjs/cheqd/did/v2';
|
|
2
|
+
import { CheqdSDK } from './index';
|
|
3
|
+
import { Coin, EncodeObject } from '@cosmjs/proto-signing-cjs';
|
|
4
|
+
import { Signer } from 'did-jwt-cjs';
|
|
5
|
+
import { QueryClient } from '@cosmjs/stargate-cjs';
|
|
6
|
+
import { DIDDocument, DIDResolutionResult } from 'did-resolver-cjs';
|
|
7
|
+
import { DidExtension } from './modules/did';
|
|
8
|
+
import { ResourceExtension } from './modules/resource';
|
|
9
|
+
import { FeemarketExtension } from './modules/feemarket';
|
|
10
|
+
import { FeeabstractionExtension } from './modules/feeabstraction';
|
|
11
|
+
import { GetTxResponse, SimulateResponse } from 'cosmjs-types-cjs/cosmos/tx/v1beta1/service';
|
|
12
|
+
import { Any } from 'cosmjs-types-cjs/google/protobuf/any';
|
|
13
|
+
import { Pubkey } from '@cosmjs/amino-cjs';
|
|
14
|
+
import { MovingAverage, OracleExtension, WMAStrategy } from './modules/oracle';
|
|
15
|
+
export { DIDDocument, VerificationMethod, Service, ServiceEndpoint, JsonWebKey } from 'did-resolver-cjs';
|
|
16
|
+
/** Supported Cheqd blockchain networks */
|
|
17
|
+
export declare enum CheqdNetwork {
|
|
18
|
+
/** Production network for live transactions */
|
|
19
|
+
Mainnet = "mainnet",
|
|
20
|
+
/** Test network for development and testing */
|
|
21
|
+
Testnet = "testnet"
|
|
22
|
+
}
|
|
23
|
+
/** Function type for setting up query extensions on a base QueryClient */
|
|
24
|
+
export type QueryExtensionSetup<T> = (base: QueryClient) => T;
|
|
25
|
+
/**
|
|
26
|
+
* Utility type for creating exclusive extension objects where only one extension can be active at a time.
|
|
27
|
+
* Ensures type safety when working with mutually exclusive extensions.
|
|
28
|
+
*/
|
|
29
|
+
export type CheqdExtension<K extends string, V = any> = {
|
|
30
|
+
[P in K]: Record<P, V> & Partial<Record<Exclude<K, P>, never>> extends infer O ? {
|
|
31
|
+
[Q in keyof O]: O[Q];
|
|
32
|
+
} : never;
|
|
33
|
+
}[K];
|
|
34
|
+
/** Union type of all supported Cheqd query extensions */
|
|
35
|
+
export type CheqdExtensions = DidExtension | ResourceExtension | FeemarketExtension | FeeabstractionExtension | OracleExtension;
|
|
36
|
+
/**
|
|
37
|
+
* Extension interface for transaction-related operations.
|
|
38
|
+
* Provides methods for transaction retrieval and simulation.
|
|
39
|
+
*/
|
|
40
|
+
export interface TxExtension {
|
|
41
|
+
readonly tx: {
|
|
42
|
+
/** Retrieves a transaction by its ID */
|
|
43
|
+
getTx: (txId: string) => Promise<GetTxResponse>;
|
|
44
|
+
/** Simulates a transaction to estimate gas usage and validate execution */
|
|
45
|
+
simulate: (messages: readonly Any[], memo: string | undefined, signer: Pubkey, signerAddress: string, sequence: number, gasLimit: number) => Promise<SimulateResponse>;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/** Generic interface for module methods that can be executed with variable arguments */
|
|
49
|
+
export interface IModuleMethod {
|
|
50
|
+
(...args: any[]): Promise<any>;
|
|
51
|
+
}
|
|
52
|
+
/** Map of method names to their corresponding module method implementations */
|
|
53
|
+
export interface IModuleMethodMap extends Record<string, IModuleMethod> {
|
|
54
|
+
}
|
|
55
|
+
/** Context interface providing access to the SDK instance for module methods */
|
|
56
|
+
export interface IContext {
|
|
57
|
+
sdk: CheqdSDK;
|
|
58
|
+
}
|
|
59
|
+
/** DID document with associated metadata from resolution results */
|
|
60
|
+
export type DIDDocumentWithMetadata = Pick<DIDResolutionResult, 'didDocument' | 'didDocumentMetadata'>;
|
|
61
|
+
/**
|
|
62
|
+
* Result of DID specification validation containing validation status,
|
|
63
|
+
* error information, and converted protobuf objects.
|
|
64
|
+
*/
|
|
65
|
+
export type SpecValidationResult = {
|
|
66
|
+
/** Whether the validation passed */
|
|
67
|
+
valid: boolean;
|
|
68
|
+
/** Error message if validation failed */
|
|
69
|
+
error?: string;
|
|
70
|
+
/** Converted verification methods in protobuf format */
|
|
71
|
+
protobufVerificationMethod?: ProtobufVerificationMethod[];
|
|
72
|
+
/** Converted services in protobuf format */
|
|
73
|
+
protobufService?: ProtobufService[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Result of authentication validation for DID operations,
|
|
77
|
+
* including resolved external controllers and previous document state.
|
|
78
|
+
*/
|
|
79
|
+
export type AuthenticationValidationResult = {
|
|
80
|
+
/** Whether the authentication validation passed */
|
|
81
|
+
valid: boolean;
|
|
82
|
+
/** Error message if validation failed */
|
|
83
|
+
error?: string;
|
|
84
|
+
/** Resolved external controller DID documents */
|
|
85
|
+
externalControllersDocuments?: DIDDocument[];
|
|
86
|
+
/** Previous version of the DID document for updates */
|
|
87
|
+
previousDidDocument?: DIDDocument;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Batched messages grouped by gas consumption limits,
|
|
91
|
+
* with corresponding gas estimates for each batch.
|
|
92
|
+
*/
|
|
93
|
+
export type MessageBatch = {
|
|
94
|
+
/** Array of message batches grouped by gas limits */
|
|
95
|
+
readonly batches: EncodeObject[][];
|
|
96
|
+
/** Gas estimates for each corresponding batch */
|
|
97
|
+
readonly gas: number[];
|
|
98
|
+
};
|
|
99
|
+
/** Supported verification method types for DID documents */
|
|
100
|
+
export declare enum VerificationMethods {
|
|
101
|
+
/** Ed25519 verification key (2020 specification) */
|
|
102
|
+
Ed255192020 = "Ed25519VerificationKey2020",
|
|
103
|
+
/** Ed25519 verification key (2018 specification) */
|
|
104
|
+
Ed255192018 = "Ed25519VerificationKey2018",
|
|
105
|
+
/** JSON Web Key (2020 specification) */
|
|
106
|
+
JWK = "JsonWebKey2020"
|
|
107
|
+
}
|
|
108
|
+
/** Supported algorithms for generating method-specific identifiers */
|
|
109
|
+
export declare enum MethodSpecificIdAlgo {
|
|
110
|
+
/** Base58 Bitcoin encoding */
|
|
111
|
+
Base58 = "base58btc",
|
|
112
|
+
/** UUID format */
|
|
113
|
+
Uuid = "uuid"
|
|
114
|
+
}
|
|
115
|
+
/** Map of verification method types to their corresponding signer algorithms */
|
|
116
|
+
export type TSignerAlgo = {
|
|
117
|
+
[key in VerificationMethods as string]?: (secretKey: Uint8Array) => Signer;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Interface for signing inputs containing verification method details
|
|
121
|
+
* and the private key required for signing operations.
|
|
122
|
+
*/
|
|
123
|
+
export interface ISignInputs {
|
|
124
|
+
/** ID of the verification method to use for signing */
|
|
125
|
+
verificationMethodId: string;
|
|
126
|
+
/** Type of cryptographic key (Ed25519, Secp256k1, or P256) */
|
|
127
|
+
keyType?: 'Ed25519' | 'Secp256k1' | 'P256';
|
|
128
|
+
/** Private key in hexadecimal format */
|
|
129
|
+
privateKeyHex: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Interface representing a cryptographic key pair with optional algorithm specification.
|
|
133
|
+
*/
|
|
134
|
+
export interface IKeyPair {
|
|
135
|
+
/** Public key string */
|
|
136
|
+
publicKey: string;
|
|
137
|
+
/** Private key string */
|
|
138
|
+
privateKey: string;
|
|
139
|
+
/** Optional algorithm used for key generation */
|
|
140
|
+
algo?: MethodSpecificIdAlgo;
|
|
141
|
+
}
|
|
142
|
+
/** Generic key-value pair interface for flexible data storage */
|
|
143
|
+
export interface IKeyValuePair {
|
|
144
|
+
/** The key identifier */
|
|
145
|
+
key: string;
|
|
146
|
+
/** The associated value (can be any type) */
|
|
147
|
+
value: any;
|
|
148
|
+
}
|
|
149
|
+
/** String type for verification key prefixes */
|
|
150
|
+
export type TVerificationKeyPrefix = string;
|
|
151
|
+
/** Template literal type for creating verification key identifiers with prefix and number */
|
|
152
|
+
export type TVerificationKey<K extends TVerificationKeyPrefix, N extends number> = `${K}-${N}`;
|
|
153
|
+
/**
|
|
154
|
+
* Interface for verification key structures with strongly typed DID URLs and key IDs.
|
|
155
|
+
* Provides type safety for Cheqd DID identifiers and verification key relationships.
|
|
156
|
+
*/
|
|
157
|
+
export interface IVerificationKeys {
|
|
158
|
+
/** Method-specific identifier for the DID */
|
|
159
|
+
readonly methodSpecificId: TMethodSpecificId;
|
|
160
|
+
/** Fully qualified DID URL for the Cheqd network */
|
|
161
|
+
readonly didUrl: `did:cheqd:${CheqdNetwork}:${IVerificationKeys['methodSpecificId']}` extends string ? string : never;
|
|
162
|
+
/** Key identifier combining DID URL with verification key fragment */
|
|
163
|
+
readonly keyId: `${IVerificationKeys['didUrl']}#${TVerificationKey<TVerificationKeyPrefix, number>}`;
|
|
164
|
+
/** Public key string representation */
|
|
165
|
+
readonly publicKey: string;
|
|
166
|
+
}
|
|
167
|
+
/** String type representing a method-specific identifier for DIDs */
|
|
168
|
+
export type TMethodSpecificId = string;
|
|
169
|
+
/**
|
|
170
|
+
* DID-specific fee structure extending standard fee with payer and granter support.
|
|
171
|
+
* Enables fee delegation and payment by third parties for DID operations.
|
|
172
|
+
*/
|
|
173
|
+
export interface DidStdFee {
|
|
174
|
+
/** Array of coins representing the fee amount */
|
|
175
|
+
readonly amount: readonly Coin[];
|
|
176
|
+
/** Gas limit for the transaction */
|
|
177
|
+
readonly gas: string;
|
|
178
|
+
/** Optional address of the account paying the fees */
|
|
179
|
+
payer?: string;
|
|
180
|
+
/** Optional address of the account granting fee payment permissions */
|
|
181
|
+
granter?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Identity-specific fee options for DID and DLR transactions.
|
|
185
|
+
* Enables customization of fee payment and slippage tolerance.
|
|
186
|
+
*/
|
|
187
|
+
export interface DidFeeOptions {
|
|
188
|
+
/** Optional explicit USD amount, otherwise we use lower bound from parameters */
|
|
189
|
+
wantedAmountUsd?: string;
|
|
190
|
+
/** Optional slippage in basis points; default is module's defaultSlippageBps */
|
|
191
|
+
slippageBps?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Optional fee denom.
|
|
194
|
+
* - If 'ncheq': pay in native after oracle conversion.
|
|
195
|
+
* - If accepted fee-abstraction denom: go through fee-abstraction flow.
|
|
196
|
+
* - If omitted: pay in native 'ncheq'.
|
|
197
|
+
*/
|
|
198
|
+
feeDenom?: string;
|
|
199
|
+
/** Optional gas limit for the transaction */
|
|
200
|
+
gasLimit?: string;
|
|
201
|
+
/** Optional moving average type. */
|
|
202
|
+
movingAverageType?: MovingAverage;
|
|
203
|
+
/** Optional WMA strategy, if applicable */
|
|
204
|
+
wmaStrategy?: WMAStrategy;
|
|
205
|
+
/** Optional weights for WMA strategy CUSTOM, if applicable */
|
|
206
|
+
wmaWeights?: number[];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Utility object providing type guard functions for ISignInputs validation.
|
|
210
|
+
* Contains helper methods to validate and type-check signing input objects.
|
|
211
|
+
*/
|
|
212
|
+
export declare const ISignInputs: {
|
|
213
|
+
/** Type guard function to check if an object array contains valid ISignInputs */
|
|
214
|
+
isSignInput(object: Object[]): object is ISignInputs[];
|
|
215
|
+
};
|
|
216
|
+
/** Enumeration of supported service types for DID documents */
|
|
217
|
+
export declare enum ServiceType {
|
|
218
|
+
/** Service type for linking domain names to DIDs */
|
|
219
|
+
LinkedDomains = "LinkedDomains"
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../cjs/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,IAAI,eAAe,EAC1B,kBAAkB,IAAI,0BAA0B,EAChD,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa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