@keplr-wallet/stores 0.10.13 → 0.10.14-rc.0
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/build/account/base.d.ts +4 -0
- package/build/account/base.js +15 -0
- package/build/account/base.js.map +1 -1
- package/build/account/cosmos.d.ts +57 -13
- package/build/account/cosmos.js +522 -27
- package/build/account/cosmos.js.map +1 -1
- package/build/account/cosmwasm.d.ts +20 -7
- package/build/account/cosmwasm.js +79 -20
- package/build/account/cosmwasm.js.map +1 -1
- package/build/account/index.d.ts +2 -0
- package/build/account/index.js +2 -0
- package/build/account/index.js.map +1 -1
- package/build/account/secret.d.ts +20 -7
- package/build/account/secret.js +88 -24
- package/build/account/secret.js.map +1 -1
- package/build/account/types.d.ts +41 -0
- package/build/account/types.js +3 -0
- package/build/account/types.js.map +1 -0
- package/build/account/utils.d.ts +10 -0
- package/build/account/utils.js +52 -0
- package/build/account/utils.js.map +1 -0
- package/build/ibc/currency-registrar.js +2 -0
- package/build/ibc/currency-registrar.js.map +1 -1
- package/package.json +11 -11
- package/src/account/base.ts +36 -0
- package/src/account/cosmos.ts +848 -139
- package/src/account/cosmwasm.ts +122 -40
- package/src/account/index.ts +2 -0
- package/src/account/secret.ts +140 -44
- package/src/account/types.ts +69 -0
- package/src/account/utils.ts +74 -0
- package/src/ibc/currency-registrar.ts +2 -0
package/build/account/base.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppCurrency, Keplr, KeplrSignOptions } from "@keplr-wallet/types";
|
|
2
2
|
import { ChainGetter } from "../common";
|
|
3
3
|
import { StdFee } from "@cosmjs/launchpad";
|
|
4
|
+
import { MakeTxResponse } from "./types";
|
|
4
5
|
export declare enum WalletStatus {
|
|
5
6
|
NotInit = "NotInit",
|
|
6
7
|
Loading = "Loading",
|
|
@@ -39,6 +40,7 @@ export declare class AccountSetBase {
|
|
|
39
40
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
40
41
|
onFulfill?: (tx: any) => void;
|
|
41
42
|
}) => Promise<boolean>)[];
|
|
43
|
+
protected makeSendTokenTxFns: ((amount: string, currency: AppCurrency, recipient: string) => MakeTxResponse | undefined)[];
|
|
42
44
|
constructor(eventListener: {
|
|
43
45
|
addEventListener: (type: string, fn: () => unknown) => void;
|
|
44
46
|
removeEventListener: (type: string, fn: () => unknown) => void;
|
|
@@ -48,6 +50,7 @@ export declare class AccountSetBase {
|
|
|
48
50
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
49
51
|
onFulfill?: (tx: any) => void;
|
|
50
52
|
}) => Promise<boolean>): void;
|
|
53
|
+
registerMakeSendTokenFn(fn: (amount: string, currency: AppCurrency, recipient: string) => MakeTxResponse | undefined): void;
|
|
51
54
|
protected enable(keplr: Keplr, chainId: string): Promise<void>;
|
|
52
55
|
protected suggestChain(keplr: Keplr, chainInfo: ReturnType<ChainGetter["getChain"]>): Promise<void>;
|
|
53
56
|
private readonly handleInit;
|
|
@@ -59,6 +62,7 @@ export declare class AccountSetBase {
|
|
|
59
62
|
* @deprecated Use `isReadyToSendTx`
|
|
60
63
|
*/
|
|
61
64
|
get isReadyToSendMsgs(): boolean;
|
|
65
|
+
makeSendTokenTx(amount: string, currency: AppCurrency, recipient: string): MakeTxResponse;
|
|
62
66
|
sendToken(amount: string, currency: AppCurrency, recipient: string, memo?: string, stdFee?: Partial<StdFee>, signOptions?: KeplrSignOptions, onTxEvents?: ((tx: any) => void) | {
|
|
63
67
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
64
68
|
onFulfill?: (tx: any) => void;
|
package/build/account/base.js
CHANGED
|
@@ -40,6 +40,7 @@ class AccountSetBase {
|
|
|
40
40
|
this._txTypeInProgress = "";
|
|
41
41
|
this.hasInited = false;
|
|
42
42
|
this.sendTokenFns = [];
|
|
43
|
+
this.makeSendTokenTxFns = [];
|
|
43
44
|
this.handleInit = () => this.init();
|
|
44
45
|
mobx_1.makeObservable(this);
|
|
45
46
|
this.pubKey = new Uint8Array();
|
|
@@ -53,6 +54,9 @@ class AccountSetBase {
|
|
|
53
54
|
registerSendTokenFn(fn) {
|
|
54
55
|
this.sendTokenFns.push(fn);
|
|
55
56
|
}
|
|
57
|
+
registerMakeSendTokenFn(fn) {
|
|
58
|
+
this.makeSendTokenTxFns.push(fn);
|
|
59
|
+
}
|
|
56
60
|
enable(keplr, chainId) {
|
|
57
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
62
|
const chainInfo = this.chainGetter.getChain(chainId);
|
|
@@ -143,6 +147,17 @@ class AccountSetBase {
|
|
|
143
147
|
get isReadyToSendMsgs() {
|
|
144
148
|
return (this.walletStatus === WalletStatus.Loaded && this.bech32Address !== "");
|
|
145
149
|
}
|
|
150
|
+
makeSendTokenTx(amount, currency, recipient) {
|
|
151
|
+
for (let i = 0; i < this.makeSendTokenTxFns.length; i++) {
|
|
152
|
+
const fn = this.makeSendTokenTxFns[i];
|
|
153
|
+
const res = fn(amount, currency, recipient);
|
|
154
|
+
if (res) {
|
|
155
|
+
return res;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const denomHelper = new common_1.DenomHelper(currency.coinMinimalDenom);
|
|
159
|
+
throw new Error(`Unsupported type of currency (${denomHelper.type})`);
|
|
160
|
+
}
|
|
146
161
|
sendToken(amount, currency, recipient, memo = "", stdFee = {}, signOptions, onTxEvents) {
|
|
147
162
|
return __awaiter(this, void 0, void 0, function* () {
|
|
148
163
|
for (let i = 0; i < this.sendTokenFns.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/account/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA0E;AAG1E,iDAAgE;AAEhE,kEAAwD;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/account/base.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+BAA0E;AAG1E,iDAAgE;AAEhE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C,iBAAU;sDAC2B;AAGtC;IADC,iBAAU;yDAC8B;AAsGzC;IADC,WAAI;0CA6DJ;AAGD;IADC,aAAM;gDAWN;AAOD;IADC,eAAQ;qDAKR;AAMD;IADC,eAAQ;uDAKR;AArNH,wCAqTC;AAED,MAAa,mBAAoB,SAAQ,cAAc;IACrD,YAAY,GAAG,MAAoD;QACjE,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;QAEjB,qBAAc,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAGD,mBAAmB,CAAC,IAAY;QAC9B,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAChC,CAAC;CACF;AAHC;IADC,aAAM;8DAGN;AAVH,kDAWC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AccountSetBaseSuper, MsgOpt } from "./base";
|
|
2
2
|
import { AppCurrency, KeplrSignOptions } from "@keplr-wallet/types";
|
|
3
|
-
import {
|
|
3
|
+
import { StdFee, StdSignDoc } from "@cosmjs/launchpad";
|
|
4
4
|
import { Any } from "@keplr-wallet/proto-types/google/protobuf/any";
|
|
5
5
|
import { QueriesSetBase, IQueriesStore, CosmosQueries } from "../query";
|
|
6
6
|
import { DeepPartial, DeepReadonly } from "utility-types";
|
|
7
7
|
import { ChainGetter } from "../common";
|
|
8
8
|
import { AxiosInstance } from "axios";
|
|
9
|
+
import { MakeTxResponse, ProtoMsgsOrWithAminoMsgs } from "./types";
|
|
9
10
|
export interface CosmosAccount {
|
|
10
11
|
cosmos: CosmosAccountImpl;
|
|
11
12
|
}
|
|
@@ -21,6 +22,9 @@ export declare const CosmosAccount: {
|
|
|
21
22
|
} | undefined;
|
|
22
23
|
}): (base: AccountSetBaseSuper, chainGetter: ChainGetter, chainId: string) => CosmosAccount;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Predict gas through simulation rather than using a fixed gas.
|
|
27
|
+
*/
|
|
24
28
|
export interface CosmosMsgOpts {
|
|
25
29
|
readonly send: {
|
|
26
30
|
readonly native: MsgOpt;
|
|
@@ -32,11 +36,10 @@ export interface CosmosMsgOpts {
|
|
|
32
36
|
readonly withdrawRewards: MsgOpt;
|
|
33
37
|
readonly govVote: MsgOpt;
|
|
34
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated Predict gas through simulation rather than using a fixed gas.
|
|
41
|
+
*/
|
|
35
42
|
export declare const defaultCosmosMsgOpts: CosmosMsgOpts;
|
|
36
|
-
declare type ProtoMsgsOrWithAminoMsgs = {
|
|
37
|
-
aminoMsgs: Msg[];
|
|
38
|
-
protoMsgs: Any[];
|
|
39
|
-
};
|
|
40
43
|
export declare class CosmosAccountImpl {
|
|
41
44
|
protected readonly base: AccountSetBaseSuper;
|
|
42
45
|
protected readonly chainGetter: ChainGetter;
|
|
@@ -60,7 +63,14 @@ export declare class CosmosAccountImpl {
|
|
|
60
63
|
onFulfill?: (chainId: string, tx: any) => void;
|
|
61
64
|
};
|
|
62
65
|
});
|
|
66
|
+
/**
|
|
67
|
+
* @deprecated Predict gas through simulation rather than using a fixed gas.
|
|
68
|
+
*/
|
|
63
69
|
get msgOpts(): CosmosMsgOpts;
|
|
70
|
+
protected processMakeSendTokenTx(amount: string, currency: AppCurrency, recipient: string): MakeTxResponse | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated
|
|
73
|
+
*/
|
|
64
74
|
protected processSendToken(amount: string, currency: AppCurrency, recipient: string, memo: string, stdFee: Partial<StdFee>, signOptions?: KeplrSignOptions, onTxEvents?: ((tx: any) => void) | {
|
|
65
75
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
66
76
|
onFulfill?: (tx: any) => void;
|
|
@@ -74,7 +84,36 @@ export declare class CosmosAccountImpl {
|
|
|
74
84
|
txHash: Uint8Array;
|
|
75
85
|
signDoc: StdSignDoc;
|
|
76
86
|
}>;
|
|
87
|
+
/**
|
|
88
|
+
* Simulate tx without making state transition on chain or not waiting the tx committed.
|
|
89
|
+
* Mainly used to estimate the gas needed to process tx.
|
|
90
|
+
* You should multiply arbitrary number (gas adjustment) for gas before sending tx.
|
|
91
|
+
*
|
|
92
|
+
* NOTE: "/cosmos/tx/v1beta1/simulate" returns 400, 500 or (more?) status and error code as a response when tx fails on stimulate.
|
|
93
|
+
* Currently, non 200~300 status is handled as error, thus error would be thrown.
|
|
94
|
+
*
|
|
95
|
+
* XXX: Uses the simulate request format for cosmos-sdk@0.43+
|
|
96
|
+
* Thus, may throw an error if the chain is below cosmos-sdk@0.43
|
|
97
|
+
* And, for simplicity, doesn't set the public key to tx bytes.
|
|
98
|
+
* Thus, the gas estimated doesn't include the tx bytes size of public key.
|
|
99
|
+
*
|
|
100
|
+
* @param msgs
|
|
101
|
+
* @param fee
|
|
102
|
+
* @param memo
|
|
103
|
+
*/
|
|
104
|
+
simulateTx(msgs: Any[], fee: Omit<StdFee, "gas">, memo?: string): Promise<{
|
|
105
|
+
gasUsed: number;
|
|
106
|
+
}>;
|
|
107
|
+
makeTx(type: string | "unknown", msgs: ProtoMsgsOrWithAminoMsgs | (() => Promise<ProtoMsgsOrWithAminoMsgs>), preOnTxEvents?: ((tx: any) => void) | {
|
|
108
|
+
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
109
|
+
onFulfill?: (tx: any) => void;
|
|
110
|
+
}): MakeTxResponse;
|
|
77
111
|
get instance(): AxiosInstance;
|
|
112
|
+
makeIBCTransferTx(channel: {
|
|
113
|
+
portId: string;
|
|
114
|
+
channelId: string;
|
|
115
|
+
counterpartyChainId: string;
|
|
116
|
+
}, amount: string, currency: AppCurrency, recipient: string): MakeTxResponse;
|
|
78
117
|
sendIBCTransferMsg(channel: {
|
|
79
118
|
portId: string;
|
|
80
119
|
channelId: string;
|
|
@@ -83,6 +122,7 @@ export declare class CosmosAccountImpl {
|
|
|
83
122
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
84
123
|
onFulfill?: (tx: any) => void;
|
|
85
124
|
}): Promise<void>;
|
|
125
|
+
makeDelegateTx(amount: string, validatorAddress: string): MakeTxResponse;
|
|
86
126
|
/**
|
|
87
127
|
* Send `MsgDelegate` msg to the chain.
|
|
88
128
|
* @param amount Decimal number used by humans.
|
|
@@ -95,7 +135,9 @@ export declare class CosmosAccountImpl {
|
|
|
95
135
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
96
136
|
onFulfill?: (tx: any) => void;
|
|
97
137
|
}): Promise<void>;
|
|
138
|
+
makeUndelegateTx(amount: string, validatorAddress: string): MakeTxResponse;
|
|
98
139
|
/**
|
|
140
|
+
* @deprecated
|
|
99
141
|
* Send `MsgUndelegate` msg to the chain.
|
|
100
142
|
* @param amount Decimal number used by humans.
|
|
101
143
|
* If amount is 0.1 and the stake currenct is uatom, actual amount will be changed to the 100000uatom.
|
|
@@ -107,7 +149,9 @@ export declare class CosmosAccountImpl {
|
|
|
107
149
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
108
150
|
onFulfill?: (tx: any) => void;
|
|
109
151
|
}): Promise<void>;
|
|
152
|
+
makeBeginRedelegateTx(amount: string, srcValidatorAddress: string, dstValidatorAddress: string): MakeTxResponse;
|
|
110
153
|
/**
|
|
154
|
+
* @deprecated
|
|
111
155
|
* Send `MsgBeginRedelegate` msg to the chain.
|
|
112
156
|
* @param amount Decimal number used by humans.
|
|
113
157
|
* If amount is 0.1 and the stake currenct is uatom, actual amount will be changed to the 100000uatom.
|
|
@@ -120,21 +164,21 @@ export declare class CosmosAccountImpl {
|
|
|
120
164
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
121
165
|
onFulfill?: (tx: any) => void;
|
|
122
166
|
}): Promise<void>;
|
|
167
|
+
makeWithdrawDelegationRewardTx(validatorAddresses: string[]): MakeTxResponse;
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated
|
|
170
|
+
*/
|
|
123
171
|
sendWithdrawDelegationRewardMsgs(validatorAddresses: string[], memo?: string, stdFee?: Partial<StdFee>, signOptions?: KeplrSignOptions, onTxEvents?: ((tx: any) => void) | {
|
|
124
172
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
125
173
|
onFulfill?: (tx: any) => void;
|
|
126
174
|
}): Promise<void>;
|
|
175
|
+
makeGovVoteTx(proposalId: string, option: "Yes" | "No" | "Abstain" | "NoWithVeto"): MakeTxResponse;
|
|
176
|
+
/**
|
|
177
|
+
* @deprecated
|
|
178
|
+
*/
|
|
127
179
|
sendGovVoteMsg(proposalId: string, option: "Yes" | "No" | "Abstain" | "NoWithVeto", memo?: string, stdFee?: Partial<StdFee>, signOptions?: KeplrSignOptions, onTxEvents?: ((tx: any) => void) | {
|
|
128
180
|
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
129
181
|
onFulfill?: (tx: any) => void;
|
|
130
182
|
}): Promise<void>;
|
|
131
|
-
protected txEventsWithPreOnFulfill(onTxEvents: ((tx: any) => void) | {
|
|
132
|
-
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
133
|
-
onFulfill?: (tx: any) => void;
|
|
134
|
-
} | undefined, preOnFulfill?: (tx: any) => void): {
|
|
135
|
-
onBroadcasted?: (txHash: Uint8Array) => void;
|
|
136
|
-
onFulfill?: (tx: any) => void;
|
|
137
|
-
} | undefined;
|
|
138
183
|
protected get queries(): DeepReadonly<QueriesSetBase & CosmosQueries>;
|
|
139
184
|
}
|
|
140
|
-
export {};
|