@firmachain/firma-js 0.3.5 → 0.3.6-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/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/TxCommon.d.ts +2 -2
- 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 +85 -0
- package/dist/sdk/firmachain/common/signing.d.ts +19 -0
- package/dist/sdk/firmachain/common/signing.js +132 -0
- 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/test/27.arbitrary_sign.test.js +59 -30
- package/dist/test/config_test.d.ts +2 -2
- package/dist/test/config_test.js +22 -5
- package/package.json +1 -1
- package/dist/sdk/firmachain/common/coins.d.ts +0 -30
- package/dist/sdk/firmachain/common/coins.js +0 -69
|
@@ -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;
|