@keplr-wallet/hooks-starknet 0.12.133-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/.eslintignore +2 -0
- package/.prettierignore +2 -0
- package/LICENSE +209 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +18 -0
- package/build/index.js.map +1 -0
- package/build/tx/amount.d.ts +27 -0
- package/build/tx/amount.js +230 -0
- package/build/tx/amount.js.map +1 -0
- package/build/tx/chain.d.ts +11 -0
- package/build/tx/chain.js +37 -0
- package/build/tx/chain.js.map +1 -0
- package/build/tx/errors.d.ts +48 -0
- package/build/tx/errors.js +132 -0
- package/build/tx/errors.js.map +1 -0
- package/build/tx/fee.d.ts +30 -0
- package/build/tx/fee.js +167 -0
- package/build/tx/fee.js.map +1 -0
- package/build/tx/gas-simulator.d.ts +72 -0
- package/build/tx/gas-simulator.js +491 -0
- package/build/tx/gas-simulator.js.map +1 -0
- package/build/tx/gas.d.ts +14 -0
- package/build/tx/gas.js +116 -0
- package/build/tx/gas.js.map +1 -0
- package/build/tx/index.d.ts +12 -0
- package/build/tx/index.js +29 -0
- package/build/tx/index.js.map +1 -0
- package/build/tx/noop-amount.d.ts +20 -0
- package/build/tx/noop-amount.js +90 -0
- package/build/tx/noop-amount.js.map +1 -0
- package/build/tx/recipient.d.ts +12 -0
- package/build/tx/recipient.js +80 -0
- package/build/tx/recipient.js.map +1 -0
- package/build/tx/send-tx.d.ts +9 -0
- package/build/tx/send-tx.js +22 -0
- package/build/tx/send-tx.js.map +1 -0
- package/build/tx/sender.d.ts +14 -0
- package/build/tx/sender.js +88 -0
- package/build/tx/sender.js.map +1 -0
- package/build/tx/types.d.ts +63 -0
- package/build/tx/types.js +3 -0
- package/build/tx/types.js.map +1 -0
- package/build/tx/validate.d.ts +11 -0
- package/build/tx/validate.js +52 -0
- package/build/tx/validate.js.map +1 -0
- package/jest.config.js +5 -0
- package/package.json +43 -0
- package/src/index.ts +1 -0
- package/src/tx/amount.ts +275 -0
- package/src/tx/chain.ts +32 -0
- package/src/tx/errors.ts +127 -0
- package/src/tx/fee.ts +209 -0
- package/src/tx/gas-simulator.ts +571 -0
- package/src/tx/gas.ts +131 -0
- package/src/tx/index.ts +12 -0
- package/src/tx/noop-amount.ts +92 -0
- package/src/tx/recipient.ts +82 -0
- package/src/tx/send-tx.ts +53 -0
- package/src/tx/sender.ts +104 -0
- package/src/tx/types.ts +97 -0
- package/src/tx/validate.ts +70 -0
- package/tsconfig.json +13 -0
package/.eslintignore
ADDED
package/.prettierignore
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
License: Apache2.0 (Extension) / All rights reserved (Mobile)
|
|
2
|
+
|
|
3
|
+
## Keplr Extension License:
|
|
4
|
+
|
|
5
|
+
Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
+
|
|
11
|
+
1. Definitions.
|
|
12
|
+
|
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
+
|
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
+
the copyright owner that is granting the License.
|
|
18
|
+
|
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
+
other entities that control, are controlled by, or are under common
|
|
21
|
+
control with that entity. For the purposes of this definition,
|
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
+
direction or management of such entity, whether by contract or
|
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to software source code, documentation
|
|
32
|
+
source, and configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
40
|
+
Object form, made available under the License, as indicated by a
|
|
41
|
+
copyright notice that is included in or attached to the work
|
|
42
|
+
(an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
48
|
+
of this License, Derivative Works shall not include works that remain
|
|
49
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
50
|
+
the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
|
53
|
+
the original version of the Work and any modifications or additions
|
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
56
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
57
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
58
|
+
means any form of electronic, verbal, or written communication sent
|
|
59
|
+
to the Licensor or its representatives, including but not limited to
|
|
60
|
+
communication on electronic mailing lists, source code control systems,
|
|
61
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
62
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
63
|
+
excluding communication that is conspicuously marked or otherwise
|
|
64
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
65
|
+
|
|
66
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
67
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
68
|
+
subsequently incorporated within the Work.
|
|
69
|
+
|
|
70
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
71
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
72
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
73
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
75
|
+
Work and such Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
78
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
79
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
80
|
+
(except as stated in this section) patent license to make, have made,
|
|
81
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
82
|
+
where such license applies only to those patent claims licensable
|
|
83
|
+
by such Contributor that are necessarily infringed by their
|
|
84
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
85
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
86
|
+
institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
88
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
89
|
+
or contributory patent infringement, then any patent licenses
|
|
90
|
+
granted to You under this License for that Work shall terminate
|
|
91
|
+
as of the date such litigation is filed.
|
|
92
|
+
|
|
93
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
94
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
95
|
+
modifications, and in Source or Object form, provided that You
|
|
96
|
+
meet the following conditions:
|
|
97
|
+
|
|
98
|
+
(a) You must give any other recipients of the Work or
|
|
99
|
+
Derivative Works a copy of this License; and
|
|
100
|
+
|
|
101
|
+
(b) You must cause any modified files to carry prominent notices
|
|
102
|
+
stating that You changed the files; and
|
|
103
|
+
|
|
104
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
105
|
+
that You distribute, all copyright, patent, trademark, and
|
|
106
|
+
attribution notices from the Source form of the Work,
|
|
107
|
+
excluding those notices that do not pertain to any part of
|
|
108
|
+
the Derivative Works; and
|
|
109
|
+
|
|
110
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
111
|
+
distribution, then any Derivative Works that You distribute must
|
|
112
|
+
include a readable copy of the attribution notices contained
|
|
113
|
+
within such NOTICE file, excluding those notices that do not
|
|
114
|
+
pertain to any part of the Derivative Works, in at least one
|
|
115
|
+
of the following places: within a NOTICE text file distributed
|
|
116
|
+
as part of the Derivative Works; within the Source form or
|
|
117
|
+
documentation, if provided along with the Derivative Works; or,
|
|
118
|
+
within a display generated by the Derivative Works, if and
|
|
119
|
+
wherever such third-party notices normally appear. The contents
|
|
120
|
+
of the NOTICE file are for informational purposes only and
|
|
121
|
+
do not modify the License. You may add Your own attribution
|
|
122
|
+
notices within Derivative Works that You distribute, alongside
|
|
123
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
124
|
+
that such additional attribution notices cannot be construed
|
|
125
|
+
as modifying the License.
|
|
126
|
+
|
|
127
|
+
You may add Your own copyright statement to Your modifications and
|
|
128
|
+
may provide additional or different license terms and conditions
|
|
129
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
130
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
131
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
132
|
+
the conditions stated in this License.
|
|
133
|
+
|
|
134
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
135
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
136
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
137
|
+
this License, without any additional terms or conditions.
|
|
138
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
139
|
+
the terms of any separate license agreement you may have executed
|
|
140
|
+
with Licensor regarding such Contributions.
|
|
141
|
+
|
|
142
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
143
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
144
|
+
except as required for reasonable and customary use in describing the
|
|
145
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
146
|
+
|
|
147
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
148
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
149
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
150
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
151
|
+
implied, including, without limitation, any warranties or conditions
|
|
152
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
153
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
154
|
+
appropriateness of using or redistributing the Work and assume any
|
|
155
|
+
risks associated with Your exercise of permissions under this License.
|
|
156
|
+
|
|
157
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
158
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
159
|
+
unless required by applicable law (such as deliberate and grossly
|
|
160
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
161
|
+
liable to You for damages, including any direct, indirect, special,
|
|
162
|
+
incidental, or consequential damages of any character arising as a
|
|
163
|
+
result of this License or out of the use or inability to use the
|
|
164
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
165
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
166
|
+
other commercial damages or losses), even if such Contributor
|
|
167
|
+
has been advised of the possibility of such damages.
|
|
168
|
+
|
|
169
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
170
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
171
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
172
|
+
or other liability obligations and/or rights consistent with this
|
|
173
|
+
License. However, in accepting such obligations, You may act only
|
|
174
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
175
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
176
|
+
defend, and hold each Contributor harmless for any liability
|
|
177
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
178
|
+
of your accepting any such warranty or additional liability.
|
|
179
|
+
|
|
180
|
+
END OF TERMS AND CONDITIONS
|
|
181
|
+
|
|
182
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
183
|
+
|
|
184
|
+
To apply the Apache License to your work, attach the following
|
|
185
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
186
|
+
replaced with your own identifying information. (Don't include
|
|
187
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
188
|
+
comment syntax for the file format. We also recommend that a
|
|
189
|
+
file or class name and description of purpose be included on the
|
|
190
|
+
same "printed page" as the copyright notice for easier
|
|
191
|
+
identification within third-party archives.
|
|
192
|
+
|
|
193
|
+
Copyright 2020 Chainapsis, Inc
|
|
194
|
+
|
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
you may not use this file except in compliance with the License.
|
|
197
|
+
You may obtain a copy of the License at
|
|
198
|
+
|
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
|
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
See the License for the specific language governing permissions and
|
|
205
|
+
limitations under the License.
|
|
206
|
+
|
|
207
|
+
## Keplr Mobile License
|
|
208
|
+
|
|
209
|
+
Copyright (c) 2021 Chainapsis Inc. All rights reserved.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tx";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./tx"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IAmountConfig, IFeeConfig, ISenderConfig, UIProperties } from "./types";
|
|
2
|
+
import { TxChainSetter } from "./chain";
|
|
3
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
4
|
+
import { ERC20Currency } from "@keplr-wallet/types";
|
|
5
|
+
import { CoinPretty } from "@keplr-wallet/unit";
|
|
6
|
+
import { StarknetQueriesStore } from "@keplr-wallet/stores-starknet";
|
|
7
|
+
export declare class AmountConfig extends TxChainSetter implements IAmountConfig {
|
|
8
|
+
protected readonly starknetQueriesStore: StarknetQueriesStore;
|
|
9
|
+
protected readonly senderConfig: ISenderConfig;
|
|
10
|
+
protected _currency?: ERC20Currency;
|
|
11
|
+
protected _value: string;
|
|
12
|
+
protected _fraction: number;
|
|
13
|
+
protected _feeConfig: IFeeConfig | undefined;
|
|
14
|
+
constructor(chainGetter: ChainGetter, starknetQueriesStore: StarknetQueriesStore, initialChainId: string, senderConfig: ISenderConfig);
|
|
15
|
+
get feeConfig(): IFeeConfig | undefined;
|
|
16
|
+
setFeeConfig(feeConfig: IFeeConfig | undefined): void;
|
|
17
|
+
get value(): string;
|
|
18
|
+
setValue(value: string): void;
|
|
19
|
+
get amount(): CoinPretty[];
|
|
20
|
+
get currency(): ERC20Currency;
|
|
21
|
+
setCurrency(currency: ERC20Currency | undefined): void;
|
|
22
|
+
get fraction(): number;
|
|
23
|
+
setFraction(fraction: number): void;
|
|
24
|
+
canUseCurrency(currency: ERC20Currency): boolean;
|
|
25
|
+
get uiProperties(): UIProperties;
|
|
26
|
+
}
|
|
27
|
+
export declare const useAmountConfig: (chainGetter: ChainGetter, queriesStore: StarknetQueriesStore, chainId: string, senderConfig: ISenderConfig) => AmountConfig;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.useAmountConfig = exports.AmountConfig = void 0;
|
|
10
|
+
const chain_1 = require("./chain");
|
|
11
|
+
const mobx_1 = require("mobx");
|
|
12
|
+
const errors_1 = require("./errors");
|
|
13
|
+
const unit_1 = require("@keplr-wallet/unit");
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
class AmountConfig extends chain_1.TxChainSetter {
|
|
16
|
+
constructor(chainGetter, starknetQueriesStore, initialChainId, senderConfig) {
|
|
17
|
+
super(chainGetter, initialChainId);
|
|
18
|
+
this.starknetQueriesStore = starknetQueriesStore;
|
|
19
|
+
this.senderConfig = senderConfig;
|
|
20
|
+
this._currency = undefined;
|
|
21
|
+
this._value = "";
|
|
22
|
+
this._fraction = 0;
|
|
23
|
+
this._feeConfig = undefined;
|
|
24
|
+
(0, mobx_1.makeObservable)(this);
|
|
25
|
+
}
|
|
26
|
+
get feeConfig() {
|
|
27
|
+
return this._feeConfig;
|
|
28
|
+
}
|
|
29
|
+
setFeeConfig(feeConfig) {
|
|
30
|
+
this._feeConfig = feeConfig;
|
|
31
|
+
}
|
|
32
|
+
get value() {
|
|
33
|
+
var _a;
|
|
34
|
+
if (this.fraction > 0) {
|
|
35
|
+
let result = (_a = this.starknetQueriesStore
|
|
36
|
+
.get(this.chainId)
|
|
37
|
+
.queryStarknetERC20Balance.getBalance(this.chainId, this.chainGetter, this.senderConfig.sender, this.currency.coinMinimalDenom)) === null || _a === void 0 ? void 0 : _a.balance;
|
|
38
|
+
if (!result) {
|
|
39
|
+
return "0";
|
|
40
|
+
}
|
|
41
|
+
if (this.feeConfig) {
|
|
42
|
+
if (this.feeConfig.fee) {
|
|
43
|
+
result = result.sub(this.feeConfig.fee);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (result.toDec().lte(new unit_1.Dec(0))) {
|
|
47
|
+
return "0";
|
|
48
|
+
}
|
|
49
|
+
return result
|
|
50
|
+
.mul(new unit_1.Dec(this.fraction))
|
|
51
|
+
.trim(true)
|
|
52
|
+
.locale(false)
|
|
53
|
+
.hideDenom(true)
|
|
54
|
+
.toString();
|
|
55
|
+
}
|
|
56
|
+
return this._value;
|
|
57
|
+
}
|
|
58
|
+
setValue(value) {
|
|
59
|
+
if (value.startsWith(".")) {
|
|
60
|
+
value = "0" + value;
|
|
61
|
+
}
|
|
62
|
+
this._value = value;
|
|
63
|
+
this.setFraction(0);
|
|
64
|
+
}
|
|
65
|
+
get amount() {
|
|
66
|
+
let amount;
|
|
67
|
+
try {
|
|
68
|
+
if (this.value.trim() === "") {
|
|
69
|
+
amount = new unit_1.Dec(0);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
amount = new unit_1.Dec(this.value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (_a) {
|
|
76
|
+
amount = new unit_1.Dec(0);
|
|
77
|
+
}
|
|
78
|
+
return [
|
|
79
|
+
new unit_1.CoinPretty(this.currency, amount
|
|
80
|
+
.mul(unit_1.DecUtils.getTenExponentN(this.currency.coinDecimals))
|
|
81
|
+
.truncate()),
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
get currency() {
|
|
85
|
+
const modularChainInfo = this.modularChainInfo;
|
|
86
|
+
if (!("starknet" in modularChainInfo)) {
|
|
87
|
+
throw new Error("Chain doesn't support the starknet");
|
|
88
|
+
}
|
|
89
|
+
if (this._currency) {
|
|
90
|
+
const find = modularChainInfo.starknet.currencies.find((cur) => cur.coinMinimalDenom === this._currency.coinMinimalDenom);
|
|
91
|
+
if (find) {
|
|
92
|
+
return find;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return modularChainInfo.starknet.currencies[0];
|
|
96
|
+
}
|
|
97
|
+
setCurrency(currency) {
|
|
98
|
+
var _a;
|
|
99
|
+
if ((currency === null || currency === void 0 ? void 0 : currency.coinMinimalDenom) !== ((_a = this._currency) === null || _a === void 0 ? void 0 : _a.coinMinimalDenom)) {
|
|
100
|
+
this._value = "";
|
|
101
|
+
this.setFraction(0);
|
|
102
|
+
}
|
|
103
|
+
this._currency = currency;
|
|
104
|
+
}
|
|
105
|
+
get fraction() {
|
|
106
|
+
return this._fraction;
|
|
107
|
+
}
|
|
108
|
+
setFraction(fraction) {
|
|
109
|
+
this._fraction = fraction;
|
|
110
|
+
}
|
|
111
|
+
canUseCurrency(currency) {
|
|
112
|
+
const modularChainInfo = this.modularChainInfo;
|
|
113
|
+
if (!("starknet" in modularChainInfo)) {
|
|
114
|
+
throw new Error("Chain doesn't support the starknet");
|
|
115
|
+
}
|
|
116
|
+
return (modularChainInfo.starknet.currencies.find((cur) => cur.coinMinimalDenom === currency.coinMinimalDenom) != null);
|
|
117
|
+
}
|
|
118
|
+
get uiProperties() {
|
|
119
|
+
if (!this.currency) {
|
|
120
|
+
return {
|
|
121
|
+
error: new Error("Currency to send not set"),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
if (this.value.trim() === "") {
|
|
125
|
+
return {
|
|
126
|
+
error: new errors_1.EmptyAmountError("Amount is empty"),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const dec = new unit_1.Dec(this.value);
|
|
131
|
+
if (dec.equals(new unit_1.Dec(0))) {
|
|
132
|
+
return {
|
|
133
|
+
error: new errors_1.ZeroAmountError("Amount is zero"),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
if (dec.lt(new unit_1.Dec(0))) {
|
|
137
|
+
return {
|
|
138
|
+
error: new errors_1.NegativeAmountError("Amount is negative"),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
catch (_a) {
|
|
143
|
+
return {
|
|
144
|
+
error: new errors_1.InvalidNumberAmountError("Invalid form of number"),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
for (const amount of this.amount) {
|
|
148
|
+
const currency = amount.currency;
|
|
149
|
+
if (!("type" in currency) || currency.type !== "erc20") {
|
|
150
|
+
return {
|
|
151
|
+
error: new errors_1.NotSupportedCurrencyError("Not supported currency"),
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
if (!this.canUseCurrency(currency)) {
|
|
155
|
+
return {
|
|
156
|
+
error: new errors_1.NotSupportedCurrencyError("Not supported currency"),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
const bal = this.starknetQueriesStore
|
|
160
|
+
.get(this.chainId)
|
|
161
|
+
.queryStarknetERC20Balance.getBalance(this.chainId, this.chainGetter, this.senderConfig.sender, currency.coinMinimalDenom);
|
|
162
|
+
if (!bal) {
|
|
163
|
+
return {
|
|
164
|
+
warning: new Error(`Can't parse the balance for ${currency.coinMinimalDenom}`),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
if (bal.error) {
|
|
168
|
+
return {
|
|
169
|
+
warning: new Error("Failed to fetch balance"),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
if (!bal.response) {
|
|
173
|
+
return {
|
|
174
|
+
loadingState: "loading-block",
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
if (bal.balance.toDec().lt(amount.toDec())) {
|
|
178
|
+
return {
|
|
179
|
+
error: new errors_1.InsufficientAmountError("Insufficient amount"),
|
|
180
|
+
loadingState: bal.isFetching ? "loading" : undefined,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
__decorate([
|
|
188
|
+
mobx_1.observable.ref
|
|
189
|
+
], AmountConfig.prototype, "_currency", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
mobx_1.observable
|
|
192
|
+
], AmountConfig.prototype, "_value", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
mobx_1.observable
|
|
195
|
+
], AmountConfig.prototype, "_fraction", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
mobx_1.observable.ref
|
|
198
|
+
], AmountConfig.prototype, "_feeConfig", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
mobx_1.action
|
|
201
|
+
], AmountConfig.prototype, "setFeeConfig", null);
|
|
202
|
+
__decorate([
|
|
203
|
+
mobx_1.computed
|
|
204
|
+
], AmountConfig.prototype, "value", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
mobx_1.action
|
|
207
|
+
], AmountConfig.prototype, "setValue", null);
|
|
208
|
+
__decorate([
|
|
209
|
+
mobx_1.computed
|
|
210
|
+
], AmountConfig.prototype, "amount", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
mobx_1.computed
|
|
213
|
+
], AmountConfig.prototype, "currency", null);
|
|
214
|
+
__decorate([
|
|
215
|
+
mobx_1.action
|
|
216
|
+
], AmountConfig.prototype, "setCurrency", null);
|
|
217
|
+
__decorate([
|
|
218
|
+
mobx_1.action
|
|
219
|
+
], AmountConfig.prototype, "setFraction", null);
|
|
220
|
+
__decorate([
|
|
221
|
+
mobx_1.computed
|
|
222
|
+
], AmountConfig.prototype, "uiProperties", null);
|
|
223
|
+
exports.AmountConfig = AmountConfig;
|
|
224
|
+
const useAmountConfig = (chainGetter, queriesStore, chainId, senderConfig) => {
|
|
225
|
+
const [txConfig] = (0, react_1.useState)(() => new AmountConfig(chainGetter, queriesStore, chainId, senderConfig));
|
|
226
|
+
txConfig.setChain(chainId);
|
|
227
|
+
return txConfig;
|
|
228
|
+
};
|
|
229
|
+
exports.useAmountConfig = useAmountConfig;
|
|
230
|
+
//# sourceMappingURL=amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amount.js","sourceRoot":"","sources":["../../src/tx/amount.ts"],"names":[],"mappings":";;;;;;;;;AAMA,mCAAwC;AAExC,+BAAoE;AAEpE,qCAOkB;AAClB,6CAA+D;AAC/D,iCAAiC;AAGjC,MAAa,YAAa,SAAQ,qBAAa;IAa7C,YACE,WAAwB,EACL,oBAA0C,EAC7D,cAAsB,EACH,YAA2B;QAE9C,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAJhB,yBAAoB,GAApB,oBAAoB,CAAsB;QAE1C,iBAAY,GAAZ,YAAY,CAAe;QAftC,cAAS,GAAmB,SAAS,CAAC;QAGtC,WAAM,GAAW,EAAE,CAAC;QAGpB,cAAS,GAAW,CAAC,CAAC;QAGtB,eAAU,GAA2B,SAAS,CAAC;QAUvD,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAGD,YAAY,CAAC,SAAiC;QAC5C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAGD,IAAI,KAAK;;QACP,IAA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,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE;gBAC1C,OAAO;oBACL,KAAK,EAAE,IAAI,gCAAuB,CAAC,qBAAqB,CAAC;oBACzD,YAAY,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS;iBACrD,CAAC;aACH;SACF;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AA5OW;IADT,iBAAU,CAAC,GAAG;+CACiC;AAGtC;IADT,iBAAU;4CACmB;AAGpB;IADT,iBAAU;+CACqB;AAGtB;IADT,iBAAU,CAAC,GAAG;gDAC0C;AAkBzD;IADC,aAAM;gDAGN;AAGD;IADC,eAAQ;yCAgCR;AAGD;IADC,aAAM;4CASN;AAGD;IADC,eAAQ;0CAqBR;AAGD;IADC,eAAQ;4CAiBR;AAGD;IADC,aAAM;+CAQN;AAOD;IADC,aAAM;+CAGN;AAgBD;IADC,eAAQ;gDAqFR;AA7OH,oCA8OC;AAEM,MAAM,eAAe,GAAG,CAC7B,WAAwB,EACxB,YAAkC,EAClC,OAAe,EACf,YAA2B,EAC3B,EAAE;IACF,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EACzB,GAAG,EAAE,CAAC,IAAI,YAAY,CAAC,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CACzE,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
2
|
+
import { ITxChainSetter } from "./types";
|
|
3
|
+
import { ModularChainInfo } from "@keplr-wallet/types";
|
|
4
|
+
export declare class TxChainSetter implements ITxChainSetter {
|
|
5
|
+
protected readonly chainGetter: ChainGetter;
|
|
6
|
+
protected _chainId: string;
|
|
7
|
+
constructor(chainGetter: ChainGetter, initialChainId: string);
|
|
8
|
+
get modularChainInfo(): ModularChainInfo;
|
|
9
|
+
get chainId(): string;
|
|
10
|
+
setChain(chainId: string): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TxChainSetter = void 0;
|
|
10
|
+
const mobx_1 = require("mobx");
|
|
11
|
+
class TxChainSetter {
|
|
12
|
+
constructor(chainGetter, initialChainId) {
|
|
13
|
+
this.chainGetter = chainGetter;
|
|
14
|
+
this._chainId = initialChainId;
|
|
15
|
+
(0, mobx_1.makeObservable)(this);
|
|
16
|
+
}
|
|
17
|
+
get modularChainInfo() {
|
|
18
|
+
return this.chainGetter.getModularChain(this.chainId);
|
|
19
|
+
}
|
|
20
|
+
get chainId() {
|
|
21
|
+
return this._chainId;
|
|
22
|
+
}
|
|
23
|
+
setChain(chainId) {
|
|
24
|
+
this._chainId = chainId;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
__decorate([
|
|
28
|
+
mobx_1.observable
|
|
29
|
+
], TxChainSetter.prototype, "_chainId", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
mobx_1.computed
|
|
32
|
+
], TxChainSetter.prototype, "modularChainInfo", null);
|
|
33
|
+
__decorate([
|
|
34
|
+
mobx_1.action
|
|
35
|
+
], TxChainSetter.prototype, "setChain", null);
|
|
36
|
+
exports.TxChainSetter = TxChainSetter;
|
|
37
|
+
//# sourceMappingURL=chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../src/tx/chain.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+BAAoE;AAKpE,MAAa,aAAa;IAIxB,YACqB,WAAwB,EAC3C,cAAsB;QADH,gBAAW,GAAX,WAAW,CAAa;QAG3C,IAAI,CAAC,QAAQ,GAAG,cAAc,CAAC;QAE/B,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAGD,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAGD,QAAQ,CAAC,OAAe;QACtB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;CACF;AAxBW;IADT,iBAAU;+CACgB;AAY3B;IADC,eAAQ;qDAGR;AAOD;IADC,aAAM;6CAGN;AAzBH,sCA0BC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare class AccountNotDeployed extends Error {
|
|
2
|
+
constructor(m: string);
|
|
3
|
+
}
|
|
4
|
+
export declare class EmptyAddressError extends Error {
|
|
5
|
+
constructor(m: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class InvalidBech32Error extends Error {
|
|
8
|
+
constructor(m: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class ICNSIsFetchingError extends Error {
|
|
11
|
+
constructor(m: string);
|
|
12
|
+
}
|
|
13
|
+
export declare class ICNSFailedToFetchError extends Error {
|
|
14
|
+
constructor(m: string);
|
|
15
|
+
}
|
|
16
|
+
export declare class EmptyAmountError extends Error {
|
|
17
|
+
constructor(m: string);
|
|
18
|
+
}
|
|
19
|
+
export declare class InvalidNumberAmountError extends Error {
|
|
20
|
+
constructor(m: string);
|
|
21
|
+
}
|
|
22
|
+
export declare class ZeroAmountError extends Error {
|
|
23
|
+
constructor(m: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class NegativeAmountError extends Error {
|
|
26
|
+
constructor(m: string);
|
|
27
|
+
}
|
|
28
|
+
export declare class InsufficientAmountError extends Error {
|
|
29
|
+
constructor(m: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class NotLoadedFeeError extends Error {
|
|
32
|
+
constructor(m: string);
|
|
33
|
+
}
|
|
34
|
+
export declare class InsufficientFeeError extends Error {
|
|
35
|
+
constructor(m: string);
|
|
36
|
+
}
|
|
37
|
+
export declare class UnknownCurrencyError extends Error {
|
|
38
|
+
constructor(m: string);
|
|
39
|
+
}
|
|
40
|
+
export declare class NotSupportedCurrencyError extends Error {
|
|
41
|
+
constructor(m: string);
|
|
42
|
+
}
|
|
43
|
+
export declare class InvalidHexError extends Error {
|
|
44
|
+
constructor(m: string);
|
|
45
|
+
}
|
|
46
|
+
export declare class MemoSuspectMnemonicInclusion extends Error {
|
|
47
|
+
constructor(m: string);
|
|
48
|
+
}
|