carbon-js-sdk 0.3.47 → 0.3.49

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.
Files changed (78) hide show
  1. package/lib/clients/EvmIbcClient.d.ts +86 -0
  2. package/lib/clients/EvmIbcClient.js +90 -0
  3. package/lib/clients/TokenClient.js +5 -4
  4. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.d.ts +39 -0
  5. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/keys.js +138 -0
  6. package/lib/codec/ethermint/evm/v1/evm.d.ts +239 -0
  7. package/lib/codec/ethermint/evm/v1/evm.js +1140 -0
  8. package/lib/codec/ethermint/evm/v1/genesis.d.ts +43 -0
  9. package/lib/codec/ethermint/evm/v1/genesis.js +153 -0
  10. package/lib/codec/ethermint/evm/v1/query.d.ts +424 -0
  11. package/lib/codec/ethermint/evm/v1/query.js +1637 -0
  12. package/lib/codec/ethermint/evm/v1/tx.d.ts +183 -0
  13. package/lib/codec/ethermint/evm/v1/tx.js +836 -0
  14. package/lib/codec/ethermint/feemarket/v1/feemarket.d.ts +41 -0
  15. package/lib/codec/ethermint/feemarket/v1/feemarket.js +149 -0
  16. package/lib/codec/ethermint/feemarket/v1/genesis.d.ts +26 -0
  17. package/lib/codec/ethermint/feemarket/v1/genesis.js +79 -0
  18. package/lib/codec/ethermint/feemarket/v1/query.d.ts +100 -0
  19. package/lib/codec/ethermint/feemarket/v1/query.js +276 -0
  20. package/lib/codec/ethermint/types/v1/account.d.ts +26 -0
  21. package/lib/codec/ethermint/types/v1/account.js +78 -0
  22. package/lib/codec/ethermint/types/v1/dynamic_fee.d.ts +20 -0
  23. package/lib/codec/ethermint/types/v1/dynamic_fee.js +60 -0
  24. package/lib/codec/ethermint/types/v1/indexer.d.ts +41 -0
  25. package/lib/codec/ethermint/types/v1/indexer.js +153 -0
  26. package/lib/codec/ethermint/types/v1/web3.d.ts +36 -0
  27. package/lib/codec/ethermint/types/v1/web3.js +124 -0
  28. package/lib/codec/evmbank/genesis.d.ts +32 -0
  29. package/lib/codec/evmbank/genesis.js +152 -0
  30. package/lib/codec/evmbank/query.d.ts +40 -0
  31. package/lib/codec/evmbank/query.js +116 -0
  32. package/lib/codec/{liquiditypool/legacy.d.ts → evmmerge/event.d.ts} +11 -9
  33. package/lib/codec/evmmerge/event.js +90 -0
  34. package/lib/codec/evmmerge/genesis.d.ts +48 -0
  35. package/lib/codec/evmmerge/genesis.js +216 -0
  36. package/lib/codec/evmmerge/offchain.d.ts +22 -0
  37. package/lib/codec/evmmerge/offchain.js +105 -0
  38. package/lib/codec/evmmerge/query.d.ts +43 -0
  39. package/lib/codec/evmmerge/query.js +117 -0
  40. package/lib/codec/evmmerge/tx.d.ts +45 -0
  41. package/lib/codec/evmmerge/tx.js +128 -0
  42. package/lib/codec/ibc/applications/fee/v1/ack.d.ts +24 -0
  43. package/lib/codec/ibc/applications/fee/v1/ack.js +125 -0
  44. package/lib/codec/ibc/applications/fee/v1/fee.d.ts +68 -0
  45. package/lib/codec/ibc/applications/fee/v1/fee.js +289 -0
  46. package/lib/codec/ibc/applications/fee/v1/genesis.d.ts +93 -0
  47. package/lib/codec/ibc/applications/fee/v1/genesis.js +390 -0
  48. package/lib/codec/ibc/applications/fee/v1/metadata.d.ts +25 -0
  49. package/lib/codec/ibc/applications/fee/v1/metadata.js +71 -0
  50. package/lib/codec/ibc/applications/fee/v1/query.d.ts +312 -0
  51. package/lib/codec/ibc/applications/fee/v1/query.js +1187 -0
  52. package/lib/codec/ibc/applications/fee/v1/tx.d.ts +171 -0
  53. package/lib/codec/ibc/applications/fee/v1/tx.js +524 -0
  54. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.d.ts +78 -0
  55. package/lib/codec/ibc/applications/interchain_accounts/controller/v1/tx.js +296 -0
  56. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.d.ts +80 -0
  57. package/lib/codec/ibc/applications/interchain_accounts/genesis/v1/genesis.js +439 -0
  58. package/lib/codec/index.d.ts +2 -0
  59. package/lib/codec/index.js +556 -551
  60. package/lib/constant/ibc.d.ts +7 -0
  61. package/lib/constant/ibc.js +84 -37
  62. package/lib/constant/network.js +1 -1
  63. package/lib/modules/index.d.ts +1 -0
  64. package/lib/modules/index.js +1 -0
  65. package/lib/provider/keplr/KeplrStore.js +3 -1
  66. package/lib/util/ethermint/evm-ibc.d.ts +97 -0
  67. package/lib/util/ethermint/evm-ibc.js +134 -0
  68. package/lib/util/ethermint/index.d.ts +3 -0
  69. package/lib/util/ethermint/index.js +12 -0
  70. package/lib/util/ethermint/keys.d.ts +39 -0
  71. package/lib/util/ethermint/keys.js +138 -0
  72. package/lib/util/ethermint/web3.d.ts +36 -0
  73. package/lib/util/ethermint/web3.js +124 -0
  74. package/lib/util/ibc.d.ts +2 -0
  75. package/lib/util/ibc.js +19 -6
  76. package/lib/util/tx.d.ts +1 -0
  77. package/package.json +1 -1
  78. package/lib/codec/liquiditypool/legacy.js +0 -64
