coreum-js 2.17.5 → 2.18.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.
@@ -404,11 +404,20 @@ class Client {
404
404
  const [{ address }] = await offlineSigner.getAccounts();
405
405
  this._address = address;
406
406
  const registry = Client.getRegistry();
407
+ const aminoTypes = new stargate_1.AminoTypes({
408
+ ...(0, stargate_1.createDefaultAminoConverters)(),
409
+ ...(0, cosmwasm_stargate_1.createWasmAminoConverters)(),
410
+ ...(0, coreum_1.createCoreumAminoTypes)(),
411
+ });
407
412
  // signing client
408
413
  this._client = await cosmwasm_stargate_1.SigningCosmWasmClient.connectWithSigner(this.config.chain_rpc_endpoint, offlineSigner, {
409
414
  registry: registry,
410
415
  gasPrice: stargate_1.GasPrice.fromString(this.config.gas_price),
416
+ aminoTypes: aminoTypes,
411
417
  });
418
+ this._client.aminoTypes.register = {
419
+ ...(0, coreum_1.createCoreumAminoTypes)(),
420
+ };
412
421
  }
413
422
  catch (e) {
414
423
  throw {
@@ -0,0 +1 @@
1
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types";
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = exports.coreumAminoConverters = exports.createCoreumAminoTypes = void 0;
4
+ var types_1 = require("./types");
5
+ Object.defineProperty(exports, "createCoreumAminoTypes", { enumerable: true, get: function () { return types_1.createCoreumAminoTypes; } });
6
+ Object.defineProperty(exports, "coreumAminoConverters", { enumerable: true, get: function () { return types_1.coreumAminoConverters; } });
7
+ Object.defineProperty(exports, "ftAminoConverters", { enumerable: true, get: function () { return types_1.ftAminoConverters; } });
8
+ Object.defineProperty(exports, "dexAminoConverters", { enumerable: true, get: function () { return types_1.dexAminoConverters; } });
9
+ Object.defineProperty(exports, "nftAminoConverters", { enumerable: true, get: function () { return types_1.nftAminoConverters; } });
10
+ Object.defineProperty(exports, "nftBetaAminoConverters", { enumerable: true, get: function () { return types_1.nftBetaAminoConverters; } });
@@ -0,0 +1,7 @@
1
+ import { AminoConverters, AminoTypes } from "@cosmjs/stargate";
2
+ export declare const ftAminoConverters: AminoConverters;
3
+ export declare const dexAminoConverters: AminoConverters;
4
+ export declare const nftAminoConverters: AminoConverters;
5
+ export declare const nftBetaAminoConverters: AminoConverters;
6
+ export declare const coreumAminoConverters: AminoConverters;
7
+ export declare function createCoreumAminoTypes(): AminoTypes;
@@ -0,0 +1,550 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createCoreumAminoTypes = exports.coreumAminoConverters = exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = void 0;
4
+ const stargate_1 = require("@cosmjs/stargate");
5
+ // FT (Fungible Token) Amino Types
6
+ exports.ftAminoConverters = {
7
+ // MsgIssue - Issue new fungible token
8
+ "/coreum.asset.ft.v1.MsgIssue": {
9
+ aminoType: "cosmos-sdk/MsgIssue",
10
+ toAmino: ({ issuer, symbol, subunit, precision, initialAmount, description, features, burnRate, sendCommissionRate, uri, uriHash, extensionSettings, dexSettings, }) => ({
11
+ issuer,
12
+ symbol,
13
+ subunit,
14
+ precision,
15
+ initial_amount: initialAmount,
16
+ description,
17
+ features,
18
+ burn_rate: burnRate,
19
+ send_commission_rate: sendCommissionRate,
20
+ uri,
21
+ uri_hash: uriHash,
22
+ extension_settings: extensionSettings,
23
+ dex_settings: dexSettings,
24
+ }),
25
+ fromAmino: ({ issuer, symbol, subunit, precision, initial_amount, description, features, burn_rate, send_commission_rate, uri, uri_hash, extension_settings, dex_settings, }) => ({
26
+ issuer,
27
+ symbol,
28
+ subunit,
29
+ precision,
30
+ initialAmount: initial_amount,
31
+ description,
32
+ features,
33
+ burnRate: burn_rate,
34
+ sendCommissionRate: send_commission_rate,
35
+ uri,
36
+ uriHash: uri_hash,
37
+ extensionSettings: extension_settings,
38
+ dexSettings: dex_settings,
39
+ }),
40
+ },
41
+ // MsgMint - Mint new fungible tokens
42
+ "/coreum.asset.ft.v1.MsgMint": {
43
+ aminoType: "cosmos-sdk/MsgMint",
44
+ toAmino: ({ sender, coin, recipient }) => ({
45
+ sender,
46
+ coin,
47
+ recipient,
48
+ }),
49
+ fromAmino: ({ sender, coin, recipient }) => ({
50
+ sender,
51
+ coin,
52
+ recipient,
53
+ }),
54
+ },
55
+ // MsgBurn - Burn fungible tokens
56
+ "/coreum.asset.ft.v1.MsgBurn": {
57
+ aminoType: "cosmos-sdk/MsgBurn",
58
+ toAmino: ({ sender, coin }) => ({
59
+ sender,
60
+ coin,
61
+ }),
62
+ fromAmino: ({ sender, coin }) => ({
63
+ sender,
64
+ coin,
65
+ }),
66
+ },
67
+ // MsgFreeze - Freeze fungible tokens
68
+ "/coreum.asset.ft.v1.MsgFreeze": {
69
+ aminoType: "cosmos-sdk/MsgFreeze",
70
+ toAmino: ({ sender, account, coin }) => ({
71
+ sender,
72
+ account,
73
+ coin,
74
+ }),
75
+ fromAmino: ({ sender, account, coin }) => ({
76
+ sender,
77
+ account,
78
+ coin,
79
+ }),
80
+ },
81
+ // MsgUnfreeze - Unfreeze fungible tokens
82
+ "/coreum.asset.ft.v1.MsgUnfreeze": {
83
+ aminoType: "cosmos-sdk/MsgUnfreeze",
84
+ toAmino: ({ sender, account, coin }) => ({
85
+ sender,
86
+ account,
87
+ coin,
88
+ }),
89
+ fromAmino: ({ sender, account, coin }) => ({
90
+ sender,
91
+ account,
92
+ coin,
93
+ }),
94
+ },
95
+ // MsgSetFrozen - Set frozen amount
96
+ "/coreum.asset.ft.v1.MsgSetFrozen": {
97
+ aminoType: "cosmos-sdk/MsgSetFrozen",
98
+ toAmino: ({ sender, account, coin }) => ({
99
+ sender,
100
+ account,
101
+ coin,
102
+ }),
103
+ fromAmino: ({ sender, account, coin }) => ({
104
+ sender,
105
+ account,
106
+ coin,
107
+ }),
108
+ },
109
+ // MsgGloballyFreeze - Globally freeze token
110
+ "/coreum.asset.ft.v1.MsgGloballyFreeze": {
111
+ aminoType: "cosmos-sdk/MsgGloballyFreeze",
112
+ toAmino: ({ sender, denom }) => ({
113
+ sender,
114
+ denom,
115
+ }),
116
+ fromAmino: ({ sender, denom }) => ({
117
+ sender,
118
+ denom,
119
+ }),
120
+ },
121
+ // MsgGloballyUnfreeze - Globally unfreeze token
122
+ "/coreum.asset.ft.v1.MsgGloballyUnfreeze": {
123
+ aminoType: "cosmos-sdk/MsgGloballyUnfreeze",
124
+ toAmino: ({ sender, denom }) => ({
125
+ sender,
126
+ denom,
127
+ }),
128
+ fromAmino: ({ sender, denom }) => ({
129
+ sender,
130
+ denom,
131
+ }),
132
+ },
133
+ // MsgClawback - Clawback tokens
134
+ "/coreum.asset.ft.v1.MsgClawback": {
135
+ aminoType: "cosmos-sdk/MsgClawback",
136
+ toAmino: ({ sender, account, coin }) => ({
137
+ sender,
138
+ account,
139
+ coin,
140
+ }),
141
+ fromAmino: ({ sender, account, coin }) => ({
142
+ sender,
143
+ account,
144
+ coin,
145
+ }),
146
+ },
147
+ // MsgSetWhitelistedLimit - Set whitelisted limit
148
+ "/coreum.asset.ft.v1.MsgSetWhitelistedLimit": {
149
+ aminoType: "cosmos-sdk/MsgSetWhitelistedLimit",
150
+ toAmino: ({ sender, account, coin }) => ({
151
+ sender,
152
+ account,
153
+ coin,
154
+ }),
155
+ fromAmino: ({ sender, account, coin }) => ({
156
+ sender,
157
+ account,
158
+ coin,
159
+ }),
160
+ },
161
+ // MsgTransferAdmin - Transfer admin
162
+ "/coreum.asset.ft.v1.MsgTransferAdmin": {
163
+ aminoType: "cosmos-sdk/MsgTransferAdmin",
164
+ toAmino: ({ sender, account, denom }) => ({
165
+ sender,
166
+ account,
167
+ denom,
168
+ }),
169
+ fromAmino: ({ sender, account, denom }) => ({
170
+ sender,
171
+ account,
172
+ denom,
173
+ }),
174
+ },
175
+ // MsgClearAdmin - Clear admin
176
+ "/coreum.asset.ft.v1.MsgClearAdmin": {
177
+ aminoType: "cosmos-sdk/MsgClearAdmin",
178
+ toAmino: ({ sender, denom }) => ({
179
+ sender,
180
+ denom,
181
+ }),
182
+ fromAmino: ({ sender, denom }) => ({
183
+ sender,
184
+ denom,
185
+ }),
186
+ },
187
+ // MsgUpgradeTokenV1 - Upgrade token to V1
188
+ "/coreum.asset.ft.v1.MsgUpgradeTokenV1": {
189
+ aminoType: "cosmos-sdk/MsgUpgradeTokenV1",
190
+ toAmino: ({ sender, denom, ibcEnabled }) => ({
191
+ sender,
192
+ denom,
193
+ ibc_enabled: ibcEnabled,
194
+ }),
195
+ fromAmino: ({ sender, denom, ibc_enabled }) => ({
196
+ sender,
197
+ denom,
198
+ ibcEnabled: ibc_enabled,
199
+ }),
200
+ },
201
+ // MsgUpdateParams - Update parameters
202
+ "/coreum.asset.ft.v1.MsgUpdateParams": {
203
+ aminoType: "cosmos-sdk/MsgUpdateParams",
204
+ toAmino: ({ authority, params }) => ({
205
+ authority,
206
+ params,
207
+ }),
208
+ fromAmino: ({ authority, params }) => ({
209
+ authority,
210
+ params,
211
+ }),
212
+ },
213
+ // MsgUpdateDEXUnifiedRefAmount - Update DEX unified ref amount
214
+ "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount": {
215
+ aminoType: "cosmos-sdk/MsgUpdateDEXUnifiedRefAmount",
216
+ toAmino: ({ sender, denom, unifiedRefAmount, }) => ({
217
+ sender,
218
+ denom,
219
+ unified_ref_amount: unifiedRefAmount,
220
+ }),
221
+ fromAmino: ({ sender, denom, unified_ref_amount, }) => ({
222
+ sender,
223
+ denom,
224
+ unifiedRefAmount: unified_ref_amount,
225
+ }),
226
+ },
227
+ // MsgUpdateDEXWhitelistedDenoms - Update DEX whitelisted denoms
228
+ "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms": {
229
+ aminoType: "cosmos-sdk/MsgUpdateDEXWhitelistedDenoms",
230
+ toAmino: ({ sender, denom, whitelistedDenoms, }) => ({
231
+ sender,
232
+ denom,
233
+ whitelisted_denoms: whitelistedDenoms,
234
+ }),
235
+ fromAmino: ({ sender, denom, whitelisted_denoms, }) => ({
236
+ sender,
237
+ denom,
238
+ whitelistedDenoms: whitelisted_denoms,
239
+ }),
240
+ },
241
+ };
242
+ // DEX Amino Types
243
+ exports.dexAminoConverters = {
244
+ // MsgUpdateParams - Update DEX parameters
245
+ "/coreum.dex.v1.MsgUpdateParams": {
246
+ aminoType: "cosmos-sdk/MsgUpdateParams",
247
+ toAmino: ({ authority, params }) => ({
248
+ authority,
249
+ params,
250
+ }),
251
+ fromAmino: ({ authority, params }) => ({
252
+ authority,
253
+ params,
254
+ }),
255
+ },
256
+ // MsgPlaceOrder - Place order on DEX
257
+ "/coreum.dex.v1.MsgPlaceOrder": {
258
+ aminoType: "cosmos-sdk/MsgPlaceOrder",
259
+ toAmino: ({ sender, type, id, baseDenom, quoteDenom, price, quantity, side, goodTil, timeInForce, }) => ({
260
+ sender,
261
+ type,
262
+ id,
263
+ base_denom: baseDenom,
264
+ quote_denom: quoteDenom,
265
+ price,
266
+ quantity,
267
+ side,
268
+ good_til: goodTil,
269
+ time_in_force: timeInForce,
270
+ }),
271
+ fromAmino: ({ sender, type, id, base_denom, quote_denom, price, quantity, side, good_til, time_in_force, }) => ({
272
+ sender,
273
+ type,
274
+ id,
275
+ baseDenom: base_denom,
276
+ quoteDenom: quote_denom,
277
+ price,
278
+ quantity,
279
+ side,
280
+ goodTil: good_til,
281
+ timeInForce: time_in_force,
282
+ }),
283
+ },
284
+ // MsgCancelOrder - Cancel order
285
+ "/coreum.dex.v1.MsgCancelOrder": {
286
+ aminoType: "cosmos-sdk/MsgCancelOrder",
287
+ toAmino: ({ sender, id }) => ({
288
+ sender,
289
+ id,
290
+ }),
291
+ fromAmino: ({ sender, id }) => ({
292
+ sender,
293
+ id,
294
+ }),
295
+ },
296
+ // MsgCancelOrdersByDenom - Cancel orders by denom
297
+ "/coreum.dex.v1.MsgCancelOrdersByDenom": {
298
+ aminoType: "cosmos-sdk/MsgCancelOrdersByDenom",
299
+ toAmino: ({ sender, account, denom }) => ({
300
+ sender,
301
+ account,
302
+ denom,
303
+ }),
304
+ fromAmino: ({ sender, account, denom }) => ({
305
+ sender,
306
+ account,
307
+ denom,
308
+ }),
309
+ },
310
+ };
311
+ // NFT (Non-Fungible Token) Amino Types
312
+ exports.nftAminoConverters = {
313
+ // MsgIssueClass - Issue new NFT class
314
+ "/coreum.asset.nft.v1.MsgIssueClass": {
315
+ aminoType: "cosmos-sdk/MsgIssueClass",
316
+ toAmino: ({ issuer, symbol, name, description, uri, uriHash, data, features, royaltyRate, }) => ({
317
+ issuer,
318
+ symbol,
319
+ name,
320
+ description,
321
+ uri,
322
+ uri_hash: uriHash,
323
+ data,
324
+ features,
325
+ royalty_rate: royaltyRate,
326
+ }),
327
+ fromAmino: ({ issuer, symbol, name, description, uri, uri_hash, data, features, royalty_rate, }) => ({
328
+ issuer,
329
+ symbol,
330
+ name,
331
+ description,
332
+ uri,
333
+ uriHash: uri_hash,
334
+ data,
335
+ features,
336
+ royaltyRate: royalty_rate,
337
+ }),
338
+ },
339
+ // MsgMint - Mint NFT
340
+ "/coreum.asset.nft.v1.MsgMint": {
341
+ aminoType: "cosmos-sdk/MsgMint",
342
+ toAmino: ({ sender, classId, id, uri, uriHash, data, recipient, }) => ({
343
+ sender,
344
+ class_id: classId,
345
+ id,
346
+ uri,
347
+ uri_hash: uriHash,
348
+ data,
349
+ recipient,
350
+ }),
351
+ fromAmino: ({ sender, class_id, id, uri, uri_hash, data, recipient, }) => ({
352
+ sender,
353
+ classId: class_id,
354
+ id,
355
+ uri,
356
+ uriHash: uri_hash,
357
+ data,
358
+ recipient,
359
+ }),
360
+ },
361
+ // MsgUpdateData - Update NFT data
362
+ "/coreum.asset.nft.v1.MsgUpdateData": {
363
+ aminoType: "cosmos-sdk/MsgUpdateData",
364
+ toAmino: ({ sender, classId, id, items }) => ({
365
+ sender,
366
+ class_id: classId,
367
+ id,
368
+ items,
369
+ }),
370
+ fromAmino: ({ sender, class_id, id, items }) => ({
371
+ sender,
372
+ classId: class_id,
373
+ id,
374
+ items,
375
+ }),
376
+ },
377
+ // MsgBurn - Burn NFT
378
+ "/coreum.asset.nft.v1.MsgBurn": {
379
+ aminoType: "cosmos-sdk/MsgBurn",
380
+ toAmino: ({ sender, classId, id }) => ({
381
+ sender,
382
+ class_id: classId,
383
+ id,
384
+ }),
385
+ fromAmino: ({ sender, class_id, id }) => ({
386
+ sender,
387
+ classId: class_id,
388
+ id,
389
+ }),
390
+ },
391
+ // MsgFreeze - Freeze NFT
392
+ "/coreum.asset.nft.v1.MsgFreeze": {
393
+ aminoType: "cosmos-sdk/MsgFreeze",
394
+ toAmino: ({ sender, classId, id }) => ({
395
+ sender,
396
+ class_id: classId,
397
+ id,
398
+ }),
399
+ fromAmino: ({ sender, class_id, id }) => ({
400
+ sender,
401
+ classId: class_id,
402
+ id,
403
+ }),
404
+ },
405
+ // MsgUnfreeze - Unfreeze NFT
406
+ "/coreum.asset.nft.v1.MsgUnfreeze": {
407
+ aminoType: "cosmos-sdk/MsgUnfreeze",
408
+ toAmino: ({ sender, classId, id }) => ({
409
+ sender,
410
+ class_id: classId,
411
+ id,
412
+ }),
413
+ fromAmino: ({ sender, class_id, id }) => ({
414
+ sender,
415
+ classId: class_id,
416
+ id,
417
+ }),
418
+ },
419
+ // MsgClassFreeze - Freeze NFT class for account
420
+ "/coreum.asset.nft.v1.MsgClassFreeze": {
421
+ aminoType: "cosmos-sdk/MsgClassFreeze",
422
+ toAmino: ({ sender, classId, account }) => ({
423
+ sender,
424
+ class_id: classId,
425
+ account,
426
+ }),
427
+ fromAmino: ({ sender, class_id, account }) => ({
428
+ sender,
429
+ classId: class_id,
430
+ account,
431
+ }),
432
+ },
433
+ // MsgClassUnfreeze - Unfreeze NFT class for account
434
+ "/coreum.asset.nft.v1.MsgClassUnfreeze": {
435
+ aminoType: "cosmos-sdk/MsgClassUnfreeze",
436
+ toAmino: ({ sender, classId, account }) => ({
437
+ sender,
438
+ class_id: classId,
439
+ account,
440
+ }),
441
+ fromAmino: ({ sender, class_id, account }) => ({
442
+ sender,
443
+ classId: class_id,
444
+ account,
445
+ }),
446
+ },
447
+ // MsgAddToWhitelist - Add account to NFT whitelist
448
+ "/coreum.asset.nft.v1.MsgAddToWhitelist": {
449
+ aminoType: "cosmos-sdk/MsgAddToWhitelist",
450
+ toAmino: ({ sender, classId, id, account }) => ({
451
+ sender,
452
+ class_id: classId,
453
+ id,
454
+ account,
455
+ }),
456
+ fromAmino: ({ sender, class_id, id, account }) => ({
457
+ sender,
458
+ classId: class_id,
459
+ id,
460
+ account,
461
+ }),
462
+ },
463
+ // MsgRemoveFromWhitelist - Remove account from NFT whitelist
464
+ "/coreum.asset.nft.v1.MsgRemoveFromWhitelist": {
465
+ aminoType: "cosmos-sdk/MsgRemoveFromWhitelist",
466
+ toAmino: ({ sender, classId, id, account }) => ({
467
+ sender,
468
+ class_id: classId,
469
+ id,
470
+ account,
471
+ }),
472
+ fromAmino: ({ sender, class_id, id, account, }) => ({
473
+ sender,
474
+ classId: class_id,
475
+ id,
476
+ account,
477
+ }),
478
+ },
479
+ // MsgAddToClassWhitelist - Add account to NFT class whitelist
480
+ "/coreum.asset.nft.v1.MsgAddToClassWhitelist": {
481
+ aminoType: "cosmos-sdk/MsgAddToClassWhitelist",
482
+ toAmino: ({ sender, classId, account }) => ({
483
+ sender,
484
+ class_id: classId,
485
+ account,
486
+ }),
487
+ fromAmino: ({ sender, class_id, account, }) => ({
488
+ sender,
489
+ classId: class_id,
490
+ account,
491
+ }),
492
+ },
493
+ // MsgRemoveFromClassWhitelist - Remove account from NFT class whitelist
494
+ "/coreum.asset.nft.v1.MsgRemoveFromClassWhitelist": {
495
+ aminoType: "cosmos-sdk/MsgRemoveFromClassWhitelist",
496
+ toAmino: ({ sender, classId, account }) => ({
497
+ sender,
498
+ class_id: classId,
499
+ account,
500
+ }),
501
+ fromAmino: ({ sender, class_id, account, }) => ({
502
+ sender,
503
+ classId: class_id,
504
+ account,
505
+ }),
506
+ },
507
+ // MsgUpdateParams - Update NFT module parameters
508
+ "/coreum.asset.nft.v1.MsgUpdateParams": {
509
+ aminoType: "cosmos-sdk/MsgUpdateParams",
510
+ toAmino: ({ authority, params }) => ({
511
+ authority,
512
+ params,
513
+ }),
514
+ fromAmino: ({ authority, params }) => ({
515
+ authority,
516
+ params,
517
+ }),
518
+ },
519
+ };
520
+ // NFT Beta Amino Types
521
+ exports.nftBetaAminoConverters = {
522
+ // MsgSend - Send NFT
523
+ "/cosmos.nft.v1beta1.MsgSend": {
524
+ aminoType: "cosmos-sdk/MsgSend",
525
+ toAmino: ({ classId, id, sender, receiver }) => ({
526
+ class_id: classId,
527
+ id,
528
+ sender,
529
+ receiver,
530
+ }),
531
+ fromAmino: ({ class_id, id, sender, receiver }) => ({
532
+ classId: class_id,
533
+ id,
534
+ sender,
535
+ receiver,
536
+ }),
537
+ },
538
+ };
539
+ // Combined Amino Converters
540
+ exports.coreumAminoConverters = {
541
+ ...exports.ftAminoConverters,
542
+ ...exports.dexAminoConverters,
543
+ ...exports.nftAminoConverters,
544
+ ...exports.nftBetaAminoConverters,
545
+ };
546
+ // Create AminoTypes instance
547
+ function createCoreumAminoTypes() {
548
+ return new stargate_1.AminoTypes(exports.coreumAminoConverters);
549
+ }
550
+ exports.createCoreumAminoTypes = createCoreumAminoTypes;
@@ -4,6 +4,7 @@ import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhite
4
4
  import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms } from "./asset/ft/v1/tx";
5
5
  import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom } from "./dex/v1/tx";
