carbon-js-sdk 0.4.2 → 0.4.3-dev.1
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/CarbonSDK.js +1 -1
- package/lib/clients/CarbonQueryClient.js +2 -2
- package/lib/clients/ETHClient.d.ts +11 -4
- package/lib/clients/ETHClient.js +32 -18
- package/lib/clients/HydrogenClient.d.ts +16 -7
- package/lib/clients/HydrogenClient.js +56 -10
- package/lib/clients/NEOClient.d.ts +1 -1
- package/lib/clients/NEOClient.js +15 -10
- package/lib/clients/TokenClient.d.ts +29 -5
- package/lib/clients/TokenClient.js +258 -53
- package/lib/clients/ZILClient.d.ts +1 -1
- package/lib/clients/ZILClient.js +25 -20
- package/lib/codec/cosmos/gov/v1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1/tx.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/query.js +2 -2
- package/lib/codec/cosmos/gov/v1beta1/tx.js +2 -2
- package/lib/codec/cosmos/group/v1/events.js +2 -2
- package/lib/codec/cosmos/group/v1/tx.js +4 -4
- package/lib/codec/cosmos/tx/v1beta1/tx.js +4 -4
- package/lib/constant/generic.js +1 -1
- package/lib/constant/ibc.d.ts +7 -0
- package/lib/constant/ibc.js +4 -1
- package/lib/constant/network.d.ts +2 -0
- package/lib/constant/network.js +5 -1
- package/lib/hydrogen/transfer.d.ts +5 -5
- package/lib/modules/cdp.js +43 -43
- package/lib/modules/cosmwasm.js +1 -1
- package/lib/modules/gov.js +12 -12
- package/lib/modules/ibc.d.ts +5 -1
- package/lib/modules/ibc.js +78 -0
- package/lib/modules/liquiditypool.js +1 -1
- package/lib/provider/account/EthLedgerAccount/EthLedgerAccount.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/ErrorCode.js +1 -1
- package/lib/provider/account/NeoLedgerAccount/N3Ledger/main.js +8 -8
- package/lib/provider/account/NeoLedgerAccount/NeoLedgerAccount.js +3 -3
- package/lib/provider/account/NeoLedgerAccount/NeonLedger.js +1 -1
- package/lib/provider/amino/types/admin.js +27 -27
- package/lib/provider/amino/types/bank.js +1 -1
- package/lib/provider/amino/types/broker.js +1 -1
- package/lib/provider/amino/types/cdp.js +22 -22
- package/lib/provider/amino/types/coin.js +4 -4
- package/lib/provider/amino/types/gov.js +4 -4
- package/lib/provider/amino/types/ibc.js +1 -1
- package/lib/provider/amino/types/leverage.js +1 -1
- package/lib/provider/amino/types/liquidityPool.js +7 -7
- package/lib/provider/amino/types/market.js +1 -1
- package/lib/provider/amino/types/oracle.js +1 -1
- package/lib/provider/amino/types/order.js +4 -4
- package/lib/provider/amino/types/position.js +1 -1
- package/lib/provider/amino/types/profile.js +1 -1
- package/lib/provider/amino/types/staking.js +4 -4
- package/lib/provider/amino/types/subaccount.js +3 -3
- package/lib/provider/amino/utils.js +11 -11
- package/lib/provider/keplr/KeplrStore.d.ts +1 -1
- package/lib/provider/keplr/KeplrStore.js +2 -5
- package/lib/provider/ledger/ledger.js +2 -2
- package/lib/provider/metamask/MetaMask.d.ts +5 -5
- package/lib/provider/metamask/MetaMask.js +37 -37
- package/lib/provider/o3/O3Wallet.js +2 -2
- package/lib/util/address.js +13 -13
- package/lib/util/api.js +4 -4
- package/lib/util/blockchain.d.ts +26 -0
- package/lib/util/blockchain.js +160 -1
- package/lib/util/fetch.js +1 -1
- package/lib/util/generic.js +3 -3
- package/lib/util/ibc.d.ts +4 -3
- package/lib/util/ibc.js +20 -1
- package/lib/util/number.js +5 -5
- package/lib/wallet/CarbonSigner.js +2 -2
- package/lib/wallet/CarbonSigningClient.js +8 -8
- package/lib/wallet/CarbonWallet.js +6 -6
- package/lib/websocket/connector.d.ts +2 -1
- package/lib/websocket/connector.js +7 -9
- package/package.json +1 -1
- package/lib/clients/EvmIbcClient.d.ts +0 -86
- package/lib/clients/EvmIbcClient.js +0 -90
- package/lib/codec/broker/incoming_pool_swap.d.ts +0 -23
- package/lib/codec/broker/incoming_pool_swap.js +0 -136
- package/lib/util/ethermint/evm-ibc.d.ts +0 -97
- package/lib/util/ethermint/evm-ibc.js +0 -134
- package/lib/util/ethermint/index.d.ts +0 -3
- package/lib/util/ethermint/index.js +0 -12
- package/lib/util/ethermint/keys.d.ts +0 -39
- package/lib/util/ethermint/keys.js +0 -138
- package/lib/util/ethermint/web3.d.ts +0 -36
- package/lib/util/ethermint/web3.js +0 -124
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { TxRaw } from "../../codec/cosmos/tx/v1beta1/tx";
|
|
2
|
-
import { Network } from "../../constant";
|
|
3
|
-
import { StdFee, StdSignDoc } from "@cosmjs/amino";
|
|
4
|
-
import { EncodeObject, Registry } from "@cosmjs/proto-signing";
|
|
5
|
-
import { Blockchain } from "../blockchain";
|
|
6
|
-
declare type SupportedBlockchains = Blockchain.Canto | Blockchain.Evmos;
|
|
7
|
-
declare namespace EvmIbcHelper {
|
|
8
|
-
interface TypedDomain {
|
|
9
|
-
name: string;
|
|
10
|
-
version: string;
|
|
11
|
-
chainId: number;
|
|
12
|
-
verifyingContract: string;
|
|
13
|
-
salt: string;
|
|
14
|
-
}
|
|
15
|
-
interface TypedDataV4 {
|
|
16
|
-
types: object;
|
|
17
|
-
primaryType: string;
|
|
18
|
-
message: StdSignDoc;
|
|
19
|
-
domain: TypedDomain;
|
|
20
|
-
}
|
|
21
|
-
interface SignFee extends StdFee {
|
|
22
|
-
feePayer: string;
|
|
23
|
-
}
|
|
24
|
-
interface SignDoc extends StdSignDoc {
|
|
25
|
-
fee: SignFee;
|
|
26
|
-
}
|
|
27
|
-
const TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
28
|
-
const DEFAULT_EIP712_TYPES: {
|
|
29
|
-
EIP712Domain: {
|
|
30
|
-
name: string;
|
|
31
|
-
type: string;
|
|
32
|
-
}[];
|
|
33
|
-
Tx: {
|
|
34
|
-
name: string;
|
|
35
|
-
type: string;
|
|
36
|
-
}[];
|
|
37
|
-
Fee: {
|
|
38
|
-
name: string;
|
|
39
|
-
type: string;
|
|
40
|
-
}[];
|
|
41
|
-
Coin: {
|
|
42
|
-
name: string;
|
|
43
|
-
type: string;
|
|
44
|
-
}[];
|
|
45
|
-
Msg: {
|
|
46
|
-
name: string;
|
|
47
|
-
type: string;
|
|
48
|
-
}[];
|
|
49
|
-
};
|
|
50
|
-
const getEvmChainId: (blockchain: SupportedBlockchains, network?: Network) => 7700 | 9001;
|
|
51
|
-
const getIbcTransferTypes: () => {
|
|
52
|
-
MsgValue: {
|
|
53
|
-
name: string;
|
|
54
|
-
type: string;
|
|
55
|
-
}[];
|
|
56
|
-
TypeToken: {
|
|
57
|
-
name: string;
|
|
58
|
-
type: string;
|
|
59
|
-
}[];
|
|
60
|
-
TypeTimeoutHeight: {
|
|
61
|
-
name: string;
|
|
62
|
-
type: string;
|
|
63
|
-
}[];
|
|
64
|
-
EIP712Domain: {
|
|
65
|
-
name: string;
|
|
66
|
-
type: string;
|
|
67
|
-
}[];
|
|
68
|
-
Tx: {
|
|
69
|
-
name: string;
|
|
70
|
-
type: string;
|
|
71
|
-
}[];
|
|
72
|
-
Fee: {
|
|
73
|
-
name: string;
|
|
74
|
-
type: string;
|
|
75
|
-
}[];
|
|
76
|
-
Coin: {
|
|
77
|
-
name: string;
|
|
78
|
-
type: string;
|
|
79
|
-
}[];
|
|
80
|
-
Msg: {
|
|
81
|
-
name: string;
|
|
82
|
-
type: string;
|
|
83
|
-
}[];
|
|
84
|
-
};
|
|
85
|
-
const getCosmosWeb3Domain: (blockchain: SupportedBlockchains) => {
|
|
86
|
-
name: string;
|
|
87
|
-
version: string;
|
|
88
|
-
chainId: number;
|
|
89
|
-
verifyingContract: string;
|
|
90
|
-
salt: string;
|
|
91
|
-
};
|
|
92
|
-
const getSignatureExtension: (blockchain: SupportedBlockchains, address: string, signature: Uint8Array) => EncodeObject;
|
|
93
|
-
const getEIP712TypedData: (blockchain: SupportedBlockchains, tx: EvmIbcHelper.SignDoc, types?: object, domain?: EvmIbcHelper.TypedDomain, primaryType?: string) => TypedDataV4;
|
|
94
|
-
const makeSignedTx: (blockchain: SupportedBlockchains, msgs: EncodeObject[], tx: EvmIbcHelper.SignDoc, address: string, publicKey: Uint8Array, signature: Uint8Array, registry: Registry) => TxRaw;
|
|
95
|
-
const registerEthermintCodec: (registry: Registry) => void;
|
|
96
|
-
}
|
|
97
|
-
export default EvmIbcHelper;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tx_1 = require("../../codec/cosmos/tx/v1beta1/tx");
|
|
4
|
-
const constant_1 = require("../../constant");
|
|
5
|
-
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
6
|
-
const signing_1 = require("cosmjs-types/cosmos/tx/signing/v1beta1/signing");
|
|
7
|
-
const blockchain_1 = require("../blockchain");
|
|
8
|
-
const keys_1 = require("./keys");
|
|
9
|
-
const web3_1 = require("./web3");
|
|
10
|
-
const _DEFAULT_EIP712_TYPES = {
|
|
11
|
-
EIP712Domain: [
|
|
12
|
-
{ name: 'name', type: 'string' },
|
|
13
|
-
{ name: 'version', type: 'string' },
|
|
14
|
-
{ name: 'chainId', type: 'uint256' },
|
|
15
|
-
{ name: 'verifyingContract', type: 'string' },
|
|
16
|
-
{ name: 'salt', type: 'string' },
|
|
17
|
-
],
|
|
18
|
-
Tx: [
|
|
19
|
-
{ name: 'account_number', type: 'string' },
|
|
20
|
-
{ name: 'chain_id', type: 'string' },
|
|
21
|
-
{ name: 'fee', type: 'Fee' },
|
|
22
|
-
{ name: 'memo', type: 'string' },
|
|
23
|
-
{ name: 'msgs', type: 'Msg[]' },
|
|
24
|
-
{ name: 'sequence', type: 'string' },
|
|
25
|
-
],
|
|
26
|
-
Fee: [
|
|
27
|
-
{ name: 'feePayer', type: 'string' },
|
|
28
|
-
{ name: 'amount', type: 'Coin[]' },
|
|
29
|
-
{ name: 'gas', type: 'string' },
|
|
30
|
-
],
|
|
31
|
-
Coin: [
|
|
32
|
-
{ name: 'denom', type: 'string' },
|
|
33
|
-
{ name: 'amount', type: 'string' },
|
|
34
|
-
],
|
|
35
|
-
Msg: [
|
|
36
|
-
{ name: 'type', type: 'string' },
|
|
37
|
-
{ name: 'value', type: 'MsgValue' },
|
|
38
|
-
],
|
|
39
|
-
};
|
|
40
|
-
var EvmIbcHelper;
|
|
41
|
-
(function (EvmIbcHelper) {
|
|
42
|
-
;
|
|
43
|
-
EvmIbcHelper.TYPED_DATA_REQUEST_METHOD = "eth_signTypedData_v4";
|
|
44
|
-
EvmIbcHelper.DEFAULT_EIP712_TYPES = _DEFAULT_EIP712_TYPES;
|
|
45
|
-
EvmIbcHelper.getEvmChainId = (blockchain, network = constant_1.Network.MainNet) => {
|
|
46
|
-
switch (network) {
|
|
47
|
-
case constant_1.Network.MainNet:
|
|
48
|
-
switch (blockchain) {
|
|
49
|
-
case blockchain_1.Blockchain.Canto:
|
|
50
|
-
return 7700;
|
|
51
|
-
case blockchain_1.Blockchain.Evmos:
|
|
52
|
-
return 9001;
|
|
53
|
-
default:
|
|
54
|
-
throw new Error("network not supported");
|
|
55
|
-
}
|
|
56
|
-
default:
|
|
57
|
-
throw new Error("network not supported");
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
EvmIbcHelper.getIbcTransferTypes = () => {
|
|
61
|
-
return Object.assign(Object.assign({}, EvmIbcHelper.DEFAULT_EIP712_TYPES), { MsgValue: [
|
|
62
|
-
{ name: 'source_port', type: 'string' },
|
|
63
|
-
{ name: 'source_channel', type: 'string' },
|
|
64
|
-
{ name: 'token', type: 'TypeToken' },
|
|
65
|
-
{ name: 'sender', type: 'string' },
|
|
66
|
-
{ name: 'receiver', type: 'string' },
|
|
67
|
-
{ name: 'timeout_height', type: 'TypeTimeoutHeight' },
|
|
68
|
-
{ name: 'timeout_timestamp', type: 'uint64' },
|
|
69
|
-
], TypeToken: [
|
|
70
|
-
{ name: 'denom', type: 'string' },
|
|
71
|
-
{ name: 'amount', type: 'string' },
|
|
72
|
-
], TypeTimeoutHeight: [
|
|
73
|
-
{ name: 'revision_number', type: 'uint64' },
|
|
74
|
-
{ name: 'revision_height', type: 'uint64' },
|
|
75
|
-
] });
|
|
76
|
-
};
|
|
77
|
-
EvmIbcHelper.getCosmosWeb3Domain = (blockchain) => {
|
|
78
|
-
return {
|
|
79
|
-
name: "Cosmos Web3",
|
|
80
|
-
version: "1.0.0",
|
|
81
|
-
chainId: EvmIbcHelper.getEvmChainId(blockchain),
|
|
82
|
-
verifyingContract: "cosmos",
|
|
83
|
-
salt: "0",
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
EvmIbcHelper.getSignatureExtension = (blockchain, address, signature) => {
|
|
87
|
-
return {
|
|
88
|
-
typeUrl: "/ethermint.types.v1.ExtensionOptionsWeb3Tx",
|
|
89
|
-
value: web3_1.ExtensionOptionsWeb3Tx.encode(web3_1.ExtensionOptionsWeb3Tx.fromPartial({
|
|
90
|
-
typedDataChainId: EvmIbcHelper.getEvmChainId(blockchain),
|
|
91
|
-
feePayer: address,
|
|
92
|
-
feePayerSig: signature,
|
|
93
|
-
})).finish(),
|
|
94
|
-
};
|
|
95
|
-
};
|
|
96
|
-
EvmIbcHelper.getEIP712TypedData = (blockchain, tx, types = EvmIbcHelper.getIbcTransferTypes(), domain = EvmIbcHelper.getCosmosWeb3Domain(blockchain), primaryType = "Tx") => {
|
|
97
|
-
const typedData = {
|
|
98
|
-
types,
|
|
99
|
-
primaryType,
|
|
100
|
-
domain,
|
|
101
|
-
message: tx,
|
|
102
|
-
};
|
|
103
|
-
return typedData;
|
|
104
|
-
};
|
|
105
|
-
EvmIbcHelper.makeSignedTx = (blockchain, msgs, tx, address, publicKey, signature, registry) => {
|
|
106
|
-
EvmIbcHelper.registerEthermintCodec(registry);
|
|
107
|
-
const pubkey = registry.encodeAsAny({
|
|
108
|
-
typeUrl: '/ethermint.crypto.v1.ethsecp256k1.PubKey',
|
|
109
|
-
value: keys_1.PubKey.fromPartial({
|
|
110
|
-
key: publicKey,
|
|
111
|
-
}),
|
|
112
|
-
});
|
|
113
|
-
const signatureExtension = EvmIbcHelper.getSignatureExtension(blockchain, address, signature);
|
|
114
|
-
const txBodyBytes = registry.encodeTxBody({
|
|
115
|
-
extensionOptions: [signatureExtension],
|
|
116
|
-
messages: msgs,
|
|
117
|
-
memo: tx.memo,
|
|
118
|
-
});
|
|
119
|
-
const txRaw = tx_1.TxRaw.fromPartial({
|
|
120
|
-
authInfoBytes: proto_signing_1.makeAuthInfoBytes([{
|
|
121
|
-
pubkey,
|
|
122
|
-
sequence: parseInt(tx.sequence),
|
|
123
|
-
}], tx.fee.amount, parseInt(tx.fee.gas), signing_1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON),
|
|
124
|
-
bodyBytes: txBodyBytes,
|
|
125
|
-
signatures: [new Uint8Array()],
|
|
126
|
-
});
|
|
127
|
-
return txRaw;
|
|
128
|
-
};
|
|
129
|
-
EvmIbcHelper.registerEthermintCodec = (registry) => {
|
|
130
|
-
registry.register('/ethermint.types.v1.ExtensionOptionsWeb3Tx', web3_1.ExtensionOptionsWeb3Tx);
|
|
131
|
-
registry.register('/ethermint.crypto.v1.ethsecp256k1.PubKey', keys_1.PubKey);
|
|
132
|
-
};
|
|
133
|
-
})(EvmIbcHelper || (EvmIbcHelper = {}));
|
|
134
|
-
exports.default = EvmIbcHelper;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.EvmIbcHelper = exports.ExtensionOptionsWeb3Tx = exports.PubKey = void 0;
|
|
7
|
-
var keys_1 = require("./keys");
|
|
8
|
-
Object.defineProperty(exports, "PubKey", { enumerable: true, get: function () { return keys_1.PubKey; } });
|
|
9
|
-
var web3_1 = require("./web3");
|
|
10
|
-
Object.defineProperty(exports, "ExtensionOptionsWeb3Tx", { enumerable: true, get: function () { return web3_1.ExtensionOptionsWeb3Tx; } });
|
|
11
|
-
var evm_ibc_1 = require("./evm-ibc");
|
|
12
|
-
Object.defineProperty(exports, "EvmIbcHelper", { enumerable: true, get: function () { return __importDefault(evm_ibc_1).default; } });
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import Long from "long";
|
|
2
|
-
import _m0 from "protobufjs/minimal";
|
|
3
|
-
export declare const protobufPackage = "ethermint.crypto.v1.ethsecp256k1";
|
|
4
|
-
/**
|
|
5
|
-
* PubKey defines a type alias for an ecdsa.PublicKey that implements
|
|
6
|
-
* Tendermint's PubKey interface. It represents the 33-byte compressed public
|
|
7
|
-
* key format.
|
|
8
|
-
*/
|
|
9
|
-
export interface PubKey {
|
|
10
|
-
/** key is the public key in byte form */
|
|
11
|
-
key: Uint8Array;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* PrivKey defines a type alias for an ecdsa.PrivateKey that implements
|
|
15
|
-
* Tendermint's PrivateKey interface.
|
|
16
|
-
*/
|
|
17
|
-
export interface PrivKey {
|
|
18
|
-
/** key is the private key in byte form */
|
|
19
|
-
key: Uint8Array;
|
|
20
|
-
}
|
|
21
|
-
export declare const PubKey: {
|
|
22
|
-
encode(message: PubKey, writer?: _m0.Writer): _m0.Writer;
|
|
23
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PubKey;
|
|
24
|
-
fromJSON(object: any): PubKey;
|
|
25
|
-
toJSON(message: PubKey): unknown;
|
|
26
|
-
fromPartial(object: DeepPartial<PubKey>): PubKey;
|
|
27
|
-
};
|
|
28
|
-
export declare const PrivKey: {
|
|
29
|
-
encode(message: PrivKey, writer?: _m0.Writer): _m0.Writer;
|
|
30
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): PrivKey;
|
|
31
|
-
fromJSON(object: any): PrivKey;
|
|
32
|
-
toJSON(message: PrivKey): unknown;
|
|
33
|
-
fromPartial(object: DeepPartial<PrivKey>): PrivKey;
|
|
34
|
-
};
|
|
35
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
36
|
-
export declare type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
37
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
38
|
-
} : Partial<T>;
|
|
39
|
-
export {};
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.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
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import Long from "long";
|
|
2
|
-
import _m0 from "protobufjs/minimal";
|
|
3
|
-
export declare const protobufPackage = "ethermint.types.v1";
|
|
4
|
-
/**
|
|
5
|
-
* ExtensionOptionsWeb3Tx is an extension option that specifies the typed chain id,
|
|
6
|
-
* the fee payer as well as its signature data.
|
|
7
|
-
*/
|
|
8
|
-
export interface ExtensionOptionsWeb3Tx {
|
|
9
|
-
/**
|
|
10
|
-
* typed_data_chain_id is used only in EIP712 Domain and should match
|
|
11
|
-
* Ethereum network ID in a Web3 provider (e.g. Metamask).
|
|
12
|
-
*/
|
|
13
|
-
typedDataChainId: Long;
|
|
14
|
-
/**
|
|
15
|
-
* fee_payer is an account address for the fee payer. It will be validated
|
|
16
|
-
* during EIP712 signature checking.
|
|
17
|
-
*/
|
|
18
|
-
feePayer: string;
|
|
19
|
-
/**
|
|
20
|
-
* fee_payer_sig is a signature data from the fee paying account,
|
|
21
|
-
* allows to perform fee delegation when using EIP712 Domain.
|
|
22
|
-
*/
|
|
23
|
-
feePayerSig: Uint8Array;
|
|
24
|
-
}
|
|
25
|
-
export declare const ExtensionOptionsWeb3Tx: {
|
|
26
|
-
encode(message: ExtensionOptionsWeb3Tx, writer?: _m0.Writer): _m0.Writer;
|
|
27
|
-
decode(input: _m0.Reader | Uint8Array, length?: number | undefined): ExtensionOptionsWeb3Tx;
|
|
28
|
-
fromJSON(object: any): ExtensionOptionsWeb3Tx;
|
|
29
|
-
toJSON(message: ExtensionOptionsWeb3Tx): unknown;
|
|
30
|
-
fromPartial(object: DeepPartial<ExtensionOptionsWeb3Tx>): ExtensionOptionsWeb3Tx;
|
|
31
|
-
};
|
|
32
|
-
declare type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
33
|
-
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 {} ? {
|
|
34
|
-
[K in keyof T]?: DeepPartial<T[K]>;
|
|
35
|
-
} : Partial<T>;
|
|
36
|
-
export {};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ExtensionOptionsWeb3Tx = 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.types.v1";
|
|
11
|
-
const baseExtensionOptionsWeb3Tx = {
|
|
12
|
-
typedDataChainId: long_1.default.UZERO,
|
|
13
|
-
feePayer: "",
|
|
14
|
-
};
|
|
15
|
-
exports.ExtensionOptionsWeb3Tx = {
|
|
16
|
-
encode(message, writer = minimal_1.default.Writer.create()) {
|
|
17
|
-
if (!message.typedDataChainId.isZero()) {
|
|
18
|
-
writer.uint32(8).uint64(message.typedDataChainId);
|
|
19
|
-
}
|
|
20
|
-
if (message.feePayer !== "") {
|
|
21
|
-
writer.uint32(18).string(message.feePayer);
|
|
22
|
-
}
|
|
23
|
-
if (message.feePayerSig.length !== 0) {
|
|
24
|
-
writer.uint32(26).bytes(message.feePayerSig);
|
|
25
|
-
}
|
|
26
|
-
return writer;
|
|
27
|
-
},
|
|
28
|
-
decode(input, length) {
|
|
29
|
-
const reader = input instanceof minimal_1.default.Reader ? input : new minimal_1.default.Reader(input);
|
|
30
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
31
|
-
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
32
|
-
message.feePayerSig = new Uint8Array();
|
|
33
|
-
while (reader.pos < end) {
|
|
34
|
-
const tag = reader.uint32();
|
|
35
|
-
switch (tag >>> 3) {
|
|
36
|
-
case 1:
|
|
37
|
-
message.typedDataChainId = reader.uint64();
|
|
38
|
-
break;
|
|
39
|
-
case 2:
|
|
40
|
-
message.feePayer = reader.string();
|
|
41
|
-
break;
|
|
42
|
-
case 3:
|
|
43
|
-
message.feePayerSig = reader.bytes();
|
|
44
|
-
break;
|
|
45
|
-
default:
|
|
46
|
-
reader.skipType(tag & 7);
|
|
47
|
-
break;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return message;
|
|
51
|
-
},
|
|
52
|
-
fromJSON(object) {
|
|
53
|
-
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
54
|
-
message.typedDataChainId =
|
|
55
|
-
object.typedDataChainId !== undefined && object.typedDataChainId !== null
|
|
56
|
-
? long_1.default.fromString(object.typedDataChainId)
|
|
57
|
-
: long_1.default.UZERO;
|
|
58
|
-
message.feePayer =
|
|
59
|
-
object.feePayer !== undefined && object.feePayer !== null
|
|
60
|
-
? String(object.feePayer)
|
|
61
|
-
: "";
|
|
62
|
-
message.feePayerSig =
|
|
63
|
-
object.feePayerSig !== undefined && object.feePayerSig !== null
|
|
64
|
-
? bytesFromBase64(object.feePayerSig)
|
|
65
|
-
: new Uint8Array();
|
|
66
|
-
return message;
|
|
67
|
-
},
|
|
68
|
-
toJSON(message) {
|
|
69
|
-
const obj = {};
|
|
70
|
-
message.typedDataChainId !== undefined &&
|
|
71
|
-
(obj.typedDataChainId = (message.typedDataChainId || long_1.default.UZERO).toString());
|
|
72
|
-
message.feePayer !== undefined && (obj.feePayer = message.feePayer);
|
|
73
|
-
message.feePayerSig !== undefined &&
|
|
74
|
-
(obj.feePayerSig = base64FromBytes(message.feePayerSig !== undefined
|
|
75
|
-
? message.feePayerSig
|
|
76
|
-
: new Uint8Array()));
|
|
77
|
-
return obj;
|
|
78
|
-
},
|
|
79
|
-
fromPartial(object) {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
const message = Object.assign({}, baseExtensionOptionsWeb3Tx);
|
|
82
|
-
message.typedDataChainId =
|
|
83
|
-
object.typedDataChainId !== undefined && object.typedDataChainId !== null
|
|
84
|
-
? long_1.default.fromValue(object.typedDataChainId)
|
|
85
|
-
: long_1.default.UZERO;
|
|
86
|
-
message.feePayer = (_a = object.feePayer) !== null && _a !== void 0 ? _a : "";
|
|
87
|
-
message.feePayerSig = (_b = object.feePayerSig) !== null && _b !== void 0 ? _b : new Uint8Array();
|
|
88
|
-
return message;
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
var globalThis = (() => {
|
|
92
|
-
if (typeof globalThis !== "undefined")
|
|
93
|
-
return globalThis;
|
|
94
|
-
if (typeof self !== "undefined")
|
|
95
|
-
return self;
|
|
96
|
-
if (typeof window !== "undefined")
|
|
97
|
-
return window;
|
|
98
|
-
if (typeof global !== "undefined")
|
|
99
|
-
return global;
|
|
100
|
-
throw "Unable to locate global object";
|
|
101
|
-
})();
|
|
102
|
-
const atob = globalThis.atob ||
|
|
103
|
-
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
|
|
104
|
-
function bytesFromBase64(b64) {
|
|
105
|
-
const bin = atob(b64);
|
|
106
|
-
const arr = new Uint8Array(bin.length);
|
|
107
|
-
for (let i = 0; i < bin.length; ++i) {
|
|
108
|
-
arr[i] = bin.charCodeAt(i);
|
|
109
|
-
}
|
|
110
|
-
return arr;
|
|
111
|
-
}
|
|
112
|
-
const btoa = globalThis.btoa ||
|
|
113
|
-
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
|
|
114
|
-
function base64FromBytes(arr) {
|
|
115
|
-
const bin = [];
|
|
116
|
-
for (const byte of arr) {
|
|
117
|
-
bin.push(String.fromCharCode(byte));
|
|
118
|
-
}
|
|
119
|
-
return btoa(bin.join(""));
|
|
120
|
-
}
|
|
121
|
-
if (minimal_1.default.util.Long !== long_1.default) {
|
|
122
|
-
minimal_1.default.util.Long = long_1.default;
|
|
123
|
-
minimal_1.default.configure();
|
|
124
|
-
}
|