@rainlanguage/ui-components 0.0.1-alpha.59 → 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.
- package/dist/components/deployment/DeploymentSteps.svelte +4 -4
- package/dist/components/detail/OrderDetail.svelte +1 -1
- package/dist/components/input/InputTokenAmount.svelte +1 -1
- package/dist/stores/transactionStore.d.ts +1 -1
- package/dist/stores/transactionStore.js +46 -34
- package/package.json +2 -2
|
@@ -231,13 +231,13 @@ async function handleDeployButtonClick() {
|
|
|
231
231
|
<DepositInput {deposit} />
|
|
232
232
|
{/each}
|
|
233
233
|
|
|
234
|
-
{#each allTokenInputs as input, i}
|
|
235
|
-
<TokenIOInput {i} label="Input" vault={input} />
|
|
236
|
-
{/each}
|
|
237
|
-
|
|
238
234
|
{#each allTokenOutputs as output, i}
|
|
239
235
|
<TokenIOInput {i} label="Output" vault={output} />
|
|
240
236
|
{/each}
|
|
237
|
+
|
|
238
|
+
{#each allTokenInputs as input, i}
|
|
239
|
+
<TokenIOInput {i} label="Input" vault={input} />
|
|
240
|
+
{/each}
|
|
241
241
|
{/if}
|
|
242
242
|
|
|
243
243
|
{#if $deploymentStepsError}
|
|
@@ -111,7 +111,7 @@ $: subgraphName = $page.url.pathname.split("/")[2]?.split("-")[0];
|
|
|
111
111
|
</svelte:fragment>
|
|
112
112
|
</CardProperty>
|
|
113
113
|
|
|
114
|
-
{#each [{ key: '
|
|
114
|
+
{#each [{ key: 'Output vaults', type: 'outputs' }, { key: 'Input vaults', type: 'inputs' }, { key: 'Input & output vaults', type: 'inputs_outputs' }] as { key, type }}
|
|
115
115
|
{#if data.vaults.get(type)?.length !== 0}
|
|
116
116
|
<CardProperty>
|
|
117
117
|
<svelte:fragment slot="key"
|
|
@@ -39,7 +39,7 @@ function fillMaxValue() {
|
|
|
39
39
|
/>
|
|
40
40
|
|
|
41
41
|
{#if maxValue}
|
|
42
|
-
<div class="absolute right-
|
|
42
|
+
<div class="absolute right-2 flex h-10 flex-col justify-center">
|
|
43
43
|
<Button color="blue" class="px-2 py-1" size="xs" pill on:click={fillMaxValue}>MAX</Button>
|
|
44
44
|
</div>
|
|
45
45
|
{/if}
|
|
@@ -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",
|