@firmachain/firma-js 0.2.57 → 0.2.59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +0 -1
- package/dist/sdk/FirmaCosmWasmCw20.js +1 -4
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +0 -1
- package/dist/sdk/FirmaCosmWasmCw721.js +0 -3
- package/dist/sdk/FirmaCosmWasmService.d.ts +5 -2
- package/dist/sdk/FirmaCosmWasmService.js +3 -2
- package/dist/sdk/FirmaIbcService.js +3 -3
- package/dist/sdk/firmachain/common/ITxClient.d.ts +1 -0
- package/dist/sdk/firmachain/common/ITxClient.js +14 -0
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +5 -1
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +8 -4
- package/package.json +1 -1
|
@@ -59,7 +59,6 @@ export declare class FirmaCosmWasmCw20Service {
|
|
|
59
59
|
private readonly config;
|
|
60
60
|
private readonly cosmwasmService;
|
|
61
61
|
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
|
|
62
|
-
getCw721MsgData(): typeof Cw20MsgData;
|
|
63
62
|
transfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
64
63
|
getUnsignedTxTransfer(wallet: FirmaWalletService, contractAddress: string, recipient: string, amount: string): Promise<EncodeObject>;
|
|
65
64
|
transferFrom(wallet: FirmaWalletService, contractAddress: string, owner: string, recipient: string, amount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
@@ -153,9 +153,6 @@ var FirmaCosmWasmCw20Service = /** @class */ (function () {
|
|
|
153
153
|
this.config = config;
|
|
154
154
|
this.cosmwasmService = cosmwasmService;
|
|
155
155
|
}
|
|
156
|
-
FirmaCosmWasmCw20Service.prototype.getCw721MsgData = function () {
|
|
157
|
-
return Cw20MsgData;
|
|
158
|
-
};
|
|
159
156
|
// tx
|
|
160
157
|
FirmaCosmWasmCw20Service.prototype.transfer = function (wallet, contractAddress, recipient, amount, txMisc) {
|
|
161
158
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
@@ -830,7 +827,7 @@ var FirmaCosmWasmCw20Service = /** @class */ (function () {
|
|
|
830
827
|
case 1:
|
|
831
828
|
result = _a.sent();
|
|
832
829
|
data = JSON.parse(result);
|
|
833
|
-
return [2 /*return*/, data];
|
|
830
|
+
return [2 /*return*/, data.allowances];
|
|
834
831
|
case 2:
|
|
835
832
|
error_9 = _a.sent();
|
|
836
833
|
FirmaUtil_1.FirmaUtil.printLog(error_9);
|
|
@@ -54,7 +54,6 @@ export declare class FirmaCosmWasmCw721Service {
|
|
|
54
54
|
private readonly config;
|
|
55
55
|
private readonly cosmwasmService;
|
|
56
56
|
constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
|
|
57
|
-
getCw721MsgData(): typeof Cw721MsgData;
|
|
58
57
|
mint(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, token_uri?: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
59
58
|
getUnsignedTxMint(wallet: FirmaWalletService, contractAddress: string, owner: string, token_id: string, token_uri?: string): Promise<EncodeObject>;
|
|
60
59
|
burn(wallet: FirmaWalletService, contractAddress: string, token_id: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
|
|
@@ -138,9 +138,6 @@ var FirmaCosmWasmCw721Service = /** @class */ (function () {
|
|
|
138
138
|
this.config = config;
|
|
139
139
|
this.cosmwasmService = cosmwasmService;
|
|
140
140
|
}
|
|
141
|
-
FirmaCosmWasmCw721Service.prototype.getCw721MsgData = function () {
|
|
142
|
-
return Cw721MsgData;
|
|
143
|
-
};
|
|
144
141
|
// tx
|
|
145
142
|
FirmaCosmWasmCw721Service.prototype.mint = function (wallet, contractAddress, owner, token_id, token_uri, txMisc) {
|
|
146
143
|
if (token_uri === void 0) { token_uri = ""; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CosmWasmTxClient, TxMisc, CodeInfo, CodeData, ContractInfo, ContractHistoryInfo, ContractStateInfo } from "./firmachain/cosmwasm";
|
|
1
|
+
import { CosmWasmTxClient, TxMisc, CodeInfo, CodeData, ContractInfo, ContractHistoryInfo, ContractStateInfo, Pagination } from "./firmachain/cosmwasm";
|
|
2
2
|
import { TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";
|
|
3
3
|
import { FirmaWalletService } from "./FirmaWalletService";
|
|
4
4
|
import { FirmaConfig } from "./FirmaConfig";
|
|
@@ -34,7 +34,10 @@ export declare class FirmaCosmWasmService {
|
|
|
34
34
|
private getSignedTxStoreCode;
|
|
35
35
|
getCodeList(): Promise<CodeInfo[]>;
|
|
36
36
|
getCodeData(codeId: string): Promise<CodeData>;
|
|
37
|
-
getContractListFromCodeId(codeId: string): Promise<
|
|
37
|
+
getContractListFromCodeId(codeId: string, paginationKey?: string): Promise<{
|
|
38
|
+
dataList: string[];
|
|
39
|
+
pagination: Pagination;
|
|
40
|
+
}>;
|
|
38
41
|
getContractInfo(contractAddress: string): Promise<ContractInfo>;
|
|
39
42
|
getContractHistory(contractAddress: string): Promise<ContractHistoryInfo[]>;
|
|
40
43
|
getContractRawQueryData(contractAddress: string, hexString: string): Promise<string>;
|
|
@@ -582,7 +582,8 @@ var FirmaCosmWasmService = /** @class */ (function () {
|
|
|
582
582
|
});
|
|
583
583
|
});
|
|
584
584
|
};
|
|
585
|
-
FirmaCosmWasmService.prototype.getContractListFromCodeId = function (codeId) {
|
|
585
|
+
FirmaCosmWasmService.prototype.getContractListFromCodeId = function (codeId, paginationKey) {
|
|
586
|
+
if (paginationKey === void 0) { paginationKey = ""; }
|
|
586
587
|
return __awaiter(this, void 0, void 0, function () {
|
|
587
588
|
var queryClient, result, error_24;
|
|
588
589
|
return __generator(this, function (_a) {
|
|
@@ -590,7 +591,7 @@ var FirmaCosmWasmService = /** @class */ (function () {
|
|
|
590
591
|
case 0:
|
|
591
592
|
_a.trys.push([0, 2, , 3]);
|
|
592
593
|
queryClient = new cosmwasm_1.CosmWasmQueryClient(this.config.restApiAddress);
|
|
593
|
-
return [4 /*yield*/, queryClient.getContractListFromCodeId(codeId)];
|
|
594
|
+
return [4 /*yield*/, queryClient.getContractListFromCodeId(codeId, paginationKey)];
|
|
594
595
|
case 1:
|
|
595
596
|
result = _a.sent();
|
|
596
597
|
return [2 /*return*/, result];
|
|
@@ -71,7 +71,7 @@ var FirmaIbcService = /** @class */ (function () {
|
|
|
71
71
|
FirmaIbcService.prototype.transfer = function (wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc) {
|
|
72
72
|
if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
|
|
73
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var txRaw,
|
|
74
|
+
var txRaw, txClient, error_2;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
@@ -79,8 +79,8 @@ var FirmaIbcService = /** @class */ (function () {
|
|
|
79
79
|
return [4 /*yield*/, this.getSignedTxTransfer(wallet, sourcePort, sourceChannel, denom, amount, receiver, timeoutHeight, timeoutTimestamp, txMisc)];
|
|
80
80
|
case 1:
|
|
81
81
|
txRaw = _a.sent();
|
|
82
|
-
|
|
83
|
-
return [4 /*yield*/,
|
|
82
|
+
txClient = new ibc_1.IbcTxClient(wallet, this.config.rpcAddress);
|
|
83
|
+
return [4 /*yield*/, txClient.broadcast(txRaw)];
|
|
84
84
|
case 2: return [2 /*return*/, _a.sent()];
|
|
85
85
|
case 3:
|
|
86
86
|
error_2 = _a.sent();
|
|
@@ -13,6 +13,7 @@ export declare class ITxClient {
|
|
|
13
13
|
getRegistry(): Registry;
|
|
14
14
|
sign(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<TxRaw>;
|
|
15
15
|
broadcast(txRaw: TxRaw): Promise<BroadcastTxResponse>;
|
|
16
|
+
broadcastTxBytes(txBytes: Uint8Array): Promise<BroadcastTxResponse>;
|
|
16
17
|
signAndBroadcast(msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions): Promise<BroadcastTxResponse>;
|
|
17
18
|
signDirectForSignDoc(signerAddress: string, signDoc: SignDoc): Promise<TxRawExt>;
|
|
18
19
|
}
|
|
@@ -83,6 +83,20 @@ var ITxClient = /** @class */ (function () {
|
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
|
+
ITxClient.prototype.broadcastTxBytes = function (txBytes) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var client;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, signingstargateclient_1.SigningStargateClient.connectWithSigner(this.serverUrl, this.rawWallet, this.registry)];
|
|
92
|
+
case 1:
|
|
93
|
+
client = _a.sent();
|
|
94
|
+
return [4 /*yield*/, client.broadcastTx(txBytes)];
|
|
95
|
+
case 2: return [2 /*return*/, _a.sent()];
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
};
|
|
86
100
|
ITxClient.prototype.signAndBroadcast = function (msgs, _a) {
|
|
87
101
|
var fee = _a.fee, memo = _a.memo;
|
|
88
102
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Pagination } from "../common";
|
|
1
2
|
export interface CodeInfo {
|
|
2
3
|
code_id: string;
|
|
3
4
|
creator: string;
|
|
@@ -42,7 +43,10 @@ export declare class CosmWasmQueryClient {
|
|
|
42
43
|
constructor(baseUrl: string);
|
|
43
44
|
getCodeInfoList(): Promise<CodeInfo[]>;
|
|
44
45
|
getCodeData(codeId: string): Promise<CodeData>;
|
|
45
|
-
getContractListFromCodeId(codeId: string): Promise<
|
|
46
|
+
getContractListFromCodeId(codeId: string, paginationKey: string): Promise<{
|
|
47
|
+
dataList: string[];
|
|
48
|
+
pagination: Pagination;
|
|
49
|
+
}>;
|
|
46
50
|
getContractInfo(contractAddress: string): Promise<ContractInfo>;
|
|
47
51
|
getContractHistory(contractAddress: string): Promise<ContractHistoryInfo[]>;
|
|
48
52
|
getContractRawQueryData(contractAddress: string, hexString: string): Promise<string>;
|
|
@@ -81,17 +81,21 @@ var CosmWasmQueryClient = /** @class */ (function () {
|
|
|
81
81
|
});
|
|
82
82
|
});
|
|
83
83
|
};
|
|
84
|
-
CosmWasmQueryClient.prototype.getContractListFromCodeId = function (codeId) {
|
|
84
|
+
CosmWasmQueryClient.prototype.getContractListFromCodeId = function (codeId, paginationKey) {
|
|
85
85
|
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
var path, result;
|
|
86
|
+
var path, result, convertPagination;
|
|
87
87
|
return __generator(this, function (_a) {
|
|
88
88
|
switch (_a.label) {
|
|
89
89
|
case 0:
|
|
90
90
|
path = "/cosmwasm/wasm/v1/code/" + codeId + "/contracts";
|
|
91
|
-
return [4 /*yield*/, this.axios.get(path)];
|
|
91
|
+
return [4 /*yield*/, this.axios.get(path, { params: { "pagination.key": paginationKey } })];
|
|
92
92
|
case 1:
|
|
93
93
|
result = _a.sent();
|
|
94
|
-
|
|
94
|
+
convertPagination = {
|
|
95
|
+
next_key: result.data.pagination.next_key,
|
|
96
|
+
total: Number.parseInt(result.data.pagination.total)
|
|
97
|
+
};
|
|
98
|
+
return [2 /*return*/, { dataList: result.data.contracts, pagination: convertPagination }];
|
|
95
99
|
}
|
|
96
100
|
});
|
|
97
101
|
});
|