carbon-js-sdk 0.4.19 → 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/TokenClient.js +1 -2
- 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/network.js +2 -2
- 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/vault.d.ts +44 -0
- package/lib/modules/vault.js +95 -0
- 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/metamask/legacy-accounts.d.ts +6 -0
- package/lib/provider/metamask/legacy-accounts.js +44 -0
- 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/legacyEIP712.d.ts +20 -0
- package/lib/util/legacyEIP712.js +98 -0
- 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
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
};
|
package/lib/constant/network.js
CHANGED
|
@@ -183,7 +183,7 @@ exports.NetworkConfigs = {
|
|
|
183
183
|
feeURL: `https://dev-fees.carbon.network`,
|
|
184
184
|
feeAddress: "989761fb0c0eb0c05605e849cae77d239f98ac7f",
|
|
185
185
|
eth: {
|
|
186
|
-
rpcURL: "https://eth-
|
|
186
|
+
rpcURL: "https://eth-goerli.g.alchemy.com/v2/OTTRiEhTje49mmrrm4WbuPbZmuZMivEu",
|
|
187
187
|
wsURL: "",
|
|
188
188
|
payerURL: `https://dev-payer.carbon.network`,
|
|
189
189
|
lockProxyAddr: "0x7f7317167e90afa38972e46b031bb4da0b1f6f73",
|
|
@@ -258,7 +258,7 @@ exports.NetworkConfigs = {
|
|
|
258
258
|
feeURL: `http://localhost:9001`,
|
|
259
259
|
feeAddress: "989761fb0c0eb0c05605e849cae77d239f98ac7f",
|
|
260
260
|
eth: {
|
|
261
|
-
rpcURL: "https://
|
|
261
|
+
rpcURL: "https://eth-goerli.g.alchemy.com/v2/OTTRiEhTje49mmrrm4WbuPbZmuZMivEu",
|
|
262
262
|
wsURL: "wss://ropsten.dagger.matic.network",
|
|
263
263
|
payerURL: `http://localhost:8001`,
|
|
264
264
|
bridgeEntranceAddr: "",
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
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;
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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;
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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;
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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;
|
|
@@ -0,0 +1,40 @@
|
|
|
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;
|