carbon-js-sdk 0.4.20 → 0.4.21
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/HydrogenClient.js +1 -1
- package/lib/clients/NEOClient.js +7 -7
- package/lib/clients/TokenClient.js +3 -3
- package/lib/clients/ZILClient.js +17 -17
- 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/ethermint/crypto/v1/ethsecp256k1/export.d.ts +1 -0
- package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.js +6 -0
- package/lib/codec/ethermint/evm/v1/export.d.ts +5 -0
- package/lib/codec/ethermint/evm/v1/export.js +53 -0
- package/lib/codec/ethermint/feemarket/v1/export.d.ts +4 -0
- package/lib/codec/ethermint/feemarket/v1/export.js +18 -0
- package/lib/codec/ethermint/types/v1/export.d.ts +4 -0
- package/lib/codec/ethermint/types/v1/export.js +11 -0
- package/lib/codec/ethermint-models.d.ts +4 -0
- package/lib/codec/ethermint-models.js +26 -0
- package/lib/codec/market/fee.d.ts +123 -0
- package/lib/codec/market/fee.js +334 -0
- package/lib/codec/perpsliquidity/event.d.ts +102 -0
- package/lib/codec/perpsliquidity/event.js +581 -0
- package/lib/codec/perpsliquidity/genesis.d.ts +35 -0
- package/lib/codec/perpsliquidity/genesis.js +162 -0
- package/lib/codec/perpsliquidity/params.d.ts +24 -0
- package/lib/codec/perpsliquidity/params.js +103 -0
- package/lib/codec/perpsliquidity/pool.d.ts +137 -0
- package/lib/codec/perpsliquidity/pool.js +747 -0
- package/lib/codec/perpsliquidity/query.d.ts +167 -0
- package/lib/codec/perpsliquidity/query.js +719 -0
- package/lib/codec/perpsliquidity/tx.d.ts +199 -0
- package/lib/codec/perpsliquidity/tx.js +940 -0
- package/lib/constant/eip712.d.ts +46 -0
- package/lib/constant/eip712.js +106 -0
- package/lib/constant/generic.js +1 -1
- package/lib/constant/network.js +2 -2
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/evm.d.ts +46 -0
- package/lib/modules/evm.js +127 -0
- package/lib/modules/evmmerge.d.ts +12 -0
- package/lib/modules/evmmerge.js +35 -0
- package/lib/modules/feemarket.d.ts +20 -0
- package/lib/modules/feemarket.js +45 -0
- package/lib/modules/gov.js +12 -12
- package/lib/modules/liquiditypool.js +1 -1
- package/lib/modules/vault.d.ts +44 -0
- package/lib/modules/vault.js +95 -0
- 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/evm.d.ts +4 -0
- package/lib/provider/amino/types/evm.js +40 -0
- package/lib/provider/amino/types/evmmerge.d.ts +4 -0
- package/lib/provider/amino/types/evmmerge.js +34 -0
- package/lib/provider/amino/types/feemarket.d.ts +4 -0
- package/lib/provider/amino/types/feemarket.js +34 -0
- 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/metamask/legacy-accounts.d.ts +6 -0
- package/lib/provider/metamask/legacy-accounts.js +44 -0
- 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/eip712.d.ts +10 -0
- package/lib/util/eip712.js +195 -0
- package/lib/util/ethermint.d.ts +8 -0
- package/lib/util/ethermint.js +68 -0
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/legacyEIP712.d.ts +20 -0
- package/lib/util/legacyEIP712.js +98 -0
- package/lib/util/number.js +5 -5
- 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/clients/EvmIbcClient.d.ts +0 -86
- package/lib/clients/EvmIbcClient.js +0 -90
- package/lib/codec/broker/incoming_pool_swap.d.ts +0 -23
- package/lib/codec/broker/incoming_pool_swap.js +0 -136
- package/lib/util/ethermint/evm-ibc.d.ts +0 -97
- package/lib/util/ethermint/evm-ibc.js +0 -134
- package/lib/util/ethermint/index.d.ts +0 -3
- package/lib/util/ethermint/index.js +0 -12
- package/lib/util/ethermint/keys.d.ts +0 -39
- package/lib/util/ethermint/keys.js +0 -138
- package/lib/util/ethermint/web3.d.ts +0 -36
- package/lib/util/ethermint/web3.js +0 -124
|
@@ -1,86 +0,0 @@
|
|
|
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;
|
|
@@ -1,90 +0,0 @@
|
|
|
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;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Long from "long";
|
|
2
|
-
import _m0 from "protobufjs/minimal";
|
|
3
|
-
export declare const protobufPackage = "Switcheo.carbon.broker";
|
|
4
|
-
export interface IncomingPoolSwap {
|
|
5
|
-
poolId: Long;
|
|
6
|
-
market: string;
|
|
7
|
-
tokenATotalInput: string;
|
|
8
|
-
tokenATotalExpectedOutput: string;
|
|
9
|
-
tokenBTotalInput: string;
|
|
10
|
-
tokenBTotalExpectedOutput: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const IncomingPoolSwap: {
|
|
13
|
-
encode(message: IncomingPoolSwap, writer?: _m0.Writer): _m0.Writer;
|
|
14
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): IncomingPoolSwap;
|
|
15
|
-
fromJSON(object: any): IncomingPoolSwap;
|
|
16
|
-
toJSON(message: IncomingPoolSwap): unknown;
|
|
17
|
-
fromPartial(object: DeepPartial<IncomingPoolSwap>): IncomingPoolSwap;
|
|
18
|
-
};
|
|
19
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
20
|
-
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 {} ? {
|
|
21
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
22
|
-
} : Partial<T>;
|
|
23
|
-
export {};
|
|
@@ -1,136 +0,0 @@
|
|
|
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.IncomingPoolSwap = 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.broker";
|
|
11
|
-
const baseIncomingPoolSwap = {
|
|
12
|
-
poolId: long_1.default.UZERO,
|
|
13
|
-
market: "",
|
|
14
|
-
tokenATotalInput: "",
|
|
15
|
-
tokenATotalExpectedOutput: "",
|
|
16
|
-
tokenBTotalInput: "",
|
|
17
|
-
tokenBTotalExpectedOutput: "",
|
|
18
|
-
};
|
|
19
|
-
exports.IncomingPoolSwap = {
|
|
20
|
-
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
21
|
-
if (!message.poolId.isZero()) {
|
|
22
|
-
writer.uint32(8).uint64(message.poolId);
|
|
23
|
-
}
|
|
24
|
-
if (message.market !== "") {
|
|
25
|
-
writer.uint32(18).string(message.market);
|
|
26
|
-
}
|
|
27
|
-
if (message.tokenATotalInput !== "") {
|
|
28
|
-
writer.uint32(26).string(message.tokenATotalInput);
|
|
29
|
-
}
|
|
30
|
-
if (message.tokenATotalExpectedOutput !== "") {
|
|
31
|
-
writer.uint32(34).string(message.tokenATotalExpectedOutput);
|
|
32
|
-
}
|
|
33
|
-
if (message.tokenBTotalInput !== "") {
|
|
34
|
-
writer.uint32(42).string(message.tokenBTotalInput);
|
|
35
|
-
}
|
|
36
|
-
if (message.tokenBTotalExpectedOutput !== "") {
|
|
37
|
-
writer.uint32(50).string(message.tokenBTotalExpectedOutput);
|
|
38
|
-
}
|
|
39
|
-
return writer;
|
|
40
|
-
},
|
|
41
|
-
decode(input, length) {
|
|
42
|
-
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
43
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
44
|
-
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
45
|
-
while (reader.pos < end) {
|
|
46
|
-
const tag = reader.uint32();
|
|
47
|
-
switch (tag >>> 3) {
|
|
48
|
-
case 1:
|
|
49
|
-
message.poolId = reader.uint64();
|
|
50
|
-
break;
|
|
51
|
-
case 2:
|
|
52
|
-
message.market = reader.string();
|
|
53
|
-
break;
|
|
54
|
-
case 3:
|
|
55
|
-
message.tokenATotalInput = reader.string();
|
|
56
|
-
break;
|
|
57
|
-
case 4:
|
|
58
|
-
message.tokenATotalExpectedOutput = reader.string();
|
|
59
|
-
break;
|
|
60
|
-
case 5:
|
|
61
|
-
message.tokenBTotalInput = reader.string();
|
|
62
|
-
break;
|
|
63
|
-
case 6:
|
|
64
|
-
message.tokenBTotalExpectedOutput = reader.string();
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
reader.skipType(tag & 7);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return message;
|
|
72
|
-
},
|
|
73
|
-
fromJSON(object) {
|
|
74
|
-
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
75
|
-
message.poolId =
|
|
76
|
-
object.poolId !== undefined && object.poolId !== null
|
|
77
|
-
? long_1.default.fromString(object.poolId)
|
|
78
|
-
: long_1.default.UZERO;
|
|
79
|
-
message.market =
|
|
80
|
-
object.market !== undefined && object.market !== null
|
|
81
|
-
? String(object.market)
|
|
82
|
-
: "";
|
|
83
|
-
message.tokenATotalInput =
|
|
84
|
-
object.tokenATotalInput !== undefined && object.tokenATotalInput !== null
|
|
85
|
-
? String(object.tokenATotalInput)
|
|
86
|
-
: "";
|
|
87
|
-
message.tokenATotalExpectedOutput =
|
|
88
|
-
object.tokenATotalExpectedOutput !== undefined &&
|
|
89
|
-
object.tokenATotalExpectedOutput !== null
|
|
90
|
-
? String(object.tokenATotalExpectedOutput)
|
|
91
|
-
: "";
|
|
92
|
-
message.tokenBTotalInput =
|
|
93
|
-
object.tokenBTotalInput !== undefined && object.tokenBTotalInput !== null
|
|
94
|
-
? String(object.tokenBTotalInput)
|
|
95
|
-
: "";
|
|
96
|
-
message.tokenBTotalExpectedOutput =
|
|
97
|
-
object.tokenBTotalExpectedOutput !== undefined &&
|
|
98
|
-
object.tokenBTotalExpectedOutput !== null
|
|
99
|
-
? String(object.tokenBTotalExpectedOutput)
|
|
100
|
-
: "";
|
|
101
|
-
return message;
|
|
102
|
-
},
|
|
103
|
-
toJSON(message) {
|
|
104
|
-
const obj = {};
|
|
105
|
-
message.poolId !== undefined &&
|
|
106
|
-
(obj.poolId = (message.poolId || long_1.default.UZERO).toString());
|
|
107
|
-
message.market !== undefined && (obj.market = message.market);
|
|
108
|
-
message.tokenATotalInput !== undefined &&
|
|
109
|
-
(obj.tokenATotalInput = message.tokenATotalInput);
|
|
110
|
-
message.tokenATotalExpectedOutput !== undefined &&
|
|
111
|
-
(obj.tokenATotalExpectedOutput = message.tokenATotalExpectedOutput);
|
|
112
|
-
message.tokenBTotalInput !== undefined &&
|
|
113
|
-
(obj.tokenBTotalInput = message.tokenBTotalInput);
|
|
114
|
-
message.tokenBTotalExpectedOutput !== undefined &&
|
|
115
|
-
(obj.tokenBTotalExpectedOutput = message.tokenBTotalExpectedOutput);
|
|
116
|
-
return obj;
|
|
117
|
-
},
|
|
118
|
-
fromPartial(object) {
|
|
119
|
-
var _a, _b, _c, _d, _e;
|
|
120
|
-
const message = Object.assign({}, baseIncomingPoolSwap);
|
|
121
|
-
message.poolId =
|
|
122
|
-
object.poolId !== undefined && object.poolId !== null
|
|
123
|
-
? long_1.default.fromValue(object.poolId)
|
|
124
|
-
: long_1.default.UZERO;
|
|
125
|
-
message.market = (_a = object.market) !== null && _a !== void 0 ? _a : "";
|
|
126
|
-
message.tokenATotalInput = (_b = object.tokenATotalInput) !== null && _b !== void 0 ? _b : "";
|
|
127
|
-
message.tokenATotalExpectedOutput = (_c = object.tokenATotalExpectedOutput) !== null && _c !== void 0 ? _c : "";
|
|
128
|
-
message.tokenBTotalInput = (_d = object.tokenBTotalInput) !== null && _d !== void 0 ? _d : "";
|
|
129
|
-
message.tokenBTotalExpectedOutput = (_e = object.tokenBTotalExpectedOutput) !== null && _e !== void 0 ? _e : "";
|
|
130
|
-
return message;
|
|
131
|
-
},
|
|
132
|
-
};
|
|
133
|
-
if (minimal_1.default.util.Long !== long_1.default) {
|
|
134
|
-
minimal_1.default.util.Long = long_1.default;
|
|
135
|
-
minimal_1.default.configure();
|
|
136
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
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;
|
|
@@ -1,134 +0,0 @@
|
|
|
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;
|
|
@@ -1,12 +0,0 @@
|
|
|
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; } });
|
|
@@ -1,39 +0,0 @@
|
|
|
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 {};
|