carbon-js-sdk 0.4.1 → 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/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,86 @@
|
|
|
1
|
+
import { Network } from "../constant";
|
|
2
|
+
import { StdSignDoc } from "@cosmjs/amino";
|
|
3
|
+
import { BlockchainUtils } from "../util";
|
|
4
|
+
declare type SupportedBlockchains = BlockchainUtils.Blockchain.Canto | BlockchainUtils.Blockchain.Evmos;
|
|
5
|
+
declare namespace EvmIbcClient {
|
|
6
|
+
interface TypedDomain {
|
|
7
|
+
name: string;
|
|
8
|
+
version: string;
|
|
9
|
+
chainId: number;
|
|
10
|
+
verifyingContract: string;
|
|
11
|
+
salt: string;
|
|
12
|
+
}
|
|
13
|
+
interface TypedDataV4 {
|
|
14
|
+
types: object;
|
|
15
|
+
primaryType: string;
|
|
16
|
+
message: StdSignDoc;
|
|
17
|
+
domain: TypedDomain;
|
|
18
|
+
}
|
|
19
|
+
const TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
20
|
+
const DEFAULT_EIP712_TYPES: {
|
|
21
|
+
EIP712Domain: {
|
|
22
|
+
name: string;
|
|
23
|
+
type: string;
|
|
24
|
+
}[];
|
|
25
|
+
Tx: {
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}[];
|
|
29
|
+
Fee: {
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}[];
|
|
33
|
+
Coin: {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
Msg: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
const getEvmChainId: (blockchain: SupportedBlockchains, network?: Network) => 7700 | 9001;
|
|
43
|
+
const getIbcTransferTypes: () => {
|
|
44
|
+
MsgValue: {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
}[];
|
|
48
|
+
TypeToken: {
|
|
49
|
+
name: string;
|
|
50
|
+
type: string;
|
|
51
|
+
}[];
|
|
52
|
+
TypeTimeoutHeight: {
|
|
53
|
+
name: string;
|
|
54
|
+
type: string;
|
|
55
|
+
}[];
|
|
56
|
+
EIP712Domain: {
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
}[];
|
|
60
|
+
Tx: {
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
}[];
|
|
64
|
+
Fee: {
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
}[];
|
|
68
|
+
Coin: {
|
|
69
|
+
name: string;
|
|
70
|
+
type: string;
|
|
71
|
+
}[];
|
|
72
|
+
Msg: {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
}[];
|
|
76
|
+
};
|
|
77
|
+
const getCosmosWeb3Domain: (blockchain: SupportedBlockchains) => {
|
|
78
|
+
name: string;
|
|
79
|
+
version: string;
|
|
80
|
+
chainId: number;
|
|
81
|
+
verifyingContract: string;
|
|
82
|
+
salt: string;
|
|
83
|
+
};
|
|
84
|
+
const getEIP712TypedData: (tx: StdSignDoc, blockchain: SupportedBlockchains, types?: object, domain?: EvmIbcClient.TypedDomain, primaryType?: string) => TypedDataV4;
|
|
85
|
+
}
|
|
86
|
+
export default EvmIbcClient;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constant_1 = require("../constant");
|
|
4
|
+
const util_1 = require("../util");
|
|
5
|
+
const _DEFAULT_EIP712_TYPES = {
|
|
6
|
+
EIP712Domain: [
|
|
7
|
+
{ name: 'name', type: 'string' },
|
|
8
|
+
{ name: 'version', type: 'string' },
|
|
9
|
+
{ name: 'chainId', type: 'uint256' },
|
|
10
|
+
{ name: 'verifyingContract', type: 'string' },
|
|
11
|
+
{ name: 'salt', type: 'string' },
|
|
12
|
+
],
|
|
13
|
+
Tx: [
|
|
14
|
+
{ name: 'account_number', type: 'string' },
|
|
15
|
+
{ name: 'chain_id', type: 'string' },
|
|
16
|
+
{ name: 'fee', type: 'Fee' },
|
|
17
|
+
{ name: 'memo', type: 'string' },
|
|
18
|
+
{ name: 'msgs', type: 'Msg[]' },
|
|
19
|
+
{ name: 'sequence', type: 'string' },
|
|
20
|
+
],
|
|
21
|
+
Fee: [
|
|
22
|
+
{ name: 'feePayer', type: 'string' },
|
|
23
|
+
{ name: 'amount', type: 'Coin[]' },
|
|
24
|
+
{ name: 'gas', type: 'string' },
|
|
25
|
+
],
|
|
26
|
+
Coin: [
|
|
27
|
+
{ name: 'denom', type: 'string' },
|
|
28
|
+
{ name: 'amount', type: 'string' },
|
|
29
|
+
],
|
|
30
|
+
Msg: [
|
|
31
|
+
{ name: 'type', type: 'string' },
|
|
32
|
+
{ name: 'value', type: 'MsgValue' },
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
var EvmIbcClient;
|
|
36
|
+
(function (EvmIbcClient) {
|
|
37
|
+
EvmIbcClient.TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
38
|
+
EvmIbcClient.DEFAULT_EIP712_TYPES = _DEFAULT_EIP712_TYPES;
|
|
39
|
+
EvmIbcClient.getEvmChainId = (blockchain, network = constant_1.Network.MainNet) => {
|
|
40
|
+
switch (network) {
|
|
41
|
+
case constant_1.Network.MainNet:
|
|
42
|
+
switch (blockchain) {
|
|
43
|
+
case util_1.BlockchainUtils.Blockchain.Canto:
|
|
44
|
+
return 7700;
|
|
45
|
+
case util_1.BlockchainUtils.Blockchain.Evmos:
|
|
46
|
+
return 9001;
|
|
47
|
+
default:
|
|
48
|
+
throw new Error("network not supported");
|
|
49
|
+
}
|
|
50
|
+
default:
|
|
51
|
+
throw new Error("network not supported");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
EvmIbcClient.getIbcTransferTypes = () => {
|
|
55
|
+
return Object.assign(Object.assign({}, EvmIbcClient.DEFAULT_EIP712_TYPES), { MsgValue: [
|
|
56
|
+
{ name: 'source_port', type: 'string' },
|
|
57
|
+
{ name: 'source_channel', type: 'string' },
|
|
58
|
+
{ name: 'token', type: 'TypeToken' },
|
|
59
|
+
{ name: 'sender', type: 'string' },
|
|
60
|
+
{ name: 'receiver', type: 'string' },
|
|
61
|
+
{ name: 'timeout_height', type: 'TypeTimeoutHeight' },
|
|
62
|
+
{ name: 'timeout_timestamp', type: 'uint64' },
|
|
63
|
+
], TypeToken: [
|
|
64
|
+
{ name: 'denom', type: 'string' },
|
|
65
|
+
{ name: 'amount', type: 'string' },
|
|
66
|
+
], TypeTimeoutHeight: [
|
|
67
|
+
{ name: 'revision_number', type: 'uint64' },
|
|
68
|
+
{ name: 'revision_height', type: 'uint64' },
|
|
69
|
+
] });
|
|
70
|
+
};
|
|
71
|
+
EvmIbcClient.getCosmosWeb3Domain = (blockchain) => {
|
|
72
|
+
return {
|
|
73
|
+
name: "Cosmos Web3",
|
|
74
|
+
version: "1.0.0",
|
|
75
|
+
chainId: EvmIbcClient.getEvmChainId(blockchain),
|
|
76
|
+
verifyingContract: "cosmos",
|
|
77
|
+
salt: "0",
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
EvmIbcClient.getEIP712TypedData = (tx, blockchain, types = EvmIbcClient.getIbcTransferTypes(), domain = EvmIbcClient.getCosmosWeb3Domain(blockchain), primaryType = "Tx") => {
|
|
81
|
+
const typedData = {
|
|
82
|
+
types,
|
|
83
|
+
primaryType,
|
|
84
|
+
domain,
|
|
85
|
+
message: tx,
|
|
86
|
+
};
|
|
87
|
+
return typedData;
|
|
88
|
+
};
|
|
89
|
+
})(EvmIbcClient || (EvmIbcClient = {}));
|
|
90
|
+
exports.default = EvmIbcClient;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "Switcheo.carbon.crisis";
|
|
4
|
+
/** GenesisState defines the crisis module's genesis state. */
|
|
5
|
+
export interface GenesisState {
|
|
6
|
+
}
|
|
7
|
+
export declare const GenesisState: {
|
|
8
|
+
encode(_: GenesisState, writer?: _m0.Writer): _m0.Writer;
|
|
9
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): GenesisState;
|
|
10
|
+
fromJSON(_: any): GenesisState;
|
|
11
|
+
toJSON(_: GenesisState): unknown;
|
|
12
|
+
fromPartial(_: DeepPartial<GenesisState>): GenesisState;
|
|
13
|
+
};
|
|
14
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
15
|
+
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 {} ? {
|
|
16
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
17
|
+
} : Partial<T>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
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.GenesisState = 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 = "Switcheo.carbon.crisis";
|
|
11
|
+
const baseGenesisState = {};
|
|
12
|
+
exports.GenesisState = {
|
|
13
|
+
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
14
|
+
return writer;
|
|
15
|
+
},
|
|
16
|
+
decode(input, length) {
|
|
17
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
18
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
19
|
+
const message = Object.assign({}, baseGenesisState);
|
|
20
|
+
while (reader.pos < end) {
|
|
21
|
+
const tag = reader.uint32();
|
|
22
|
+
switch (tag >>> 3) {
|
|
23
|
+
default:
|
|
24
|
+
reader.skipType(tag & 7);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return message;
|
|
29
|
+
},
|
|
30
|
+
fromJSON(_) {
|
|
31
|
+
const message = Object.assign({}, baseGenesisState);
|
|
32
|
+
return message;
|
|
33
|
+
},
|
|
34
|
+
toJSON(_) {
|
|
35
|
+
const obj = {};
|
|
36
|
+
return obj;
|
|
37
|
+
},
|
|
38
|
+
fromPartial(_) {
|
|
39
|
+
const message = Object.assign({}, baseGenesisState);
|
|
40
|
+
return message;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
44
|
+
minimal_1.default.util.Long = long_1.default;
|
|
45
|
+
minimal_1.default.configure();
|
|
46
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Long from "long";
|
|
2
|
+
import _m0 from "protobufjs/minimal";
|
|
3
|
+
export declare const protobufPackage = "Switcheo.carbon.crisis";
|
|
4
|
+
/** QueryParamsRequest is request type for the Query/Params RPC method. */
|
|
5
|
+
export interface QueryParamsRequest {
|
|
6
|
+
}
|
|
7
|
+
/** QueryParamsResponse is response type for the Query/Params RPC method. */
|
|
8
|
+
export interface QueryParamsResponse {
|
|
9
|
+
/** params holds all the parameters of this module. */
|
|
10
|
+
params: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const QueryParamsRequest: {
|
|
13
|
+
encode(_: QueryParamsRequest, writer?: _m0.Writer): _m0.Writer;
|
|
14
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): QueryParamsRequest;
|
|
15
|
+
fromJSON(_: any): QueryParamsRequest;
|
|
16
|
+
toJSON(_: QueryParamsRequest): unknown;
|
|
17
|
+
fromPartial(_: DeepPartial<QueryParamsRequest>): QueryParamsRequest;
|
|
18
|
+
};
|
|
19
|
+
export declare const QueryParamsResponse: {
|
|
20
|
+
encode(message: QueryParamsResponse, writer?: _m0.Writer): _m0.Writer;
|
|
21
|
+
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): QueryParamsResponse;
|
|
22
|
+
fromJSON(object: any): QueryParamsResponse;
|
|
23
|
+
toJSON(message: QueryParamsResponse): unknown;
|
|
24
|
+
fromPartial(object: DeepPartial<QueryParamsResponse>): QueryParamsResponse;
|
|
25
|
+
};
|
|
26
|
+
/** Query defines the gRPC querier service. */
|
|
27
|
+
export interface Query {
|
|
28
|
+
/** Parameters queries the crisis parameters. */
|
|
29
|
+
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
30
|
+
}
|
|
31
|
+
export declare class QueryClientImpl implements Query {
|
|
32
|
+
private readonly rpc;
|
|
33
|
+
constructor(rpc: Rpc);
|
|
34
|
+
Params(request: QueryParamsRequest): Promise<QueryParamsResponse>;
|
|
35
|
+
}
|
|
36
|
+
interface Rpc {
|
|
37
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
38
|
+
}
|
|
39
|
+
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
40
|
+
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 {} ? {
|
|
41
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
42
|
+
} : Partial<T>;
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
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.QueryClientImpl = exports.QueryParamsResponse = exports.QueryParamsRequest = 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 = "Switcheo.carbon.crisis";
|
|
11
|
+
const baseQueryParamsRequest = {};
|
|
12
|
+
exports.QueryParamsRequest = {
|
|
13
|
+
encode(_, writer = minimal_1.default.Writer.create()) {
|
|
14
|
+
return writer;
|
|
15
|
+
},
|
|
16
|
+
decode(input, length) {
|
|
17
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
18
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
19
|
+
const message = Object.assign({}, baseQueryParamsRequest);
|
|
20
|
+
while (reader.pos < end) {
|
|
21
|
+
const tag = reader.uint32();
|
|
22
|
+
switch (tag >>> 3) {
|
|
23
|
+
default:
|
|
24
|
+
reader.skipType(tag & 7);
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return message;
|
|
29
|
+
},
|
|
30
|
+
fromJSON(_) {
|
|
31
|
+
const message = Object.assign({}, baseQueryParamsRequest);
|
|
32
|
+
return message;
|
|
33
|
+
},
|
|
34
|
+
toJSON(_) {
|
|
35
|
+
const obj = {};
|
|
36
|
+
return obj;
|
|
37
|
+
},
|
|
38
|
+
fromPartial(_) {
|
|
39
|
+
const message = Object.assign({}, baseQueryParamsRequest);
|
|
40
|
+
return message;
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const baseQueryParamsResponse = { params: "" };
|
|
44
|
+
exports.QueryParamsResponse = {
|
|
45
|
+
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
46
|
+
if (message.params !== "") {
|
|
47
|
+
writer.uint32(10).string(message.params);
|
|
48
|
+
}
|
|
49
|
+
return writer;
|
|
50
|
+
},
|
|
51
|
+
decode(input, length) {
|
|
52
|
+
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
53
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
54
|
+
const message = Object.assign({}, baseQueryParamsResponse);
|
|
55
|
+
while (reader.pos < end) {
|
|
56
|
+
const tag = reader.uint32();
|
|
57
|
+
switch (tag >>> 3) {
|
|
58
|
+
case 1:
|
|
59
|
+
message.params = reader.string();
|
|
60
|
+
break;
|
|
61
|
+
default:
|
|
62
|
+
reader.skipType(tag & 7);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return message;
|
|
67
|
+
},
|
|
68
|
+
fromJSON(object) {
|
|
69
|
+
const message = Object.assign({}, baseQueryParamsResponse);
|
|
70
|
+
message.params =
|
|
71
|
+
object.params !== undefined && object.params !== null
|
|
72
|
+
? String(object.params)
|
|
73
|
+
: "";
|
|
74
|
+
return message;
|
|
75
|
+
},
|
|
76
|
+
toJSON(message) {
|
|
77
|
+
const obj = {};
|
|
78
|
+
message.params !== undefined && (obj.params = message.params);
|
|
79
|
+
return obj;
|
|
80
|
+
},
|
|
81
|
+
fromPartial(object) {
|
|
82
|
+
var _a;
|
|
83
|
+
const message = Object.assign({}, baseQueryParamsResponse);
|
|
84
|
+
message.params = (_a = object.params) !== null && _a !== void 0 ? _a : "";
|
|
85
|
+
return message;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
class QueryClientImpl {
|
|
89
|
+
constructor(rpc) {
|
|
90
|
+
this.rpc = rpc;
|
|
91
|
+
this.Params = this.Params.bind(this);
|
|
92
|
+
}
|
|
93
|
+
Params(request) {
|
|
94
|
+
const data = exports.QueryParamsRequest.encode(request).finish();
|
|
95
|
+
const promise = this.rpc.request("Switcheo.carbon.crisis.Query", "Params", data);
|
|
96
|
+
return promise.then((data) => exports.QueryParamsResponse.decode(new minimal_1.default.Reader(data)));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.QueryClientImpl = QueryClientImpl;
|
|
100
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
101
|
+
minimal_1.default.util.Long = long_1.default;
|
|
102
|
+
minimal_1.default.configure();
|
|
103
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const protobufPackage = "Switcheo.carbon.crisis";
|
|
2
|
+
/** Msg defines the Msg service. */
|
|
3
|
+
export interface Msg {
|
|
4
|
+
}
|
|
5
|
+
export declare class MsgClientImpl implements Msg {
|
|
6
|
+
private readonly rpc;
|
|
7
|
+
constructor(rpc: Rpc);
|
|
8
|
+
}
|
|
9
|
+
interface Rpc {
|
|
10
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
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.MsgClientImpl = 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 = "Switcheo.carbon.crisis";
|
|
11
|
+
class MsgClientImpl {
|
|
12
|
+
constructor(rpc) {
|
|
13
|
+
this.rpc = rpc;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.MsgClientImpl = MsgClientImpl;
|
|
17
|
+
if (minimal_1.default.util.Long !== long_1.default) {
|
|
18
|
+
minimal_1.default.util.Long = long_1.default;
|
|
19
|
+
minimal_1.default.configure();
|
|
20
|
+
}
|
package/lib/codec/index.d.ts
CHANGED
|
@@ -141,8 +141,8 @@ export declare const TxTypes: {
|
|
|
141
141
|
MsgRevokeAllowanceResponse: string;
|
|
142
142
|
MsgSubmitEvidence: string;
|
|
143
143
|
MsgSubmitEvidenceResponse: string;
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
MsgSendNft: string;
|
|
145
|
+
MsgSendNftResponse: string;
|
|
146
146
|
MsgCreateGroup: string;
|
|
147
147
|
MsgCreateGroupResponse: string;
|
|
148
148
|
MsgUpdateGroupMembers: string;
|
|
@@ -171,8 +171,8 @@ export declare const TxTypes: {
|
|
|
171
171
|
MsgExecResponse: string;
|
|
172
172
|
MsgLeaveGroup: string;
|
|
173
173
|
MsgLeaveGroupResponse: string;
|
|
174
|
-
|
|
175
|
-
|
|
174
|
+
MsgSend: string;
|
|
175
|
+
MsgSendResponse: string;
|
|
176
176
|
MsgMultiSend: string;
|
|
177
177
|
MsgMultiSendResponse: string;
|
|
178
178
|
MsgSetWithdrawAddress: string;
|
package/lib/codec/index.js
CHANGED
|
@@ -648,8 +648,8 @@ exports.TxTypes = {
|
|
|
648
648
|
"MsgRevokeAllowanceResponse": "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse",
|
|
649
649
|
"MsgSubmitEvidence": "/cosmos.evidence.v1beta1.MsgSubmitEvidence",
|
|
650
650
|
"MsgSubmitEvidenceResponse": "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse",
|
|
651
|
-
"
|
|
652
|
-
"
|
|
651
|
+
"MsgSendNft": "/cosmos.nft.v1beta1.MsgSend",
|
|
652
|
+
"MsgSendNftResponse": "/cosmos.nft.v1beta1.MsgSendResponse",
|
|
653
653
|
"MsgCreateGroup": "/cosmos.group.v1.MsgCreateGroup",
|
|
654
654
|
"MsgCreateGroupResponse": "/cosmos.group.v1.MsgCreateGroupResponse",
|
|
655
655
|
"MsgUpdateGroupMembers": "/cosmos.group.v1.MsgUpdateGroupMembers",
|
|
@@ -678,8 +678,8 @@ exports.TxTypes = {
|
|
|
678
678
|
"MsgExecResponse": "/cosmos.group.v1.MsgExecResponse",
|
|
679
679
|
"MsgLeaveGroup": "/cosmos.group.v1.MsgLeaveGroup",
|
|
680
680
|
"MsgLeaveGroupResponse": "/cosmos.group.v1.MsgLeaveGroupResponse",
|
|
681
|
-
"
|
|
682
|
-
"
|
|
681
|
+
"MsgSend": "/cosmos.bank.v1beta1.MsgSend",
|
|
682
|
+
"MsgSendResponse": "/cosmos.bank.v1beta1.MsgSendResponse",
|
|
683
683
|
"MsgMultiSend": "/cosmos.bank.v1beta1.MsgMultiSend",
|
|
684
684
|
"MsgMultiSendResponse": "/cosmos.bank.v1beta1.MsgMultiSendResponse",
|
|
685
685
|
"MsgSetWithdrawAddress": "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { TxRaw } from "../../codec/cosmos/tx/v1beta1/tx";
|
|
2
|
+
import { Network } from "../../constant";
|
|
3
|
+
import { StdFee, StdSignDoc } from "@cosmjs/amino";
|
|
4
|
+
import { EncodeObject, Registry } from "@cosmjs/proto-signing";
|
|
5
|
+
import { Blockchain } from "../blockchain";
|
|
6
|
+
declare type SupportedBlockchains = Blockchain.Canto | Blockchain.Evmos;
|
|
7
|
+
declare namespace EvmIbcHelper {
|
|
8
|
+
interface TypedDomain {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
chainId: number;
|
|
12
|
+
verifyingContract: string;
|
|
13
|
+
salt: string;
|
|
14
|
+
}
|
|
15
|
+
interface TypedDataV4 {
|
|
16
|
+
types: object;
|
|
17
|
+
primaryType: string;
|
|
18
|
+
message: StdSignDoc;
|
|
19
|
+
domain: TypedDomain;
|
|
20
|
+
}
|
|
21
|
+
interface SignFee extends StdFee {
|
|
22
|
+
feePayer: string;
|
|
23
|
+
}
|
|
24
|
+
interface SignDoc extends StdSignDoc {
|
|
25
|
+
fee: SignFee;
|
|
26
|
+
}
|
|
27
|
+
const TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
28
|
+
const DEFAULT_EIP712_TYPES: {
|
|
29
|
+
EIP712Domain: {
|
|
30
|
+
name: string;
|
|
31
|
+
type: string;
|
|
32
|
+
}[];
|
|
33
|
+
Tx: {
|
|
34
|
+
name: string;
|
|
35
|
+
type: string;
|
|
36
|
+
}[];
|
|
37
|
+
Fee: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}[];
|
|
41
|
+
Coin: {
|
|
42
|
+
name: string;
|
|
43
|
+
type: string;
|
|
44
|
+
}[];
|
|
45
|
+
Msg: {
|
|
46
|
+
name: string;
|
|
47
|
+
type: string;
|
|
48
|
+
}[];
|
|
49
|
+
};
|
|
50
|
+
const getEvmChainId: (blockchain: SupportedBlockchains, network?: Network) => 7700 | 9001;
|
|
51
|
+
const getIbcTransferTypes: () => {
|
|
52
|
+
MsgValue: {
|
|
53
|
+
name: string;
|
|
54
|
+
type: string;
|
|
55
|
+
}[];
|
|
56
|
+
TypeToken: {
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
}[];
|
|
60
|
+
TypeTimeoutHeight: {
|
|
61
|
+
name: string;
|
|
62
|
+
type: string;
|
|
63
|
+
}[];
|
|
64
|
+
EIP712Domain: {
|
|
65
|
+
name: string;
|
|
66
|
+
type: string;
|
|
67
|
+
}[];
|
|
68
|
+
Tx: {
|
|
69
|
+
name: string;
|
|
70
|
+
type: string;
|
|
71
|
+
}[];
|
|
72
|
+
Fee: {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
}[];
|
|
76
|
+
Coin: {
|
|
77
|
+
name: string;
|
|
78
|
+
type: string;
|
|
79
|
+
}[];
|
|
80
|
+
Msg: {
|
|
81
|
+
name: string;
|
|
82
|
+
type: string;
|
|
83
|
+
}[];
|
|
84
|
+
};
|
|
85
|
+
const getCosmosWeb3Domain: (blockchain: SupportedBlockchains) => {
|
|
86
|
+
name: string;
|
|
87
|
+
version: string;
|
|
88
|
+
chainId: number;
|
|
89
|
+
verifyingContract: string;
|
|
90
|
+
salt: string;
|
|
91
|
+
};
|
|
92
|
+
const getSignatureExtension: (blockchain: SupportedBlockchains, address: string, signature: Uint8Array) => EncodeObject;
|
|
93
|
+
const getEIP712TypedData: (blockchain: SupportedBlockchains, tx: EvmIbcHelper.SignDoc, types?: object, domain?: EvmIbcHelper.TypedDomain, primaryType?: string) => TypedDataV4;
|
|
94
|
+
const makeSignedTx: (blockchain: SupportedBlockchains, msgs: EncodeObject[], tx: EvmIbcHelper.SignDoc, address: string, publicKey: Uint8Array, signature: Uint8Array, registry: Registry) => TxRaw;
|
|
95
|
+
const registerEthermintCodec: (registry: Registry) => void;
|
|
96
|
+
}
|
|
97
|
+
export default EvmIbcHelper;
|