@cheqd/sdk 5.3.2-develop.2 → 5.3.3-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/README.md +310 -0
- package/build/cjs/index.d.ts +92 -1
- package/build/cjs/index.d.ts.map +1 -1
- package/build/cjs/index.js +75 -2
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/modules/_.d.ts +61 -0
- package/build/cjs/modules/_.d.ts.map +1 -1
- package/build/cjs/modules/_.js +50 -0
- package/build/cjs/modules/_.js.map +1 -1
- package/build/cjs/modules/did.d.ts +278 -0
- package/build/cjs/modules/did.d.ts.map +1 -1
- package/build/cjs/modules/did.js +242 -0
- package/build/cjs/modules/did.js.map +1 -1
- package/build/cjs/modules/feeabstraction.d.ts +297 -2
- package/build/cjs/modules/feeabstraction.d.ts.map +1 -1
- package/build/cjs/modules/feeabstraction.js +235 -4
- package/build/cjs/modules/feeabstraction.js.map +1 -1
- package/build/cjs/modules/feemarket.d.ts +154 -21
- package/build/cjs/modules/feemarket.d.ts.map +1 -1
- package/build/cjs/modules/feemarket.js +133 -22
- package/build/cjs/modules/feemarket.js.map +1 -1
- package/build/cjs/modules/resource.d.ts +143 -0
- package/build/cjs/modules/resource.d.ts.map +1 -1
- package/build/cjs/modules/resource.js +131 -0
- package/build/cjs/modules/resource.js.map +1 -1
- package/build/cjs/querier.d.ts +50 -0
- package/build/cjs/querier.d.ts.map +1 -1
- package/build/cjs/querier.js +50 -0
- package/build/cjs/querier.js.map +1 -1
- package/build/cjs/registry.d.ts +14 -0
- package/build/cjs/registry.d.ts.map +1 -1
- package/build/cjs/registry.js +14 -0
- package/build/cjs/registry.js.map +1 -1
- package/build/cjs/signer.d.ts +172 -1
- package/build/cjs/signer.d.ts.map +1 -1
- package/build/cjs/signer.js +172 -1
- package/build/cjs/signer.js.map +1 -1
- package/build/cjs/types.d.ts +91 -0
- package/build/cjs/types.d.ts.map +1 -1
- package/build/cjs/types.js +17 -0
- package/build/cjs/types.js.map +1 -1
- package/build/cjs/utils.d.ts +188 -0
- package/build/cjs/utils.d.ts.map +1 -1
- package/build/cjs/utils.js +195 -0
- package/build/cjs/utils.js.map +1 -1
- package/build/esm/index.d.ts +92 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +74 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/modules/_.d.ts +42 -0
- package/build/esm/modules/_.d.ts.map +1 -1
- package/build/esm/modules/_.js +32 -0
- package/build/esm/modules/_.js.map +1 -1
- package/build/esm/modules/did.d.ts +274 -0
- package/build/esm/modules/did.d.ts.map +1 -1
- package/build/esm/modules/did.js +242 -0
- package/build/esm/modules/did.js.map +1 -1
- package/build/esm/modules/feeabstraction.d.ts +277 -2
- package/build/esm/modules/feeabstraction.d.ts.map +1 -1
- package/build/esm/modules/feeabstraction.js +221 -2
- package/build/esm/modules/feeabstraction.js.map +1 -1
- package/build/esm/modules/feemarket.d.ts +152 -21
- package/build/esm/modules/feemarket.d.ts.map +1 -1
- package/build/esm/modules/feemarket.js +131 -21
- package/build/esm/modules/feemarket.js.map +1 -1
- package/build/esm/modules/resource.d.ts +142 -0
- package/build/esm/modules/resource.d.ts.map +1 -1
- package/build/esm/modules/resource.js +130 -0
- package/build/esm/modules/resource.js.map +1 -1
- package/build/esm/querier.d.ts +50 -0
- package/build/esm/querier.d.ts.map +1 -1
- package/build/esm/querier.js +50 -0
- package/build/esm/querier.js.map +1 -1
- package/build/esm/registry.d.ts +14 -0
- package/build/esm/registry.d.ts.map +1 -1
- package/build/esm/registry.js +14 -0
- package/build/esm/registry.js.map +1 -1
- package/build/esm/signer.d.ts +122 -0
- package/build/esm/signer.d.ts.map +1 -1
- package/build/esm/signer.js +122 -0
- package/build/esm/signer.js.map +1 -1
- package/build/esm/types.d.ts +92 -0
- package/build/esm/types.d.ts.map +1 -1
- package/build/esm/types.js +17 -0
- package/build/esm/types.js.map +1 -1
- package/build/esm/utils.d.ts +178 -0
- package/build/esm/utils.d.ts.map +1 -1
- package/build/esm/utils.js +171 -0
- package/build/esm/utils.js.map +1 -1
- package/build/types/index.d.ts +92 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/modules/_.d.ts +42 -0
- package/build/types/modules/_.d.ts.map +1 -1
- package/build/types/modules/did.d.ts +274 -0
- package/build/types/modules/did.d.ts.map +1 -1
- package/build/types/modules/feeabstraction.d.ts +277 -2
- package/build/types/modules/feeabstraction.d.ts.map +1 -1
- package/build/types/modules/feemarket.d.ts +152 -21
- package/build/types/modules/feemarket.d.ts.map +1 -1
- package/build/types/modules/resource.d.ts +142 -0
- package/build/types/modules/resource.d.ts.map +1 -1
- package/build/types/querier.d.ts +50 -0
- package/build/types/querier.d.ts.map +1 -1
- package/build/types/registry.d.ts +14 -0
- package/build/types/registry.d.ts.map +1 -1
- package/build/types/signer.d.ts +122 -0
- package/build/types/signer.d.ts.map +1 -1
- package/build/types/types.d.ts +92 -0
- package/build/types/types.d.ts.map +1 -1
- package/build/types/utils.d.ts +178 -0
- package/build/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feemarket.d.ts","sourceRoot":"","sources":["../../../esm/src/modules/feemarket.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EAGd,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAA2B,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAI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KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAkB5E;;;;;;;;OAQG;IACG,uBAAuB,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,oBAA+C,GACnD,OAAO,CAAC,QAAQ,CAAC;IAepB;;;;;;;;OAQG;IACG,oBAAoB,CACzB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,oBAA+C,EACrD,OAAO,CAAC,EAAE,QAAQ,GAChB,OAAO,CAAC,QAAQ,CAAC;IAYpB;;;;;;;;;OASG;IACG,0CAA0C,CAC/C,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,oBAA+C,EACrD,cAAc,yDAAwB,EACtC,OAAO,CAAC,EAAE,QAAQ,GAChB,OAAO,CAAC,QAAQ,CAAC;IAapB;;;;;;;;OAQG;IACH,MAAM,CAAC,wBAAwB,CAAC,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,SAAW,GAAG,SAAS;CAO7F"}
|
|
@@ -3,29 +3,72 @@ import { createProtobufRpcClient, GasPrice } from '@cosmjs/stargate';
|
|
|
3
3
|
import { AbstractCheqdSDKModule } from './_.js';
|
|
4
4
|
import { DefaultBackoffOptions, retry } from '../utils.js';
|
|
5
5
|
import { Decimal, Uint32 } from '@cosmjs/math';
|
|
6
|
+
/** Default extension key for fee market-related query operations */
|
|
6
7
|
export const defaultFeemarketExtensionKey = 'feemarket';
|
|
8
|
+
/**
|
|
9
|
+
* Protobuf message type literals for fee market operations.
|
|
10
|
+
* Used for consistent message type identification across the module.
|
|
11
|
+
*/
|
|
7
12
|
export const protobufLiterals = {
|
|
13
|
+
/** Gas price response message type */
|
|
8
14
|
GasPriceResponse: 'GasPriceResponse',
|
|
15
|
+
/** Gas prices response message type */
|
|
9
16
|
GasPricesResponse: 'GasPricesResponse',
|
|
17
|
+
/** Parameters response message type */
|
|
10
18
|
ParamsResponse: 'ParamsResponse',
|
|
11
19
|
};
|
|
20
|
+
/** Type URL for GasPriceResponse messages */
|
|
12
21
|
export const typeUrlGasPriceResponse = `/${protobufPackage}.${protobufLiterals.GasPriceResponse}`;
|
|
22
|
+
/** Type URL for GasPricesResponse messages */
|
|
13
23
|
export const typeUrlGasPricesResponse = `/${protobufPackage}.${protobufLiterals.GasPricesResponse}`;
|
|
24
|
+
/** Type URL for ParamsResponse messages */
|
|
14
25
|
export const typeUrlParamsResponse = `/${protobufPackage}.${protobufLiterals.ParamsResponse}`;
|
|
26
|
+
/**
|
|
27
|
+
* Default gas price tier names for fee calculation.
|
|
28
|
+
* Provides predefined tiers for different transaction priority levels.
|
|
29
|
+
*/
|
|
15
30
|
export const defaultGasPriceTiers = {
|
|
31
|
+
/** Low priority tier with lowest gas prices */
|
|
16
32
|
Low: 'DefaultLowTier',
|
|
33
|
+
/** Average priority tier with moderate gas prices */
|
|
17
34
|
Avg: 'DefaultAvgTier',
|
|
35
|
+
/** High priority tier with highest gas prices */
|
|
18
36
|
High: 'DefaultHighTier',
|
|
19
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* Type guard function to check if an object is a GasPriceEncodeObject.
|
|
40
|
+
*
|
|
41
|
+
* @param obj - EncodeObject to check
|
|
42
|
+
* @returns True if the object is a GasPriceEncodeObject
|
|
43
|
+
*/
|
|
20
44
|
export function isGasPriceEncodeObject(obj) {
|
|
21
45
|
return obj.typeUrl === typeUrlGasPriceResponse;
|
|
22
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Type guard function to check if an object is a GasPricesEncodeObject.
|
|
49
|
+
*
|
|
50
|
+
* @param obj - EncodeObject to check
|
|
51
|
+
* @returns True if the object is a GasPricesEncodeObject
|
|
52
|
+
*/
|
|
23
53
|
export function isGasPricesEncodeObject(obj) {
|
|
24
54
|
return obj.typeUrl === typeUrlGasPricesResponse;
|
|
25
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Type guard function to check if an object is a ParamsEncodeObject.
|
|
58
|
+
*
|
|
59
|
+
* @param obj - EncodeObject to check
|
|
60
|
+
* @returns True if the object is a ParamsEncodeObject
|
|
61
|
+
*/
|
|
26
62
|
export function isParamsEncodeObject(obj) {
|
|
27
63
|
return obj.typeUrl === typeUrlParamsResponse;
|
|
28
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Sets up the fee market extension for the querier client.
|
|
67
|
+
* Creates and configures the fee market-specific query methods.
|
|
68
|
+
*
|
|
69
|
+
* @param base - Base QueryClient to extend
|
|
70
|
+
* @returns Configured fee market extension with query methods
|
|
71
|
+
*/
|
|
29
72
|
export const setupFeemarketExtension = (base) => {
|
|
30
73
|
const rpc = createProtobufRpcClient(base);
|
|
31
74
|
const queryService = new QueryClientImpl(rpc);
|
|
@@ -43,6 +86,10 @@ export const setupFeemarketExtension = (base) => {
|
|
|
43
86
|
},
|
|
44
87
|
};
|
|
45
88
|
};
|
|
89
|
+
/**
|
|
90
|
+
* Fee Market Module class providing comprehensive fee market functionality.
|
|
91
|
+
* Handles gas price queries, dynamic fee calculation, and fee market parameter management.
|
|
92
|
+
*/
|
|
46
93
|
export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
47
94
|
// @ts-expect-error underlying type `GeneratedType` is intentionally wider
|
|
48
95
|
static registryTypes = [
|
|
@@ -50,16 +97,31 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
50
97
|
[typeUrlGasPricesResponse, GasPricesResponse],
|
|
51
98
|
[typeUrlParamsResponse, ParamsResponse],
|
|
52
99
|
];
|
|
100
|
+
/**
|
|
101
|
+
* Default gas prices for different priority tiers.
|
|
102
|
+
* Used as fallback when live gas price queries are unavailable.
|
|
103
|
+
*/
|
|
53
104
|
static defaultGasPrices = {
|
|
54
105
|
[defaultGasPriceTiers.Low]: { amount: '5000', denom: 'ncheq' },
|
|
55
106
|
[defaultGasPriceTiers.Avg]: { amount: '7500', denom: 'ncheq' },
|
|
56
107
|
[defaultGasPriceTiers.High]: { amount: '10000', denom: 'ncheq' },
|
|
57
108
|
};
|
|
109
|
+
/** Gas offset factor used for adjusting live gas prices */
|
|
58
110
|
static gasOffsetFactor = 10 ** 4;
|
|
111
|
+
/** Address of the fee collector account that receives transaction fees */
|
|
59
112
|
static feeCollectorAddress = 'cheqd13pxn9n3qw79e03844rdadagmg0nshmwfszqu0g';
|
|
113
|
+
/** Address of the fee market module account */
|
|
60
114
|
static moduleAccountAddress = 'cheqd1el68mjnzv87uurqks8u29tec0cj3297047g2dl';
|
|
115
|
+
/** Querier extension setup function for fee market operations */
|
|
61
116
|
static querierExtensionSetup = setupFeemarketExtension;
|
|
117
|
+
/** Querier instance with fee market extension capabilities */
|
|
62
118
|
querier;
|
|
119
|
+
/**
|
|
120
|
+
* Constructs a new fee market module instance.
|
|
121
|
+
*
|
|
122
|
+
* @param signer - Signing client for blockchain transactions
|
|
123
|
+
* @param querier - Querier client with fee market extension for data retrieval
|
|
124
|
+
*/
|
|
63
125
|
constructor(signer, querier) {
|
|
64
126
|
super(signer, querier);
|
|
65
127
|
this.querier = querier;
|
|
@@ -73,31 +135,68 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
73
135
|
generateSafeGasPriceWithExponentialBackoff: this.generateSafeGasPriceWithExponentialBackoff.bind(this),
|
|
74
136
|
};
|
|
75
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Gets the registry types for fee market message encoding/decoding.
|
|
140
|
+
*
|
|
141
|
+
* @returns Iterable of [typeUrl, GeneratedType] pairs for the registry
|
|
142
|
+
*/
|
|
76
143
|
getRegistryTypes() {
|
|
77
144
|
return FeemarketModule.registryTypes;
|
|
78
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Gets the querier extension setup for fee market operations.
|
|
148
|
+
*
|
|
149
|
+
* @returns Query extension setup function for fee market functionality
|
|
150
|
+
*/
|
|
79
151
|
getQuerierExtensionSetup() {
|
|
80
152
|
return FeemarketModule.querierExtensionSetup;
|
|
81
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Queries the current gas price for a specific denomination.
|
|
156
|
+
* Retrieves live gas price data from the fee market module.
|
|
157
|
+
*
|
|
158
|
+
* @param denom - Token denomination to query gas price for
|
|
159
|
+
* @param context - Optional SDK context for accessing clients
|
|
160
|
+
* @returns Promise resolving to the gas price response
|
|
161
|
+
*/
|
|
82
162
|
async queryGasPrice(denom, context) {
|
|
83
163
|
if (!this.querier)
|
|
84
164
|
this.querier = context.sdk.querier;
|
|
85
165
|
return this.querier[defaultFeemarketExtensionKey].gasPrice(denom);
|
|
86
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Queries all available gas prices from the fee market.
|
|
169
|
+
* Retrieves comprehensive gas pricing information for all denominations.
|
|
170
|
+
*
|
|
171
|
+
* @param context - Optional SDK context for accessing clients
|
|
172
|
+
* @returns Promise resolving to the gas prices response
|
|
173
|
+
*/
|
|
87
174
|
async queryGasPrices(context) {
|
|
88
175
|
if (!this.querier)
|
|
89
176
|
this.querier = context.sdk.querier;
|
|
90
177
|
return this.querier[defaultFeemarketExtensionKey].gasPrices();
|
|
91
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Queries the fee market module parameters.
|
|
181
|
+
* Retrieves configuration settings for the fee market functionality.
|
|
182
|
+
*
|
|
183
|
+
* @param context - Optional SDK context for accessing clients
|
|
184
|
+
* @returns Promise resolving to the parameters response
|
|
185
|
+
*/
|
|
92
186
|
async queryParams(context) {
|
|
93
187
|
if (!this.querier)
|
|
94
188
|
this.querier = context.sdk.querier;
|
|
95
189
|
return this.querier[defaultFeemarketExtensionKey].params();
|
|
96
190
|
}
|
|
97
191
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
192
|
+
* Generates gas price for a denomination by live polling the fee market.
|
|
193
|
+
* Queries current gas prices and adjusts them using the gas offset factor.
|
|
194
|
+
* Throws an error if live polling fails.
|
|
195
|
+
*
|
|
196
|
+
* @param denom - Token denomination to generate gas price for
|
|
197
|
+
* @param context - Optional SDK context for accessing clients
|
|
198
|
+
* @returns Promise resolving to the calculated gas price
|
|
199
|
+
* @throws Error if live poll for gas price fails or returns invalid data
|
|
101
200
|
*/
|
|
102
201
|
async generateGasPrice(denom, context) {
|
|
103
202
|
if (!this.querier)
|
|
@@ -115,10 +214,13 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
115
214
|
return GasPrice.fromString(`${adjustedGasPrice}${gasPrice.price.denom}`);
|
|
116
215
|
}
|
|
117
216
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* @
|
|
217
|
+
* Generates offline gas price for a denomination using static tier pricing.
|
|
218
|
+
* Uses predefined gas prices as fallback when live polling is unavailable.
|
|
219
|
+
*
|
|
220
|
+
* @param denom - Token denomination to generate gas price for
|
|
221
|
+
* @param tier - Priority tier for gas price calculation (defaults to Low)
|
|
222
|
+
* @returns Promise resolving to the static gas price
|
|
223
|
+
* @throws Error if denomination or tier is invalid
|
|
122
224
|
*/
|
|
123
225
|
async generateOfflineGasPrice(denom, tier = defaultGasPriceTiers.Low) {
|
|
124
226
|
// validate denom against default
|
|
@@ -133,10 +235,13 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
133
235
|
return GasPrice.fromString(`${gasPrice.amount}${gasPrice.denom}`);
|
|
134
236
|
}
|
|
135
237
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* @
|
|
238
|
+
* Generates safe gas price with automatic fallback to offline pricing.
|
|
239
|
+
* Attempts live polling first, falls back to static tier pricing if it fails.
|
|
240
|
+
*
|
|
241
|
+
* @param denom - Token denomination to generate gas price for
|
|
242
|
+
* @param tier - Priority tier for fallback gas price calculation (defaults to Low)
|
|
243
|
+
* @param context - Optional SDK context for accessing clients
|
|
244
|
+
* @returns Promise resolving to the gas price (live or fallback)
|
|
140
245
|
*/
|
|
141
246
|
async generateSafeGasPrice(denom, tier = defaultGasPriceTiers.Low, context) {
|
|
142
247
|
if (!this.querier)
|
|
@@ -151,11 +256,14 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
151
256
|
}
|
|
152
257
|
}
|
|
153
258
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @param
|
|
158
|
-
* @
|
|
259
|
+
* Generates safe gas price with exponential backoff retry mechanism.
|
|
260
|
+
* Retries live polling with exponential backoff before falling back to offline pricing.
|
|
261
|
+
*
|
|
262
|
+
* @param denom - Token denomination to generate gas price for
|
|
263
|
+
* @param tier - Priority tier for fallback gas price calculation (defaults to Low)
|
|
264
|
+
* @param backoffOptions - Retry configuration options (defaults to DefaultBackoffOptions)
|
|
265
|
+
* @param context - Optional SDK context for accessing clients
|
|
266
|
+
* @returns Promise resolving to the gas price (live with retries or fallback)
|
|
159
267
|
*/
|
|
160
268
|
async generateSafeGasPriceWithExponentialBackoff(denom, tier = defaultGasPriceTiers.Low, backoffOptions = DefaultBackoffOptions, context) {
|
|
161
269
|
if (!this.querier)
|
|
@@ -169,11 +277,13 @@ export class FeemarketModule extends AbstractCheqdSDKModule {
|
|
|
169
277
|
return await this.generateOfflineGasPrice(denom, tier);
|
|
170
278
|
}
|
|
171
279
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @param
|
|
176
|
-
* @
|
|
280
|
+
* Generates transaction fees from a given gas price.
|
|
281
|
+
* Calculates the total fee amount based on gas price and gas limit.
|
|
282
|
+
*
|
|
283
|
+
* @param gasPrice - Gas price to use for fee calculation
|
|
284
|
+
* @param payer - Address of the account paying the transaction fees
|
|
285
|
+
* @param gas - Gas limit for the transaction (defaults to '200000')
|
|
286
|
+
* @returns Standard fee configuration for the transaction
|
|
177
287
|
*/
|
|
178
288
|
static generateFeesFromGasPrice(gasPrice, payer, gas = '200000') {
|
|
179
289
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feemarket.js","sourceRoot":"","sources":["../../../esm/src/modules/feemarket.ts"],"names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OAAO,KAAK,EAAE,CAAC;YAChB,6BAA6B;YAC7B,OAAO,MAAM,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;IACF,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,0CAA0C,CAC/C,KAAa,EACb,OAA6B,oBAAoB,CAAC,GAAG,EACrD,cAAc,GAAG,qBAAqB,EACtC,OAAkB;QAElB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,IAAI,CAAC,OAAO,GAAG,OAAQ,CAAC,GAAI,CAAC,OAAO,CAAC;QAExD,0BAA0B;QAC1B,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC;QAE1F,wBAAwB;QACxB,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,wCAAwC;QACxC,OAAO,MAAM,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,wBAAwB,CAAC,QAAkB,EAAE,KAAa,EAAE,GAAG,GAAG,QAAQ;QAChF,OAAO;YACN,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;YACxG,GAAG;YACH,KAAK;SACe,CAAC;IACvB,CAAC"}
|
|
@@ -6,57 +6,199 @@ import { Metadata, MsgCreateResource, MsgCreateResourcePayload, QueryCollectionR
|
|
|
6
6
|
import { DeliverTxResponse, QueryClient } from '@cosmjs/stargate';
|
|
7
7
|
import { SignInfo } from '@cheqd/ts-proto/cheqd/did/v2/index.js';
|
|
8
8
|
import { CheqdQuerier } from '../querier.js';
|
|
9
|
+
/** Default extension key for resource-related query operations */
|
|
9
10
|
export declare const defaultResourceExtensionKey: "resource";
|
|
11
|
+
/**
|
|
12
|
+
* Protobuf message type literals for resource operations.
|
|
13
|
+
* Used for consistent message type identification across the module.
|
|
14
|
+
*/
|
|
10
15
|
export declare const protobufLiterals: {
|
|
16
|
+
/** Create resource message type */
|
|
11
17
|
readonly MsgCreateResource: "MsgCreateResource";
|
|
18
|
+
/** Create resource response message type */
|
|
12
19
|
readonly MsgCreateResourceResponse: "MsgCreateResourceResponse";
|
|
13
20
|
};
|
|
21
|
+
/** Type URL for MsgCreateResource messages */
|
|
14
22
|
export declare const typeUrlMsgCreateResource: "/cheqd.resource.v2.MsgCreateResource";
|
|
23
|
+
/** Type URL for MsgCreateResourceResponse messages */
|
|
15
24
|
export declare const typeUrlMsgCreateResourceResponse: "/cheqd.resource.v2.MsgCreateResourceResponse";
|
|
25
|
+
/**
|
|
26
|
+
* Encode object interface for MsgCreateResource messages.
|
|
27
|
+
* Used for type-safe message encoding in resource creation transactions.
|
|
28
|
+
*/
|
|
16
29
|
export interface MsgCreateResourceEncodeObject extends EncodeObject {
|
|
17
30
|
readonly typeUrl: typeof typeUrlMsgCreateResource;
|
|
18
31
|
readonly value: Partial<MsgCreateResource>;
|
|
19
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Type guard function to check if an object is a MsgCreateResourceEncodeObject.
|
|
35
|
+
*
|
|
36
|
+
* @param obj - EncodeObject to check
|
|
37
|
+
* @returns True if the object is a MsgCreateResourceEncodeObject
|
|
38
|
+
*/
|
|
20
39
|
export declare function isMsgCreateResourceEncodeObject(obj: EncodeObject): obj is MsgCreateResourceEncodeObject;
|
|
40
|
+
/** Minimal importable version of the resource module for clean external interfaces */
|
|
21
41
|
export type MinimalImportableResourceModule = MinimalImportableCheqdSDKModule<ResourceModule>;
|
|
42
|
+
/**
|
|
43
|
+
* Resource extension interface for querier functionality.
|
|
44
|
+
* Provides methods for querying resources and their metadata.
|
|
45
|
+
*/
|
|
22
46
|
export type ResourceExtension = {
|
|
23
47
|
readonly [defaultResourceExtensionKey]: {
|
|
48
|
+
/** Query a specific resource by collection and resource ID */
|
|
24
49
|
readonly resource: (collectionId: string, resourceId: string) => Promise<ResourceWithMetadata>;
|
|
50
|
+
/** Query metadata for a specific resource */
|
|
25
51
|
readonly resourceMetadata: (collectionId: string, resourceId: string) => Promise<Metadata>;
|
|
52
|
+
/** Query all resources in a collection with pagination support */
|
|
26
53
|
readonly collectionResources: (collectionId: string, paginationKey?: Uint8Array) => Promise<QueryCollectionResourcesResponse>;
|
|
27
54
|
};
|
|
28
55
|
};
|
|
56
|
+
/**
|
|
57
|
+
* Sets up the resource extension for the querier client.
|
|
58
|
+
* Creates and configures the resource-specific query methods.
|
|
59
|
+
*
|
|
60
|
+
* @param base - Base QueryClient to extend
|
|
61
|
+
* @returns Configured resource extension with query methods
|
|
62
|
+
*/
|
|
29
63
|
export declare const setupResourceExtension: (base: QueryClient) => ResourceExtension;
|
|
64
|
+
/**
|
|
65
|
+
* Resource Module class providing comprehensive linked resource functionality.
|
|
66
|
+
* Handles creation, querying, and metadata management of resources linked to DID documents.
|
|
67
|
+
*/
|
|
30
68
|
export declare class ResourceModule extends AbstractCheqdSDKModule {
|
|
31
69
|
static readonly registryTypes: Iterable<[string, GeneratedType]>;
|
|
70
|
+
/** Base denomination for Cheqd network transactions */
|
|
32
71
|
static readonly baseMinimalDenom: "ncheq";
|
|
72
|
+
/**
|
|
73
|
+
* Standard fee amounts for different resource types.
|
|
74
|
+
* Fees vary based on resource content type and processing requirements.
|
|
75
|
+
*/
|
|
33
76
|
static readonly fees: {
|
|
77
|
+
/** Default fee for creating image resources */
|
|
34
78
|
readonly DefaultCreateResourceImageFee: {
|
|
35
79
|
readonly amount: "10000000000";
|
|
36
80
|
readonly denom: "ncheq";
|
|
37
81
|
};
|
|
82
|
+
/** Default fee for creating JSON resources */
|
|
38
83
|
readonly DefaultCreateResourceJsonFee: {
|
|
39
84
|
readonly amount: "10000000000";
|
|
40
85
|
readonly denom: "ncheq";
|
|
41
86
|
};
|
|
87
|
+
/** Default fee for creating other types of resources */
|
|
42
88
|
readonly DefaultCreateResourceDefaultFee: {
|
|
43
89
|
readonly amount: "10000000000";
|
|
44
90
|
readonly denom: "ncheq";
|
|
45
91
|
};
|
|
46
92
|
};
|
|
93
|
+
/** Querier extension setup function for resource operations */
|
|
47
94
|
static readonly querierExtensionSetup: QueryExtensionSetup<ResourceExtension>;
|
|
95
|
+
/** Querier instance with resource extension capabilities */
|
|
48
96
|
querier: CheqdQuerier & ResourceExtension;
|
|
97
|
+
/**
|
|
98
|
+
* Constructs a new resource module instance.
|
|
99
|
+
*
|
|
100
|
+
* @param signer - Signing client for blockchain transactions
|
|
101
|
+
* @param querier - Querier client with resource extension for data retrieval
|
|
102
|
+
*/
|
|
49
103
|
constructor(signer: CheqdSigningStargateClient, querier: CheqdQuerier & ResourceExtension);
|
|
104
|
+
/**
|
|
105
|
+
* Gets the registry types for resource message encoding/decoding.
|
|
106
|
+
*
|
|
107
|
+
* @returns Iterable of [typeUrl, GeneratedType] pairs for the registry
|
|
108
|
+
*/
|
|
50
109
|
getRegistryTypes(): Iterable<[string, GeneratedType]>;
|
|
110
|
+
/**
|
|
111
|
+
* Gets the querier extension setup for resource operations.
|
|
112
|
+
*
|
|
113
|
+
* @returns Query extension setup function for resource functionality
|
|
114
|
+
*/
|
|
51
115
|
getQuerierExtensionSetup(): QueryExtensionSetup<ResourceExtension>;
|
|
116
|
+
/**
|
|
117
|
+
* Signs a resource payload with provided signature inputs.
|
|
118
|
+
* Creates a complete signed resource message ready for blockchain submission.
|
|
119
|
+
*
|
|
120
|
+
* @param payload - Resource payload to sign
|
|
121
|
+
* @param signInputs - Signing inputs or pre-computed signatures
|
|
122
|
+
* @returns Promise resolving to the signed resource message
|
|
123
|
+
*/
|
|
52
124
|
static signPayload(payload: MsgCreateResourcePayload, signInputs: ISignInputs[] | SignInfo[]): Promise<MsgCreateResource>;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a linked resource transaction on the blockchain.
|
|
127
|
+
* Handles automatic fee calculation based on resource content type and size.
|
|
128
|
+
*
|
|
129
|
+
* @param signInputs - Signing inputs or pre-computed signatures for the transaction
|
|
130
|
+
* @param resourcePayload - Resource payload containing data and metadata
|
|
131
|
+
* @param address - Address of the account submitting the transaction
|
|
132
|
+
* @param fee - Transaction fee configuration or 'auto' for automatic calculation
|
|
133
|
+
* @param memo - Optional transaction memo
|
|
134
|
+
* @param context - Optional SDK context for accessing clients
|
|
135
|
+
* @returns Promise resolving to the transaction response
|
|
136
|
+
* @throws Error if linked resource data is empty when automatic fee calculation is requested
|
|
137
|
+
*/
|
|
53
138
|
createLinkedResourceTx(signInputs: ISignInputs[] | SignInfo[], resourcePayload: Partial<MsgCreateResourcePayload>, address: string, fee?: DidStdFee | 'auto' | number, memo?: string, context?: IContext): Promise<DeliverTxResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* Queries a specific linked resource by collection and resource ID.
|
|
141
|
+
* Retrieves the complete resource data along with its metadata.
|
|
142
|
+
*
|
|
143
|
+
* @param collectionId - ID of the collection containing the resource
|
|
144
|
+
* @param resourceId - ID of the resource to query
|
|
145
|
+
* @param context - Optional SDK context for accessing clients
|
|
146
|
+
* @returns Promise resolving to the resource with metadata
|
|
147
|
+
*/
|
|
54
148
|
queryLinkedResource(collectionId: string, resourceId: string, context?: IContext): Promise<ResourceWithMetadata>;
|
|
149
|
+
/**
|
|
150
|
+
* Queries metadata for a specific linked resource.
|
|
151
|
+
* Retrieves only the metadata without the resource content data.
|
|
152
|
+
*
|
|
153
|
+
* @param collectionId - ID of the collection containing the resource
|
|
154
|
+
* @param resourceId - ID of the resource to query metadata for
|
|
155
|
+
* @param context - Optional SDK context for accessing clients
|
|
156
|
+
* @returns Promise resolving to the resource metadata
|
|
157
|
+
*/
|
|
55
158
|
queryLinkedResourceMetadata(collectionId: string, resourceId: string, context?: IContext): Promise<Metadata>;
|
|
159
|
+
/**
|
|
160
|
+
* Queries all resources in a collection with pagination support.
|
|
161
|
+
* Retrieves a list of all resources belonging to a specific collection.
|
|
162
|
+
*
|
|
163
|
+
* @param collectionId - ID of the collection to query resources for
|
|
164
|
+
* @param context - Optional SDK context for accessing clients
|
|
165
|
+
* @returns Promise resolving to the collection resources response with pagination
|
|
166
|
+
*/
|
|
56
167
|
queryLinkedResources(collectionId: string, context?: IContext): Promise<QueryCollectionResourcesResponse>;
|
|
168
|
+
/**
|
|
169
|
+
* Reads and determines the MIME type of resource content.
|
|
170
|
+
* Analyzes the content to identify the appropriate MIME type for fee calculation and validation.
|
|
171
|
+
*
|
|
172
|
+
* @param content - Resource content as byte array
|
|
173
|
+
* @returns Promise resolving to the detected MIME type string
|
|
174
|
+
*/
|
|
57
175
|
static readMimeType(content: Uint8Array): Promise<string>;
|
|
176
|
+
/**
|
|
177
|
+
* Generates fee configuration for image resource creation transactions.
|
|
178
|
+
* Uses higher gas limits appropriate for image processing and storage.
|
|
179
|
+
*
|
|
180
|
+
* @param feePayer - Address of the account that will pay the transaction fees
|
|
181
|
+
* @param granter - Optional address of the account granting fee payment permissions
|
|
182
|
+
* @returns Promise resolving to the fee configuration for image resources
|
|
183
|
+
*/
|
|
58
184
|
static generateCreateResourceImageFees(feePayer: string, granter?: string): Promise<DidStdFee>;
|
|
185
|
+
/**
|
|
186
|
+
* Generates fee configuration for JSON resource creation transactions.
|
|
187
|
+
* Uses gas limits optimized for JSON data processing and validation.
|
|
188
|
+
*
|
|
189
|
+
* @param feePayer - Address of the account that will pay the transaction fees
|
|
190
|
+
* @param granter - Optional address of the account granting fee payment permissions
|
|
191
|
+
* @returns Promise resolving to the fee configuration for JSON resources
|
|
192
|
+
*/
|
|
59
193
|
static generateCreateResourceJsonFees(feePayer: string, granter?: string): Promise<DidStdFee>;
|
|
194
|
+
/**
|
|
195
|
+
* Generates fee configuration for default resource creation transactions.
|
|
196
|
+
* Uses standard gas limits for generic resource types and binary data.
|
|
197
|
+
*
|
|
198
|
+
* @param feePayer - Address of the account that will pay the transaction fees
|
|
199
|
+
* @param granter - Optional address of the account granting fee payment permissions
|
|
200
|
+
* @returns Promise resolving to the fee configuration for default resources
|
|
201
|
+
*/
|
|
60
202
|
static generateCreateResourceDefaultFees(feePayer: string, granter?: string): Promise<DidStdFee>;
|
|
61
203
|
}
|
|
62
204
|
//# sourceMappingURL=resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../esm/src/modules/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpF,OAAO,EACN,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,EAGxB,gCAAgC,EAChC,oBAAoB,EAEpB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAA6C,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAKjE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAG7C,eAAO,MAAM,2BAA2B,EAAG,UAAmB,CAAC;AAE/D,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../../esm/src/modules/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,M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