@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
|
@@ -0,0 +1,29 @@
|
|
|
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("./errors"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
__exportStar(require("./fee"), exports);
|
|
20
|
+
__exportStar(require("./gas"), exports);
|
|
21
|
+
__exportStar(require("./recipient"), exports);
|
|
22
|
+
__exportStar(require("./amount"), exports);
|
|
23
|
+
__exportStar(require("./sender"), exports);
|
|
24
|
+
__exportStar(require("./send-tx"), exports);
|
|
25
|
+
__exportStar(require("./chain"), exports);
|
|
26
|
+
__exportStar(require("./gas-simulator"), exports);
|
|
27
|
+
__exportStar(require("./validate"), exports);
|
|
28
|
+
__exportStar(require("./noop-amount"), exports);
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tx/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,wCAAsB;AACtB,wCAAsB;AACtB,8CAA4B;AAC5B,2CAAyB;AACzB,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB;AACxB,kDAAgC;AAChC,6CAA2B;AAC3B,gDAA8B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IAmountConfig, 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
|
+
export declare class NoopAmountConfig extends TxChainSetter implements IAmountConfig {
|
|
7
|
+
protected readonly senderConfig: ISenderConfig;
|
|
8
|
+
protected _currency?: ERC20Currency;
|
|
9
|
+
constructor(chainGetter: ChainGetter, initialChainId: string, senderConfig: ISenderConfig);
|
|
10
|
+
get value(): string;
|
|
11
|
+
setValue(_value: string): void;
|
|
12
|
+
get amount(): CoinPretty[];
|
|
13
|
+
get currency(): ERC20Currency;
|
|
14
|
+
setCurrency(_currency: ERC20Currency | undefined): void;
|
|
15
|
+
get fraction(): number;
|
|
16
|
+
setFraction(_fraction: number): void;
|
|
17
|
+
canUseCurrency(_currency: ERC20Currency): boolean;
|
|
18
|
+
get uiProperties(): UIProperties;
|
|
19
|
+
}
|
|
20
|
+
export declare const useNoopAmountConfig: (chainGetter: ChainGetter, chainId: string, senderConfig: ISenderConfig) => NoopAmountConfig;
|
|
@@ -0,0 +1,90 @@
|
|
|
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.useNoopAmountConfig = exports.NoopAmountConfig = void 0;
|
|
10
|
+
const chain_1 = require("./chain");
|
|
11
|
+
const mobx_1 = require("mobx");
|
|
12
|
+
const unit_1 = require("@keplr-wallet/unit");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
class NoopAmountConfig extends chain_1.TxChainSetter {
|
|
15
|
+
constructor(chainGetter, initialChainId, senderConfig) {
|
|
16
|
+
super(chainGetter, initialChainId);
|
|
17
|
+
this.senderConfig = senderConfig;
|
|
18
|
+
this._currency = undefined;
|
|
19
|
+
(0, mobx_1.makeObservable)(this);
|
|
20
|
+
}
|
|
21
|
+
get value() {
|
|
22
|
+
return "0";
|
|
23
|
+
}
|
|
24
|
+
setValue(_value) {
|
|
25
|
+
// noop
|
|
26
|
+
}
|
|
27
|
+
get amount() {
|
|
28
|
+
return [
|
|
29
|
+
new unit_1.CoinPretty(this.currency, new unit_1.Dec(0)
|
|
30
|
+
.mul(unit_1.DecUtils.getTenExponentN(this.currency.coinDecimals))
|
|
31
|
+
.truncate()),
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
get currency() {
|
|
35
|
+
const modularChainInfo = this.modularChainInfo;
|
|
36
|
+
if (!("starknet" in modularChainInfo)) {
|
|
37
|
+
throw new Error("Chain doesn't support the starknet");
|
|
38
|
+
}
|
|
39
|
+
return modularChainInfo.starknet.currencies[0];
|
|
40
|
+
}
|
|
41
|
+
setCurrency(_currency) {
|
|
42
|
+
// noop
|
|
43
|
+
}
|
|
44
|
+
get fraction() {
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
setFraction(_fraction) {
|
|
48
|
+
// noop
|
|
49
|
+
}
|
|
50
|
+
canUseCurrency(_currency) {
|
|
51
|
+
// noop
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
get uiProperties() {
|
|
55
|
+
// noop
|
|
56
|
+
return {};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
__decorate([
|
|
60
|
+
mobx_1.observable.ref
|
|
61
|
+
], NoopAmountConfig.prototype, "_currency", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
mobx_1.computed
|
|
64
|
+
], NoopAmountConfig.prototype, "value", null);
|
|
65
|
+
__decorate([
|
|
66
|
+
mobx_1.action
|
|
67
|
+
], NoopAmountConfig.prototype, "setValue", null);
|
|
68
|
+
__decorate([
|
|
69
|
+
mobx_1.computed
|
|
70
|
+
], NoopAmountConfig.prototype, "amount", null);
|
|
71
|
+
__decorate([
|
|
72
|
+
mobx_1.computed
|
|
73
|
+
], NoopAmountConfig.prototype, "currency", null);
|
|
74
|
+
__decorate([
|
|
75
|
+
mobx_1.action
|
|
76
|
+
], NoopAmountConfig.prototype, "setCurrency", null);
|
|
77
|
+
__decorate([
|
|
78
|
+
mobx_1.action
|
|
79
|
+
], NoopAmountConfig.prototype, "setFraction", null);
|
|
80
|
+
__decorate([
|
|
81
|
+
mobx_1.computed
|
|
82
|
+
], NoopAmountConfig.prototype, "uiProperties", null);
|
|
83
|
+
exports.NoopAmountConfig = NoopAmountConfig;
|
|
84
|
+
const useNoopAmountConfig = (chainGetter, chainId, senderConfig) => {
|
|
85
|
+
const [txConfig] = (0, react_1.useState)(() => new NoopAmountConfig(chainGetter, chainId, senderConfig));
|
|
86
|
+
txConfig.setChain(chainId);
|
|
87
|
+
return txConfig;
|
|
88
|
+
};
|
|
89
|
+
exports.useNoopAmountConfig = useNoopAmountConfig;
|
|
90
|
+
//# sourceMappingURL=noop-amount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-amount.js","sourceRoot":"","sources":["../../src/tx/noop-amount.ts"],"names":[],"mappings":";;;;;;;;;AACA,mCAAwC;AAExC,+BAAoE;AAEpE,6CAA+D;AAC/D,iCAAiC;AAEjC,MAAa,gBAAiB,SAAQ,qBAAa;IAIjD,YACE,WAAwB,EACxB,cAAsB,EACH,YAA2B;QAE9C,KAAK,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAFhB,iBAAY,GAAZ,YAAY,CAAe;QALtC,cAAS,GAAmB,SAAS,CAAC;QAS9C,IAAA,qBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAGD,IAAI,KAAK;QACP,OAAO,GAAG,CAAC;IACb,CAAC;IAGD,QAAQ,CAAC,MAAc;QACrB,OAAO;IACT,CAAC;IAGD,IAAI,MAAM;QACR,OAAO;YACL,IAAI,iBAAU,CACZ,IAAI,CAAC,QAAQ,EACb,IAAI,UAAG,CAAC,CAAC,CAAC;iBACP,GAAG,CAAC,eAAQ,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;iBACzD,QAAQ,EAAE,CACd;SACF,CAAC;IACJ,CAAC;IAGD,IAAI,QAAQ;QACV,MAAM,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;QAC/C,IAAI,CAAC,CAAC,UAAU,IAAI,gBAAgB,CAAC,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;SACvD;QAED,OAAO,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;IAGD,WAAW,CAAC,SAAoC;QAC9C,OAAO;IACT,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,CAAC,CAAC;IACX,CAAC;IAGD,WAAW,CAAC,SAAiB;QAC3B,OAAO;IACT,CAAC;IAED,cAAc,CAAC,SAAwB;QACrC,OAAO;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IAGD,IAAI,YAAY;QACd,OAAO;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;CACF;AApEW;IADT,iBAAU,CAAC,GAAG;mDACiC;AAahD;IADC,eAAQ;6CAGR;AAGD;IADC,aAAM;gDAGN;AAGD;IADC,eAAQ;8CAUR;AAGD;IADC,eAAQ;gDAQR;AAGD;IADC,aAAM;mDAGN;AAOD;IADC,aAAM;mDAGN;AAQD;IADC,eAAQ;oDAIR;AArEH,4CAsEC;AAEM,MAAM,mBAAmB,GAAG,CACjC,WAAwB,EACxB,OAAe,EACf,YAA2B,EAC3B,EAAE;IACF,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EACzB,GAAG,EAAE,CAAC,IAAI,gBAAgB,CAAC,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,CAC/D,CAAC;IACF,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAE3B,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAXW,QAAA,mBAAmB,uBAW9B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IRecipientConfig, UIProperties } from "./types";
|
|
2
|
+
import { TxChainSetter } from "./chain";
|
|
3
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
4
|
+
export declare class RecipientConfig extends TxChainSetter implements IRecipientConfig {
|
|
5
|
+
protected _value: string;
|
|
6
|
+
constructor(chainGetter: ChainGetter, initialChainId: string);
|
|
7
|
+
get recipient(): string;
|
|
8
|
+
get uiProperties(): UIProperties;
|
|
9
|
+
get value(): string;
|
|
10
|
+
setValue(value: string): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const useRecipientConfig: (chainGetter: ChainGetter, chainId: string) => RecipientConfig;
|
|
@@ -0,0 +1,80 @@
|
|
|
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.useRecipientConfig = exports.RecipientConfig = void 0;
|
|
10
|
+
const chain_1 = require("./chain");
|
|
11
|
+
const mobx_1 = require("mobx");
|
|
12
|
+
const errors_1 = require("./errors");
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const buffer_1 = require("buffer/");
|
|
15
|
+
class RecipientConfig extends chain_1.TxChainSetter {
|
|
16
|
+
constructor(chainGetter, initialChainId) {
|
|
17
|
+
super(chainGetter, initialChainId);
|
|
18
|
+
this._value = "";
|
|
19
|
+
(0, mobx_1.makeObservable)(this);
|
|
20
|
+
}
|
|
21
|
+
get recipient() {
|
|
22
|
+
const rawRecipient = this.value.trim();
|
|
23
|
+
const modularChainInfo = this.modularChainInfo;
|
|
24
|
+
if (!("starknet" in modularChainInfo)) {
|
|
25
|
+
throw new Error("Chain doesn't support the starknet");
|
|
26
|
+
}
|
|
27
|
+
return rawRecipient;
|
|
28
|
+
}
|
|
29
|
+
get uiProperties() {
|
|
30
|
+
const rawRecipient = this.value.trim();
|
|
31
|
+
if (!rawRecipient) {
|
|
32
|
+
return {
|
|
33
|
+
error: new errors_1.EmptyAddressError("Address is empty"),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (!rawRecipient.startsWith("0x")) {
|
|
37
|
+
return {
|
|
38
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
{
|
|
42
|
+
const hex = rawRecipient.replace("0x", "");
|
|
43
|
+
const buf = buffer_1.Buffer.from(hex, "hex");
|
|
44
|
+
if (buf.length !== 32) {
|
|
45
|
+
return {
|
|
46
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (hex.toLowerCase() !== buf.toString("hex").toLowerCase()) {
|
|
50
|
+
return {
|
|
51
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
get value() {
|
|
58
|
+
return this._value;
|
|
59
|
+
}
|
|
60
|
+
setValue(value) {
|
|
61
|
+
this._value = value;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__decorate([
|
|
65
|
+
mobx_1.observable
|
|
66
|
+
], RecipientConfig.prototype, "_value", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
mobx_1.computed
|
|
69
|
+
], RecipientConfig.prototype, "uiProperties", null);
|
|
70
|
+
__decorate([
|
|
71
|
+
mobx_1.action
|
|
72
|
+
], RecipientConfig.prototype, "setValue", null);
|
|
73
|
+
exports.RecipientConfig = RecipientConfig;
|
|
74
|
+
const useRecipientConfig = (chainGetter, chainId) => {
|
|
75
|
+
const [config] = (0, react_1.useState)(() => new RecipientConfig(chainGetter, chainId));
|
|
76
|
+
config.setChain(chainId);
|
|
77
|
+
return config;
|
|
78
|
+
};
|
|
79
|
+
exports.useRecipientConfig = useRecipientConfig;
|
|
80
|
+
//# sourceMappingURL=recipient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipient.js","sourceRoot":"","sources":["../../src/tx/recipient.ts"],"names":[],"mapp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AW,EAAE,KAAK,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE;gBAC3D,OAAO;oBACL,KAAK,EAAE,IAAI,wBAAe,CAAC,+BAA+B,CAAC;iBAC5D,CAAC;aACH;SACF;QAED,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAGD,QAAQ,CAAC,KAAa;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;CACF;AA7DW;IADT,iBAAU;+CACmB;AAoB9B;IADC,eAAQ;mDAgCR;AAOD;IADC,aAAM;+CAGN;AA9DH,0CA+DC;AAEM,MAAM,kBAAkB,GAAG,CAChC,WAAwB,EACxB,OAAe,EACf,EAAE;IACF,MAAM,CAAC,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEzB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AARW,QAAA,kBAAkB,sBAQ7B"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
2
|
+
import { StarknetQueriesStore } from "@keplr-wallet/stores-starknet";
|
|
3
|
+
export declare const useSendTxConfig: (chainGetter: ChainGetter, starknetQueriesStore: StarknetQueriesStore, chainId: string, sender: string, initialGas: number) => {
|
|
4
|
+
senderConfig: import("./sender").SenderConfig;
|
|
5
|
+
amountConfig: import("./amount").AmountConfig;
|
|
6
|
+
gasConfig: import("./gas").GasConfig;
|
|
7
|
+
feeConfig: import("./fee").FeeConfig;
|
|
8
|
+
recipientConfig: import("./recipient").RecipientConfig;
|
|
9
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSendTxConfig = void 0;
|
|
4
|
+
const index_1 = require("./index");
|
|
5
|
+
const amount_1 = require("./amount");
|
|
6
|
+
const useSendTxConfig = (chainGetter, starknetQueriesStore, chainId, sender, initialGas) => {
|
|
7
|
+
const senderConfig = (0, index_1.useSenderConfig)(chainGetter, starknetQueriesStore, chainId, sender);
|
|
8
|
+
const amountConfig = (0, amount_1.useAmountConfig)(chainGetter, starknetQueriesStore, chainId, senderConfig);
|
|
9
|
+
const gasConfig = (0, index_1.useGasConfig)(chainGetter, chainId, initialGas);
|
|
10
|
+
const feeConfig = (0, index_1.useFeeConfig)(chainGetter, starknetQueriesStore, chainId, senderConfig, amountConfig, gasConfig);
|
|
11
|
+
amountConfig.setFeeConfig(feeConfig);
|
|
12
|
+
const recipientConfig = (0, index_1.useRecipientConfig)(chainGetter, chainId);
|
|
13
|
+
return {
|
|
14
|
+
senderConfig,
|
|
15
|
+
amountConfig,
|
|
16
|
+
gasConfig,
|
|
17
|
+
feeConfig,
|
|
18
|
+
recipientConfig,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.useSendTxConfig = useSendTxConfig;
|
|
22
|
+
//# sourceMappingURL=send-tx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"send-tx.js","sourceRoot":"","sources":["../../src/tx/send-tx.ts"],"names":[],"mappings":";;;AACA,mCAKiB;AACjB,qCAA2C;AAGpC,MAAM,eAAe,GAAG,CAC7B,WAAwB,EACxB,oBAA0C,EAC1C,OAAe,EACf,MAAc,EACd,UAAkB,EAClB,EAAE;IACF,MAAM,YAAY,GAAG,IAAA,uBAAe,EAClC,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,MAAM,CACP,CAAC;IAEF,MAAM,YAAY,GAAG,IAAA,wBAAe,EAClC,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,YAAY,CACb,CAAC;IAEF,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,WAAW,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,IAAA,oBAAY,EAC5B,WAAW,EACX,oBAAoB,EACpB,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,SAAS,CACV,CAAC;IAEF,YAAY,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAErC,MAAM,eAAe,GAAG,IAAA,0BAAkB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEjE,OAAO;QACL,YAAY;QACZ,YAAY;QACZ,SAAS;QACT,SAAS;QACT,eAAe;KAChB,CAAC;AACJ,CAAC,CAAC;AA1CW,QAAA,eAAe,mBA0C1B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ISenderConfig, UIProperties } from "./types";
|
|
2
|
+
import { TxChainSetter } from "./chain";
|
|
3
|
+
import { ChainGetter } from "@keplr-wallet/stores";
|
|
4
|
+
import { StarknetQueriesStore } from "@keplr-wallet/stores-starknet";
|
|
5
|
+
export declare class SenderConfig extends TxChainSetter implements ISenderConfig {
|
|
6
|
+
protected readonly starknetQueriesStore: StarknetQueriesStore;
|
|
7
|
+
protected _value: string;
|
|
8
|
+
constructor(chainGetter: ChainGetter, starknetQueriesStore: StarknetQueriesStore, initialChainId: string, initialSender: string);
|
|
9
|
+
get sender(): string;
|
|
10
|
+
get value(): string;
|
|
11
|
+
setValue(value: string): void;
|
|
12
|
+
get uiProperties(): UIProperties;
|
|
13
|
+
}
|
|
14
|
+
export declare const useSenderConfig: (chainGetter: ChainGetter, starknetQueriesStore: StarknetQueriesStore, chainId: string, sender: string) => SenderConfig;
|
|
@@ -0,0 +1,88 @@
|
|
|
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.useSenderConfig = exports.SenderConfig = void 0;
|
|
10
|
+
const chain_1 = require("./chain");
|
|
11
|
+
const mobx_1 = require("mobx");
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
const errors_1 = require("./errors");
|
|
14
|
+
const buffer_1 = require("buffer");
|
|
15
|
+
class SenderConfig extends chain_1.TxChainSetter {
|
|
16
|
+
constructor(chainGetter, starknetQueriesStore, initialChainId, initialSender) {
|
|
17
|
+
super(chainGetter, initialChainId);
|
|
18
|
+
this.starknetQueriesStore = starknetQueriesStore;
|
|
19
|
+
this._value = "";
|
|
20
|
+
this._value = initialSender;
|
|
21
|
+
(0, mobx_1.makeObservable)(this);
|
|
22
|
+
}
|
|
23
|
+
get sender() {
|
|
24
|
+
return this._value;
|
|
25
|
+
}
|
|
26
|
+
get value() {
|
|
27
|
+
return this._value;
|
|
28
|
+
}
|
|
29
|
+
setValue(value) {
|
|
30
|
+
this._value = value;
|
|
31
|
+
}
|
|
32
|
+
get uiProperties() {
|
|
33
|
+
var _a;
|
|
34
|
+
if (!this.value) {
|
|
35
|
+
return {
|
|
36
|
+
error: new errors_1.EmptyAddressError("Address is empty"),
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
if (!this.value.startsWith("0x")) {
|
|
40
|
+
return {
|
|
41
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
{
|
|
45
|
+
const hex = this.value.replace("0x", "");
|
|
46
|
+
const buf = buffer_1.Buffer.from(hex, "hex");
|
|
47
|
+
if (buf.length !== 32) {
|
|
48
|
+
return {
|
|
49
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (hex.toLowerCase() !== buf.toString("hex").toLowerCase()) {
|
|
53
|
+
return {
|
|
54
|
+
error: new errors_1.InvalidHexError("Invalid hex address for chain"),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const queryNonce = this.starknetQueriesStore
|
|
59
|
+
.get(this.chainId)
|
|
60
|
+
.queryAccountNonce.getNonce(this.value);
|
|
61
|
+
if (!queryNonce.response && !queryNonce.error) {
|
|
62
|
+
return {
|
|
63
|
+
loadingState: "loading-block",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (((_a = queryNonce.error) === null || _a === void 0 ? void 0 : _a.message) === "Contract not found") {
|
|
67
|
+
return {
|
|
68
|
+
error: new errors_1.AccountNotDeployed("Account not deployed"),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
__decorate([
|
|
75
|
+
mobx_1.observable
|
|
76
|
+
], SenderConfig.prototype, "_value", void 0);
|
|
77
|
+
__decorate([
|
|
78
|
+
mobx_1.action
|
|
79
|
+
], SenderConfig.prototype, "setValue", null);
|
|
80
|
+
exports.SenderConfig = SenderConfig;
|
|
81
|
+
const useSenderConfig = (chainGetter, starknetQueriesStore, chainId, sender) => {
|
|
82
|
+
const [config] = (0, react_1.useState)(() => new SenderConfig(chainGetter, starknetQueriesStore, chainId, sender));
|
|
83
|
+
config.setChain(chainId);
|
|
84
|
+
config.setValue(sender);
|
|
85
|
+
return config;
|
|
86
|
+
};
|
|
87
|
+
exports.useSenderConfig = useSenderConfig;
|
|
88
|
+
//# sourceMappingURL=sender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender.js","sourceRoot":"","sources":["../../src/tx/sender.ts"],"names":[],"mappings":";;;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interface ITxChainSetter {
|
|
4
|
+
chainId: string;
|
|
5
|
+
setChain(chainId: string): void;
|
|
6
|
+
}
|
|
7
|
+
export interface UIProperties {
|
|
8
|
+
readonly error?: Error;
|
|
9
|
+
readonly warning?: Error;
|
|
10
|
+
readonly loadingState?: "loading" | "loading-block";
|
|
11
|
+
}
|
|
12
|
+
export interface IGasConfig extends ITxChainSetter {
|
|
13
|
+
value: string;
|
|
14
|
+
setValue(value: string | number): void;
|
|
15
|
+
gas: number;
|
|
16
|
+
uiProperties: UIProperties;
|
|
17
|
+
}
|
|
18
|
+
export interface ISenderConfig extends ITxChainSetter {
|
|
19
|
+
value: string;
|
|
20
|
+
setValue(value: string): void;
|
|
21
|
+
sender: string;
|
|
22
|
+
uiProperties: UIProperties;
|
|
23
|
+
}
|
|
24
|
+
export interface IFeeConfig extends ITxChainSetter {
|
|
25
|
+
type: "ETH" | "STRK";
|
|
26
|
+
setType(type: "ETH" | "STRK"): void;
|
|
27
|
+
gasPrice: CoinPretty | undefined;
|
|
28
|
+
maxGasPrice: CoinPretty | undefined;
|
|
29
|
+
setGasPrice(gasPrice: {
|
|
30
|
+
gasPrice: CoinPretty;
|
|
31
|
+
maxGasPrice: CoinPretty;
|
|
32
|
+
} | undefined): void;
|
|
33
|
+
fee: CoinPretty | undefined;
|
|
34
|
+
maxFee: CoinPretty | undefined;
|
|
35
|
+
uiProperties: UIProperties;
|
|
36
|
+
}
|
|
37
|
+
export interface IRecipientConfig extends ITxChainSetter {
|
|
38
|
+
value: string;
|
|
39
|
+
setValue(value: string): void;
|
|
40
|
+
recipient: string;
|
|
41
|
+
uiProperties: UIProperties;
|
|
42
|
+
}
|
|
43
|
+
export interface IAmountConfig extends ITxChainSetter {
|
|
44
|
+
amount: CoinPretty[];
|
|
45
|
+
value: string;
|
|
46
|
+
setValue(value: string): void;
|
|
47
|
+
currency: ERC20Currency;
|
|
48
|
+
setCurrency(currency: ERC20Currency | undefined): void;
|
|
49
|
+
canUseCurrency(currency: ERC20Currency): boolean;
|
|
50
|
+
fraction: number;
|
|
51
|
+
setFraction(fraction: number): void;
|
|
52
|
+
uiProperties: UIProperties;
|
|
53
|
+
}
|
|
54
|
+
export interface IGasSimulator {
|
|
55
|
+
enabled: boolean;
|
|
56
|
+
setEnabled(value: boolean): void;
|
|
57
|
+
isSimulating: boolean;
|
|
58
|
+
gasEstimated: number | undefined;
|
|
59
|
+
gasAdjustment: number;
|
|
60
|
+
gasAdjustmentValue: string;
|
|
61
|
+
setGasAdjustmentValue(gasAdjustment: string | number): void;
|
|
62
|
+
uiProperties: UIProperties;
|
|
63
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tx/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAmountConfig, IFeeConfig, IGasConfig, IGasSimulator, IRecipientConfig, ISenderConfig } from "./types";
|
|
2
|
+
export declare const useTxConfigsValidate: (configs: {
|
|
3
|
+
amountConfig?: IAmountConfig;
|
|
4
|
+
senderConfig?: ISenderConfig;
|
|
5
|
+
recipientConfig?: IRecipientConfig;
|
|
6
|
+
gasConfig?: IGasConfig;
|
|
7
|
+
feeConfig?: IFeeConfig;
|
|
8
|
+
gasSimulator?: IGasSimulator;
|
|
9
|
+
}) => {
|
|
10
|
+
interactionBlocked: boolean;
|
|
11
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useTxConfigsValidate = void 0;
|
|
4
|
+
// CONTRACT: Use with `observer`
|
|
5
|
+
const useTxConfigsValidate = (configs) => {
|
|
6
|
+
const interactionBlocked = (() => {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
/*
|
|
9
|
+
* XXX: 밑의 예시같은 식으로 처리하면 안된다...
|
|
10
|
+
* 그러면 또는(||)에 의해서 앞에꺼에서 true가 나오면 뒤에꺼가 실행도 안되는 문제가 있다.
|
|
11
|
+
* mobx observable의 특성상 이렇게 처리되면 의도에 맞지 않는다.
|
|
12
|
+
* if (
|
|
13
|
+
configs.amountConfig?.uiProperties.error ||
|
|
14
|
+
configs.senderConfig?.uiProperties.error ||
|
|
15
|
+
configs.recipientConfig?.uiProperties.error ||
|
|
16
|
+
configs.gasConfig?.uiProperties.error ||
|
|
17
|
+
configs.feeConfig?.uiProperties.error ||
|
|
18
|
+
configs.gasSimulator?.uiProperties.error
|
|
19
|
+
) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
*/
|
|
23
|
+
const amountConfigUIProperties = (_a = configs.amountConfig) === null || _a === void 0 ? void 0 : _a.uiProperties;
|
|
24
|
+
const senderConfigUIProperties = (_b = configs.senderConfig) === null || _b === void 0 ? void 0 : _b.uiProperties;
|
|
25
|
+
const recipientConfigUIProperties = (_c = configs.recipientConfig) === null || _c === void 0 ? void 0 : _c.uiProperties;
|
|
26
|
+
const gasConfigUIProperties = (_d = configs.gasConfig) === null || _d === void 0 ? void 0 : _d.uiProperties;
|
|
27
|
+
const feeConfigUIProperties = (_e = configs.feeConfig) === null || _e === void 0 ? void 0 : _e.uiProperties;
|
|
28
|
+
const gasSimulatorUIProperties = (_f = configs.gasSimulator) === null || _f === void 0 ? void 0 : _f.uiProperties;
|
|
29
|
+
if ((amountConfigUIProperties === null || amountConfigUIProperties === void 0 ? void 0 : amountConfigUIProperties.error) ||
|
|
30
|
+
(senderConfigUIProperties === null || senderConfigUIProperties === void 0 ? void 0 : senderConfigUIProperties.error) ||
|
|
31
|
+
(recipientConfigUIProperties === null || recipientConfigUIProperties === void 0 ? void 0 : recipientConfigUIProperties.error) ||
|
|
32
|
+
(gasConfigUIProperties === null || gasConfigUIProperties === void 0 ? void 0 : gasConfigUIProperties.error) ||
|
|
33
|
+
(feeConfigUIProperties === null || feeConfigUIProperties === void 0 ? void 0 : feeConfigUIProperties.error) ||
|
|
34
|
+
(gasSimulatorUIProperties === null || gasSimulatorUIProperties === void 0 ? void 0 : gasSimulatorUIProperties.error)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if ((amountConfigUIProperties === null || amountConfigUIProperties === void 0 ? void 0 : amountConfigUIProperties.loadingState) === "loading-block" ||
|
|
38
|
+
(senderConfigUIProperties === null || senderConfigUIProperties === void 0 ? void 0 : senderConfigUIProperties.loadingState) === "loading-block" ||
|
|
39
|
+
(recipientConfigUIProperties === null || recipientConfigUIProperties === void 0 ? void 0 : recipientConfigUIProperties.loadingState) === "loading-block" ||
|
|
40
|
+
(gasConfigUIProperties === null || gasConfigUIProperties === void 0 ? void 0 : gasConfigUIProperties.loadingState) === "loading-block" ||
|
|
41
|
+
(feeConfigUIProperties === null || feeConfigUIProperties === void 0 ? void 0 : feeConfigUIProperties.loadingState) === "loading-block" ||
|
|
42
|
+
(gasSimulatorUIProperties === null || gasSimulatorUIProperties === void 0 ? void 0 : gasSimulatorUIProperties.loadingState) === "loading-block") {
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
})();
|
|
47
|
+
return {
|
|
48
|
+
interactionBlocked,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
exports.useTxConfigsValidate = useTxConfigsValidate;
|
|
52
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/tx/validate.ts"],"names":[],"mappings":";;;AASA,gCAAgC;AACzB,MAAM,oBAAoB,GAAG,CAAC,OAOpC,EAAE,EAAE;IACH,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE;;QAC/B;;;;;;;;;;;;;;WAcG;QACH,MAAM,wBAAwB,GAAG,MAAA,OAAO,CAAC,YAAY,0CAAE,YAAY,CAAC;QACpE,MAAM,wBAAwB,GAAG,MAAA,OAAO,CAAC,YAAY,0CAAE,YAAY,CAAC;QACpE,MAAM,2B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CAAC,EAAE,CAAC;IAEL,OAAO;QACL,kBAAkB;KACnB,CAAC;AACJ,CAAC,CAAC;AA3DW,QAAA,oBAAoB,wBA2D/B"}
|
package/jest.config.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keplr-wallet/hooks-starknet",
|
|
3
|
+
"version": "0.12.133-rc.0",
|
|
4
|
+
"main": "build/index.js",
|
|
5
|
+
"author": "chainapsis",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"clean": "rm -rf node_modules; rm -rf build",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"dev": "tsc -w",
|
|
14
|
+
"test": "jest --passWithNoTests",
|
|
15
|
+
"lint-test": "eslint \"src/**/*\" && prettier --check \"src/**/*\"",
|
|
16
|
+
"lint-fix": "eslint --fix \"src/**/*\" && prettier --write \"src/**/*\""
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@ethersproject/address": "^5.7.0",
|
|
20
|
+
"@ethersproject/providers": "^5.7.0",
|
|
21
|
+
"@keplr-wallet/background": "0.12.133-rc.0",
|
|
22
|
+
"@keplr-wallet/common": "0.12.133-rc.0",
|
|
23
|
+
"@keplr-wallet/cosmos": "0.12.133-rc.0",
|
|
24
|
+
"@keplr-wallet/crypto": "0.12.133-rc.0",
|
|
25
|
+
"@keplr-wallet/proto-types": "0.12.133-rc.0",
|
|
26
|
+
"@keplr-wallet/simple-fetch": "0.12.133-rc.0",
|
|
27
|
+
"@keplr-wallet/stores": "0.12.133-rc.0",
|
|
28
|
+
"@keplr-wallet/stores-etc": "0.12.133-rc.0",
|
|
29
|
+
"@keplr-wallet/stores-eth": "0.12.133-rc.0",
|
|
30
|
+
"@keplr-wallet/stores-starknet": "0.12.133-rc.0",
|
|
31
|
+
"@keplr-wallet/types": "0.12.133-rc.0",
|
|
32
|
+
"@keplr-wallet/unit": "0.12.133-rc.0",
|
|
33
|
+
"buffer": "^6.0.3",
|
|
34
|
+
"long": "^4.0.0",
|
|
35
|
+
"utility-types": "^3.10.0"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"mobx": "^6",
|
|
39
|
+
"mobx-utils": "^6",
|
|
40
|
+
"react": "^16.8.0 || ^17 || ^18"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "6496cf28fc619e718b4e2e9e347755730292745b"
|
|
43
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./tx";
|