@ouronet/ouronet-core 4.3.6
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/CHANGELOG.md +3043 -0
- package/README.md +1940 -0
- package/dist/codex/codec.d.ts +77 -0
- package/dist/codex/codec.js +123 -0
- package/dist/codex/errors.d.ts +14 -0
- package/dist/codex/errors.js +20 -0
- package/dist/codex/index.d.ts +27 -0
- package/dist/codex/index.js +25 -0
- package/dist/codex/seedTypeMigration.d.ts +35 -0
- package/dist/codex/seedTypeMigration.js +45 -0
- package/dist/codex/types.d.ts +100 -0
- package/dist/codex/types.js +19 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.js +3 -0
- package/dist/constants/ouronet.d.ts +33 -0
- package/dist/constants/ouronet.js +59 -0
- package/dist/constants/tokenIds.d.ts +13 -0
- package/dist/constants/tokenIds.js +21 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1 -0
- package/dist/interactions/activateFunctions.d.ts +67 -0
- package/dist/interactions/activateFunctions.js +154 -0
- package/dist/interactions/addLiquidityFunctions.d.ts +140 -0
- package/dist/interactions/addLiquidityFunctions.js +485 -0
- package/dist/interactions/coilFunctions.d.ts +73 -0
- package/dist/interactions/coilFunctions.js +213 -0
- package/dist/interactions/crossChainFunctions.d.ts +211 -0
- package/dist/interactions/crossChainFunctions.js +463 -0
- package/dist/interactions/dexAcquisitionPoolFunctions.d.ts +18 -0
- package/dist/interactions/dexAcquisitionPoolFunctions.js +18 -0
- package/dist/interactions/dexCollectablesFunctions.d.ts +28 -0
- package/dist/interactions/dexCollectablesFunctions.js +227 -0
- package/dist/interactions/dexFunctions.d.ts +23 -0
- package/dist/interactions/dexFunctions.js +23 -0
- package/dist/interactions/dexOrtoFungibleFunctions.d.ts +33 -0
- package/dist/interactions/dexOrtoFungibleFunctions.js +171 -0
- package/dist/interactions/dexParseFunctions.d.ts +150 -0
- package/dist/interactions/dexParseFunctions.js +316 -0
- package/dist/interactions/dexSwapPairAdminFunctions.d.ts +75 -0
- package/dist/interactions/dexSwapPairAdminFunctions.js +255 -0
- package/dist/interactions/dexSwapPairCalcFunctions.d.ts +55 -0
- package/dist/interactions/dexSwapPairCalcFunctions.js +218 -0
- package/dist/interactions/dexSwapPairDashboardFunctions.d.ts +47 -0
- package/dist/interactions/dexSwapPairDashboardFunctions.js +179 -0
- package/dist/interactions/dexSwapPairExecuteFunctions.d.ts +40 -0
- package/dist/interactions/dexSwapPairExecuteFunctions.js +301 -0
- package/dist/interactions/dexSwapPairSmartSwapFunctions.d.ts +25 -0
- package/dist/interactions/dexSwapPairSmartSwapFunctions.js +166 -0
- package/dist/interactions/dexTrueFungibleFunctions.d.ts +52 -0
- package/dist/interactions/dexTrueFungibleFunctions.js +220 -0
- package/dist/interactions/dexTypes.d.ts +465 -0
- package/dist/interactions/dexTypes.js +6 -0
- package/dist/interactions/errors.d.ts +12 -0
- package/dist/interactions/errors.js +13 -0
- package/dist/interactions/guardFunctions.d.ts +33 -0
- package/dist/interactions/guardFunctions.js +110 -0
- package/dist/interactions/index.d.ts +1 -0
- package/dist/interactions/index.js +20 -0
- package/dist/interactions/infoOneFunctions.d.ts +133 -0
- package/dist/interactions/infoOneFunctions.js +566 -0
- package/dist/interactions/kadenaFunctions.d.ts +11 -0
- package/dist/interactions/kadenaFunctions.js +40 -0
- package/dist/interactions/kpayFunctions.d.ts +45 -0
- package/dist/interactions/kpayFunctions.js +191 -0
- package/dist/interactions/ouroAccountFunctions.d.ts +64 -0
- package/dist/interactions/ouroAccountFunctions.js +229 -0
- package/dist/interactions/ouroBalanceFunctions.d.ts +39 -0
- package/dist/interactions/ouroBalanceFunctions.js +100 -0
- package/dist/interactions/ouroCoilFunctions.d.ts +33 -0
- package/dist/interactions/ouroCoilFunctions.js +190 -0
- package/dist/interactions/ouroFunctions.d.ts +23 -0
- package/dist/interactions/ouroFunctions.js +23 -0
- package/dist/interactions/ouroMovieBoosterFunctions.d.ts +18 -0
- package/dist/interactions/ouroMovieBoosterFunctions.js +203 -0
- package/dist/interactions/ouroPriceFunctions.d.ts +38 -0
- package/dist/interactions/ouroPriceFunctions.js +96 -0
- package/dist/interactions/ouroPrimordialsFunctions.d.ts +10 -0
- package/dist/interactions/ouroPrimordialsFunctions.js +480 -0
- package/dist/interactions/ouroRotateFunctions.d.ts +22 -0
- package/dist/interactions/ouroRotateFunctions.js +114 -0
- package/dist/interactions/ouroSubCompressFunctions.d.ts +23 -0
- package/dist/interactions/ouroSubCompressFunctions.js +191 -0
- package/dist/interactions/ouroTransferFunctions.d.ts +14 -0
- package/dist/interactions/ouroTransferFunctions.js +87 -0
- package/dist/interactions/ouroTypes.d.ts +113 -0
- package/dist/interactions/ouroTypes.js +6 -0
- package/dist/interactions/ouroUrStoaFunctions.d.ts +16 -0
- package/dist/interactions/ouroUrStoaFunctions.js +121 -0
- package/dist/interactions/ouroWrapFunctions.d.ts +22 -0
- package/dist/interactions/ouroWrapFunctions.js +234 -0
- package/dist/interactions/pensionFunctions.d.ts +12 -0
- package/dist/interactions/pensionFunctions.js +127 -0
- package/dist/interactions/urStoaFunctions.d.ts +104 -0
- package/dist/interactions/urStoaFunctions.js +475 -0
- package/dist/interactions/wrapFunctions.d.ts +46 -0
- package/dist/interactions/wrapFunctions.js +221 -0
- package/dist/pact/cfmBuilders.d.ts +807 -0
- package/dist/pact/cfmBuilders.js +812 -0
- package/dist/pact/index.d.ts +1 -0
- package/dist/pact/index.js +10 -0
- package/package.json +64 -0
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ouroPrimordialsFunctions.ts
|
|
3
|
+
* Chain call to ouronet-ns.DPL-UR.URC_0002_Primordials plus the placeholder factory.
|
|
4
|
+
* The internal `parseResponse` and `fmt` helpers retain the v4.x token-decoration
|
|
5
|
+
* logic verbatim for backward compat (v5.0.0 will physically extract it).
|
|
6
|
+
*/
|
|
7
|
+
import { KADENA_NAMESPACE } from "../constants/index.js";
|
|
8
|
+
import { formatEU, mayComeWithDeimal } from "@stoachain/stoa-core/pact";
|
|
9
|
+
import { pactRead } from "@stoachain/stoa-core/reads";
|
|
10
|
+
// (namespace.DPL-UR.URC_0002_Primordials account)
|
|
11
|
+
export async function getPrimordials(currentAccount = "", codexAccounts = [], options) {
|
|
12
|
+
const accountsList = codexAccounts.map((a) => `"${a}"`).join(" ");
|
|
13
|
+
const pactCode = `(${KADENA_NAMESPACE}.DPL-UR.URC_0002_Primordials "${currentAccount}" [${accountsList}])`;
|
|
14
|
+
const response = await pactRead(pactCode, { tier: "T5", skipTempWatcher: options?.skipTempWatcher });
|
|
15
|
+
if (!response || !response.result) {
|
|
16
|
+
return null; // network failure — caller should retry, not show ???
|
|
17
|
+
}
|
|
18
|
+
if (response.result.status === "failure") {
|
|
19
|
+
return null; // pact failure — caller should retry, not show ???
|
|
20
|
+
}
|
|
21
|
+
return parseResponse(response.result.data);
|
|
22
|
+
}
|
|
23
|
+
const fmt = (v) => formatEU(mayComeWithDeimal(v) ?? null);
|
|
24
|
+
const parseResponse = (data) => {
|
|
25
|
+
const d = data[0];
|
|
26
|
+
const codex = data[1] ?? {};
|
|
27
|
+
const supplyHoverVal = (v) => {
|
|
28
|
+
const raw = mayComeWithDeimal(v);
|
|
29
|
+
return formatEU(raw !== null && raw !== undefined ? String(raw) : null);
|
|
30
|
+
};
|
|
31
|
+
const ouro = {
|
|
32
|
+
id: d["ouro-id"],
|
|
33
|
+
name: d["ouro-name"],
|
|
34
|
+
icon: "/images/coins/OURO.svg",
|
|
35
|
+
iconBgColor: "bg-primary/5",
|
|
36
|
+
balance: {
|
|
37
|
+
display: fmt(d["ouro-balance"]),
|
|
38
|
+
value: fmt(d["ouro-balance-hover"]),
|
|
39
|
+
},
|
|
40
|
+
balanceUsd: fmt(d["ouro-balance-vid"]),
|
|
41
|
+
pricePerUnit: fmt(d["ouro-price"]),
|
|
42
|
+
totalSupply: {
|
|
43
|
+
display: fmt(d["ouro-dispo-capacity"]),
|
|
44
|
+
value: fmt(d["ouro-dispo-capacity-hover"]),
|
|
45
|
+
},
|
|
46
|
+
supplyUsdValue: fmt(d["ouro-dispo-capacity-vid"]),
|
|
47
|
+
virtual: {
|
|
48
|
+
display: fmt(d["ouro-v-balance"]),
|
|
49
|
+
value: fmt(d["ouro-v-balance-hover"]),
|
|
50
|
+
inUsd: fmt(d["ouro-v-balance-vid"]),
|
|
51
|
+
},
|
|
52
|
+
info: "",
|
|
53
|
+
currencySymbol: "Ѻ",
|
|
54
|
+
currencySymbolColor: "#7b4a1e",
|
|
55
|
+
availableActions: ["Sublimate", "Coil", "Curl", "Transfer", "Bulk Transfer"],
|
|
56
|
+
keepTransferNames: true,
|
|
57
|
+
balanceLabel: "Balance",
|
|
58
|
+
virtualLabel: "Virtual Balance",
|
|
59
|
+
supplyLabel: "Dispo Capacity",
|
|
60
|
+
};
|
|
61
|
+
const ignis = {
|
|
62
|
+
id: d["gas-id"],
|
|
63
|
+
name: d["gas-name"],
|
|
64
|
+
icon: "/images/coins/Ignis.svg",
|
|
65
|
+
iconBgColor: "bg-primary/5",
|
|
66
|
+
balance: {
|
|
67
|
+
display: fmt(d["gas-balance"]),
|
|
68
|
+
value: fmt(d["gas-balance-hover"]),
|
|
69
|
+
},
|
|
70
|
+
balanceUsd: fmt(d["gas-balance-vid"]),
|
|
71
|
+
pricePerUnit: fmt(d["gas-price"]),
|
|
72
|
+
totalSupply: {
|
|
73
|
+
display: fmt(d["gas-supply"]),
|
|
74
|
+
value: supplyHoverVal(d["gas-supply-hover"]),
|
|
75
|
+
},
|
|
76
|
+
supplyUsdValue: fmt(d["gas-supply-vid"]),
|
|
77
|
+
virtual: null,
|
|
78
|
+
info: d["gas-discount-text"] ?? "",
|
|
79
|
+
currencySymbol: "Ω",
|
|
80
|
+
currencySymbolColor: "#cc2200",
|
|
81
|
+
availableActions: ["Compress", "Firestarter", "Transfer", "Bulk Transfer"],
|
|
82
|
+
keepTransferNames: true,
|
|
83
|
+
maxButtonsPerRow: 2,
|
|
84
|
+
balanceLabel: "Balance",
|
|
85
|
+
showCodexRow: true,
|
|
86
|
+
supplyLabel: "Ouronet Total GAS",
|
|
87
|
+
codexBalance: {
|
|
88
|
+
display: fmt(codex["codex-balance"]),
|
|
89
|
+
value: fmt(codex["codex-balance-hover"]),
|
|
90
|
+
inUsd: fmt(codex["codex-balance-vid"]),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const auryn = {
|
|
94
|
+
id: d["auryn-id"],
|
|
95
|
+
name: d["auryn-name"],
|
|
96
|
+
icon: "/images/coins/AURYN.svg",
|
|
97
|
+
iconBgColor: "bg-purple-50",
|
|
98
|
+
balance: {
|
|
99
|
+
display: fmt(d["auryn-balance"]),
|
|
100
|
+
value: fmt(d["auryn-balance-hover"]),
|
|
101
|
+
},
|
|
102
|
+
balanceUsd: fmt(d["auryn-balance-vid"]),
|
|
103
|
+
pricePerUnit: fmt(d["auryn-price"]),
|
|
104
|
+
totalSupply: {
|
|
105
|
+
display: fmt(d["auryn-supply"]),
|
|
106
|
+
value: fmt(d["auryn-supply-hover"]),
|
|
107
|
+
},
|
|
108
|
+
supplyUsdValue: fmt(d["auryn-supply-vid"]),
|
|
109
|
+
supplyLabel: "Auryn Supply",
|
|
110
|
+
postSupplyRow: {
|
|
111
|
+
label: "Ouroboros Supply",
|
|
112
|
+
value: fmt(d["ouro-supply"]),
|
|
113
|
+
hoverValue: fmt(d["ouro-supply-hover"]),
|
|
114
|
+
usdValue: fmt(d["ouro-supply-vid"]),
|
|
115
|
+
suffix: " Ѻ",
|
|
116
|
+
suffixColor: "#7b4a1e",
|
|
117
|
+
},
|
|
118
|
+
virtual: null,
|
|
119
|
+
info: "",
|
|
120
|
+
currencySymbol: "₳",
|
|
121
|
+
currencySymbolColor: "#d2d3d4",
|
|
122
|
+
availableActions: ["Autostake (Coil)", "Recover (Uncoil)", "Transfer", "Bulk Transfer"],
|
|
123
|
+
keepTransferNames: true,
|
|
124
|
+
maxButtonsPerRow: 2,
|
|
125
|
+
hideSupplySeparator: true,
|
|
126
|
+
};
|
|
127
|
+
const eauryn = {
|
|
128
|
+
id: d["eauryn-id"],
|
|
129
|
+
name: d["eauryn-name"],
|
|
130
|
+
icon: "/images/coins/ELITE-AURYN.svg",
|
|
131
|
+
iconBgColor: "bg-yellow-50",
|
|
132
|
+
balance: {
|
|
133
|
+
display: fmt(d["eauryn-balance"]),
|
|
134
|
+
value: fmt(d["eauryn-balance-hover"]),
|
|
135
|
+
},
|
|
136
|
+
balanceUsd: fmt(d["eauryn-balance-vid"]),
|
|
137
|
+
pricePerUnit: fmt(d["eauryn-price"]),
|
|
138
|
+
totalSupply: {
|
|
139
|
+
display: fmt(d["eauryn-supply"]),
|
|
140
|
+
value: fmt(d["eauryn-supply-hover"]),
|
|
141
|
+
},
|
|
142
|
+
supplyUsdValue: fmt(d["eauryn-supply-vid"]),
|
|
143
|
+
supplyLabel: "EliteAuryn Supply",
|
|
144
|
+
virtual: null,
|
|
145
|
+
info: "",
|
|
146
|
+
currencySymbol: "Ξ₳",
|
|
147
|
+
currencySymbolColor: "#ceac5f",
|
|
148
|
+
availableActions: ["Clear Ouroboros Dispo", "Recover (Uncoil)", "Transfer", "Bulk Transfer"],
|
|
149
|
+
keepTransferNames: true,
|
|
150
|
+
notImplementedActions: [],
|
|
151
|
+
maxButtonsPerRow: 2,
|
|
152
|
+
hideSupplySeparator: true,
|
|
153
|
+
extraBalanceRow: {
|
|
154
|
+
label: "EA to Next Tier",
|
|
155
|
+
value: fmt(d["eauryn-next"]),
|
|
156
|
+
hoverValue: fmt(d["eauryn-next-hover"]),
|
|
157
|
+
usdValue: fmt(d["eauryn-next-vid"]),
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
const wstoa = {
|
|
161
|
+
id: d["wstoa-id"],
|
|
162
|
+
name: "WSTOA",
|
|
163
|
+
icon: "/images/coins/WSTOA.svg",
|
|
164
|
+
iconBgColor: "bg-primary/5",
|
|
165
|
+
balance: {
|
|
166
|
+
display: fmt(d["wstoa-wrapped-balance"]),
|
|
167
|
+
value: fmt(d["wstoa-wrapped-balance-hover"]),
|
|
168
|
+
},
|
|
169
|
+
balanceUsd: fmt(d["wstoa-wrapped-balance-vid"]),
|
|
170
|
+
pricePerUnit: fmt(d["wstoa-price"]),
|
|
171
|
+
totalSupply: {
|
|
172
|
+
display: fmt(d["wstoa-wrapped-total-supply"]),
|
|
173
|
+
value: fmt(d["wstoa-wrapped-total-supply-hover"]),
|
|
174
|
+
},
|
|
175
|
+
supplyUsdValue: fmt(d["wstoa-wrapped-total-supply-vid"]),
|
|
176
|
+
virtual: null,
|
|
177
|
+
info: d["stoa-discount-text"] ?? "",
|
|
178
|
+
currencySymbol: "❖",
|
|
179
|
+
currencySymbolColor: "#ceac5f",
|
|
180
|
+
displayName: "WrappedStoa",
|
|
181
|
+
leadingBalanceRow: {
|
|
182
|
+
label: "Native Balance",
|
|
183
|
+
value: fmt(d["wstoa-native-balance"]),
|
|
184
|
+
hoverValue: supplyHoverVal(d["wstoa-native-balance-hover"]),
|
|
185
|
+
usdValue: fmt(d["wstoa-native-balance-vid"]),
|
|
186
|
+
suffix: " ❖",
|
|
187
|
+
suffixColor: "#ceac5f",
|
|
188
|
+
},
|
|
189
|
+
balanceLabel: "Wrapped Balance",
|
|
190
|
+
supplyLabel: "Total Wrapped Supply",
|
|
191
|
+
hideSupplySeparator: true,
|
|
192
|
+
keepTransferNames: true,
|
|
193
|
+
availableActions: ["Coil", "Brumate", "Wrap", "Transfer", "Bulk Transfer", "Unwrap"],
|
|
194
|
+
};
|
|
195
|
+
const sstoa = {
|
|
196
|
+
id: d["sstoa-id"],
|
|
197
|
+
name: "SSTOA",
|
|
198
|
+
icon: "/images/coins/SSTOA.svg",
|
|
199
|
+
iconBgColor: "bg-primary/5",
|
|
200
|
+
balance: {
|
|
201
|
+
display: fmt(d["sstoa-balance"]),
|
|
202
|
+
value: fmt(d["sstoa-balance-hover"]),
|
|
203
|
+
},
|
|
204
|
+
balanceUsd: fmt(d["sstoa-balance-vid"]),
|
|
205
|
+
pricePerUnit: fmt(d["sstoa-price"]),
|
|
206
|
+
totalSupply: {
|
|
207
|
+
display: fmt(d["sstoa-supply"]),
|
|
208
|
+
value: fmt(d["sstoa-supply-hover"]),
|
|
209
|
+
},
|
|
210
|
+
supplyUsdValue: fmt(d["sstoa-supply-vid"]),
|
|
211
|
+
virtual: null,
|
|
212
|
+
info: "",
|
|
213
|
+
currencySymbol: "◈",
|
|
214
|
+
currencySymbolColor: "#e8e8e8",
|
|
215
|
+
displayName: "SilverStoa",
|
|
216
|
+
supplyLabel: "Total SilverStoa Supply",
|
|
217
|
+
hideSupplySeparator: true,
|
|
218
|
+
keepTransferNames: true,
|
|
219
|
+
maxButtonsPerRow: 2,
|
|
220
|
+
availableActions: ["Constrict", "Recover", "Transfer", "Bulk Transfer"],
|
|
221
|
+
postSupplyRow: {
|
|
222
|
+
label: "Total GoldenStoa Supply",
|
|
223
|
+
value: fmt(d["gstoa-supply"]),
|
|
224
|
+
hoverValue: fmt(d["gstoa-supply-hover"]),
|
|
225
|
+
usdValue: fmt(d["gstoa-supply-vid"]),
|
|
226
|
+
suffix: " ◈",
|
|
227
|
+
suffixColor: "#ceac5f",
|
|
228
|
+
},
|
|
229
|
+
};
|
|
230
|
+
const gstoa = {
|
|
231
|
+
id: d["gstoa-id"],
|
|
232
|
+
displayId: `${d["gstoa-id"] ?? "GSTOA"} | ${d["hgstoa-id"] ?? "H|GSTOA"}`,
|
|
233
|
+
name: "GSTOA",
|
|
234
|
+
icon: "/images/coins/SSTOA.svg",
|
|
235
|
+
isGoldIcon: true,
|
|
236
|
+
balance: {
|
|
237
|
+
display: fmt(d["gstoa-balance"]),
|
|
238
|
+
value: fmt(d["gstoa-balance-hover"]),
|
|
239
|
+
},
|
|
240
|
+
balanceUsd: fmt(d["gstoa-balance-vid"]),
|
|
241
|
+
pricePerUnit: fmt(d["gstoa-price"]),
|
|
242
|
+
totalSupply: {
|
|
243
|
+
display: fmt(d["gstoa-supply"]),
|
|
244
|
+
value: fmt(d["gstoa-supply-hover"]),
|
|
245
|
+
},
|
|
246
|
+
supplyUsdValue: fmt(d["gstoa-supply-vid"]),
|
|
247
|
+
virtual: null,
|
|
248
|
+
info: "",
|
|
249
|
+
currencySymbol: "◈",
|
|
250
|
+
currencySymbolColor: "#ceac5f",
|
|
251
|
+
displayName: "GoldenStoa",
|
|
252
|
+
hideSupplySeparator: true,
|
|
253
|
+
hideSupplyRow: true,
|
|
254
|
+
middleBalanceRows: [
|
|
255
|
+
{
|
|
256
|
+
label: "Hibernated Balance (Nonces)",
|
|
257
|
+
value: fmt(d["hgstoa-balance-nonces"]),
|
|
258
|
+
hoverValue: d["hgstoa-balance-nonces-hover"] ?? undefined,
|
|
259
|
+
usdValue: fmt(d["hgstoa-balance-nonces-vid"]),
|
|
260
|
+
suffix: " ◈",
|
|
261
|
+
suffixColor: "#ceac5f",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
label: "Total GoldenStoa",
|
|
265
|
+
value: fmt(d["gstoa-total-balance"]),
|
|
266
|
+
hoverValue: fmt(d["gstoa-total-balance-hover"]),
|
|
267
|
+
usdValue: fmt(d["gstoa-total-balance-vid"]),
|
|
268
|
+
suffix: " ◈",
|
|
269
|
+
suffixColor: "#ceac5f",
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
availableActions: ["Recover", "Transfer", "Bulk Transfer", "Awake", "Slumber", "Transfer Nonces"],
|
|
273
|
+
keepTransferNames: true,
|
|
274
|
+
notImplementedActions: [],
|
|
275
|
+
};
|
|
276
|
+
const urstoa = {
|
|
277
|
+
id: "URSTOA",
|
|
278
|
+
displayId: "coin.UR|StoaTable",
|
|
279
|
+
name: "UrStoa",
|
|
280
|
+
icon: "/images/coins/WSTOA.svg",
|
|
281
|
+
isStoneIcon: true,
|
|
282
|
+
pricePerUnit: "—",
|
|
283
|
+
balanceUsd: "—",
|
|
284
|
+
balance: { display: "—", value: "0" },
|
|
285
|
+
totalSupply: { display: "—", value: "0" },
|
|
286
|
+
currencySymbol: "✦",
|
|
287
|
+
currencySymbolColor: "#555555",
|
|
288
|
+
hidePrice: true,
|
|
289
|
+
hideSupplySeparator: true,
|
|
290
|
+
textAlignTop: true,
|
|
291
|
+
customBalanceRows: [
|
|
292
|
+
{
|
|
293
|
+
label: "Wrapped Balance",
|
|
294
|
+
value: fmt(String(d["urstoa-wrapped-balance"] ?? 0)),
|
|
295
|
+
suffix: " ✦",
|
|
296
|
+
suffixColor: "#555555",
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
label: "Payment Key Balance",
|
|
300
|
+
value: fmt(String(d["urstoa-payment-key-balance"] ?? 0)),
|
|
301
|
+
suffix: " ✦",
|
|
302
|
+
suffixColor: "#555555",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
label: "UrStoa Vault Balance",
|
|
306
|
+
value: fmt(String(d["urstoa-vault-balance"] ?? 0)),
|
|
307
|
+
suffix: " ✦",
|
|
308
|
+
suffixColor: "#555555",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
label: "UrStoa Vault Earnings in STOA",
|
|
312
|
+
value: fmt(d["urstoa-vault-earnings"]),
|
|
313
|
+
// The chain returns this hover as a { decimal: "…" } object (like the
|
|
314
|
+
// supply hover). Route it through supplyHoverVal so mayComeWithDeimal
|
|
315
|
+
// unwraps it — `String({decimal})` would yield "[object Object]", which
|
|
316
|
+
// parses back to 0 and wrongly disables the Collect button. See supply row.
|
|
317
|
+
hoverValue: supplyHoverVal(d["urstoa-vault-earning-hover"]),
|
|
318
|
+
suffix: " ❖",
|
|
319
|
+
suffixColor: "#ceac5f",
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
label: "UrStoa Vault STOA Supply",
|
|
323
|
+
value: fmt(d["urstoa-vault-stoa-supply"]),
|
|
324
|
+
hoverValue: supplyHoverVal(d["urstoa-vault-stoa-supply-hover"]),
|
|
325
|
+
suffix: " ❖",
|
|
326
|
+
suffixColor: "#ceac5f",
|
|
327
|
+
},
|
|
328
|
+
],
|
|
329
|
+
availableActions: ["Stake", "Unstake", "Wrap", "Collect", "Transfer", "Unwrap"],
|
|
330
|
+
keepTransferNames: true,
|
|
331
|
+
forceGoldActions: ["Transfer", "Stake", "Unstake", "Collect"],
|
|
332
|
+
notImplementedActions: [],
|
|
333
|
+
/** Wrapped UrStoa DPTF token ID (from primordials) */
|
|
334
|
+
wrappedTokenId: d["urstoa-wrapped-id"] ?? null,
|
|
335
|
+
};
|
|
336
|
+
return {
|
|
337
|
+
totalWithVirtual: formatEU(d["total-value-with-vouro"]),
|
|
338
|
+
total: formatEU(d["total-value"]),
|
|
339
|
+
tokens: [ouro, ignis, auryn, eauryn, wstoa, sstoa, gstoa, urstoa],
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
export function buildPlaceholderPrimordials() {
|
|
343
|
+
const Q = "???";
|
|
344
|
+
const mkToken = (name, extra = {}) => ({
|
|
345
|
+
id: Q,
|
|
346
|
+
name,
|
|
347
|
+
balance: { display: Q, value: Q },
|
|
348
|
+
balanceUsd: Q,
|
|
349
|
+
pricePerUnit: Q,
|
|
350
|
+
totalSupply: { display: Q, value: Q },
|
|
351
|
+
supplyUsdValue: Q,
|
|
352
|
+
virtual: null,
|
|
353
|
+
info: "",
|
|
354
|
+
currencySymbol: "",
|
|
355
|
+
availableActions: [],
|
|
356
|
+
...extra,
|
|
357
|
+
});
|
|
358
|
+
return {
|
|
359
|
+
totalWithVirtual: Q,
|
|
360
|
+
total: Q,
|
|
361
|
+
tokens: [
|
|
362
|
+
mkToken("Ouroboros", {
|
|
363
|
+
icon: "/images/coins/OURO.svg",
|
|
364
|
+
currencySymbol: "Ѻ",
|
|
365
|
+
currencySymbolColor: "#7b4a1e",
|
|
366
|
+
virtual: { display: Q, value: Q, inUsd: Q },
|
|
367
|
+
availableActions: ["Sublimate", "Coil", "Curl", "Transfer", "Bulk Transfer"],
|
|
368
|
+
keepTransferNames: true,
|
|
369
|
+
balanceLabel: "Balance",
|
|
370
|
+
virtualLabel: "Virtual Balance",
|
|
371
|
+
supplyLabel: "Dispo Capacity",
|
|
372
|
+
}),
|
|
373
|
+
mkToken("Ignis", {
|
|
374
|
+
icon: "/images/coins/Ignis.svg",
|
|
375
|
+
currencySymbol: "Ω",
|
|
376
|
+
currencySymbolColor: "#cc2200",
|
|
377
|
+
showCodexRow: true,
|
|
378
|
+
codexBalance: { display: Q, value: Q, inUsd: Q },
|
|
379
|
+
availableActions: ["Compress", "Firestarter", "Transfer", "Bulk Transfer"],
|
|
380
|
+
keepTransferNames: true,
|
|
381
|
+
maxButtonsPerRow: 2,
|
|
382
|
+
supplyLabel: "Ouronet Total GAS",
|
|
383
|
+
}),
|
|
384
|
+
mkToken("Auryn", {
|
|
385
|
+
icon: "/images/coins/AURYN.svg",
|
|
386
|
+
currencySymbol: "₳",
|
|
387
|
+
hideSupplySeparator: true,
|
|
388
|
+
availableActions: ["Autostake (Coil)", "Recover (Uncoil)", "Transfer", "Bulk Transfer"],
|
|
389
|
+
keepTransferNames: true,
|
|
390
|
+
maxButtonsPerRow: 2,
|
|
391
|
+
}),
|
|
392
|
+
mkToken("EliteAuryn", {
|
|
393
|
+
icon: "/images/coins/ELITE-AURYN.svg",
|
|
394
|
+
currencySymbol: "Ξ₳",
|
|
395
|
+
currencySymbolColor: "#ceac5f",
|
|
396
|
+
hideSupplySeparator: true,
|
|
397
|
+
hideSupplyRow: true,
|
|
398
|
+
extraBalanceRow: { label: "EA to Next Tier", value: Q, usdValue: Q },
|
|
399
|
+
availableActions: ["Clear Ouroboros Dispo", "Recover (Uncoil)", "Transfer", "Bulk Transfer"],
|
|
400
|
+
keepTransferNames: true,
|
|
401
|
+
notImplementedActions: [],
|
|
402
|
+
maxButtonsPerRow: 2,
|
|
403
|
+
}),
|
|
404
|
+
mkToken("WSTOA", {
|
|
405
|
+
icon: "/images/coins/WSTOA.svg",
|
|
406
|
+
currencySymbol: "❖",
|
|
407
|
+
currencySymbolColor: "#ceac5f",
|
|
408
|
+
displayName: "WrappedStoa",
|
|
409
|
+
leadingBalanceRow: { label: "Native Balance", value: Q, usdValue: Q },
|
|
410
|
+
balanceLabel: "Wrapped Balance",
|
|
411
|
+
supplyLabel: "Total Wrapped Supply",
|
|
412
|
+
hideSupplySeparator: true,
|
|
413
|
+
keepTransferNames: true,
|
|
414
|
+
availableActions: ["Coil", "Brumate", "Wrap", "Transfer", "Bulk Transfer", "Unwrap"],
|
|
415
|
+
}),
|
|
416
|
+
mkToken("SSTOA", {
|
|
417
|
+
icon: "/images/coins/SSTOA.svg",
|
|
418
|
+
currencySymbol: "◈",
|
|
419
|
+
currencySymbolColor: "#e8e8e8",
|
|
420
|
+
displayName: "SilverStoa",
|
|
421
|
+
supplyLabel: "Total SilverStoa Supply",
|
|
422
|
+
hideSupplySeparator: true,
|
|
423
|
+
keepTransferNames: true,
|
|
424
|
+
maxButtonsPerRow: 2,
|
|
425
|
+
availableActions: ["Constrict", "Recover", "Transfer", "Bulk Transfer"],
|
|
426
|
+
}),
|
|
427
|
+
{
|
|
428
|
+
id: Q,
|
|
429
|
+
displayId: `${Q} | ${Q}`,
|
|
430
|
+
name: "GSTOA",
|
|
431
|
+
icon: "/images/coins/SSTOA.svg",
|
|
432
|
+
isGoldIcon: true,
|
|
433
|
+
balance: { display: Q, value: Q },
|
|
434
|
+
balanceUsd: Q,
|
|
435
|
+
pricePerUnit: Q,
|
|
436
|
+
totalSupply: { display: Q, value: Q },
|
|
437
|
+
supplyUsdValue: Q,
|
|
438
|
+
virtual: null,
|
|
439
|
+
info: "",
|
|
440
|
+
currencySymbol: "◈",
|
|
441
|
+
currencySymbolColor: "#ceac5f",
|
|
442
|
+
displayName: "GoldenStoa",
|
|
443
|
+
hideSupplySeparator: true,
|
|
444
|
+
hideSupplyRow: true,
|
|
445
|
+
middleBalanceRows: [
|
|
446
|
+
{ label: "Hibernated Balance (Nonces)", value: Q, usdValue: Q },
|
|
447
|
+
{ label: "Total GoldenStoa", value: Q, usdValue: Q },
|
|
448
|
+
],
|
|
449
|
+
availableActions: ["Recover", "Transfer", "Bulk Transfer", "Awake", "Slumber", "Transfer Nonces"],
|
|
450
|
+
keepTransferNames: true,
|
|
451
|
+
notImplementedActions: [],
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
id: "URSTOA",
|
|
455
|
+
displayId: "coin.UR|StoaTable",
|
|
456
|
+
name: "UrStoa",
|
|
457
|
+
icon: "/images/coins/WSTOA.svg",
|
|
458
|
+
isStoneIcon: true,
|
|
459
|
+
pricePerUnit: "—",
|
|
460
|
+
balanceUsd: "—",
|
|
461
|
+
balance: { display: "—", value: "0" },
|
|
462
|
+
totalSupply: { display: "—", value: "0" },
|
|
463
|
+
currencySymbol: "✦",
|
|
464
|
+
currencySymbolColor: "#555555",
|
|
465
|
+
hidePrice: true,
|
|
466
|
+
hideSupplySeparator: true,
|
|
467
|
+
textAlignTop: true,
|
|
468
|
+
customBalanceRows: [
|
|
469
|
+
{ label: "Payment Key Balance", value: Q },
|
|
470
|
+
{ label: "UrStoa Vault Balance", value: Q },
|
|
471
|
+
{ label: "UrStoa Vault Earnings in STOA", value: Q },
|
|
472
|
+
{ label: "UrStoa Vault STOA Supply", value: Q },
|
|
473
|
+
],
|
|
474
|
+
availableActions: ["Stake", "Unstake", "Collect", "Transfer"],
|
|
475
|
+
keepTransferNames: true,
|
|
476
|
+
notImplementedActions: ["Transfer"],
|
|
477
|
+
},
|
|
478
|
+
],
|
|
479
|
+
};
|
|
480
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ouroRotateFunctions.ts
|
|
3
|
+
* Kadena payment-key rotation for Ouronet accounts (multi-signer flow).
|
|
4
|
+
*/
|
|
5
|
+
import type { IKadenaKeypair } from "@stoachain/stoa-core/signing";
|
|
6
|
+
import type { IKeyset } from "@stoachain/stoa-core/guard";
|
|
7
|
+
/**
|
|
8
|
+
* Query RotateKadena info object from the chain.
|
|
9
|
+
* (ouronet-ns.INFO-ZERO.DALOS-INFO|URC_RotateKadena <patron> <account>)
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRotateKadenaInfo(patron: string, account: string): Promise<any | null>;
|
|
12
|
+
/**
|
|
13
|
+
* Rotate Payment Key (Kadena Ledger) for an Ouronet account.
|
|
14
|
+
* (ouronet-ns.TS01-C1.DALOS|C_RotateKadena patron account newPaymentKey)
|
|
15
|
+
*
|
|
16
|
+
* Requires two signers:
|
|
17
|
+
* 1. patronKadenaKey — key from patron's guard (pays IGNIS, has GAS_PAYER cap)
|
|
18
|
+
* 2. accountGuardKey — key from the target account's guard (ownership proof)
|
|
19
|
+
*
|
|
20
|
+
* If patron == account, these may be the same key, requiring only 1 signer.
|
|
21
|
+
*/
|
|
22
|
+
export declare function rotateKadenaPaymentKey(patronAddress: string, accountAddress: string, newPaymentKey: string, gasStationKey: IKadenaKeypair, patronGuardKeys: IKadenaKeypair[], accountGuardKeys: IKadenaKeypair[], patronGuard: IKeyset | null, accountGuard: IKeyset | null): Promise<import("@stoachain/kadena-stoic-legacy/client").ITransactionDescriptor>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ouroRotateFunctions.ts
|
|
3
|
+
* Kadena payment-key rotation for Ouronet accounts (multi-signer flow).
|
|
4
|
+
*/
|
|
5
|
+
import { calculateAutoGasLimit } from "@stoachain/stoa-core/gas";
|
|
6
|
+
import { KADENA_CHAIN_ID, KADENA_NAMESPACE, STOA_AUTONOMIC_OURONETGASSTATION, KADENA_NETWORK, } from "../constants/index.js";
|
|
7
|
+
import { safeCreationTime } from "@stoachain/stoa-core/pact";
|
|
8
|
+
import { Pact } from "@stoachain/kadena-stoic-legacy/client";
|
|
9
|
+
import { getFailoverClient } from "@stoachain/stoa-core/network";
|
|
10
|
+
import { universalSignTransaction, fromKeypair } from "@stoachain/stoa-core/signing";
|
|
11
|
+
import { createSimulationError, logDetailedError } from "@stoachain/stoa-core/errors";
|
|
12
|
+
import { pactRead } from "@stoachain/stoa-core/reads";
|
|
13
|
+
import { getLogger } from "@stoachain/stoa-core/observability";
|
|
14
|
+
/**
|
|
15
|
+
* Query RotateKadena info object from the chain.
|
|
16
|
+
* (ouronet-ns.INFO-ZERO.DALOS-INFO|URC_RotateKadena <patron> <account>)
|
|
17
|
+
*/
|
|
18
|
+
export async function getRotateKadenaInfo(patron, account) {
|
|
19
|
+
try {
|
|
20
|
+
const pactCode = `(${KADENA_NAMESPACE}.INFO-ZERO.DALOS-INFO|URC_RotateKadena "${patron}" "${account}")`;
|
|
21
|
+
const response = await pactRead(pactCode, { tier: "T3" });
|
|
22
|
+
if (response?.result?.status === "success") {
|
|
23
|
+
return response.result.data;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
getLogger().error("Error getting RotateKadena info:", error);
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rotate Payment Key (Kadena Ledger) for an Ouronet account.
|
|
34
|
+
* (ouronet-ns.TS01-C1.DALOS|C_RotateKadena patron account newPaymentKey)
|
|
35
|
+
*
|
|
36
|
+
* Requires two signers:
|
|
37
|
+
* 1. patronKadenaKey — key from patron's guard (pays IGNIS, has GAS_PAYER cap)
|
|
38
|
+
* 2. accountGuardKey — key from the target account's guard (ownership proof)
|
|
39
|
+
*
|
|
40
|
+
* If patron == account, these may be the same key, requiring only 1 signer.
|
|
41
|
+
*/
|
|
42
|
+
export async function rotateKadenaPaymentKey(patronAddress, accountAddress, newPaymentKey, gasStationKey, patronGuardKeys, accountGuardKeys, patronGuard, accountGuard) {
|
|
43
|
+
let gasLimit = 2000000;
|
|
44
|
+
// Collect all unique signers: gasStation + patronGuard + accountGuard
|
|
45
|
+
const allSigners = [gasStationKey];
|
|
46
|
+
const addedPubs = new Set([gasStationKey.publicKey]);
|
|
47
|
+
for (const k of [...patronGuardKeys, ...accountGuardKeys]) {
|
|
48
|
+
if (!addedPubs.has(k.publicKey)) {
|
|
49
|
+
allSigners.push(k);
|
|
50
|
+
addedPubs.add(k.publicKey);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const buildTransaction = (gasLimitOverride) => {
|
|
54
|
+
let builder = Pact.builder
|
|
55
|
+
.execution(`(${KADENA_NAMESPACE}.TS01-C1.DALOS|C_RotateKadena "${patronAddress}" "${accountAddress}" "${newPaymentKey}")`);
|
|
56
|
+
// Add keyset data for patron guard
|
|
57
|
+
if (patronGuard) {
|
|
58
|
+
builder = builder.addData("ks", {
|
|
59
|
+
keys: patronGuard.keys,
|
|
60
|
+
pred: patronGuard.pred,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Add keyset data for account guard (if different from patron)
|
|
64
|
+
if (accountGuard && accountAddress !== patronAddress) {
|
|
65
|
+
builder = builder.addData("ks-account", {
|
|
66
|
+
keys: accountGuard.keys,
|
|
67
|
+
pred: accountGuard.pred,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
builder = builder
|
|
71
|
+
.setMeta({
|
|
72
|
+
senderAccount: STOA_AUTONOMIC_OURONETGASSTATION,
|
|
73
|
+
creationTime: safeCreationTime(),
|
|
74
|
+
chainId: KADENA_CHAIN_ID,
|
|
75
|
+
gasLimit: gasLimitOverride || gasLimit,
|
|
76
|
+
})
|
|
77
|
+
.setNetworkId(KADENA_NETWORK)
|
|
78
|
+
// Gas Station key: GAS_PAYER capability (SEPARATE from guard keys)
|
|
79
|
+
.addSigner(gasStationKey.publicKey, (withCapability) => [
|
|
80
|
+
withCapability(`${KADENA_NAMESPACE}.DALOS.GAS_PAYER`, "", { int: 0 }, { decimal: "0.0" }),
|
|
81
|
+
]);
|
|
82
|
+
// Patron guard signers — pure signing (ownership)
|
|
83
|
+
const addedSignerPubs = new Set([gasStationKey.publicKey]);
|
|
84
|
+
for (const k of patronGuardKeys) {
|
|
85
|
+
if (!addedSignerPubs.has(k.publicKey)) {
|
|
86
|
+
builder = builder.addSigner(k.publicKey);
|
|
87
|
+
addedSignerPubs.add(k.publicKey);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
// Account guard signers — pure signing (ownership)
|
|
91
|
+
for (const k of accountGuardKeys) {
|
|
92
|
+
if (!addedSignerPubs.has(k.publicKey)) {
|
|
93
|
+
builder = builder.addSigner(k.publicKey);
|
|
94
|
+
addedSignerPubs.add(k.publicKey);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return builder.createTransaction();
|
|
98
|
+
};
|
|
99
|
+
const { dirtyRead, submit } = getFailoverClient(KADENA_CHAIN_ID);
|
|
100
|
+
let transaction = buildTransaction();
|
|
101
|
+
const simulation = await dirtyRead(transaction);
|
|
102
|
+
if (simulation.result.status === "failure") {
|
|
103
|
+
const error = createSimulationError("Rotate Payment Key", simulation.result, `Patron: ${patronAddress} | Account: ${accountAddress} | New Key: ${newPaymentKey}`);
|
|
104
|
+
logDetailedError(error);
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
const requiredGas = simulation.gas;
|
|
108
|
+
if (requiredGas) {
|
|
109
|
+
gasLimit = calculateAutoGasLimit(requiredGas);
|
|
110
|
+
transaction = buildTransaction(gasLimit);
|
|
111
|
+
}
|
|
112
|
+
const signedTransaction = await universalSignTransaction(transaction, allSigners.map((s) => fromKeypair(s)));
|
|
113
|
+
return await submit(signedTransaction);
|
|
114
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ouroSubCompressFunctions.ts
|
|
3
|
+
* Sublimate (OURO -> IGNIS) and compress (IGNIS -> OURO) execution + preview/info reads.
|
|
4
|
+
*/
|
|
5
|
+
import type { IKadenaKeypair } from "@stoachain/stoa-core/signing";
|
|
6
|
+
import type { IOuroAccountKeypair } from "./ouroTypes.js";
|
|
7
|
+
export declare function sublimateOuroToIgnis(ouroAccount: IOuroAccountKeypair, kadenaAccount: IKadenaKeypair, guard: IKadenaKeypair, targetAccount: string, ouroAmount: string): Promise<import("@stoachain/kadena-stoic-legacy/client").ITransactionDescriptor>;
|
|
8
|
+
export declare function compressIgnisToOuro(ouroAccount: IOuroAccountKeypair, kadenaAccount: IKadenaKeypair, guard: IKadenaKeypair, ignisAmount: string): Promise<import("@stoachain/kadena-stoic-legacy/client").ITransactionDescriptor>;
|
|
9
|
+
export declare function getSublimatPreview(ouroAmount: string): Promise<{
|
|
10
|
+
ignis: number;
|
|
11
|
+
fee: number;
|
|
12
|
+
} | null>;
|
|
13
|
+
export declare function getCompressPreview(ignisAmount: string): Promise<{
|
|
14
|
+
ouro: number;
|
|
15
|
+
fee: number;
|
|
16
|
+
} | null>;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated Use `getSublimateInfo` from `@ouronet/ouronet-core/interactions/infoOneFunctions` instead.
|
|
19
|
+
* This compat shim accepts the legacy (patron, resident, amount-as-string) signature and forwards to the canonical
|
|
20
|
+
* (client, target, amount-as-number) form. Will be removed in v4.2.0.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getSublimateInfo(a: string, b: string, c: string | number): Promise<any>;
|
|
23
|
+
export declare function getCompressInfo(client: string, amount: string): Promise<any | null>;
|