@@ -65,9 +65,16 @@ export declare const ibcWhitelist: string[];
65
65
  export declare const EmbedChainInfosInit: SimpleMap<ChainInfoExplorerTmRpc>;
66
66
  export declare type AssetListObj = SimpleMap<SimpleMap<AppCurrency>>;
67
67
  export interface ChannelConfig {
68
+ ibc: ChannelSet;
69
+ cw20?: CosmWasmChannelSet;
70
+ }
71
+ export interface ChannelSet {
68
72
  sourceChannel: string;
69
73
  dstChannel: string;
70
74
  }
75
+ export interface CosmWasmChannelSet extends ChannelSet {
76
+ portId: string;
77
+ }
71
78
  export declare const swthChannels: SimpleMap<ChannelConfig>;
72
79
  export declare const cibtIbcTokenRegex: RegExp;
73
80
  export declare const ibcTokenRegex: RegExp;
@@ -1735,7 +1735,7 @@ exports.EmbedChainInfosInit = {
1735
1735
  explorerUrlToTx: "https://finder.kujira.app/kaiyo-1/tx/{txHash}",
1736
1736
  },
1737
1737
  [ChainIds.Terra2]: {
1738
- rpc: "https://rpc.terrav2.ccvalidators.com/",
1738
+ rpc: "https://terra-rpc.lavenderfive.com:443/",
1739
1739
  rest: "https://phoenix-lcd.terra.dev/",
1740
1740
  chainId: "phoenix-1",
1741
1741
  chainName: "Terra 2.0",
@@ -1756,6 +1756,14 @@ exports.EmbedChainInfosInit = {
1756
1756
  coinDecimals: 6,
1757
1757
  coinGeckoId: "terra-luna-2",
1758
1758
  },
1759
+ {
1760
+ coinDenom: "ampLUNA",
1761
+ coinMinimalDenom: "cw20:terra1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2s5lvsct",
1762
+ coinDecimals: 6,
1763
+ coinGeckoId: "terra-luna-2",
1764
+ type: "cw20",
1765
+ contractAddress: "terra1ecgazyd0waaj3g7l9cmy5gulhxkps2gmxu9ghducvuypjq68mq2s5lvsct",
1766
+ },
1759
1767
  ],
1760
1768
  feeCurrencies: [
1761
1769
  {
@@ -1770,7 +1778,7 @@ exports.EmbedChainInfosInit = {
1770
1778
  },
1771
1779
  },
1772
1780
  ],
1773
- features: ["ibc-transfer", "ibc-go"],
1781
+ features: ["ibc-transfer", "ibc-go", "cosmwasm", "wasmd_0.24+"],
1774
1782
  explorerUrlToTx: "https://finder.terra.money/phoenix-1/tx/{txHash}",