6
6
  import { FTMsgs, NFTMsgs } from "../types/msgs";
7
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino";
7
8
  export { Feature } from "./asset/ft/v1/token";
8
9
  export { ClassFeature } from "./asset/nft/v1/nft";
9
10
  /** @internal */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEX = exports.NFT = exports.FT = exports.coreumRegistry = exports.ClassFeature = exports.Feature = void 0;
3
+ exports.DEX = exports.NFT = exports.FT = exports.coreumRegistry = exports.ClassFeature = exports.Feature = exports.nftBetaAminoConverters = exports.nftAminoConverters = exports.dexAminoConverters = exports.ftAminoConverters = exports.coreumAminoConverters = exports.createCoreumAminoTypes = void 0;
4
4
  const asset_1 = require("./asset");
5
5
  const nft_1 = require("./nft");
6
6
  const dex_1 = require("./dex");
@@ -8,6 +8,14 @@ const tx_1 = require("./nft/v1beta1/tx");
8
8
  const tx_2 = require("./asset/nft/v1/tx");
9
9
  const tx_3 = require("./asset/ft/v1/tx");
10
10
  const tx_4 = require("./dex/v1/tx");
11
+ // Export AminoTypes
12
+ var amino_1 = require("./amino");
13
+ Object.defineProperty(exports, "createCoreumAminoTypes", { enumerable: true, get: function () { return amino_1.createCoreumAminoTypes; } });
14
+ Object.defineProperty(exports, "coreumAminoConverters", { enumerable: true, get: function () { return amino_1.coreumAminoConverters; } });
15
+ Object.defineProperty(exports, "ftAminoConverters", { enumerable: true, get: function () { return amino_1.ftAminoConverters; } });
16
+ Object.defineProperty(exports, "dexAminoConverters", { enumerable: true, get: function () { return amino_1.dexAminoConverters; } });
17
+ Object.defineProperty(exports, "nftAminoConverters", { enumerable: true, get: function () { return amino_1.nftAminoConverters; } });
18
+ Object.defineProperty(exports, "nftBetaAminoConverters", { enumerable: true, get: function () { return amino_1.nftBetaAminoConverters; } });
11
19
  var token_1 = require("./asset/ft/v1/token");
