@firmachain/firma-js 0.2.64 → 0.3.0-beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -8
- package/dist/sdk/FirmaAuthzService.js +12 -6
- package/dist/sdk/FirmaBankService.d.ts +4 -4
- package/dist/sdk/FirmaContractService.d.ts +4 -4
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.js +2 -3
- package/dist/sdk/FirmaDistributionService.d.ts +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
- package/dist/sdk/FirmaGovService.d.ts +12 -9
- package/dist/sdk/FirmaGovService.js +162 -97
- package/dist/sdk/FirmaIbcService.d.ts +3 -4
- package/dist/sdk/FirmaIbcService.js +5 -2
- package/dist/sdk/FirmaNftService.d.ts +5 -5
- package/dist/sdk/FirmaStakingService.d.ts +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +5 -5
- package/dist/sdk/FirmaUtil.d.ts +1 -1
- package/dist/sdk/FirmaUtil.js +12 -14
- package/dist/sdk/firmachain/amino/addresses.js +1 -1
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
- package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
- package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
- package/dist/sdk/firmachain/amino/coins.js +26 -5
- package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
- package/dist/sdk/firmachain/amino/encoding.js +21 -3
- package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
- package/dist/sdk/firmachain/amino/signdoc.js +37 -11
- package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
- package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
- package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
- package/dist/sdk/firmachain/common/ITxClient.js +82 -24
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
- package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
- package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
- package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
- package/dist/sdk/firmachain/common/accounts.js +28 -33
- package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
- package/dist/sdk/firmachain/common/aminotypes.js +74 -0
- package/dist/sdk/firmachain/common/events.d.ts +32 -0
- package/dist/sdk/firmachain/common/events.js +18 -0
- package/dist/sdk/firmachain/common/fee.d.ts +26 -0
- package/dist/sdk/firmachain/common/fee.js +83 -0
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +3 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
- package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
- package/dist/sdk/firmachain/common/modules/index.js +101 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
- package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
- package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
- package/dist/sdk/firmachain/common/search.d.ts +10 -0
- package/dist/sdk/firmachain/common/search.js +7 -0
- package/dist/sdk/firmachain/common/signing.d.ts +8 -3
- package/dist/sdk/firmachain/common/signing.js +24 -12
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
- package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
- package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
- package/dist/sdk/firmachain/common/stargateclient.js +351 -35
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +6 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +6 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
- package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
- package/dist/test/00.wallet.test.js +15 -9
- package/dist/test/01.contract_tx.test.js +53 -45
- package/dist/test/02.contract_query.test.js +54 -31
- package/dist/test/03.contract_scenario.test.js +170 -326
- package/dist/test/04.bank_tx.test.js +58 -59
- package/dist/test/05.bank_query.test.js +51 -56
- package/dist/test/06.feegrant_tx.test.js +74 -89
- package/dist/test/07.feegrant_query.test.js +69 -27
- package/dist/test/08.gas_estimate.test.js +351 -379
- package/dist/test/09.ipfs.test.js +3 -3
- package/dist/test/10.nft_tx.test.js +108 -76
- package/dist/test/11.nft_query.test.js +41 -46
- package/dist/test/12.staking_tx.test.js +81 -98
- package/dist/test/13.staking_query.test.js +66 -12
- package/dist/test/14.distribution_tx.test.js +69 -78
- package/dist/test/15.distribution_query.test.js +81 -57
- package/dist/test/16.gov_tx.test.js +149 -78
- package/dist/test/17.gov_query.test.js +48 -9
- package/dist/test/18.util.test.js +6 -1
- package/dist/test/19.chain.test.js +50 -4
- package/dist/test/20.slashing_query.test.js +31 -1
- package/dist/test/21.token_tx.test.js +48 -56
- package/dist/test/22.token_query.test.js +24 -20
- package/dist/test/23.authz_tx.test.js +119 -240
- package/dist/test/24.authz_query.test.js +116 -56
- package/dist/test/25.cosmwasm_tx.test.js +95 -57
- package/dist/test/26.cosmwasm_query.test.js +66 -26
- package/dist/test/27.arbitary_sign.test.js +59 -67
- package/dist/test/28.ibc_tx.test.js +29 -17
- package/dist/test/29.mint_query.test.js +2 -0
- package/dist/test/30.cw20_tx.test.js +161 -226
- package/dist/test/31.cw20_query.test.js +183 -37
- package/dist/test/32.cw721_tx.test.js +147 -149
- package/dist/test/33.cw721_query.test.js +188 -36
- package/dist/test/34.cw_bridge_tx.test.js +266 -155
- package/dist/test/35.cw_bridge_tx_low.test.js +221 -81
- package/dist/test/36.cw_bridge_query.test.js +157 -21
- package/dist/test/37.cw_marketplace_tx.test.js +22 -22
- package/dist/test/38.cw_marketplace_query.test.js +9 -9
- package/dist/test/config_test.d.ts +10 -4
- package/dist/test/config_test.js +18 -9
- package/dist/test/config_test.sample.d.ts +5 -0
- package/dist/test/config_test.sample.js +8 -0
- package/package.json +9 -7
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
|
@@ -35,11 +35,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
49
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
+
};
|
|
38
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
var
|
|
40
|
-
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
53
|
+
var fs_1 = __importDefault(require("fs"));
|
|
41
54
|
var chai_1 = require("chai");
|
|
55
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
42
56
|
var config_test_1 = require("./config_test");
|
|
57
|
+
var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
|
|
58
|
+
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
43
59
|
describe('[35. Bridge tx low Test]', function () {
|
|
44
60
|
var firma;
|
|
45
61
|
var aliceWallet;
|
|
@@ -51,7 +67,7 @@ describe('[35. Bridge tx low Test]', function () {
|
|
|
51
67
|
return __generator(this, function (_a) {
|
|
52
68
|
switch (_a.label) {
|
|
53
69
|
case 0:
|
|
54
|
-
firma = new FirmaSDK_1.FirmaSDK(
|
|
70
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
55
71
|
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
56
72
|
case 1:
|
|
57
73
|
aliceWallet = _a.sent();
|
|
@@ -69,41 +85,192 @@ describe('[35. Bridge tx low Test]', function () {
|
|
|
69
85
|
});
|
|
70
86
|
});
|
|
71
87
|
});
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
88
|
+
var extractValue = function (events, eventType, attrKey) {
|
|
89
|
+
var e_1, _a, e_2, _b;
|
|
90
|
+
try {
|
|
91
|
+
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
92
|
+
var event_1 = events_1_1.value;
|
|
93
|
+
if (event_1.type === eventType) {
|
|
94
|
+
try {
|
|
95
|
+
for (var _c = (e_2 = void 0, __values(event_1.attributes)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
96
|
+
var attr = _d.value;
|
|
97
|
+
if (attr.key === attrKey) {
|
|
98
|
+
return attr.value;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
103
|
+
finally {
|
|
104
|
+
try {
|
|
105
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
106
|
+
}
|
|
107
|
+
finally { if (e_2) throw e_2.error; }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
113
|
+
finally {
|
|
114
|
+
try {
|
|
115
|
+
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
116
|
+
}
|
|
117
|
+
finally { if (e_1) throw e_1.error; }
|
|
118
|
+
}
|
|
119
|
+
return "";
|
|
120
|
+
};
|
|
121
|
+
var cw721ContractAddress = "";
|
|
122
|
+
var bridgeContractAddress = "";
|
|
75
123
|
// low level test
|
|
76
124
|
//----------------------------------------------------------------------
|
|
77
|
-
it
|
|
78
|
-
var
|
|
125
|
+
it('[low] Cw721 contract setup', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
126
|
+
var wasmFile, array, storeGas, storeFee, everyBodyAccessConfig, storeCodeResult, codeId, admin, label, instantiateGas, instantiateFee, noFunds, testData, instantiateResult;
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0:
|
|
130
|
+
wasmFile = fs_1.default.readFileSync("./test/sample/cw721_base.wasm");
|
|
131
|
+
array = new Uint8Array(wasmFile.buffer);
|
|
132
|
+
storeGas = 3000000;
|
|
133
|
+
storeFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
134
|
+
everyBodyAccessConfig = {
|
|
135
|
+
permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
|
|
136
|
+
address: "",
|
|
137
|
+
addresses: []
|
|
138
|
+
};
|
|
139
|
+
return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: storeGas, fee: storeFee })];
|
|
140
|
+
case 1:
|
|
141
|
+
storeCodeResult = _a.sent();
|
|
142
|
+
codeId = extractValue(storeCodeResult.events, "store_code", "code_id");
|
|
143
|
+
chai_1.expect(storeCodeResult.code).to.be.equal(0);
|
|
144
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
145
|
+
case 2:
|
|
146
|
+
admin = _a.sent();
|
|
147
|
+
label = "test1";
|
|
148
|
+
instantiateGas = 3000000;
|
|
149
|
+
instantiateFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
150
|
+
noFunds = [];
|
|
151
|
+
testData = JSON.stringify({
|
|
152
|
+
minter: aliceAddress,
|
|
153
|
+
name: "My Awesome NFT Collection",
|
|
154
|
+
symbol: "MAWESOME"
|
|
155
|
+
});
|
|
156
|
+
return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: instantiateGas, fee: instantiateFee })];
|
|
157
|
+
case 3:
|
|
158
|
+
instantiateResult = _a.sent();
|
|
159
|
+
cw721ContractAddress = extractValue(instantiateResult.events, "instantiate", "_contract_address");
|
|
160
|
+
chai_1.expect(instantiateResult.code).to.be.equal(0);
|
|
161
|
+
return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}); });
|
|
165
|
+
it('[low] Cw bridge contract setup', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
166
|
+
var wasmFile, array, storeCodeGas, storeCodeFee, everyBodyAccessConfig, storeCodeResult, codeId, admin, label, instantiateGas, instantiateFee, noFunds, testData, instantiateResult;
|
|
167
|
+
return __generator(this, function (_a) {
|
|
168
|
+
switch (_a.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
wasmFile = fs_1.default.readFileSync("./test/sample/bridge_contract.wasm");
|
|
171
|
+
array = new Uint8Array(wasmFile.buffer);
|
|
172
|
+
storeCodeGas = 3000000;
|
|
173
|
+
storeCodeFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
174
|
+
everyBodyAccessConfig = {
|
|
175
|
+
permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
|
|
176
|
+
address: "",
|
|
177
|
+
addresses: []
|
|
178
|
+
};
|
|
179
|
+
return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: storeCodeGas, fee: storeCodeFee })];
|
|
180
|
+
case 1:
|
|
181
|
+
storeCodeResult = _a.sent();
|
|
182
|
+
codeId = extractValue(storeCodeResult.events, "store_code", "code_id");
|
|
183
|
+
chai_1.expect(storeCodeResult.code).to.be.equal(0);
|
|
184
|
+
admin = aliceAddress;
|
|
185
|
+
label = "CwBridge";
|
|
186
|
+
instantiateGas = 3000000;
|
|
187
|
+
instantiateFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
188
|
+
noFunds = [];
|
|
189
|
+
testData = JSON.stringify({
|
|
190
|
+
owner: admin,
|
|
191
|
+
cw721_address: cw721ContractAddress
|
|
192
|
+
});
|
|
193
|
+
return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: instantiateGas, fee: instantiateFee })];
|
|
194
|
+
case 2:
|
|
195
|
+
instantiateResult = _a.sent();
|
|
196
|
+
bridgeContractAddress = extractValue(instantiateResult.events, "instantiate", "_contract_address");
|
|
197
|
+
chai_1.expect(instantiateResult.code).to.be.equal(0);
|
|
198
|
+
return [2 /*return*/];
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}); });
|
|
202
|
+
it('[low] Cw721 prepare nfts (mint bulk)', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
203
|
+
var tokenIds, txList, tokenIds_1, tokenIds_1_1, tokenId, txData, e_3_1, gas, fee, txResult;
|
|
204
|
+
var e_3, _a;
|
|
205
|
+
return __generator(this, function (_b) {
|
|
206
|
+
switch (_b.label) {
|
|
207
|
+
case 0:
|
|
208
|
+
tokenIds = ["101", "102", "103", "104", "105", "106", "107", "108", "109", "110"];
|
|
209
|
+
txList = [];
|
|
210
|
+
_b.label = 1;
|
|
211
|
+
case 1:
|
|
212
|
+
_b.trys.push([1, 6, 7, 8]);
|
|
213
|
+
tokenIds_1 = __values(tokenIds), tokenIds_1_1 = tokenIds_1.next();
|
|
214
|
+
_b.label = 2;
|
|
215
|
+
case 2:
|
|
216
|
+
if (!!tokenIds_1_1.done) return [3 /*break*/, 5];
|
|
217
|
+
tokenId = tokenIds_1_1.value;
|
|
218
|
+
return [4 /*yield*/, firma.Cw721.getUnsignedTxMint(aliceWallet, cw721ContractAddress, aliceAddress, tokenId, "https://meta.nft.io/uri/" + tokenId)];
|
|
219
|
+
case 3:
|
|
220
|
+
txData = _b.sent();
|
|
221
|
+
txList.push(txData);
|
|
222
|
+
_b.label = 4;
|
|
223
|
+
case 4:
|
|
224
|
+
tokenIds_1_1 = tokenIds_1.next();
|
|
225
|
+
return [3 /*break*/, 2];
|
|
226
|
+
case 5: return [3 /*break*/, 8];
|
|
227
|
+
case 6:
|
|
228
|
+
e_3_1 = _b.sent();
|
|
229
|
+
e_3 = { error: e_3_1 };
|
|
230
|
+
return [3 /*break*/, 8];
|
|
231
|
+
case 7:
|
|
232
|
+
try {
|
|
233
|
+
if (tokenIds_1_1 && !tokenIds_1_1.done && (_a = tokenIds_1.return)) _a.call(tokenIds_1);
|
|
234
|
+
}
|
|
235
|
+
finally { if (e_3) throw e_3.error; }
|
|
236
|
+
return [7 /*endfinally*/];
|
|
237
|
+
case 8: return [4 /*yield*/, firma.Cw721.getGasEstimationSignAndBroadcast(aliceWallet, txList)];
|
|
238
|
+
case 9:
|
|
239
|
+
gas = _b.sent();
|
|
240
|
+
fee = Math.ceil(gas * 0.1);
|
|
241
|
+
return [4 /*yield*/, firma.Cw721.signAndBroadcast(aliceWallet, txList, { gas: gas, fee: fee })];
|
|
242
|
+
case 10:
|
|
243
|
+
txResult = _b.sent();
|
|
244
|
+
chai_1.expect(txResult.code).to.be.equal(0);
|
|
245
|
+
return [2 /*return*/];
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
}); });
|
|
249
|
+
it('[low] Cw721 send_nft & lock', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
250
|
+
var token_id, msg, gas, fee, result;
|
|
79
251
|
return __generator(this, function (_a) {
|
|
80
252
|
switch (_a.label) {
|
|
81
253
|
case 0:
|
|
82
|
-
token_id = "
|
|
83
|
-
targetContractAddress = bridgeContractAddress;
|
|
254
|
+
token_id = "101";
|
|
84
255
|
msg = firma.CwBridge.getCwBridgeMsgData().getMsgDataLock();
|
|
85
|
-
return [4 /*yield*/, firma.Cw721.getGasEstimationSendNft(aliceWallet, cw721ContractAddress,
|
|
256
|
+
return [4 /*yield*/, firma.Cw721.getGasEstimationSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id, msg)];
|
|
86
257
|
case 1:
|
|
87
258
|
gas = _a.sent();
|
|
88
259
|
fee = Math.ceil(gas * 0.1);
|
|
89
|
-
return [4 /*yield*/, firma.Cw721.sendNft(aliceWallet, cw721ContractAddress,
|
|
260
|
+
return [4 /*yield*/, firma.Cw721.sendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id, msg, { gas: gas, fee: fee })];
|
|
90
261
|
case 2:
|
|
91
262
|
result = _a.sent();
|
|
92
263
|
chai_1.expect(result.code).to.be.equal(0);
|
|
93
|
-
return [4 /*yield*/, firma.Cw721.getNftData(cw721ContractAddress, token_id)];
|
|
94
|
-
case 3:
|
|
95
|
-
data = _a.sent();
|
|
96
|
-
console.log(data);
|
|
97
264
|
return [2 /*return*/];
|
|
98
265
|
}
|
|
99
266
|
});
|
|
100
267
|
}); });
|
|
101
|
-
it
|
|
102
|
-
var token_id, noFunds, msgData, gas, fee, result
|
|
268
|
+
it('[low] cw bridge unlock', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
269
|
+
var token_id, noFunds, msgData, gas, fee, result;
|
|
103
270
|
return __generator(this, function (_a) {
|
|
104
271
|
switch (_a.label) {
|
|
105
272
|
case 0:
|
|
106
|
-
token_id = "
|
|
273
|
+
token_id = "101";
|
|
107
274
|
noFunds = [];
|
|
108
275
|
msgData = JSON.stringify({
|
|
109
276
|
"unlock": {
|
|
@@ -118,61 +285,46 @@ describe('[35. Bridge tx low Test]', function () {
|
|
|
118
285
|
case 2:
|
|
119
286
|
result = _a.sent();
|
|
120
287
|
chai_1.expect(result.code).to.be.equal(0);
|
|
121
|
-
return [4 /*yield*/, firma.Cw721.getNftData(cw721ContractAddress, token_id)];
|
|
122
|
-
case 3:
|
|
123
|
-
data = _a.sent();
|
|
124
|
-
console.log(data);
|
|
125
288
|
return [2 /*return*/];
|
|
126
289
|
}
|
|
127
290
|
});
|
|
128
291
|
}); });
|
|
129
|
-
it
|
|
130
|
-
var
|
|
292
|
+
it('[low] Cw721 send_nft & deposit', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
293
|
+
var tokenId, msg, authUsers, gas, fee, result;
|
|
131
294
|
return __generator(this, function (_a) {
|
|
132
295
|
switch (_a.label) {
|
|
133
296
|
case 0:
|
|
134
|
-
|
|
135
|
-
new_token_id = "6";
|
|
136
|
-
new_token_uri = "https://meta.nft.io/uri/" + new_token_id;
|
|
137
|
-
return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, cw721ContractAddress, owner, new_token_id, new_token_uri)];
|
|
138
|
-
case 1:
|
|
139
|
-
gas = _a.sent();
|
|
140
|
-
fee = Math.ceil(gas * 0.1);
|
|
141
|
-
return [4 /*yield*/, firma.Cw721.mint(aliceWallet, cw721ContractAddress, owner, new_token_id, new_token_uri, { gas: gas, fee: fee })];
|
|
142
|
-
case 2:
|
|
143
|
-
result = _a.sent();
|
|
144
|
-
chai_1.expect(result.code).to.be.equal(0);
|
|
145
|
-
return [4 /*yield*/, firma.Cw721.getNftData(cw721ContractAddress, new_token_id)];
|
|
146
|
-
case 3:
|
|
147
|
-
data1 = _a.sent();
|
|
148
|
-
console.log(data1);
|
|
149
|
-
targetContractAddress = bridgeContractAddress;
|
|
297
|
+
tokenId = "102";
|
|
150
298
|
msg = {
|
|
151
299
|
action: "deposit",
|
|
152
300
|
target_addr: bobAddress
|
|
153
301
|
};
|
|
154
|
-
return [4 /*yield*/, firma.
|
|
302
|
+
return [4 /*yield*/, firma.CwBridge.getAuthorizedUsers(bridgeContractAddress)];
|
|
303
|
+
case 1:
|
|
304
|
+
authUsers = _a.sent();
|
|
305
|
+
if (!!authUsers.includes(aliceAddress)) return [3 /*break*/, 3];
|
|
306
|
+
return [4 /*yield*/, firma.CwBridge.addAuthorizedUser(aliceWallet, bridgeContractAddress, aliceAddress)];
|
|
307
|
+
case 2:
|
|
308
|
+
_a.sent();
|
|
309
|
+
_a.label = 3;
|
|
310
|
+
case 3: return [4 /*yield*/, firma.Cw721.getGasEstimationSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, tokenId, msg)];
|
|
155
311
|
case 4:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return [4 /*yield*/, firma.Cw721.sendNft(aliceWallet, cw721ContractAddress,
|
|
312
|
+
gas = _a.sent();
|
|
313
|
+
fee = Math.ceil(gas * 0.1);
|
|
314
|
+
return [4 /*yield*/, firma.Cw721.sendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, tokenId, msg, { gas: gas, fee: fee })];
|
|
159
315
|
case 5:
|
|
160
316
|
result = _a.sent();
|
|
161
317
|
chai_1.expect(result.code).to.be.equal(0);
|
|
162
|
-
return [4 /*yield*/, firma.Cw721.getNftData(cw721ContractAddress, new_token_id)];
|
|
163
|
-
case 6:
|
|
164
|
-
data = _a.sent();
|
|
165
|
-
console.log(data);
|
|
166
318
|
return [2 /*return*/];
|
|
167
319
|
}
|
|
168
320
|
});
|
|
169
321
|
}); });
|
|
170
|
-
it
|
|
171
|
-
var token_id, noFunds, msgData, gas, fee, result
|
|
322
|
+
it('[low] cw bridge withdraw', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
323
|
+
var token_id, noFunds, msgData, gas, fee, result;
|
|
172
324
|
return __generator(this, function (_a) {
|
|
173
325
|
switch (_a.label) {
|
|
174
326
|
case 0:
|
|
175
|
-
token_id = "
|
|
327
|
+
token_id = "102";
|
|
176
328
|
noFunds = [];
|
|
177
329
|
msgData = JSON.stringify({
|
|
178
330
|
"withdraw": {
|
|
@@ -187,70 +339,58 @@ describe('[35. Bridge tx low Test]', function () {
|
|
|
187
339
|
case 2:
|
|
188
340
|
result = _a.sent();
|
|
189
341
|
chai_1.expect(result.code).to.be.equal(0);
|
|
190
|
-
return [4 /*yield*/, firma.Cw721.getNftData(cw721ContractAddress, token_id)];
|
|
191
|
-
case 3:
|
|
192
|
-
data = _a.sent();
|
|
193
|
-
console.log(data);
|
|
194
342
|
return [2 /*return*/];
|
|
195
343
|
}
|
|
196
344
|
});
|
|
197
345
|
}); });
|
|
198
|
-
it
|
|
199
|
-
var token_id1, token_id2, contractMsg, tx1, tx2, gas, fee, result
|
|
346
|
+
it('[low] cw721 send_nft & bridge lock bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
347
|
+
var token_id1, token_id2, contractMsg, tx1, tx2, gas, fee, result;
|
|
200
348
|
return __generator(this, function (_a) {
|
|
201
349
|
switch (_a.label) {
|
|
202
350
|
case 0:
|
|
203
|
-
token_id1 = "
|
|
204
|
-
token_id2 = "
|
|
351
|
+
token_id1 = "103";
|
|
352
|
+
token_id2 = "104";
|
|
205
353
|
contractMsg = firma.CwBridge.getCwBridgeMsgData().getMsgDataLock();
|
|
206
|
-
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(
|
|
354
|
+
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id1, contractMsg)];
|
|
207
355
|
case 1:
|
|
208
356
|
tx1 = _a.sent();
|
|
209
|
-
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(
|
|
357
|
+
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id2, contractMsg)];
|
|
210
358
|
case 2:
|
|
211
359
|
tx2 = _a.sent();
|
|
212
|
-
return [4 /*yield*/, firma.Cw721.getGasEstimationSignAndBroadcast(
|
|
360
|
+
return [4 /*yield*/, firma.Cw721.getGasEstimationSignAndBroadcast(aliceWallet, [tx1, tx2])];
|
|
213
361
|
case 3:
|
|
214
362
|
gas = _a.sent();
|
|
215
363
|
fee = Math.ceil(gas * 0.1);
|
|
216
|
-
return [4 /*yield*/, firma.Cw721.signAndBroadcast(
|
|
364
|
+
return [4 /*yield*/, firma.Cw721.signAndBroadcast(aliceWallet, [tx1, tx2], { gas: gas, fee: fee })];
|
|
217
365
|
case 4:
|
|
218
366
|
result = _a.sent();
|
|
219
367
|
chai_1.expect(result.code).to.be.equal(0);
|
|
220
|
-
return [4 /*yield*/, firma.Cw721.getNFTIdListOfOwner(cw721ContractAddress, bobAddress)];
|
|
221
|
-
case 5:
|
|
222
|
-
data = _a.sent();
|
|
223
|
-
console.log(data);
|
|
224
368
|
return [2 /*return*/];
|
|
225
369
|
}
|
|
226
370
|
});
|
|
227
371
|
}); });
|
|
228
|
-
it
|
|
229
|
-
var token_id1, token_id2, contractMsg, tx1, tx2, gas, fee, result
|
|
372
|
+
it('[low] cw721 send_nft & bridge deposit bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
373
|
+
var token_id1, token_id2, contractMsg, tx1, tx2, gas, fee, result;
|
|
230
374
|
return __generator(this, function (_a) {
|
|
231
375
|
switch (_a.label) {
|
|
232
376
|
case 0:
|
|
233
|
-
token_id1 = "
|
|
234
|
-
token_id2 = "
|
|
235
|
-
contractMsg = firma.CwBridge.getCwBridgeMsgData().getMsgDataDeposit(
|
|
236
|
-
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(
|
|
377
|
+
token_id1 = "105";
|
|
378
|
+
token_id2 = "106";
|
|
379
|
+
contractMsg = firma.CwBridge.getCwBridgeMsgData().getMsgDataDeposit(aliceAddress);
|
|
380
|
+
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id1, contractMsg)];
|
|
237
381
|
case 1:
|
|
238
382
|
tx1 = _a.sent();
|
|
239
|
-
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(
|
|
383
|
+
return [4 /*yield*/, firma.Cw721.getUnsignedTxSendNft(aliceWallet, cw721ContractAddress, bridgeContractAddress, token_id2, contractMsg)];
|
|
240
384
|
case 2:
|
|
241
385
|
tx2 = _a.sent();
|
|
242
|
-
return [4 /*yield*/, firma.Cw721.getGasEstimationSignAndBroadcast(
|
|
386
|
+
return [4 /*yield*/, firma.Cw721.getGasEstimationSignAndBroadcast(aliceWallet, [tx1, tx2])];
|
|
243
387
|
case 3:
|
|
244
388
|
gas = _a.sent();
|
|
245
389
|
fee = Math.ceil(gas * 0.1);
|
|
246
|
-
return [4 /*yield*/, firma.Cw721.signAndBroadcast(
|
|
390
|
+
return [4 /*yield*/, firma.Cw721.signAndBroadcast(aliceWallet, [tx1, tx2], { gas: gas, fee: fee })];
|
|
247
391
|
case 4:
|
|
248
392
|
result = _a.sent();
|
|
249
393
|
chai_1.expect(result.code).to.be.equal(0);
|
|
250
|
-
return [4 /*yield*/, firma.Cw721.getNFTIdListOfOwner(cw721ContractAddress, bobAddress)];
|
|
251
|
-
case 5:
|
|
252
|
-
data = _a.sent();
|
|
253
|
-
console.log(data);
|
|
254
394
|
return [2 /*return*/];
|
|
255
395
|
}
|
|
256
396
|
});
|