@rainlanguage/ui-components 0.0.1-alpha.60 → 0.0.1-alpha.61
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.
|
@@ -20,7 +20,7 @@ export declare enum TransactionStatus {
|
|
|
20
20
|
export declare enum TransactionErrorMessage {
|
|
21
21
|
BAD_CALLLDATA = "Bad calldata.",
|
|
22
22
|
DEPLOY_FAILED = "Lock transaction failed.",
|
|
23
|
-
TIMEOUT = "
|
|
23
|
+
TIMEOUT = "The subgraph took too long to respond. Please check the transaction link.",
|
|
24
24
|
APPROVAL_FAILED = "Approval transaction failed.",
|
|
25
25
|
USER_REJECTED_APPROVAL = "User rejected approval transaction.",
|
|
26
26
|
USER_REJECTED_TRANSACTION = "User rejected the transaction.",
|
|
@@ -22,7 +22,7 @@ export var TransactionErrorMessage;
|
|
|
22
22
|
(function (TransactionErrorMessage) {
|
|
23
23
|
TransactionErrorMessage["BAD_CALLLDATA"] = "Bad calldata.";
|
|
24
24
|
TransactionErrorMessage["DEPLOY_FAILED"] = "Lock transaction failed.";
|
|
25
|
-
TransactionErrorMessage["TIMEOUT"] = "
|
|
25
|
+
TransactionErrorMessage["TIMEOUT"] = "The subgraph took too long to respond. Please check the transaction link.";
|
|
26
26
|
TransactionErrorMessage["APPROVAL_FAILED"] = "Approval transaction failed.";
|
|
27
27
|
TransactionErrorMessage["USER_REJECTED_APPROVAL"] = "User rejected approval transaction.";
|
|
28
28
|
TransactionErrorMessage["USER_REJECTED_TRANSACTION"] = "User rejected the transaction.";
|
|
@@ -46,6 +46,10 @@ export const initialState = {
|
|
|
46
46
|
const transactionStore = () => {
|
|
47
47
|
const { subscribe, set, update } = writable(initialState);
|
|
48
48
|
const reset = () => set(initialState);
|
|
49
|
+
const returnError = (interval) => {
|
|
50
|
+
clearInterval(interval);
|
|
51
|
+
return transactionError(TransactionErrorMessage.TIMEOUT);
|
|
52
|
+
};
|
|
49
53
|
const awaitTransactionIndexing = async (subgraphUrl, txHash, successMessage) => {
|
|
50
54
|
update((state) => ({
|
|
51
55
|
...state,
|
|
@@ -56,18 +60,22 @@ const transactionStore = () => {
|
|
|
56
60
|
let newTx;
|
|
57
61
|
const interval = setInterval(async () => {
|
|
58
62
|
attempts++;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
try {
|
|
64
|
+
newTx = await getTransaction(subgraphUrl, txHash);
|
|
65
|
+
if (newTx) {
|
|
66
|
+
clearInterval(interval);
|
|
67
|
+
transactionSuccess(txHash, successMessage);
|
|
68
|
+
}
|
|
69
|
+
else if (attempts >= 10) {
|
|
70
|
+
update((state) => ({
|
|
71
|
+
...state,
|
|
72
|
+
message: 'The subgraph took too long to respond. Please check again later.'
|
|
73
|
+
}));
|
|
74
|
+
return returnError(interval);
|
|
75
|
+
}
|
|
63
76
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
...state,
|
|
67
|
-
message: 'The subgraph took too long to respond. Please check again later.'
|
|
68
|
-
}));
|
|
69
|
-
clearInterval(interval);
|
|
70
|
-
return transactionError(TransactionErrorMessage.TIMEOUT);
|
|
77
|
+
catch {
|
|
78
|
+
return returnError(interval);
|
|
71
79
|
}
|
|
72
80
|
}, 1000);
|
|
73
81
|
};
|
|
@@ -80,18 +88,18 @@ const transactionStore = () => {
|
|
|
80
88
|
let attempts = 0;
|
|
81
89
|
const interval = setInterval(async () => {
|
|
82
90
|
attempts++;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
try {
|
|
92
|
+
const addOrders = await getTransactionAddOrders(subgraphUrl, txHash);
|
|
93
|
+
if (attempts >= 10) {
|
|
94
|
+
return returnError(interval);
|
|
95
|
+
}
|
|
96
|
+
else if (addOrders?.length > 0) {
|
|
97
|
+
clearInterval(interval);
|
|
98
|
+
return transactionSuccess(txHash, '', addOrders[0].order.orderHash, network);
|
|
99
|
+
}
|
|
91
100
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
return transactionSuccess(txHash, '', addOrders[0].order.orderHash, network);
|
|
101
|
+
catch {
|
|
102
|
+
return returnError(interval);
|
|
95
103
|
}
|
|
96
104
|
}, 1000);
|
|
97
105
|
};
|
|
@@ -104,18 +112,22 @@ const transactionStore = () => {
|
|
|
104
112
|
let attempts = 0;
|
|
105
113
|
const interval = setInterval(async () => {
|
|
106
114
|
attempts++;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
try {
|
|
116
|
+
const removeOrders = await getTransactionRemoveOrders(subgraphUrl, txHash);
|
|
117
|
+
if (attempts >= 10) {
|
|
118
|
+
update((state) => ({
|
|
119
|
+
...state,
|
|
120
|
+
message: 'The subgraph took too long to respond. Please check again later.'
|
|
121
|
+
}));
|
|
122
|
+
return returnError(interval);
|
|
123
|
+
}
|
|
124
|
+
else if (removeOrders?.length > 0) {
|
|
125
|
+
clearInterval(interval);
|
|
126
|
+
return transactionSuccess(txHash, 'Order removed successfully');
|
|
127
|
+
}
|
|
115
128
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return transactionSuccess(txHash, 'Order removed successfully');
|
|
129
|
+
catch {
|
|
130
|
+
return returnError(interval);
|
|
119
131
|
}
|
|
120
132
|
}, 1000);
|
|
121
133
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rainlanguage/ui-components",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.61",
|
|
4
4
|
"description": "A component library for building Svelte applications to be used with Raindex.",
|
|
5
5
|
"license": "LicenseRef-DCL-1.0",
|
|
6
6
|
"author": "Rain Open Source Software Ltd",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@fontsource/dm-sans": "5.1.0",
|
|
54
54
|
"@imask/svelte": "7.6.1",
|
|
55
55
|
"@observablehq/plot": "0.6.16",
|
|
56
|
-
"@rainlanguage/orderbook": "0.0.1-alpha.
|
|
56
|
+
"@rainlanguage/orderbook": "0.0.1-alpha.61",
|
|
57
57
|
"@reown/appkit": "1.6.4",
|
|
58
58
|
"@reown/appkit-adapter-wagmi": "1.6.4",
|
|
59
59
|
"@sentry/sveltekit": "7.120.0",
|