12
20
  Object.defineProperty(exports, "Feature", { enumerable: true, get: function () { return token_1.Feature; } });
13
21
  var nft_2 = require("./asset/nft/v1/nft");
@@ -1,4 +1,4 @@
1
- import { coreumRegistry } from "../coreum";
1
+ import { coreumRegistry, createCoreumAminoTypes } from "../coreum";
2
2
  import { cosmwasmRegistry } from "../wasm/v1";
3
3
  import { setupFTExtension } from "../coreum/extensions/ft";
4
4
  import { setupNFTExtension } from "../coreum/extensions/nft";
@@ -11,12 +11,12 @@ import { Registry, } from "@cosmjs/proto-signing";
11
11
  import { Tendermint37Client, WebsocketClient } from "@cosmjs/tendermint-rpc";
12
12
  import { ExtensionWallets } from "../types";
13
13
  import { generateWalletFromMnemonic, generateMultisigFromPubkeys, } from "../utils";
14
- import { GasPrice, QueryClient, StargateClient, calculateFee, createProtobufRpcClient, decodeCosmosSdkDecFromProto, defaultRegistryTypes, setupAuthExtension, setupFeegrantExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, } from "@cosmjs/stargate";
14
+ import { GasPrice, QueryClient, StargateClient, calculateFee, AminoTypes, createDefaultAminoConverters, createProtobufRpcClient, decodeCosmosSdkDecFromProto, defaultRegistryTypes, setupAuthExtension, setupFeegrantExtension, setupIbcExtension, setupMintExtension, setupStakingExtension, setupTxExtension, } from "@cosmjs/stargate";
15
15
  import { setupBankExtension, setupGovExtension, setupDistributionExtension, } from "../cosmos/extensions";
