carbon-js-sdk 0.4.21 → 0.4.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/lib/clients/CarbonQueryClient.js +2 -2
  2. package/lib/clients/ETHClient.js +15 -15
  3. package/lib/clients/EvmIbcClient.d.ts +86 -0
  4. package/lib/clients/EvmIbcClient.js +90 -0
  5. package/lib/clients/HydrogenClient.js +1 -1
  6. package/lib/clients/NEOClient.js +7 -7
  7. package/lib/clients/TokenClient.js +4 -4
  8. package/lib/clients/ZILClient.js +17 -17
  9. package/lib/codec/alliance/alliance.d.ts +65 -0
  10. package/lib/codec/alliance/alliance.js +354 -0
  11. package/lib/codec/alliance/delegations.d.ts +86 -0
  12. package/lib/codec/alliance/delegations.js +489 -0
  13. package/lib/codec/alliance/events.d.ts +61 -0
  14. package/lib/codec/alliance/events.js +403 -0
  15. package/lib/codec/alliance/genesis.d.ts +74 -0
  16. package/lib/codec/alliance/genesis.js +469 -0
  17. package/lib/codec/alliance/gov.d.ts +78 -0
  18. package/lib/codec/alliance/gov.js +380 -0
  19. package/lib/codec/{perpsliquidity → alliance}/params.d.ts +18 -8
  20. package/lib/codec/alliance/params.js +182 -0
  21. package/lib/codec/alliance/query.d.ts +312 -0
  22. package/lib/codec/alliance/query.js +1497 -0
  23. package/lib/codec/alliance/tx.d.ts +111 -0
  24. package/lib/codec/alliance/tx.js +495 -0
  25. package/lib/codec/broker/incoming_pool_swap.d.ts +23 -0
  26. package/lib/codec/broker/incoming_pool_swap.js +136 -0
  27. package/lib/codec/cosmos/gov/v1/query.js +2 -2
  28. package/lib/codec/cosmos/gov/v1/tx.js +2 -2
  29. package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
  30. package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
  31. package/lib/codec/cosmos/group/v1/events.js +2 -2
  32. package/lib/codec/cosmos/group/v1/tx.js +4 -4
  33. package/lib/codec/cosmos/tx/v1beta1/tx.js +4 -4
  34. package/lib/codec/google/protobuf/any.d.ts +4 -1
  35. package/lib/codec/google/protobuf/timestamp.d.ts +0 -2
  36. package/lib/codec/index.d.ts +58 -35
  37. package/lib/codec/index.js +788 -697
  38. package/lib/constant/generic.js +1 -1
  39. package/lib/modules/cdp.js +43 -43
  40. package/lib/modules/cosmwasm.js +1 -1
  41. package/lib/modules/gov.js +12 -12
  42. package/lib/modules/liquiditypool.js +1 -1
  43. package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
  44. package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
  45. package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
  46. package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
  47. package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
  48. package/lib/provider/amino/types/admin.js +27 -27
  49. package/lib/provider/amino/types/bank.js +1 -1
  50. package/lib/provider/amino/types/broker.js +1 -1
  51. package/lib/provider/amino/types/cdp.js +25 -25
  52. package/lib/provider/amino/types/coin.js +4 -4
  53. package/lib/provider/amino/types/gov.js +4 -4
  54. package/lib/provider/amino/types/ibc.js +1 -1
  55. package/lib/provider/amino/types/leverage.js +1 -1
  56. package/lib/provider/amino/types/liquidityPool.js +7 -7
  57. package/lib/provider/amino/types/market.js +2 -2
  58. package/lib/provider/amino/types/oracle.js +1 -1
  59. package/lib/provider/amino/types/order.js +4 -4
  60. package/lib/provider/amino/types/position.js +1 -1
  61. package/lib/provider/amino/types/profile.js +1 -1
  62. package/lib/provider/amino/types/staking.js +4 -4
  63. package/lib/provider/amino/types/subaccount.js +3 -3
  64. package/lib/provider/amino/utils.js +11 -11
  65. package/lib/provider/ledger/ledger.js +2 -2
  66. package/lib/provider/metamask/MetaMask.js +1 -1
  67. package/lib/provider/o3/O3Wallet.js +2 -2
  68. package/lib/util/address.js +13 -13
  69. package/lib/util/api.js +4 -4
  70. package/lib/util/ethermint/evm-ibc.d.ts +97 -0
  71. package/lib/util/ethermint/evm-ibc.js +134 -0
  72. package/lib/util/ethermint/index.d.ts +3 -0
  73. package/lib/util/ethermint/index.js +12 -0
  74. package/lib/util/ethermint/keys.d.ts +39 -0
  75. package/lib/util/ethermint/keys.js +138 -0
  76. package/lib/util/ethermint/web3.d.ts +36 -0
  77. package/lib/util/ethermint/web3.js +124 -0
  78. package/lib/util/fetch.js +1 -1
  79. package/lib/util/generic.js +3 -3
  80. package/lib/util/number.js +5 -5
  81. package/lib/util/tx.d.ts +51 -34
  82. package/lib/wallet/CarbonSigner.js +2 -2
  83. package/lib/wallet/CarbonSigningClient.js +8 -8
  84. package/lib/wallet/CarbonWallet.js +6 -6
  85. package/lib/websocket/connector.js +3 -3
  86. package/package.json +1 -1
  87. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.d.ts +0 -1
  88. package/lib/codec/ethermint/crypto/v1/ethsecp256k1/export.js +0 -6
  89. package/lib/codec/ethermint/evm/v1/export.d.ts +0 -5
  90. package/lib/codec/ethermint/evm/v1/export.js +0 -53
  91. package/lib/codec/ethermint/feemarket/v1/export.d.ts +0 -4
  92. package/lib/codec/ethermint/feemarket/v1/export.js +0 -18
  93. package/lib/codec/ethermint/types/v1/export.d.ts +0 -4
  94. package/lib/codec/ethermint/types/v1/export.js +0 -11
  95. package/lib/codec/ethermint-models.d.ts +0 -4
  96. package/lib/codec/ethermint-models.js +0 -26
  97. package/lib/codec/market/fee.d.ts +0 -123
  98. package/lib/codec/market/fee.js +0 -334
  99. package/lib/codec/perpsliquidity/event.d.ts +0 -102
  100. package/lib/codec/perpsliquidity/event.js +0 -581
  101. package/lib/codec/perpsliquidity/genesis.d.ts +0 -35
  102. package/lib/codec/perpsliquidity/genesis.js +0 -162
  103. package/lib/codec/perpsliquidity/params.js +0 -103
  104. package/lib/codec/perpsliquidity/pool.d.ts +0 -137
  105. package/lib/codec/perpsliquidity/pool.js +0 -747
  106. package/lib/codec/perpsliquidity/query.d.ts +0 -167
  107. package/lib/codec/perpsliquidity/query.js +0 -719
  108. package/lib/codec/perpsliquidity/tx.d.ts +0 -199
  109. package/lib/codec/perpsliquidity/tx.js +0 -940
  110. package/lib/constant/eip712.d.ts +0 -46
  111. package/lib/constant/eip712.js +0 -106
  112. package/lib/modules/evm.d.ts +0 -46
  113. package/lib/modules/evm.js +0 -127
  114. package/lib/modules/evmmerge.d.ts +0 -12
  115. package/lib/modules/evmmerge.js +0 -35
  116. package/lib/modules/feemarket.d.ts +0 -20
  117. package/lib/modules/feemarket.js +0 -45
  118. package/lib/modules/vault.d.ts +0 -44
  119. package/lib/modules/vault.js +0 -95
  120. package/lib/provider/amino/types/evm.d.ts +0 -4
  121. package/lib/provider/amino/types/evm.js +0 -40
  122. package/lib/provider/amino/types/evmmerge.d.ts +0 -4
  123. package/lib/provider/amino/types/evmmerge.js +0 -34
  124. package/lib/provider/amino/types/feemarket.d.ts +0 -4
  125. package/lib/provider/amino/types/feemarket.js +0 -34
  126. package/lib/provider/metamask/legacy-accounts.d.ts +0 -6
  127. package/lib/provider/metamask/legacy-accounts.js +0 -44
  128. package/lib/util/eip712.d.ts +0 -10
  129. package/lib/util/eip712.js +0 -195
  130. package/lib/util/ethermint.d.ts +0 -8
  131. package/lib/util/ethermint.js +0 -68
  132. package/lib/util/legacyEIP712.d.ts +0 -20
  133. package/lib/util/legacyEIP712.js +0 -98
