@firmachain/firma-js 0.2.62 → 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 +31 -13
- package/dist/sdk/FirmaCosmWasmCw721.js +25 -0
- 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.d.ts +1 -0
- package/dist/test/00.wallet.test.js +96 -0
- package/dist/test/01.contract_tx.test.d.ts +1 -0
- package/dist/test/01.contract_tx.test.js +157 -0
- package/dist/test/02.contract_query.test.d.ts +1 -0
- package/dist/test/02.contract_query.test.js +245 -0
- package/dist/test/03.contract_scenario.test.d.ts +1 -0
- package/dist/test/03.contract_scenario.test.js +406 -0
- package/dist/test/04.bank_tx.test.d.ts +1 -0
- package/dist/test/04.bank_tx.test.js +126 -0
- package/dist/test/05.bank_query.test.d.ts +1 -0
- package/dist/test/05.bank_query.test.js +162 -0
- package/dist/test/06.feegrant_tx.test.d.ts +1 -0
- package/dist/test/06.feegrant_tx.test.js +161 -0
- package/dist/test/07.feegrant_query.test.d.ts +1 -0
- package/dist/test/07.feegrant_query.test.js +126 -0
- package/dist/test/08.gas_estimate.test.d.ts +1 -0
- package/dist/test/08.gas_estimate.test.js +675 -0
- package/dist/test/09.ipfs.test.d.ts +1 -0
- package/dist/test/09.ipfs.test.js +72 -0
- package/dist/test/10.nft_tx.test.d.ts +1 -0
- package/dist/test/10.nft_tx.test.js +209 -0
- package/dist/test/11.nft_query.test.d.ts +1 -0
- package/dist/test/11.nft_query.test.js +165 -0
- package/dist/test/12.staking_tx.test.d.ts +1 -0
- package/dist/test/12.staking_tx.test.js +199 -0
- package/dist/test/13.staking_query.test.d.ts +1 -0
- package/dist/test/13.staking_query.test.js +263 -0
- package/dist/test/14.distribution_tx.test.d.ts +1 -0
- package/dist/test/14.distribution_tx.test.js +170 -0
- package/dist/test/15.distribution_query.test.d.ts +1 -0
- package/dist/test/15.distribution_query.test.js +243 -0
- package/dist/test/16.gov_tx.test.d.ts +1 -0
- package/dist/test/16.gov_tx.test.js +311 -0
- package/dist/test/17.gov_query.test.d.ts +1 -0
- package/dist/test/17.gov_query.test.js +157 -0
- package/dist/test/18.util.test.d.ts +1 -0
- package/dist/test/18.util.test.js +251 -0
- package/dist/test/19.chain.test.d.ts +1 -0
- package/dist/test/19.chain.test.js +127 -0
- package/dist/test/20.slashing_query.test.d.ts +1 -0
- package/dist/test/20.slashing_query.test.js +112 -0
- package/dist/test/21.token_tx.test.d.ts +1 -0
- package/dist/test/21.token_tx.test.js +149 -0
- package/dist/test/22.token_query.test.d.ts +1 -0
- package/dist/test/22.token_query.test.js +103 -0
- package/dist/test/23.authz_tx.test.d.ts +1 -0
- package/dist/test/23.authz_tx.test.js +350 -0
- package/dist/test/24.authz_query.test.d.ts +1 -0
- package/dist/test/24.authz_query.test.js +203 -0
- package/dist/test/25.cosmwasm_tx.test.d.ts +1 -0
- package/dist/test/25.cosmwasm_tx.test.js +229 -0
- package/dist/test/26.cosmwasm_query.test.d.ts +1 -0
- package/dist/test/26.cosmwasm_query.test.js +209 -0
- package/dist/test/27.arbitary_sign.test.d.ts +1 -0
- package/dist/test/27.arbitary_sign.test.js +159 -0
- package/dist/test/28.ibc_tx.test.d.ts +1 -0
- package/dist/test/28.ibc_tx.test.js +98 -0
- package/dist/test/29.mint_query.test.d.ts +1 -0
- package/dist/test/29.mint_query.test.js +59 -0
- package/dist/test/30.cw20_tx.test.d.ts +1 -0
- package/dist/test/30.cw20_tx.test.js +450 -0
- package/dist/test/31.cw20_query.test.d.ts +1 -0
- package/dist/test/31.cw20_query.test.js +333 -0
- package/dist/test/32.cw721_tx.test.d.ts +1 -0
- package/dist/test/32.cw721_tx.test.js +431 -0
- package/dist/test/33.cw721_query.test.d.ts +1 -0
- package/dist/test/33.cw721_query.test.js +371 -0
- package/dist/test/34.cw_bridge_tx.test.d.ts +1 -0
- package/dist/test/34.cw_bridge_tx.test.js +476 -0
- package/dist/test/35.cw_bridge_tx_low.test.d.ts +1 -0
- package/dist/test/35.cw_bridge_tx_low.test.js +398 -0
- package/dist/test/36.cw_bridge_query.test.d.ts +1 -0
- package/dist/test/36.cw_bridge_query.test.js +318 -0
- package/dist/test/37.cw_marketplace_tx.test.d.ts +1 -0
- package/dist/test/37.cw_marketplace_tx.test.js +794 -0
- package/dist/test/38.cw_marketplace_query.test.d.ts +1 -0
- package/dist/test/38.cw_marketplace_query.test.js +128 -0
- package/dist/test/config_test.d.ts +11 -0
- package/dist/test/config_test.js +29 -0
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Reader } from "protobufjs/minimal";
|
|
2
|
+
import { BinaryWriter } from "cosmjs-types/binary";
|
|
2
3
|
export declare const protobufPackage = "google.protobuf";
|
|
3
4
|
/**
|
|
4
5
|
* `Any` contains an arbitrary serialized protocol buffer message along with a
|
|
@@ -116,7 +117,7 @@ export interface Any {
|
|
|
116
117
|
value: Uint8Array;
|
|
117
118
|
}
|
|
118
119
|
export declare const Any: {
|
|
119
|
-
encode(message: Any, writer?:
|
|
120
|
+
encode(message: Any, writer?: BinaryWriter): BinaryWriter;
|
|
120
121
|
decode(input: Reader | Uint8Array, length?: number | undefined): Any;
|
|
121
122
|
fromJSON(object: any): Any;
|
|
122
123
|
fromPartial(object: DeepPartial<Any>): Any;
|
|
@@ -14,11 +14,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.Any = exports.protobufPackage = void 0;
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
var minimal_1 = require("protobufjs/minimal");
|
|
17
|
+
var binary_1 = require("cosmjs-types/binary");
|
|
17
18
|
exports.protobufPackage = "google.protobuf";
|
|
18
19
|
var baseAny = { typeUrl: "" };
|
|
19
20
|
exports.Any = {
|
|
20
21
|
encode: function (message, writer) {
|
|
21
|
-
if (writer === void 0) { writer =
|
|
22
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
22
23
|
if (message.typeUrl !== "") {
|
|
23
24
|
writer.uint32(10).string(message.typeUrl);
|
|
24
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Reader } from "protobufjs/minimal";
|
|
2
|
+
import { BinaryWriter } from "cosmjs-types/binary";
|
|
2
3
|
export declare const protobufPackage = "google.protobuf";
|
|
3
4
|
/**
|
|
4
5
|
* A Duration represents a signed, fixed-length span of time represented
|
|
@@ -78,7 +79,7 @@ export interface Duration {
|
|
|
78
79
|
nanos: number;
|
|
79
80
|
}
|
|
80
81
|
export declare const Duration: {
|
|
81
|
-
encode(message: Duration, writer?:
|
|
82
|
+
encode(message: Duration, writer?: BinaryWriter): BinaryWriter;
|
|
82
83
|
decode(input: Reader | Uint8Array, length?: number | undefined): Duration;
|
|
83
84
|
fromJSON(object: any): Duration;
|
|
84
85
|
toJSON(message: Duration): unknown;
|
|
@@ -14,11 +14,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.Duration = exports.protobufPackage = void 0;
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
var minimal_1 = require("protobufjs/minimal");
|
|
17
|
+
var binary_1 = require("cosmjs-types/binary");
|
|
17
18
|
exports.protobufPackage = "google.protobuf";
|
|
18
19
|
var baseDuration = { seconds: 0, nanos: 0 };
|
|
19
20
|
exports.Duration = {
|
|
20
21
|
encode: function (message, writer) {
|
|
21
|
-
if (writer === void 0) { writer =
|
|
22
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
22
23
|
if (message.seconds !== 0) {
|
|
23
24
|
writer.uint32(8).int64(message.seconds);
|
|
24
25
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Reader } from "protobufjs/minimal";
|
|
2
|
+
import { BinaryWriter } from "cosmjs-types/binary";
|
|
2
3
|
export declare const protobufPackage = "google.protobuf";
|
|
3
4
|
/**
|
|
4
5
|
* A Timestamp represents a point in time independent of any time zone
|
|
@@ -96,7 +97,7 @@ export interface Timestamp {
|
|
|
96
97
|
nanos: number;
|
|
97
98
|
}
|
|
98
99
|
export declare const Timestamp: {
|
|
99
|
-
encode(message: Timestamp, writer?:
|
|
100
|
+
encode(message: Timestamp, writer?: BinaryWriter): BinaryWriter;
|
|
100
101
|
decode(input: Reader | Uint8Array, length?: number | undefined): Timestamp;
|
|
101
102
|
fromJSON(object: any): Timestamp;
|
|
102
103
|
toJSON(message: Timestamp): unknown;
|
|
@@ -14,11 +14,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.Timestamp = exports.protobufPackage = void 0;
|
|
15
15
|
/* eslint-disable */
|
|
16
16
|
var minimal_1 = require("protobufjs/minimal");
|
|
17
|
+
var binary_1 = require("cosmjs-types/binary");
|
|
17
18
|
exports.protobufPackage = "google.protobuf";
|
|
18
19
|
var baseTimestamp = { seconds: 0, nanos: 0 };
|
|
19
20
|
exports.Timestamp = {
|
|
20
21
|
encode: function (message, writer) {
|
|
21
|
-
if (writer === void 0) { writer =
|
|
22
|
+
if (writer === void 0) { writer = binary_1.BinaryWriter.create(); }
|
|
22
23
|
if (message.seconds !== 0) {
|
|
23
24
|
writer.uint32(8).int64(message.seconds);
|
|
24
25
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Registry, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
2
|
import { MsgDeposit, MsgSubmitProposal, MsgVote } from "cosmjs-types/cosmos/gov/v1beta1/tx";
|
|
3
|
+
import { MsgCancelProposal } from "@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx";
|
|
3
4
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
4
5
|
import { ITxClient } from "../common/ITxClient";
|
|
5
6
|
export interface MsgDepositEncodeObject extends EncodeObject {
|
|
@@ -14,10 +15,15 @@ export interface MsgVoteEncodeObject extends EncodeObject {
|
|
|
14
15
|
readonly typeUrl: "/cosmos.gov.v1beta1.MsgVote";
|
|
15
16
|
readonly value: Partial<MsgVote>;
|
|
16
17
|
}
|
|
18
|
+
export interface MsgCancelProposalEncodeObject extends EncodeObject {
|
|
19
|
+
readonly typeUrl: "/cosmos.gov.v1.MsgCancelProposal";
|
|
20
|
+
readonly value: Partial<MsgCancelProposal>;
|
|
21
|
+
}
|
|
17
22
|
export declare class GovTxClient extends ITxClient {
|
|
18
23
|
constructor(wallet: FirmaWalletService, serverUrl: string);
|
|
19
24
|
static getRegistry(): Registry;
|
|
20
25
|
static msgDeposit(data: MsgDeposit): MsgDepositEncodeObject;
|
|
21
26
|
static msgSubmitProposal(data: MsgSubmitProposal): MsgSubmitProposalEncodeObject;
|
|
22
27
|
static msgVote(data: MsgVote): MsgVoteEncodeObject;
|
|
28
|
+
static msgCancelProposal(data: MsgCancelProposal): MsgCancelProposalEncodeObject;
|
|
23
29
|
}
|
|
@@ -18,11 +18,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.GovTxClient = void 0;
|
|
19
19
|
var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
20
20
|
var tx_1 = require("cosmjs-types/cosmos/gov/v1beta1/tx");
|
|
21
|
+
var tx_2 = require("@kintsugi-tech/cosmjs-types/cosmos/gov/v1/tx");
|
|
21
22
|
var ITxClient_1 = require("../common/ITxClient");
|
|
22
23
|
var types = [
|
|
23
24
|
["/cosmos.gov.v1beta1.MsgDeposit", tx_1.MsgDeposit],
|
|
24
25
|
["/cosmos.gov.v1beta1.MsgSubmitProposal", tx_1.MsgSubmitProposal],
|
|
25
|
-
["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote]
|
|
26
|
+
["/cosmos.gov.v1beta1.MsgVote", tx_1.MsgVote],
|
|
27
|
+
["/cosmos.gov.v1.MsgCancelProposal", tx_2.MsgCancelProposal],
|
|
26
28
|
];
|
|
27
29
|
var registry = new proto_signing_1.Registry(types);
|
|
28
30
|
var GovTxClient = /** @class */ (function (_super) {
|
|
@@ -42,6 +44,9 @@ var GovTxClient = /** @class */ (function (_super) {
|
|
|
42
44
|
GovTxClient.msgVote = function (data) {
|
|
43
45
|
return { typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: data };
|
|
44
46
|
};
|
|
47
|
+
GovTxClient.msgCancelProposal = function (data) {
|
|
48
|
+
return { typeUrl: "/cosmos.gov.v1.MsgCancelProposal", value: data };
|
|
49
|
+
};
|
|
45
50
|
return GovTxClient;
|
|
46
51
|
}(ITxClient_1.ITxClient));
|
|
47
52
|
exports.GovTxClient = GovTxClient;
|
|
@@ -3,15 +3,15 @@ import { MsgTransfer, MsgMint, MsgBurn } from "./NftTxTypes";
|
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
4
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
5
5
|
export interface MsgNftTransferEncodeObject extends EncodeObject {
|
|
6
|
-
readonly typeUrl: "/firmachain.
|
|
6
|
+
readonly typeUrl: "/firmachain.nft.MsgTransfer";
|
|
7
7
|
readonly value: Partial<MsgTransfer>;
|
|
8
8
|
}
|
|
9
9
|
export interface MsgNftMintEncodeObject extends EncodeObject {
|
|
10
|
-
readonly typeUrl: "/firmachain.
|
|
10
|
+
readonly typeUrl: "/firmachain.nft.MsgMint";
|
|
11
11
|
readonly value: Partial<MsgMint>;
|
|
12
12
|
}
|
|
13
13
|
export interface MsgNftBurnEncodeObject extends EncodeObject {
|
|
14
|
-
readonly typeUrl: "/firmachain.
|
|
14
|
+
readonly typeUrl: "/firmachain.nft.MsgBurn";
|
|
15
15
|
readonly value: Partial<MsgBurn>;
|
|
16
16
|
}
|
|
17
17
|
export declare class NftTxClient extends ITxClient {
|
|
@@ -20,9 +20,9 @@ var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
|
20
20
|
var NftTxTypes_1 = require("./NftTxTypes");
|
|
21
21
|
var ITxClient_1 = require("../common/ITxClient");
|
|
22
22
|
var types = [
|
|
23
|
-
["/firmachain.
|
|
24
|
-
["/firmachain.
|
|
25
|
-
["/firmachain.
|
|
23
|
+
["/firmachain.nft.MsgTransfer", NftTxTypes_1.MsgTransfer],
|
|
24
|
+
["/firmachain.nft.MsgMint", NftTxTypes_1.MsgMint],
|
|
25
|
+
["/firmachain.nft.MsgBurn", NftTxTypes_1.MsgBurn]
|
|
26
26
|
];
|
|
27
27
|
var registry = new proto_signing_1.Registry(types);
|
|
28
28
|
var NftTxClient = /** @class */ (function (_super) {
|
|
@@ -34,13 +34,13 @@ var NftTxClient = /** @class */ (function (_super) {
|
|
|
34
34
|
return registry;
|
|
35
35
|
};
|
|
36
36
|
NftTxClient.msgTransfer = function (data) {
|
|
37
|
-
return { typeUrl: "/firmachain.
|
|
37
|
+
return { typeUrl: "/firmachain.nft.MsgTransfer", value: data };
|
|
38
38
|
};
|
|
39
39
|
NftTxClient.msgMint = function (data) {
|
|
40
|
-
return { typeUrl: "/firmachain.
|
|
40
|
+
return { typeUrl: "/firmachain.nft.MsgMint", value: data };
|
|
41
41
|
};
|
|
42
42
|
NftTxClient.msgBurn = function (data) {
|
|
43
|
-
return { typeUrl: "/firmachain.
|
|
43
|
+
return { typeUrl: "/firmachain.nft.MsgBurn", value: data };
|
|
44
44
|
};
|
|
45
45
|
return NftTxClient;
|
|
46
46
|
}(ITxClient_1.ITxClient));
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.MsgClientImpl = exports.MsgMintResponse = exports.MsgMint = exports.MsgBurnResponse = exports.MsgBurn = exports.MsgTransferResponse = exports.MsgTransfer = exports.protobufPackage = void 0;
|
|
15
15
|
var minimal_1 = require("protobufjs/minimal");
|
|
16
|
-
exports.protobufPackage = "firmachain.
|
|
16
|
+
exports.protobufPackage = "firmachain.nft";
|
|
17
17
|
var baseMsgTransfer = { owner: "", nftId: 0, toAddress: "" };
|
|
18
18
|
exports.MsgTransfer = {
|
|
19
19
|
encode: function (message, writer) {
|
|
@@ -389,17 +389,17 @@ var MsgClientImpl = /** @class */ (function () {
|
|
|
389
389
|
}
|
|
390
390
|
MsgClientImpl.prototype.Transfer = function (request) {
|
|
391
391
|
var data = exports.MsgTransfer.encode(request).finish();
|
|
392
|
-
var promise = this.rpc.request("firmachain.
|
|
392
|
+
var promise = this.rpc.request("firmachain.nft.Msg", "Transfer", data);
|
|
393
393
|
return promise.then(function (data) { return exports.MsgTransferResponse.decode(new minimal_1.Reader(data)); });
|
|
394
394
|
};
|
|
395
395
|
MsgClientImpl.prototype.Burn = function (request) {
|
|
396
396
|
var data = exports.MsgBurn.encode(request).finish();
|
|
397
|
-
var promise = this.rpc.request("firmachain.
|
|
397
|
+
var promise = this.rpc.request("firmachain.nft.Msg", "Burn", data);
|
|
398
398
|
return promise.then(function (data) { return exports.MsgBurnResponse.decode(new minimal_1.Reader(data)); });
|
|
399
399
|
};
|
|
400
400
|
MsgClientImpl.prototype.Mint = function (request) {
|
|
401
401
|
var data = exports.MsgMint.encode(request).finish();
|
|
402
|
-
var promise = this.rpc.request("firmachain.
|
|
402
|
+
var promise = this.rpc.request("firmachain.nft.Msg", "Mint", data);
|
|
403
403
|
return promise.then(function (data) { return exports.MsgMintResponse.decode(new minimal_1.Reader(data)); });
|
|
404
404
|
};
|
|
405
405
|
return MsgClientImpl;
|
|
@@ -3,19 +3,19 @@ import { MsgUpdateTokenURI, MsgMint, MsgBurn, MsgCreateToken } from "./TokenTxTy
|
|
|
3
3
|
import { ITxClient } from "../common/ITxClient";
|
|
4
4
|
import { FirmaWalletService } from "../../FirmaWalletService";
|
|
5
5
|
export interface MsgCreateTokenEncodeObject extends EncodeObject {
|
|
6
|
-
readonly typeUrl: "/firmachain.
|
|
6
|
+
readonly typeUrl: "/firmachain.token.MsgCreateToken";
|
|
7
7
|
readonly value: Partial<MsgCreateToken>;
|
|
8
8
|
}
|
|
9
9
|
export interface MsgUpdateTokenURIEncodeObject extends EncodeObject {
|
|
10
|
-
readonly typeUrl: "/firmachain.
|
|
10
|
+
readonly typeUrl: "/firmachain.token.MsgUpdateTokenURI";
|
|
11
11
|
readonly value: Partial<MsgUpdateTokenURI>;
|
|
12
12
|
}
|
|
13
13
|
export interface MsgMintEncodeObject extends EncodeObject {
|
|
14
|
-
readonly typeUrl: "/firmachain.
|
|
14
|
+
readonly typeUrl: "/firmachain.token.MsgMint";
|
|
15
15
|
readonly value: Partial<MsgMint>;
|
|
16
16
|
}
|
|
17
17
|
export interface MsgBurnEncodeObject extends EncodeObject {
|
|
18
|
-
readonly typeUrl: "/firmachain.
|
|
18
|
+
readonly typeUrl: "/firmachain.token.MsgBurn";
|
|
19
19
|
readonly value: Partial<MsgBurn>;
|
|
20
20
|
}
|
|
21
21
|
export declare class TokenTxClient extends ITxClient {
|
|
@@ -20,10 +20,10 @@ var proto_signing_1 = require("@cosmjs/proto-signing");
|
|
|
20
20
|
var TokenTxTypes_1 = require("./TokenTxTypes");
|
|
21
21
|
var ITxClient_1 = require("../common/ITxClient");
|
|
22
22
|
var types = [
|
|
23
|
-
["/firmachain.
|
|
24
|
-
["/firmachain.
|
|
25
|
-
["/firmachain.
|
|
26
|
-
["/firmachain.
|
|
23
|
+
["/firmachain.token.MsgCreateToken", TokenTxTypes_1.MsgCreateToken],
|
|
24
|
+
["/firmachain.token.MsgUpdateTokenURI", TokenTxTypes_1.MsgUpdateTokenURI],
|
|
25
|
+
["/firmachain.token.MsgMint", TokenTxTypes_1.MsgMint],
|
|
26
|
+
["/firmachain.token.MsgBurn", TokenTxTypes_1.MsgBurn]
|
|
27
27
|
];
|
|
28
28
|
var registry = new proto_signing_1.Registry(types);
|
|
29
29
|
var TokenTxClient = /** @class */ (function (_super) {
|
|
@@ -35,16 +35,16 @@ var TokenTxClient = /** @class */ (function (_super) {
|
|
|
35
35
|
return registry;
|
|
36
36
|
};
|
|
37
37
|
TokenTxClient.msgCreateToken = function (data) {
|
|
38
|
-
return { typeUrl: "/firmachain.
|
|
38
|
+
return { typeUrl: "/firmachain.token.MsgCreateToken", value: data };
|
|
39
39
|
};
|
|
40
40
|
TokenTxClient.msgUpdateTokenURI = function (data) {
|
|
41
|
-
return { typeUrl: "/firmachain.
|
|
41
|
+
return { typeUrl: "/firmachain.token.MsgUpdateTokenURI", value: data };
|
|
42
42
|
};
|
|
43
43
|
TokenTxClient.msgMint = function (data) {
|
|
44
|
-
return { typeUrl: "/firmachain.
|
|
44
|
+
return { typeUrl: "/firmachain.token.MsgMint", value: data };
|
|
45
45
|
};
|
|
46
46
|
TokenTxClient.msgBurn = function (data) {
|
|
47
|
-
return { typeUrl: "/firmachain.
|
|
47
|
+
return { typeUrl: "/firmachain.token.MsgBurn", value: data };
|
|
48
48
|
};
|
|
49
49
|
return TokenTxClient;
|
|
50
50
|
}(ITxClient_1.ITxClient));
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.MsgClientImpl = exports.MsgUpdateTokenURIResponse = exports.MsgUpdateTokenURI = exports.MsgBurnResponse = exports.MsgBurn = exports.MsgMintResponse = exports.MsgMint = exports.MsgCreateTokenResponse = exports.MsgCreateToken = exports.protobufPackage = void 0;
|
|
15
15
|
var minimal_1 = require("protobufjs/minimal");
|
|
16
|
-
exports.protobufPackage = "firmachain.
|
|
16
|
+
exports.protobufPackage = "firmachain.token";
|
|
17
17
|
var baseMsgCreateToken = {
|
|
18
18
|
owner: "",
|
|
19
19
|
name: "",
|
|
@@ -641,24 +641,24 @@ var MsgClientImpl = /** @class */ (function () {
|
|
|
641
641
|
}
|
|
642
642
|
MsgClientImpl.prototype.CreateToken = function (request) {
|
|
643
643
|
var data = exports.MsgCreateToken.encode(request).finish();
|
|
644
|
-
var promise = this.rpc.request("firmachain.
|
|
644
|
+
var promise = this.rpc.request("firmachain.token.Msg", "CreateToken", data);
|
|
645
645
|
return promise.then(function (data) {
|
|
646
646
|
return exports.MsgCreateTokenResponse.decode(new minimal_1.Reader(data));
|
|
647
647
|
});
|
|
648
648
|
};
|
|
649
649
|
MsgClientImpl.prototype.Mint = function (request) {
|
|
650
650
|
var data = exports.MsgMint.encode(request).finish();
|
|
651
|
-
var promise = this.rpc.request("firmachain.
|
|
651
|
+
var promise = this.rpc.request("firmachain.token.Msg", "Mint", data);
|
|
652
652
|
return promise.then(function (data) { return exports.MsgMintResponse.decode(new minimal_1.Reader(data)); });
|
|
653
653
|
};
|
|
654
654
|
MsgClientImpl.prototype.Burn = function (request) {
|
|
655
655
|
var data = exports.MsgBurn.encode(request).finish();
|
|
656
|
-
var promise = this.rpc.request("firmachain.
|
|
656
|
+
var promise = this.rpc.request("firmachain.token.Msg", "Burn", data);
|
|
657
657
|
return promise.then(function (data) { return exports.MsgBurnResponse.decode(new minimal_1.Reader(data)); });
|
|
658
658
|
};
|
|
659
659
|
MsgClientImpl.prototype.UpdateTokenURI = function (request) {
|
|
660
660
|
var data = exports.MsgUpdateTokenURI.encode(request).finish();
|
|
661
|
-
var promise = this.rpc.request("firmachain.
|
|
661
|
+
var promise = this.rpc.request("firmachain.token.Msg", "UpdateTokenURI", data);
|
|
662
662
|
return promise.then(function (data) {
|
|
663
663
|
return exports.MsgUpdateTokenURIResponse.decode(new minimal_1.Reader(data));
|
|
664
664
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var chai_1 = require("chai");
|
|
40
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
41
|
+
var config_test_1 = require("./config_test");
|
|
42
|
+
describe('[00. Wallet Test]', function () {
|
|
43
|
+
var firma;
|
|
44
|
+
var aliceWallet;
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
51
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
52
|
+
case 1:
|
|
53
|
+
aliceWallet = _a.sent();
|
|
54
|
+
return [2 /*return*/];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
it('fromMnemonic check', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
+
return __generator(this, function (_a) {
|
|
61
|
+
chai_1.expect(aliceWallet.getMnemonic()).to.equal(config_test_1.aliceMnemonic);
|
|
62
|
+
return [2 /*return*/];
|
|
63
|
+
});
|
|
64
|
+
}); });
|
|
65
|
+
it('Wallet.fromPrivateKey check', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
+
var privateKey, privateKeyFromWallet;
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0:
|
|
70
|
+
privateKey = "0x15bc0d2e445ef5b13f9d3c6d227f21524fd05d5afda713d1aff1ecc8db49a62d";
|
|
71
|
+
return [4 /*yield*/, firma.Wallet.fromPrivateKey(privateKey)];
|
|
72
|
+
case 1:
|
|
73
|
+
privateKeyFromWallet = (_a.sent()).getPrivateKey();
|
|
74
|
+
chai_1.expect(privateKeyFromWallet).to.equal(privateKey);
|
|
75
|
+
return [2 /*return*/];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}); });
|
|
79
|
+
it('Wallet.getPubKey check with new mnemonic', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var randomMnemonic, wallet, pubkey;
|
|
81
|
+
return __generator(this, function (_a) {
|
|
82
|
+
switch (_a.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
randomMnemonic = "inmate stock silly toy divide example orchard harbor pulse gasp acquire bulk predict spin salon quiz record office party today narrow crumble remember sing";
|
|
85
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(randomMnemonic)];
|
|
86
|
+
case 1:
|
|
87
|
+
wallet = _a.sent();
|
|
88
|
+
return [4 /*yield*/, wallet.getPubKey()];
|
|
89
|
+
case 2:
|
|
90
|
+
pubkey = _a.sent();
|
|
91
|
+
chai_1.expect(pubkey).to.equal("AvzyjjaXumyGNQR1DRkDdozJge+MPJPFuNaMr+DAK2ks");
|
|
92
|
+
return [2 /*return*/];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}); });
|
|
96
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
var chai_1 = require("chai");
|
|
40
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
41
|
+
var config_test_1 = require("./config_test");
|
|
42
|
+
describe('[01. Contract Tx Test]', function () {
|
|
43
|
+
var firma;
|
|
44
|
+
var aliceWallet;
|
|
45
|
+
var aliceAddress;
|
|
46
|
+
var bobWallet;
|
|
47
|
+
var bobAddress;
|
|
48
|
+
beforeEach(function () {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
54
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
55
|
+
case 1:
|
|
56
|
+
aliceWallet = _a.sent();
|
|
57
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
58
|
+
case 2:
|
|
59
|
+
aliceAddress = _a.sent();
|
|
60
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
|
|
61
|
+
case 3:
|
|
62
|
+
bobWallet = _a.sent();
|
|
63
|
+
return [4 /*yield*/, bobWallet.getAddress()];
|
|
64
|
+
case 4:
|
|
65
|
+
bobAddress = _a.sent();
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
it('Contract getUnsignedTxAddContractLog X 3 and signAndBroadcast', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
+
var contractHash, timeStamp, eventName, ownerAddress, jsonString, tx, result;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
switch (_a.label) {
|
|
75
|
+
case 0:
|
|
76
|
+
contractHash = "0xsalkdjfasldkjf2";
|
|
77
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
78
|
+
;
|
|
79
|
+
eventName = "CreateContract";
|
|
80
|
+
ownerAddress = aliceAddress;
|
|
81
|
+
jsonString = "{}";
|
|
82
|
+
return [4 /*yield*/, firma.Contract.getUnsignedTxAddContractLog(aliceWallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)];
|
|
83
|
+
case 1:
|
|
84
|
+
tx = _a.sent();
|
|
85
|
+
return [4 /*yield*/, firma.Contract.signAndBroadcast(aliceWallet, [tx, tx, tx])];
|
|
86
|
+
case 2:
|
|
87
|
+
result = _a.sent();
|
|
88
|
+
chai_1.expect(result.code).equal(0);
|
|
89
|
+
return [2 /*return*/];
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}); });
|
|
93
|
+
it('Contract addContractLog', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
|
+
var contractHash, timeStamp, eventName, ownerAddress, jsonString, result;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0:
|
|
98
|
+
contractHash = "0xsalkdjfasldkjf2";
|
|
99
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
100
|
+
;
|
|
101
|
+
eventName = "CreateContract";
|
|
102
|
+
ownerAddress = aliceAddress;
|
|
103
|
+
jsonString = "{}";
|
|
104
|
+
return [4 /*yield*/, firma.Contract.addContractLog(aliceWallet, contractHash, timeStamp, eventName, ownerAddress, jsonString)];
|
|
105
|
+
case 1:
|
|
106
|
+
result = _a.sent();
|
|
107
|
+
chai_1.expect(result.code).equal(0);
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); });
|
|
112
|
+
it('Contract getUnsignedTxCreateContractFile x3 signAndBroadcast', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
|
+
var timeStamp, fileHash, ownerAddress, ownerList, jsonString, tx1, tx2, tx3, result;
|
|
114
|
+
return __generator(this, function (_a) {
|
|
115
|
+
switch (_a.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
118
|
+
fileHash = "0xklsdjflaksjflaksjf" + timeStamp;
|
|
119
|
+
ownerAddress = aliceAddress;
|
|
120
|
+
ownerList = [ownerAddress, ownerAddress];
|
|
121
|
+
jsonString = "{}";
|
|
122
|
+
return [4 /*yield*/, firma.Contract.getUnsignedTxCreateContractFile(aliceWallet, fileHash, timeStamp, ownerList, jsonString)];
|
|
123
|
+
case 1:
|
|
124
|
+
tx1 = _a.sent();
|
|
125
|
+
return [4 /*yield*/, firma.Contract.getUnsignedTxCreateContractFile(aliceWallet, fileHash + "a", timeStamp, ownerList, jsonString)];
|
|
126
|
+
case 2:
|
|
127
|
+
tx2 = _a.sent();
|
|
128
|
+
return [4 /*yield*/, firma.Contract.getUnsignedTxCreateContractFile(aliceWallet, fileHash + "b", timeStamp, ownerList, jsonString)];
|
|
129
|
+
case 3:
|
|
130
|
+
tx3 = _a.sent();
|
|
131
|
+
return [4 /*yield*/, firma.Contract.signAndBroadcast(aliceWallet, [tx1, tx2, tx3])];
|
|
132
|
+
case 4:
|
|
133
|
+
result = _a.sent();
|
|
134
|
+
chai_1.expect(result.code).equal(0);
|
|
135
|
+
return [2 /*return*/];
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}); });
|
|
139
|
+
it('Contract createContractFile', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
var timeStamp, fileHash, ownerAddress, ownerList, jsonString, result;
|
|
141
|
+
return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
timeStamp = Math.round(+new Date() / 1000);
|
|
145
|
+
fileHash = "0xklsdjflaksjflaksjf" + timeStamp;
|
|
146
|
+
ownerAddress = aliceAddress;
|
|
147
|
+
ownerList = [ownerAddress, ownerAddress];
|
|
148
|
+
jsonString = "{}";
|
|
149
|
+
return [4 /*yield*/, firma.Contract.createContractFile(aliceWallet, fileHash, timeStamp, ownerList, jsonString)];
|
|
150
|
+
case 1:
|
|
151
|
+
result = _a.sent();
|
|
152
|
+
chai_1.expect(result.code).equal(0);
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
}); });
|
|
157
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|