@pollar/react 0.12.1-rc.2 → 0.12.1-rc.5
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/README.md +172 -159
- package/dist/index.css +208 -150
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +19 -11
- package/dist/index.d.ts +19 -11
- package/dist/index.js +620 -210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +620 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1221,6 +1221,19 @@ var LOGO_POLLAR_MARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-mark-on-
|
|
|
1221
1221
|
var LOGO_POLLAR_MARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-mark-on-dark.png";
|
|
1222
1222
|
var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
|
|
1223
1223
|
var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
|
|
1224
|
+
var CHAIN_LOGOS = {
|
|
1225
|
+
STELLAR: "https://www.pollar.xyz/chains/stellar.png",
|
|
1226
|
+
POLYGON: "https://www.pollar.xyz/chains/polygon.png",
|
|
1227
|
+
SOLANA: "https://www.pollar.xyz/chains/solana.png"
|
|
1228
|
+
};
|
|
1229
|
+
var TOKEN_LOGOS = {
|
|
1230
|
+
USDC: "https://www.pollar.xyz/tokens/usdc.png",
|
|
1231
|
+
USDT: "https://www.pollar.xyz/tokens/usdt.png",
|
|
1232
|
+
EURC: "https://www.pollar.xyz/tokens/eurc.png",
|
|
1233
|
+
XLM: "https://www.pollar.xyz/tokens/xlm.png",
|
|
1234
|
+
SOL: "https://www.pollar.xyz/tokens/sol.png",
|
|
1235
|
+
POL: "https://www.pollar.xyz/tokens/pol.png"
|
|
1236
|
+
};
|
|
1224
1237
|
var _modalLog = console;
|
|
1225
1238
|
function setModalErrorLogger(logger) {
|
|
1226
1239
|
_modalLog = logger;
|
|
@@ -1259,7 +1272,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1259
1272
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1260
1273
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1261
1274
|
"v",
|
|
1262
|
-
"0.12.1-rc.
|
|
1275
|
+
"0.12.1-rc.5"
|
|
1263
1276
|
] })
|
|
1264
1277
|
] });
|
|
1265
1278
|
};
|
|
@@ -4237,6 +4250,7 @@ var RAMP_COPY = {
|
|
|
4237
4250
|
providerReviewing: "The provider is reviewing your details. This updates on its own.",
|
|
4238
4251
|
serverTrouble: "Having trouble reaching the server. Retrying\u2026",
|
|
4239
4252
|
startAnother: "Start another operation",
|
|
4253
|
+
newQuote: "Get a new quote",
|
|
4240
4254
|
keepsGoing: "This one keeps going; you can resume it later.",
|
|
4241
4255
|
somethingWrong: "Something went wrong.",
|
|
4242
4256
|
routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
|
|
@@ -4359,6 +4373,7 @@ var RAMP_COPY = {
|
|
|
4359
4373
|
providerReviewing: "El proveedor est\xE1 revisando tus datos. Esto se actualiza solo.",
|
|
4360
4374
|
serverTrouble: "Hay problemas para conectar con el servidor. Reintentando\u2026",
|
|
4361
4375
|
startAnother: "Iniciar otra operaci\xF3n",
|
|
4376
|
+
newQuote: "Pedir nueva cotizaci\xF3n",
|
|
4362
4377
|
keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
|
|
4363
4378
|
somethingWrong: "Algo sali\xF3 mal.",
|
|
4364
4379
|
routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
|
|
@@ -4481,6 +4496,7 @@ var RAMP_COPY = {
|
|
|
4481
4496
|
providerReviewing: "O provedor est\xE1 analisando seus dados. Isto se atualiza sozinho.",
|
|
4482
4497
|
serverTrouble: "Problemas para conectar ao servidor. Tentando de novo\u2026",
|
|
4483
4498
|
startAnother: "Iniciar outra opera\xE7\xE3o",
|
|
4499
|
+
newQuote: "Pedir nova cota\xE7\xE3o",
|
|
4484
4500
|
keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
|
|
4485
4501
|
somethingWrong: "Algo deu errado.",
|
|
4486
4502
|
routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
|
|
@@ -4793,6 +4809,7 @@ function RampWidgetTemplate({
|
|
|
4793
4809
|
noChains = false,
|
|
4794
4810
|
retrying = false,
|
|
4795
4811
|
onRetryOrder,
|
|
4812
|
+
onRequote,
|
|
4796
4813
|
onSetUpRecovery,
|
|
4797
4814
|
recoveryMissing = null,
|
|
4798
4815
|
checkingPayment = false,
|
|
@@ -4824,6 +4841,7 @@ function RampWidgetTemplate({
|
|
|
4824
4841
|
const stopped = order ? core.rampOrderStopped(order) : false;
|
|
4825
4842
|
const receive = order ? core.rampOrderReceive(order) : null;
|
|
4826
4843
|
const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
|
|
4844
|
+
const asksNewQuote = order?.failure?.resolutionAction === "accept_new_quote";
|
|
4827
4845
|
const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
|
|
4828
4846
|
useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
|
|
4829
4847
|
const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
|
|
@@ -5156,7 +5174,8 @@ function RampWidgetTemplate({
|
|
|
5156
5174
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: core.rampOrderResolutionText(order, language) }),
|
|
5157
5175
|
stopped && !settled && waitsOnRecovery && recoveryMissing !== false && onSetUpRecovery && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onSetUpRecovery, children: copy.setUpRecovery }),
|
|
5158
5176
|
stopped && !settled && waitsOnRecovery && recoveryMissing === true && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-ramp-payment-note", children: copy.recoveryNote }),
|
|
5159
|
-
stopped && !settled &&
|
|
5177
|
+
stopped && !settled && asksNewQuote && onRequote && /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRequote, children: copy.newQuote }),
|
|
5178
|
+
stopped && !settled && order.failure.resolutionOwner === "END_USER" && !asksNewQuote && onRetryOrder && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5160
5179
|
"button",
|
|
5161
5180
|
{
|
|
5162
5181
|
type: "button",
|
|
@@ -6270,6 +6289,10 @@ function RampWidget({ onClose, language: languageProp }) {
|
|
|
6270
6289
|
setRetrying(false);
|
|
6271
6290
|
}
|
|
6272
6291
|
}
|
|
6292
|
+
async function handleRequote() {
|
|
6293
|
+
setOrder(null);
|
|
6294
|
+
await handleFindRoute();
|
|
6295
|
+
}
|
|
6273
6296
|
const heldForRecovery = step === "status" && order?.failure?.resolutionAction === "set_up_recovery";
|
|
6274
6297
|
const wasRecoveryLocked = react.useRef(recoveryLocked);
|
|
6275
6298
|
react.useEffect(() => {
|
|
@@ -6417,6 +6440,7 @@ function RampWidget({ onClose, language: languageProp }) {
|
|
|
6417
6440
|
onApprove: openCosignModal,
|
|
6418
6441
|
retrying,
|
|
6419
6442
|
onRetryOrder: () => void handleRetryOrder(),
|
|
6443
|
+
onRequote: () => void handleRequote(),
|
|
6420
6444
|
onSetUpRecovery: openRecoveryModal,
|
|
6421
6445
|
recoveryMissing: recovery === null ? null : recoveryLocked,
|
|
6422
6446
|
pollTrouble,
|
|
@@ -6943,25 +6967,480 @@ var SEND_COPY = {
|
|
|
6943
6967
|
}
|
|
6944
6968
|
};
|
|
6945
6969
|
|
|
6970
|
+
// src/components/tx-review/tx-review-copy.ts
|
|
6971
|
+
var TX_REVIEW_COPY = {
|
|
6972
|
+
en: {
|
|
6973
|
+
titles: {
|
|
6974
|
+
send: (amount) => `Send ${amount}`,
|
|
6975
|
+
bridge: (amount, chain) => `Move ${amount} to ${chain}`,
|
|
6976
|
+
approve: (asset, spender) => `Allow ${spender} to use your ${asset}`,
|
|
6977
|
+
swap: (from, to) => `Swap ${from} for ${to}`,
|
|
6978
|
+
payment: (amount, to) => `Pay ${amount} to ${to}`,
|
|
6979
|
+
createAccount: "Create an account"
|
|
6980
|
+
},
|
|
6981
|
+
yourWallet: "Your wallet",
|
|
6982
|
+
newAccount: "New account",
|
|
6983
|
+
atLeast: "at least",
|
|
6984
|
+
approveNote: "This only gives permission. Nothing moves yet.",
|
|
6985
|
+
feeSponsored: "Fee covered by the app",
|
|
6986
|
+
feePaid: "You pay the network fee",
|
|
6987
|
+
showDetails: "Show details",
|
|
6988
|
+
hideDetails: "Hide details",
|
|
6989
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
6990
|
+
rows: {
|
|
6991
|
+
description: "Description",
|
|
6992
|
+
network: "Network",
|
|
6993
|
+
from: "From",
|
|
6994
|
+
to: "To",
|
|
6995
|
+
amount: "Amount",
|
|
6996
|
+
receiveMin: "Receive at least",
|
|
6997
|
+
via: "Via",
|
|
6998
|
+
fee: "Network fee",
|
|
6999
|
+
feeCovered: "Covered by the app",
|
|
7000
|
+
contract: "Contract",
|
|
7001
|
+
method: "Method",
|
|
7002
|
+
asset: "Asset",
|
|
7003
|
+
expiresIn: "Expires in",
|
|
7004
|
+
rawTx: "Raw transaction",
|
|
7005
|
+
txHash: "Transaction hash"
|
|
7006
|
+
},
|
|
7007
|
+
viewOnExplorer: "View on explorer"
|
|
7008
|
+
},
|
|
7009
|
+
es: {
|
|
7010
|
+
titles: {
|
|
7011
|
+
send: (amount) => `Enviar ${amount}`,
|
|
7012
|
+
bridge: (amount, chain) => `Mover ${amount} a ${chain}`,
|
|
7013
|
+
approve: (asset, spender) => `Permitir que ${spender} use tu ${asset}`,
|
|
7014
|
+
swap: (from, to) => `Cambiar ${from} por ${to}`,
|
|
7015
|
+
payment: (amount, to) => `Pagar ${amount} a ${to}`,
|
|
7016
|
+
createAccount: "Crear una cuenta"
|
|
7017
|
+
},
|
|
7018
|
+
yourWallet: "Tu billetera",
|
|
7019
|
+
newAccount: "Cuenta nueva",
|
|
7020
|
+
atLeast: "al menos",
|
|
7021
|
+
approveNote: "Solo das permiso. Todav\xEDa no se mueve nada.",
|
|
7022
|
+
feeSponsored: "La app cubre la comisi\xF3n",
|
|
7023
|
+
feePaid: "T\xFA pagas la comisi\xF3n de red",
|
|
7024
|
+
showDetails: "Ver detalles",
|
|
7025
|
+
hideDetails: "Ocultar detalles",
|
|
7026
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
7027
|
+
rows: {
|
|
7028
|
+
description: "Descripci\xF3n",
|
|
7029
|
+
network: "Red",
|
|
7030
|
+
from: "Desde",
|
|
7031
|
+
to: "Hacia",
|
|
7032
|
+
amount: "Monto",
|
|
7033
|
+
receiveMin: "Recibes al menos",
|
|
7034
|
+
via: "V\xEDa",
|
|
7035
|
+
fee: "Comisi\xF3n de red",
|
|
7036
|
+
feeCovered: "La cubre la app",
|
|
7037
|
+
contract: "Contrato",
|
|
7038
|
+
method: "M\xE9todo",
|
|
7039
|
+
asset: "Activo",
|
|
7040
|
+
expiresIn: "Vence en",
|
|
7041
|
+
rawTx: "Transacci\xF3n en bruto",
|
|
7042
|
+
txHash: "Hash de la transacci\xF3n"
|
|
7043
|
+
},
|
|
7044
|
+
viewOnExplorer: "Ver en el explorador"
|
|
7045
|
+
},
|
|
7046
|
+
pt: {
|
|
7047
|
+
titles: {
|
|
7048
|
+
send: (amount) => `Enviar ${amount}`,
|
|
7049
|
+
bridge: (amount, chain) => `Mover ${amount} para ${chain}`,
|
|
7050
|
+
approve: (asset, spender) => `Permitir que ${spender} use seu ${asset}`,
|
|
7051
|
+
swap: (from, to) => `Trocar ${from} por ${to}`,
|
|
7052
|
+
payment: (amount, to) => `Pagar ${amount} para ${to}`,
|
|
7053
|
+
createAccount: "Criar uma conta"
|
|
7054
|
+
},
|
|
7055
|
+
yourWallet: "Sua carteira",
|
|
7056
|
+
newAccount: "Conta nova",
|
|
7057
|
+
atLeast: "pelo menos",
|
|
7058
|
+
approveNote: "Isto s\xF3 d\xE1 permiss\xE3o. Nada se move ainda.",
|
|
7059
|
+
feeSponsored: "O app cobre a taxa",
|
|
7060
|
+
feePaid: "Voc\xEA paga a taxa de rede",
|
|
7061
|
+
showDetails: "Ver detalhes",
|
|
7062
|
+
hideDetails: "Ocultar detalhes",
|
|
7063
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
7064
|
+
rows: {
|
|
7065
|
+
description: "Descri\xE7\xE3o",
|
|
7066
|
+
network: "Rede",
|
|
7067
|
+
from: "De",
|
|
7068
|
+
to: "Para",
|
|
7069
|
+
amount: "Valor",
|
|
7070
|
+
receiveMin: "Recebe pelo menos",
|
|
7071
|
+
via: "Via",
|
|
7072
|
+
fee: "Taxa de rede",
|
|
7073
|
+
feeCovered: "Coberta pelo app",
|
|
7074
|
+
contract: "Contrato",
|
|
7075
|
+
method: "M\xE9todo",
|
|
7076
|
+
asset: "Ativo",
|
|
7077
|
+
expiresIn: "Expira em",
|
|
7078
|
+
rawTx: "Transa\xE7\xE3o bruta",
|
|
7079
|
+
txHash: "Hash da transa\xE7\xE3o"
|
|
7080
|
+
},
|
|
7081
|
+
viewOnExplorer: "Ver no explorador"
|
|
7082
|
+
}
|
|
7083
|
+
};
|
|
7084
|
+
var CHAINS = /* @__PURE__ */ new Set(["STELLAR", "POLYGON", "SOLANA"]);
|
|
7085
|
+
var asChain = (value) => typeof value === "string" && CHAINS.has(value) ? value : void 0;
|
|
7086
|
+
var asString = (value) => typeof value === "string" && value !== "" ? value : typeof value === "number" ? String(value) : void 0;
|
|
7087
|
+
function shortAddress(address) {
|
|
7088
|
+
return address.length <= 12 ? address : `${address.slice(0, 4)}...${address.slice(-4)}`;
|
|
7089
|
+
}
|
|
7090
|
+
function displayName(label) {
|
|
7091
|
+
if (/[A-Z]/.test(label) && /[a-z]/.test(label)) return label;
|
|
7092
|
+
return label.toLowerCase().split(/[_\s-]+/).map((word) => word ? word[0].toUpperCase() + word.slice(1) : word).join(" ");
|
|
7093
|
+
}
|
|
7094
|
+
var withAsset = (party) => [party?.amount, party?.asset].filter(Boolean).join(" ");
|
|
7095
|
+
function partyRow(label, party, copy) {
|
|
7096
|
+
if (!party?.address && !party?.label) return null;
|
|
7097
|
+
const chain = party.chain ? `${copy.chains[party.chain]} ` : "";
|
|
7098
|
+
const name = party.label ? `${displayName(party.label)} ` : "";
|
|
7099
|
+
return party.address ? { label, value: `${chain}${name}${party.address}`.trim(), copyValue: party.address, mono: true } : { label, value: `${chain}${name}`.trim() };
|
|
7100
|
+
}
|
|
7101
|
+
function titleOf(data, fallback, copy) {
|
|
7102
|
+
const { from, to } = data;
|
|
7103
|
+
switch (data.kind) {
|
|
7104
|
+
case "send":
|
|
7105
|
+
return from?.amount ? copy.titles.send(withAsset(from)) : fallback;
|
|
7106
|
+
case "bridge":
|
|
7107
|
+
return from?.amount && to?.chain ? copy.titles.bridge(withAsset(from), copy.chains[to.chain]) : fallback;
|
|
7108
|
+
case "approve":
|
|
7109
|
+
return from?.asset && to?.label ? copy.titles.approve(from.asset, displayName(to.label)) : fallback;
|
|
7110
|
+
case "swap":
|
|
7111
|
+
return from?.asset && to?.asset ? copy.titles.swap(from.asset, to.asset) : fallback;
|
|
7112
|
+
case "payment":
|
|
7113
|
+
return from?.amount && to?.label ? copy.titles.payment(withAsset(from), displayName(to.label)) : fallback;
|
|
7114
|
+
case "create_account":
|
|
7115
|
+
return copy.titles.createAccount;
|
|
7116
|
+
default:
|
|
7117
|
+
return fallback;
|
|
7118
|
+
}
|
|
7119
|
+
}
|
|
7120
|
+
function rampFlow(details) {
|
|
7121
|
+
const flow = details.flow;
|
|
7122
|
+
if (!flow || typeof flow !== "object" || !flow.from || !flow.to) return null;
|
|
7123
|
+
const kind = flow.kind;
|
|
7124
|
+
if (kind !== "bridge" && kind !== "approve" && kind !== "swap" && kind !== "payment") return null;
|
|
7125
|
+
const party = (p) => {
|
|
7126
|
+
const out = {};
|
|
7127
|
+
const chain = asChain(p.chain);
|
|
7128
|
+
if (chain) out.chain = chain;
|
|
7129
|
+
for (const key of ["asset", "amount", "address", "label"]) {
|
|
7130
|
+
const value = asString(p[key]);
|
|
7131
|
+
if (value) out[key] = value;
|
|
7132
|
+
}
|
|
7133
|
+
if (p.minimum === true) out.minimum = true;
|
|
7134
|
+
return out;
|
|
7135
|
+
};
|
|
7136
|
+
const from = { ...party(flow.from), self: true };
|
|
7137
|
+
const to = { ...party(flow.to), self: kind === "bridge" || kind === "swap" };
|
|
7138
|
+
return { kind, from, to, via: asString(flow.via) };
|
|
7139
|
+
}
|
|
7140
|
+
function readableAmount(details) {
|
|
7141
|
+
const { amount, decimals, symbol } = details;
|
|
7142
|
+
if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
|
|
7143
|
+
try {
|
|
7144
|
+
return { amount: core.fromBaseUnits(amount, decimals), symbol };
|
|
7145
|
+
} catch {
|
|
7146
|
+
return null;
|
|
7147
|
+
}
|
|
7148
|
+
}
|
|
7149
|
+
function reviewFromRequest(parts, copy) {
|
|
7150
|
+
const details = parts.details ?? {};
|
|
7151
|
+
const flow = rampFlow(details);
|
|
7152
|
+
const rows = [];
|
|
7153
|
+
let data;
|
|
7154
|
+
let via;
|
|
7155
|
+
if (flow) {
|
|
7156
|
+
data = { kind: flow.kind, from: flow.from, to: flow.to };
|
|
7157
|
+
via = flow.via;
|
|
7158
|
+
} else {
|
|
7159
|
+
const destination = asString(details.destination) ?? asString(details.to);
|
|
7160
|
+
const readable = readableAmount(details);
|
|
7161
|
+
const asset = readable?.symbol ?? asString(details.asset) ?? asString(details.assetCode) ?? asString(details.symbol);
|
|
7162
|
+
const amount = readable?.amount ?? asString(details.amount);
|
|
7163
|
+
const isTransfer = parts.operation === "payment" || parts.operation === "transfer";
|
|
7164
|
+
if (isTransfer && destination) {
|
|
7165
|
+
data = {
|
|
7166
|
+
kind: "send",
|
|
7167
|
+
from: {
|
|
7168
|
+
chain: parts.chain,
|
|
7169
|
+
self: true,
|
|
7170
|
+
...asset ? { asset } : {},
|
|
7171
|
+
...amount ? { amount } : {},
|
|
7172
|
+
...parts.signWith ? { address: parts.signWith } : {}
|
|
7173
|
+
},
|
|
7174
|
+
to: { chain: parts.chain, address: destination }
|
|
7175
|
+
};
|
|
7176
|
+
} else if (parts.operation === "create_account" && destination) {
|
|
7177
|
+
data = {
|
|
7178
|
+
kind: "create_account",
|
|
7179
|
+
from: { chain: parts.chain, self: true, ...parts.signWith ? { address: parts.signWith } : {} },
|
|
7180
|
+
to: { chain: parts.chain, address: destination, label: copy.newAccount }
|
|
7181
|
+
};
|
|
7182
|
+
} else {
|
|
7183
|
+
data = { kind: "other" };
|
|
7184
|
+
if (asset) rows.push({ label: copy.rows.asset, value: asset });
|
|
7185
|
+
if (amount) rows.push({ label: copy.rows.amount, value: amount });
|
|
7186
|
+
}
|
|
7187
|
+
}
|
|
7188
|
+
if (parts.summary) rows.unshift({ label: copy.rows.description, value: parts.summary });
|
|
7189
|
+
rows.push({
|
|
7190
|
+
label: copy.rows.network,
|
|
7191
|
+
value: [copy.chains[data.from?.chain ?? parts.chain], parts.network].filter(Boolean).join(" ")
|
|
7192
|
+
});
|
|
7193
|
+
const fromRow = partyRow(copy.rows.from, data.from ?? (parts.signWith ? { address: parts.signWith } : void 0), copy);
|
|
7194
|
+
if (fromRow) rows.push(fromRow);
|
|
7195
|
+
const toRow = partyRow(copy.rows.to, data.to, copy);
|
|
7196
|
+
if (toRow) rows.push(toRow);
|
|
7197
|
+
if (data.kind !== "other" && data.from?.amount) rows.push({ label: copy.rows.amount, value: withAsset(data.from) });
|
|
7198
|
+
if (data.kind === "swap" && data.to?.amount)
|
|
7199
|
+
rows.push({ label: data.to.minimum ? copy.rows.receiveMin : copy.rows.amount, value: withAsset(data.to) });
|
|
7200
|
+
if (via) rows.push({ label: copy.rows.via, value: displayName(via) });
|
|
7201
|
+
const contract = asString(details.contractId);
|
|
7202
|
+
if (contract) rows.push({ label: copy.rows.contract, value: contract, copyValue: contract, mono: true });
|
|
7203
|
+
const method = asString(details.method);
|
|
7204
|
+
if (method) rows.push({ label: copy.rows.method, value: method, mono: true });
|
|
7205
|
+
if (parts.appPaysFee) rows.push({ label: copy.rows.fee, value: copy.rows.feeCovered });
|
|
7206
|
+
rows.push(...parts.extraRows ?? []);
|
|
7207
|
+
return {
|
|
7208
|
+
...data,
|
|
7209
|
+
title: titleOf(data, parts.fallbackTitle, copy),
|
|
7210
|
+
...parts.appPaysFee ? { fee: { sponsored: true } } : {},
|
|
7211
|
+
rows,
|
|
7212
|
+
...parts.raw ? { raw: parts.raw } : {},
|
|
7213
|
+
...parts.hash ? { hash: parts.hash } : {}
|
|
7214
|
+
};
|
|
7215
|
+
}
|
|
7216
|
+
function splitAmount(text) {
|
|
7217
|
+
if (!text) return void 0;
|
|
7218
|
+
const [amount, ...rest] = text.trim().split(/\s+/);
|
|
7219
|
+
if (!amount) return void 0;
|
|
7220
|
+
return rest.length ? { amount, asset: rest.join(" ") } : { amount };
|
|
7221
|
+
}
|
|
7222
|
+
function buildLabel(label, copy) {
|
|
7223
|
+
const known = {
|
|
7224
|
+
From: copy.rows.from,
|
|
7225
|
+
To: copy.rows.to,
|
|
7226
|
+
Amount: copy.rows.amount,
|
|
7227
|
+
Asset: copy.rows.asset,
|
|
7228
|
+
Contract: copy.rows.contract,
|
|
7229
|
+
Method: copy.rows.method,
|
|
7230
|
+
"Receive min": copy.rows.receiveMin
|
|
7231
|
+
};
|
|
7232
|
+
return known[label] ?? label;
|
|
7233
|
+
}
|
|
7234
|
+
function reviewFromBuild(build, copy, fallbackTitle, hash, sponsored) {
|
|
7235
|
+
const lines = /* @__PURE__ */ new Map();
|
|
7236
|
+
for (const line of build.summary.lines) {
|
|
7237
|
+
const at = line.indexOf(": ");
|
|
7238
|
+
if (at > 0) lines.set(line.slice(0, at), line.slice(at + 2));
|
|
7239
|
+
}
|
|
7240
|
+
const chain = asChain(build.chain) ?? "STELLAR";
|
|
7241
|
+
let data = { kind: "other" };
|
|
7242
|
+
const from = lines.get("From") ?? lines.get("Funder");
|
|
7243
|
+
if (lines.has("Send") && lines.has("Receive min")) {
|
|
7244
|
+
const sent = splitAmount(lines.get("Send"));
|
|
7245
|
+
const received = splitAmount(lines.get("Receive min"));
|
|
7246
|
+
data = {
|
|
7247
|
+
kind: "swap",
|
|
7248
|
+
from: { chain, self: true, ...sent, ...from ? { address: from } : {} },
|
|
7249
|
+
to: { chain, minimum: true, ...received, ...lines.get("To") ? { address: lines.get("To") } : {} }
|
|
7250
|
+
};
|
|
7251
|
+
} else if (lines.has("To") && lines.has("Amount")) {
|
|
7252
|
+
data = {
|
|
7253
|
+
kind: "send",
|
|
7254
|
+
from: { chain, self: true, ...splitAmount(lines.get("Amount")), ...from ? { address: from } : {} },
|
|
7255
|
+
to: { chain, address: lines.get("To") }
|
|
7256
|
+
};
|
|
7257
|
+
} else if (lines.has("New account")) {
|
|
7258
|
+
data = {
|
|
7259
|
+
kind: "create_account",
|
|
7260
|
+
from: { chain, self: true, ...splitAmount(lines.get("Starting balance")), ...from ? { address: from } : {} },
|
|
7261
|
+
to: { chain, address: lines.get("New account"), label: copy.newAccount }
|
|
7262
|
+
};
|
|
7263
|
+
}
|
|
7264
|
+
const rows = [
|
|
7265
|
+
{ label: copy.rows.network, value: `${copy.chains[chain]} ${build.summary.network}` },
|
|
7266
|
+
...build.summary.lines.map((line) => {
|
|
7267
|
+
const at = line.indexOf(": ");
|
|
7268
|
+
if (at <= 0) return { label: "", value: line };
|
|
7269
|
+
const value = line.slice(at + 2);
|
|
7270
|
+
const label = line.slice(0, at);
|
|
7271
|
+
const isAddress = /^[GCM][A-Z2-7]{55,68}$/.test(value) || /^0x[0-9a-fA-F]{40}$/.test(value);
|
|
7272
|
+
return { label: buildLabel(label, copy), value, ...isAddress ? { copyValue: value, mono: true } : {} };
|
|
7273
|
+
}),
|
|
7274
|
+
{ label: copy.rows.fee, value: sponsored ? copy.rows.feeCovered : build.summary.fee }
|
|
7275
|
+
];
|
|
7276
|
+
return {
|
|
7277
|
+
...data,
|
|
7278
|
+
title: titleOf(data, build.summary.title || fallbackTitle, copy),
|
|
7279
|
+
rows,
|
|
7280
|
+
..."unsignedXdr" in build && build.unsignedXdr ? { raw: build.unsignedXdr } : {},
|
|
7281
|
+
...hash ? { hash } : {},
|
|
7282
|
+
...sponsored !== void 0 ? { fee: { sponsored } } : {}
|
|
7283
|
+
};
|
|
7284
|
+
}
|
|
7285
|
+
function ChainBadge({ chain, copy }) {
|
|
7286
|
+
if (!chain) return null;
|
|
7287
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-chain", src: CHAIN_LOGOS[chain], alt: copy.chains[chain], title: copy.chains[chain] });
|
|
7288
|
+
}
|
|
7289
|
+
function AssetLogo({ asset }) {
|
|
7290
|
+
const url = TOKEN_LOGOS[asset.toUpperCase()];
|
|
7291
|
+
const [failed, setFailed] = react.useState(false);
|
|
7292
|
+
if (url && !failed) return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-logo", src: url, alt: asset, onError: () => setFailed(true) });
|
|
7293
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-logo pollar-txr-logo-initial", "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
|
|
7294
|
+
}
|
|
7295
|
+
function AccountGlyph() {
|
|
7296
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
|
|
7297
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "10", cy: "7", r: "3.25", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
7298
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7299
|
+
"path",
|
|
7300
|
+
{
|
|
7301
|
+
d: "M3.75 16.5c.9-3 3.3-4.5 6.25-4.5s5.35 1.5 6.25 4.5",
|
|
7302
|
+
stroke: "currentColor",
|
|
7303
|
+
strokeWidth: "1.6",
|
|
7304
|
+
strokeLinecap: "round"
|
|
7305
|
+
}
|
|
7306
|
+
)
|
|
7307
|
+
] }) });
|
|
7308
|
+
}
|
|
7309
|
+
function ContractGlyph() {
|
|
7310
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
|
|
7311
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4.5", y: "9", width: "11", height: "7.5", rx: "1.75", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
7312
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 9V6.75a3 3 0 0 1 6 0V9", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
7313
|
+
] }) });
|
|
7314
|
+
}
|
|
7315
|
+
function Node2({
|
|
7316
|
+
party,
|
|
7317
|
+
showAmount,
|
|
7318
|
+
glyph,
|
|
7319
|
+
copy
|
|
7320
|
+
}) {
|
|
7321
|
+
const caption = party.self ? copy.yourWallet : party.label ?? (party.address ? shortAddress(party.address) : party.chain ? copy.chains[party.chain] : "");
|
|
7322
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-node", children: [
|
|
7323
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-avatar", children: [
|
|
7324
|
+
glyph === "asset" && party.asset ? /* @__PURE__ */ jsxRuntime.jsx(AssetLogo, { asset: party.asset }, party.asset) : glyph === "contract" ? /* @__PURE__ */ jsxRuntime.jsx(ContractGlyph, {}) : /* @__PURE__ */ jsxRuntime.jsx(AccountGlyph, {}),
|
|
7325
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChainBadge, { chain: party.chain, copy })
|
|
7326
|
+
] }),
|
|
7327
|
+
showAmount && party.amount && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-amount", children: [
|
|
7328
|
+
party.minimum && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-min", children: [
|
|
7329
|
+
copy.atLeast,
|
|
7330
|
+
" "
|
|
7331
|
+
] }),
|
|
7332
|
+
party.amount,
|
|
7333
|
+
" ",
|
|
7334
|
+
party.asset
|
|
7335
|
+
] }),
|
|
7336
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-txr-caption", title: party.address, children: caption })
|
|
7337
|
+
] });
|
|
7338
|
+
}
|
|
7339
|
+
function Arrow() {
|
|
7340
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-txr-arrow", "aria-hidden": true, children: [
|
|
7341
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "100%", height: "12", viewBox: "0 0 64 12", preserveAspectRatio: "none", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1 6h60", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeDasharray: "3 4" }) }),
|
|
7342
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { className: "pollar-txr-arrow-head", width: "10", height: "12", viewBox: "0 0 10 12", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 1.5 7.5 6 2 10.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
7343
|
+
] });
|
|
7344
|
+
}
|
|
7345
|
+
function FeeBadge({ sponsored, copy }) {
|
|
7346
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `pollar-txr-fee${sponsored ? " pollar-txr-fee-sponsored" : ""}`, children: [
|
|
7347
|
+
sponsored ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: [
|
|
7348
|
+
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "6", width: "12", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
7349
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M1.5 4.25h13V6h-13zM8 4.25V14", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }),
|
|
7350
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7351
|
+
"path",
|
|
7352
|
+
{
|
|
7353
|
+
d: "M8 4.25C6.5 4.25 5 3.5 5 2.4 5 1.2 7 1.2 8 4.25Zm0 0c1.5 0 3-.75 3-1.85 0-1.2-2-1.2-3 1.85Z",
|
|
7354
|
+
stroke: "currentColor",
|
|
7355
|
+
strokeWidth: "1.2",
|
|
7356
|
+
strokeLinejoin: "round"
|
|
7357
|
+
}
|
|
7358
|
+
)
|
|
7359
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M8.5 1.5 3.5 9H8l-.5 5.5 5-7.5H8l.5-5.5Z", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }) }),
|
|
7360
|
+
sponsored ? copy.feeSponsored : copy.feePaid
|
|
7361
|
+
] });
|
|
7362
|
+
}
|
|
7363
|
+
function TxFeeBadge({
|
|
7364
|
+
sponsored,
|
|
7365
|
+
language: languageProp
|
|
7366
|
+
}) {
|
|
7367
|
+
const language = useInheritedLanguage(languageProp);
|
|
7368
|
+
return /* @__PURE__ */ jsxRuntime.jsx(FeeBadge, { sponsored, copy: TX_REVIEW_COPY[language] });
|
|
7369
|
+
}
|
|
7370
|
+
function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
|
|
7371
|
+
const language = useInheritedLanguage(languageProp);
|
|
7372
|
+
const copy = TX_REVIEW_COPY[language];
|
|
7373
|
+
const [openState, setOpenState] = react.useState(false);
|
|
7374
|
+
const open = openProp ?? openState;
|
|
7375
|
+
const toggle = onToggle ?? (() => setOpenState((v) => !v));
|
|
7376
|
+
const { from, to, kind } = data;
|
|
7377
|
+
const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
|
|
7378
|
+
const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" ? "asset" : "account";
|
|
7379
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr", children: [
|
|
7380
|
+
from && to && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-flow", children: [
|
|
7381
|
+
/* @__PURE__ */ jsxRuntime.jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
|
|
7382
|
+
/* @__PURE__ */ jsxRuntime.jsx(Arrow, {}),
|
|
7383
|
+
/* @__PURE__ */ jsxRuntime.jsx(Node2, { party: to, showAmount: kind !== "approve" && toShowsAmount, glyph: toGlyph, copy })
|
|
7384
|
+
] }),
|
|
7385
|
+
kind === "approve" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-txr-note", children: copy.approveNote }),
|
|
7386
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-bar", children: [
|
|
7387
|
+
data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(FeeBadge, { sponsored: data.fee.sponsored, copy }) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
|
|
7388
|
+
/* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
|
|
7389
|
+
open ? copy.hideDetails : copy.showDetails,
|
|
7390
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7391
|
+
"svg",
|
|
7392
|
+
{
|
|
7393
|
+
width: "10",
|
|
7394
|
+
height: "10",
|
|
7395
|
+
viewBox: "0 0 12 12",
|
|
7396
|
+
fill: "none",
|
|
7397
|
+
"aria-hidden": true,
|
|
7398
|
+
style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 150ms" },
|
|
7399
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
7400
|
+
}
|
|
7401
|
+
)
|
|
7402
|
+
] })
|
|
7403
|
+
] }),
|
|
7404
|
+
open && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-details", children: [
|
|
7405
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pollar-txr-rows", children: [
|
|
7406
|
+
data.rows.map((row, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-row", children: [
|
|
7407
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: row.label }),
|
|
7408
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dd", { className: row.mono ? "pollar-txr-mono" : void 0, children: [
|
|
7409
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: row.value }),
|
|
7410
|
+
row.copyValue && /* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: row.copyValue, className: "pollar-copy-btn-sm", language })
|
|
7411
|
+
] })
|
|
7412
|
+
] }, `${row.label}-${i}`)),
|
|
7413
|
+
data.hash && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-row", children: [
|
|
7414
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: copy.rows.txHash }),
|
|
7415
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dd", { className: "pollar-txr-mono", children: [
|
|
7416
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: data.hash.value }),
|
|
7417
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: data.hash.value, className: "pollar-copy-btn-sm", language })
|
|
7418
|
+
] })
|
|
7419
|
+
] })
|
|
7420
|
+
] }),
|
|
7421
|
+
data.hash?.explorerUrl && /* @__PURE__ */ jsxRuntime.jsx("a", { className: "pollar-txr-link", href: data.hash.explorerUrl, target: "_blank", rel: "noopener noreferrer", children: copy.viewOnExplorer }),
|
|
7422
|
+
data.raw && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-raw", children: [
|
|
7423
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-raw-head", children: [
|
|
7424
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: copy.rows.rawTx }),
|
|
7425
|
+
/* @__PURE__ */ jsxRuntime.jsx(CopyButton, { value: data.raw, className: "pollar-copy-btn-sm", language })
|
|
7426
|
+
] }),
|
|
7427
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", { children: data.raw })
|
|
7428
|
+
] })
|
|
7429
|
+
] })
|
|
7430
|
+
] });
|
|
7431
|
+
}
|
|
7432
|
+
|
|
6946
7433
|
// src/components/transaction-modal/transaction-copy.ts
|
|
6947
7434
|
var TRANSACTION_COPY = {
|
|
6948
7435
|
en: {
|
|
6949
7436
|
title: "Transaction",
|
|
6950
7437
|
close: "Close",
|
|
6951
|
-
details: "Details",
|
|
6952
|
-
network: "Network",
|
|
6953
|
-
fee: "Fee",
|
|
6954
|
-
rawXdr: "Raw transaction (XDR)",
|
|
6955
7438
|
errorDetails: "Error details",
|
|
6956
7439
|
signAndSend: "Sign & Send",
|
|
6957
7440
|
waitingFreighter: "Waiting for Freighter\u2026",
|
|
6958
7441
|
waitingAlbedo: "Waiting for Albedo\u2026",
|
|
6959
7442
|
signingAndSending: "Signing and sending\u2026",
|
|
6960
7443
|
tryAgain: "Try again",
|
|
6961
|
-
txHash: "Transaction hash",
|
|
6962
|
-
copied: "Copied!",
|
|
6963
|
-
copyHash: "Copy hash",
|
|
6964
|
-
viewOnExplorer: "View on Explorer",
|
|
6965
7444
|
done: "Done",
|
|
6966
7445
|
status: {
|
|
6967
7446
|
idle: "",
|
|
@@ -6981,20 +7460,12 @@ var TRANSACTION_COPY = {
|
|
|
6981
7460
|
es: {
|
|
6982
7461
|
title: "Transacci\xF3n",
|
|
6983
7462
|
close: "Cerrar",
|
|
6984
|
-
details: "Detalles",
|
|
6985
|
-
network: "Red",
|
|
6986
|
-
fee: "Comisi\xF3n",
|
|
6987
|
-
rawXdr: "Transacci\xF3n en bruto (XDR)",
|
|
6988
7463
|
errorDetails: "Detalles del error",
|
|
6989
7464
|
signAndSend: "Firmar y enviar",
|
|
6990
7465
|
waitingFreighter: "Esperando a Freighter\u2026",
|
|
6991
7466
|
waitingAlbedo: "Esperando a Albedo\u2026",
|
|
6992
7467
|
signingAndSending: "Firmando y enviando\u2026",
|
|
6993
7468
|
tryAgain: "Intenta de nuevo",
|
|
6994
|
-
txHash: "Hash de la transacci\xF3n",
|
|
6995
|
-
copied: "\xA1Copiado!",
|
|
6996
|
-
copyHash: "Copiar hash",
|
|
6997
|
-
viewOnExplorer: "Ver en el explorador",
|
|
6998
7469
|
done: "Listo",
|
|
6999
7470
|
status: {
|
|
7000
7471
|
idle: "",
|
|
@@ -7014,20 +7485,12 @@ var TRANSACTION_COPY = {
|
|
|
7014
7485
|
pt: {
|
|
7015
7486
|
title: "Transa\xE7\xE3o",
|
|
7016
7487
|
close: "Fechar",
|
|
7017
|
-
details: "Detalhes",
|
|
7018
|
-
network: "Rede",
|
|
7019
|
-
fee: "Taxa",
|
|
7020
|
-
rawXdr: "Transa\xE7\xE3o bruta (XDR)",
|
|
7021
7488
|
errorDetails: "Detalhes do erro",
|
|
7022
7489
|
signAndSend: "Assinar e enviar",
|
|
7023
7490
|
waitingFreighter: "Aguardando o Freighter\u2026",
|
|
7024
7491
|
waitingAlbedo: "Aguardando o Albedo\u2026",
|
|
7025
7492
|
signingAndSending: "Assinando e enviando\u2026",
|
|
7026
7493
|
tryAgain: "Tentar novamente",
|
|
7027
|
-
txHash: "Hash da transa\xE7\xE3o",
|
|
7028
|
-
copied: "Copiado!",
|
|
7029
|
-
copyHash: "Copiar hash",
|
|
7030
|
-
viewOnExplorer: "Ver no explorador",
|
|
7031
7494
|
done: "Concluir",
|
|
7032
7495
|
status: {
|
|
7033
7496
|
idle: "",
|
|
@@ -7051,7 +7514,8 @@ var IN_FLIGHT_STEPS = /* @__PURE__ */ new Set([
|
|
|
7051
7514
|
"submitting",
|
|
7052
7515
|
"submitted",
|
|
7053
7516
|
"signing-submitting",
|
|
7054
|
-
"building-signing-submitting"
|
|
7517
|
+
"building-signing-submitting",
|
|
7518
|
+
"awaiting_cosign"
|
|
7055
7519
|
]);
|
|
7056
7520
|
var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
|
|
7057
7521
|
"built",
|
|
@@ -7060,17 +7524,16 @@ var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
|
|
|
7060
7524
|
"submitting",
|
|
7061
7525
|
"submitted",
|
|
7062
7526
|
"signing-submitting",
|
|
7527
|
+
"awaiting_cosign",
|
|
7063
7528
|
"success"
|
|
7064
7529
|
]);
|
|
7065
7530
|
function TxStatusView({
|
|
7066
7531
|
transaction,
|
|
7067
7532
|
showXdr,
|
|
7068
|
-
copied,
|
|
7069
7533
|
explorerUrl,
|
|
7070
7534
|
walletType,
|
|
7071
7535
|
onSignAndSend,
|
|
7072
7536
|
onToggleXdr,
|
|
7073
|
-
onCopyHash,
|
|
7074
7537
|
onRetry,
|
|
7075
7538
|
onDone,
|
|
7076
7539
|
language: languageProp
|
|
@@ -7084,7 +7547,11 @@ function TxStatusView({
|
|
|
7084
7547
|
const isInFlight = IN_FLIGHT_STEPS.has(transaction.step);
|
|
7085
7548
|
const isSuccess = transaction.step === "success";
|
|
7086
7549
|
const isError = transaction.step === "error";
|
|
7087
|
-
const showDetails =
|
|
7550
|
+
const showDetails = SHOW_DETAILS_STEPS.has(transaction.step);
|
|
7551
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
7552
|
+
const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
|
|
7553
|
+
const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
|
|
7554
|
+
const review = buildData ? reviewFromBuild(buildData, reviewCopy, copy.title, hashInfo, sponsored) : hashInfo ? { title: copy.title, kind: "other", rows: [], hash: hashInfo, ...sponsored !== void 0 && { fee: { sponsored } } } : null;
|
|
7088
7555
|
const walletImg = walletType === core.WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === core.WalletType.ALBEDO ? LOGO_ALBEDO : null;
|
|
7089
7556
|
const walletAlt = walletType === core.WalletType.FREIGHTER ? "Freighter" : walletType === core.WalletType.ALBEDO ? "Albedo" : "Pollar";
|
|
7090
7557
|
const statusBanner = /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -7095,41 +7562,12 @@ function TxStatusView({
|
|
|
7095
7562
|
}
|
|
7096
7563
|
);
|
|
7097
7564
|
const showSpinner = isInFlight || isSuccess || isError;
|
|
7565
|
+
const reviewBlock = showDetails && review && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-review", children: [
|
|
7566
|
+
buildData && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-review-title", children: review.title }),
|
|
7567
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, open: showXdr, onToggle: onToggleXdr, language })
|
|
7568
|
+
] });
|
|
7098
7569
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7099
|
-
|
|
7100
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-summary", children: [
|
|
7101
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-summary-title", children: copy.details }),
|
|
7102
|
-
/* @__PURE__ */ jsxRuntime.jsx("ul", { className: "pollar-tx-summary-lines", children: buildData.summary.lines.map((line, i) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: "pollar-tx-summary-line", children: line }, i)) })
|
|
7103
|
-
] }),
|
|
7104
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta", children: [
|
|
7105
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
|
|
7106
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: copy.network }),
|
|
7107
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.network })
|
|
7108
|
-
] }),
|
|
7109
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-meta-item", children: [
|
|
7110
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-label", children: copy.fee }),
|
|
7111
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.fee })
|
|
7112
|
-
] })
|
|
7113
|
-
] }),
|
|
7114
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-xdr", children: [
|
|
7115
|
-
/* @__PURE__ */ jsxRuntime.jsxs("button", { className: "pollar-tx-xdr-toggle", onClick: onToggleXdr, children: [
|
|
7116
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7117
|
-
"svg",
|
|
7118
|
-
{
|
|
7119
|
-
width: "12",
|
|
7120
|
-
height: "12",
|
|
7121
|
-
viewBox: "0 0 12 12",
|
|
7122
|
-
fill: "none",
|
|
7123
|
-
"aria-hidden": true,
|
|
7124
|
-
style: { transform: showXdr ? "rotate(90deg)" : "rotate(0deg)", transition: "transform 150ms" },
|
|
7125
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M4 2l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
7126
|
-
}
|
|
7127
|
-
),
|
|
7128
|
-
copy.rawXdr
|
|
7129
|
-
] }),
|
|
7130
|
-
showXdr && /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-xdr-content", children: buildData.unsignedXdr })
|
|
7131
|
-
] })
|
|
7132
|
-
] }),
|
|
7570
|
+
!isSuccess && reviewBlock,
|
|
7133
7571
|
isError && errorDetails && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-error-details", children: [
|
|
7134
7572
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-error-details-label", children: copy.errorDetails }),
|
|
7135
7573
|
/* @__PURE__ */ jsxRuntime.jsx("pre", { className: "pollar-tx-error-details-content", children: errorDetails })
|
|
@@ -7171,69 +7609,10 @@ function TxStatusView({
|
|
|
7171
7609
|
] }) })
|
|
7172
7610
|
] }),
|
|
7173
7611
|
statusBanner,
|
|
7174
|
-
isInFlight && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-spinner-label", children: walletType === core.WalletType.FREIGHTER ? copy.waitingFreighter : walletType === core.WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
|
|
7612
|
+
isInFlight && transaction.step !== "awaiting_cosign" && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-spinner-label", children: walletType === core.WalletType.FREIGHTER ? copy.waitingFreighter : walletType === core.WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
|
|
7175
7613
|
isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain })
|
|
7176
7614
|
] }),
|
|
7177
|
-
isSuccess &&
|
|
7178
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-label", children: copy.txHash }),
|
|
7179
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-tx-result-hash", children: hash }),
|
|
7180
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-result-actions", children: [
|
|
7181
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-tx-result-btn", onClick: onCopyHash, children: copied ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7182
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
7183
|
-
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
7184
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7185
|
-
"path",
|
|
7186
|
-
{
|
|
7187
|
-
d: "M3.5 7l2.5 2.5 4.5-5",
|
|
7188
|
-
stroke: "white",
|
|
7189
|
-
strokeWidth: "1.5",
|
|
7190
|
-
strokeLinecap: "round",
|
|
7191
|
-
strokeLinejoin: "round"
|
|
7192
|
-
}
|
|
7193
|
-
)
|
|
7194
|
-
] }),
|
|
7195
|
-
copy.copied
|
|
7196
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
7197
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
7198
|
-
/* @__PURE__ */ jsxRuntime.jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
7199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7200
|
-
"path",
|
|
7201
|
-
{
|
|
7202
|
-
d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
|
|
7203
|
-
stroke: "currentColor",
|
|
7204
|
-
strokeWidth: "1.5",
|
|
7205
|
-
strokeLinecap: "round"
|
|
7206
|
-
}
|
|
7207
|
-
)
|
|
7208
|
-
] }),
|
|
7209
|
-
copy.copyHash
|
|
7210
|
-
] }) }),
|
|
7211
|
-
explorerUrl && /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "pollar-tx-result-btn", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
7212
|
-
/* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
7213
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7214
|
-
"path",
|
|
7215
|
-
{
|
|
7216
|
-
d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8",
|
|
7217
|
-
stroke: "currentColor",
|
|
7218
|
-
strokeWidth: "1.5",
|
|
7219
|
-
strokeLinecap: "round"
|
|
7220
|
-
}
|
|
7221
|
-
),
|
|
7222
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
7223
|
-
"path",
|
|
7224
|
-
{
|
|
7225
|
-
d: "M8 1h4m0 0v4m0-4L6 7",
|
|
7226
|
-
stroke: "currentColor",
|
|
7227
|
-
strokeWidth: "1.5",
|
|
7228
|
-
strokeLinecap: "round",
|
|
7229
|
-
strokeLinejoin: "round"
|
|
7230
|
-
}
|
|
7231
|
-
)
|
|
7232
|
-
] }),
|
|
7233
|
-
copy.viewOnExplorer
|
|
7234
|
-
] })
|
|
7235
|
-
] })
|
|
7236
|
-
] }),
|
|
7615
|
+
isSuccess && reviewBlock,
|
|
7237
7616
|
isSuccess && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done }),
|
|
7238
7617
|
!showSpinner && statusBanner
|
|
7239
7618
|
] });
|
|
@@ -8462,7 +8841,7 @@ function toBaseUnits2(amount, decimals) {
|
|
|
8462
8841
|
const units = BigInt(`${whole}${fraction.padEnd(decimals, "0")}`);
|
|
8463
8842
|
return units > 0n ? units.toString() : null;
|
|
8464
8843
|
}
|
|
8465
|
-
function
|
|
8844
|
+
function fromBaseUnits3(units, decimals) {
|
|
8466
8845
|
if (decimals === 0) return units;
|
|
8467
8846
|
const padded = units.padStart(decimals + 1, "0");
|
|
8468
8847
|
const fraction = padded.slice(-decimals).replace(/0+$/, "");
|
|
@@ -8654,8 +9033,8 @@ function SwapModal({ onClose }) {
|
|
|
8654
9033
|
const solanaQuote = solanaQuotes[0] ?? null;
|
|
8655
9034
|
const quoteView = chain === "SOLANA" ? solanaQuote && selectedBuy?.decimals !== void 0 ? {
|
|
8656
9035
|
provider: solanaQuote.provider,
|
|
8657
|
-
amountOut:
|
|
8658
|
-
minReceived:
|
|
9036
|
+
amountOut: fromBaseUnits3(solanaQuote.outAmount, selectedBuy.decimals),
|
|
9037
|
+
minReceived: fromBaseUnits3(solanaQuote.minOut, selectedBuy.decimals),
|
|
8659
9038
|
priceImpactPct: solanaQuote.priceImpactPct
|
|
8660
9039
|
} : null : quote;
|
|
8661
9040
|
react.useEffect(() => {
|
|
@@ -9382,6 +9761,16 @@ var CARD_COPY = {
|
|
|
9382
9761
|
CREDITED: { title: "Credited to your card" },
|
|
9383
9762
|
FAILED: { title: "Failed" }
|
|
9384
9763
|
},
|
|
9764
|
+
fundingSolana: {
|
|
9765
|
+
CREATED: {
|
|
9766
|
+
title: "Confirming your payment",
|
|
9767
|
+
hint: "Your USDC payment is being confirmed on Solana. This takes a few seconds."
|
|
9768
|
+
},
|
|
9769
|
+
SENT: {
|
|
9770
|
+
title: "Arrived, crediting your card",
|
|
9771
|
+
hint: "The USDC reached the card provider, which is adding it to your card. This can take a few minutes."
|
|
9772
|
+
}
|
|
9773
|
+
},
|
|
9385
9774
|
incomeRanges: {
|
|
9386
9775
|
"0-1000": "Up to 1,000 USD",
|
|
9387
9776
|
"1000-5000": "1,000 to 5,000 USD",
|
|
@@ -9530,6 +9919,16 @@ var CARD_COPY = {
|
|
|
9530
9919
|
CREDITED: { title: "Acreditado en tu tarjeta" },
|
|
9531
9920
|
FAILED: { title: "Fall\xF3" }
|
|
9532
9921
|
},
|
|
9922
|
+
fundingSolana: {
|
|
9923
|
+
CREATED: {
|
|
9924
|
+
title: "Confirmando tu pago",
|
|
9925
|
+
hint: "Tu pago en USDC se est\xE1 confirmando en Solana. Esto toma unos segundos."
|
|
9926
|
+
},
|
|
9927
|
+
SENT: {
|
|
9928
|
+
title: "Lleg\xF3, acreditando tu tarjeta",
|
|
9929
|
+
hint: "Los USDC llegaron al proveedor de la tarjeta, que los est\xE1 sumando a tu tarjeta. Esto puede tardar unos minutos."
|
|
9930
|
+
}
|
|
9931
|
+
},
|
|
9533
9932
|
incomeRanges: {
|
|
9534
9933
|
"0-1000": "Hasta 1,000 USD",
|
|
9535
9934
|
"1000-5000": "De 1,000 a 5,000 USD",
|
|
@@ -9678,6 +10077,16 @@ var CARD_COPY = {
|
|
|
9678
10077
|
CREDITED: { title: "Creditado no seu cart\xE3o" },
|
|
9679
10078
|
FAILED: { title: "Falhou" }
|
|
9680
10079
|
},
|
|
10080
|
+
fundingSolana: {
|
|
10081
|
+
CREATED: {
|
|
10082
|
+
title: "Confirmando seu pagamento",
|
|
10083
|
+
hint: "Seu pagamento em USDC est\xE1 sendo confirmado na Solana. Isso leva alguns segundos."
|
|
10084
|
+
},
|
|
10085
|
+
SENT: {
|
|
10086
|
+
title: "Chegou, creditando seu cart\xE3o",
|
|
10087
|
+
hint: "Os USDC chegaram ao provedor do cart\xE3o, que est\xE1 adicionando ao seu cart\xE3o. Isso pode levar alguns minutos."
|
|
10088
|
+
}
|
|
10089
|
+
},
|
|
9681
10090
|
incomeRanges: {
|
|
9682
10091
|
"0-1000": "At\xE9 1.000 USD",
|
|
9683
10092
|
"1000-5000": "De 1.000 a 5.000 USD",
|
|
@@ -9848,9 +10257,13 @@ var KYC_POLL_MS = 5e3;
|
|
|
9848
10257
|
var REVEAL_MS = 3e4;
|
|
9849
10258
|
var TX_LIMIT = 10;
|
|
9850
10259
|
var FUNDING_POLL_MS = 5e3;
|
|
9851
|
-
var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "BURNED", "ATTESTED", "MINTED"]);
|
|
9852
|
-
var
|
|
9853
|
-
|
|
10260
|
+
var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "SENT", "BURNED", "ATTESTED", "MINTED"]);
|
|
10261
|
+
var FUNDING_STEPS = {
|
|
10262
|
+
STELLAR: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
|
|
10263
|
+
SOLANA: ["CREATED", "SENT"]
|
|
10264
|
+
};
|
|
10265
|
+
var FUNDING_CHAINS = ["STELLAR", "SOLANA"];
|
|
10266
|
+
var isFundingChain = (chain) => FUNDING_CHAINS.includes(chain);
|
|
9854
10267
|
var INCOME_RANGES = ["0-1000", "1000-5000", "5000-10000", "10000+"];
|
|
9855
10268
|
var KYC_PENDING = /* @__PURE__ */ new Set(["PENDING", "NEEDS_ACTION", "IN_REVIEW"]);
|
|
9856
10269
|
var KYC_FINAL = /* @__PURE__ */ new Set(["DENIED", "LOCKED", "CANCELED"]);
|
|
@@ -9912,6 +10325,7 @@ function CardModal({ onClose }) {
|
|
|
9912
10325
|
const [deposit, setDeposit] = react.useState(null);
|
|
9913
10326
|
const [fundings, setFundings] = react.useState(null);
|
|
9914
10327
|
const [fundAmount, setFundAmount] = react.useState("");
|
|
10328
|
+
const [fundChain, setFundChain] = react.useState(null);
|
|
9915
10329
|
const [showManual, setShowManual] = react.useState(false);
|
|
9916
10330
|
const [occupations, setOccupations] = react.useState([]);
|
|
9917
10331
|
const [kyc, setKyc] = react.useState(emptyKyc);
|
|
@@ -9924,7 +10338,9 @@ function CardModal({ onClose }) {
|
|
|
9924
10338
|
const revealTimer = react.useRef(null);
|
|
9925
10339
|
const provider = providers?.[0] ?? null;
|
|
9926
10340
|
const fundingAsset = provider?.fundingAssets[0] ?? "USDC";
|
|
9927
|
-
const
|
|
10341
|
+
const fundChains = useChains().chains.filter(isFundingChain);
|
|
10342
|
+
const selectedFundChain = fundChain ?? fundChains[0] ?? "STELLAR";
|
|
10343
|
+
const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: selectedFundChain, code: fundingAsset } : null);
|
|
9928
10344
|
const card = cards?.[0] ?? null;
|
|
9929
10345
|
const expiry = card?.expMonth && card.expYear ? `${card.expMonth}/${card.expYear.slice(-2)}` : null;
|
|
9930
10346
|
const loadHolder = react.useCallback(async () => {
|
|
@@ -10090,7 +10506,7 @@ function CardModal({ onClose }) {
|
|
|
10090
10506
|
const fund = () => run(
|
|
10091
10507
|
"fund-send",
|
|
10092
10508
|
async () => {
|
|
10093
|
-
const outcome = await getClient().fundCard({ amount: fundAmount.trim() });
|
|
10509
|
+
const outcome = await getClient().fundCard({ amount: fundAmount.trim(), chain: selectedFundChain });
|
|
10094
10510
|
if (outcome.status === "cancelled") {
|
|
10095
10511
|
setError(copy.notSigned);
|
|
10096
10512
|
return;
|
|
@@ -10465,6 +10881,16 @@ function CardModal({ onClose }) {
|
|
|
10465
10881
|
] }),
|
|
10466
10882
|
!loading && provider && card && panel === "fund" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10467
10883
|
/* @__PURE__ */ jsxRuntime.jsx("p", { children: copy.fundIntro(provider.fundingAssets.join(` ${copy.or} `) || "USDC") }),
|
|
10884
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10885
|
+
ChainSelect,
|
|
10886
|
+
{
|
|
10887
|
+
value: selectedFundChain,
|
|
10888
|
+
options: fundChains,
|
|
10889
|
+
onChange: (chain) => setFundChain(chain),
|
|
10890
|
+
disabled: busy !== null,
|
|
10891
|
+
language
|
|
10892
|
+
}
|
|
10893
|
+
),
|
|
10468
10894
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10469
10895
|
AmountField,
|
|
10470
10896
|
{
|
|
@@ -10491,8 +10917,9 @@ function CardModal({ onClose }) {
|
|
|
10491
10917
|
fundings && fundings.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10492
10918
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-card-section-title", children: copy.yourFundings }),
|
|
10493
10919
|
fundings.map((f) => {
|
|
10494
|
-
const state = copy.funding[f.status];
|
|
10495
|
-
const
|
|
10920
|
+
const state = (f.chain === "SOLANA" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
|
|
10921
|
+
const steps = FUNDING_STEPS[isFundingChain(f.chain) ? f.chain : "STELLAR"];
|
|
10922
|
+
const step = steps.indexOf(f.status) + 1;
|
|
10496
10923
|
const inflight = FUNDING_INFLIGHT.has(f.status);
|
|
10497
10924
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-card-tx", "aria-busy": inflight, children: [
|
|
10498
10925
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
@@ -10500,8 +10927,8 @@ function CardModal({ onClose }) {
|
|
|
10500
10927
|
inflight && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
10501
10928
|
state?.title ?? f.status
|
|
10502
10929
|
] }),
|
|
10503
|
-
inflight && step && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
|
|
10504
|
-
copy.stepOf(step,
|
|
10930
|
+
inflight && step > 0 && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
|
|
10931
|
+
copy.stepOf(step, steps.length),
|
|
10505
10932
|
" \xB7 ",
|
|
10506
10933
|
state?.hint
|
|
10507
10934
|
] }),
|
|
@@ -10949,7 +11376,6 @@ var COSIGN_COPY = {
|
|
|
10949
11376
|
approving: "Approving...",
|
|
10950
11377
|
genericError: "Something went wrong. Please try again.",
|
|
10951
11378
|
transaction: "Transaction",
|
|
10952
|
-
rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
|
|
10953
11379
|
operations: {
|
|
10954
11380
|
payment: "Send",
|
|
10955
11381
|
path_payment_strict_send: "Swap",
|
|
@@ -10957,7 +11383,10 @@ var COSIGN_COPY = {
|
|
|
10957
11383
|
create_account: "Create account",
|
|
10958
11384
|
invoke_contract: "Contract call",
|
|
10959
11385
|
soroban_auth: "Authorize a contract call",
|
|
10960
|
-
manage_data: "Manage data"
|
|
11386
|
+
manage_data: "Manage data",
|
|
11387
|
+
transfer: "Send",
|
|
11388
|
+
ramp_payment: "Ramp payment",
|
|
11389
|
+
cctp_burn: "Move USDC"
|
|
10961
11390
|
}
|
|
10962
11391
|
},
|
|
10963
11392
|
es: {
|
|
@@ -10986,7 +11415,6 @@ var COSIGN_COPY = {
|
|
|
10986
11415
|
approving: "Aprobando...",
|
|
10987
11416
|
genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
|
|
10988
11417
|
transaction: "Transacci\xF3n",
|
|
10989
|
-
rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
|
|
10990
11418
|
operations: {
|
|
10991
11419
|
payment: "Enviar",
|
|
10992
11420
|
path_payment_strict_send: "Intercambiar",
|
|
@@ -10994,7 +11422,10 @@ var COSIGN_COPY = {
|
|
|
10994
11422
|
create_account: "Crear cuenta",
|
|
10995
11423
|
invoke_contract: "Llamada a contrato",
|
|
10996
11424
|
soroban_auth: "Autorizar una llamada a contrato",
|
|
10997
|
-
manage_data: "Gestionar datos"
|
|
11425
|
+
manage_data: "Gestionar datos",
|
|
11426
|
+
transfer: "Enviar",
|
|
11427
|
+
ramp_payment: "Pago de rampa",
|
|
11428
|
+
cctp_burn: "Mover USDC"
|
|
10998
11429
|
}
|
|
10999
11430
|
},
|
|
11000
11431
|
pt: {
|
|
@@ -11023,7 +11454,6 @@ var COSIGN_COPY = {
|
|
|
11023
11454
|
approving: "Aprovando...",
|
|
11024
11455
|
genericError: "Algo deu errado. Tente novamente.",
|
|
11025
11456
|
transaction: "Transa\xE7\xE3o",
|
|
11026
|
-
rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
|
|
11027
11457
|
operations: {
|
|
11028
11458
|
payment: "Enviar",
|
|
11029
11459
|
path_payment_strict_send: "Trocar",
|
|
@@ -11031,7 +11461,10 @@ var COSIGN_COPY = {
|
|
|
11031
11461
|
create_account: "Criar conta",
|
|
11032
11462
|
invoke_contract: "Chamada de contrato",
|
|
11033
11463
|
soroban_auth: "Autorizar uma chamada de contrato",
|
|
11034
|
-
manage_data: "Gerenciar dados"
|
|
11464
|
+
manage_data: "Gerenciar dados",
|
|
11465
|
+
transfer: "Enviar",
|
|
11466
|
+
ramp_payment: "Pagamento de rampa",
|
|
11467
|
+
cctp_burn: "Mover USDC"
|
|
11035
11468
|
}
|
|
11036
11469
|
}
|
|
11037
11470
|
};
|
|
@@ -11046,32 +11479,6 @@ function expiresIn(request, copy) {
|
|
|
11046
11479
|
const m = Math.floor(ms % 36e5 / 6e4);
|
|
11047
11480
|
return h > 0 ? `${h}h ${m}m` : `${m}m`;
|
|
11048
11481
|
}
|
|
11049
|
-
function readableAmount(details) {
|
|
11050
|
-
const { amount, decimals, symbol } = details;
|
|
11051
|
-
if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
|
|
11052
|
-
try {
|
|
11053
|
-
return { amount: core.fromBaseUnits(amount, decimals), symbol };
|
|
11054
|
-
} catch {
|
|
11055
|
-
return null;
|
|
11056
|
-
}
|
|
11057
|
-
}
|
|
11058
|
-
function detailRows(request, copy) {
|
|
11059
|
-
const details = request.details ?? {};
|
|
11060
|
-
const rows = [];
|
|
11061
|
-
const push = (label, value) => {
|
|
11062
|
-
if (value === void 0 || value === null || value === "") return;
|
|
11063
|
-
rows.push([
|
|
11064
|
-
label,
|
|
11065
|
-
typeof value === "string" && value.length > 24 && /^[GC][A-Z2-7]{55}$/.test(value) ? cropAddress(value) : String(value)
|
|
11066
|
-
]);
|
|
11067
|
-
};
|
|
11068
|
-
push(copy.rows.destination, details.destination);
|
|
11069
|
-
const readable = readableAmount(details);
|
|
11070
|
-
push(copy.rows.amount, readable ? `${readable.amount} ${readable.symbol}` : details.amount);
|
|
11071
|
-
push(copy.rows.asset, details.asset ?? details.assetCode ?? readable?.symbol);
|
|
11072
|
-
push(copy.rows.network, request.network);
|
|
11073
|
-
return rows;
|
|
11074
|
-
}
|
|
11075
11482
|
function CloseIcon2() {
|
|
11076
11483
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
11077
11484
|
}
|
|
@@ -11096,6 +11503,7 @@ function CosignModalTemplate({
|
|
|
11096
11503
|
closesIn = null,
|
|
11097
11504
|
nextStep = null,
|
|
11098
11505
|
language: languageProp,
|
|
11506
|
+
network,
|
|
11099
11507
|
onSelect,
|
|
11100
11508
|
onApprove,
|
|
11101
11509
|
onReject,
|
|
@@ -11108,6 +11516,22 @@ function CosignModalTemplate({
|
|
|
11108
11516
|
const canVote = !!current && verified && !busy && !approveBlocked;
|
|
11109
11517
|
const [verifiedOpenFor, setVerifiedOpenFor] = react.useState(null);
|
|
11110
11518
|
const verifiedOpen = !!current && verifiedOpenFor === current.id;
|
|
11519
|
+
const reviewOf = (request) => reviewFromRequest(
|
|
11520
|
+
{
|
|
11521
|
+
chain: request.network,
|
|
11522
|
+
network,
|
|
11523
|
+
operation: request.operation,
|
|
11524
|
+
summary: request.summary,
|
|
11525
|
+
details: request.details,
|
|
11526
|
+
signWith: request.account ?? request.signWith,
|
|
11527
|
+
raw: request.unsignedPayload,
|
|
11528
|
+
fallbackTitle: labelOf(request, copy),
|
|
11529
|
+
extraRows: [{ label: copy.expiresIn, value: expiresIn(request, copy) }],
|
|
11530
|
+
appPaysFee: request.appPaysFee
|
|
11531
|
+
},
|
|
11532
|
+
TX_REVIEW_COPY[language]
|
|
11533
|
+
);
|
|
11534
|
+
const review = current ? reviewOf(current) : null;
|
|
11111
11535
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11112
11536
|
"div",
|
|
11113
11537
|
{
|
|
@@ -11148,7 +11572,8 @@ function CosignModalTemplate({
|
|
|
11148
11572
|
className: "pollar-copy-btn-sm pollar-cosign-copy"
|
|
11149
11573
|
}
|
|
11150
11574
|
)
|
|
11151
|
-
] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned })
|
|
11575
|
+
] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned }),
|
|
11576
|
+
lastResolved.submit?.sponsored !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-fee", children: /* @__PURE__ */ jsxRuntime.jsx(TxFeeBadge, { sponsored: lastResolved.submit.sponsored, language }) })
|
|
11152
11577
|
] }) : /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: copy.nothingWaiting }),
|
|
11153
11578
|
nextStep && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "pollar-cosign-next", children: [
|
|
11154
11579
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
@@ -11164,14 +11589,14 @@ function CosignModalTemplate({
|
|
|
11164
11589
|
className: `pollar-cosign-item${current?.id === r.id ? " pollar-cosign-item-active" : ""}`,
|
|
11165
11590
|
onClick: () => onSelect(r),
|
|
11166
11591
|
children: [
|
|
11167
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
11592
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: reviewOf(r).title }),
|
|
11168
11593
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-cosign-muted", children: expiresIn(r, copy) })
|
|
11169
11594
|
]
|
|
11170
11595
|
}
|
|
11171
11596
|
) }, r.id)) }),
|
|
11172
|
-
current && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail"
|
|
11597
|
+
current && review && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `pollar-cosign-detail${pending.length > 1 ? " pollar-cosign-detail-grouped" : ""}`, children: [
|
|
11173
11598
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail-head", children: [
|
|
11174
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children:
|
|
11599
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
|
|
11175
11600
|
!verification && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-cosign-chip", children: [
|
|
11176
11601
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
11177
11602
|
copy.checking
|
|
@@ -11190,17 +11615,7 @@ function CosignModalTemplate({
|
|
|
11190
11615
|
}
|
|
11191
11616
|
)
|
|
11192
11617
|
] }),
|
|
11193
|
-
|
|
11194
|
-
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "pollar-cosign-rows", children: [
|
|
11195
|
-
detailRows(current, copy).map(([k, v]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
|
|
11196
|
-
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: k }),
|
|
11197
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { children: v })
|
|
11198
|
-
] }, k)),
|
|
11199
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-row", children: [
|
|
11200
|
-
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: copy.expiresIn }),
|
|
11201
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { children: expiresIn(current, copy) })
|
|
11202
|
-
] })
|
|
11203
|
-
] }),
|
|
11618
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, language }, current.id),
|
|
11204
11619
|
verification?.ok && verifiedOpen && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedAgainstTurnkey }),
|
|
11205
11620
|
verification && !verification.ok && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
|
|
11206
11621
|
copy.notVerified,
|
|
@@ -11346,6 +11761,7 @@ function CosignModal({ nextStep = null, onClose }) {
|
|
|
11346
11761
|
closesIn,
|
|
11347
11762
|
nextStep: awaitingNext ? nextStep : null,
|
|
11348
11763
|
language,
|
|
11764
|
+
network,
|
|
11349
11765
|
explorerUrl: lastResolved?.submit?.hash ? explorerTxUrl(lastResolved.network, lastResolved.submit.hash, network) : null,
|
|
11350
11766
|
onSelect: (r) => setSelectedId(r.id),
|
|
11351
11767
|
onApprove: (r) => void run("approving", r, approve),
|
|
@@ -12104,7 +12520,6 @@ var CONFIRM_COPY = {
|
|
|
12104
12520
|
confirm: "Confirm",
|
|
12105
12521
|
close: "Close",
|
|
12106
12522
|
transaction: "Transaction",
|
|
12107
|
-
rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
|
|
12108
12523
|
operations: {
|
|
12109
12524
|
payment: "Send",
|
|
12110
12525
|
path_payment_strict_send: "Swap",
|
|
@@ -12122,7 +12537,6 @@ var CONFIRM_COPY = {
|
|
|
12122
12537
|
confirm: "Confirmar",
|
|
12123
12538
|
close: "Cerrar",
|
|
12124
12539
|
transaction: "Transacci\xF3n",
|
|
12125
|
-
rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
|
|
12126
12540
|
operations: {
|
|
12127
12541
|
payment: "Enviar",
|
|
12128
12542
|
path_payment_strict_send: "Intercambiar",
|
|
@@ -12140,7 +12554,6 @@ var CONFIRM_COPY = {
|
|
|
12140
12554
|
confirm: "Confirmar",
|
|
12141
12555
|
close: "Fechar",
|
|
12142
12556
|
transaction: "Transa\xE7\xE3o",
|
|
12143
|
-
rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
|
|
12144
12557
|
operations: {
|
|
12145
12558
|
payment: "Enviar",
|
|
12146
12559
|
path_payment_strict_send: "Trocar",
|
|
@@ -12156,26 +12569,26 @@ function labelOf2(confirmation, copy) {
|
|
|
12156
12569
|
const op = confirmation.operation ?? "";
|
|
12157
12570
|
return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
|
|
12158
12571
|
}
|
|
12159
|
-
function detailRows2(confirmation, copy) {
|
|
12160
|
-
const details = confirmation.details ?? {};
|
|
12161
|
-
const rows = [];
|
|
12162
|
-
const push = (label, value) => {
|
|
12163
|
-
if (value === void 0 || value === null || value === "") return;
|
|
12164
|
-
const text = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
12165
|
-
rows.push([label, /^[GC][A-Z2-7]{55}$/.test(text) ? cropAddress(text) : text]);
|
|
12166
|
-
};
|
|
12167
|
-
push(copy.rows.destination, details.destination);
|
|
12168
|
-
push(copy.rows.amount, details.amount);
|
|
12169
|
-
push(copy.rows.asset, details.asset ?? details.assetCode ?? details.mint);
|
|
12170
|
-
push(copy.rows.network, confirmation.network);
|
|
12171
|
-
return rows;
|
|
12172
|
-
}
|
|
12173
12572
|
function CloseIcon4() {
|
|
12174
12573
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
12175
12574
|
}
|
|
12176
12575
|
function ConfirmModal({ confirmation }) {
|
|
12177
|
-
const { getClient, styles } = usePollar();
|
|
12178
|
-
const
|
|
12576
|
+
const { getClient, styles, network } = usePollar();
|
|
12577
|
+
const language = useModalLanguage();
|
|
12578
|
+
const copy = CONFIRM_COPY[language];
|
|
12579
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
12580
|
+
const raw = confirmation.unsignedXdr ?? confirmation.authEntryXdr;
|
|
12581
|
+
const review = confirmation.buildData ? reviewFromBuild(confirmation.buildData, reviewCopy, labelOf2(confirmation, copy)) : reviewFromRequest(
|
|
12582
|
+
{
|
|
12583
|
+
chain: confirmation.network,
|
|
12584
|
+
network,
|
|
12585
|
+
operation: confirmation.operation,
|
|
12586
|
+
details: confirmation.details,
|
|
12587
|
+
raw,
|
|
12588
|
+
fallbackTitle: labelOf2(confirmation, copy)
|
|
12589
|
+
},
|
|
12590
|
+
reviewCopy
|
|
12591
|
+
);
|
|
12179
12592
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
12180
12593
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
12181
12594
|
const rejectRef = react.useRef(confirmation.reject);
|
|
@@ -12208,15 +12621,12 @@ function ConfirmModal({ confirmation }) {
|
|
|
12208
12621
|
) })
|
|
12209
12622
|
] }),
|
|
12210
12623
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-detail", children: [
|
|
12211
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children:
|
|
12624
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
|
|
12212
12625
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-cosign-muted", children: copy.intro }),
|
|
12213
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
12214
|
-
/* @__PURE__ */ jsxRuntime.jsx("dt", { children: k }),
|
|
12215
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { children: v })
|
|
12216
|
-
] }, k)) }),
|
|
12626
|
+
/* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, language }),
|
|
12217
12627
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-cosign-actions", children: [
|
|
12218
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children:
|
|
12219
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children:
|
|
12628
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children: copy.cancel }),
|
|
12629
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children: copy.confirm })
|
|
12220
12630
|
] })
|
|
12221
12631
|
] }),
|
|
12222
12632
|
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|