@cheqd/sdk 5.4.0-develop.3 → 5.4.1-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/build/esm/package.json +1 -1
  2. package/package.json +1 -1
  3. package/build/esm/cjs/src/index.d.ts +0 -142
  4. package/build/esm/cjs/src/index.d.ts.map +0 -1
  5. package/build/esm/cjs/src/index.js +0 -184
  6. package/build/esm/cjs/src/index.js.map +0 -1
  7. package/build/esm/cjs/src/modules/_.d.ts +0 -81
  8. package/build/esm/cjs/src/modules/_.d.ts.map +0 -1
  9. package/build/esm/cjs/src/modules/_.js +0 -93
  10. package/build/esm/cjs/src/modules/_.js.map +0 -1
  11. package/build/esm/cjs/src/modules/did.d.ts +0 -490
  12. package/build/esm/cjs/src/modules/did.d.ts.map +0 -1
  13. package/build/esm/cjs/src/modules/did.js +0 -1274
  14. package/build/esm/cjs/src/modules/did.js.map +0 -1
  15. package/build/esm/cjs/src/modules/feeabstraction.d.ts +0 -429
  16. package/build/esm/cjs/src/modules/feeabstraction.d.ts.map +0 -1
  17. package/build/esm/cjs/src/modules/feeabstraction.js +0 -474
  18. package/build/esm/cjs/src/modules/feeabstraction.js.map +0 -1
  19. package/build/esm/cjs/src/modules/feemarket.d.ts +0 -244
  20. package/build/esm/cjs/src/modules/feemarket.d.ts.map +0 -1
  21. package/build/esm/cjs/src/modules/feemarket.js +0 -297
  22. package/build/esm/cjs/src/modules/feemarket.js.map +0 -1
  23. package/build/esm/cjs/src/modules/oracle.d.ts +0 -563
  24. package/build/esm/cjs/src/modules/oracle.d.ts.map +0 -1
  25. package/build/esm/cjs/src/modules/oracle.js +0 -784
  26. package/build/esm/cjs/src/modules/oracle.js.map +0 -1
  27. package/build/esm/cjs/src/modules/resource.d.ts +0 -332
  28. package/build/esm/cjs/src/modules/resource.d.ts.map +0 -1
  29. package/build/esm/cjs/src/modules/resource.js +0 -575
  30. package/build/esm/cjs/src/modules/resource.js.map +0 -1
  31. package/build/esm/cjs/src/querier.d.ts +0 -83
  32. package/build/esm/cjs/src/querier.d.ts.map +0 -1
  33. package/build/esm/cjs/src/querier.js +0 -138
  34. package/build/esm/cjs/src/querier.js.map +0 -1
  35. package/build/esm/cjs/src/registry.d.ts +0 -18
  36. package/build/esm/cjs/src/registry.d.ts.map +0 -1
  37. package/build/esm/cjs/src/registry.js +0 -23
  38. package/build/esm/cjs/src/registry.js.map +0 -1
  39. package/build/esm/cjs/src/signer.d.ts +0 -250
  40. package/build/esm/cjs/src/signer.d.ts.map +0 -1
  41. package/build/esm/cjs/src/signer.js +0 -617
  42. package/build/esm/cjs/src/signer.js.map +0 -1
  43. package/build/esm/cjs/src/types.d.ts +0 -221
  44. package/build/esm/cjs/src/types.d.ts.map +0 -1
  45. package/build/esm/cjs/src/types.js.map +0 -1
  46. package/build/esm/cjs/src/utils.d.ts +0 -233
  47. package/build/esm/cjs/src/utils.d.ts.map +0 -1
  48. package/build/esm/cjs/src/utils.js +0 -571
  49. package/build/esm/cjs/src/utils.js.map +0 -1
  50. package/build/esm/esm/src/types.js +0 -43
  51. package/build/types/cjs/src/index.d.ts +0 -142
  52. package/build/types/cjs/src/index.d.ts.map +0 -1
  53. package/build/types/cjs/src/modules/_.d.ts +0 -81
  54. package/build/types/cjs/src/modules/_.d.ts.map +0 -1
  55. package/build/types/cjs/src/modules/did.d.ts +0 -490
  56. package/build/types/cjs/src/modules/did.d.ts.map +0 -1
  57. package/build/types/cjs/src/modules/feeabstraction.d.ts +0 -429
  58. package/build/types/cjs/src/modules/feeabstraction.d.ts.map +0 -1
  59. package/build/types/cjs/src/modules/feemarket.d.ts +0 -244
  60. package/build/types/cjs/src/modules/feemarket.d.ts.map +0 -1
  61. package/build/types/cjs/src/modules/oracle.d.ts +0 -563
  62. package/build/types/cjs/src/modules/oracle.d.ts.map +0 -1
  63. package/build/types/cjs/src/modules/resource.d.ts +0 -332
  64. package/build/types/cjs/src/modules/resource.d.ts.map +0 -1
  65. package/build/types/cjs/src/querier.d.ts +0 -83
  66. package/build/types/cjs/src/querier.d.ts.map +0 -1
  67. package/build/types/cjs/src/registry.d.ts +0 -18
  68. package/build/types/cjs/src/registry.d.ts.map +0 -1
  69. package/build/types/cjs/src/signer.d.ts +0 -250
  70. package/build/types/cjs/src/signer.d.ts.map +0 -1
  71. package/build/types/cjs/src/types.d.ts +0 -221
  72. package/build/types/cjs/src/types.d.ts.map +0 -1
  73. package/build/types/cjs/src/utils.d.ts +0 -233
  74. package/build/types/cjs/src/utils.d.ts.map +0 -1
  75. /package/build/esm/{esm/src/index.d.ts → index.d.ts} +0 -0
  76. /package/build/esm/{esm/src/index.d.ts.map → index.d.ts.map} +0 -0
  77. /package/build/esm/{esm/src/index.js → index.js} +0 -0
  78. /package/build/esm/{esm/src/index.js.map → index.js.map} +0 -0
  79. /package/build/esm/{esm/src/modules → modules}/_.d.ts +0 -0
  80. /package/build/esm/{esm/src/modules → modules}/_.d.ts.map +0 -0
  81. /package/build/esm/{esm/src/modules → modules}/_.js +0 -0
  82. /package/build/esm/{esm/src/modules → modules}/_.js.map +0 -0
  83. /package/build/esm/{esm/src/modules → modules}/did.d.ts +0 -0
  84. /package/build/esm/{esm/src/modules → modules}/did.d.ts.map +0 -0
  85. /package/build/esm/{esm/src/modules → modules}/did.js +0 -0
  86. /package/build/esm/{esm/src/modules → modules}/did.js.map +0 -0
  87. /package/build/esm/{esm/src/modules → modules}/feeabstraction.d.ts +0 -0
  88. /package/build/esm/{esm/src/modules → modules}/feeabstraction.d.ts.map +0 -0
  89. /package/build/esm/{esm/src/modules → modules}/feeabstraction.js +0 -0
  90. /package/build/esm/{esm/src/modules → modules}/feeabstraction.js.map +0 -0
  91. /package/build/esm/{esm/src/modules → modules}/feemarket.d.ts +0 -0
  92. /package/build/esm/{esm/src/modules → modules}/feemarket.d.ts.map +0 -0
  93. /package/build/esm/{esm/src/modules → modules}/feemarket.js +0 -0
  94. /package/build/esm/{esm/src/modules → modules}/feemarket.js.map +0 -0
  95. /package/build/esm/{esm/src/modules → modules}/oracle.d.ts +0 -0
  96. /package/build/esm/{esm/src/modules → modules}/oracle.d.ts.map +0 -0
  97. /package/build/esm/{esm/src/modules → modules}/oracle.js +0 -0
  98. /package/build/esm/{esm/src/modules → modules}/oracle.js.map +0 -0
  99. /package/build/esm/{esm/src/modules → modules}/resource.d.ts +0 -0
  100. /package/build/esm/{esm/src/modules → modules}/resource.d.ts.map +0 -0
  101. /package/build/esm/{esm/src/modules → modules}/resource.js +0 -0
  102. /package/build/esm/{esm/src/modules → modules}/resource.js.map +0 -0
  103. /package/build/esm/{esm/src/querier.d.ts → querier.d.ts} +0 -0
  104. /package/build/esm/{esm/src/querier.d.ts.map → querier.d.ts.map} +0 -0
  105. /package/build/esm/{esm/src/querier.js → querier.js} +0 -0
  106. /package/build/esm/{esm/src/querier.js.map → querier.js.map} +0 -0
  107. /package/build/esm/{esm/src/registry.d.ts → registry.d.ts} +0 -0
  108. /package/build/esm/{esm/src/registry.d.ts.map → registry.d.ts.map} +0 -0
  109. /package/build/esm/{esm/src/registry.js → registry.js} +0 -0
  110. /package/build/esm/{esm/src/registry.js.map → registry.js.map} +0 -0
  111. /package/build/esm/{esm/src/signer.d.ts → signer.d.ts} +0 -0
  112. /package/build/esm/{esm/src/signer.d.ts.map → signer.d.ts.map} +0 -0
  113. /package/build/esm/{esm/src/signer.js → signer.js} +0 -0
  114. /package/build/esm/{esm/src/signer.js.map → signer.js.map} +0 -0
  115. /package/build/esm/{esm/src/types.d.ts → types.d.ts} +0 -0
  116. /package/build/esm/{esm/src/types.d.ts.map → types.d.ts.map} +0 -0
  117. /package/build/esm/{cjs/src/types.js → types.js} +0 -0
  118. /package/build/esm/{esm/src/types.js.map → types.js.map} +0 -0
  119. /package/build/esm/{esm/src/utils.d.ts → utils.d.ts} +0 -0
  120. /package/build/esm/{esm/src/utils.d.ts.map → utils.d.ts.map} +0 -0
  121. /package/build/esm/{esm/src/utils.js → utils.js} +0 -0
  122. /package/build/esm/{esm/src/utils.js.map → utils.js.map} +0 -0
  123. /package/build/types/{esm/src/index.d.ts → index.d.ts} +0 -0
  124. /package/build/types/{esm/src/index.d.ts.map → index.d.ts.map} +0 -0
  125. /package/build/types/{esm/src/modules → modules}/_.d.ts +0 -0
  126. /package/build/types/{esm/src/modules → modules}/_.d.ts.map +0 -0
  127. /package/build/types/{esm/src/modules → modules}/did.d.ts +0 -0
  128. /package/build/types/{esm/src/modules → modules}/did.d.ts.map +0 -0
  129. /package/build/types/{esm/src/modules → modules}/feeabstraction.d.ts +0 -0
  130. /package/build/types/{esm/src/modules → modules}/feeabstraction.d.ts.map +0 -0
  131. /package/build/types/{esm/src/modules → modules}/feemarket.d.ts +0 -0
  132. /package/build/types/{esm/src/modules → modules}/feemarket.d.ts.map +0 -0
  133. /package/build/types/{esm/src/modules → modules}/oracle.d.ts +0 -0
  134. /package/build/types/{esm/src/modules → modules}/oracle.d.ts.map +0 -0
  135. /package/build/types/{esm/src/modules → modules}/resource.d.ts +0 -0
  136. /package/build/types/{esm/src/modules → modules}/resource.d.ts.map +0 -0
  137. /package/build/types/{esm/src/querier.d.ts → querier.d.ts} +0 -0
  138. /package/build/types/{esm/src/querier.d.ts.map → querier.d.ts.map} +0 -0
  139. /package/build/types/{esm/src/registry.d.ts → registry.d.ts} +0 -0
  140. /package/build/types/{esm/src/registry.d.ts.map → registry.d.ts.map} +0 -0
  141. /package/build/types/{esm/src/signer.d.ts → signer.d.ts} +0 -0
  142. /package/build/types/{esm/src/signer.d.ts.map → signer.d.ts.map} +0 -0
  143. /package/build/types/{esm/src/types.d.ts → types.d.ts} +0 -0
  144. /package/build/types/{esm/src/types.d.ts.map → types.d.ts.map} +0 -0
  145. /package/build/types/{esm/src/utils.d.ts → utils.d.ts} +0 -0
  146. /package/build/types/{esm/src/utils.d.ts.map → utils.d.ts.map} +0 -0
