@firmachain/firma-js 0.3.5 → 0.3.6
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/FirmaUtil.d.ts +21 -19
- package/dist/sdk/FirmaUtil.js +116 -151
- package/dist/sdk/FirmaWalletService.d.ts +0 -3
- package/dist/sdk/FirmaWalletService.js +11 -19
- package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -1
- package/dist/sdk/firmachain/common/ITxClient.js +18 -4
- package/dist/sdk/firmachain/common/LedgerWallet.js +1 -1
- package/dist/sdk/firmachain/common/SigningProtobufStargateClient.d.ts +34 -0
- package/dist/sdk/firmachain/common/SigningProtobufStargateClient.js +319 -0
- package/dist/sdk/firmachain/common/SigningStargateClient.d.ts +37 -0
- package/dist/sdk/firmachain/common/SigningStargateClient.js +322 -0
- package/dist/sdk/firmachain/common/StargateClient.d.ts +161 -0
- package/dist/sdk/firmachain/common/StargateClient.js +433 -0
- package/dist/sdk/firmachain/common/TxCommon.d.ts +2 -16
- package/dist/sdk/firmachain/common/accounts.d.ts +4 -0
- package/dist/sdk/firmachain/common/events.d.ts +36 -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 +90 -0
- package/dist/sdk/firmachain/common/signing.d.ts +19 -0
- package/dist/sdk/firmachain/common/signing.js +132 -0
- package/dist/test/26.cosmwasm_query.test.js +1 -3
- package/dist/test/27.arbitrary_sign.test.js +61 -30
- package/dist/test/config_test.d.ts +9 -9
- package/dist/test/config_test.js +27 -26
- package/package.json +1 -1
- package/dist/sdk/firmachain/common/coins.d.ts +0 -30
- package/dist/sdk/firmachain/common/coins.js +0 -69
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
3
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
|
+
if (!m) return o;
|
|
5
|
+
var i = m.call(o), r, ar = [], e;
|
|
6
|
+
try {
|
|
7
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
8
|
+
}
|
|
9
|
+
catch (error) { e = { error: error }; }
|
|
10
|
+
finally {
|
|
11
|
+
try {
|
|
12
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
13
|
+
}
|
|
14
|
+
finally { if (e) throw e.error; }
|
|
15
|
+
}
|
|
16
|
+
return ar;
|
|
17
|
+
};
|
|
18
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
19
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
20
|
+
if (ar || !(i in from)) {
|
|
21
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
22
|
+
ar[i] = from[i];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
exports.makeSignDocProtobuf = exports.makeAuthInfoBytesProtobuf = exports.makeSignBytes = exports.makeSignDoc = exports.makeAuthInfoBytes = void 0;
|
|
29
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
30
|
+
var coin_1 = require("cosmjs-types/cosmos/base/v1beta1/coin");
|
|
31
|
+
var signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
32
|
+
var tx_1 = require("cosmjs-types/cosmos/tx/v1beta1/tx");
|
|
33
|
+
function makeSignerInfos(signers, signMode) {
|
|
34
|
+
return signers.map(function (_a) {
|
|
35
|
+
var pubkey = _a.pubkey, sequence = _a.sequence;
|
|
36
|
+
return tx_1.SignerInfo.fromPartial({
|
|
37
|
+
publicKey: pubkey,
|
|
38
|
+
modeInfo: {
|
|
39
|
+
single: { mode: signMode },
|
|
40
|
+
},
|
|
41
|
+
sequence: BigInt(sequence),
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function makeAuthInfoBytes(signers, feeAmount, gasLimit, granter, payer, signMode) {
|
|
46
|
+
if (signMode === void 0) { signMode = signing_1.SignMode.SIGN_MODE_DIRECT; }
|
|
47
|
+
var fee = tx_1.Fee.fromPartial({
|
|
48
|
+
amount: __spreadArray([], __read(feeAmount), false),
|
|
49
|
+
gasLimit: BigInt(gasLimit),
|
|
50
|
+
granter: granter || "",
|
|
51
|
+
payer: payer || "",
|
|
52
|
+
});
|
|
53
|
+
var authInfo = tx_1.AuthInfo.fromPartial({
|
|
54
|
+
signerInfos: makeSignerInfos(signers, signMode),
|
|
55
|
+
fee: fee,
|
|
56
|
+
});
|
|
57
|
+
return tx_1.AuthInfo.encode(authInfo).finish();
|
|
58
|
+
}
|
|
59
|
+
exports.makeAuthInfoBytes = makeAuthInfoBytes;
|
|
60
|
+
function makeSignDoc(bodyBytes, authInfoBytes, chainId, accountNumber) {
|
|
61
|
+
return tx_1.SignDoc.fromPartial({
|
|
62
|
+
bodyBytes: bodyBytes,
|
|
63
|
+
authInfoBytes: authInfoBytes,
|
|
64
|
+
chainId: chainId,
|
|
65
|
+
accountNumber: BigInt(accountNumber),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
exports.makeSignDoc = makeSignDoc;
|
|
69
|
+
function makeSignBytes(signDoc) {
|
|
70
|
+
// Ensure all required fields are present
|
|
71
|
+
if (!signDoc.bodyBytes || !signDoc.authInfoBytes || !signDoc.chainId || signDoc.accountNumber === undefined) {
|
|
72
|
+
throw new Error("SignDoc is missing required fields");
|
|
73
|
+
}
|
|
74
|
+
var doc = tx_1.SignDoc.fromPartial({
|
|
75
|
+
accountNumber: signDoc.accountNumber,
|
|
76
|
+
authInfoBytes: signDoc.authInfoBytes,
|
|
77
|
+
bodyBytes: signDoc.bodyBytes,
|
|
78
|
+
chainId: signDoc.chainId,
|
|
79
|
+
});
|
|
80
|
+
return tx_1.SignDoc.encode(doc).finish();
|
|
81
|
+
}
|
|
82
|
+
exports.makeSignBytes = makeSignBytes;
|
|
83
|
+
/**
|
|
84
|
+
* Creates AuthInfo bytes for protobuf signing with enhanced type safety
|
|
85
|
+
*/
|
|
86
|
+
function makeAuthInfoBytesProtobuf(signers, feeAmount, gasLimit, granter, payer) {
|
|
87
|
+
var normalizedGasLimit = typeof gasLimit === 'bigint' ? gasLimit : BigInt(gasLimit);
|
|
88
|
+
var fee = tx_1.Fee.fromPartial({
|
|
89
|
+
amount: feeAmount.map(function (coin) { return coin_1.Coin.fromPartial(coin); }),
|
|
90
|
+
gasLimit: normalizedGasLimit,
|
|
91
|
+
granter: granter || "",
|
|
92
|
+
payer: payer || "",
|
|
93
|
+
});
|
|
94
|
+
var signerInfos = signers.map(function (_a) {
|
|
95
|
+
var pubkey = _a.pubkey, sequence = _a.sequence;
|
|
96
|
+
return tx_1.SignerInfo.fromPartial({
|
|
97
|
+
publicKey: pubkey,
|
|
98
|
+
modeInfo: {
|
|
99
|
+
single: { mode: signing_1.SignMode.SIGN_MODE_DIRECT },
|
|
100
|
+
},
|
|
101
|
+
sequence: BigInt(sequence),
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
var authInfo = tx_1.AuthInfo.fromPartial({
|
|
105
|
+
signerInfos: signerInfos,
|
|
106
|
+
fee: fee,
|
|
107
|
+
});
|
|
108
|
+
return tx_1.AuthInfo.encode(authInfo).finish();
|
|
109
|
+
}
|
|
110
|
+
exports.makeAuthInfoBytesProtobuf = makeAuthInfoBytesProtobuf;
|
|
111
|
+
/**
|
|
112
|
+
* Creates a protobuf SignDoc with validation
|
|
113
|
+
*/
|
|
114
|
+
function makeSignDocProtobuf(bodyBytes, authInfoBytes, chainId, accountNumber) {
|
|
115
|
+
if (!bodyBytes || bodyBytes.length === 0) {
|
|
116
|
+
throw new Error("bodyBytes cannot be empty");
|
|
117
|
+
}
|
|
118
|
+
if (!authInfoBytes || authInfoBytes.length === 0) {
|
|
119
|
+
throw new Error("authInfoBytes cannot be empty");
|
|
120
|
+
}
|
|
121
|
+
if (!chainId) {
|
|
122
|
+
throw new Error("chainId cannot be empty");
|
|
123
|
+
}
|
|
124
|
+
var normalizedAccountNumber = typeof accountNumber === 'bigint' ? accountNumber : BigInt(accountNumber);
|
|
125
|
+
return tx_1.SignDoc.fromPartial({
|
|
126
|
+
bodyBytes: bodyBytes,
|
|
127
|
+
authInfoBytes: authInfoBytes,
|
|
128
|
+
chainId: chainId,
|
|
129
|
+
accountNumber: normalizedAccountNumber,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
exports.makeSignDocProtobuf = makeSignDocProtobuf;
|
|
@@ -216,9 +216,7 @@ describe('[26. cosmwasm query Test]', function () {
|
|
|
216
216
|
switch (_b.label) {
|
|
217
217
|
case 0:
|
|
218
218
|
queries = [
|
|
219
|
-
'{"
|
|
220
|
-
'{"minter":{}}',
|
|
221
|
-
'{"marketing_info":{}}'
|
|
219
|
+
'{"config":{}}',
|
|
222
220
|
];
|
|
223
221
|
successfulQuery = null;
|
|
224
222
|
result = null;
|
|
@@ -40,7 +40,7 @@ var chai_1 = require("chai");
|
|
|
40
40
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
41
41
|
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
42
42
|
var config_test_1 = require("./config_test");
|
|
43
|
-
var
|
|
43
|
+
var bank_1 = require("../sdk/firmachain/bank");
|
|
44
44
|
describe('[27. protobuf arbitrary sign]', function () {
|
|
45
45
|
var firma;
|
|
46
46
|
var aliceWallet;
|
|
@@ -71,59 +71,90 @@ describe('[27. protobuf arbitrary sign]', function () {
|
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
it('protobuf arbitrary sign & verify basic test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
-
var testMsg,
|
|
74
|
+
var testMsg, signatureResult, jsonString, finalData, isMatch;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
78
78
|
testMsg = "be14202e-46dc-4d38-924c-65db209ea2fb";
|
|
79
|
-
|
|
80
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.protobufArbitrarySign(aliceWallet, aliceAddress, testBytes)];
|
|
79
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.experimentalAdr36Sign(aliceWallet, testMsg)];
|
|
81
80
|
case 1:
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
signatureResult = _a.sent();
|
|
82
|
+
jsonString = JSON.stringify(signatureResult);
|
|
83
|
+
finalData = JSON.parse(jsonString);
|
|
84
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.experimentalAdr36Verify(finalData, testMsg)];
|
|
84
85
|
case 2:
|
|
85
|
-
|
|
86
|
-
(0, chai_1.expect)(
|
|
86
|
+
isMatch = _a.sent();
|
|
87
|
+
(0, chai_1.expect)(isMatch).to.be.equal(true);
|
|
87
88
|
return [2 /*return*/];
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
91
|
}); });
|
|
91
|
-
it('
|
|
92
|
-
var
|
|
92
|
+
it('direct sign & verify basic test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
93
|
+
var amountFCT, alicePubkey, sendAmount, msgSend, stringSignDoc, signDoc, commonTxClient, extTxRaw, valid;
|
|
93
94
|
return __generator(this, function (_a) {
|
|
94
95
|
switch (_a.label) {
|
|
95
96
|
case 0:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.protobufArbitrarySign(aliceWallet, aliceAddress, testBytes)];
|
|
97
|
+
amountFCT = 9;
|
|
98
|
+
return [4 /*yield*/, aliceWallet.getPubKey()];
|
|
99
99
|
case 1:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
alicePubkey = _a.sent();
|
|
101
|
+
sendAmount = { denom: firma.Config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT) };
|
|
102
|
+
msgSend = bank_1.BankTxClient.msgSend({
|
|
103
|
+
fromAddress: aliceAddress,
|
|
104
|
+
toAddress: bobAddress,
|
|
105
|
+
amount: [sendAmount]
|
|
106
|
+
});
|
|
107
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.makeSignDocWithStringify(aliceAddress, alicePubkey, [msgSend])];
|
|
103
108
|
case 2:
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
stringSignDoc = _a.sent();
|
|
110
|
+
signDoc = FirmaUtil_1.FirmaUtil.parseSignDocValues(stringSignDoc);
|
|
111
|
+
commonTxClient = FirmaUtil_1.FirmaUtil.getCommonTxClient(aliceWallet);
|
|
112
|
+
return [4 /*yield*/, commonTxClient.signDirectForSignDoc(aliceAddress, signDoc)];
|
|
113
|
+
case 3:
|
|
114
|
+
extTxRaw = _a.sent();
|
|
115
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.verifyDirectSignature(aliceAddress, extTxRaw.signature, signDoc)];
|
|
116
|
+
case 4:
|
|
117
|
+
valid = _a.sent();
|
|
118
|
+
(0, chai_1.expect)(valid).to.be.equal(true);
|
|
106
119
|
return [2 /*return*/];
|
|
107
120
|
}
|
|
108
121
|
});
|
|
109
122
|
}); });
|
|
110
|
-
it('
|
|
111
|
-
var
|
|
123
|
+
it('direct sign & verify & send basic test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var amountFCT, alicePubkey, sendAmount, msgSend, signDoc, stringSignDoc, newSignDoc, commonTxClient, extTxRaw, valid, result;
|
|
112
125
|
return __generator(this, function (_a) {
|
|
113
126
|
switch (_a.label) {
|
|
114
127
|
case 0:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.protobufArbitrarySign(aliceWallet, aliceAddress, testBytes)];
|
|
128
|
+
amountFCT = 9;
|
|
129
|
+
return [4 /*yield*/, aliceWallet.getPubKey()];
|
|
118
130
|
case 1:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
alicePubkey = _a.sent();
|
|
132
|
+
sendAmount = { denom: firma.Config.denom, amount: FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountFCT) };
|
|
133
|
+
msgSend = bank_1.BankTxClient.msgSend({
|
|
134
|
+
fromAddress: aliceAddress,
|
|
135
|
+
toAddress: bobAddress,
|
|
136
|
+
amount: [sendAmount]
|
|
137
|
+
});
|
|
138
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.makeSignDoc(aliceAddress, alicePubkey, [msgSend])];
|
|
124
139
|
case 2:
|
|
125
|
-
|
|
126
|
-
|
|
140
|
+
signDoc = _a.sent();
|
|
141
|
+
stringSignDoc = FirmaUtil_1.FirmaUtil.stringifySignDocValues(signDoc);
|
|
142
|
+
newSignDoc = FirmaUtil_1.FirmaUtil.parseSignDocValues(stringSignDoc);
|
|
143
|
+
commonTxClient = FirmaUtil_1.FirmaUtil.getCommonTxClient(aliceWallet);
|
|
144
|
+
return [4 /*yield*/, commonTxClient.signDirectForSignDoc(aliceAddress, newSignDoc)];
|
|
145
|
+
case 3:
|
|
146
|
+
extTxRaw = _a.sent();
|
|
147
|
+
return [4 /*yield*/, FirmaUtil_1.FirmaUtil.verifyDirectSignature(aliceAddress, extTxRaw.signature, newSignDoc)];
|
|
148
|
+
case 4:
|
|
149
|
+
valid = _a.sent();
|
|
150
|
+
if (!valid) return [3 /*break*/, 6];
|
|
151
|
+
return [4 /*yield*/, commonTxClient.broadcast(extTxRaw.txRaw)];
|
|
152
|
+
case 5:
|
|
153
|
+
result = _a.sent();
|
|
154
|
+
(0, chai_1.expect)(result.code).to.be.equal(0);
|
|
155
|
+
_a.label = 6;
|
|
156
|
+
case 6:
|
|
157
|
+
(0, chai_1.expect)(valid).to.be.equal(true);
|
|
127
158
|
return [2 /*return*/];
|
|
128
159
|
}
|
|
129
160
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { FirmaConfig } from '../sdk/FirmaConfig';
|
|
2
2
|
export declare let TestChainConfig: FirmaConfig;
|
|
3
|
-
export declare const validatorMnemonic = "
|
|
4
|
-
export declare const aliceMnemonic = "
|
|
5
|
-
export declare const bobMnemonic = "
|
|
6
|
-
export declare const feeMnemonic = "
|
|
7
|
-
export declare const firmaFeeMnemonic = "
|
|
8
|
-
export declare const signerMnemonic1 = "
|
|
9
|
-
export declare const signerMnemonic2 = "
|
|
10
|
-
export declare const signerMnemonic3 = "
|
|
11
|
-
export declare const signerMnemonic4 = "
|
|
3
|
+
export declare const validatorMnemonic = "uncle banana theme relax oak prosper volcano glad industry bicycle tower thrive jelly curious luggage frame that defy reason jewel figure begin nice moon";
|
|
4
|
+
export declare const aliceMnemonic = "ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy";
|
|
5
|
+
export declare const bobMnemonic = "burst torch enemy quick crime slogan trust wood hamster way armor visual common language close park leg ill ball board couch nose theory must";
|
|
6
|
+
export declare const feeMnemonic = "";
|
|
7
|
+
export declare const firmaFeeMnemonic = "";
|
|
8
|
+
export declare const signerMnemonic1 = "owner pottery smile evolve pig base lady dismiss badge purchase divide royal medal buffalo miss carbon kiwi gate draft mouse yard reunion thank wage";
|
|
9
|
+
export declare const signerMnemonic2 = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
10
|
+
export declare const signerMnemonic3 = "main shallow liberty desk super palm remind throw track legal warrior client garbage type insect first token keen subway pony curtain pitch yellow arrive";
|
|
11
|
+
export declare const signerMnemonic4 = "sand mule spice strike summer invite hybrid inner deputy truly cabin little fence smart erase roast gesture raccoon side love odor decorate action lunar";
|
package/dist/test/config_test.js
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.signerMnemonic4 = exports.signerMnemonic3 = exports.signerMnemonic2 = exports.signerMnemonic1 = exports.firmaFeeMnemonic = exports.feeMnemonic = exports.bobMnemonic = exports.aliceMnemonic = exports.validatorMnemonic = exports.TestChainConfig = void 0;
|
|
4
|
+
// TESTNET
|
|
4
5
|
// export let TestChainConfig: FirmaConfig = FirmaConfig.TestNetConfig;
|
|
6
|
+
// Validator 1
|
|
7
|
+
// export const validatorMnemonic = "owner pottery smile evolve pig base lady dismiss badge purchase divide royal medal buffalo miss carbon kiwi gate draft mouse yard reunion thank wage";
|
|
8
|
+
// Validator 2
|
|
9
|
+
// export const validatorMnemonic = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
10
|
+
// validator 3
|
|
11
|
+
// export const validatorMnemonic = "main shallow liberty desk super palm remind throw track legal warrior client garbage type insect first token keen subway pony curtain pitch yellow arrive";
|
|
12
|
+
// export const aliceMnemonic = "harvest galaxy sniff include record undo width oven tired sad month text museum curious firm mountain flash assault oval sand ribbon blouse consider lens";
|
|
13
|
+
// export const bobMnemonic = "certain bean eager measure crawl cliff innocent practice gas ladder board aspect fish link sweet raccoon staff long crumble skin special width click plastic";
|
|
14
|
+
// export const feeMnemonic = "";
|
|
15
|
+
// export const firmaFeeMnemonic = "";
|
|
16
|
+
// export const signerMnemonic1 = "owner pottery smile evolve pig base lady dismiss badge purchase divide royal medal buffalo miss carbon kiwi gate draft mouse yard reunion thank wage";
|
|
17
|
+
// export const signerMnemonic2 = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
18
|
+
// export const signerMnemonic3 = "main shallow liberty desk super palm remind throw track legal warrior client garbage type insect first token keen subway pony curtain pitch yellow arrive";
|
|
19
|
+
// export const signerMnemonic4 = "sand mule spice strike summer invite hybrid inner deputy truly cabin little fence smart erase roast gesture raccoon side love odor decorate action lunar";
|
|
20
|
+
// DEVNET
|
|
5
21
|
exports.TestChainConfig = {
|
|
6
22
|
chainID: "roma-1",
|
|
7
23
|
rpcAddress: "http://192.168.30.47:26657",
|
|
@@ -14,30 +30,15 @@ exports.TestChainConfig = {
|
|
|
14
30
|
denom: "ufct",
|
|
15
31
|
defaultFee: 20000,
|
|
16
32
|
defaultGas: 200000,
|
|
17
|
-
isShowLog:
|
|
33
|
+
isShowLog: true,
|
|
18
34
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
exports.aliceMnemonic = "
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// export const aliceMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
|
|
30
|
-
// export const aliceMnemonic = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
31
|
-
// export const aliceMnemonic = "angry water bunker where iron absurd cruise deliver clutch unique creek pyramid arch express flush pill lens concert absent enemy boring mom nuclear rose";
|
|
32
|
-
// export const aliceMnemonic = "stadium lonely midnight okay meat rib awesome wealth phone leisure turn prosper notable label fruit define little also father silver half drill bargain antique";
|
|
33
|
-
// export const aliceMnemonic = "uncle banana theme relax oak prosper volcano glad industry bicycle tower thrive jelly curious luggage frame that defy reason jewel figure begin nice moon";
|
|
34
|
-
// export const aliceMnemonic = "rebel engine situate catalog blood strong satisfy aerobic cupboard again vivid twice flag work taxi heart fruit island ribbon hungry cheap ordinary horse foam";
|
|
35
|
-
// export const aliceMnemonic = "ladder damage art company shield glance cushion float need layer rare toast intact grief wet point write season correct access mix bomb accident estate";
|
|
36
|
-
exports.bobMnemonic = "innocent enforce visit tilt job kitten actual glory flash feed wonder license rubber outer drum sun fuel relax roof universe enrich pulse fine grid";
|
|
37
|
-
exports.feeMnemonic = "long shallow crumble clown truth book oval render seed canal buffalo assist sadness elbow afraid catalog brother trade food subject must luggage bread neither";
|
|
38
|
-
exports.firmaFeeMnemonic = "arrest dynamic typical lunch original glare truth narrow stairs clip canyon space alley chat drive sudden music bubble time mesh color office minor draft";
|
|
39
|
-
// export const firmaFeeMnemonic = "child material talent property foot sign talent congress cargo pistol suspect screen leader owner type style patch amused stable flame sure fluid april acoustic";
|
|
40
|
-
exports.signerMnemonic1 = "couch tonight jelly pond notice spring gold tornado cancel hover hill soft table can buyer already region bean mask cart gasp include change rent";
|
|
41
|
-
exports.signerMnemonic2 = "frozen never essence submit moon night cement omit final guilt border draft caution zoo gorilla illegal notable whisper try name orange hollow maximum arrive";
|
|
42
|
-
exports.signerMnemonic3 = "stock vapor planet van asthma upgrade scheme fuel cushion before brief knee kick lesson gun spatial protect danger they stem stay chunk critic cram";
|
|
43
|
-
exports.signerMnemonic4 = "tomorrow hospital bottom lucky insane play concert casual truly certain antique airport safe envelope relax matter cute zone boring calm pudding eyebrow mouse spawn";
|
|
35
|
+
// Validator
|
|
36
|
+
exports.validatorMnemonic = "uncle banana theme relax oak prosper volcano glad industry bicycle tower thrive jelly curious luggage frame that defy reason jewel figure begin nice moon";
|
|
37
|
+
exports.aliceMnemonic = "ozone unfold device pave lemon potato omit insect column wise cover hint narrow large provide kidney episode clay notable milk mention dizzy muffin crazy";
|
|
38
|
+
exports.bobMnemonic = "burst torch enemy quick crime slogan trust wood hamster way armor visual common language close park leg ill ball board couch nose theory must";
|
|
39
|
+
exports.feeMnemonic = "";
|
|
40
|
+
exports.firmaFeeMnemonic = "";
|
|
41
|
+
exports.signerMnemonic1 = "owner pottery smile evolve pig base lady dismiss badge purchase divide royal medal buffalo miss carbon kiwi gate draft mouse yard reunion thank wage";
|
|
42
|
+
exports.signerMnemonic2 = "clump erupt type lucky mask pig soup runway wrestle suspect element involve stamp civil auction resource blame same journey start unaware crush ten draw";
|
|
43
|
+
exports.signerMnemonic3 = "main shallow liberty desk super palm remind throw track legal warrior client garbage type insect first token keen subway pony curtain pitch yellow arrive";
|
|
44
|
+
exports.signerMnemonic4 = "sand mule spice strike summer invite hybrid inner deputy truly cabin little fence smart erase roast gesture raccoon side love odor decorate action lunar";
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface Coin {
|
|
2
|
-
readonly denom: string;
|
|
3
|
-
readonly amount: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Creates a coin.
|
|
7
|
-
*
|
|
8
|
-
* If your values do not exceed the safe integer range of JS numbers (53 bit),
|
|
9
|
-
* you can use the number type here. This is the case for all typical Cosmos SDK
|
|
10
|
-
* chains that use the default 6 decimals.
|
|
11
|
-
*
|
|
12
|
-
* In case you need to supportr larger values, use unsigned integer strings instead.
|
|
13
|
-
*/
|
|
14
|
-
export declare function coin(amount: number | string, denom: string): Coin;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a list of coins with one element.
|
|
17
|
-
*/
|
|
18
|
-
export declare function coins(amount: number | string, denom: string): Coin[];
|
|
19
|
-
/**
|
|
20
|
-
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
|
|
21
|
-
*
|
|
22
|
-
* A Stargate-ready variant of this function is available via:
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
* import { parseCoins } from "@cosmjs/proto-signing";
|
|
26
|
-
* // or
|
|
27
|
-
* import { parseCoins } from "@cosmjs/stargate";
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare function parseCoins(input: string): Coin[];
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseCoins = exports.coins = exports.coin = void 0;
|
|
4
|
-
var math_1 = require("@cosmjs/math");
|
|
5
|
-
/**
|
|
6
|
-
* Creates a coin.
|
|
7
|
-
*
|
|
8
|
-
* If your values do not exceed the safe integer range of JS numbers (53 bit),
|
|
9
|
-
* you can use the number type here. This is the case for all typical Cosmos SDK
|
|
10
|
-
* chains that use the default 6 decimals.
|
|
11
|
-
*
|
|
12
|
-
* In case you need to supportr larger values, use unsigned integer strings instead.
|
|
13
|
-
*/
|
|
14
|
-
function coin(amount, denom) {
|
|
15
|
-
var outAmount;
|
|
16
|
-
if (typeof amount === "number") {
|
|
17
|
-
try {
|
|
18
|
-
outAmount = new math_1.Uint53(amount).toString();
|
|
19
|
-
}
|
|
20
|
-
catch (_err) {
|
|
21
|
-
throw new Error("Given amount is not a safe integer. Consider using a string instead to overcome the limitations of JS numbers.");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
if (!amount.match(/^[0-9]+$/)) {
|
|
26
|
-
throw new Error("Invalid unsigned integer string format");
|
|
27
|
-
}
|
|
28
|
-
outAmount = amount.replace(/^0*/, "") || "0";
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
amount: outAmount,
|
|
32
|
-
denom: denom,
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
exports.coin = coin;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a list of coins with one element.
|
|
38
|
-
*/
|
|
39
|
-
function coins(amount, denom) {
|
|
40
|
-
return [coin(amount, denom)];
|
|
41
|
-
}
|
|
42
|
-
exports.coins = coins;
|
|
43
|
-
/**
|
|
44
|
-
* Takes a coins list like "819966000ucosm,700000000ustake" and parses it.
|
|
45
|
-
*
|
|
46
|
-
* A Stargate-ready variant of this function is available via:
|
|
47
|
-
*
|
|
48
|
-
* ```
|
|
49
|
-
* import { parseCoins } from "@cosmjs/proto-signing";
|
|
50
|
-
* // or
|
|
51
|
-
* import { parseCoins } from "@cosmjs/stargate";
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
function parseCoins(input) {
|
|
55
|
-
return input
|
|
56
|
-
.replace(/\s/g, "")
|
|
57
|
-
.split(",")
|
|
58
|
-
.filter(Boolean)
|
|
59
|
-
.map(function (part) {
|
|
60
|
-
var match = part.match(/^([0-9]+)([a-zA-Z][a-zA-Z0-9/]{2,127})$/);
|
|
61
|
-
if (!match)
|
|
62
|
-
throw new Error("Got an invalid coin string");
|
|
63
|
-
return {
|
|
64
|
-
amount: math_1.Uint64.fromString(match[1]).toString(),
|
|
65
|
-
denom: match[2],
|
|
66
|
-
};
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
exports.parseCoins = parseCoins;
|