@onepercentio/one-ui 0.18.0 → 0.18.2
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/dist/context/AsyncProcessQueue.d.ts +71 -0
- package/dist/context/AsyncProcessQueue.development.d.ts +8 -0
- package/dist/context/AsyncProcessQueue.development.js +42 -0
- package/dist/context/AsyncProcessQueue.development.js.map +1 -0
- package/dist/context/AsyncProcessQueue.js +186 -0
- package/dist/context/AsyncProcessQueue.js.map +1 -0
- package/package.json +3 -3
- package/test/models/examples/contract.ts +4 -0
- package/test/models/examples/raw_erc.ts +367 -0
- package/dist/hooks/useHero.module.scss +0 -5
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React, { PropsWithChildren, ReactElement, RefObject } from "react";
|
|
2
|
+
export declare enum AsyncQueueErrors {
|
|
3
|
+
RECOVERY_IS_NOT_BEING_CALLED = "A recovery is not set for this call. If the user reloads the page, this process will not return to the async list"
|
|
4
|
+
}
|
|
5
|
+
declare type ReactElementWithState = ReactElement & {
|
|
6
|
+
status: "loading" | "succeded" | "failed";
|
|
7
|
+
};
|
|
8
|
+
declare type ContextShape = {
|
|
9
|
+
targetElRef: RefObject<HTMLDivElement>;
|
|
10
|
+
pendingTransactions: ReturnType<typeof useCounter>;
|
|
11
|
+
UIs: ReactElementWithState[];
|
|
12
|
+
setUIs: (updater: (previous: ReactElementWithState[]) => ReactElementWithState[]) => void;
|
|
13
|
+
watchPromise: <T extends keyof OnepercentUtility.AsyncQueue.UIModels>(promise: Promise<any>, retryFunc: () => Promise<any>, uiType: T, ...uiArgs: OnepercentUtility.AsyncQueue.UIModels[T]) => void;
|
|
14
|
+
recoveries: {
|
|
15
|
+
[k in keyof OnepercentUtility.AsyncQueue.RecoveryTypes]: {
|
|
16
|
+
write: (...args: OnepercentUtility.AsyncQueue.RecoveryTypes[k]) => void;
|
|
17
|
+
clear: (...args: OnepercentUtility.AsyncQueue.RecoveryTypes[k]) => void;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
declare function useCounter(): {
|
|
22
|
+
count: number;
|
|
23
|
+
setCounter: React.Dispatch<React.SetStateAction<number>>;
|
|
24
|
+
increment: () => void;
|
|
25
|
+
decrement: () => void;
|
|
26
|
+
reset: () => void;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* This propagates the utilitary functions
|
|
30
|
+
*/
|
|
31
|
+
export declare function AsyncProcessQueueProvider<R extends OnepercentUtility.AsyncQueue.RecoveryTypes = OnepercentUtility.AsyncQueue.RecoveryTypes, T extends keyof OnepercentUtility.AsyncQueue.UIModels = keyof OnepercentUtility.AsyncQueue.UIModels>({ children, recoveries, uiFactory, }: PropsWithChildren<{
|
|
32
|
+
recoveries: {
|
|
33
|
+
[k in keyof R]: {
|
|
34
|
+
write: (...args: R[k]) => void;
|
|
35
|
+
clear: (...args: R[k]) => void;
|
|
36
|
+
recover: () => [
|
|
37
|
+
promiseToWaitFor: Promise<any>,
|
|
38
|
+
promiseRetryFunction: () => Promise<any>,
|
|
39
|
+
uiType: T,
|
|
40
|
+
...uiArgs: OnepercentUtility.AsyncQueue.UIModels[T]
|
|
41
|
+
][];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
uiFactory: (type: keyof OnepercentUtility.AsyncQueue.UIModels) => UIStateFactory;
|
|
45
|
+
}>): JSX.Element;
|
|
46
|
+
export declare function useAsyncProcessQueueContext(): ContextShape;
|
|
47
|
+
declare type AsyncProcessStatuses = "loading" | "succeded" | "failed";
|
|
48
|
+
export interface UIStateFactory {
|
|
49
|
+
(status: AsyncProcessStatuses, error?: Error, dismiss?: () => void, retry?: () => void): ReactElement;
|
|
50
|
+
}
|
|
51
|
+
/** This exposes the recovery registration functions available for abtract types of calls */
|
|
52
|
+
export declare function useRecoveries<R extends OnepercentUtility.AsyncQueue.RecoveryTypes = OnepercentUtility.AsyncQueue.RecoveryTypes>(): {
|
|
53
|
+
[K in keyof R]: {
|
|
54
|
+
write(...args: R[K]): void;
|
|
55
|
+
clear(...args: R[K]): void;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
declare type Params<U extends keyof OnepercentUtility.AsyncQueue.UIModels = keyof OnepercentUtility.AsyncQueue.UIModels> = [U, ...OnepercentUtility.AsyncQueue.UIModels[U]];
|
|
59
|
+
/**
|
|
60
|
+
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
61
|
+
*/
|
|
62
|
+
export declare function useAsyncProcessQueue<T extends {
|
|
63
|
+
[k: string]: (...args: any[]) => Promise<any>;
|
|
64
|
+
}>(functionsToQueue: T, UIParamsFactory: <F extends keyof T>(functionName: F) => Params): T & {
|
|
65
|
+
elToTransitionToQueue: RefObject<HTMLDivElement>;
|
|
66
|
+
/**
|
|
67
|
+
* Function that wraps the current running actions and animates to the target queue element
|
|
68
|
+
*/
|
|
69
|
+
wrapQueue: () => void;
|
|
70
|
+
};
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binds to the promise and checks if a restore has been registered when finishing
|
|
3
|
+
* @param promise
|
|
4
|
+
*/
|
|
5
|
+
export declare function securePromise<T>(promise: Promise<T>): Promise<T>;
|
|
6
|
+
/** This registers that a registration has been made an this will be recoverable */
|
|
7
|
+
export declare function countRegistration(): void;
|
|
8
|
+
export declare function resetRegistrationCounter(): void;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file has been created to optimize module bundling and ignore development utility
|
|
3
|
+
// when on production by unused imports
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resetRegistrationCounter = exports.countRegistration = exports.securePromise = void 0;
|
|
6
|
+
const AsyncProcessQueue_1 = require("./AsyncProcessQueue");
|
|
7
|
+
/** This count how many registrations have been made */
|
|
8
|
+
let amountOfRestorationThatShouldBeNeeded = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Binds to the promise and checks if a restore has been registered when finishing
|
|
11
|
+
* @param promise
|
|
12
|
+
*/
|
|
13
|
+
function securePromise(promise) {
|
|
14
|
+
function validate() {
|
|
15
|
+
if (amountOfRestorationThatShouldBeNeeded === 0) {
|
|
16
|
+
throw new Error(AsyncProcessQueue_1.AsyncQueueErrors.RECOVERY_IS_NOT_BEING_CALLED);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return promise
|
|
20
|
+
.then((e) => {
|
|
21
|
+
validate();
|
|
22
|
+
return e;
|
|
23
|
+
})
|
|
24
|
+
.catch((e) => {
|
|
25
|
+
validate();
|
|
26
|
+
return Promise.reject(e);
|
|
27
|
+
})
|
|
28
|
+
.finally(() => amountOfRestorationThatShouldBeNeeded > 0
|
|
29
|
+
? amountOfRestorationThatShouldBeNeeded--
|
|
30
|
+
: 0);
|
|
31
|
+
}
|
|
32
|
+
exports.securePromise = securePromise;
|
|
33
|
+
/** This registers that a registration has been made an this will be recoverable */
|
|
34
|
+
function countRegistration() {
|
|
35
|
+
amountOfRestorationThatShouldBeNeeded++;
|
|
36
|
+
}
|
|
37
|
+
exports.countRegistration = countRegistration;
|
|
38
|
+
function resetRegistrationCounter() {
|
|
39
|
+
amountOfRestorationThatShouldBeNeeded = 0;
|
|
40
|
+
}
|
|
41
|
+
exports.resetRegistrationCounter = resetRegistrationCounter;
|
|
42
|
+
//# sourceMappingURL=AsyncProcessQueue.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncProcessQueue.development.js","sourceRoot":"","sources":["../../src/context/AsyncProcessQueue.development.tsx"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,uCAAuC;;;AAEvC,2DAAuD;AAEvD,uDAAuD;AACvD,IAAI,qCAAqC,GAAG,CAAC,CAAC;AAE9C;;;GAGG;AACH,SAAgB,aAAa,CAAI,OAAmB;IAClD,SAAS,QAAQ;QACf,IAAI,qCAAqC,KAAK,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CAAC,oCAAgB,CAAC,4BAA4B,CAAC,CAAC;SAChE;IACH,CAAC;IACD,OAAO,OAAO;SACX,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACV,QAAQ,EAAE,CAAC;QACX,OAAO,CAAC,CAAC;IACX,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;QACX,QAAQ,EAAE,CAAC;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC;SACD,OAAO,CAAC,GAAG,EAAE,CACZ,qCAAqC,GAAG,CAAC;QACvC,CAAC,CAAC,qCAAqC,EAAE;QACzC,CAAC,CAAC,CAAC,CACN,CAAC;AACN,CAAC;AApBD,sCAoBC;AAED,mFAAmF;AACnF,SAAgB,iBAAiB;IAC/B,qCAAqC,EAAE,CAAC;AAC1C,CAAC;AAFD,8CAEC;AAED,SAAgB,wBAAwB;IACtC,qCAAqC,GAAG,CAAC,CAAC;AAC5C,CAAC;AAFD,4DAEC"}
|
|
@@ -0,0 +1,186 @@
|
|
|
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.useAsyncProcessQueue = exports.useRecoveries = exports.useAsyncProcessQueueContext = exports.AsyncProcessQueueProvider = exports.AsyncQueueErrors = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const AsyncProcessQueue_development_1 = require("./AsyncProcessQueue.development");
|
|
29
|
+
var AsyncQueueErrors;
|
|
30
|
+
(function (AsyncQueueErrors) {
|
|
31
|
+
AsyncQueueErrors["RECOVERY_IS_NOT_BEING_CALLED"] = "A recovery is not set for this call. If the user reloads the page, this process will not return to the async list";
|
|
32
|
+
})(AsyncQueueErrors = exports.AsyncQueueErrors || (exports.AsyncQueueErrors = {}));
|
|
33
|
+
const Context = (0, react_1.createContext)(null);
|
|
34
|
+
function useCounter() {
|
|
35
|
+
const [count, setCounter] = (0, react_1.useState)(0);
|
|
36
|
+
return {
|
|
37
|
+
count,
|
|
38
|
+
setCounter,
|
|
39
|
+
increment: () => setCounter((prev) => prev + 1),
|
|
40
|
+
decrement: () => setCounter((prev) => prev - 1),
|
|
41
|
+
reset: () => setCounter(0),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* This propagates the utilitary functions
|
|
46
|
+
*/
|
|
47
|
+
function AsyncProcessQueueProvider({ children, recoveries, uiFactory, }) {
|
|
48
|
+
const targetRef = (0, react_1.useRef)(null);
|
|
49
|
+
const pendingCounter = useCounter();
|
|
50
|
+
const [UIs, setUIs] = (0, react_1.useState)([]);
|
|
51
|
+
const _recoveries = process.env.NODE_ENV === "development"
|
|
52
|
+
? Object.entries(recoveries).reduce((r, [k, v]) => (Object.assign(Object.assign({}, r), { [k]: Object.assign(Object.assign({}, v), { write: (...args) => {
|
|
53
|
+
(0, AsyncProcessQueue_development_1.countRegistration)();
|
|
54
|
+
return v.write(...args);
|
|
55
|
+
} }) })), {})
|
|
56
|
+
: recoveries;
|
|
57
|
+
const watchPromise = (0, react_1.useCallback)((promise, retry, uiType, ...uiParams) => {
|
|
58
|
+
const Factory = uiFactory(uiType);
|
|
59
|
+
const LoadingUIInstance = Object.assign(Object.assign({}, Factory("loading")), { status: "loading" });
|
|
60
|
+
if (process.env.NODE_ENV === "development" && !LoadingUIInstance.key)
|
|
61
|
+
throw new Error(`The UI generate for the async process should have a key`);
|
|
62
|
+
setUIs((prev) => [
|
|
63
|
+
...prev.filter((a) => a.key !== LoadingUIInstance.key),
|
|
64
|
+
LoadingUIInstance,
|
|
65
|
+
]);
|
|
66
|
+
promise.then((result) => {
|
|
67
|
+
// Write success UI
|
|
68
|
+
setUIs((prev) => prev.map((a) => a === LoadingUIInstance
|
|
69
|
+
? Object.assign(Object.assign({}, Factory("succeded")), { status: "succeded" }) : a));
|
|
70
|
+
return result;
|
|
71
|
+
});
|
|
72
|
+
promise.catch((error) => {
|
|
73
|
+
const UIInstance = Factory("failed", error, () => setUIs((prev) => prev.filter((ui) => ui !== UIInstance)), () => watchPromise(retry(), retry, uiType, ...uiParams));
|
|
74
|
+
// Write success UI
|
|
75
|
+
setUIs((prev) => prev.map((a) => a === LoadingUIInstance ? Object.assign(Object.assign({}, UIInstance), { status: "failed" }) : a));
|
|
76
|
+
throw error;
|
|
77
|
+
});
|
|
78
|
+
return promise;
|
|
79
|
+
}, []);
|
|
80
|
+
(0, react_1.useEffect)(() => {
|
|
81
|
+
for (let recovery in recoveries) {
|
|
82
|
+
const recoveredProcesses = recoveries[recovery].recover();
|
|
83
|
+
for (let [promise, ...recoveredProcess] of recoveredProcesses) {
|
|
84
|
+
watchPromise(promise.catch(() => { }), ...recoveredProcess);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}, []);
|
|
88
|
+
return (react_1.default.createElement(Context.Provider, { value: {
|
|
89
|
+
targetElRef: targetRef,
|
|
90
|
+
pendingTransactions: pendingCounter,
|
|
91
|
+
watchPromise,
|
|
92
|
+
setUIs,
|
|
93
|
+
UIs,
|
|
94
|
+
recoveries: _recoveries,
|
|
95
|
+
} }, children));
|
|
96
|
+
}
|
|
97
|
+
exports.AsyncProcessQueueProvider = AsyncProcessQueueProvider;
|
|
98
|
+
function useAsyncProcessQueueContext() {
|
|
99
|
+
return (0, react_1.useContext)(Context);
|
|
100
|
+
}
|
|
101
|
+
exports.useAsyncProcessQueueContext = useAsyncProcessQueueContext;
|
|
102
|
+
function calculateCenter(el) {
|
|
103
|
+
const boundsOnViewport = el.getBoundingClientRect();
|
|
104
|
+
return {
|
|
105
|
+
x: boundsOnViewport.x + boundsOnViewport.width / 2,
|
|
106
|
+
y: boundsOnViewport.y + boundsOnViewport.height / 2,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** This exposes the recovery registration functions available for abtract types of calls */
|
|
110
|
+
function useRecoveries() {
|
|
111
|
+
return useAsyncProcessQueueContext().recoveries;
|
|
112
|
+
}
|
|
113
|
+
exports.useRecoveries = useRecoveries;
|
|
114
|
+
/**
|
|
115
|
+
* This function wraps other async functions and decides when the ongoing promise should be put on the queue or not
|
|
116
|
+
*/
|
|
117
|
+
function useAsyncProcessQueue(functionsToQueue, UIParamsFactory) {
|
|
118
|
+
const loadingRef = (0, react_1.useRef)(null);
|
|
119
|
+
const wrapped = (0, react_1.useRef)(false);
|
|
120
|
+
const elToTransitionToQueue = (0, react_1.useRef)(null);
|
|
121
|
+
const { targetElRef: targetEl, watchPromise } = (0, react_1.useContext)(Context);
|
|
122
|
+
const initialCenter = (0, react_1.useRef)();
|
|
123
|
+
(0, react_1.useEffect)(() => {
|
|
124
|
+
if (targetEl.current)
|
|
125
|
+
initialCenter.current = {
|
|
126
|
+
center: calculateCenter(targetEl.current),
|
|
127
|
+
dimensions: [
|
|
128
|
+
targetEl.current.clientWidth,
|
|
129
|
+
targetEl.current.clientHeight,
|
|
130
|
+
],
|
|
131
|
+
};
|
|
132
|
+
}, []);
|
|
133
|
+
const wrapQueue = (0, react_1.useCallback)(() => {
|
|
134
|
+
if (wrapped.current || !loadingRef.current || !targetEl.current)
|
|
135
|
+
return;
|
|
136
|
+
const wrapUI = loadingRef.current;
|
|
137
|
+
wrapped.current = true;
|
|
138
|
+
const clone = elToTransitionToQueue.current.cloneNode(true);
|
|
139
|
+
const currPositionOnViewport = elToTransitionToQueue.current.getBoundingClientRect();
|
|
140
|
+
const currPosCenter = calculateCenter(elToTransitionToQueue.current);
|
|
141
|
+
const targetCenter = targetEl.current
|
|
142
|
+
? calculateCenter(targetEl.current)
|
|
143
|
+
: initialCenter.current.center;
|
|
144
|
+
clone.style.position = "fixed";
|
|
145
|
+
clone.style.top = `${currPositionOnViewport.top}px`;
|
|
146
|
+
clone.style.left = `${currPositionOnViewport.left}px`;
|
|
147
|
+
clone.style.width = `${currPositionOnViewport.width}px`;
|
|
148
|
+
clone.style.height = `${currPositionOnViewport.height}px`;
|
|
149
|
+
clone.style.transition = `transform 250ms ease-out, opacity 250ms ease-in`;
|
|
150
|
+
clone.style.opacity = "1";
|
|
151
|
+
clone.ontransitionend = ({ target, currentTarget }) => {
|
|
152
|
+
if (target === currentTarget)
|
|
153
|
+
wrapUI();
|
|
154
|
+
};
|
|
155
|
+
const targetHeight = Math.min(targetEl.current
|
|
156
|
+
? targetEl.current.clientHeight
|
|
157
|
+
: initialCenter.current.dimensions[1], elToTransitionToQueue.current.clientHeight);
|
|
158
|
+
const targetWidth = Math.min(targetHeight, targetEl.current
|
|
159
|
+
? targetEl.current.clientWidth
|
|
160
|
+
: initialCenter.current.dimensions[0], elToTransitionToQueue.current.clientWidth);
|
|
161
|
+
const targetScaleX = targetWidth / elToTransitionToQueue.current.clientWidth;
|
|
162
|
+
const targetScaleY = targetHeight / elToTransitionToQueue.current.clientHeight;
|
|
163
|
+
document.body.appendChild(clone);
|
|
164
|
+
setTimeout(() => {
|
|
165
|
+
clone.style.opacity = "0";
|
|
166
|
+
clone.style.transform = `translateX(${targetCenter.x - currPosCenter.x}px) translateY(${targetCenter.y - currPosCenter.y}px) scaleX(${targetScaleX}) scaleY(${targetScaleY})`;
|
|
167
|
+
clone.addEventListener("transitionend", ({ target, currentTarget }) => {
|
|
168
|
+
if (target === currentTarget)
|
|
169
|
+
clone.remove();
|
|
170
|
+
});
|
|
171
|
+
}, 100);
|
|
172
|
+
}, []);
|
|
173
|
+
return Object.entries(functionsToQueue).reduce((r, [k, v]) => {
|
|
174
|
+
const _process = (...args) => {
|
|
175
|
+
let promise = v(...args);
|
|
176
|
+
loadingRef.current = () => watchPromise(promise, () => v(...args), ...UIParamsFactory(k));
|
|
177
|
+
promise.finally(() => (loadingRef.current = null));
|
|
178
|
+
if (process.env.NODE_ENV === "development")
|
|
179
|
+
promise = (0, AsyncProcessQueue_development_1.securePromise)(promise);
|
|
180
|
+
return promise;
|
|
181
|
+
};
|
|
182
|
+
return Object.assign(Object.assign({}, r), { [k]: _process });
|
|
183
|
+
}, { elToTransitionToQueue, wrapQueue });
|
|
184
|
+
}
|
|
185
|
+
exports.useAsyncProcessQueue = useAsyncProcessQueue;
|
|
186
|
+
//# sourceMappingURL=AsyncProcessQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncProcessQueue.js","sourceRoot":"","sources":["../../src/context/AsyncProcessQueue.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAWe;AACf,mFAGyC;AAEzC,IAAY,gBAEX;AAFD,WAAY,gBAAgB;IAC1B,sKAAkJ,CAAA;AACpJ,CAAC,EAFW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAE3B;AAyBD,MAAM,OAAO,GAAG,IAAA,qBAA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AAC,OAAO,GAAG,GAAG,EAAE,CACxB,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;YACjE,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;YACnD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa;gBACxC,OAAO,GAAG,IAAA,6CAAa,EAAC,OAAO,CAAC,CAAC;YACnC,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;QACF,uCACK,CAAC,KACJ,CAAC,CAAC,CAAC,EAAE,QAAQ,IACb;IACJ,CAAC,EACD,EAAE,qBAAqB,EAAE,SAAS,EAMjC,CACF,CAAC;AACJ,CAAC;AAjHD,oDAiHC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "A set of reusable components created through the development of Onepercent projects",
|
|
5
5
|
"repository": "git@github.com:onepercentio/one-ui.git",
|
|
6
6
|
"author": "Murilo Oliveira de Araujo <murilo.araujo@onepercent.io>",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"@testing-library/react": "^12.1.2",
|
|
24
24
|
"@testing-library/react-hooks": "^7.0.2",
|
|
25
25
|
"@testing-library/user-event": "^13.5.0",
|
|
26
|
+
"@types/chroma-js": "^2.1.3",
|
|
26
27
|
"@types/jest": "^27.4.0",
|
|
27
28
|
"@types/jsdom": "^21.1.1",
|
|
28
29
|
"@types/matter-js": "^0.18.2",
|
|
@@ -65,10 +66,8 @@
|
|
|
65
66
|
"use-wallet": "0.13.5"
|
|
66
67
|
},
|
|
67
68
|
"dependencies": {
|
|
68
|
-
"@types/chroma-js": "^2.1.3",
|
|
69
69
|
"@types/lodash": "^4.14.177",
|
|
70
70
|
"bignumber.js": "^9.0.2",
|
|
71
|
-
"color-seed": "^1.1.3",
|
|
72
71
|
"deepdash": "^5.3.9",
|
|
73
72
|
"eslint-plugin-import-helpers": "^1.2.1",
|
|
74
73
|
"identity-obj-proxy": "^3.0.0",
|
|
@@ -110,6 +109,7 @@
|
|
|
110
109
|
]
|
|
111
110
|
},
|
|
112
111
|
"peerDependencies": {
|
|
112
|
+
"color-seed": "^1.1.3",
|
|
113
113
|
"chroma-js": "^2.4.2",
|
|
114
114
|
"use-wallet": "0.13.5"
|
|
115
115
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import GenericContract, { ExtractMethodDefinition, TuplifyUnion } from "../../../src/models/GenericContract";
|
|
2
|
+
import { AbiItem, RAW_ERC1155ABI } from "./raw_erc"
|
|
3
|
+
import { Contract } from 'web3-eth-contract'
|
|
4
|
+
const xpto = new Contract(RAW_ERC1155ABI as unknown as AbiItem[]) as unknown as GenericContract<typeof RAW_ERC1155ABI>;
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
|
|
2
|
+
export interface AbiInput {
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
indexed?: boolean;
|
|
6
|
+
components?: AbiInput[];
|
|
7
|
+
internalType?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface AbiOutput {
|
|
11
|
+
name: string;
|
|
12
|
+
type: string;
|
|
13
|
+
components?: AbiOutput[];
|
|
14
|
+
internalType?: string;
|
|
15
|
+
}
|
|
16
|
+
export type StateMutabilityType = 'pure' | 'view' | 'nonpayable' | 'payable';
|
|
17
|
+
|
|
18
|
+
export type AbiType = 'function' | 'constructor' | 'event' | 'fallback';
|
|
19
|
+
export interface AbiItem {
|
|
20
|
+
anonymous?: boolean;
|
|
21
|
+
constant?: boolean;
|
|
22
|
+
inputs?: AbiInput[];
|
|
23
|
+
name?: string;
|
|
24
|
+
outputs?: AbiOutput[];
|
|
25
|
+
payable?: boolean;
|
|
26
|
+
stateMutability?: StateMutabilityType;
|
|
27
|
+
type: AbiType;
|
|
28
|
+
gas?: number;
|
|
29
|
+
}
|
|
30
|
+
export const RAW_ERC1155ABI = [
|
|
31
|
+
{
|
|
32
|
+
"anonymous": false,
|
|
33
|
+
"inputs": [
|
|
34
|
+
{
|
|
35
|
+
"indexed": true,
|
|
36
|
+
"internalType": "address",
|
|
37
|
+
"name": "account",
|
|
38
|
+
"type": "address"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"indexed": true,
|
|
42
|
+
"internalType": "address",
|
|
43
|
+
"name": "operator",
|
|
44
|
+
"type": "address"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"indexed": false,
|
|
48
|
+
"internalType": "bool",
|
|
49
|
+
"name": "approved",
|
|
50
|
+
"type": "bool"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"name": "ApprovalForAll",
|
|
54
|
+
"type": "event"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"anonymous": false,
|
|
58
|
+
"inputs": [
|
|
59
|
+
{
|
|
60
|
+
"indexed": true,
|
|
61
|
+
"internalType": "address",
|
|
62
|
+
"name": "operator",
|
|
63
|
+
"type": "address"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"indexed": true,
|
|
67
|
+
"internalType": "address",
|
|
68
|
+
"name": "from",
|
|
69
|
+
"type": "address"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"indexed": true,
|
|
73
|
+
"internalType": "address",
|
|
74
|
+
"name": "to",
|
|
75
|
+
"type": "address"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"indexed": false,
|
|
79
|
+
"internalType": "uint256[]",
|
|
80
|
+
"name": "ids",
|
|
81
|
+
"type": "uint256[]"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"indexed": false,
|
|
85
|
+
"internalType": "uint256[]",
|
|
86
|
+
"name": "values",
|
|
87
|
+
"type": "uint256[]"
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"name": "TransferBatch",
|
|
91
|
+
"type": "event"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"anonymous": false,
|
|
95
|
+
"inputs": [
|
|
96
|
+
{
|
|
97
|
+
"indexed": true,
|
|
98
|
+
"internalType": "address",
|
|
99
|
+
"name": "operator",
|
|
100
|
+
"type": "address"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"indexed": true,
|
|
104
|
+
"internalType": "address",
|
|
105
|
+
"name": "from",
|
|
106
|
+
"type": "address"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"indexed": true,
|
|
110
|
+
"internalType": "address",
|
|
111
|
+
"name": "to",
|
|
112
|
+
"type": "address"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"indexed": false,
|
|
116
|
+
"internalType": "uint256",
|
|
117
|
+
"name": "id",
|
|
118
|
+
"type": "uint256"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"indexed": false,
|
|
122
|
+
"internalType": "uint256",
|
|
123
|
+
"name": "value",
|
|
124
|
+
"type": "uint256"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
"name": "TransferSingle",
|
|
128
|
+
"type": "event"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"anonymous": false,
|
|
132
|
+
"inputs": [
|
|
133
|
+
{
|
|
134
|
+
"indexed": false,
|
|
135
|
+
"internalType": "string",
|
|
136
|
+
"name": "value",
|
|
137
|
+
"type": "string"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"indexed": true,
|
|
141
|
+
"internalType": "uint256",
|
|
142
|
+
"name": "id",
|
|
143
|
+
"type": "uint256"
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"name": "URI",
|
|
147
|
+
"type": "event"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"inputs": [
|
|
151
|
+
{
|
|
152
|
+
"internalType": "address",
|
|
153
|
+
"name": "account",
|
|
154
|
+
"type": "address"
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"internalType": "uint256",
|
|
158
|
+
"name": "id",
|
|
159
|
+
"type": "uint256"
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"name": "balanceOf",
|
|
163
|
+
"outputs": [
|
|
164
|
+
{
|
|
165
|
+
"internalType": "uint256",
|
|
166
|
+
"name": "",
|
|
167
|
+
"type": "uint256"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"stateMutability": "view",
|
|
171
|
+
"type": "function"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"inputs": [
|
|
175
|
+
{
|
|
176
|
+
"internalType": "address[]",
|
|
177
|
+
"name": "accounts",
|
|
178
|
+
"type": "address[]"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"internalType": "uint256[]",
|
|
182
|
+
"name": "ids",
|
|
183
|
+
"type": "uint256[]"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"name": "balanceOfBatch",
|
|
187
|
+
"outputs": [
|
|
188
|
+
{
|
|
189
|
+
"internalType": "uint256[]",
|
|
190
|
+
"name": "",
|
|
191
|
+
"type": "uint256[]"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"stateMutability": "view",
|
|
195
|
+
"type": "function"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"inputs": [
|
|
199
|
+
{
|
|
200
|
+
"internalType": "address",
|
|
201
|
+
"name": "account",
|
|
202
|
+
"type": "address"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"internalType": "address",
|
|
206
|
+
"name": "operator",
|
|
207
|
+
"type": "address"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"name": "isApprovedForAll",
|
|
211
|
+
"outputs": [
|
|
212
|
+
{
|
|
213
|
+
"internalType": "bool",
|
|
214
|
+
"name": "",
|
|
215
|
+
"type": "bool"
|
|
216
|
+
}
|
|
217
|
+
],
|
|
218
|
+
"stateMutability": "view",
|
|
219
|
+
"type": "function"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"inputs": [
|
|
223
|
+
{
|
|
224
|
+
"internalType": "address",
|
|
225
|
+
"name": "from",
|
|
226
|
+
"type": "address"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"internalType": "address",
|
|
230
|
+
"name": "to",
|
|
231
|
+
"type": "address"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"internalType": "uint256[]",
|
|
235
|
+
"name": "ids",
|
|
236
|
+
"type": "uint256[]"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"internalType": "uint256[]",
|
|
240
|
+
"name": "amounts",
|
|
241
|
+
"type": "uint256[]"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"internalType": "bytes",
|
|
245
|
+
"name": "data",
|
|
246
|
+
"type": "bytes"
|
|
247
|
+
}
|
|
248
|
+
],
|
|
249
|
+
"name": "safeBatchTransferFrom",
|
|
250
|
+
"outputs": [],
|
|
251
|
+
"stateMutability": "nonpayable",
|
|
252
|
+
"type": "function"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"inputs": [
|
|
256
|
+
{
|
|
257
|
+
"internalType": "address",
|
|
258
|
+
"name": "from",
|
|
259
|
+
"type": "address"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"internalType": "address",
|
|
263
|
+
"name": "to",
|
|
264
|
+
"type": "address"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"internalType": "uint256",
|
|
268
|
+
"name": "id",
|
|
269
|
+
"type": "uint256"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"internalType": "uint256",
|
|
273
|
+
"name": "amount",
|
|
274
|
+
"type": "uint256"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"internalType": "bytes",
|
|
278
|
+
"name": "data",
|
|
279
|
+
"type": "bytes"
|
|
280
|
+
}
|
|
281
|
+
],
|
|
282
|
+
"name": "safeTransferFrom",
|
|
283
|
+
"outputs": [],
|
|
284
|
+
"stateMutability": "nonpayable",
|
|
285
|
+
"type": "function"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"inputs": [
|
|
289
|
+
{
|
|
290
|
+
"internalType": "address",
|
|
291
|
+
"name": "operator",
|
|
292
|
+
"type": "address"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"internalType": "bool",
|
|
296
|
+
"name": "approved",
|
|
297
|
+
"type": "bool"
|
|
298
|
+
}
|
|
299
|
+
],
|
|
300
|
+
"name": "setApprovalForAll",
|
|
301
|
+
"outputs": [],
|
|
302
|
+
"stateMutability": "nonpayable",
|
|
303
|
+
"type": "function"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"inputs": [
|
|
307
|
+
{
|
|
308
|
+
"internalType": "bytes4",
|
|
309
|
+
"name": "interfaceId",
|
|
310
|
+
"type": "bytes4"
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"name": "supportsInterface",
|
|
314
|
+
"outputs": [
|
|
315
|
+
{
|
|
316
|
+
"internalType": "bool",
|
|
317
|
+
"name": "",
|
|
318
|
+
"type": "bool"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"stateMutability": "view",
|
|
322
|
+
"type": "function"
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
"inputs": [
|
|
326
|
+
{
|
|
327
|
+
"internalType": "uint256",
|
|
328
|
+
"name": "id",
|
|
329
|
+
"type": "uint256"
|
|
330
|
+
}
|
|
331
|
+
],
|
|
332
|
+
"name": "uri",
|
|
333
|
+
"outputs": [
|
|
334
|
+
{
|
|
335
|
+
"internalType": "string",
|
|
336
|
+
"name": "",
|
|
337
|
+
"type": "string"
|
|
338
|
+
}
|
|
339
|
+
],
|
|
340
|
+
"stateMutability": "view",
|
|
341
|
+
"type": "function"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
inputs: [
|
|
345
|
+
{
|
|
346
|
+
internalType: 'address',
|
|
347
|
+
name: 'wallet',
|
|
348
|
+
type: 'address',
|
|
349
|
+
},
|
|
350
|
+
],
|
|
351
|
+
name: 'balancesOf',
|
|
352
|
+
outputs: [
|
|
353
|
+
{
|
|
354
|
+
internalType: 'uint256[]',
|
|
355
|
+
name: 'tokens',
|
|
356
|
+
type: 'uint256[]',
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
internalType: 'uint256[]',
|
|
360
|
+
name: 'balances',
|
|
361
|
+
type: 'uint256[]',
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
stateMutability: 'view',
|
|
365
|
+
type: 'function',
|
|
366
|
+
},
|
|
367
|
+
] as const
|