@@ -1,575 +0,0 @@
1
- import { AbstractCheqdSDKModule } from './_';
2
- import { CheqdSigningStargateClient } from '../signer';
3
- import { parseCoins } from '@cosmjs/proto-signing-cjs';
4
- import { CheqdNetwork, ISignInputs } from '../types';
5
- import { MsgCreateResource, MsgCreateResourcePayload, MsgCreateResourceResponse, QueryClientImpl, protobufPackage, } from '@cheqd/ts-proto-cjs/cheqd/resource/v2/index';
6
- import { createPagination, createProtobufRpcClient } from '@cosmjs/stargate-cjs';
7
- import { fromBuffer } from 'file-type-cjs';
8
- import { toString } from 'uint8arrays-cjs';
9
- import { assert } from '@cosmjs/utils-cjs';
10
- import { CheqdQuerier } from '../querier';
11
- import { isJSON } from '../utils';
12
- import { defaultOracleExtensionKey, MovingAverages, WMAStrategies } from './oracle';
13
- import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin';
14
- /** Default extension key for resource-related query operations */
15
- export const defaultResourceExtensionKey = 'resource';
16
- /**
17
- * Protobuf message type literals for resource operations.
18
- * Used for consistent message type identification across the module.
19
- */
20
- export const protobufLiterals = {
21
- /** Create resource message type */
22
- MsgCreateResource: 'MsgCreateResource',
23
- /** Create resource response message type */
24
- MsgCreateResourceResponse: 'MsgCreateResourceResponse',
25
- };
26
- /** Type URL for MsgCreateResource messages */
27
- export const typeUrlMsgCreateResource = `/${protobufPackage}.${protobufLiterals.MsgCreateResource}`;
28
- /** Type URL for MsgCreateResourceResponse messages */
29
- export const typeUrlMsgCreateResourceResponse = `/${protobufPackage}.${protobufLiterals.MsgCreateResourceResponse}`;
30
- /**
31
- * Type guard function to check if an object is a MsgCreateResourceEncodeObject.
32
- *
33
- * @param obj - EncodeObject to check
34
- * @returns True if the object is a MsgCreateResourceEncodeObject
35
- */
36
- export function isMsgCreateResourceEncodeObject(obj) {
37
- return obj.typeUrl === typeUrlMsgCreateResource;
38
- }
39
- /**
40
- * Sets up the resource extension for the querier client.
41
- * Creates and configures the resource-specific query methods.
42
- *
43
- * @param base - Base QueryClient to extend
44
- * @returns Configured resource extension with query methods
45
- */
46
- export const setupResourceExtension = (base) => {
47
- const rpc = createProtobufRpcClient(base);
48
- const queryService = new QueryClientImpl(rpc);
49
- return {
50
- [defaultResourceExtensionKey]: {
51
- resource: async (collectionId, resourceId) => {
52
- const { resource } = await queryService.Resource({ collectionId, id: resourceId });
53
- assert(resource);
54
- return resource;
55
- },
56
- resourceMetadata: async (collectionId, resourceId) => {
57
- const { resource } = await queryService.ResourceMetadata({ collectionId, id: resourceId });
58
- assert(resource);
59
- return resource;
60
- },
61
- collectionResources: async (collectionId, paginationKey) => {
62
- const response = await queryService.CollectionResources({
63
- collectionId,
64
- pagination: createPagination(paginationKey),
65
- });
66
- return response;
67
- },
68
- latestResourceVersion: async (collectionId, name, type) => {
69
- const { resource } = await queryService.LatestResourceVersion({
70
- collectionId,
71
- name,
72
- resourceType: type,
73
- });
74
- assert(resource);
75
- return resource;
76
- },
77
- latestResourceVersionMetadata: async (collectionId, name, type) => {
78
- const { resource } = await queryService.LatestResourceVersionMetadata({
79
- collectionId,
80
- name,
81
- resourceType: type,
82
- });
83
- assert(resource);
84
- return resource;
85
- },
86
- params: async () => {
87
- const response = await queryService.Params({});
88
- assert(response.params);
89
- return response;
90
- },
91
- },
92
- };
93
- };
94
- /**
95
- * Resource Module class providing comprehensive linked resource functionality.
96
- * Handles creation, querying, and metadata management of resources linked to DID documents.
97
- */
98
- export class ResourceModule extends AbstractCheqdSDKModule {
99
- // @ts-expect-error underlying type `GeneratedType` is intentionally wider
100
- static registryTypes = [
101
- [typeUrlMsgCreateResource, MsgCreateResource],
102
- [typeUrlMsgCreateResourceResponse, MsgCreateResourceResponse],
103
- ];
104
- /** Base denomination for Cheqd network transactions */
105
- static baseMinimalDenom = 'ncheq';
106
- /** Base denomination in USD for Cheqd network transactions */
107
- static baseUsdDenom = 'usd';
108
- /** Default slippage tolerance in base points (BPS) */
109
- static defaultSlippageBps = 500n;
110
- /**
111
- * Standard fee amounts for different resource types.
112
- * Fees vary based on resource content type and processing requirements.
113
- */
114
- static fees = {
115
- /** Default fee for creating image resources */
116
- DefaultCreateResourceImageFee: { amount: '10000000000', denom: ResourceModule.baseMinimalDenom },
117
- /** Default fee for creating JSON resources */
118
- DefaultCreateResourceJsonFee: { amount: '10000000000', denom: ResourceModule.baseMinimalDenom },
119
- /** Default fee for creating other types of resources */
120
- DefaultCreateResourceDefaultFee: { amount: '10000000000', denom: ResourceModule.baseMinimalDenom },
121
- /** Default fee for creating image resources in USD */
122
- DefaultCreateResourceImageFeeUsd: { amount: '100000000000000000', denom: ResourceModule.baseUsdDenom },
123
- /** Default fee for creating JSON resources in USD */
124
- DefaultCreateResourceJsonFeeUsd: { amount: '400000000000000000', denom: ResourceModule.baseUsdDenom },
125
- /** Default fee for creating other types of resources in USD */
126
- DefaultCreateResourceDefaultFeeUsd: {
127
- amount: '200000000000000000',
128
- denom: ResourceModule.baseUsdDenom,
129
- },
130
- };
131
- /** Standard gas limits for DLR operations.
132
- * These represent the default gas limits for various DLR-related transactions.
133
- */
134
- static gasLimits = {
135
- /** Gas limit for creating linked resources */
136
- CreateLinkedResourceImageGasLimit: '1000000',
137
- /** Gas limit for creating linked JSON resources */
138
- CreateLinkedResourceJsonGasLimit: '1000000',
139
- /** Gas limit for creating other types of linked resources */
140
- CreateLinkedResourceDefaultGasLimit: '1000000',
141
- };
142
- /** Querier extension setup function for resource operations */
143
- static querierExtensionSetup = setupResourceExtension;
144
- /** Querier instance with resource extension capabilities */
145
- querier;
146
- /**
147
- * Constructs a new resource module instance.
148
- *
149
- * @param signer - Signing client for blockchain transactions
150
- * @param querier - Querier client with resource extension for data retrieval
151
- */
152
- constructor(signer, querier) {
153
- super(signer, querier);
154
- this.querier = querier;
155
- this.methods = {
156
- createLinkedResourceTx: this.createLinkedResourceTx.bind(this),
157
- queryLinkedResource: this.queryLinkedResource.bind(this),
158
- queryLinkedResourceMetadata: this.queryLinkedResourceMetadata.bind(this),
159
- queryLinkedResources: this.queryLinkedResources.bind(this),
160
- queryLatestLinkedResourceVersion: this.queryLatestLinkedResourceVersion.bind(this),
161
- queryLatestLinkedResourceVersionMetadata: this.queryLatestLinkedResourceVersionMetadata.bind(this),
162
- queryParams: this.queryParams.bind(this),
163
- generateCreateResourceImageFees: this.generateCreateResourceImageFees.bind(this),
164
- generateCreateResourceJsonFees: this.generateCreateResourceJsonFees.bind(this),
165
- generateCreateResourceDefaultFees: this.generateCreateResourceDefaultFees.bind(this),
166
- getPriceRangeFromParams: this.getPriceRangeFromParams.bind(this),
167
- };
168
- }
169
- /**
170
- * Gets the registry types for resource message encoding/decoding.
171
- *
172
- * @returns Iterable of [typeUrl, GeneratedType] pairs for the registry
173
- */
174
- getRegistryTypes() {
175
- return ResourceModule.registryTypes;
176
- }
177
- /**
178
- * Gets the querier extension setup for resource operations.
179
- *
180
- * @returns Query extension setup function for resource functionality
181
- */
182
- getQuerierExtensionSetup() {
183
- return ResourceModule.querierExtensionSetup;
184
- }
185
- /**
186
- * Signs a resource payload with provided signature inputs.
187
- * Creates a complete signed resource message ready for blockchain submission.
188
- *
189
- * @param payload - Resource payload to sign
190
- * @param signInputs - Signing inputs or pre-computed signatures
191
- * @returns Promise resolving to the signed resource message
192
- */
193
- static async signPayload(payload, signInputs) {
194
- const signBytes = MsgCreateResourcePayload.encode(payload).finish();
195
- let signatures;
196
- if (ISignInputs.isSignInput(signInputs)) {
197
- signatures = await CheqdSigningStargateClient.signIdentityTx(signBytes, signInputs);
198
- }
199
- else {
200
- signatures = signInputs;
201
- }
202
- return {
203
- payload,
204
- signatures,
205
- };
206
- }
207
- /**
208
- * Creates a linked resource transaction on the blockchain.
209
- * Handles automatic fee calculation based on resource content type and size.
210
- *
211
- * @param signInputs - Signing inputs or pre-computed signatures for the transaction
212
- * @param resourcePayload - Resource payload containing data and metadata
213
- * @param address - Address of the account submitting the transaction
214
- * @param fee - Transaction fee configuration or 'auto' for automatic calculation
215
- * @param memo - Optional transaction memo
216
- * @param feeOptions - Optional fee options for the transaction
217
- * @param context - Optional SDK context for accessing clients
218
- * @returns Promise resolving to the transaction response
219
- * @throws Error if linked resource data is empty when automatic fee calculation is requested
220
- */
221
- async createLinkedResourceTx(signInputs, resourcePayload, address, fee, memo, feeOptions, context) {
222
- if (!this._signer) {
223
- this._signer = context.sdk.signer;
224
- }
225
- const payload = MsgCreateResourcePayload.fromPartial(resourcePayload);
226
- const msg = await ResourceModule.signPayload(payload, signInputs);
227
- const encObj = {
228
- typeUrl: typeUrlMsgCreateResource,
229
- value: msg,
230
- };
231
- if (address === '') {
232
- address = (await context.sdk.options.wallet.getAccounts())[0].address;
233
- }
234
- if (!fee) {
235
- if (payload.data.length === 0) {
236
- throw new Error('Linked resource data is empty');
237
- }
238
- fee = await (async function (that) {
239
- const mimeType = await ResourceModule.readMimeType(payload.data);
240
- if (mimeType.startsWith('image/')) {
241
- return await that.generateCreateResourceImageFees(address, undefined, feeOptions, context);
242
- }
243
- if (mimeType.startsWith('application/json')) {
244
- return await that.generateCreateResourceJsonFees(address, undefined, feeOptions, context);
245
- }
246
- return await that.generateCreateResourceDefaultFees(address, undefined, feeOptions, context);
247
- })(this);
248
- }
249
- return this._signer.signAndBroadcast(address, [encObj], fee, memo);
250
- }
251
- /**
252
- * Queries a specific linked resource by collection and resource ID.
253
- * Retrieves the complete resource data along with its metadata.
254
- *
255
- * @param collectionId - ID of the collection containing the resource
256
- * @param resourceId - ID of the resource to query
257
- * @param context - Optional SDK context for accessing clients
258
- * @returns Promise resolving to the resource with metadata
259
- */
260
- async queryLinkedResource(collectionId, resourceId, context) {
261
- if (!this.querier) {
262
- this.querier = context.sdk.querier;
263
- }
264
- return await this.querier[defaultResourceExtensionKey].resource(collectionId, resourceId);
265
- }
266
- /**
267
- * Queries metadata for a specific linked resource.
268
- * Retrieves only the metadata without the resource content data.
269
- *
270
- * @param collectionId - ID of the collection containing the resource
271
- * @param resourceId - ID of the resource to query metadata for
272
- * @param context - Optional SDK context for accessing clients
273
- * @returns Promise resolving to the resource metadata
274
- */
275
- async queryLinkedResourceMetadata(collectionId, resourceId, context) {
276
- if (!this.querier) {
277
- this.querier = context.sdk.querier;
278
- }
279
- return await this.querier[defaultResourceExtensionKey].resourceMetadata(collectionId, resourceId);
280
- }
281
- /**
282
- * Queries all resources in a collection with pagination support.
283
- * Retrieves a list of all resources belonging to a specific collection.
284
- *
285
- * @param collectionId - ID of the collection to query resources for
286
- * @param context - Optional SDK context for accessing clients
287
- * @returns Promise resolving to the collection resources response with pagination
288
- */
289
- async queryLinkedResources(collectionId, context) {
290
- if (!this.querier) {
291
- this.querier = context.sdk.querier;
292
- }
293
- return await this.querier[defaultResourceExtensionKey].collectionResources(collectionId);
294
- }
295
- /**
296
- * Queries the latest version of a linked resource by collection ID, name, and type.
297
- * Retrieves the most recent version of the specified resource.
298
- *
299
- * @param collectionId - ID of the collection containing the resource
300
- * @param name - Name of the resource
301
- * @param type - Type of the resource
302
- * @param context - Optional SDK context for accessing clients
303
- * @returns Promise resolving to the latest resource version with metadata
304
- */
305
- async queryLatestLinkedResourceVersion(collectionId, name, type, context) {
306
- if (!this.querier) {
307
- this.querier = context.sdk.querier;
308
- }
309
- return await this.querier[defaultResourceExtensionKey].latestResourceVersion(collectionId, name, type);
310
- }
311
- /**
312
- * Queries the latest metadata of a linked resource by collection ID, name, and type.
313
- * Retrieves only the metadata of the most recent version of the specified resource.
314
- *
315
- * @param collectionId - ID of the collection containing the resource
316
- * @param name - Name of the resource
317
- * @param type - Type of the resource
318
- * @param context - Optional SDK context for accessing clients
319
- * @returns Promise resolving to the latest resource metadata
320
- */
321
- async queryLatestLinkedResourceVersionMetadata(collectionId, name, type, context) {
322
- if (!this.querier) {
323
- this.querier = context.sdk.querier;
324
- }
325
- return await this.querier[defaultResourceExtensionKey].latestResourceVersionMetadata(collectionId, name, type);
326
- }
327
- async resolveNetworkForFees(context) {
328
- if (context?.sdk?.options?.rpcUrl) {
329
- return await CheqdQuerier.detectNetwork(context.sdk.options.rpcUrl);
330
- }
331
- return context?.sdk?.options?.network ?? CheqdNetwork.Testnet;
332
- }
333
- async shouldUseOracleFees(context) {
334
- return (await this.resolveNetworkForFees(context)) === CheqdNetwork.Testnet;
335
- }
336
- /**
337
- * Queries the Resource module parameters from the blockchain.
338
- * @param context - Optional SDK context for accessing clients
339
- * @returns Promise resolving to the Resource module parameters
340
- */
341
- async queryParams(context) {
342
- if (!this.querier) {
343
- this.querier = context.sdk.querier;
344
- }
345
- return await this.querier[defaultResourceExtensionKey].params();
346
- }
347
- /**
348
- * Generates oracle-powered fees for creating image DID-Linked Resources.
349
- *
350
- * @param feePayer - Address of the account that will pay the transaction fees
351
- * @param granter - Optional address of the account granting fee payment permissions
352
- * @param feeOptions - Options for fetching oracle fees
353
- * @param context - Optional SDK context for accessing clients
354
- * @returns Promise resolving to the fee configuration for DLR creation
355
- */
356
- async generateCreateResourceImageFees(feePayer, granter, feeOptions, context) {
357
- if (!this.querier) {
358
- this.querier = context.sdk.querier;
359
- }
360
- if (!(await this.shouldUseOracleFees(context))) {
361
- return ResourceModule.generateCreateResourceImageFees(feePayer, granter);
362
- }
363
- // fetch fee parameters from the Resource module
364
- const feeParams = await this.queryParams(context);
365
- // get the price range for the image resource creation
366
- const priceRange = await this.getPriceRangeFromParams(feeParams, 'image', feeOptions);
367
- // calculate the oracle fee amount based on the price range and options
368
- return {
369
- amount: [await this.calculateOracleFeeAmount(priceRange, feeOptions, context)],
370
- gas: ResourceModule.gasLimits.CreateLinkedResourceImageGasLimit,
371
- payer: feePayer,
372
- granter,
373
- };
374
- }
375
- /**
376
- * Generates oracle-powered fees for creating JSON DID-Linked Resources.
377
- *
378
- * @param feePayer - Address of the account that will pay the transaction fees
379
- * @param granter - Optional address of the account granting fee payment permissions
380
- * @param feeOptions - Options for fetching oracle fees
381
- * @param context - Optional SDK context for accessing clients
382
- * @returns Promise resolving to the fee configuration for DLR creation
383
- */
384
- async generateCreateResourceJsonFees(feePayer, granter, feeOptions, context) {
385
- if (!this.querier) {
386
- this.querier = context.sdk.querier;
387
- }
388
- if (!(await this.shouldUseOracleFees(context))) {
389
- return ResourceModule.generateCreateResourceJsonFees(feePayer, granter);
390
- }
391
- // fetch fee parameters from the Resource module
392
- const feeParams = await this.queryParams(context);
393
- // get the price range for the JSON resource creation
394
- const priceRange = await this.getPriceRangeFromParams(feeParams, 'json', feeOptions);
395
- // calculate the oracle fee amount based on the price range and options
396
- return {
397
- amount: [await this.calculateOracleFeeAmount(priceRange, feeOptions, context)],
398
- gas: ResourceModule.gasLimits.CreateLinkedResourceJsonGasLimit,
399
- payer: feePayer,
400
- granter,
401
- };
402
- }
403
- /**
404
- * Generates oracle-powered fees for creating default DID-Linked Resources.
405
- *
406
- * @param feePayer - Address of the account that will pay the transaction fees
407
- * @param granter - Optional address of the account granting fee payment permissions
408
- * @param feeOptions - Options for fetching oracle fees
409
- * @param context - Optional SDK context for accessing clients
410
- * @returns Promise resolving to the fee configuration for DLR creation
411
- */
412
- async generateCreateResourceDefaultFees(feePayer, granter, feeOptions, context) {
413
- if (!this.querier) {
414
- this.querier = context.sdk.querier;
415
- }
416
- if (!(await this.shouldUseOracleFees(context))) {
417
- return ResourceModule.generateCreateResourceDefaultFees(feePayer, granter);
418
- }
419
- // fetch fee parameters from the Resource module
420
- const feeParams = await this.queryParams(context);
421
- // get the price range for the default resource creation
422
- const priceRange = await this.getPriceRangeFromParams(feeParams, 'default', feeOptions);
423
- // calculate the oracle fee amount based on the price range and options
424
- return {
425
- amount: [await this.calculateOracleFeeAmount(priceRange, feeOptions, context)],
426
- gas: ResourceModule.gasLimits.CreateLinkedResourceDefaultGasLimit,
427
- payer: feePayer,
428
- granter,
429
- };
430
- }
431
- /**
432
- * Gets the fee range for a specific DID operation from the module parameters.
433
- * @param feeParams - DID module fee parameters
434
- * @param operation - DID operation type ('create', 'update', 'deactivate')
435
- * @param feeOptions - Options for fee retrieval
436
- * @returns Promise resolving to the fee range for the specified operation
437
- */
438
- async getPriceRangeFromParams(feeParams, operation, feeOptions) {
439
- const operationFees = (() => {
440
- switch (operation) {
441
- case 'image':
442
- return feeParams.params?.image.find((fee) => fee.denom === (feeOptions?.feeDenom ?? ResourceModule.baseUsdDenom));
443
- case 'json':
444
- return feeParams.params?.json.find((fee) => fee.denom === (feeOptions?.feeDenom ?? ResourceModule.baseUsdDenom));
445
- case 'default':
446
- return feeParams.params?.default.find((fee) => fee.denom === (feeOptions?.feeDenom ?? ResourceModule.baseUsdDenom));
447
- default:
448
- throw new Error('Unsupported operation for fee retrieval');
449
- }
450
- })();
451
- if (!operationFees) {
452
- throw new Error(`Fee parameters not found for operation: ${operation}`);
453
- }
454
- return operationFees;
455
- }
456
- /**
457
- * Calculates the oracle fee amount based on the provided fee range and options.
458
- * @param feeRange - Fee range for the DID operation
459
- * @param feeOptions - Options for fee calculation
460
- * @param context - Optional SDK context for accessing clients
461
- * @returns Promise resolving to the calculated fee amount as a Coin
462
- */
463
- async calculateOracleFeeAmount(feeRange, feeOptions, context) {
464
- if (!this.querier) {
465
- this.querier = context.sdk.querier;
466
- }
467
- if (feeRange.denom !== feeOptions?.feeDenom && feeOptions?.feeDenom !== undefined) {
468
- throw new Error(`Fee denomination mismatch: expected ${feeRange.denom}, got ${feeOptions.feeDenom}`);
469
- }
470
- const wantedFeeAmount = feeRange.denom === ResourceModule.baseUsdDenom
471
- ? (feeOptions?.wantedAmountUsd ?? ResourceModule.isFixedRange(feeRange))
472
- ? feeRange.minAmount
473
- : feeRange.minAmount
474
- : feeRange.minAmount;
475
- // override fee options, if unassigned - case: moving average type
476
- feeOptions = {
477
- ...feeOptions,
478
- movingAverageType: feeOptions?.movingAverageType || MovingAverages.WMA,
479
- };
480
- // override fee options, if unassigned - case: WMA strategy
481
- feeOptions = {
482
- ...feeOptions,
483
- wmaStrategy: feeOptions?.wmaStrategy || feeOptions?.movingAverageType === MovingAverages.WMA
484
- ? WMAStrategies.BALANCED
485
- : undefined,
486
- };
487
- const convertedFeeAmount = feeRange.denom === ResourceModule.baseUsdDenom
488
- ? parseCoins((await this.querier[defaultOracleExtensionKey].convertUSDtoCHEQ(wantedFeeAmount, feeOptions?.movingAverageType, feeOptions?.wmaStrategy, feeOptions?.wmaWeights?.map((w) => BigInt(w)))).amount)[0]
489
- : Coin.fromPartial({ amount: wantedFeeAmount, denom: feeRange.denom });
490
- return feeOptions?.slippageBps
491
- ? ResourceModule.applySlippageToCoin(convertedFeeAmount, feeOptions.slippageBps)
492
- : convertedFeeAmount;
493
- }
494
- /**
495
- * Applies slippage to a given coin amount based on the specified basis points.
496
- * @param coin - Coin amount to apply slippage to
497
- * @param slippageBps - Slippage in basis points (bps)
498
- * @returns Coin with adjusted amount after applying slippage
499
- */
500
- static applySlippageToCoin(coin, slippageBps) {
501
- const base = BigInt(coin.amount);
502
- const delta = (base * BigInt(slippageBps)) / BigInt(10_000);
503
- const adjustedAmount = base + delta;
504
- return Coin.fromPartial({ amount: adjustedAmount.toString(), denom: coin.denom });
505
- }
506
- /**
507
- * Checks if a fee range represents a fixed fee (minAmount equals maxAmount).
508
- * @param feeRange - Fee range to check
509
- * @returns True if the fee range is fixed, false otherwise
510
- */
511
- static isFixedRange(feeRange) {
512
- return feeRange.minAmount === feeRange.maxAmount;
513
- }
514
- /**
515
- * Reads and determines the MIME type of resource content.
516
- * Analyzes the content to identify the appropriate MIME type for fee calculation and validation.
517
- *
518
- * @param content - Resource content as byte array
519
- * @returns Promise resolving to the detected MIME type string
520
- */
521
- static async readMimeType(content) {
522
- if (isJSON(toString(content, 'utf-8')))
523
- return 'application/json';
524
- return (await fromBuffer(content))?.mime ?? 'application/octet-stream';
525
- }
526
- /**
527
- * Generates fee configuration for image resource creation transactions.
528
- * Uses higher gas limits appropriate for image processing and storage.
529
- *
530
- * @param feePayer - Address of the account that will pay the transaction fees
531
- * @param granter - Optional address of the account granting fee payment permissions
532
- * @returns Promise resolving to the fee configuration for image resources
533
- */
534
- static async generateCreateResourceImageFees(feePayer, granter) {
535
- return {
536
- amount: [ResourceModule.fees.DefaultCreateResourceImageFee],
537
- gas: ResourceModule.gasLimits.CreateLinkedResourceImageGasLimit,
538
- payer: feePayer,
539
- granter: granter,
540
- };
541
- }
542
- /**
543
- * Generates fee configuration for JSON resource creation transactions.
544
- * Uses gas limits optimized for JSON data processing and validation.
545
- *
546
- * @param feePayer - Address of the account that will pay the transaction fees
547
- * @param granter - Optional address of the account granting fee payment permissions
548
- * @returns Promise resolving to the fee configuration for JSON resources
549
- */
550
- static async generateCreateResourceJsonFees(feePayer, granter) {
551
- return {
552
- amount: [ResourceModule.fees.DefaultCreateResourceJsonFee],
553
- gas: ResourceModule.gasLimits.CreateLinkedResourceJsonGasLimit,
554
- payer: feePayer,
555
- granter: granter,
556
- };
557
- }
558
- /**
559
- * Generates fee configuration for default resource creation transactions.
560
- * Uses standard gas limits for generic resource types and binary data.
561
- *
562
- * @param feePayer - Address of the account that will pay the transaction fees
563
- * @param granter - Optional address of the account granting fee payment permissions
564
- * @returns Promise resolving to the fee configuration for default resources
565
- */
566
- static async generateCreateResourceDefaultFees(feePayer, granter) {
567
- return {
568
- amount: [ResourceModule.fees.DefaultCreateResourceDefaultFee],
569
- gas: ResourceModule.gasLimits.CreateLinkedResourceDefaultGasLimit,
570
- payer: feePayer,
571
- granter: granter,
572
- };
573
- }
574
- }
575
- //# sourceMappingURL=resource.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../../../../cjs/src/modules/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAmC,MAAM,KAAK,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAA+B,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,YAAY,EAAsC,WAAW,EAAuB,MAAM,UAAU,CAAC;AAC9G,OAAO,EAEN,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,EACzB,eAAe,EAIf,eAAe,GACf,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAkC,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEjH,OAAO,EAAE,UAAU,EAAE,MAA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