carbon-js-sdk 0.4.0 → 0.4.2
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/EvmIbcClient.d.ts +86 -0
- package/lib/clients/EvmIbcClient.js +90 -0
- package/lib/codec/crisis/genesis.d.ts +18 -0
- package/lib/codec/crisis/genesis.js +46 -0
- package/lib/codec/crisis/query.d.ts +43 -0
- package/lib/codec/crisis/query.js +103 -0
- package/lib/codec/crisis/tx.d.ts +12 -0
- package/lib/codec/crisis/tx.js +20 -0
- package/lib/codec/index.d.ts +4 -4
- package/lib/codec/index.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/tx.d.ts +4 -4
- package/lib/websocket/models.d.ts +19 -22
- package/lib/websocket/types.d.ts +2 -0
- package/package.json +1 -1
- package/lib/codec/cosmos/base/store/v1beta1/snapshot.d.ts +0 -45
- package/lib/codec/cosmos/base/store/v1beta1/snapshot.js +0 -246
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tx_1 = require("../../codec/cosmos/tx/v1beta1/tx");
|
|
4
|
+
const constant_1 = require("../../constant");
|
|
5
|
+
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
6
|
+
const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
7
|
+
const blockchain_1 = require("../blockchain");
|
|
8
|
+
const keys_1 = require("./keys");
|
|
9
|
+
const web3_1 = require("./web3");
|
|
10
|
+
const _DEFAULT_EIP712_TYPES = {
|
|
11
|
+
EIP712Domain: [
|
|
12
|
+
{ name: 'name', type: 'string' },
|
|
13
|
+
{ name: 'version', type: 'string' },
|
|
14
|
+
{ name: 'chainId', type: 'uint256' },
|
|
15
|
+
{ name: 'verifyingContract', type: 'string' },
|
|
16
|
+
{ name: 'salt', type: 'string' },
|
|
17
|
+
],
|
|
18
|
+
Tx: [
|
|
19
|
+
{ name: 'account_number', type: 'string' },
|
|
20
|
+
{ name: 'chain_id', type: 'string' },
|
|
21
|
+
{ name: 'fee', type: 'Fee' },
|
|
22
|
+
{ name: 'memo', type: 'string' },
|
|
23
|
+
{ name: 'msgs', type: 'Msg[]' },
|
|
24
|
+
{ name: 'sequence', type: 'string' },
|
|
25
|
+
],
|
|
26
|
+
Fee: [
|
|
27
|
+
{ name: 'feePayer', type: 'string' },
|
|
28
|
+
{ name: 'amount', type: 'Coin[]' },
|
|
29
|
+
{ name: 'gas', type: 'string' },
|
|
30
|
+
],
|
|
31
|
+
Coin: [
|
|
32
|
+
{ name: 'denom', type: 'string' },
|
|
33
|
+
{ name: 'amount', type: 'string' },
|
|
34
|
+
],
|
|
35
|
+
Msg: [
|
|
36
|
+
{ name: 'type', type: 'string' },
|
|
37
|
+
{ name: 'value', type: 'MsgValue' },
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
var EvmIbcHelper;
|
|
41
|
+
(function (EvmIbcHelper) {
|
|
42
|
+
;
|
|
43
|
+
EvmIbcHelper.TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
44
|
+
EvmIbcHelper.DEFAULT_EIP712_TYPES = _DEFAULT_EIP712_TYPES;
|
|
45
|
+
EvmIbcHelper.getEvmChainId = (blockchain, network = constant_1.Network.MainNet) => {
|
|
46
|
+
switch (network) {
|
|
47
|
+
case constant_1.Network.MainNet:
|
|
48
|
+
switch (blockchain) {
|
|
49
|
+
case blockchain_1.Blockchain.Canto:
|
|
50
|
+
return 7700;
|
|
51
|
+
case blockchain_1.Blockchain.Evmos:
|
|
52
|
+
return 9001;
|
|
53
|
+
default:
|
|
54
|
+
throw new Error("network not supported");
|
|
55
|
+
}
|
|
56
|
+
default:
|
|
57
|
+
throw new Error("network not supported");
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
EvmIbcHelper.getIbcTransferTypes = () => {
|
|
61
|
+
return Object.assign(Object.assign({}, EvmIbcHelper.DEFAULT_EIP712_TYPES), { MsgValue: [
|
|
62
|
+
{ name: 'source_port', type: 'string' },
|
|
63
|
+
{ name: 'source_channel', type: 'string' },
|
|
64
|
+
{ name: 'token', type: 'TypeToken' },
|
|
65
|
+
{ name: 'sender', type: 'string' },
|
|
66
|
+
{ name: 'receiver', type: 'string' },
|
|
67
|
+
{ name: 'timeout_height', type: 'TypeTimeoutHeight' },
|
|
68
|
+
{ name: 'timeout_timestamp', type: 'uint64' },
|
|
69
|
+
], TypeToken: [
|
|
70
|
+
{ name: 'denom', type: 'string' },
|
|
71
|
+
{ name: 'amount', type: 'string' },
|
|
72
|
+
], TypeTimeoutHeight: [
|
|
73
|
+
{ name: 'revision_number', type: 'uint64' },
|
|
74
|
+
{ name: 'revision_height', type: 'uint64' },
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
EvmIbcHelper.getCosmosWeb3Domain = (blockchain) => {
|
|
78
|
+
return {
|
|
79
|
+
name: "Cosmos Web3",
|
|
80
|
+
version: "1.0.0",
|
|
81
|
+
chainId: EvmIbcHelper.getEvmChainId(blockchain),
|
|
82
|
+
verifyingContract: "cosmos",
|
|
83
|
+
salt: "0",
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
EvmIbcHelper.getSignatureExtension = (blockchain, address, signature) => {
|
|
87
|
+
return {
|
|
88
|
+
typeUrl: "/ethermint.types.v1.ExtensionOptionsWeb3Tx",
|
|
89
|
+
value: web3_1.ExtensionOptionsWeb3Tx.encode(web3_1.ExtensionOptionsWeb3Tx.fromPartial({
|
|
90
|
+
typedDataChainId: EvmIbcHelper.getEvmChainId(blockchain),
|
|
91
|
+
feePayer: address,
|
|
92
|
+
feePayerSig: signature,
|
|
93
|
+
})).finish(),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
EvmIbcHelper.getEIP712TypedData = (blockchain, tx, types = EvmIbcHelper.getIbcTransferTypes(), domain = EvmIbcHelper.getCosmosWeb3Domain(blockchain), primaryType = "Tx") => {
|
|
97
|
+
const typedData = {
|
|
98
|
+
types,
|
|
99
|
+
primaryType,
|
|
100
|
+
domain,
|
|
101
|
+
message: tx,
|
|
102
|
+
};
|
|
103
|
+
return typedData;
|
|
104
|
+
};
|
|
105
|
+
EvmIbcHelper.makeSignedTx = (blockchain, msgs, tx, address, publicKey, signature, registry) => {
|
|
106
|
+
EvmIbcHelper.registerEthermintCodec(registry);
|
|
107
|
+
const pubkey = registry.encodeAsAny({
|
|
108
|
+
typeUrl: '/ethermint.crypto.v1.ethsecp256k1.PubKey',
|
|
109
|
+
value: keys_1.PubKey.fromPartial({
|
|
110
|
+
key: publicKey,
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
113
|
+
const signatureExtension = EvmIbcHelper.getSignatureExtension(blockchain, address, signature);
|
|
114
|
+
const txBodyBytes = registry.encodeTxBody({
|
|
115
|
+
extensionOptions: [signatureExtension],
|
|
116
|
+
messages: msgs,
|
|
117
|
+
memo: tx.memo,
|
|
118
|
+
});
|
|
119
|
+
const txRaw = tx_1.TxRaw.fromPartial({
|
|
120
|
+
authInfoBytes: proto_signing_1.makeAuthInfoBytes([{
|
|
121
|
+
pubkey,
|
|
122
|
+
sequence: parseInt(tx.sequence),
|
|
123
|
+
}], tx.fee.amount, parseInt(tx.fee.gas), signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON),
|
|
124
|
+
bodyBytes: txBodyBytes,
|
|
125
|
+
signatures: [new Uint8Array()],
|
|
126
|
+
});
|
|
127
|
+
return txRaw;
|
|
128
|
+
};
|
|
129
|
+
EvmIbcHelper.registerEthermintCodec = (registry) => {
|
|
130
|
+
registry.register('/ethermint.types.v1.ExtensionOptionsWeb3Tx', web3_1.ExtensionOptionsWeb3Tx);
|
|
131
|
+
registry.register('/ethermint.crypto.v1.ethsecp256k1.PubKey', keys_1.PubKey);
|
|
132
|
+
};
|
|
133
|
+
})(EvmIbcHelper || (EvmIbcHelper = {}));
|
|
134
|
+
exports.default = EvmIbcHelper;
|
|
@@ -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/tx.d.ts
CHANGED
|
@@ -189,8 +189,8 @@ export declare const Types: {
|
|
|
189
189
|
MsgRevokeAllowanceResponse: string;
|
|
190
190
|
MsgSubmitEvidence: string;
|
|
191
191
|
MsgSubmitEvidenceResponse: string;
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
MsgSendNft: string;
|
|
193
|
+
MsgSendNftResponse: string;
|
|
194
194
|
MsgCreateGroup: string;
|
|
195
195
|
MsgCreateGroupResponse: string;
|
|
196
196
|
MsgUpdateGroupMembers: string;
|
|
@@ -219,8 +219,8 @@ export declare const Types: {
|
|
|
219
219
|
MsgExecResponse: string;
|
|
220
220
|
MsgLeaveGroup: string;
|
|
221
221
|
MsgLeaveGroupResponse: string;
|
|
222
|
-
|
|
223
|
-
|
|
222
|
+
MsgSend: string;
|
|
223
|
+
MsgSendResponse: string;
|
|
224
224
|
MsgMultiSend: string;
|
|
225
225
|
MsgMultiSendResponse: string;
|
|
226
226
|
MsgSetWithdrawAddress: string;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
|
|
3
|
-
block_height: number;
|
|
4
|
-
id: number;
|
|
5
|
-
liquidation?: string;
|
|
6
|
-
maker_address: string;
|
|
7
|
-
maker_fee_amount: string;
|
|
8
|
-
maker_fee_denom: string;
|
|
9
|
-
maker_id: string;
|
|
10
|
-
maker_side: string;
|
|
1
|
+
export interface AccountTrade {
|
|
2
|
+
order_id: string;
|
|
11
3
|
market: string;
|
|
4
|
+
side: string;
|
|
12
5
|
price: string;
|
|
13
6
|
quantity: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
fee_amount: string;
|
|
8
|
+
fee_denom: string;
|
|
9
|
+
address: string;
|
|
10
|
+
block_height: number;
|
|
11
|
+
block_created_at: string;
|
|
12
|
+
trade_id: number;
|
|
19
13
|
}
|
|
20
14
|
export interface HistoryOrder {
|
|
21
15
|
address: string;
|
|
@@ -65,18 +59,12 @@ export interface Candlestick {
|
|
|
65
59
|
quote_volume: string;
|
|
66
60
|
resolution: number;
|
|
67
61
|
}
|
|
68
|
-
export interface
|
|
69
|
-
address: string;
|
|
62
|
+
export interface RecentTrade {
|
|
70
63
|
block_created_at: string;
|
|
71
64
|
block_height: number;
|
|
72
|
-
fee_amount: string;
|
|
73
|
-
fee_denom: string;
|
|
74
65
|
market: string;
|
|
75
|
-
order_id: string;
|
|
76
66
|
price: string;
|
|
77
67
|
quantity: string;
|
|
78
|
-
side: string;
|
|
79
|
-
trade_id: number;
|
|
80
68
|
id?: string;
|
|
81
69
|
liquidation?: string;
|
|
82
70
|
taker_id?: string;
|
|
@@ -195,9 +183,18 @@ export interface CDPParams {
|
|
|
195
183
|
interest_fee: string;
|
|
196
184
|
liquidation_fee: string;
|
|
197
185
|
stablecoin_interest_rate: string;
|
|
186
|
+
stablecoin_mint_cap: string;
|
|
198
187
|
complete_liquidation_threshold: string;
|
|
199
188
|
minimum_close_factor: string;
|
|
200
189
|
small_liquidation_size: string;
|
|
190
|
+
stale_price_grace_period: string;
|
|
191
|
+
cdp_paused: boolean;
|
|
192
|
+
stablecoin_interest_rate_epoch: string;
|
|
193
|
+
stablecoin_interest_rate_adjuster_coefficient?: string;
|
|
194
|
+
}
|
|
195
|
+
export interface StablecoinInterestInfo {
|
|
196
|
+
last_updated_time: string;
|
|
197
|
+
stablecoin_interest_rate: string;
|
|
201
198
|
}
|
|
202
199
|
export interface RateStrategy {
|
|
203
200
|
name: string;
|
package/lib/websocket/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import Long from "long";
|
|
2
|
-
import _m0 from "protobufjs/minimal";
|
|
3
|
-
export declare const protobufPackage = "cosmos.base.store.v1beta1";
|
|
4
|
-
/** SnapshotItem is an item contained in a rootmulti.Store snapshot. */
|
|
5
|
-
export interface SnapshotItem {
|
|
6
|
-
store?: SnapshotStoreItem | undefined;
|
|
7
|
-
iavl?: SnapshotIAVLItem | undefined;
|
|
8
|
-
}
|
|
9
|
-
/** SnapshotStoreItem contains metadata about a snapshotted store. */
|
|
10
|
-
export interface SnapshotStoreItem {
|
|
11
|
-
name: string;
|
|
12
|
-
}
|
|
13
|
-
/** SnapshotIAVLItem is an exported IAVL node. */
|
|
14
|
-
export interface SnapshotIAVLItem {
|
|
15
|
-
key: Uint8Array;
|
|
16
|
-
value: Uint8Array;
|
|
17
|
-
version: Long;
|
|
18
|
-
height: number;
|
|
19
|
-
}
|
|
20
|
-
export declare const SnapshotItem: {
|
|
21
|
-
encode(message: SnapshotItem, writer?: _m0.Writer): _m0.Writer;
|
|
22
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): SnapshotItem;
|
|
23
|
-
fromJSON(object: any): SnapshotItem;
|
|
24
|
-
toJSON(message: SnapshotItem): unknown;
|
|
25
|
-
fromPartial(object: DeepPartial<SnapshotItem>): SnapshotItem;
|
|
26
|
-
};
|
|
27
|
-
export declare const SnapshotStoreItem: {
|
|
28
|
-
encode(message: SnapshotStoreItem, writer?: _m0.Writer): _m0.Writer;
|
|
29
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): SnapshotStoreItem;
|
|
30
|
-
fromJSON(object: any): SnapshotStoreItem;
|
|
31
|
-
toJSON(message: SnapshotStoreItem): unknown;
|
|
32
|
-
fromPartial(object: DeepPartial<SnapshotStoreItem>): SnapshotStoreItem;
|
|
33
|
-
};
|
|
34
|
-
export declare const SnapshotIAVLItem: {
|
|
35
|
-
encode(message: SnapshotIAVLItem, writer?: _m0.Writer): _m0.Writer;
|
|
36
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): SnapshotIAVLItem;
|
|
37
|
-
fromJSON(object: any): SnapshotIAVLItem;
|
|
38
|
-
toJSON(message: SnapshotIAVLItem): unknown;
|
|
39
|
-
fromPartial(object: DeepPartial<SnapshotIAVLItem>): SnapshotIAVLItem;
|
|
40
|
-
};
|
|
41
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
42
|
-
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 {} ? {
|
|
43
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
44
|
-
} : Partial<T>;
|
|
45
|
-
export {};
|