1775
1783
  },
1776
1784
  [ChainIds.Quicksilver]: {
@@ -1992,78 +2000,117 @@ exports.EmbedChainInfosInit = {
1992
2000
  };
1993
2001
  exports.swthChannels = {
1994
2002
  [ChainIds.Osmosis]: {
1995
- sourceChannel: "channel-0",
1996
- dstChannel: "channel-188",
2003
+ ibc: {
2004
+ sourceChannel: "channel-0",
2005
+ dstChannel: "channel-188",
2006
+ },
1997
2007
  },
1998
2008
  [ChainIds.Terra]: {
1999
- sourceChannel: "channel-2",
2000
- dstChannel: "channel-48",
2009
+ ibc: {
2010
+ sourceChannel: "channel-2",
2011
+ dstChannel: "channel-48",
2012
+ },
2001
2013
  },
2002
2014
  [ChainIds.CosmosHub]: {
2003
- sourceChannel: "channel-3",
2004
- dstChannel: "channel-342",
2015
+ ibc: {
2016
+ sourceChannel: "channel-3",
2017
+ dstChannel: "channel-342",
2018
+ },
2005
2019
  },
2006
2020
  [ChainIds.Juno]: {
2007
- sourceChannel: "channel-4",
2008
- dstChannel: "channel-92",
2021
+ ibc: {
2022
+ sourceChannel: "channel-4",
2023
+ dstChannel: "channel-92",
2024
+ },
2009
2025
  },
2010
2026
  [ChainIds.Evmos]: {
2011
- sourceChannel: "channel-6",
2012
- dstChannel: "channel-23",
2027
+ ibc: {
2028
+ sourceChannel: "channel-6",
2029
+ dstChannel: "channel-23",
2030
+ },
2013
2031
  },
2014
2032
  [ChainIds.Axelar]: {
2015
- sourceChannel: "channel-7",
2016
- dstChannel: "channel-37",
2033
+ ibc: {
2034
+ sourceChannel: "channel-7",
2035
+ dstChannel: "channel-37",
2036
+ },
2017
2037
  },
2018
2038
  [ChainIds.Stride]: {
2019
- sourceChannel: "channel-8",
2020
- dstChannel: "channel-47",
2039
+ ibc: {
2040
+ sourceChannel: "channel-8",
2041
+ dstChannel: "channel-47",
2042
+ },
2021
2043
  },
2022
2044
  [ChainIds.Kujira]: {
2023
- sourceChannel: "channel-9",
2024
- dstChannel: "channel-46",
2045
+ ibc: {
2046
+ sourceChannel: "channel-9",
2047
+ dstChannel: "channel-46",
2048
+ },
2025
2049
  },
2026
2050
  [ChainIds.Terra2]: {
2027
- sourceChannel: "channel-12",
2028
- dstChannel: "channel-36",
2051
+ ibc: {
2052
+ sourceChannel: "channel-12",
2053
+ dstChannel: "channel-36",
2054
+ },
2055
+ cw20: {
2056
+ sourceChannel: "channel-16",
2057
+ dstChannel: "channel-41",
2058
+ portId: "terra1e0mrzy8077druuu42vs0hu7ugguade0cj65dgtauyaw4gsl4kv0qtdf2au",
2059
+ },
2029
2060
  },
2030
2061
  [ChainIds.Comdex]: {
2031
- sourceChannel: "channel-11",
2032
- dstChannel: "channel-50",
2062
+ ibc: {
2063
+ sourceChannel: "channel-11",
2064
+ dstChannel: "channel-50",
2065
+ },
2033
2066
  },
2034
2067
  [ChainIds.Quicksilver]: {
2035
- sourceChannel: "channel-17",
2036
- dstChannel: "channel-10",
2068
+ ibc: {
2069
+ sourceChannel: "channel-17",
2070
+ dstChannel: "channel-10",
2071
+ },
2037
2072
  },
2038
2073
  [ChainIds.StafiHub]: {
2039
- sourceChannel: "channel-13",
2040
- dstChannel: "channel-5",
2074
+ ibc: {
2075
+ sourceChannel: "channel-13",
2076
+ dstChannel: "channel-5",
2077
+ },
2041
2078
  },
2042
2079
  [ChainIds.Persistence]: {
2043
- sourceChannel: "channel-14",
2044
- dstChannel: "channel-62",
2080
+ ibc: {
2081
+ sourceChannel: "channel-14",
2082
+ dstChannel: "channel-62",
2083
+ },
2045
2084
  },
2046
2085
  [ChainIds.Stargaze]: {
2047
- sourceChannel: "channel-15",
2048
- dstChannel: "channel-123",
2086
+ ibc: {
2087
+ sourceChannel: "channel-15",
2088
+ dstChannel: "channel-123",
2089
+ },
2049
2090
  },
2050
2091
  [ChainIds.Canto]: {
2051
- sourceChannel: "channel-18",
2052
- dstChannel: "channel-6",
2092
+ ibc: {
2093
+ sourceChannel: "channel-18",
2094
+ dstChannel: "channel-6",
2095
+ },
2053
2096
  },
2054
2097
  [ChainIds.OmniFlixHub]: {
2055
- sourceChannel: "channel-19",
2056
- dstChannel: "channel-24",
2098
+ ibc: {
2099
+ sourceChannel: "channel-19",
2100
+ dstChannel: "channel-24",
2101
+ },
2057
2102
  },
2058
2103
  [ChainIds.Agoric]: {
2059
- sourceChannel: "channel-20",
2060
- dstChannel: "channel-12",
2104
+ ibc: {
2105
+ sourceChannel: "channel-20",
2106
+ dstChannel: "channel-12",
2107
+ },
2061
2108
  },
2062
2109
  };
2063
2110
  exports.cibtIbcTokenRegex = RegExp(`^${token_1.DenomPrefix.CDPToken}/ibc/([a-f\\d]+)$`, "i");
2064
2111
  exports.ibcTokenRegex = /^ibc\/([a-f\d]+)$/i;
2065
2112
  exports.ibcNetworkRegex = /^([a-z\d_-]+)-([\d]+)$/i;
2066
- exports.ibcDefaultGas = 210000;
2113
+ exports.ibcDefaultGas = 300000;
2067
2114
  exports.DefaultGasPriceStep = {
2068
2115
  low: 0.01,
2069
2116
  average: 0.025,
@@ -70,7 +70,7 @@ exports.NetworkConfigs = {
70
70
  zil: {
71
71
  rpcURL: "https://api.zilliqa.com",
72
72
  lockProxyAddr: "0xd73c6b871b4d0e130d64581993b745fc938a5be7",
73
- bridgeEntranceAddr: "0x3fd798e7fc7c5817bae8d06da8050e37ae45a739",
73
+ bridgeEntranceAddr: "0x5d78b51a1ceae202a793f4e87478253f41a22956",
74
74
  chainId: 1,
75
75
  },
76
76
  },
@@ -3,6 +3,7 @@ export * from "./bank";
3
3
  export * from "./broker";
4
4
  export * from "./cdp";
5
5
  export * from "./coin";
6
+ export * from "./cosmwasm";
6
7
  export * from "./gov";
7
8
  export * from "./ibc";
8
9
  export * from "./leverage";
@@ -15,6 +15,7 @@ __exportStar(require("./bank"), exports);
15
15
  __exportStar(require("./broker"), exports);
16
16
  __exportStar(require("./cdp"), exports);
17
17
  __exportStar(require("./coin"), exports);
18
+ __exportStar(require("./cosmwasm"), exports);
18
19
  __exportStar(require("./gov"), exports);
19
20
  __exportStar(require("./ibc"), exports);
20
21
  __exportStar(require("./leverage"), exports);
@@ -78,7 +78,9 @@ class RootStore {
78
78
  }, stores_1.CosmosAccount.use({
79
79
  queriesStore: this.queriesStore,
80
80
  msgOptsCreator: () => ({ ibcTransfer: { gas: ibc_1.ibcDefaultGas } }),
81
- }), stores_1.CosmwasmAccount.use({ queriesStore: this.queriesStore }));
81
+ }), stores_1.CosmwasmAccount.use({
82
+ queriesStore: this.queriesStore,
83
+ }));
82
84
  }
83
85
  }
84
86
  exports.RootStore = RootStore;
@@ -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;
@@ -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,3 @@
1
+ export { PubKey } from "./keys";
2
+ export { ExtensionOptionsWeb3Tx } from "./web3";
3
+ export { default as EvmIbcHelper } from "./evm-ibc";
@@ -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
+ }