carbon-js-sdk 0.4.21 → 0.4.23
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/lib/clients/CarbonQueryClient.js +2 -2
- package/lib/clients/ETHClient.js +15 -15
- package/lib/clients/EvmIbcClient.d.ts +86 -0
- package/lib/clients/EvmIbcClient.js +90 -0
- package/lib/clients/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.js +4 -4
- package/lib/clients/ZILClient.js +17 -17
- package/lib/codec/alliance/alliance.d.ts +65 -0
- package/lib/codec/alliance/alliance.js +354 -0
- package/lib/codec/alliance/delegations.d.ts +86 -0
- package/lib/codec/alliance/delegations.js +489 -0
- package/lib/codec/alliance/events.d.ts +61 -0
- package/lib/codec/alliance/events.js +403 -0
- package/lib/codec/alliance/genesis.d.ts +74 -0
- package/lib/codec/alliance/genesis.js +469 -0
- package/lib/codec/alliance/gov.d.ts +78 -0
- package/lib/codec/alliance/gov.js +380 -0
- package/lib/codec/{perpsliquidity → alliance}/params.d.ts +18 -8
- package/lib/codec/alliance/params.js +182 -0
- package/lib/codec/alliance/query.d.ts +312 -0
- package/lib/codec/alliance/query.js +1497 -0
- package/lib/codec/alliance/tx.d.ts +111 -0
- package/lib/codec/alliance/tx.js +495 -0
- package/lib/codec/broker/incoming_pool_swap.d.ts +23 -0
- package/lib/codec/broker/incoming_pool_swap.js +136 -0
- package/lib/codec/cosmos/gov/v1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1/tx.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/group/v1/events.js +2 -2
- package/lib/codec/cosmos/group/v1/tx.js +4 -4
- package/lib/codec/cosmos/tx/v1beta1/tx.js +4 -4
- package/lib/codec/google/protobuf/any.d.ts +4 -1
- package/lib/codec/google/protobuf/timestamp.d.ts +0 -2
- package/lib/codec/index.d.ts +58 -35
- package/lib/codec/index.js +788 -697
- package/lib/constant/generic.js +1 -1
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/gov.js +12 -12
- package/lib/modules/liquiditypool.js +1 -1
- package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
- package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
- package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
- package/lib/provider/amino/types/admin.js +27 -27
- package/lib/provider/amino/types/bank.js +1 -1
- package/lib/provider/amino/types/broker.js +1 -1
- package/lib/provider/amino/types/cdp.js +25 -25
- package/lib/provider/amino/types/coin.js +4 -4
- package/lib/provider/amino/types/gov.js +4 -4
- package/lib/provider/amino/types/ibc.js +1 -1
- package/lib/provider/amino/types/leverage.js +1 -1
- package/lib/provider/amino/types/liquidityPool.js +7 -7
- package/lib/provider/amino/types/market.js +2 -2
- package/lib/provider/amino/types/oracle.js +1 -1
- package/lib/provider/amino/types/order.js +4 -4
- package/lib/provider/amino/types/position.js +1 -1
- package/lib/provider/amino/types/profile.js +1 -1
- package/lib/provider/amino/types/staking.js +4 -4
- package/lib/provider/amino/types/subaccount.js +3 -3
- package/lib/provider/amino/utils.js +11 -11
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.js +1 -1
- package/lib/provider/o3/O3Wallet.js +2 -2
- package/lib/util/address.js +13 -13
- package/lib/util/api.js +4 -4
- package/lib/util/ethermint/evm-ibc.d.ts +97 -0
- package/lib/util/ethermint/evm-ibc.js +134 -0
- package/lib/util/ethermint/index.d.ts +3 -0
- package/lib/util/ethermint/index.js +12 -0
- package/lib/util/ethermint/keys.d.ts +39 -0
- package/lib/util/ethermint/keys.js +138 -0
- package/lib/util/ethermint/web3.d.ts +36 -0
- package/lib/util/ethermint/web3.js +124 -0
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/number.js +5 -5
- package/lib/util/tx.d.ts +51 -34
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +8 -8
- package/lib/wallet/CarbonWallet.js +6 -6
- package/lib/websocket/connector.js +3 -3
- package/package.json +1 -1
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.d.ts +0 -1
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.js +0 -6
- package/lib/codec/ethermint/evm/v1/export.d.ts +0 -5
- package/lib/codec/ethermint/evm/v1/export.js +0 -53
- package/lib/codec/ethermint/feemarket/v1/export.d.ts +0 -4
- package/lib/codec/ethermint/feemarket/v1/export.js +0 -18
- package/lib/codec/ethermint/types/v1/export.d.ts +0 -4
- package/lib/codec/ethermint/types/v1/export.js +0 -11
- package/lib/codec/ethermint-models.d.ts +0 -4
- package/lib/codec/ethermint-models.js +0 -26
- package/lib/codec/market/fee.d.ts +0 -123
- package/lib/codec/market/fee.js +0 -334
- package/lib/codec/perpsliquidity/event.d.ts +0 -102
- package/lib/codec/perpsliquidity/event.js +0 -581
- package/lib/codec/perpsliquidity/genesis.d.ts +0 -35
- package/lib/codec/perpsliquidity/genesis.js +0 -162
- package/lib/codec/perpsliquidity/params.js +0 -103
- package/lib/codec/perpsliquidity/pool.d.ts +0 -137
- package/lib/codec/perpsliquidity/pool.js +0 -747
- package/lib/codec/perpsliquidity/query.d.ts +0 -167
- package/lib/codec/perpsliquidity/query.js +0 -719
- package/lib/codec/perpsliquidity/tx.d.ts +0 -199
- package/lib/codec/perpsliquidity/tx.js +0 -940
- package/lib/constant/eip712.d.ts +0 -46
- package/lib/constant/eip712.js +0 -106
- package/lib/modules/evm.d.ts +0 -46
- package/lib/modules/evm.js +0 -127
- package/lib/modules/evmmerge.d.ts +0 -12
- package/lib/modules/evmmerge.js +0 -35
- package/lib/modules/feemarket.d.ts +0 -20
- package/lib/modules/feemarket.js +0 -45
- package/lib/modules/vault.d.ts +0 -44
- package/lib/modules/vault.js +0 -95
- package/lib/provider/amino/types/evm.d.ts +0 -4
- package/lib/provider/amino/types/evm.js +0 -40
- package/lib/provider/amino/types/evmmerge.d.ts +0 -4
- package/lib/provider/amino/types/evmmerge.js +0 -34
- package/lib/provider/amino/types/feemarket.d.ts +0 -4
- package/lib/provider/amino/types/feemarket.js +0 -34
- package/lib/provider/metamask/legacy-accounts.d.ts +0 -6
- package/lib/provider/metamask/legacy-accounts.js +0 -44
- package/lib/util/eip712.d.ts +0 -10
- package/lib/util/eip712.js +0 -195
- package/lib/util/ethermint.d.ts +0 -8
- package/lib/util/ethermint.js +0 -68
- package/lib/util/legacyEIP712.d.ts +0 -20
- package/lib/util/legacyEIP712.js +0 -98
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.EvmIbcHelper = exports.ExtensionOptionsWeb3Tx = exports.PubKey = void 0;
|
|
7
|
+
var keys_1 = require("./keys");
|
|
8
|
+
Object.defineProperty(exports, "PubKey", { enumerable: true, get: function () { return keys_1.PubKey; } });
|
|
9
|
+
var web3_1 = require("./web3");
|
|
10
|
+
Object.defineProperty(exports, "ExtensionOptionsWeb3Tx", { enumerable: true, get: function () { return web3_1.ExtensionOptionsWeb3Tx; } });
|
|
11
|
+
var evm_ibc_1 = require("./evm-ibc");
|
|
12
|
+
Object.defineProperty(exports, "EvmIbcHelper", { enumerable: true, get: function () { return __importDefault(evm_ibc_1).default; } });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "ethermint.crypto.v1.ethsecp256k1";
|
|
4
|
+
/**
|
|
5
|
+
* PubKey defines a type alias for an ecdsa.PublicKey that implements
|
|
6
|
+
* Tendermint's PubKey interface. It represents the 33-byte compressed public
|
|
7
|
+
* key format.
|
|
8
|
+
*/
|
|
9
|
+
export interface PubKey {
|
|
10
|
+
/** key is the public key in byte form */
|
|
11
|
+
key: Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* PrivKey defines a type alias for an ecdsa.PrivateKey that implements
|
|
15
|
+
* Tendermint's PrivateKey interface.
|
|
16
|
+
*/
|
|
17
|
+
export interface PrivKey {
|
|
18
|
+
/** key is the private key in byte form */
|
|
19
|
+
key: Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
export declare const PubKey: {
|
|
22
|
+
encode(message: PubKey, writer?: _m0.Writer): _m0.Writer;
|
|
23
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PubKey;
|
|
24
|
+
fromJSON(object: any): PubKey;
|
|
25
|
+
toJSON(message: PubKey): unknown;
|
|
26
|
+
fromPartial(object: DeepPartial<PubKey>): PubKey;
|
|
27
|
+
};
|
|
28
|
+
export declare const PrivKey: {
|
|
29
|
+
encode(message: PrivKey, writer?: _m0.Writer): _m0.Writer;
|
|
30
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PrivKey;
|
|
31
|
+
fromJSON(object: any): PrivKey;
|
|
32
|
+
toJSON(message: PrivKey): unknown;
|
|
33
|
+
fromPartial(object: DeepPartial<PrivKey>): PrivKey;
|
|
34
|
+
};
|
|
35
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
36
|
+
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
37
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
38
|
+
} : Partial<T>;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PrivKey = exports.PubKey = exports.protobufPackage = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
exports.protobufPackage = "ethermint.crypto.v1.ethsecp256k1";
|
|
11
|
+
const basePubKey = {};
|
|
12
|
+
exports.PubKey = {
|
|
13
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
14
|
+
if (message.key.length !== 0) {
|
|
15
|
+
writer.uint32(10).bytes(message.key);
|
|
16
|
+
}
|
|
17
|
+
return writer;
|
|
18
|
+
},
|
|
19
|
+
decode(input, length) {
|
|
20
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
21
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
22
|
+
const message = Object.assign({}, basePubKey);
|
|
23
|
+
message.key = new Uint8Array();
|
|
24
|
+
while (reader.pos < end) {
|
|
25
|
+
const tag = reader.uint32();
|
|
26
|
+
switch (tag >>> 3) {
|
|
27
|
+
case 1:
|
|
28
|
+
message.key = reader.bytes();
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
reader.skipType(tag & 7);
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return message;
|
|
36
|
+
},
|
|
37
|
+
fromJSON(object) {
|
|
38
|
+
const message = Object.assign({}, basePubKey);
|
|
39
|
+
message.key =
|
|
40
|
+
object.key !== undefined && object.key !== null
|
|
41
|
+
? bytesFromBase64(object.key)
|
|
42
|
+
: new Uint8Array();
|
|
43
|
+
return message;
|
|
44
|
+
},
|
|
45
|
+
toJSON(message) {
|
|
46
|
+
const obj = {};
|
|
47
|
+
message.key !== undefined &&
|
|
48
|
+
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
|
|
49
|
+
return obj;
|
|
50
|
+
},
|
|
51
|
+
fromPartial(object) {
|
|
52
|
+
var _a;
|
|
53
|
+
const message = Object.assign({}, basePubKey);
|
|
54
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
|
|
55
|
+
return message;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const basePrivKey = {};
|
|
59
|
+
exports.PrivKey = {
|
|
60
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
61
|
+
if (message.key.length !== 0) {
|
|
62
|
+
writer.uint32(10).bytes(message.key);
|
|
63
|
+
}
|
|
64
|
+
return writer;
|
|
65
|
+
},
|
|
66
|
+
decode(input, length) {
|
|
67
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
68
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
69
|
+
const message = Object.assign({}, basePrivKey);
|
|
70
|
+
message.key = new Uint8Array();
|
|
71
|
+
while (reader.pos < end) {
|
|
72
|
+
const tag = reader.uint32();
|
|
73
|
+
switch (tag >>> 3) {
|
|
74
|
+
case 1:
|
|
75
|
+
message.key = reader.bytes();
|
|
76
|
+
break;
|
|
77
|
+
default:
|
|
78
|
+
reader.skipType(tag & 7);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return message;
|
|
83
|
+
},
|
|
84
|
+
fromJSON(object) {
|
|
85
|
+
const message = Object.assign({}, basePrivKey);
|
|
86
|
+
message.key =
|
|
87
|
+
object.key !== undefined && object.key !== null
|
|
88
|
+
? bytesFromBase64(object.key)
|
|
89
|
+
: new Uint8Array();
|
|
90
|
+
return message;
|
|
91
|
+
},
|
|
92
|
+
toJSON(message) {
|
|
93
|
+
const obj = {};
|
|
94
|
+
message.key !== undefined &&
|
|
95
|
+
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
|
|
96
|
+
return obj;
|
|
97
|
+
},
|
|
98
|
+
fromPartial(object) {
|
|
99
|
+
var _a;
|
|
100
|
+
const message = Object.assign({}, basePrivKey);
|
|
101
|
+
message.key = (_a = object.key) !== null && _a !== void 0 ? _a : new Uint8Array();
|
|
102
|
+
return message;
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
var globalThis = (() => {
|
|
106
|
+
if (typeof globalThis !== "undefined")
|
|
107
|
+
return globalThis;
|
|
108
|
+
if (typeof self !== "undefined")
|
|
109
|
+
return self;
|
|
110
|
+
if (typeof window !== "undefined")
|
|
111
|
+
return window;
|
|
112
|
+
if (typeof global !== "undefined")
|
|
113
|
+
return global;
|
|
114
|
+
throw "Unable to locate global object";
|
|
115
|
+
})();
|
|
116
|
+
const atob = globalThis.atob ||
|
|
117
|
+
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
118
|
+
function bytesFromBase64(b64) {
|
|
119
|
+
const bin = atob(b64);
|
|
120
|
+
const arr = new Uint8Array(bin.length);
|
|
121
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
122
|
+
arr[i] = bin.charCodeAt(i);
|
|
123
|
+
}
|
|
124
|
+
return arr;
|
|
125
|
+
}
|
|
126
|
+
const btoa = globalThis.btoa ||
|
|
127
|
+
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
128
|
+
function base64FromBytes(arr) {
|
|
129
|
+
const bin = [];
|
|
130
|
+
for (const byte of arr) {
|
|
131
|
+
bin.push(String.fromCharCode(byte));
|
|
132
|
+
}
|
|
133
|
+
return btoa(bin.join(""));
|
|
134
|
+
}
|
|
135
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
136
|
+
minimal_1.default.util.Long = long_1.default;
|
|
137
|
+
minimal_1.default.configure();
|
|
138
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "ethermint.types.v1";
|
|
4
|
+
/**
|
|
5
|
+
* ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain id,
|
|
6
|
+
* the fee payer as well as its signature data.
|
|
7
|
+
*/
|
|
8
|
+
export interface ExtensionOptionsWeb3Tx {
|
|
9
|
+
/**
|
|
10
|
+
* typed_data_chain_id is used only in EIP712 Domain and should match
|
|
11
|
+
* Ethereum network ID in a Web3 provider (e.g. Metamask).
|
|
12
|
+
*/
|
|
13
|
+
typedDataChainId: Long;
|
|
14
|
+
/**
|
|
15
|
+
* fee_payer is an account address for the fee payer. It will be validated
|
|
16
|
+
* during EIP712 signature checking.
|
|
17
|
+
*/
|
|
18
|
+
feePayer: string;
|
|
19
|
+
/**
|
|
20
|
+
* fee_payer_sig is a signature data from the fee paying account,
|
|
21
|
+
* allows to perform fee delegation when using EIP712 Domain.
|
|
22
|
+
*/
|
|
23
|
+
feePayerSig: Uint8Array;
|
|
24
|
+
}
|
|
25
|
+
export declare const ExtensionOptionsWeb3Tx: {
|
|
26
|
+
encode(message: ExtensionOptionsWeb3Tx, writer?: _m0.Writer): _m0.Writer;
|
|
27
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): ExtensionOptionsWeb3Tx;
|
|
28
|
+
fromJSON(object: any): ExtensionOptionsWeb3Tx;
|
|
29
|
+
toJSON(message: ExtensionOptionsWeb3Tx): unknown;
|
|
30
|
+
fromPartial(object: DeepPartial<ExtensionOptionsWeb3Tx>): ExtensionOptionsWeb3Tx;
|
|
31
|
+
};
|
|
32
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
33
|
+
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
34
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
35
|
+
} : Partial<T>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ExtensionOptionsWeb3Tx = exports.protobufPackage = void 0;
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
const long_1 = __importDefault(require("long"));
|
|
9
|
+
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
10
|
+
exports.protobufPackage = "ethermint.types.v1";
|
|
11
|
+
const baseExtensionOptionsWeb3Tx = {
|
|
12
|
+
typedDataChainId: long_1.default.UZERO,
|
|
13
|
+
feePayer: "",
|
|
14
|
+
};
|
|
15
|
+
exports.ExtensionOptionsWeb3Tx = {
|
|
16
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
17
|
+
if (!message.typedDataChainId.isZero()) {
|
|
18
|
+
writer.uint32(8).uint64(message.typedDataChainId);
|
|
19
|
+
}
|
|
20
|
+
if (message.feePayer !== "") {
|
|
21
|
+
writer.uint32(18).string(message.feePayer);
|
|
22
|
+
}
|
|
23
|
+
if (message.feePayerSig.length !== 0) {
|
|
24
|
+
writer.uint32(26).bytes(message.feePayerSig);
|
|
25
|
+
}
|
|
26
|
+
return writer;
|
|
27
|
+
},
|
|
28
|
+
decode(input, length) {
|
|
29
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
30
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
31
|
+
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
32
|
+
message.feePayerSig = new Uint8Array();
|
|
33
|
+
while (reader.pos < end) {
|
|
34
|
+
const tag = reader.uint32();
|
|
35
|
+
switch (tag >>> 3) {
|
|
36
|
+
case 1:
|
|
37
|
+
message.typedDataChainId = reader.uint64();
|
|
38
|
+
break;
|
|
39
|
+
case 2:
|
|
40
|
+
message.feePayer = reader.string();
|
|
41
|
+
break;
|
|
42
|
+
case 3:
|
|
43
|
+
message.feePayerSig = reader.bytes();
|
|
44
|
+
break;
|
|
45
|
+
default:
|
|
46
|
+
reader.skipType(tag & 7);
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return message;
|
|
51
|
+
},
|
|
52
|
+
fromJSON(object) {
|
|
53
|
+
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
54
|
+
message.typedDataChainId =
|
|
55
|
+
object.typedDataChainId !== undefined && object.typedDataChainId !== null
|
|
56
|
+
? long_1.default.fromString(object.typedDataChainId)
|
|
57
|
+
: long_1.default.UZERO;
|
|
58
|
+
message.feePayer =
|
|
59
|
+
object.feePayer !== undefined && object.feePayer !== null
|
|
60
|
+
? String(object.feePayer)
|
|
61
|
+
: "";
|
|
62
|
+
message.feePayerSig =
|
|
63
|
+
object.feePayerSig !== undefined && object.feePayerSig !== null
|
|
64
|
+
? bytesFromBase64(object.feePayerSig)
|
|
65
|
+
: new Uint8Array();
|
|
66
|
+
return message;
|
|
67
|
+
},
|
|
68
|
+
toJSON(message) {
|
|
69
|
+
const obj = {};
|
|
70
|
+
message.typedDataChainId !== undefined &&
|
|
71
|
+
(obj.typedDataChainId = (message.typedDataChainId || long_1.default.UZERO).toString());
|
|
72
|
+
message.feePayer !== undefined && (obj.feePayer = message.feePayer);
|
|
73
|
+
message.feePayerSig !== undefined &&
|
|
74
|
+
(obj.feePayerSig = base64FromBytes(message.feePayerSig !== undefined
|
|
75
|
+
? message.feePayerSig
|
|
76
|
+
: new Uint8Array()));
|
|
77
|
+
return obj;
|
|
78
|
+
},
|
|
79
|
+
fromPartial(object) {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
82
|
+
message.typedDataChainId =
|
|
83
|
+
object.typedDataChainId !== undefined && object.typedDataChainId !== null
|
|
84
|
+
? long_1.default.fromValue(object.typedDataChainId)
|
|
85
|
+
: long_1.default.UZERO;
|
|
86
|
+
message.feePayer = (_a = object.feePayer) !== null && _a !== void 0 ? _a : "";
|
|
87
|
+
message.feePayerSig = (_b = object.feePayerSig) !== null && _b !== void 0 ? _b : new Uint8Array();
|
|
88
|
+
return message;
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
var globalThis = (() => {
|
|
92
|
+
if (typeof globalThis !== "undefined")
|
|
93
|
+
return globalThis;
|
|
94
|
+
if (typeof self !== "undefined")
|
|
95
|
+
return self;
|
|
96
|
+
if (typeof window !== "undefined")
|
|
97
|
+
return window;
|
|
98
|
+
if (typeof global !== "undefined")
|
|
99
|
+
return global;
|
|
100
|
+
throw "Unable to locate global object";
|
|
101
|
+
})();
|
|
102
|
+
const atob = globalThis.atob ||
|
|
103
|
+
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
104
|
+
function bytesFromBase64(b64) {
|
|
105
|
+
const bin = atob(b64);
|
|
106
|
+
const arr = new Uint8Array(bin.length);
|
|
107
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
108
|
+
arr[i] = bin.charCodeAt(i);
|
|
109
|
+
}
|
|
110
|
+
return arr;
|
|
111
|
+
}
|
|
112
|
+
const btoa = globalThis.btoa ||
|
|
113
|
+
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
114
|
+
function base64FromBytes(arr) {
|
|
115
|
+
const bin = [];
|
|
116
|
+
for (const byte of arr) {
|
|
117
|
+
bin.push(String.fromCharCode(byte));
|
|
118
|
+
}
|
|
119
|
+
return btoa(bin.join(""));
|
|
120
|
+
}
|
|
121
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
122
|
+
minimal_1.default.util.Long = long_1.default;
|
|
123
|
+
minimal_1.default.configure();
|
|
124
|
+
}
|
package/lib/util/fetch.js
CHANGED
package/lib/util/generic.js
CHANGED
|
@@ -22,7 +22,7 @@ const overrideConfig = (defaults, override) => {
|
|
|
22
22
|
continue;
|
|
23
23
|
if (typeof member === "object") {
|
|
24
24
|
// @ts-ignore
|
|
25
|
-
result[key] = exports.overrideConfig(result[key], member);
|
|
25
|
+
result[key] = (0, exports.overrideConfig)(result[key], member);
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
28
|
// @ts-ignore
|
|
@@ -41,7 +41,7 @@ const sortObject = (input) => {
|
|
|
41
41
|
Object.keys(input)
|
|
42
42
|
.sort()
|
|
43
43
|
// @ts-ignore noImplicitAny
|
|
44
|
-
.forEach((key) => (output[key] = exports.sortObject(input[key])));
|
|
44
|
+
.forEach((key) => (output[key] = (0, exports.sortObject)(input[key])));
|
|
45
45
|
return output;
|
|
46
46
|
};
|
|
47
47
|
exports.sortObject = sortObject;
|
|
@@ -56,7 +56,7 @@ exports.appendHexPrefix = appendHexPrefix;
|
|
|
56
56
|
const computeTxHash = (bytes) => {
|
|
57
57
|
if (!bytes)
|
|
58
58
|
return bytes;
|
|
59
|
-
return exports.toTxHash(crypto_1.sha256(bytes));
|
|
59
|
+
return (0, exports.toTxHash)((0, crypto_1.sha256)(bytes));
|
|
60
60
|
};
|
|
61
61
|
exports.computeTxHash = computeTxHash;
|
|
62
62
|
const toTxHash = (bytes) => {
|
package/lib/util/number.js
CHANGED
|
@@ -18,26 +18,26 @@ const parseBN = (input, defaultValue) => {
|
|
|
18
18
|
};
|
|
19
19
|
exports.parseBN = parseBN;
|
|
20
20
|
const bnOrZero = (input, defaultValue = exports.BN_ZERO) => {
|
|
21
|
-
return exports.parseBN(input, defaultValue);
|
|
21
|
+
return (0, exports.parseBN)(input, defaultValue);
|
|
22
22
|
};
|
|
23
23
|
exports.bnOrZero = bnOrZero;
|
|
24
24
|
const toHuman = (value, decimals) => {
|
|
25
25
|
if (value === undefined || value === null)
|
|
26
26
|
return undefined;
|
|
27
|
-
const valueBN = exports.bnOrZero(value);
|
|
27
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
28
28
|
if (!decimals)
|
|
29
29
|
return valueBN; // decimals = 0 or nullish
|
|
30
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
30
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
31
31
|
return valueBN.shiftedBy(decimalsBN.negated().toNumber());
|
|
32
32
|
};
|
|
33
33
|
exports.toHuman = toHuman;
|
|
34
34
|
const toUnitless = (value, decimals) => {
|
|
35
35
|
if (value === undefined || value === null)
|
|
36
36
|
return undefined;
|
|
37
|
-
const valueBN = exports.bnOrZero(value);
|
|
37
|
+
const valueBN = (0, exports.bnOrZero)(value);
|
|
38
38
|
if (!decimals)
|
|
39
39
|
return valueBN; // decimals = 0 or nullish
|
|
40
|
-
const decimalsBN = exports.bnOrZero(decimals);
|
|
40
|
+
const decimalsBN = (0, exports.bnOrZero)(decimals);
|
|
41
41
|
return valueBN.shiftedBy(decimalsBN.toNumber());
|
|
42
42
|
};
|
|
43
43
|
exports.toUnitless = toUnitless;
|
package/lib/util/tx.d.ts
CHANGED
|
@@ -183,6 +183,14 @@ export declare const Types: {
|
|
|
183
183
|
MsgSetOracleSlashEnabled: string;
|
|
184
184
|
MsgSetOracleSlashEnabledResponse: string;
|
|
185
185
|
CreateOracleProposal: string;
|
|
186
|
+
MsgAllianceDelegate: string;
|
|
187
|
+
MsgAllianceDelegateResponse: string;
|
|
188
|
+
MsgAllianceUndelegate: string;
|
|
189
|
+
MsgAllianceUndelegateResponse: string;
|
|
190
|
+
MsgAllianceRedelegate: string;
|
|
191
|
+
MsgAllianceRedelegateResponse: string;
|
|
192
|
+
MsgAllianceClaimDelegationRewards: string;
|
|
193
|
+
MsgAllianceClaimDelegationRewardsResponse: string;
|
|
186
194
|
MsgSoftwareUpgrade: string;
|
|
187
195
|
MsgSoftwareUpgradeResponse: string;
|
|
188
196
|
MsgCancelUpgrade: string;
|
|
@@ -197,34 +205,34 @@ export declare const Types: {
|
|
|
197
205
|
MsgSubmitEvidenceResponse: string;
|
|
198
206
|
MsgNftSend: string;
|
|
199
207
|
MsgNftSendResponse: string;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
208
|
+
MsgGroupCreateGroup: string;
|
|
209
|
+
MsgGroupCreateGroupResponse: string;
|
|
210
|
+
MsgGroupUpdateGroupMembers: string;
|
|
211
|
+
MsgGroupUpdateGroupMembersResponse: string;
|
|
212
|
+
MsgGroupUpdateGroupAdmin: string;
|
|
213
|
+
MsgGroupUpdateGroupAdminResponse: string;
|
|
214
|
+
MsgGroupUpdateGroupMetadata: string;
|
|
215
|
+
MsgGroupUpdateGroupMetadataResponse: string;
|
|
216
|
+
MsgGroupCreateGroupPolicy: string;
|
|
217
|
+
MsgGroupCreateGroupPolicyResponse: string;
|
|
218
|
+
MsgGroupUpdateGroupPolicyAdmin: string;
|
|
219
|
+
MsgGroupCreateGroupWithPolicy: string;
|
|
220
|
+
MsgGroupCreateGroupWithPolicyResponse: string;
|
|
221
|
+
MsgGroupUpdateGroupPolicyAdminResponse: string;
|
|
222
|
+
MsgGroupUpdateGroupPolicyDecisionPolicy: string;
|
|
223
|
+
MsgGroupUpdateGroupPolicyDecisionPolicyResponse: string;
|
|
224
|
+
MsgGroupUpdateGroupPolicyMetadata: string;
|
|
225
|
+
MsgGroupUpdateGroupPolicyMetadataResponse: string;
|
|
218
226
|
MsgGroupSubmitProposal: string;
|
|
219
227
|
MsgGroupSubmitProposalResponse: string;
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
MsgGroupWithdrawProposal: string;
|
|
229
|
+
MsgGroupWithdrawProposalResponse: string;
|
|
222
230
|
MsgGroupVote: string;
|
|
223
231
|
MsgGroupVoteResponse: string;
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
232
|
+
MsgGroupExec: string;
|
|
233
|
+
MsgGroupExecResponse: string;
|
|
234
|
+
MsgGroupLeaveGroup: string;
|
|
235
|
+
MsgGroupLeaveGroupResponse: string;
|
|
228
236
|
MsgSend: string;
|
|
229
237
|
MsgSendResponse: string;
|
|
230
238
|
MsgMultiSend: string;
|
|
@@ -260,17 +268,25 @@ export declare const Types: {
|
|
|
260
268
|
MsgCancelUnbondingDelegationResponse: string;
|
|
261
269
|
ParameterChangeProposal: string;
|
|
262
270
|
MsgGrant: string;
|
|
263
|
-
|
|
264
|
-
|
|
271
|
+
MsgExecResponse: string;
|
|
272
|
+
MsgExec: string;
|
|
265
273
|
MsgGrantResponse: string;
|
|
266
274
|
MsgRevoke: string;
|
|
267
275
|
MsgRevokeResponse: string;
|
|
268
276
|
MsgUnjail: string;
|
|
269
277
|
MsgUnjailResponse: string;
|
|
278
|
+
MsgGovSubmitProposal: string;
|
|
279
|
+
MsgGovSubmitProposalResponse: string;
|
|
280
|
+
MsgGovExecLegacyContent: string;
|
|
281
|
+
MsgGovExecLegacyContentResponse: string;
|
|
282
|
+
MsgGovVote: string;
|
|
283
|
+
MsgGovVoteResponse: string;
|
|
284
|
+
MsgGovVoteWeighted: string;
|
|
285
|
+
MsgGovVoteWeightedResponse: string;
|
|
286
|
+
MsgGovDeposit: string;
|
|
287
|
+
MsgGovDepositResponse: string;
|
|
270
288
|
MsgSubmitProposal: string;
|
|
271
289
|
MsgSubmitProposalResponse: string;
|
|
272
|
-
MsgExecLegacyContent: string;
|
|
273
|
-
MsgExecLegacyContentResponse: string;
|
|
274
290
|
MsgVote: string;
|
|
275
291
|
MsgVoteResponse: string;
|
|
276
292
|
MsgVoteWeighted: string;
|
|
@@ -278,6 +294,7 @@ export declare const Types: {
|
|
|
278
294
|
MsgDeposit: string;
|
|
279
295
|
MsgDepositResponse: string;
|
|
280
296
|
TextProposal: string;
|
|
297
|
+
Proposal: string;
|
|
281
298
|
MsgProcessCrossChainTx: string;
|
|
282
299
|
MsgProcessZionCrossChainTx: string;
|
|
283
300
|
MsgProcessCrossChainTxResponse: string;
|
|
@@ -365,8 +382,8 @@ export declare const Types: {
|
|
|
365
382
|
MsgAddBridgeAddressResponse: string;
|
|
366
383
|
MsgRemoveBridgeAddress: string;
|
|
367
384
|
MsgRemoveBridgeAddressResponse: string;
|
|
368
|
-
|
|
369
|
-
|
|
385
|
+
MsgCreateGroup: string;
|
|
386
|
+
MsgCreateGroupResponse: string;
|
|
370
387
|
MsgUpdateGroup: string;
|
|
371
388
|
MsgUpdateGroupResponse: string;
|
|
372
389
|
MsgRegisterToGroup: string;
|
|
@@ -384,10 +401,10 @@ export declare const Types: {
|
|
|
384
401
|
MsgSetLeverageResponse: string;
|
|
385
402
|
MsgUpdateProfile: string;
|
|
386
403
|
MsgUpdateProfileResponse: string;
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
404
|
+
MsgFeemarketUpdateParams: string;
|
|
405
|
+
MsgFeemarketUpdateParamsResponse: string;
|
|
406
|
+
MsgEvmEthereumTx: string;
|
|
407
|
+
MsgEvmEthereumTxResponse: string;
|
|
391
408
|
MsgEvmUpdateParams: string;
|
|
392
409
|
MsgEvmUpdateParamsResponse: string;
|
|
393
410
|
MsgCreateSubAccount: string;
|
|
@@ -106,9 +106,9 @@ class CarbonLedgerSigner {
|
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
107
|
const account = yield this.retrieveAccount();
|
|
108
108
|
const { pubkey } = account;
|
|
109
|
-
const msg = JSON.stringify(generic_1.sortObject(doc));
|
|
109
|
+
const msg = JSON.stringify((0, generic_1.sortObject)(doc));
|
|
110
110
|
const signBytes = yield this.ledger.sign(msg);
|
|
111
|
-
const signature = amino_1.encodeSecp256k1Signature(pubkey, signBytes);
|
|
111
|
+
const signature = (0, amino_1.encodeSecp256k1Signature)(pubkey, signBytes);
|
|
112
112
|
return {
|
|
113
113
|
signed: doc,
|
|
114
114
|
signature,
|
|
@@ -87,7 +87,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
87
87
|
*/
|
|
88
88
|
sign(signerAddress, messages, fee, memo, signerData) {
|
|
89
89
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
return proto_signing_1.isOfflineDirectSigner(this.signer)
|
|
90
|
+
return (0, proto_signing_1.isOfflineDirectSigner)(this.signer)
|
|
91
91
|
? this.signDirect(signerAddress, messages, fee, memo, signerData)
|
|
92
92
|
: this.signAmino(signerAddress, messages, fee, memo, signerData);
|
|
93
93
|
});
|
|
@@ -99,7 +99,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
99
99
|
if (!accountFromSigner) {
|
|
100
100
|
throw new Error("Failed to retrieve account from signer");
|
|
101
101
|
}
|
|
102
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
102
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
103
103
|
const txBodyEncodeObject = {
|
|
104
104
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
105
105
|
value: Object.assign({ messages: messages, memo: memo }, (timeoutHeight && {
|
|
@@ -108,13 +108,13 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
108
108
|
};
|
|
109
109
|
const txBodyBytes = this.registry.encode(txBodyEncodeObject);
|
|
110
110
|
const gasLimit = math_1.Int53.fromString(fee.gas).toNumber();
|
|
111
|
-
const authInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
112
|
-
const signDoc = proto_signing_1.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
111
|
+
const authInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence }], fee.amount, gasLimit);
|
|
112
|
+
const signDoc = (0, proto_signing_1.makeSignDoc)(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
113
113
|
const { signature, signed } = yield signer.signDirect(signerAddress, signDoc);
|
|
114
114
|
return tx_1.TxRaw.fromPartial({
|
|
115
115
|
bodyBytes: signed.bodyBytes,
|
|
116
116
|
authInfoBytes: signed.authInfoBytes,
|
|
117
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
117
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -125,7 +125,7 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
125
125
|
if (!accountFromSigner) {
|
|
126
126
|
throw new Error("Failed to retrieve account from signer");
|
|
127
127
|
}
|
|
128
|
-
const pubkey = proto_signing_1.encodePubkey(amino_1.encodeSecp256k1Pubkey(accountFromSigner.pubkey));
|
|
128
|
+
const pubkey = (0, proto_signing_1.encodePubkey)((0, amino_1.encodeSecp256k1Pubkey)(accountFromSigner.pubkey));
|
|
129
129
|
const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
130
130
|
const msgs = messages.map((msg) => this.aminoTypes.toAmino(msg));
|
|
131
131
|
const signDoc = makeSignDocAmino(msgs, fee, chainId, memo, accountNumber, sequence, timeoutHeight !== null && timeoutHeight !== void 0 ? timeoutHeight : 0);
|
|
@@ -140,11 +140,11 @@ class CarbonSigningClient extends stargate_1.StargateClient {
|
|
|
140
140
|
const signedTxBodyBytes = this.registry.encode(signedTxBodyEncodeObject);
|
|
141
141
|
const signedGasLimit = math_1.Int53.fromString(signed.fee.gas).toNumber();
|
|
142
142
|
const signedSequence = math_1.Int53.fromString(signed.sequence).toNumber();
|
|
143
|
-
const signedAuthInfoBytes = proto_signing_1.makeAuthInfoBytes([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
143
|
+
const signedAuthInfoBytes = (0, proto_signing_1.makeAuthInfoBytes)([{ pubkey, sequence: signedSequence }], signed.fee.amount, signedGasLimit, signMode);
|
|
144
144
|
return tx_1.TxRaw.fromPartial({
|
|
145
145
|
bodyBytes: signedTxBodyBytes,
|
|
146
146
|
authInfoBytes: signedAuthInfoBytes,
|
|
147
|
-
signatures: [encoding_1.fromBase64(signature.signature)],
|
|
147
|
+
signatures: [(0, encoding_1.fromBase64)(signature.signature)],
|
|
148
148
|
});
|
|
149
149
|
});
|
|
150
150
|
}
|