16
16
  import EventEmitter from "eventemitter3";
17
17
  import { parseSubscriptionEvents } from "../utils/event";
18
18
  import { cosmos } from "@cosmostation/extension-client";
19
- import { SigningCosmWasmClient, setupWasmExtension, } from "@cosmjs/cosmwasm-stargate";
19
+ import { SigningCosmWasmClient, createWasmAminoConverters, setupWasmExtension, } from "@cosmjs/cosmwasm-stargate";
20
20
  import BigNumber from "bignumber.js";
21
21
  function isSigningClient(object) {
22
22
  return "signAndBroadcast" in object;
@@ -408,11 +408,20 @@ export class Client {
408
408
  const [{ address }] = await offlineSigner.getAccounts();
409
409
  this._address = address;
410
410
  const registry = Client.getRegistry();
411
+ const aminoTypes = new AminoTypes({
412
+ ...createDefaultAminoConverters(),
413
+ ...createWasmAminoConverters(),
414
+ ...createCoreumAminoTypes(),
415
+ });
411
416
  // signing client
412
417
  this._client = await SigningCosmWasmClient.connectWithSigner(this.config.chain_rpc_endpoint, offlineSigner, {
413
418
  registry: registry,
414
419
  gasPrice: GasPrice.fromString(this.config.gas_price),
420
+ aminoTypes: aminoTypes,
415
421
  });
422
+ this._client.aminoTypes.register = {
423
+ ...createCoreumAminoTypes(),
424
+ };
416
425
  }
417
426
  catch (e) {
418
427
  throw {
@@ -0,0 +1 @@
1
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types";
@@ -0,0 +1 @@
1
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./types";
@@ -0,0 +1,7 @@
1
+ import { AminoConverters, AminoTypes } from "@cosmjs/stargate";
2
+ export declare const ftAminoConverters: AminoConverters;
3
+ export declare const dexAminoConverters: AminoConverters;
4
+ export declare const nftAminoConverters: AminoConverters;
5
+ export declare const nftBetaAminoConverters: AminoConverters;
6
+ export declare const coreumAminoConverters: AminoConverters;
7
+ export declare function createCoreumAminoTypes(): AminoTypes;
@@ -0,0 +1,546 @@
1
+ import { AminoTypes } from "@cosmjs/stargate";
2
+ // FT (Fungible Token) Amino Types
3
+ export const ftAminoConverters = {
4
+ // MsgIssue - Issue new fungible token
5
+ "/coreum.asset.ft.v1.MsgIssue": {
6
+ aminoType: "cosmos-sdk/MsgIssue",
7
+ toAmino: ({ issuer, symbol, subunit, precision, initialAmount, description, features, burnRate, sendCommissionRate, uri, uriHash, extensionSettings, dexSettings, }) => ({
8
+ issuer,
9
+ symbol,
10
+ subunit,
11
+ precision,
12
+ initial_amount: initialAmount,
13
+ description,
14
+ features,
15
+ burn_rate: burnRate,
16
+ send_commission_rate: sendCommissionRate,
17
+ uri,
18
+ uri_hash: uriHash,
19
+ extension_settings: extensionSettings,
20
+ dex_settings: dexSettings,
21
+ }),
22
+ fromAmino: ({ issuer, symbol, subunit, precision, initial_amount, description, features, burn_rate, send_commission_rate, uri, uri_hash, extension_settings, dex_settings, }) => ({
23
+ issuer,
24
+ symbol,
25
+ subunit,
26
+ precision,
27
+ initialAmount: initial_amount,
28
+ description,
29
+ features,
30
+ burnRate: burn_rate,
31
+ sendCommissionRate: send_commission_rate,
32
+ uri,
33
+ uriHash: uri_hash,
34
+ extensionSettings: extension_settings,
35
+ dexSettings: dex_settings,
36
+ }),
37
+ },
38
+ // MsgMint - Mint new fungible tokens
39
+ "/coreum.asset.ft.v1.MsgMint": {
40
+ aminoType: "cosmos-sdk/MsgMint",
41
+ toAmino: ({ sender, coin, recipient }) => ({
42
+ sender,
43
+ coin,
44
+ recipient,
45
+ }),
46
+ fromAmino: ({ sender, coin, recipient }) => ({
47
+ sender,
48
+ coin,
49
+ recipient,
50
+ }),
51
+ },
52
+ // MsgBurn - Burn fungible tokens
53
+ "/coreum.asset.ft.v1.MsgBurn": {
54
+ aminoType: "cosmos-sdk/MsgBurn",
55
+ toAmino: ({ sender, coin }) => ({
56
+ sender,
57
+ coin,
58
+ }),
59
+ fromAmino: ({ sender, coin }) => ({
60
+ sender,
61
+ coin,
62
+ }),
63
+ },
64
+ // MsgFreeze - Freeze fungible tokens
65
+ "/coreum.asset.ft.v1.MsgFreeze": {
66
+ aminoType: "cosmos-sdk/MsgFreeze",
67
+ toAmino: ({ sender, account, coin }) => ({
68
+ sender,
69
+ account,
70
+ coin,
71
+ }),
72
+ fromAmino: ({ sender, account, coin }) => ({
73
+ sender,
74
+ account,
75
+ coin,
76
+ }),
77
+ },
78
+ // MsgUnfreeze - Unfreeze fungible tokens
79
+ "/coreum.asset.ft.v1.MsgUnfreeze": {
80
+ aminoType: "cosmos-sdk/MsgUnfreeze",
81
+ toAmino: ({ sender, account, coin }) => ({
82
+ sender,
83
+ account,
84
+ coin,
85
+ }),
86
+ fromAmino: ({ sender, account, coin }) => ({
87
+ sender,
88
+ account,
89
+ coin,
90
+ }),
91
+ },
92
+ // MsgSetFrozen - Set frozen amount
93
+ "/coreum.asset.ft.v1.MsgSetFrozen": {
94
+ aminoType: "cosmos-sdk/MsgSetFrozen",
95
+ toAmino: ({ sender, account, coin }) => ({
96
+ sender,
97
+ account,
98
+ coin,
99
+ }),
100
+ fromAmino: ({ sender, account, coin }) => ({
101
+ sender,
102
+ account,
103
+ coin,
104
+ }),
105
+ },
106
+ // MsgGloballyFreeze - Globally freeze token
107
+ "/coreum.asset.ft.v1.MsgGloballyFreeze": {
108
+ aminoType: "cosmos-sdk/MsgGloballyFreeze",
109
+ toAmino: ({ sender, denom }) => ({
110
+ sender,
111
+ denom,
112
+ }),
113
+ fromAmino: ({ sender, denom }) => ({
114
+ sender,
115
+ denom,
116
+ }),
117
+ },
118
+ // MsgGloballyUnfreeze - Globally unfreeze token
119
+ "/coreum.asset.ft.v1.MsgGloballyUnfreeze": {
120
+ aminoType: "cosmos-sdk/MsgGloballyUnfreeze",
121
+ toAmino: ({ sender, denom }) => ({
122
+ sender,
123
+ denom,
124
+ }),
125
+ fromAmino: ({ sender, denom }) => ({
126
+ sender,
127
+ denom,
128
+ }),
129
+ },
130
+ // MsgClawback - Clawback tokens
131
+ "/coreum.asset.ft.v1.MsgClawback": {
132
+ aminoType: "cosmos-sdk/MsgClawback",
133
+ toAmino: ({ sender, account, coin }) => ({
134
+ sender,
135
+ account,
136
+ coin,
137
+ }),
138
+ fromAmino: ({ sender, account, coin }) => ({
139
+ sender,
140
+ account,
141
+ coin,
142
+ }),
143
+ },
144
+ // MsgSetWhitelistedLimit - Set whitelisted limit
145
+ "/coreum.asset.ft.v1.MsgSetWhitelistedLimit": {
146
+ aminoType: "cosmos-sdk/MsgSetWhitelistedLimit",
147
+ toAmino: ({ sender, account, coin }) => ({
148
+ sender,
149
+ account,
150
+ coin,
151
+ }),
152
+ fromAmino: ({ sender, account, coin }) => ({
153
+ sender,
154
+ account,
155
+ coin,
156
+ }),
157
+ },
158
+ // MsgTransferAdmin - Transfer admin
159
+ "/coreum.asset.ft.v1.MsgTransferAdmin": {
160
+ aminoType: "cosmos-sdk/MsgTransferAdmin",
161
+ toAmino: ({ sender, account, denom }) => ({
162
+ sender,
163
+ account,
164
+ denom,
165
+ }),
166
+ fromAmino: ({ sender, account, denom }) => ({
167
+ sender,
168
+ account,
169
+ denom,
170
+ }),
171
+ },
172
+ // MsgClearAdmin - Clear admin
173
+ "/coreum.asset.ft.v1.MsgClearAdmin": {
174
+ aminoType: "cosmos-sdk/MsgClearAdmin",
175
+ toAmino: ({ sender, denom }) => ({
176
+ sender,
177
+ denom,
178
+ }),
179
+ fromAmino: ({ sender, denom }) => ({
180
+ sender,
181
+ denom,
182
+ }),
183
+ },
184
+ // MsgUpgradeTokenV1 - Upgrade token to V1
185
+ "/coreum.asset.ft.v1.MsgUpgradeTokenV1": {
186
+ aminoType: "cosmos-sdk/MsgUpgradeTokenV1",
187
+ toAmino: ({ sender, denom, ibcEnabled }) => ({
188
+ sender,
189
+ denom,
190
+ ibc_enabled: ibcEnabled,
191
+ }),
192
+ fromAmino: ({ sender, denom, ibc_enabled }) => ({
193
+ sender,
194
+ denom,
195
+ ibcEnabled: ibc_enabled,
196
+ }),
197
+ },
198
+ // MsgUpdateParams - Update parameters
199
+ "/coreum.asset.ft.v1.MsgUpdateParams": {
200
+ aminoType: "cosmos-sdk/MsgUpdateParams",
201
+ toAmino: ({ authority, params }) => ({
202
+ authority,
203
+ params,
204
+ }),
205
+ fromAmino: ({ authority, params }) => ({
206
+ authority,
207
+ params,
208
+ }),
209
+ },
210
+ // MsgUpdateDEXUnifiedRefAmount - Update DEX unified ref amount
211
+ "/coreum.asset.ft.v1.MsgUpdateDEXUnifiedRefAmount": {
212
+ aminoType: "cosmos-sdk/MsgUpdateDEXUnifiedRefAmount",
213
+ toAmino: ({ sender, denom, unifiedRefAmount, }) => ({
214
+ sender,
215
+ denom,
216
+ unified_ref_amount: unifiedRefAmount,
217
+ }),
218
+ fromAmino: ({ sender, denom, unified_ref_amount, }) => ({
219
+ sender,
220
+ denom,
221
+ unifiedRefAmount: unified_ref_amount,
222
+ }),
223
+ },
224
+ // MsgUpdateDEXWhitelistedDenoms - Update DEX whitelisted denoms
225
+ "/coreum.asset.ft.v1.MsgUpdateDEXWhitelistedDenoms": {
226
+ aminoType: "cosmos-sdk/MsgUpdateDEXWhitelistedDenoms",
227
+ toAmino: ({ sender, denom, whitelistedDenoms, }) => ({
228
+ sender,
229
+ denom,
230
+ whitelisted_denoms: whitelistedDenoms,
231
+ }),
232
+ fromAmino: ({ sender, denom, whitelisted_denoms, }) => ({
233
+ sender,
234
+ denom,
235
+ whitelistedDenoms: whitelisted_denoms,
236
+ }),
237
+ },
238
+ };
239
+ // DEX Amino Types
240
+ export const dexAminoConverters = {
241
+ // MsgUpdateParams - Update DEX parameters
242
+ "/coreum.dex.v1.MsgUpdateParams": {
243
+ aminoType: "cosmos-sdk/MsgUpdateParams",
244
+ toAmino: ({ authority, params }) => ({
245
+ authority,
246
+ params,
247
+ }),
248
+ fromAmino: ({ authority, params }) => ({
249
+ authority,
250
+ params,
251
+ }),
252
+ },
253
+ // MsgPlaceOrder - Place order on DEX
254
+ "/coreum.dex.v1.MsgPlaceOrder": {
255
+ aminoType: "cosmos-sdk/MsgPlaceOrder",
256
+ toAmino: ({ sender, type, id, baseDenom, quoteDenom, price, quantity, side, goodTil, timeInForce, }) => ({
257
+ sender,
258
+ type,
259
+ id,
260
+ base_denom: baseDenom,
261
+ quote_denom: quoteDenom,
262
+ price,
263
+ quantity,
264
+ side,
265
+ good_til: goodTil,
266
+ time_in_force: timeInForce,
267
+ }),
268
+ fromAmino: ({ sender, type, id, base_denom, quote_denom, price, quantity, side, good_til, time_in_force, }) => ({
269
+ sender,
270
+ type,
271
+ id,
272
+ baseDenom: base_denom,
273
+ quoteDenom: quote_denom,
274
+ price,
275
+ quantity,
276
+ side,
277
+ goodTil: good_til,
278
+ timeInForce: time_in_force,
279
+ }),
280
+ },
281
+ // MsgCancelOrder - Cancel order
282
+ "/coreum.dex.v1.MsgCancelOrder": {
283
+ aminoType: "cosmos-sdk/MsgCancelOrder",
284
+ toAmino: ({ sender, id }) => ({
285
+ sender,
286
+ id,
287
+ }),
288
+ fromAmino: ({ sender, id }) => ({
289
+ sender,
290
+ id,
291
+ }),
292
+ },
293
+ // MsgCancelOrdersByDenom - Cancel orders by denom
294
+ "/coreum.dex.v1.MsgCancelOrdersByDenom": {
295
+ aminoType: "cosmos-sdk/MsgCancelOrdersByDenom",
296
+ toAmino: ({ sender, account, denom }) => ({
297
+ sender,
298
+ account,
299
+ denom,
300
+ }),
301
+ fromAmino: ({ sender, account, denom }) => ({
302
+ sender,
303
+ account,
304
+ denom,
305
+ }),
306
+ },
307
+ };
308
+ // NFT (Non-Fungible Token) Amino Types
309
+ export const nftAminoConverters = {
310
+ // MsgIssueClass - Issue new NFT class
311
+ "/coreum.asset.nft.v1.MsgIssueClass": {
312
+ aminoType: "cosmos-sdk/MsgIssueClass",
313
+ toAmino: ({ issuer, symbol, name, description, uri, uriHash, data, features, royaltyRate, }) => ({
314
+ issuer,
315
+ symbol,
316
+ name,
317
+ description,
318
+ uri,
319
+ uri_hash: uriHash,
320
+ data,
321
+ features,
322
+ royalty_rate: royaltyRate,
323
+ }),
324
+ fromAmino: ({ issuer, symbol, name, description, uri, uri_hash, data, features, royalty_rate, }) => ({
325
+ issuer,
326
+ symbol,
327
+ name,
328
+ description,
329
+ uri,
330
+ uriHash: uri_hash,
331
+ data,
332
+ features,
333
+ royaltyRate: royalty_rate,
334
+ }),
335
+ },
336
+ // MsgMint - Mint NFT
337
+ "/coreum.asset.nft.v1.MsgMint": {
338
+ aminoType: "cosmos-sdk/MsgMint",
339
+ toAmino: ({ sender, classId, id, uri, uriHash, data, recipient, }) => ({
340
+ sender,
341
+ class_id: classId,
342
+ id,
343
+ uri,
344
+ uri_hash: uriHash,
345
+ data,
346
+ recipient,
347
+ }),
348
+ fromAmino: ({ sender, class_id, id, uri, uri_hash, data, recipient, }) => ({
349
+ sender,
350
+ classId: class_id,
351
+ id,
352
+ uri,
353
+ uriHash: uri_hash,
354
+ data,
355
+ recipient,
356
+ }),
357
+ },
358
+ // MsgUpdateData - Update NFT data
359
+ "/coreum.asset.nft.v1.MsgUpdateData": {
360
+ aminoType: "cosmos-sdk/MsgUpdateData",
361
+ toAmino: ({ sender, classId, id, items }) => ({
362
+ sender,
363
+ class_id: classId,
364
+ id,
365
+ items,
366
+ }),
367
+ fromAmino: ({ sender, class_id, id, items }) => ({
368
+ sender,
369
+ classId: class_id,
370
+ id,
371
+ items,
372
+ }),
373
+ },
374
+ // MsgBurn - Burn NFT
375
+ "/coreum.asset.nft.v1.MsgBurn": {
376
+ aminoType: "cosmos-sdk/MsgBurn",
377
+ toAmino: ({ sender, classId, id }) => ({
378
+ sender,
379
+ class_id: classId,
380
+ id,
381
+ }),
382
+ fromAmino: ({ sender, class_id, id }) => ({
383
+ sender,
384
+ classId: class_id,
385
+ id,
386
+ }),
387
+ },
388
+ // MsgFreeze - Freeze NFT
389
+ "/coreum.asset.nft.v1.MsgFreeze": {
390
+ aminoType: "cosmos-sdk/MsgFreeze",
391
+ toAmino: ({ sender, classId, id }) => ({
392
+ sender,
393
+ class_id: classId,
394
+ id,
395
+ }),
396
+ fromAmino: ({ sender, class_id, id }) => ({
397
+ sender,
398
+ classId: class_id,
399
+ id,
400
+ }),
401
+ },
402
+ // MsgUnfreeze - Unfreeze NFT
403
+ "/coreum.asset.nft.v1.MsgUnfreeze": {
404
+ aminoType: "cosmos-sdk/MsgUnfreeze",
405
+ toAmino: ({ sender, classId, id }) => ({
406
+ sender,
407
+ class_id: classId,
408
+ id,
409
+ }),
410
+ fromAmino: ({ sender, class_id, id }) => ({
411
+ sender,
412
+ classId: class_id,
413
+ id,
414
+ }),
415
+ },
416
+ // MsgClassFreeze - Freeze NFT class for account
417
+ "/coreum.asset.nft.v1.MsgClassFreeze": {
418
+ aminoType: "cosmos-sdk/MsgClassFreeze",
419
+ toAmino: ({ sender, classId, account }) => ({
420
+ sender,
421
+ class_id: classId,
422
+ account,
423
+ }),
424
+ fromAmino: ({ sender, class_id, account }) => ({
425
+ sender,
426
+ classId: class_id,
427
+ account,
428
+ }),
429
+ },
430
+ // MsgClassUnfreeze - Unfreeze NFT class for account
431
+ "/coreum.asset.nft.v1.MsgClassUnfreeze": {
432
+ aminoType: "cosmos-sdk/MsgClassUnfreeze",
433
+ toAmino: ({ sender, classId, account }) => ({
434
+ sender,
435
+ class_id: classId,
436
+ account,
437
+ }),
438
+ fromAmino: ({ sender, class_id, account }) => ({
439
+ sender,
440
+ classId: class_id,
441
+ account,
442
+ }),
443
+ },
444
+ // MsgAddToWhitelist - Add account to NFT whitelist
445
+ "/coreum.asset.nft.v1.MsgAddToWhitelist": {
446
+ aminoType: "cosmos-sdk/MsgAddToWhitelist",
447
+ toAmino: ({ sender, classId, id, account }) => ({
448
+ sender,
449
+ class_id: classId,
450
+ id,
451
+ account,
452
+ }),
453
+ fromAmino: ({ sender, class_id, id, account }) => ({
454
+ sender,
455
+ classId: class_id,
456
+ id,
457
+ account,
458
+ }),
459
+ },
460
+ // MsgRemoveFromWhitelist - Remove account from NFT whitelist
461
+ "/coreum.asset.nft.v1.MsgRemoveFromWhitelist": {
462
+ aminoType: "cosmos-sdk/MsgRemoveFromWhitelist",
463
+ toAmino: ({ sender, classId, id, account }) => ({
464
+ sender,
465
+ class_id: classId,
466
+ id,
467
+ account,
468
+ }),
469
+ fromAmino: ({ sender, class_id, id, account, }) => ({
470
+ sender,
471
+ classId: class_id,
472
+ id,
473
+ account,
474
+ }),
475
+ },
476
+ // MsgAddToClassWhitelist - Add account to NFT class whitelist
477
+ "/coreum.asset.nft.v1.MsgAddToClassWhitelist": {
478
+ aminoType: "cosmos-sdk/MsgAddToClassWhitelist",
479
+ toAmino: ({ sender, classId, account }) => ({
480
+ sender,
481
+ class_id: classId,
482
+ account,
483
+ }),
484
+ fromAmino: ({ sender, class_id, account, }) => ({
485
+ sender,
486
+ classId: class_id,
487
+ account,
488
+ }),
489
+ },
490
+ // MsgRemoveFromClassWhitelist - Remove account from NFT class whitelist
491
+ "/coreum.asset.nft.v1.MsgRemoveFromClassWhitelist": {
492
+ aminoType: "cosmos-sdk/MsgRemoveFromClassWhitelist",
493
+ toAmino: ({ sender, classId, account }) => ({
494
+ sender,
495
+ class_id: classId,
496
+ account,
497
+ }),
498
+ fromAmino: ({ sender, class_id, account, }) => ({
499
+ sender,
500
+ classId: class_id,
501
+ account,
502
+ }),
503
+ },
504
+ // MsgUpdateParams - Update NFT module parameters
505
+ "/coreum.asset.nft.v1.MsgUpdateParams": {
506
+ aminoType: "cosmos-sdk/MsgUpdateParams",
507
+ toAmino: ({ authority, params }) => ({
508
+ authority,
509
+ params,
510
+ }),
511
+ fromAmino: ({ authority, params }) => ({
512
+ authority,
513
+ params,
514
+ }),
515
+ },
516
+ };
517
+ // NFT Beta Amino Types
518
+ export const nftBetaAminoConverters = {
519
+ // MsgSend - Send NFT
520
+ "/cosmos.nft.v1beta1.MsgSend": {
521
+ aminoType: "cosmos-sdk/MsgSend",
522
+ toAmino: ({ classId, id, sender, receiver }) => ({
523
+ class_id: classId,
524
+ id,
525
+ sender,
526
+ receiver,
527
+ }),
528
+ fromAmino: ({ class_id, id, sender, receiver }) => ({
529
+ classId: class_id,
530
+ id,
531
+ sender,
532
+ receiver,
533
+ }),
534
+ },
535
+ };
536
+ // Combined Amino Converters
537
+ export const coreumAminoConverters = {
538
+ ...ftAminoConverters,
539
+ ...dexAminoConverters,
540
+ ...nftAminoConverters,
541
+ ...nftBetaAminoConverters,
542
+ };
543
+ // Create AminoTypes instance
544
+ export function createCoreumAminoTypes() {
545
+ return new AminoTypes(coreumAminoConverters);
546
+ }
@@ -4,6 +4,7 @@ import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhite
4
4
  import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms } from "./asset/ft/v1/tx";
5
5
  import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom } from "./dex/v1/tx";
6
6
  import { FTMsgs, NFTMsgs } from "../types/msgs";
7
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino";
7
8
  export { Feature } from "./asset/ft/v1/token";
8
9
  export { ClassFeature } from "./asset/nft/v1/nft";
9
10
  /** @internal */
@@ -5,6 +5,8 @@ import { MsgSend as NFTMsgSend } from "./nft/v1beta1/tx";
5
5
  import { MsgIssueClass as NFTMsgIssueClass, MsgMint as NFTMsgMint, MsgAddToWhitelist as NFTMsgAddToWhitelist, MsgBurn as NFTMsgBurn, MsgRemoveFromWhitelist as NFTMsgRemoveFromWhitelist, MsgFreeze as NFTMsgFreeze, MsgUnfreeze as NFTMsgUnfreeze, } from "./asset/nft/v1/tx";
6
6
  import { MsgIssue as FTMsgIssue, MsgMint as FTMsgMint, MsgBurn as FTMsgBurn, MsgFreeze as FTMsgFreeze, MsgUnfreeze as FTMsgUnfreeze, MsgGloballyFreeze as FTMsgGloballyFreeze, MsgGloballyUnfreeze as FTMsgGloballyUnfreeze, MsgSetWhitelistedLimit as FTMsgSetWhitelistedLimit, MsgClawback as FTMsgClawback, MsgUpdateDEXUnifiedRefAmount, MsgUpdateDEXWhitelistedDenoms, } from "./asset/ft/v1/tx";
7
7
  import { MsgUpdateParams as DEXMsgUpdateParams, MsgPlaceOrder as DEXMsgPlaceOrder, MsgCancelOrder as DEXMsgCancelOrder, MsgCancelOrdersByDenom as DEXMsgCancelOrdersByDenom, } from "./dex/v1/tx";
8
+ // Export AminoTypes
9
+ export { createCoreumAminoTypes, coreumAminoConverters, ftAminoConverters, dexAminoConverters, nftAminoConverters, nftBetaAminoConverters, } from "./amino";
8
10
  export { Feature } from "./asset/ft/v1/token";
9
11
  export { ClassFeature } from "./asset/nft/v1/nft";
10
12
  /**
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Example demonstrating how to use Coreum AminoTypes
3
+ *
4
+ * This example shows how to create and use AminoTypes for Coreum transaction messages
5
+ * in both protobuf and amino JSON formats.
6
+ */
7
+
8
+ import { createCoreumAminoTypes } from "../src/coreum/amino";
9
+ import { AminoTypes } from "@cosmjs/stargate";
10
+
11
+ // Create AminoTypes instance
12
+ const aminoTypes = createCoreumAminoTypes();
13
+
14
+ // Example: FT (Fungible Token) Message
15
+ const ftMsgIssue = {
16
+ typeUrl: "/coreum.asset.ft.v1.MsgIssue",
17
+ value: {
18
+ issuer: "core1abc123...",
19
+ symbol: "MYTOKEN",
20
+ subunit: "mytoken",
21
+ precision: 6,
22
+ initialAmount: "1000000",
23
+ description: "My custom token",
24
+ features: [1], // Feature enum value
25
+ burnRate: "0.01",
26
+ sendCommissionRate: "0.005",
27
+ uri: "https://example.com/token",
28
+ uriHash: "hash123",
29
+ },
30
+ };
31
+
32
+ // Example: DEX Message
33
+ const dexMsgPlaceOrder = {
34
+ typeUrl: "/coreum.dex.v1.MsgPlaceOrder",
35
+ value: {
36
+ sender: "core1abc123...",
37
+ type: 1, // OrderType enum value
38
+ id: "order123",
39
+ baseDenom: "ucore",
40
+ quoteDenom: "mytoken",
41
+ price: "100",
42
+ quantity: "1000",
43
+ side: 1, // Side enum value
44
+ goodTil: {
45
+ blockHeight: 1000,
46
+ },
47
+ timeInForce: 1, // TimeInForce enum value
48
+ },
49
+ };
50
+
51
+ // Example: NFT Message
52
+ const nftMsgIssueClass = {
53
+ typeUrl: "/coreum.asset.nft.v1.MsgIssueClass",
54
+ value: {
55
+ issuer: "core1abc123...",
56
+ symbol: "MYNFT",
57
+ name: "My NFT Collection",
58
+ description: "A collection of unique NFTs",
59
+ uri: "https://example.com/nft",
60
+ uriHash: "hash123",
61
+ data: undefined,
62
+ features: [1], // ClassFeature enum value
63
+ royaltyRate: "0.05",
64
+ },
65
+ };
66
+
67
+ // Example: NFT Beta Message
68
+ const nftBetaMsgSend = {
69
+ typeUrl: "/cosmos.nft.v1beta1.MsgSend",
70
+ value: {
71
+ classId: "class123",
72
+ id: "nft456",
73
+ sender: "core1abc123...",
74
+ receiver: "core1def789...",
75
+ },
76
+ };
77
+
78
+ // Convert to Amino JSON format
79
+ console.log("FT MsgIssue in Amino JSON format:");
80
+ console.log(JSON.stringify(aminoTypes.toAmino(ftMsgIssue), null, 2));
81
+
82
+ console.log("\nDEX MsgPlaceOrder in Amino JSON format:");
83
+ console.log(JSON.stringify(aminoTypes.toAmino(dexMsgPlaceOrder), null, 2));
84
+
85
+ console.log("\nNFT MsgIssueClass in Amino JSON format:");
86
+ console.log(JSON.stringify(aminoTypes.toAmino(nftMsgIssueClass), null, 2));
87
+
88
+ console.log("\nNFT Beta MsgSend in Amino JSON format:");
89
+ console.log(JSON.stringify(aminoTypes.toAmino(nftBetaMsgSend), null, 2));
90
+
91
+ // Example of creating AminoTypes with custom configuration
92
+ const customAminoTypes = new AminoTypes({
93
+ // You can combine with other converters
94
+ ...createCoreumAminoTypes(),
95
+ // Add other custom converters here if needed
96
+ });
97
+
98
+ export {
99
+ ftMsgIssue,
100
+ dexMsgPlaceOrder,
101
+ nftMsgIssueClass,
102
+ nftBetaMsgSend,
103
+ aminoTypes,
104
+ customAminoTypes,
105
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coreum-js",
3
- "version": "2.17.5",
3
+ "version": "2.18.1",
4
4
  "description": "JS/TS Library to to easily make use of the Coreum Blockchain",
5
5
  "main": "dist/main/index.js",
6
6
  "module": "dist/module/index.js",
@@ -32,7 +32,7 @@
32
32
  "@cosmostation/cosmos-client": "^0.0.5",
33
33
  "@cosmostation/extension-client": "^0.1.15",
34
34
  "bech32": "^2.0.0",
35
- "bignumber.js": "^9.1.1",
35
+ "bignumber.js": "9.1.1",
36
36
  "cosmjs-types": "^0.9.0",
37
37
  "eventemitter3": "^5.0.0",
38
38
  "google-protobuf": "^3.21.2",