@firmachain/firma-js 0.2.53 → 0.2.54

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.
@@ -21,6 +21,9 @@ export interface NftInfo {
21
21
  is_deposit: boolean;
22
22
  }
23
23
  export declare class CwBridgeMsgData {
24
+ static getMsgDataChangeOwner(new_owner: string): string;
25
+ static getMsgDataAddAuthorizedUser(user: string): string;
26
+ static getMsgDataRemoveAuthorizedUser(user: string): string;
24
27
  static getMsgDataLock(): {
25
28
  action: string;
26
29
  target_addr: string;
@@ -39,6 +42,12 @@ export declare class FirmaCosmWasmCwBridgeService {
39
42
  private readonly cw721Service;
40
43
  constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService, cw721Service: FirmaCosmWasmCw721Service);
41
44
  getCwBridgeMsgData(): typeof CwBridgeMsgData;
45
+ changeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
46
+ getUnsignedTxChangeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string): Promise<EncodeObject>;
47
+ addAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
48
+ getUnsignedTxAddAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<EncodeObject>;
49
+ removeAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
50
+ getUnsignedTxRemoveAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<EncodeObject>;
42
51
  lock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
43
52
  getUnsignedTxLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<EncodeObject>;
44
53
  deposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
@@ -49,11 +58,16 @@ export declare class FirmaCosmWasmCwBridgeService {
49
58
  getUnsignedTxWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<EncodeObject>;
50
59
  signAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<BroadcastTxResponse>;
51
60
  getGasEstimationSignAndBroadcast(wallet: FirmaWalletService, msgList: EncodeObject[], txMisc?: TxMisc): Promise<number>;
61
+ getGasEstimationChangeOwner(wallet: FirmaWalletService, contractAddress: string, new_owner: string): Promise<number>;
62
+ getGasEstimationAddAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<number>;
63
+ getGasEstimationRemoveAuthorizedUser(wallet: FirmaWalletService, contractAddress: string, user: string): Promise<number>;
52
64
  getGasEstimationLock(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string): Promise<number>;
53
65
  getGasEstimationDeposit(wallet: FirmaWalletService, contractAddress: string, cw721ContractAddress: string, tokenId: string, toAddress: string): Promise<number>;
54
66
  getGasEstimationUnlock(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
55
67
  getGasEstimationWithdraw(wallet: FirmaWalletService, contractAddress: string, token_id: string): Promise<number>;
56
68
  getConfig(contractAddress: string): Promise<BridgeConfig>;
69
+ getOwner(contractAddress: string): Promise<string>;
70
+ getAuthorizedUsers(contractAddress: string): Promise<string[]>;
57
71
  getNftInfo(contractAddress: string, tokenId: string): Promise<NftInfo>;
58
72
  getOwnerNfts(contractAddress: string, ownerAddress: string): Promise<string[]>;
59
73
  getOwnerNftsInfo(contractAddress: string, ownerAddress: string): Promise<NftInfo[]>;
@@ -44,6 +44,27 @@ var noFunds = [];
44
44
  var CwBridgeMsgData = /** @class */ (function () {
45
45
  function CwBridgeMsgData() {
46
46
  }
47
+ CwBridgeMsgData.getMsgDataChangeOwner = function (new_owner) {
48
+ return JSON.stringify({
49
+ "change_owner": {
50
+ new_owner: new_owner,
51
+ }
52
+ });
53
+ };
54
+ CwBridgeMsgData.getMsgDataAddAuthorizedUser = function (user) {
55
+ return JSON.stringify({
56
+ "add_authorized_user": {
57
+ user: user,
58
+ }
59
+ });
60
+ };
61
+ CwBridgeMsgData.getMsgDataRemoveAuthorizedUser = function (user) {
62
+ return JSON.stringify({
63
+ "remove_authorized_user": {
64
+ user: user,
65
+ }
66
+ });
67
+ };
47
68
  CwBridgeMsgData.getMsgDataLock = function () {
48
69
  return {
49
70
  action: "lock",
@@ -92,6 +113,91 @@ var FirmaCosmWasmCwBridgeService = /** @class */ (function () {
92
113
  FirmaCosmWasmCwBridgeService.prototype.getCwBridgeMsgData = function () {
93
114
  return CwBridgeMsgData;
94
115
  };
116
+ FirmaCosmWasmCwBridgeService.prototype.changeOwner = function (wallet, contractAddress, new_owner, txMisc) {
117
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
118
+ return __awaiter(this, void 0, void 0, function () {
119
+ var msgData;
120
+ return __generator(this, function (_a) {
121
+ switch (_a.label) {
122
+ case 0:
123
+ msgData = CwBridgeMsgData.getMsgDataChangeOwner(new_owner);
124
+ return [4 /*yield*/, this.cosmwasmService.executeContract(wallet, contractAddress, msgData, noFunds, txMisc)];
125
+ case 1: return [2 /*return*/, _a.sent()];
126
+ }
127
+ });
128
+ });
129
+ };
130
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxChangeOwner = function (wallet, contractAddress, new_owner) {
131
+ return __awaiter(this, void 0, void 0, function () {
132
+ var msgData;
133
+ return __generator(this, function (_a) {
134
+ switch (_a.label) {
135
+ case 0:
136
+ msgData = JSON.stringify({
137
+ "change_owner": {
138
+ new_owner: new_owner,
139
+ }
140
+ });
141
+ return [4 /*yield*/, this.cosmwasmService.getUnsignedTxExecuteContract(wallet, contractAddress, msgData, noFunds)];
142
+ case 1: return [2 /*return*/, _a.sent()];
143
+ }
144
+ });
145
+ });
146
+ };
147
+ FirmaCosmWasmCwBridgeService.prototype.addAuthorizedUser = function (wallet, contractAddress, user, txMisc) {
148
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
149
+ return __awaiter(this, void 0, void 0, function () {
150
+ var msgData;
151
+ return __generator(this, function (_a) {
152
+ switch (_a.label) {
153
+ case 0:
154
+ msgData = CwBridgeMsgData.getMsgDataAddAuthorizedUser(user);
155
+ return [4 /*yield*/, this.cosmwasmService.executeContract(wallet, contractAddress, msgData, noFunds, txMisc)];
156
+ case 1: return [2 /*return*/, _a.sent()];
157
+ }
158
+ });
159
+ });
160
+ };
161
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxAddAuthorizedUser = function (wallet, contractAddress, user) {
162
+ return __awaiter(this, void 0, void 0, function () {
163
+ var msgData;
164
+ return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0:
167
+ msgData = CwBridgeMsgData.getMsgDataAddAuthorizedUser(user);
168
+ return [4 /*yield*/, this.cosmwasmService.getUnsignedTxExecuteContract(wallet, contractAddress, msgData, noFunds)];
169
+ case 1: return [2 /*return*/, _a.sent()];
170
+ }
171
+ });
172
+ });
173
+ };
174
+ FirmaCosmWasmCwBridgeService.prototype.removeAuthorizedUser = function (wallet, contractAddress, user, txMisc) {
175
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
176
+ return __awaiter(this, void 0, void 0, function () {
177
+ var msgData;
178
+ return __generator(this, function (_a) {
179
+ switch (_a.label) {
180
+ case 0:
181
+ msgData = CwBridgeMsgData.getMsgDataRemoveAuthorizedUser(user);
182
+ return [4 /*yield*/, this.cosmwasmService.executeContract(wallet, contractAddress, msgData, noFunds, txMisc)];
183
+ case 1: return [2 /*return*/, _a.sent()];
184
+ }
185
+ });
186
+ });
187
+ };
188
+ FirmaCosmWasmCwBridgeService.prototype.getUnsignedTxRemoveAuthorizedUser = function (wallet, contractAddress, user) {
189
+ return __awaiter(this, void 0, void 0, function () {
190
+ var msgData;
191
+ return __generator(this, function (_a) {
192
+ switch (_a.label) {
193
+ case 0:
194
+ msgData = CwBridgeMsgData.getMsgDataRemoveAuthorizedUser(user);
195
+ return [4 /*yield*/, this.cosmwasmService.getUnsignedTxExecuteContract(wallet, contractAddress, msgData, noFunds)];
196
+ case 1: return [2 /*return*/, _a.sent()];
197
+ }
198
+ });
199
+ });
200
+ };
95
201
  FirmaCosmWasmCwBridgeService.prototype.lock = function (wallet, contractAddress, cw721ContractAddress, tokenId, txMisc) {
96
202
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
97
203
  return __awaiter(this, void 0, void 0, function () {
@@ -244,6 +350,45 @@ var FirmaCosmWasmCwBridgeService = /** @class */ (function () {
244
350
  });
245
351
  };
246
352
  // gas
353
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationChangeOwner = function (wallet, contractAddress, new_owner) {
354
+ return __awaiter(this, void 0, void 0, function () {
355
+ var msgData;
356
+ return __generator(this, function (_a) {
357
+ switch (_a.label) {
358
+ case 0:
359
+ msgData = CwBridgeMsgData.getMsgDataChangeOwner(new_owner);
360
+ return [4 /*yield*/, this.cosmwasmService.getGasEstimationExecuteContract(wallet, contractAddress, msgData, noFunds)];
361
+ case 1: return [2 /*return*/, _a.sent()];
362
+ }
363
+ });
364
+ });
365
+ };
366
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationAddAuthorizedUser = function (wallet, contractAddress, user) {
367
+ return __awaiter(this, void 0, void 0, function () {
368
+ var msgData;
369
+ return __generator(this, function (_a) {
370
+ switch (_a.label) {
371
+ case 0:
372
+ msgData = CwBridgeMsgData.getMsgDataAddAuthorizedUser(user);
373
+ return [4 /*yield*/, this.cosmwasmService.getGasEstimationExecuteContract(wallet, contractAddress, msgData, noFunds)];
374
+ case 1: return [2 /*return*/, _a.sent()];
375
+ }
376
+ });
377
+ });
378
+ };
379
+ FirmaCosmWasmCwBridgeService.prototype.getGasEstimationRemoveAuthorizedUser = function (wallet, contractAddress, user) {
380
+ return __awaiter(this, void 0, void 0, function () {
381
+ var msgData;
382
+ return __generator(this, function (_a) {
383
+ switch (_a.label) {
384
+ case 0:
385
+ msgData = CwBridgeMsgData.getMsgDataRemoveAuthorizedUser(user);
386
+ return [4 /*yield*/, this.cosmwasmService.getGasEstimationExecuteContract(wallet, contractAddress, msgData, noFunds)];
387
+ case 1: return [2 /*return*/, _a.sent()];
388
+ }
389
+ });
390
+ });
391
+ };
247
392
  FirmaCosmWasmCwBridgeService.prototype.getGasEstimationLock = function (wallet, contractAddress, cw721ContractAddress, tokenId) {
248
393
  return __awaiter(this, void 0, void 0, function () {
249
394
  var msgData;
@@ -303,7 +448,37 @@ var FirmaCosmWasmCwBridgeService = /** @class */ (function () {
303
448
  return __generator(this, function (_a) {
304
449
  switch (_a.label) {
305
450
  case 0:
306
- query = "{\"get_config\": { }}";
451
+ query = "{\"get_config\": {}}";
452
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
453
+ case 1:
454
+ result = _a.sent();
455
+ return [2 /*return*/, JSON.parse(result)];
456
+ }
457
+ });
458
+ });
459
+ };
460
+ FirmaCosmWasmCwBridgeService.prototype.getOwner = function (contractAddress) {
461
+ return __awaiter(this, void 0, void 0, function () {
462
+ var query, result;
463
+ return __generator(this, function (_a) {
464
+ switch (_a.label) {
465
+ case 0:
466
+ query = "{\"get_owner\": {}}";
467
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
468
+ case 1:
469
+ result = _a.sent();
470
+ return [2 /*return*/, JSON.parse(result)];
471
+ }
472
+ });
473
+ });
474
+ };
475
+ FirmaCosmWasmCwBridgeService.prototype.getAuthorizedUsers = function (contractAddress) {
476
+ return __awaiter(this, void 0, void 0, function () {
477
+ var query, result;
478
+ return __generator(this, function (_a) {
479
+ switch (_a.label) {
480
+ case 0:
481
+ query = "{\"get_authorized_users\": {}}";
307
482
  return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
308
483
  case 1:
309
484
  result = _a.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.2.53",
3
+ "version": "0.2.54",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",