@hyperlane-xyz/widgets 1.0.0-beta1
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/LICENSE.md +195 -0
- package/README.md +21 -0
- package/dist/color.d.ts +9 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +13 -0
- package/dist/color.js.map +1 -0
- package/dist/consts.d.ts +2 -0
- package/dist/consts.d.ts.map +1 -0
- package/dist/consts.js +5 -0
- package/dist/consts.js.map +1 -0
- package/dist/icons/Airplane.d.ts +11 -0
- package/dist/icons/Airplane.d.ts.map +1 -0
- package/dist/icons/Airplane.js +35 -0
- package/dist/icons/Airplane.js.map +1 -0
- package/dist/icons/ChainLogo.d.ts +15 -0
- package/dist/icons/ChainLogo.d.ts.map +1 -0
- package/dist/icons/ChainLogo.js +95 -0
- package/dist/icons/ChainLogo.js.map +1 -0
- package/dist/icons/Envelope.d.ts +11 -0
- package/dist/icons/Envelope.d.ts.map +1 -0
- package/dist/icons/Envelope.js +36 -0
- package/dist/icons/Envelope.js.map +1 -0
- package/dist/icons/Lock.d.ts +11 -0
- package/dist/icons/Lock.d.ts.map +1 -0
- package/dist/icons/Lock.js +34 -0
- package/dist/icons/Lock.js.map +1 -0
- package/dist/icons/QuestionMark.d.ts +11 -0
- package/dist/icons/QuestionMark.d.ts.map +1 -0
- package/dist/icons/QuestionMark.js +34 -0
- package/dist/icons/QuestionMark.js.map +1 -0
- package/dist/icons/Shield.d.ts +11 -0
- package/dist/icons/Shield.d.ts.map +1 -0
- package/dist/icons/Shield.js +35 -0
- package/dist/icons/Shield.js.map +1 -0
- package/dist/icons/WideChevron.d.ts +13 -0
- package/dist/icons/WideChevron.d.ts.map +1 -0
- package/dist/icons/WideChevron.js +57 -0
- package/dist/icons/WideChevron.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/messages/MessageTimeline.d.ts +11 -0
- package/dist/messages/MessageTimeline.d.ts.map +1 -0
- package/dist/messages/MessageTimeline.js +111 -0
- package/dist/messages/MessageTimeline.js.map +1 -0
- package/dist/messages/types.d.ts +58 -0
- package/dist/messages/types.d.ts.map +1 -0
- package/dist/messages/types.js +20 -0
- package/dist/messages/types.js.map +1 -0
- package/dist/messages/useMessage.d.ts +14 -0
- package/dist/messages/useMessage.d.ts.map +1 -0
- package/dist/messages/useMessage.js +73 -0
- package/dist/messages/useMessage.js.map +1 -0
- package/dist/messages/useMessageStage.d.ts +13 -0
- package/dist/messages/useMessageStage.d.ts.map +1 -0
- package/dist/messages/useMessageStage.js +149 -0
- package/dist/messages/useMessageStage.js.map +1 -0
- package/dist/messages/useMessageTimeline.d.ts +15 -0
- package/dist/messages/useMessageTimeline.d.ts.map +1 -0
- package/dist/messages/useMessageTimeline.js +18 -0
- package/dist/messages/useMessageTimeline.js.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/utils/explorers.d.ts +19 -0
- package/dist/utils/explorers.d.ts.map +1 -0
- package/dist/utils/explorers.js +81 -0
- package/dist/utils/explorers.js.map +1 -0
- package/dist/utils/timeout.d.ts +2 -0
- package/dist/utils/timeout.d.ts.map +1 -0
- package/dist/utils/timeout.js +23 -0
- package/dist/utils/timeout.js.map +1 -0
- package/dist/utils/useInterval.d.ts +2 -0
- package/dist/utils/useInterval.d.ts.map +1 -0
- package/dist/utils/useInterval.js +26 -0
- package/dist/utils/useInterval.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shield.d.ts","sourceRoot":"","sources":["../../src/icons/Shield.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAIpC,UAAU,KAAK;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAGD,iBAAS,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,KAAK,eAgB5D;AAED,eAAO,MAAM,UAAU,+CAAoB,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.ShieldIcon = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const color_1 = require("../color");
|
|
29
|
+
// Shield with checkmark
|
|
30
|
+
function _ShieldIcon({ width, height, color, classes }) {
|
|
31
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", width: width, height: height, className: classes },
|
|
32
|
+
react_1.default.createElement("path", { "fill-rule": "evenodd", d: "M8 0c-.69 0-1.843.265-2.928.56-1.11.3-2.229.655-2.887.87a1.54 1.54 0 0 0-1.044 1.262c-.596 4.477.787 7.795 2.465 9.99a11.777 11.777 0 0 0 2.517 2.453c.386.273.744.482 1.048.625.28.132.581.24.829.24s.548-.108.829-.24a7.159 7.159 0 0 0 1.048-.625 11.775 11.775 0 0 0 2.517-2.453c1.678-2.195 3.061-5.513 2.465-9.99a1.541 1.541 0 0 0-1.044-1.263 62.467 62.467 0 0 0-2.887-.87C9.843.266 8.69 0 8 0zm2.146 5.146a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 7.793l2.646-2.647z", fill: color || color_1.Color.Blue })));
|
|
33
|
+
}
|
|
34
|
+
exports.ShieldIcon = (0, react_1.memo)(_ShieldIcon);
|
|
35
|
+
//# sourceMappingURL=Shield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Shield.js","sourceRoot":"","sources":["../../src/icons/Shield.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAoC;AAEpC,oCAAiC;AASjC,wBAAwB;AACxB,SAAS,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAS;IAC3D,OAAO,CACL,uCACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO;QAElB,qDACY,SAAS,EACnB,CAAC,EAAC,ufAAuf,EACzf,IAAI,EAAE,KAAK,IAAI,aAAK,CAAC,IAAI,GACzB,CACE,CACP,CAAC;AACJ,CAAC;AAEY,QAAA,UAAU,GAAG,IAAA,YAAI,EAAC,WAAW,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface WideChevronProps {
|
|
3
|
+
width?: string | number;
|
|
4
|
+
height?: string | number;
|
|
5
|
+
direction: 'n' | 'e' | 's' | 'w';
|
|
6
|
+
color?: string;
|
|
7
|
+
rounded?: boolean;
|
|
8
|
+
classes?: string;
|
|
9
|
+
}
|
|
10
|
+
declare function _WideChevron({ width, height, direction, color, rounded, classes }: WideChevronProps): JSX.Element;
|
|
11
|
+
export declare const WideChevron: React.MemoExoticComponent<typeof _WideChevron>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=WideChevron.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WideChevron.d.ts","sourceRoot":"","sources":["../../src/icons/WideChevron.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAIpC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,gBAAgB,eA6C5F;AAED,eAAO,MAAM,WAAW,gDAAqB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.WideChevron = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const color_1 = require("../color");
|
|
29
|
+
function _WideChevron({ width, height, direction, color, rounded, classes }) {
|
|
30
|
+
let directionClass;
|
|
31
|
+
switch (direction) {
|
|
32
|
+
case 'n':
|
|
33
|
+
directionClass = '-rotate-90';
|
|
34
|
+
break;
|
|
35
|
+
case 'e':
|
|
36
|
+
directionClass = '';
|
|
37
|
+
break;
|
|
38
|
+
case 's':
|
|
39
|
+
directionClass = 'rotate-90';
|
|
40
|
+
break;
|
|
41
|
+
case 'w':
|
|
42
|
+
directionClass = 'rotate-180';
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
throw new Error(`Invalid chevron direction ${direction}`);
|
|
46
|
+
}
|
|
47
|
+
if (rounded) {
|
|
48
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 120.3 190", width: width, height: height, fill: color || color_1.Color.Blue, className: `${directionClass} ${classes}` },
|
|
49
|
+
react_1.default.createElement("path", { d: "M4.4 0h53c7.2 0 13.7 3 16.2 7.7l46.5 85.1a2 2 0 0 1 0 2l-.2.5-46.3 87c-2.5 4.6-9 7.7-16.3 7.7h-53c-3 0-5-2-4-4L48 92.9.4 4c-1-2 1-4 4-4Z" })));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 28 27", width: width, height: height, className: `${directionClass} ${classes}` },
|
|
53
|
+
react_1.default.createElement("path", { d: "M13.44 13.5 0 27h14.56L28 13.5 14.56 0H0l13.44 13.5Z", fill: color || color_1.Color.Blue })));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.WideChevron = (0, react_1.memo)(_WideChevron);
|
|
57
|
+
//# sourceMappingURL=WideChevron.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WideChevron.js","sourceRoot":"","sources":["../../src/icons/WideChevron.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAoC;AAEpC,oCAAiC;AAWjC,SAAS,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAoB;IAC3F,IAAI,cAAc,CAAC;IACnB,QAAQ,SAAS,EAAE;QACjB,KAAK,GAAG;YACN,cAAc,GAAG,YAAY,CAAC;YAC9B,MAAM;QACR,KAAK,GAAG;YACN,cAAc,GAAG,EAAE,CAAC;YACpB,MAAM;QACR,KAAK,GAAG;YACN,cAAc,GAAG,WAAW,CAAC;YAC7B,MAAM;QACR,KAAK,GAAG;YACN,cAAc,GAAG,YAAY,CAAC;YAC9B,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;KAC7D;IAED,IAAI,OAAO,EAAE;QACX,OAAO,CACL,uCACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,eAAe,EACvB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,KAAK,IAAI,aAAK,CAAC,IAAI,EACzB,SAAS,EAAE,GAAG,cAAc,IAAI,OAAO,EAAE;YAEzC,wCAAM,CAAC,EAAC,0IAA0I,GAAG,CACjJ,CACP,CAAC;KACH;SAAM;QACL,OAAO,CACL,uCACE,KAAK,EAAC,4BAA4B,EAClC,OAAO,EAAC,WAAW,EACnB,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,GAAG,cAAc,IAAI,OAAO,EAAE;YAEzC,wCAAM,CAAC,EAAC,sDAAsD,EAAC,IAAI,EAAE,KAAK,IAAI,aAAK,CAAC,IAAI,GAAI,CACxF,CACP,CAAC;KACH;AACH,CAAC;AAEY,QAAA,WAAW,GAAG,IAAA,YAAI,EAAC,YAAY,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Color } from './color';
|
|
2
|
+
export * from './consts';
|
|
3
|
+
export { ChainLogo } from './icons/ChainLogo';
|
|
4
|
+
export { WideChevron } from './icons/WideChevron';
|
|
5
|
+
export { MessageTimeline } from './messages/MessageTimeline';
|
|
6
|
+
export { MessageStage, MessageStatus, type ApiMessage, type StageTimings } from './messages/types';
|
|
7
|
+
export { useMessage } from './messages/useMessage';
|
|
8
|
+
export { useMessageStage } from './messages/useMessageStage';
|
|
9
|
+
export { useMessageTimeline } from './messages/useMessageTimeline';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
exports.useMessageTimeline = exports.useMessageStage = exports.useMessage = exports.MessageStatus = exports.MessageStage = exports.MessageTimeline = exports.WideChevron = exports.ChainLogo = exports.Color = void 0;
|
|
18
|
+
var color_1 = require("./color");
|
|
19
|
+
Object.defineProperty(exports, "Color", { enumerable: true, get: function () { return color_1.Color; } });
|
|
20
|
+
__exportStar(require("./consts"), exports);
|
|
21
|
+
var ChainLogo_1 = require("./icons/ChainLogo");
|
|
22
|
+
Object.defineProperty(exports, "ChainLogo", { enumerable: true, get: function () { return ChainLogo_1.ChainLogo; } });
|
|
23
|
+
var WideChevron_1 = require("./icons/WideChevron");
|
|
24
|
+
Object.defineProperty(exports, "WideChevron", { enumerable: true, get: function () { return WideChevron_1.WideChevron; } });
|
|
25
|
+
var MessageTimeline_1 = require("./messages/MessageTimeline");
|
|
26
|
+
Object.defineProperty(exports, "MessageTimeline", { enumerable: true, get: function () { return MessageTimeline_1.MessageTimeline; } });
|
|
27
|
+
var types_1 = require("./messages/types");
|
|
28
|
+
Object.defineProperty(exports, "MessageStage", { enumerable: true, get: function () { return types_1.MessageStage; } });
|
|
29
|
+
Object.defineProperty(exports, "MessageStatus", { enumerable: true, get: function () { return types_1.MessageStatus; } });
|
|
30
|
+
var useMessage_1 = require("./messages/useMessage");
|
|
31
|
+
Object.defineProperty(exports, "useMessage", { enumerable: true, get: function () { return useMessage_1.useMessage; } });
|
|
32
|
+
var useMessageStage_1 = require("./messages/useMessageStage");
|
|
33
|
+
Object.defineProperty(exports, "useMessageStage", { enumerable: true, get: function () { return useMessageStage_1.useMessageStage; } });
|
|
34
|
+
var useMessageTimeline_1 = require("./messages/useMessageTimeline");
|
|
35
|
+
Object.defineProperty(exports, "useMessageTimeline", { enumerable: true, get: function () { return useMessageTimeline_1.useMessageTimeline; } });
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AACd,2CAAyB;AACzB,+CAA8C;AAArC,sGAAA,SAAS,OAAA;AAClB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,0CAAmG;AAA1F,qGAAA,YAAY,OAAA;AAAE,sGAAA,aAAa,OAAA;AACpC,oDAAmD;AAA1C,wGAAA,UAAU,OAAA;AACnB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,oEAAmE;AAA1D,wHAAA,kBAAkB,OAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MessageStatus, MessageStage as Stage, StageTimings } from './types';
|
|
3
|
+
interface Props {
|
|
4
|
+
status: MessageStatus;
|
|
5
|
+
stage: Stage;
|
|
6
|
+
timings: StageTimings;
|
|
7
|
+
timestampSent?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function MessageTimeline({ status, stage: _stage, timings, timestampSent }: Props): JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=MessageTimeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageTimeline.d.ts","sourceRoot":"","sources":["../../src/messages/MessageTimeline.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,aAAa,EAAE,YAAY,IAAI,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7E,UAAU,KAAK;IACb,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,EAAE,KAAK,eAwHvF"}
|
|
@@ -0,0 +1,111 @@
|
|
|
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.MessageTimeline = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const color_1 = require("../color");
|
|
9
|
+
const Airplane_1 = require("../icons/Airplane");
|
|
10
|
+
const Envelope_1 = require("../icons/Envelope");
|
|
11
|
+
const Lock_1 = require("../icons/Lock");
|
|
12
|
+
const Shield_1 = require("../icons/Shield");
|
|
13
|
+
const WideChevron_1 = require("../icons/WideChevron");
|
|
14
|
+
const types_1 = require("./types");
|
|
15
|
+
function MessageTimeline({ status, stage: _stage, timings, timestampSent }) {
|
|
16
|
+
// Ignore stage value if status shows as delivered
|
|
17
|
+
const stage = status === types_1.MessageStatus.Delivered ? types_1.MessageStage.Relayed : _stage;
|
|
18
|
+
const timeSent = timestampSent ? new Date(timestampSent) : null;
|
|
19
|
+
const timeSentStr = timeSent
|
|
20
|
+
? `${timeSent.toLocaleDateString()} ${timeSent.toLocaleTimeString()}`
|
|
21
|
+
: null;
|
|
22
|
+
return (react_1.default.createElement("div", { className: "sm:px-2 pt-14 pb-1 flex" },
|
|
23
|
+
react_1.default.createElement("div", { className: "flex-1 flex flex-col items-center" },
|
|
24
|
+
react_1.default.createElement("div", { className: `w-full h-6 flex items-center justify-center bg-blue-500 rounded-l relative ${getStageClass(types_1.MessageStage.Sent, stage, status)}` },
|
|
25
|
+
react_1.default.createElement("div", { className: "w-3 h-3 rounded-full bg-white" }),
|
|
26
|
+
react_1.default.createElement("div", { className: "absolute -top-12 flex flex-col items-center" },
|
|
27
|
+
react_1.default.createElement(StageIcon, { Icon: Airplane_1.AirplaneIcon }),
|
|
28
|
+
react_1.default.createElement("div", { className: "w-0.5 h-4 bg-blue-500" })),
|
|
29
|
+
react_1.default.createElement("div", { className: "absolute -right-3 top-0 h-6" },
|
|
30
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto" }))),
|
|
31
|
+
react_1.default.createElement("h4", { className: "mt-2.5 text-gray-700 text-sm sm:text-base" }, getStageHeader(types_1.MessageStage.Sent, stage, timings, status)),
|
|
32
|
+
react_1.default.createElement("p", { className: "mt-1 sm:px-4 text-xs text-gray-500 text-center" }, timeSentStr
|
|
33
|
+
? `Origin transaction sent at ${timeSentStr}`
|
|
34
|
+
: 'Waiting for origin transaction')),
|
|
35
|
+
react_1.default.createElement("div", { className: "flex-0 w-2 sm:w-5" }),
|
|
36
|
+
react_1.default.createElement("div", { className: "flex-1 flex flex-col items-center" },
|
|
37
|
+
react_1.default.createElement("div", { className: `w-full h-6 flex items-center justify-center bg-blue-500 relative ${getStageClass(types_1.MessageStage.Finalized, stage, status)}` },
|
|
38
|
+
react_1.default.createElement("div", { className: "w-3 h-3 rounded-full bg-white" }),
|
|
39
|
+
react_1.default.createElement("div", { className: "absolute -top-12 flex flex-col items-center" },
|
|
40
|
+
react_1.default.createElement(StageIcon, { Icon: Lock_1.LockIcon, size: 14 }),
|
|
41
|
+
react_1.default.createElement("div", { className: "w-0.5 h-4 bg-blue-500" })),
|
|
42
|
+
react_1.default.createElement("div", { className: "absolute -left-3 top-0 h-6" },
|
|
43
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto", color: "#ffffff" })),
|
|
44
|
+
react_1.default.createElement("div", { className: "absolute -right-3 top-0 h-6" },
|
|
45
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto" }))),
|
|
46
|
+
react_1.default.createElement("h4", { className: "mt-2.5 text-gray-700 text-sm sm:text-base" }, getStageHeader(types_1.MessageStage.Finalized, stage, timings, status)),
|
|
47
|
+
react_1.default.createElement("p", { className: "mt-1 sm:px-4 text-xs text-gray-500 text-center" }, "Origin transaction has sufficient confirmations")),
|
|
48
|
+
react_1.default.createElement("div", { className: "flex-0 w-2 sm:w-5" }),
|
|
49
|
+
react_1.default.createElement("div", { className: "flex-1 flex flex-col items-center" },
|
|
50
|
+
react_1.default.createElement("div", { className: `w-full h-6 flex items-center justify-center bg-blue-500 relative ${getStageClass(types_1.MessageStage.Validated, stage, status)}` },
|
|
51
|
+
react_1.default.createElement("div", { className: "w-3 h-3 rounded-full bg-white" }),
|
|
52
|
+
react_1.default.createElement("div", { className: "absolute -top-12 flex flex-col items-center" },
|
|
53
|
+
react_1.default.createElement(StageIcon, { Icon: Shield_1.ShieldIcon }),
|
|
54
|
+
react_1.default.createElement("div", { className: "w-0.5 h-4 bg-blue-500" })),
|
|
55
|
+
react_1.default.createElement("div", { className: "absolute -left-3 top-0 h-6" },
|
|
56
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto", color: "#ffffff" })),
|
|
57
|
+
react_1.default.createElement("div", { className: "absolute -right-3 top-0 h-6" },
|
|
58
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto" }))),
|
|
59
|
+
react_1.default.createElement("h4", { className: "mt-2.5 text-gray-700 text-sm sm:text-base" }, getStageHeader(types_1.MessageStage.Validated, stage, timings, status)),
|
|
60
|
+
react_1.default.createElement("p", { className: "mt-1 sm:px-4 text-xs text-gray-500 text-center" }, "Validators have signed the message bundle")),
|
|
61
|
+
react_1.default.createElement("div", { className: "flex-0 w-2 sm:w-5" }),
|
|
62
|
+
react_1.default.createElement("div", { className: "flex-1 flex flex-col items-center" },
|
|
63
|
+
react_1.default.createElement("div", { className: `w-full h-6 flex items-center justify-center bg-blue-500 rounded-r relative ${getStageClass(types_1.MessageStage.Relayed, stage, status)}` },
|
|
64
|
+
react_1.default.createElement("div", { className: "w-3 h-3 rounded-full bg-white" }),
|
|
65
|
+
react_1.default.createElement("div", { className: "absolute -top-12 flex flex-col items-center" },
|
|
66
|
+
react_1.default.createElement(StageIcon, { Icon: Envelope_1.EnvelopeIcon }),
|
|
67
|
+
react_1.default.createElement("div", { className: "w-0.5 h-4 bg-blue-500" })),
|
|
68
|
+
react_1.default.createElement("div", { className: "absolute -left-3 top-0 h-6" },
|
|
69
|
+
react_1.default.createElement(WideChevron_1.WideChevron, { direction: "e", height: "100%", width: "auto", color: "#ffffff" }))),
|
|
70
|
+
react_1.default.createElement("h4", { className: "mt-2.5 text-gray-700 text-sm sm:text-base" }, getStageHeader(types_1.MessageStage.Relayed, stage, timings, status)),
|
|
71
|
+
react_1.default.createElement("p", { className: "mt-1 sm:px-4 text-xs text-gray-500 text-center" }, "Destination transaction has been confirmed"))));
|
|
72
|
+
}
|
|
73
|
+
exports.MessageTimeline = MessageTimeline;
|
|
74
|
+
function StageIcon({ Icon, size }) {
|
|
75
|
+
return (react_1.default.createElement("div", { className: "h-9 w-9 flex items-center justify-center rounded-full bg-blue-500" },
|
|
76
|
+
react_1.default.createElement(Icon, { width: size !== null && size !== void 0 ? size : 14, height: size !== null && size !== void 0 ? size : 14, alt: "", color: color_1.Color.White })));
|
|
77
|
+
}
|
|
78
|
+
function getStageHeader(targetStage, currentStage, timings, status) {
|
|
79
|
+
let label = '';
|
|
80
|
+
if (targetStage === types_1.MessageStage.Finalized) {
|
|
81
|
+
label = currentStage >= targetStage ? 'Finalized' : 'Finalizing';
|
|
82
|
+
}
|
|
83
|
+
else if (targetStage === types_1.MessageStage.Validated) {
|
|
84
|
+
label = currentStage >= targetStage ? 'Validated' : 'Validating';
|
|
85
|
+
}
|
|
86
|
+
else if (targetStage === types_1.MessageStage.Relayed) {
|
|
87
|
+
label = currentStage >= targetStage ? 'Relayed' : 'Relaying';
|
|
88
|
+
}
|
|
89
|
+
else if (targetStage === types_1.MessageStage.Sent) {
|
|
90
|
+
label = currentStage >= targetStage ? 'Sent' : 'Sending';
|
|
91
|
+
}
|
|
92
|
+
const timing = timings[targetStage];
|
|
93
|
+
if (status === types_1.MessageStatus.Failing) {
|
|
94
|
+
if (targetStage === currentStage + 1)
|
|
95
|
+
return `${label}: failed`;
|
|
96
|
+
if (targetStage > currentStage + 1)
|
|
97
|
+
return label;
|
|
98
|
+
}
|
|
99
|
+
if (timing)
|
|
100
|
+
return `${label}: ${timing} sec`;
|
|
101
|
+
else
|
|
102
|
+
return label;
|
|
103
|
+
}
|
|
104
|
+
function getStageClass(targetStage, currentStage, messageStatus) {
|
|
105
|
+
if (currentStage >= targetStage)
|
|
106
|
+
return '';
|
|
107
|
+
if (currentStage === targetStage - 1 && messageStatus !== types_1.MessageStatus.Failing)
|
|
108
|
+
return 'animate-pulse-slow';
|
|
109
|
+
return 'opacity-50';
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=MessageTimeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageTimeline.js","sourceRoot":"","sources":["../../src/messages/MessageTimeline.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,oCAAiC;AACjC,gDAAiD;AACjD,gDAAiD;AACjD,wCAAyC;AACzC,4CAA6C;AAC7C,sDAAmD;AAEnD,mCAA6E;AAS7E,SAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAS;IACtF,kDAAkD;IAClD,MAAM,KAAK,GAAG,MAAM,KAAK,qBAAa,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAE1E,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAChE,MAAM,WAAW,GAAG,QAAQ;QAC1B,CAAC,CAAC,GAAG,QAAQ,CAAC,kBAAkB,EAAE,IAAI,QAAQ,CAAC,kBAAkB,EAAE,EAAE;QACrE,CAAC,CAAC,IAAI,CAAC;IAET,OAAO,CACL,uCAAK,SAAS,EAAC,yBAAyB;QACtC,uCAAK,SAAS,EAAC,mCAAmC;YAChD,uCACE,SAAS,EAAE,8EAA8E,aAAa,CACpG,oBAAK,CAAC,IAAI,EACV,KAAK,EACL,MAAM,CACP,EAAE;gBAEH,uCAAK,SAA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AC,OAAO,EAAE;QACxC,KAAK,GAAG,YAAY,IAAI,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC;KAC9D;SAAM,IAAI,WAAW,KAAK,oBAAK,CAAC,IAAI,EAAE;QACrC,KAAK,GAAG,YAAY,IAAI,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;KAC1D;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,qBAAa,CAAC,OAAO,EAAE;QACpC,IAAI,WAAW,KAAK,YAAY,GAAG,CAAC;YAAE,OAAO,GAAG,KAAK,UAAU,CAAC;QAChE,IAAI,WAAW,GAAG,YAAY,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;KAClD;IACD,IAAI,MAAM;QAAE,OAAO,GAAG,KAAK,KAAK,MAAM,MAAM,CAAC;;QACxC,OAAO,KAAK,CAAC;AACpB,CAAC;AAED,SAAS,aAAa,CAAC,WAAkB,EAAE,YAAmB,EAAE,aAA4B;IAC1F,IAAI,YAAY,IAAI,WAAW;QAAE,OAAO,EAAE,CAAC;IAC3C,IAAI,YAAY,KAAK,WAAW,GAAG,CAAC,IAAI,aAAa,KAAK,qBAAa,CAAC,OAAO;QAC7E,OAAO,oBAAoB,CAAC;IAC9B,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare enum MessageStatus {
|
|
2
|
+
Pending = "pending",
|
|
3
|
+
Delivered = "delivered",
|
|
4
|
+
Failing = "failing"
|
|
5
|
+
}
|
|
6
|
+
export interface PartialTransactionReceipt {
|
|
7
|
+
from: Address;
|
|
8
|
+
transactionHash: string;
|
|
9
|
+
blockNumber: number;
|
|
10
|
+
gasUsed: number;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Message {
|
|
14
|
+
id: string;
|
|
15
|
+
msgId: string;
|
|
16
|
+
status: MessageStatus;
|
|
17
|
+
sender: Address;
|
|
18
|
+
recipient: Address;
|
|
19
|
+
originDomainId: number;
|
|
20
|
+
destinationDomainId: number;
|
|
21
|
+
originChainId: number;
|
|
22
|
+
destinationChainId: number;
|
|
23
|
+
originTimestamp: number;
|
|
24
|
+
destinationTimestamp?: number;
|
|
25
|
+
nonce: number;
|
|
26
|
+
body: string;
|
|
27
|
+
decodedBody?: string;
|
|
28
|
+
originTransaction: PartialTransactionReceipt;
|
|
29
|
+
destinationTransaction?: PartialTransactionReceipt;
|
|
30
|
+
}
|
|
31
|
+
export type ApiMessage = Omit<Message, 'msgId' | 'originChainId' | 'destinationChainId' | 'originTimestamp' | 'destinationTimestamp' | 'decodedBody'>;
|
|
32
|
+
export interface PartialMessage {
|
|
33
|
+
status: MessageStatus;
|
|
34
|
+
nonce: number;
|
|
35
|
+
originDomainId: number;
|
|
36
|
+
destinationDomainId: number;
|
|
37
|
+
originTransaction: {
|
|
38
|
+
blockNumber: number;
|
|
39
|
+
timestamp: number;
|
|
40
|
+
};
|
|
41
|
+
destinationTransaction?: {
|
|
42
|
+
blockNumber: number;
|
|
43
|
+
timestamp: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare enum MessageStage {
|
|
47
|
+
Preparing = 0,
|
|
48
|
+
Sent = 1,
|
|
49
|
+
Finalized = 2,
|
|
50
|
+
Validated = 3,
|
|
51
|
+
Relayed = 4
|
|
52
|
+
}
|
|
53
|
+
export type StageTimings = {
|
|
54
|
+
[MessageStage.Finalized]: number;
|
|
55
|
+
[MessageStage.Validated]: number;
|
|
56
|
+
[MessageStage.Relayed]: number;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/messages/types.ts"],"names":[],"mappings":"AAEA,oBAAY,aAAa;IACvB,OAAO,YAAY;IACnB,SAAS,cAAc;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AAED,oBAAY,YAAY;IACtB,SAAS,IAAI;IACb,IAAI,IAAI;IACR,SAAS,IAAI;IACb,SAAS,IAAI;IACb,OAAO,IAAI;CACZ;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IACjC,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IACjC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageStage = exports.MessageStatus = void 0;
|
|
4
|
+
// TODO DE-DUPE WITH EXPLORER
|
|
5
|
+
// Copied from explorer src/types.ts
|
|
6
|
+
var MessageStatus;
|
|
7
|
+
(function (MessageStatus) {
|
|
8
|
+
MessageStatus["Pending"] = "pending";
|
|
9
|
+
MessageStatus["Delivered"] = "delivered";
|
|
10
|
+
MessageStatus["Failing"] = "failing";
|
|
11
|
+
})(MessageStatus = exports.MessageStatus || (exports.MessageStatus = {}));
|
|
12
|
+
var MessageStage;
|
|
13
|
+
(function (MessageStage) {
|
|
14
|
+
MessageStage[MessageStage["Preparing"] = 0] = "Preparing";
|
|
15
|
+
MessageStage[MessageStage["Sent"] = 1] = "Sent";
|
|
16
|
+
MessageStage[MessageStage["Finalized"] = 2] = "Finalized";
|
|
17
|
+
MessageStage[MessageStage["Validated"] = 3] = "Validated";
|
|
18
|
+
MessageStage[MessageStage["Relayed"] = 4] = "Relayed";
|
|
19
|
+
})(MessageStage = exports.MessageStage || (exports.MessageStage = {}));
|
|
20
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/messages/types.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,oCAAoC;AACpC,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,wCAAuB,CAAA;IACvB,oCAAmB,CAAA;AACrB,CAAC,EAJW,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAIxB;AAgDD,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,yDAAa,CAAA;IACb,+CAAQ,CAAA;IACR,yDAAa,CAAA;IACb,yDAAa,CAAA;IACb,qDAAW,CAAA;AACb,CAAC,EANW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAMvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiMessage } from './types';
|
|
2
|
+
interface Params {
|
|
3
|
+
messageId?: string;
|
|
4
|
+
originTxHash?: string;
|
|
5
|
+
explorerApiUrl?: string;
|
|
6
|
+
retryInterval?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function useMessage({ messageId, originTxHash, explorerApiUrl, retryInterval, }: Params): {
|
|
9
|
+
data: ApiMessage | null;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
error: string | null;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=useMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMessage.d.ts","sourceRoot":"","sources":["../../src/messages/useMessage.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,UAAU,EAAiB,MAAM,SAAS,CAAC;AAEpD,UAAU,MAAM;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAID,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,YAAY,EACZ,cAAuC,EACvC,aAAoB,GACrB,EAAE,MAAM;;;;EA6BR"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.useMessage = void 0;
|
|
13
|
+
const react_1 = require("react");
|
|
14
|
+
const consts_1 = require("../consts");
|
|
15
|
+
const explorers_1 = require("../utils/explorers");
|
|
16
|
+
const useInterval_1 = require("../utils/useInterval");
|
|
17
|
+
const types_1 = require("./types");
|
|
18
|
+
// Queries Explorer API to get data for message
|
|
19
|
+
// Requires either messageId or originTxHash
|
|
20
|
+
function useMessage({ messageId, originTxHash, explorerApiUrl = consts_1.HYPERLANE_EXPLORER_URL, retryInterval = 2000, }) {
|
|
21
|
+
// Tempting to use react-query here as we did in Explorer but
|
|
22
|
+
// avoiding for now to keep dependencies for this lib minimal
|
|
23
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
24
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
25
|
+
const [data, setData] = (0, react_1.useState)(null);
|
|
26
|
+
const fetcher = (0, react_1.useCallback)(() => {
|
|
27
|
+
// Skip if message is already fetched and delivered
|
|
28
|
+
if ((data === null || data === void 0 ? void 0 : data.status) === types_1.MessageStatus.Delivered)
|
|
29
|
+
return;
|
|
30
|
+
setIsLoading(true);
|
|
31
|
+
fetchMessage(explorerApiUrl, messageId, originTxHash)
|
|
32
|
+
.then((result) => {
|
|
33
|
+
setData(result);
|
|
34
|
+
setError(null);
|
|
35
|
+
})
|
|
36
|
+
.catch((e) => setError(e.toString()))
|
|
37
|
+
.finally(() => setIsLoading(false));
|
|
38
|
+
}, [messageId, originTxHash, data]);
|
|
39
|
+
(0, useInterval_1.useInterval)(fetcher, retryInterval);
|
|
40
|
+
return {
|
|
41
|
+
data,
|
|
42
|
+
isLoading,
|
|
43
|
+
error,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.useMessage = useMessage;
|
|
47
|
+
function fetchMessage(explorerApiUrl, messageId, originTxHash) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
if (!explorerApiUrl)
|
|
50
|
+
throw new Error('Explorer API URL required');
|
|
51
|
+
if (!messageId && !originTxHash)
|
|
52
|
+
throw new Error('Either messageId or originTxHash required');
|
|
53
|
+
let url = `${explorerApiUrl}?module=message&action=get-messages`;
|
|
54
|
+
if (messageId)
|
|
55
|
+
url += `&id=${messageId}`;
|
|
56
|
+
else if (originTxHash)
|
|
57
|
+
url += `&origin-tx-hash=${originTxHash}`;
|
|
58
|
+
const result = yield (0, explorers_1.executeExplorerQuery)(url, 5000);
|
|
59
|
+
if (result.length > 1) {
|
|
60
|
+
console.warn('More than one message received, should not occur');
|
|
61
|
+
return result[0];
|
|
62
|
+
}
|
|
63
|
+
else if (result.length === 1) {
|
|
64
|
+
console.debug('Message data found, id:', result[0].id);
|
|
65
|
+
return result[0];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
console.debug('Message data not found');
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=useMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMessage.js","sourceRoot":"","sources":["../../src/messages/useMessage.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAA8C;AAE9C,sCAAmD;AACnD,kDAA0D;AAC1D,sDAAmD;AAEnD,mCAAoD;AASpD,+CAA+C;AAC/C,4CAA4C;A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;;QAErB,IAAI,CAAC,cAAc;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAClE,IAAI,CAAC,SAAS,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAE9F,IAAI,GAAG,GAAG,GAAG,cAAc,qCAAqC,CAAC;QACjE,IAAI,SAAS;YAAE,GAAG,IAAI,OAAO,SAAS,EAAE,CAAC;aACpC,IAAI,YAAY;YAAE,GAAG,IAAI,mBAAmB,YAAY,EAAE,CAAC;QAChE,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAoB,EAAe,GAAG,EAAE,IAAI,CAAC,CAAC;QAEnE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;YACrB,OAAO,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;YACjE,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;SAClB;aAAM,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACvD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;SAClB;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;YACxC,OAAO,IAAI,CAAC;SACb;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PartialMessage, MessageStage as Stage } from './types';
|
|
2
|
+
interface Params {
|
|
3
|
+
message: PartialMessage | null | undefined;
|
|
4
|
+
retryInterval?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function useMessageStage({ message, retryInterval }: Params): {
|
|
7
|
+
stage: Stage;
|
|
8
|
+
timings: {};
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error: string | null;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=useMessageStage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMessageStage.d.ts","sourceRoot":"","sources":["../../src/messages/useMessageStage.ts"],"names":[],"mappings":"AAQA,OAAO,EAAiB,cAAc,EAAE,YAAY,IAAI,KAAK,EAAgB,MAAM,SAAS,CAAC;AAI7F,UAAU,MAAM;IACd,OAAO,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,aAAoB,EAAE,EAAE,MAAM;;;;;EA4BxE"}
|