@@ -1,46 +0,0 @@
1
- export declare const LEGACY_DEFAULT_EIP712_TYPES: {
2
- EIP712Domain: {
3
- name: string;
4
- type: string;
5
- }[];
6
- Tx: {
7
- name: string;
8
- type: string;
9
- }[];
10
- Fee: {
11
- name: string;
12
- type: string;
13
- }[];
14
- Coin: {
15
- name: string;
16
- type: string;
17
- }[];
18
- Msg: {
19
- name: string;
20
- type: string;
21
- }[];
22
- };
23
- export declare const DEFAULT_EIP712_TYPES: {
24
- Coin: {
25
- name: string;
26
- type: string;
27
- }[];
28
- EIP712Domain: {
29
- name: string;
30
- type: string;
31
- }[];
32
- Fee: {
33
- name: string;
34
- type: string;
35
- }[];
36
- Tx: {
37
- name: string;
38
- type: string;
39
- }[];
40
- };
41
- export declare const DEFAULT_CARBON_DOMAIN_FIELDS: {
42
- name: string;
43
- version: string;
44
- verifyingContract: string;
45
- salt: string;
46
- };
@@ -1,106 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_CARBON_DOMAIN_FIELDS = exports.DEFAULT_EIP712_TYPES = exports.LEGACY_DEFAULT_EIP712_TYPES = void 0;
4
- exports.LEGACY_DEFAULT_EIP712_TYPES = {
5
- EIP712Domain: [
6
- { name: 'name', type: 'string' },
7
- { name: 'version', type: 'string' },
8
- { name: 'chainId', type: 'uint256' },
9
- { name: 'verifyingContract', type: 'string' },
10
- { name: 'salt', type: 'string' },
11
- ],
12
- Tx: [
13
- { name: 'account_number', type: 'string' },
14
- { name: 'chain_id', type: 'string' },
15
- { name: 'fee', type: 'Fee' },
16
- { name: 'memo', type: 'string' },
17
- { name: 'msgs', type: 'Msg[]' },
18
- { name: 'sequence', type: 'string' },
19
- ],
20
- Fee: [
21
- { name: 'feePayer', type: 'string' },
22
- { name: 'amount', type: 'Coin[]' },
23
- { name: 'gas', type: 'string' },
24
- ],
25
- Coin: [
26
- { name: 'denom', type: 'string' },
27
- { name: 'amount', type: 'string' },
28
- ],
29
- Msg: [
30
- { name: 'type', type: 'string' },
31
- { name: 'value', type: 'MsgValue' },
32
- ],
33
- };
34
- exports.DEFAULT_EIP712_TYPES = {
35
- Coin: [
36
- {
37
- name: 'denom',
38
- type: 'string'
39
- },
40
- {
41
- name: 'amount',
42
- type: 'string'
43
- }
44
- ],
45
- EIP712Domain: [
46
- {
47
- name: 'name',
48
- type: 'string'
49
- },
50
- {
51
- name: 'version',
52
- type: 'string'
53
- },
54
- {
55
- name: 'chainId',
56
- type: 'uint256'
57
- },
58
- {
59
- name: 'verifyingContract',
60
- type: 'string'
61
- },
62
- {
63
- name: 'salt',
64
- type: 'string'
65
- }
66
- ],
67
- Fee: [
68
- {
69
- name: 'amount',
70
- type: 'Coin[]'
71
- },
72
- {
73
- name: 'gas',
74
- type: 'string'
75
- }
76
- ],
77
- Tx: [
78
- {
79
- name: 'account_number',
80
- type: 'string'
81
- },
82
- {
83
- name: 'chain_id',
84
- type: 'string'
85
- },
86
- {
87
- name: 'fee',
88
- type: 'Fee'
89
- },
90
- {
91
- name: 'memo',
92
- type: 'string'
93
- },
94
- {
95
- name: 'sequence',
96
- type: 'string'
97
- },
98
- ]
99
- };
100
- // Note that the chainId field is delibrately omitted because it is dynamic
101
- exports.DEFAULT_CARBON_DOMAIN_FIELDS = {
102
- name: 'Carbon',
103
- version: '1.0.0',
104
- verifyingContract: 'cosmos',
105
- salt: '1',
106
- };
@@ -1,46 +0,0 @@
1
- import { Any } from "../codec";
2
- import { AccessListTx, DynamicFeeTx, LegacyTx } from "../codec/ethermint/evm/v1/tx";
3
- import { CarbonTx } from "../util";
4
- import { ethers } from "ethers";
5
- import BaseModule from "./base";
6
- export declare type TxData = LegacyTx | AccessListTx | DynamicFeeTx;
7
- export declare class EvmModule extends BaseModule {
8
- sendEvmTx(req: ethers.providers.TransactionRequest, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
9
- updateParams(p: EvmModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
10
- }
11
- export declare function constructTxDataAny(req: ethers.providers.TransactionRequest): Any;
12
- export declare namespace EvmModule {
13
- interface UpdateParams {
14
- creator: string;
15
- params: Params;
16
- chainConfig: ChainConfig;
17
- }
18
- interface Params {
19
- evmDenom: string;
20
- enableCreate: boolean;
21
- enableCall: boolean;
22
- extraEIPs: Array<number>;
23
- allowUnprotectedTxs: boolean;
24
- }
25
- interface ChainConfig {
26
- homesteadBlock: number;
27
- daoForkBlock: number;
28
- daoForkSupport: boolean;
29
- eip150Block: number;
30
- eip150Hash: string;
31
- eip155Block: number;
32
- eip158Block: number;
33
- byzantiumBlock: number;
34
- constantinopleBlock: number;
35
- petersburgBlock: number;
36
- istanbulBlock: number;
37
- muirGlacierBlock: number;
38
- berlinBlock: number;
39
- londonBlock: number;
40
- arrowGlacierBlock: number;
41
- grayGlacierBlock: number;
42
- mergeNetsplitBlock: number;
43
- shanghaiBlock: number;
44
- cancunBlock: number;
45
- }
46
- }
@@ -1,127 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.constructTxDataAny = exports.EvmModule = void 0;
16
- const codec_1 = require("../codec");
17
- const evm_1 = require("../codec/ethermint/evm/v1/evm");
18
- const tx_1 = require("../codec/ethermint/evm/v1/tx");
19
- const util_1 = require("../util");
20
- const utils_1 = require("ethers/lib/utils");
21
- const base_1 = __importDefault(require("./base"));
22
- const tx_2 = require("../codec/ethermint/evm/v1/tx");
23
- class EvmModule extends base_1.default {
24
- sendEvmTx(req, opts) {
25
- return __awaiter(this, void 0, void 0, function* () {
26
- const wallet = this.getWallet();
27
- const value = tx_1.MsgEthereumTx.fromPartial({
28
- data: constructTxDataAny(req)
29
- });
30
- return yield wallet.sendTx({
31
- typeUrl: util_1.CarbonTx.Types.MsgEthereumTx,
32
- value,
33
- }, opts);
34
- });
35
- }
36
- updateParams(p, opts) {
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const wallet = this.getWallet();
39
- const value = tx_1.MsgUpdateParams.fromPartial({
40
- authority: p.creator,
41
- params: evm_1.Params.fromPartial({
42
- evmDenom: p.params.evmDenom,
43
- enableCreate: p.params.enableCreate,
44
- enableCall: p.params.enableCall,
45
- extraEips: p.params.extraEIPs,
46
- allowUnprotectedTxs: p.params.allowUnprotectedTxs,
47
- chainConfig: evm_1.ChainConfig.fromPartial({
48
- homesteadBlock: p.chainConfig.homesteadBlock.toString(10),
49
- daoForkBlock: p.chainConfig.daoForkBlock.toString(10),
50
- daoForkSupport: p.chainConfig.daoForkSupport,
51
- eip150Block: p.chainConfig.eip150Block.toString(10),
52
- eip150Hash: p.chainConfig.eip150Hash,
53
- eip155Block: p.chainConfig.eip155Block.toString(10),
54
- eip158Block: p.chainConfig.eip158Block.toString(10),
55
- byzantiumBlock: p.chainConfig.byzantiumBlock.toString(10),
56
- constantinopleBlock: p.chainConfig.constantinopleBlock.toString(10),
57
- petersburgBlock: p.chainConfig.petersburgBlock.toString(10),
58
- istanbulBlock: p.chainConfig.istanbulBlock.toString(10),
59
- muirGlacierBlock: p.chainConfig.muirGlacierBlock.toString(10),
60
- berlinBlock: p.chainConfig.berlinBlock.toString(10),
61
- londonBlock: p.chainConfig.londonBlock.toString(10),
62
- arrowGlacierBlock: p.chainConfig.arrowGlacierBlock.toString(10),
63
- grayGlacierBlock: p.chainConfig.grayGlacierBlock.toString(10),
64
- mergeNetsplitBlock: p.chainConfig.mergeNetsplitBlock.toString(10),
65
- shanghaiBlock: p.chainConfig.shanghaiBlock.toString(10),
66
- cancunBlock: p.chainConfig.cancunBlock.toString(10),
67
- })
68
- })
69
- });
70
- return yield wallet.sendTx({
71
- typeUrl: util_1.CarbonTx.Types.MsgEvmUpdateParams,
72
- value,
73
- }, opts);
74
- });
75
- }
76
- }
77
- exports.EvmModule = EvmModule;
78
- // Referenced from ethermint v0.21.0 Switcheo/ethermint/x/evm/types/msg.go
79
- function constructTxDataAny(req) {
80
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
81
- const accessList = (req === null || req === void 0 ? void 0 : req.accessList) && req.accessList.length > 0;
82
- let txData = tx_1.LegacyTx.fromPartial({});
83
- let txType = "";
84
- if (!accessList) {
85
- txData = tx_1.LegacyTx.fromPartial({
86
- nonce: (_b = (_a = req.nonce) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "0",
87
- to: req.to,
88
- value: (_d = (_c = req.value) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : "0",
89
- gas: (_f = (_e = req.gasLimit) === null || _e === void 0 ? void 0 : _e.toString()) !== null && _f !== void 0 ? _f : "0",
90
- gasPrice: (_h = (_g = req.gasPrice) === null || _g === void 0 ? void 0 : _g.toString()) !== null && _h !== void 0 ? _h : "0",
91
- data: req.data ? utils_1.arrayify(req.data) : undefined,
92
- });
93
- txType = 'LegacyTx';
94
- }
95
- if (accessList && (req === null || req === void 0 ? void 0 : req.maxPriorityFeePerGas) && (req === null || req === void 0 ? void 0 : req.maxFeePerGas)) {
96
- txData = tx_1.DynamicFeeTx.fromPartial({
97
- chainId: (_k = (_j = req.chainId) === null || _j === void 0 ? void 0 : _j.toString()) !== null && _k !== void 0 ? _k : "0",
98
- nonce: (_m = (_l = req.nonce) === null || _l === void 0 ? void 0 : _l.toString()) !== null && _m !== void 0 ? _m : "0",
99
- to: req.to,
100
- value: (_p = (_o = req.value) === null || _o === void 0 ? void 0 : _o.toString()) !== null && _p !== void 0 ? _p : "0",
101
- gas: (_r = (_q = req.gasLimit) === null || _q === void 0 ? void 0 : _q.toString()) !== null && _r !== void 0 ? _r : "0",
102
- gasTipCap: (_t = (_s = req.maxPriorityFeePerGas) === null || _s === void 0 ? void 0 : _s.toString()) !== null && _t !== void 0 ? _t : "0",
103
- gasFeeCap: (_v = (_u = req.maxFeePerGas) === null || _u === void 0 ? void 0 : _u.toString()) !== null && _v !== void 0 ? _v : "0",
104
- data: req.data ? utils_1.arrayify(req.data) : undefined,
105
- accesses: req.accessList ? utils_1.accessListify(req.accessList) : undefined,
106
- });
107
- txType = 'DynamicFeeTx';
108
- }
109
- if (accessList) {
110
- txData = tx_1.AccessListTx.fromPartial({
111
- chainId: (_x = (_w = req.chainId) === null || _w === void 0 ? void 0 : _w.toString()) !== null && _x !== void 0 ? _x : "0",
112
- nonce: (_z = (_y = req.nonce) === null || _y === void 0 ? void 0 : _y.toString()) !== null && _z !== void 0 ? _z : "0",
113
- to: req.to,
114
- value: (_1 = (_0 = req.value) === null || _0 === void 0 ? void 0 : _0.toString()) !== null && _1 !== void 0 ? _1 : "0",
115
- gas: parseInt((_3 = (_2 = req.gasLimit) === null || _2 === void 0 ? void 0 : _2.toString()) !== null && _3 !== void 0 ? _3 : "0", 10),
116
- gasPrice: (_5 = (_4 = req.gasPrice) === null || _4 === void 0 ? void 0 : _4.toString()) !== null && _5 !== void 0 ? _5 : "0",
117
- data: req.data ? utils_1.arrayify(req.data) : undefined,
118
- accesses: req.accessList ? utils_1.accessListify(req.accessList) : undefined,
119
- });
120
- txType = 'AccessListTx';
121
- }
122
- return codec_1.registry.encodeAsAny({
123
- typeUrl: `/${tx_2.protobufPackage}.${txType}`,
124
- value: txData,
125
- });
126
- }
127
- exports.constructTxDataAny = constructTxDataAny;
@@ -1,12 +0,0 @@
1
- import { CarbonTx } from "../util";
2
- import BaseModule from "./base";
3
- export declare class EvmMergeModule extends BaseModule {
4
- mergeAccount(params: EvmMergeModule.MergeAccountParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
5
- }
6
- export declare namespace EvmMergeModule {
7
- interface MergeAccountParams {
8
- creator: string;
9
- pubKey: string;
10
- pubKeySig: string;
11
- }
12
- }
@@ -1,35 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.EvmMergeModule = void 0;
16
- const codec_1 = require("../codec");
17
- const util_1 = require("../util");
18
- const base_1 = __importDefault(require("./base"));
19
- class EvmMergeModule extends base_1.default {
20
- mergeAccount(params, opts) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const wallet = this.getWallet();
23
- const value = codec_1.MsgMergeAccount.fromPartial({
24
- creator: params.creator,
25
- pubKey: params.pubKey,
26
- pubKeySig: params.pubKeySig,
27
- });
28
- return yield wallet.sendTx({
29
- typeUrl: util_1.CarbonTx.Types.MsgMergeAccount,
30
- value,
31
- }, opts);
32
- });
33
- }
34
- }
35
- exports.EvmMergeModule = EvmMergeModule;
@@ -1,20 +0,0 @@
1
- import { CarbonTx } from "../util";
2
- import BigNumber from "bignumber.js";
3
- import BaseModule from "./base";
4
- export declare class FeemarketModule extends BaseModule {
5
- updateParams(params: FeemarketModule.UpdateParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
6
- }
7
- export declare namespace FeemarketModule {
8
- interface UpdateParams {
9
- creator: string;
10
- noBaseFee: boolean;
11
- baseFeeChangeDenominator: number;
12
- elasticityMulitplier: number;
13
- enableHeight: number;
14
- baseFee: BigNumber;
15
- minGasPrice: BigNumber;
16
- minGasMulitplier: number;
17
- gasLimitPerBlock: number;
18
- maxBaseFee: BigNumber;
19
- }
20
- }
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.FeemarketModule = void 0;
16
- const feemarket_1 = require("../codec/ethermint/feemarket/v1/feemarket");
17
- const tx_1 = require("../codec/ethermint/feemarket/v1/tx");
18
- const util_1 = require("../util");
19
- const base_1 = __importDefault(require("./base"));
20
- class FeemarketModule extends base_1.default {
21
- updateParams(params, opts) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const wallet = this.getWallet();
24
- const value = tx_1.MsgUpdateParams.fromPartial({
25
- authority: params.creator,
26
- params: feemarket_1.Params.fromPartial({
27
- noBaseFee: params.noBaseFee,
28
- baseFeeChangeDenominator: params.baseFeeChangeDenominator,
29
- elasticityMultiplier: params.elasticityMulitplier,
30
- enableHeight: params.enableHeight,
31
- baseFee: params.baseFee.toString(10),
32
- minGasPrice: params.minGasPrice.toString(10),
33
- minGasMultiplier: params.minGasMulitplier.toString(10),
34
- gasLimitPerBlock: params.gasLimitPerBlock.toString(10),
35
- maxBaseFee: params.maxBaseFee.toString(10)
36
- })
37
- });
38
- return yield wallet.sendTx({
39
- typeUrl: util_1.CarbonTx.Types.MsgUpdateParams,
40
- value,
41
- }, opts);
42
- });
43
- }
44
- }
45
- exports.FeemarketModule = FeemarketModule;
@@ -1,44 +0,0 @@
1
- /// <reference types="long" />
2
- import { PoolDetails } from "../codec";
3
- import { CarbonTx } from "..";
4
- import BaseModule from "./base";
5
- export declare class VaultModule extends BaseModule {
6
- getPerpPools(): Promise<PoolDetails[]>;
7
- createPerpertualsPool(params: VaultModule.CreatePerpetualPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
8
- updatePerpetualsPool(params: VaultModule.UpdatePerpetualPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
9
- depositToPerpetualsPool(params: VaultModule.DepositToPerpetualsPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
10
- withdrawFromPerpetualsPool(params: VaultModule.WithdrawFromPerpetualsPoolParams, opts?: CarbonTx.SignTxOpts): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
11
- }
12
- export declare namespace VaultModule {
13
- interface CreatePerpetualPoolParams {
14
- creator: string;
15
- name: string;
16
- depositDenom: string;
17
- shareTokenSymbol: string;
18
- supplyCap: string;
19
- depositFeeBps: string;
20
- withdrawalFeeBps: string;
21
- }
22
- interface UpdatePerpetualPoolParams {
23
- creator: string;
24
- name: string;
25
- poolId: Long;
26
- depositDenom: string;
27
- shareTokenSymbol: string;
28
- supplyCap: Long;
29
- depositFeeBps: Long;
30
- withdrawalFeeBps: Long;
31
- }
32
- interface DepositToPerpetualsPoolParams {
33
- creator: string;
34
- poolId: Long;
35
- depositAmount: string;
36
- minShareAmount: string;
37
- }
38
- interface WithdrawFromPerpetualsPoolParams {
39
- creator: string;
40
- poolId: Long;
41
- shareAmount: string;
42
- minReceiveAmount: string;
43
- }
44
- }
@@ -1,95 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.VaultModule = void 0;
16
- const __1 = require("..");
17
- const base_1 = __importDefault(require("./base"));
18
- class VaultModule extends base_1.default {
19
- getPerpPools() {
20
- var _a;
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const fetchDataResponse = yield this.sdkProvider.query.perpetualpool.PoolAll({});
23
- return (_a = fetchDataResponse === null || fetchDataResponse === void 0 ? void 0 : fetchDataResponse.pools) !== null && _a !== void 0 ? _a : [];
24
- });
25
- }
26
- createPerpertualsPool(params, opts) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const wallet = this.getWallet();
29
- const value = __1.Models.MsgCreatePlPool.fromPartial({
30
- creator: params.creator,
31
- name: params.name,
32
- depositDenom: params.depositDenom,
33
- shareTokenSymbol: params.shareTokenSymbol,
34
- supplyCap: params.supplyCap,
35
- depositFeeBps: params.depositFeeBps,
36
- withdrawalFeeBps: params.withdrawalFeeBps,
37
- });
38
- return yield wallet.sendTx({
39
- typeUrl: __1.CarbonTx.Types.MsgCreatePlPool,
40
- value,
41
- }, opts);
42
- });
43
- }
44
- updatePerpetualsPool(params, opts) {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const wallet = this.getWallet();
47
- const updatePoolParam = {
48
- name: params.name,
49
- supplyCap: params.supplyCap,
50
- depositFeeBps: params.depositFeeBps,
51
- withdrawalFeeBps: params.withdrawalFeeBps,
52
- };
53
- const value = __1.Models.MsgUpdatePlPool.fromPartial({
54
- creator: params.creator,
55
- poolId: params.poolId,
56
- updatePoolParams: updatePoolParam,
57
- });
58
- return yield wallet.sendTx({
59
- typeUrl: __1.CarbonTx.Types.MsgUpdatePlPool,
60
- value,
61
- }, opts);
62
- });
63
- }
64
- depositToPerpetualsPool(params, opts) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const wallet = this.getWallet();
67
- const value = __1.Models.MsgDepositToPlPool.fromPartial({
68
- creator: params.creator,
69
- poolId: params.poolId,
70
- depositAmount: params.depositAmount,
71
- minShareAmount: params.minShareAmount,
72
- });
73
- return yield wallet.sendTx({
74
- typeUrl: __1.CarbonTx.Types.MsgDepositToPlPool,
75
- value,
76
- }, opts);
77
- });
78
- }
79
- withdrawFromPerpetualsPool(params, opts) {
80
- return __awaiter(this, void 0, void 0, function* () {
81
- const wallet = this.getWallet();
82
- const value = __1.Models.MsgWithdrawFromPlPool.fromPartial({
83
- creator: params.creator,
84
- poolId: params.poolId,
85
- shareAmount: params.shareAmount,
86
- minReceiveAmount: params.minReceiveAmount,
87
- });
88
- return yield wallet.sendTx({
89
- typeUrl: __1.CarbonTx.Types.MsgWithdrawFromPlPool,
90
- value,
91
- }, opts);
92
- });
93
- }
94
- }
95
- exports.VaultModule = VaultModule;
@@ -1,4 +0,0 @@
1
- import { TypeUtils } from "../../../util";
2
- import { AminoConverter } from "@cosmjs/stargate";
3
- declare const EvmAmino: TypeUtils.SimpleMap<AminoConverter>;
4
- export default EvmAmino;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- const CarbonTx = __importStar(require("../../../util/tx"));
23
- const utils_1 = require("../utils");
24
- const TxTypes = {
25
- UpdateParams: "ethermint/MsgUpdateParams",
26
- EthereumTx: "evm/v1/MsgEthereumTx"
27
- };
28
- const MsgEthereumTx = {
29
- aminoType: TxTypes.EthereumTx,
30
- valueMap: {},
31
- };
32
- const MsgUpdateParams = {
33
- aminoType: TxTypes.UpdateParams,
34
- valueMap: {},
35
- };
36
- const EvmAmino = {
37
- [CarbonTx.Types.MsgEthereumTx]: utils_1.generateAminoType(MsgEthereumTx),
38
- [CarbonTx.Types.MsgEvmUpdateParams]: utils_1.generateAminoType(MsgUpdateParams),
39
- };
40
- exports.default = EvmAmino;
@@ -1,4 +0,0 @@
1
- import { TypeUtils } from "../../../util";
2
- import { AminoConverter } from "@cosmjs/stargate";
3
- declare const EvmMergeAmino: TypeUtils.SimpleMap<AminoConverter>;
4
- export default EvmMergeAmino;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
- Object.defineProperty(o, "default", { enumerable: true, value: v });
11
- }) : function(o, v) {
12
- o["default"] = v;
13
- });
14
- var __importStar = (this && this.__importStar) || function (mod) {
15
- if (mod && mod.__esModule) return mod;
16
- var result = {};
17
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
- __setModuleDefault(result, mod);
19
- return result;
20
- };
21
- Object.defineProperty(exports, "__esModule", { value: true });
22
- const CarbonTx = __importStar(require("../../../util/tx"));
23
- const utils_1 = require("../utils");
24
- const TxTypes = {
25
- MergeAccount: "evmmerge/MsgMergeAccount",
26
- };
27
- const MsgMergeAccount = {
28
- aminoType: TxTypes.MergeAccount,
29
- valueMap: {},
30
- };
31
- const EvmMergeAmino = {
32
- [CarbonTx.Types.MsgMergeAccount]: utils_1.generateAminoType(MsgMergeAccount),
33
- };
34
- exports.default = EvmMergeAmino;