@pollar/react 0.12.1-rc.2 → 0.12.1-rc.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/README.md +177 -160
- 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 +636 -210
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +636 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1219,6 +1219,19 @@ var LOGO_POLLAR_MARK_ON_LIGHT = "https://www.pollar.xyz/brandkit/pollar-mark-on-
|
|
|
1219
1219
|
var LOGO_POLLAR_MARK_ON_DARK = "https://www.pollar.xyz/brandkit/pollar-mark-on-dark.png";
|
|
1220
1220
|
var LOGO_FREIGHTER = "https://pollar.xyz/assets/logo_freighter.png";
|
|
1221
1221
|
var LOGO_ALBEDO = "https://pollar.xyz/assets/logo_albedo.svg";
|
|
1222
|
+
var CHAIN_LOGOS = {
|
|
1223
|
+
STELLAR: "https://www.pollar.xyz/chains/stellar.png",
|
|
1224
|
+
POLYGON: "https://www.pollar.xyz/chains/polygon.png",
|
|
1225
|
+
SOLANA: "https://www.pollar.xyz/chains/solana.png"
|
|
1226
|
+
};
|
|
1227
|
+
var TOKEN_LOGOS = {
|
|
1228
|
+
USDC: "https://www.pollar.xyz/tokens/usdc.png",
|
|
1229
|
+
USDT: "https://www.pollar.xyz/tokens/usdt.png",
|
|
1230
|
+
EURC: "https://www.pollar.xyz/tokens/eurc.png",
|
|
1231
|
+
XLM: "https://www.pollar.xyz/tokens/xlm.png",
|
|
1232
|
+
SOL: "https://www.pollar.xyz/tokens/sol.png",
|
|
1233
|
+
POL: "https://www.pollar.xyz/tokens/pol.png"
|
|
1234
|
+
};
|
|
1222
1235
|
var _modalLog = console;
|
|
1223
1236
|
function setModalErrorLogger(logger) {
|
|
1224
1237
|
_modalLog = logger;
|
|
@@ -1257,7 +1270,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1257
1270
|
/* @__PURE__ */ jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1258
1271
|
/* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
|
|
1259
1272
|
"v",
|
|
1260
|
-
"0.12.1-rc.
|
|
1273
|
+
"0.12.1-rc.6"
|
|
1261
1274
|
] })
|
|
1262
1275
|
] });
|
|
1263
1276
|
};
|
|
@@ -4235,6 +4248,7 @@ var RAMP_COPY = {
|
|
|
4235
4248
|
providerReviewing: "The provider is reviewing your details. This updates on its own.",
|
|
4236
4249
|
serverTrouble: "Having trouble reaching the server. Retrying\u2026",
|
|
4237
4250
|
startAnother: "Start another operation",
|
|
4251
|
+
newQuote: "Get a new quote",
|
|
4238
4252
|
keepsGoing: "This one keeps going; you can resume it later.",
|
|
4239
4253
|
somethingWrong: "Something went wrong.",
|
|
4240
4254
|
routeSteps: (count) => count === 1 ? "1 step" : `${count} steps`,
|
|
@@ -4357,6 +4371,7 @@ var RAMP_COPY = {
|
|
|
4357
4371
|
providerReviewing: "El proveedor est\xE1 revisando tus datos. Esto se actualiza solo.",
|
|
4358
4372
|
serverTrouble: "Hay problemas para conectar con el servidor. Reintentando\u2026",
|
|
4359
4373
|
startAnother: "Iniciar otra operaci\xF3n",
|
|
4374
|
+
newQuote: "Pedir nueva cotizaci\xF3n",
|
|
4360
4375
|
keepsGoing: "Esta sigue en curso; puedes retomarla m\xE1s tarde.",
|
|
4361
4376
|
somethingWrong: "Algo sali\xF3 mal.",
|
|
4362
4377
|
routeSteps: (count) => count === 1 ? "1 paso" : `${count} pasos`,
|
|
@@ -4479,6 +4494,7 @@ var RAMP_COPY = {
|
|
|
4479
4494
|
providerReviewing: "O provedor est\xE1 analisando seus dados. Isto se atualiza sozinho.",
|
|
4480
4495
|
serverTrouble: "Problemas para conectar ao servidor. Tentando de novo\u2026",
|
|
4481
4496
|
startAnother: "Iniciar outra opera\xE7\xE3o",
|
|
4497
|
+
newQuote: "Pedir nova cota\xE7\xE3o",
|
|
4482
4498
|
keepsGoing: "Esta continua em andamento; voc\xEA pode retom\xE1-la depois.",
|
|
4483
4499
|
somethingWrong: "Algo deu errado.",
|
|
4484
4500
|
routeSteps: (count) => count === 1 ? "1 etapa" : `${count} etapas`,
|
|
@@ -4791,6 +4807,7 @@ function RampWidgetTemplate({
|
|
|
4791
4807
|
noChains = false,
|
|
4792
4808
|
retrying = false,
|
|
4793
4809
|
onRetryOrder,
|
|
4810
|
+
onRequote,
|
|
4794
4811
|
onSetUpRecovery,
|
|
4795
4812
|
recoveryMissing = null,
|
|
4796
4813
|
checkingPayment = false,
|
|
@@ -4822,6 +4839,7 @@ function RampWidgetTemplate({
|
|
|
4822
4839
|
const stopped = order ? rampOrderStopped(order) : false;
|
|
4823
4840
|
const receive = order ? rampOrderReceive(order) : null;
|
|
4824
4841
|
const waitsOnRecovery = order?.failure?.resolutionAction === "set_up_recovery";
|
|
4842
|
+
const asksNewQuote = order?.failure?.resolutionAction === "accept_new_quote";
|
|
4825
4843
|
const payBy = view?.action?.kind === "FIAT_PAYMENT" && view.expiresAt ? Date.parse(view.expiresAt) : null;
|
|
4826
4844
|
useRenderAt(view?.canSign && view.expiresAt ? Date.parse(view.expiresAt) : null);
|
|
4827
4845
|
const stepsOpen = !!onStepSelect && step !== "status" && !isLoading && startingQuoteId === null && trustingAsset === null && walletBusy === null;
|
|
@@ -5154,7 +5172,8 @@ function RampWidgetTemplate({
|
|
|
5154
5172
|
/* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: rampOrderResolutionText(order, language) }),
|
|
5155
5173
|
stopped && !settled && waitsOnRecovery && recoveryMissing !== false && onSetUpRecovery && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-secondary", onClick: onSetUpRecovery, children: copy.setUpRecovery }),
|
|
5156
5174
|
stopped && !settled && waitsOnRecovery && recoveryMissing === true && /* @__PURE__ */ jsx("p", { className: "pollar-ramp-payment-note", children: copy.recoveryNote }),
|
|
5157
|
-
stopped && !settled &&
|
|
5175
|
+
stopped && !settled && asksNewQuote && onRequote && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-btn-primary", onClick: onRequote, children: copy.newQuote }),
|
|
5176
|
+
stopped && !settled && order.failure.resolutionOwner === "END_USER" && !asksNewQuote && onRetryOrder && /* @__PURE__ */ jsx(
|
|
5158
5177
|
"button",
|
|
5159
5178
|
{
|
|
5160
5179
|
type: "button",
|
|
@@ -6268,6 +6287,10 @@ function RampWidget({ onClose, language: languageProp }) {
|
|
|
6268
6287
|
setRetrying(false);
|
|
6269
6288
|
}
|
|
6270
6289
|
}
|
|
6290
|
+
async function handleRequote() {
|
|
6291
|
+
setOrder(null);
|
|
6292
|
+
await handleFindRoute();
|
|
6293
|
+
}
|
|
6271
6294
|
const heldForRecovery = step === "status" && order?.failure?.resolutionAction === "set_up_recovery";
|
|
6272
6295
|
const wasRecoveryLocked = useRef(recoveryLocked);
|
|
6273
6296
|
useEffect(() => {
|
|
@@ -6415,6 +6438,7 @@ function RampWidget({ onClose, language: languageProp }) {
|
|
|
6415
6438
|
onApprove: openCosignModal,
|
|
6416
6439
|
retrying,
|
|
6417
6440
|
onRetryOrder: () => void handleRetryOrder(),
|
|
6441
|
+
onRequote: () => void handleRequote(),
|
|
6418
6442
|
onSetUpRecovery: openRecoveryModal,
|
|
6419
6443
|
recoveryMissing: recovery === null ? null : recoveryLocked,
|
|
6420
6444
|
pollTrouble,
|
|
@@ -6941,25 +6965,480 @@ var SEND_COPY = {
|
|
|
6941
6965
|
}
|
|
6942
6966
|
};
|
|
6943
6967
|
|
|
6968
|
+
// src/components/tx-review/tx-review-copy.ts
|
|
6969
|
+
var TX_REVIEW_COPY = {
|
|
6970
|
+
en: {
|
|
6971
|
+
titles: {
|
|
6972
|
+
send: (amount) => `Send ${amount}`,
|
|
6973
|
+
bridge: (amount, chain) => `Move ${amount} to ${chain}`,
|
|
6974
|
+
approve: (asset, spender) => `Allow ${spender} to use your ${asset}`,
|
|
6975
|
+
swap: (from, to) => `Swap ${from} for ${to}`,
|
|
6976
|
+
payment: (amount, to) => `Pay ${amount} to ${to}`,
|
|
6977
|
+
createAccount: "Create an account"
|
|
6978
|
+
},
|
|
6979
|
+
yourWallet: "Your wallet",
|
|
6980
|
+
newAccount: "New account",
|
|
6981
|
+
atLeast: "at least",
|
|
6982
|
+
approveNote: "This only gives permission. Nothing moves yet.",
|
|
6983
|
+
feeSponsored: "Fee covered by the app",
|
|
6984
|
+
feePaid: "You pay the network fee",
|
|
6985
|
+
showDetails: "Show details",
|
|
6986
|
+
hideDetails: "Hide details",
|
|
6987
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
6988
|
+
rows: {
|
|
6989
|
+
description: "Description",
|
|
6990
|
+
network: "Network",
|
|
6991
|
+
from: "From",
|
|
6992
|
+
to: "To",
|
|
6993
|
+
amount: "Amount",
|
|
6994
|
+
receiveMin: "Receive at least",
|
|
6995
|
+
via: "Via",
|
|
6996
|
+
fee: "Network fee",
|
|
6997
|
+
feeCovered: "Covered by the app",
|
|
6998
|
+
contract: "Contract",
|
|
6999
|
+
method: "Method",
|
|
7000
|
+
asset: "Asset",
|
|
7001
|
+
expiresIn: "Expires in",
|
|
7002
|
+
rawTx: "Raw transaction",
|
|
7003
|
+
txHash: "Transaction hash"
|
|
7004
|
+
},
|
|
7005
|
+
viewOnExplorer: "View on explorer"
|
|
7006
|
+
},
|
|
7007
|
+
es: {
|
|
7008
|
+
titles: {
|
|
7009
|
+
send: (amount) => `Enviar ${amount}`,
|
|
7010
|
+
bridge: (amount, chain) => `Mover ${amount} a ${chain}`,
|
|
7011
|
+
approve: (asset, spender) => `Permitir que ${spender} use tu ${asset}`,
|
|
7012
|
+
swap: (from, to) => `Cambiar ${from} por ${to}`,
|
|
7013
|
+
payment: (amount, to) => `Pagar ${amount} a ${to}`,
|
|
7014
|
+
createAccount: "Crear una cuenta"
|
|
7015
|
+
},
|
|
7016
|
+
yourWallet: "Tu billetera",
|
|
7017
|
+
newAccount: "Cuenta nueva",
|
|
7018
|
+
atLeast: "al menos",
|
|
7019
|
+
approveNote: "Solo das permiso. Todav\xEDa no se mueve nada.",
|
|
7020
|
+
feeSponsored: "La app cubre la comisi\xF3n",
|
|
7021
|
+
feePaid: "T\xFA pagas la comisi\xF3n de red",
|
|
7022
|
+
showDetails: "Ver detalles",
|
|
7023
|
+
hideDetails: "Ocultar detalles",
|
|
7024
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
7025
|
+
rows: {
|
|
7026
|
+
description: "Descripci\xF3n",
|
|
7027
|
+
network: "Red",
|
|
7028
|
+
from: "Desde",
|
|
7029
|
+
to: "Hacia",
|
|
7030
|
+
amount: "Monto",
|
|
7031
|
+
receiveMin: "Recibes al menos",
|
|
7032
|
+
via: "V\xEDa",
|
|
7033
|
+
fee: "Comisi\xF3n de red",
|
|
7034
|
+
feeCovered: "La cubre la app",
|
|
7035
|
+
contract: "Contrato",
|
|
7036
|
+
method: "M\xE9todo",
|
|
7037
|
+
asset: "Activo",
|
|
7038
|
+
expiresIn: "Vence en",
|
|
7039
|
+
rawTx: "Transacci\xF3n en bruto",
|
|
7040
|
+
txHash: "Hash de la transacci\xF3n"
|
|
7041
|
+
},
|
|
7042
|
+
viewOnExplorer: "Ver en el explorador"
|
|
7043
|
+
},
|
|
7044
|
+
pt: {
|
|
7045
|
+
titles: {
|
|
7046
|
+
send: (amount) => `Enviar ${amount}`,
|
|
7047
|
+
bridge: (amount, chain) => `Mover ${amount} para ${chain}`,
|
|
7048
|
+
approve: (asset, spender) => `Permitir que ${spender} use seu ${asset}`,
|
|
7049
|
+
swap: (from, to) => `Trocar ${from} por ${to}`,
|
|
7050
|
+
payment: (amount, to) => `Pagar ${amount} para ${to}`,
|
|
7051
|
+
createAccount: "Criar uma conta"
|
|
7052
|
+
},
|
|
7053
|
+
yourWallet: "Sua carteira",
|
|
7054
|
+
newAccount: "Conta nova",
|
|
7055
|
+
atLeast: "pelo menos",
|
|
7056
|
+
approveNote: "Isto s\xF3 d\xE1 permiss\xE3o. Nada se move ainda.",
|
|
7057
|
+
feeSponsored: "O app cobre a taxa",
|
|
7058
|
+
feePaid: "Voc\xEA paga a taxa de rede",
|
|
7059
|
+
showDetails: "Ver detalhes",
|
|
7060
|
+
hideDetails: "Ocultar detalhes",
|
|
7061
|
+
chains: { STELLAR: "Stellar", POLYGON: "Polygon", SOLANA: "Solana" },
|
|
7062
|
+
rows: {
|
|
7063
|
+
description: "Descri\xE7\xE3o",
|
|
7064
|
+
network: "Rede",
|
|
7065
|
+
from: "De",
|
|
7066
|
+
to: "Para",
|
|
7067
|
+
amount: "Valor",
|
|
7068
|
+
receiveMin: "Recebe pelo menos",
|
|
7069
|
+
via: "Via",
|
|
7070
|
+
fee: "Taxa de rede",
|
|
7071
|
+
feeCovered: "Coberta pelo app",
|
|
7072
|
+
contract: "Contrato",
|
|
7073
|
+
method: "M\xE9todo",
|
|
7074
|
+
asset: "Ativo",
|
|
7075
|
+
expiresIn: "Expira em",
|
|
7076
|
+
rawTx: "Transa\xE7\xE3o bruta",
|
|
7077
|
+
txHash: "Hash da transa\xE7\xE3o"
|
|
7078
|
+
},
|
|
7079
|
+
viewOnExplorer: "Ver no explorador"
|
|
7080
|
+
}
|
|
7081
|
+
};
|
|
7082
|
+
var CHAINS = /* @__PURE__ */ new Set(["STELLAR", "POLYGON", "SOLANA"]);
|
|
7083
|
+
var asChain = (value) => typeof value === "string" && CHAINS.has(value) ? value : void 0;
|
|
7084
|
+
var asString = (value) => typeof value === "string" && value !== "" ? value : typeof value === "number" ? String(value) : void 0;
|
|
7085
|
+
function shortAddress(address) {
|
|
7086
|
+
return address.length <= 12 ? address : `${address.slice(0, 4)}...${address.slice(-4)}`;
|
|
7087
|
+
}
|
|
7088
|
+
function displayName(label) {
|
|
7089
|
+
if (/[A-Z]/.test(label) && /[a-z]/.test(label)) return label;
|
|
7090
|
+
return label.toLowerCase().split(/[_\s-]+/).map((word) => word ? word[0].toUpperCase() + word.slice(1) : word).join(" ");
|
|
7091
|
+
}
|
|
7092
|
+
var withAsset = (party) => [party?.amount, party?.asset].filter(Boolean).join(" ");
|
|
7093
|
+
function partyRow(label, party, copy) {
|
|
7094
|
+
if (!party?.address && !party?.label) return null;
|
|
7095
|
+
const chain = party.chain ? `${copy.chains[party.chain]} ` : "";
|
|
7096
|
+
const name = party.label ? `${displayName(party.label)} ` : "";
|
|
7097
|
+
return party.address ? { label, value: `${chain}${name}${party.address}`.trim(), copyValue: party.address, mono: true } : { label, value: `${chain}${name}`.trim() };
|
|
7098
|
+
}
|
|
7099
|
+
function titleOf(data, fallback, copy) {
|
|
7100
|
+
const { from, to } = data;
|
|
7101
|
+
switch (data.kind) {
|
|
7102
|
+
case "send":
|
|
7103
|
+
return from?.amount ? copy.titles.send(withAsset(from)) : fallback;
|
|
7104
|
+
case "bridge":
|
|
7105
|
+
return from?.amount && to?.chain ? copy.titles.bridge(withAsset(from), copy.chains[to.chain]) : fallback;
|
|
7106
|
+
case "approve":
|
|
7107
|
+
return from?.asset && to?.label ? copy.titles.approve(from.asset, displayName(to.label)) : fallback;
|
|
7108
|
+
case "swap":
|
|
7109
|
+
return from?.asset && to?.asset ? copy.titles.swap(from.asset, to.asset) : fallback;
|
|
7110
|
+
case "payment":
|
|
7111
|
+
return from?.amount && to?.label ? copy.titles.payment(withAsset(from), displayName(to.label)) : fallback;
|
|
7112
|
+
case "create_account":
|
|
7113
|
+
return copy.titles.createAccount;
|
|
7114
|
+
default:
|
|
7115
|
+
return fallback;
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
function rampFlow(details) {
|
|
7119
|
+
const flow = details.flow;
|
|
7120
|
+
if (!flow || typeof flow !== "object" || !flow.from || !flow.to) return null;
|
|
7121
|
+
const kind = flow.kind;
|
|
7122
|
+
if (kind !== "bridge" && kind !== "approve" && kind !== "swap" && kind !== "payment") return null;
|
|
7123
|
+
const party = (p) => {
|
|
7124
|
+
const out = {};
|
|
7125
|
+
const chain = asChain(p.chain);
|
|
7126
|
+
if (chain) out.chain = chain;
|
|
7127
|
+
for (const key of ["asset", "amount", "address", "label"]) {
|
|
7128
|
+
const value = asString(p[key]);
|
|
7129
|
+
if (value) out[key] = value;
|
|
7130
|
+
}
|
|
7131
|
+
if (p.minimum === true) out.minimum = true;
|
|
7132
|
+
return out;
|
|
7133
|
+
};
|
|
7134
|
+
const from = { ...party(flow.from), self: true };
|
|
7135
|
+
const to = { ...party(flow.to), self: kind === "bridge" || kind === "swap" };
|
|
7136
|
+
return { kind, from, to, via: asString(flow.via) };
|
|
7137
|
+
}
|
|
7138
|
+
function readableAmount(details) {
|
|
7139
|
+
const { amount, decimals, symbol } = details;
|
|
7140
|
+
if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
|
|
7141
|
+
try {
|
|
7142
|
+
return { amount: fromBaseUnits(amount, decimals), symbol };
|
|
7143
|
+
} catch {
|
|
7144
|
+
return null;
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
function reviewFromRequest(parts, copy) {
|
|
7148
|
+
const details = parts.details ?? {};
|
|
7149
|
+
const flow = rampFlow(details);
|
|
7150
|
+
const rows = [];
|
|
7151
|
+
let data;
|
|
7152
|
+
let via;
|
|
7153
|
+
if (flow) {
|
|
7154
|
+
data = { kind: flow.kind, from: flow.from, to: flow.to };
|
|
7155
|
+
via = flow.via;
|
|
7156
|
+
} else {
|
|
7157
|
+
const destination = asString(details.destination) ?? asString(details.to);
|
|
7158
|
+
const readable = readableAmount(details);
|
|
7159
|
+
const asset = readable?.symbol ?? asString(details.asset) ?? asString(details.assetCode) ?? asString(details.symbol);
|
|
7160
|
+
const amount = readable?.amount ?? asString(details.amount);
|
|
7161
|
+
const isTransfer = parts.operation === "payment" || parts.operation === "transfer";
|
|
7162
|
+
if (isTransfer && destination) {
|
|
7163
|
+
data = {
|
|
7164
|
+
kind: "send",
|
|
7165
|
+
from: {
|
|
7166
|
+
chain: parts.chain,
|
|
7167
|
+
self: true,
|
|
7168
|
+
...asset ? { asset } : {},
|
|
7169
|
+
...amount ? { amount } : {},
|
|
7170
|
+
...parts.signWith ? { address: parts.signWith } : {}
|
|
7171
|
+
},
|
|
7172
|
+
to: { chain: parts.chain, address: destination }
|
|
7173
|
+
};
|
|
7174
|
+
} else if (parts.operation === "create_account" && destination) {
|
|
7175
|
+
data = {
|
|
7176
|
+
kind: "create_account",
|
|
7177
|
+
from: { chain: parts.chain, self: true, ...parts.signWith ? { address: parts.signWith } : {} },
|
|
7178
|
+
to: { chain: parts.chain, address: destination, label: copy.newAccount }
|
|
7179
|
+
};
|
|
7180
|
+
} else {
|
|
7181
|
+
data = { kind: "other" };
|
|
7182
|
+
if (asset) rows.push({ label: copy.rows.asset, value: asset });
|
|
7183
|
+
if (amount) rows.push({ label: copy.rows.amount, value: amount });
|
|
7184
|
+
}
|
|
7185
|
+
}
|
|
7186
|
+
if (parts.summary) rows.unshift({ label: copy.rows.description, value: parts.summary });
|
|
7187
|
+
rows.push({
|
|
7188
|
+
label: copy.rows.network,
|
|
7189
|
+
value: [copy.chains[data.from?.chain ?? parts.chain], parts.network].filter(Boolean).join(" ")
|
|
7190
|
+
});
|
|
7191
|
+
const fromRow = partyRow(copy.rows.from, data.from ?? (parts.signWith ? { address: parts.signWith } : void 0), copy);
|
|
7192
|
+
if (fromRow) rows.push(fromRow);
|
|
7193
|
+
const toRow = partyRow(copy.rows.to, data.to, copy);
|
|
7194
|
+
if (toRow) rows.push(toRow);
|
|
7195
|
+
if (data.kind !== "other" && data.from?.amount) rows.push({ label: copy.rows.amount, value: withAsset(data.from) });
|
|
7196
|
+
if (data.kind === "swap" && data.to?.amount)
|
|
7197
|
+
rows.push({ label: data.to.minimum ? copy.rows.receiveMin : copy.rows.amount, value: withAsset(data.to) });
|
|
7198
|
+
if (via) rows.push({ label: copy.rows.via, value: displayName(via) });
|
|
7199
|
+
const contract = asString(details.contractId);
|
|
7200
|
+
if (contract) rows.push({ label: copy.rows.contract, value: contract, copyValue: contract, mono: true });
|
|
7201
|
+
const method = asString(details.method);
|
|
7202
|
+
if (method) rows.push({ label: copy.rows.method, value: method, mono: true });
|
|
7203
|
+
if (parts.appPaysFee) rows.push({ label: copy.rows.fee, value: copy.rows.feeCovered });
|
|
7204
|
+
rows.push(...parts.extraRows ?? []);
|
|
7205
|
+
return {
|
|
7206
|
+
...data,
|
|
7207
|
+
title: titleOf(data, parts.fallbackTitle, copy),
|
|
7208
|
+
...parts.appPaysFee ? { fee: { sponsored: true } } : {},
|
|
7209
|
+
rows,
|
|
7210
|
+
...parts.raw ? { raw: parts.raw } : {},
|
|
7211
|
+
...parts.hash ? { hash: parts.hash } : {}
|
|
7212
|
+
};
|
|
7213
|
+
}
|
|
7214
|
+
function splitAmount(text) {
|
|
7215
|
+
if (!text) return void 0;
|
|
7216
|
+
const [amount, ...rest] = text.trim().split(/\s+/);
|
|
7217
|
+
if (!amount) return void 0;
|
|
7218
|
+
return rest.length ? { amount, asset: rest.join(" ") } : { amount };
|
|
7219
|
+
}
|
|
7220
|
+
function buildLabel(label, copy) {
|
|
7221
|
+
const known = {
|
|
7222
|
+
From: copy.rows.from,
|
|
7223
|
+
To: copy.rows.to,
|
|
7224
|
+
Amount: copy.rows.amount,
|
|
7225
|
+
Asset: copy.rows.asset,
|
|
7226
|
+
Contract: copy.rows.contract,
|
|
7227
|
+
Method: copy.rows.method,
|
|
7228
|
+
"Receive min": copy.rows.receiveMin
|
|
7229
|
+
};
|
|
7230
|
+
return known[label] ?? label;
|
|
7231
|
+
}
|
|
7232
|
+
function reviewFromBuild(build, copy, fallbackTitle, hash, sponsored) {
|
|
7233
|
+
const lines = /* @__PURE__ */ new Map();
|
|
7234
|
+
for (const line of build.summary.lines) {
|
|
7235
|
+
const at = line.indexOf(": ");
|
|
7236
|
+
if (at > 0) lines.set(line.slice(0, at), line.slice(at + 2));
|
|
7237
|
+
}
|
|
7238
|
+
const chain = asChain(build.chain) ?? "STELLAR";
|
|
7239
|
+
let data = { kind: "other" };
|
|
7240
|
+
const from = lines.get("From") ?? lines.get("Funder");
|
|
7241
|
+
if (lines.has("Send") && lines.has("Receive min")) {
|
|
7242
|
+
const sent = splitAmount(lines.get("Send"));
|
|
7243
|
+
const received = splitAmount(lines.get("Receive min"));
|
|
7244
|
+
data = {
|
|
7245
|
+
kind: "swap",
|
|
7246
|
+
from: { chain, self: true, ...sent, ...from ? { address: from } : {} },
|
|
7247
|
+
to: { chain, minimum: true, ...received, ...lines.get("To") ? { address: lines.get("To") } : {} }
|
|
7248
|
+
};
|
|
7249
|
+
} else if (lines.has("To") && lines.has("Amount")) {
|
|
7250
|
+
data = {
|
|
7251
|
+
kind: "send",
|
|
7252
|
+
from: { chain, self: true, ...splitAmount(lines.get("Amount")), ...from ? { address: from } : {} },
|
|
7253
|
+
to: { chain, address: lines.get("To") }
|
|
7254
|
+
};
|
|
7255
|
+
} else if (lines.has("New account")) {
|
|
7256
|
+
data = {
|
|
7257
|
+
kind: "create_account",
|
|
7258
|
+
from: { chain, self: true, ...splitAmount(lines.get("Starting balance")), ...from ? { address: from } : {} },
|
|
7259
|
+
to: { chain, address: lines.get("New account"), label: copy.newAccount }
|
|
7260
|
+
};
|
|
7261
|
+
}
|
|
7262
|
+
const rows = [
|
|
7263
|
+
{ label: copy.rows.network, value: `${copy.chains[chain]} ${build.summary.network}` },
|
|
7264
|
+
...build.summary.lines.map((line) => {
|
|
7265
|
+
const at = line.indexOf(": ");
|
|
7266
|
+
if (at <= 0) return { label: "", value: line };
|
|
7267
|
+
const value = line.slice(at + 2);
|
|
7268
|
+
const label = line.slice(0, at);
|
|
7269
|
+
const isAddress = /^[GCM][A-Z2-7]{55,68}$/.test(value) || /^0x[0-9a-fA-F]{40}$/.test(value);
|
|
7270
|
+
return { label: buildLabel(label, copy), value, ...isAddress ? { copyValue: value, mono: true } : {} };
|
|
7271
|
+
}),
|
|
7272
|
+
{ label: copy.rows.fee, value: sponsored ? copy.rows.feeCovered : build.summary.fee }
|
|
7273
|
+
];
|
|
7274
|
+
return {
|
|
7275
|
+
...data,
|
|
7276
|
+
title: titleOf(data, build.summary.title || fallbackTitle, copy),
|
|
7277
|
+
rows,
|
|
7278
|
+
..."unsignedXdr" in build && build.unsignedXdr ? { raw: build.unsignedXdr } : {},
|
|
7279
|
+
...hash ? { hash } : {},
|
|
7280
|
+
...sponsored !== void 0 ? { fee: { sponsored } } : {}
|
|
7281
|
+
};
|
|
7282
|
+
}
|
|
7283
|
+
function ChainBadge({ chain, copy }) {
|
|
7284
|
+
if (!chain) return null;
|
|
7285
|
+
return /* @__PURE__ */ jsx("img", { className: "pollar-txr-chain", src: CHAIN_LOGOS[chain], alt: copy.chains[chain], title: copy.chains[chain] });
|
|
7286
|
+
}
|
|
7287
|
+
function AssetLogo({ asset }) {
|
|
7288
|
+
const url = TOKEN_LOGOS[asset.toUpperCase()];
|
|
7289
|
+
const [failed, setFailed] = useState(false);
|
|
7290
|
+
if (url && !failed) return /* @__PURE__ */ jsx("img", { className: "pollar-txr-logo", src: url, alt: asset, onError: () => setFailed(true) });
|
|
7291
|
+
return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-initial", "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
|
|
7292
|
+
}
|
|
7293
|
+
function AccountGlyph() {
|
|
7294
|
+
return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
|
|
7295
|
+
/* @__PURE__ */ jsx("circle", { cx: "10", cy: "7", r: "3.25", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
7296
|
+
/* @__PURE__ */ jsx(
|
|
7297
|
+
"path",
|
|
7298
|
+
{
|
|
7299
|
+
d: "M3.75 16.5c.9-3 3.3-4.5 6.25-4.5s5.35 1.5 6.25 4.5",
|
|
7300
|
+
stroke: "currentColor",
|
|
7301
|
+
strokeWidth: "1.6",
|
|
7302
|
+
strokeLinecap: "round"
|
|
7303
|
+
}
|
|
7304
|
+
)
|
|
7305
|
+
] }) });
|
|
7306
|
+
}
|
|
7307
|
+
function ContractGlyph() {
|
|
7308
|
+
return /* @__PURE__ */ jsx("span", { className: "pollar-txr-logo pollar-txr-logo-glyph", "aria-hidden": true, children: /* @__PURE__ */ jsxs("svg", { width: "18", height: "18", viewBox: "0 0 20 20", fill: "none", children: [
|
|
7309
|
+
/* @__PURE__ */ jsx("rect", { x: "4.5", y: "9", width: "11", height: "7.5", rx: "1.75", stroke: "currentColor", strokeWidth: "1.6" }),
|
|
7310
|
+
/* @__PURE__ */ jsx("path", { d: "M7 9V6.75a3 3 0 0 1 6 0V9", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round" })
|
|
7311
|
+
] }) });
|
|
7312
|
+
}
|
|
7313
|
+
function Node2({
|
|
7314
|
+
party,
|
|
7315
|
+
showAmount,
|
|
7316
|
+
glyph,
|
|
7317
|
+
copy
|
|
7318
|
+
}) {
|
|
7319
|
+
const caption = party.self ? copy.yourWallet : party.label ?? (party.address ? shortAddress(party.address) : party.chain ? copy.chains[party.chain] : "");
|
|
7320
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-txr-node", children: [
|
|
7321
|
+
/* @__PURE__ */ jsxs("span", { className: "pollar-txr-avatar", children: [
|
|
7322
|
+
glyph === "asset" && party.asset ? /* @__PURE__ */ jsx(AssetLogo, { asset: party.asset }, party.asset) : glyph === "contract" ? /* @__PURE__ */ jsx(ContractGlyph, {}) : /* @__PURE__ */ jsx(AccountGlyph, {}),
|
|
7323
|
+
/* @__PURE__ */ jsx(ChainBadge, { chain: party.chain, copy })
|
|
7324
|
+
] }),
|
|
7325
|
+
showAmount && party.amount && /* @__PURE__ */ jsxs("span", { className: "pollar-txr-amount", children: [
|
|
7326
|
+
party.minimum && /* @__PURE__ */ jsxs("span", { className: "pollar-txr-min", children: [
|
|
7327
|
+
copy.atLeast,
|
|
7328
|
+
" "
|
|
7329
|
+
] }),
|
|
7330
|
+
party.amount,
|
|
7331
|
+
" ",
|
|
7332
|
+
party.asset
|
|
7333
|
+
] }),
|
|
7334
|
+
/* @__PURE__ */ jsx("span", { className: "pollar-txr-caption", title: party.address, children: caption })
|
|
7335
|
+
] });
|
|
7336
|
+
}
|
|
7337
|
+
function Arrow() {
|
|
7338
|
+
return /* @__PURE__ */ jsxs("span", { className: "pollar-txr-arrow", "aria-hidden": true, children: [
|
|
7339
|
+
/* @__PURE__ */ jsx("svg", { width: "100%", height: "12", viewBox: "0 0 64 12", preserveAspectRatio: "none", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M1 6h60", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeDasharray: "3 4" }) }),
|
|
7340
|
+
/* @__PURE__ */ jsx("svg", { className: "pollar-txr-arrow-head", width: "10", height: "12", viewBox: "0 0 10 12", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M2 1.5 7.5 6 2 10.5", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
7341
|
+
] });
|
|
7342
|
+
}
|
|
7343
|
+
function FeeBadge({ sponsored, copy }) {
|
|
7344
|
+
return /* @__PURE__ */ jsxs("span", { className: `pollar-txr-fee${sponsored ? " pollar-txr-fee-sponsored" : ""}`, children: [
|
|
7345
|
+
sponsored ? /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: [
|
|
7346
|
+
/* @__PURE__ */ jsx("rect", { x: "2", y: "6", width: "12", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.4" }),
|
|
7347
|
+
/* @__PURE__ */ jsx("path", { d: "M1.5 4.25h13V6h-13zM8 4.25V14", stroke: "currentColor", strokeWidth: "1.4", strokeLinejoin: "round" }),
|
|
7348
|
+
/* @__PURE__ */ jsx(
|
|
7349
|
+
"path",
|
|
7350
|
+
{
|
|
7351
|
+
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",
|
|
7352
|
+
stroke: "currentColor",
|
|
7353
|
+
strokeWidth: "1.2",
|
|
7354
|
+
strokeLinejoin: "round"
|
|
7355
|
+
}
|
|
7356
|
+
)
|
|
7357
|
+
] }) : /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ 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" }) }),
|
|
7358
|
+
sponsored ? copy.feeSponsored : copy.feePaid
|
|
7359
|
+
] });
|
|
7360
|
+
}
|
|
7361
|
+
function TxFeeBadge({
|
|
7362
|
+
sponsored,
|
|
7363
|
+
language: languageProp
|
|
7364
|
+
}) {
|
|
7365
|
+
const language = useInheritedLanguage(languageProp);
|
|
7366
|
+
return /* @__PURE__ */ jsx(FeeBadge, { sponsored, copy: TX_REVIEW_COPY[language] });
|
|
7367
|
+
}
|
|
7368
|
+
function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
|
|
7369
|
+
const language = useInheritedLanguage(languageProp);
|
|
7370
|
+
const copy = TX_REVIEW_COPY[language];
|
|
7371
|
+
const [openState, setOpenState] = useState(false);
|
|
7372
|
+
const open = openProp ?? openState;
|
|
7373
|
+
const toggle = onToggle ?? (() => setOpenState((v) => !v));
|
|
7374
|
+
const { from, to, kind } = data;
|
|
7375
|
+
const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
|
|
7376
|
+
const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" ? "asset" : "account";
|
|
7377
|
+
return /* @__PURE__ */ jsxs("div", { className: "pollar-txr", children: [
|
|
7378
|
+
from && to && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-flow", children: [
|
|
7379
|
+
/* @__PURE__ */ jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
|
|
7380
|
+
/* @__PURE__ */ jsx(Arrow, {}),
|
|
7381
|
+
/* @__PURE__ */ jsx(Node2, { party: to, showAmount: kind !== "approve" && toShowsAmount, glyph: toGlyph, copy })
|
|
7382
|
+
] }),
|
|
7383
|
+
kind === "approve" && /* @__PURE__ */ jsx("p", { className: "pollar-txr-note", children: copy.approveNote }),
|
|
7384
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-txr-bar", children: [
|
|
7385
|
+
data.fee?.sponsored !== void 0 ? /* @__PURE__ */ jsx(FeeBadge, { sponsored: data.fee.sponsored, copy }) : /* @__PURE__ */ jsx("span", {}),
|
|
7386
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "pollar-txr-toggle", "aria-expanded": open, onClick: toggle, children: [
|
|
7387
|
+
open ? copy.hideDetails : copy.showDetails,
|
|
7388
|
+
/* @__PURE__ */ jsx(
|
|
7389
|
+
"svg",
|
|
7390
|
+
{
|
|
7391
|
+
width: "10",
|
|
7392
|
+
height: "10",
|
|
7393
|
+
viewBox: "0 0 12 12",
|
|
7394
|
+
fill: "none",
|
|
7395
|
+
"aria-hidden": true,
|
|
7396
|
+
style: { transform: open ? "rotate(180deg)" : "none", transition: "transform 150ms" },
|
|
7397
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2 4l4 4 4-4", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
7398
|
+
}
|
|
7399
|
+
)
|
|
7400
|
+
] })
|
|
7401
|
+
] }),
|
|
7402
|
+
open && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-details", children: [
|
|
7403
|
+
/* @__PURE__ */ jsxs("dl", { className: "pollar-txr-rows", children: [
|
|
7404
|
+
data.rows.map((row, i) => /* @__PURE__ */ jsxs("div", { className: "pollar-txr-row", children: [
|
|
7405
|
+
/* @__PURE__ */ jsx("dt", { children: row.label }),
|
|
7406
|
+
/* @__PURE__ */ jsxs("dd", { className: row.mono ? "pollar-txr-mono" : void 0, children: [
|
|
7407
|
+
/* @__PURE__ */ jsx("span", { children: row.value }),
|
|
7408
|
+
row.copyValue && /* @__PURE__ */ jsx(CopyButton, { value: row.copyValue, className: "pollar-copy-btn-sm", language })
|
|
7409
|
+
] })
|
|
7410
|
+
] }, `${row.label}-${i}`)),
|
|
7411
|
+
data.hash && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-row", children: [
|
|
7412
|
+
/* @__PURE__ */ jsx("dt", { children: copy.rows.txHash }),
|
|
7413
|
+
/* @__PURE__ */ jsxs("dd", { className: "pollar-txr-mono", children: [
|
|
7414
|
+
/* @__PURE__ */ jsx("span", { children: data.hash.value }),
|
|
7415
|
+
/* @__PURE__ */ jsx(CopyButton, { value: data.hash.value, className: "pollar-copy-btn-sm", language })
|
|
7416
|
+
] })
|
|
7417
|
+
] })
|
|
7418
|
+
] }),
|
|
7419
|
+
data.hash?.explorerUrl && /* @__PURE__ */ jsx("a", { className: "pollar-txr-link", href: data.hash.explorerUrl, target: "_blank", rel: "noopener noreferrer", children: copy.viewOnExplorer }),
|
|
7420
|
+
data.raw && /* @__PURE__ */ jsxs("div", { className: "pollar-txr-raw", children: [
|
|
7421
|
+
/* @__PURE__ */ jsxs("div", { className: "pollar-txr-raw-head", children: [
|
|
7422
|
+
/* @__PURE__ */ jsx("span", { children: copy.rows.rawTx }),
|
|
7423
|
+
/* @__PURE__ */ jsx(CopyButton, { value: data.raw, className: "pollar-copy-btn-sm", language })
|
|
7424
|
+
] }),
|
|
7425
|
+
/* @__PURE__ */ jsx("pre", { children: data.raw })
|
|
7426
|
+
] })
|
|
7427
|
+
] })
|
|
7428
|
+
] });
|
|
7429
|
+
}
|
|
7430
|
+
|
|
6944
7431
|
// src/components/transaction-modal/transaction-copy.ts
|
|
6945
7432
|
var TRANSACTION_COPY = {
|
|
6946
7433
|
en: {
|
|
6947
7434
|
title: "Transaction",
|
|
6948
7435
|
close: "Close",
|
|
6949
|
-
details: "Details",
|
|
6950
|
-
network: "Network",
|
|
6951
|
-
fee: "Fee",
|
|
6952
|
-
rawXdr: "Raw transaction (XDR)",
|
|
6953
7436
|
errorDetails: "Error details",
|
|
6954
7437
|
signAndSend: "Sign & Send",
|
|
6955
7438
|
waitingFreighter: "Waiting for Freighter\u2026",
|
|
6956
7439
|
waitingAlbedo: "Waiting for Albedo\u2026",
|
|
6957
7440
|
signingAndSending: "Signing and sending\u2026",
|
|
6958
7441
|
tryAgain: "Try again",
|
|
6959
|
-
txHash: "Transaction hash",
|
|
6960
|
-
copied: "Copied!",
|
|
6961
|
-
copyHash: "Copy hash",
|
|
6962
|
-
viewOnExplorer: "View on Explorer",
|
|
6963
7442
|
done: "Done",
|
|
6964
7443
|
status: {
|
|
6965
7444
|
idle: "",
|
|
@@ -6979,20 +7458,12 @@ var TRANSACTION_COPY = {
|
|
|
6979
7458
|
es: {
|
|
6980
7459
|
title: "Transacci\xF3n",
|
|
6981
7460
|
close: "Cerrar",
|
|
6982
|
-
details: "Detalles",
|
|
6983
|
-
network: "Red",
|
|
6984
|
-
fee: "Comisi\xF3n",
|
|
6985
|
-
rawXdr: "Transacci\xF3n en bruto (XDR)",
|
|
6986
7461
|
errorDetails: "Detalles del error",
|
|
6987
7462
|
signAndSend: "Firmar y enviar",
|
|
6988
7463
|
waitingFreighter: "Esperando a Freighter\u2026",
|
|
6989
7464
|
waitingAlbedo: "Esperando a Albedo\u2026",
|
|
6990
7465
|
signingAndSending: "Firmando y enviando\u2026",
|
|
6991
7466
|
tryAgain: "Intenta de nuevo",
|
|
6992
|
-
txHash: "Hash de la transacci\xF3n",
|
|
6993
|
-
copied: "\xA1Copiado!",
|
|
6994
|
-
copyHash: "Copiar hash",
|
|
6995
|
-
viewOnExplorer: "Ver en el explorador",
|
|
6996
7467
|
done: "Listo",
|
|
6997
7468
|
status: {
|
|
6998
7469
|
idle: "",
|
|
@@ -7012,20 +7483,12 @@ var TRANSACTION_COPY = {
|
|
|
7012
7483
|
pt: {
|
|
7013
7484
|
title: "Transa\xE7\xE3o",
|
|
7014
7485
|
close: "Fechar",
|
|
7015
|
-
details: "Detalhes",
|
|
7016
|
-
network: "Rede",
|
|
7017
|
-
fee: "Taxa",
|
|
7018
|
-
rawXdr: "Transa\xE7\xE3o bruta (XDR)",
|
|
7019
7486
|
errorDetails: "Detalhes do erro",
|
|
7020
7487
|
signAndSend: "Assinar e enviar",
|
|
7021
7488
|
waitingFreighter: "Aguardando o Freighter\u2026",
|
|
7022
7489
|
waitingAlbedo: "Aguardando o Albedo\u2026",
|
|
7023
7490
|
signingAndSending: "Assinando e enviando\u2026",
|
|
7024
7491
|
tryAgain: "Tentar novamente",
|
|
7025
|
-
txHash: "Hash da transa\xE7\xE3o",
|
|
7026
|
-
copied: "Copiado!",
|
|
7027
|
-
copyHash: "Copiar hash",
|
|
7028
|
-
viewOnExplorer: "Ver no explorador",
|
|
7029
7492
|
done: "Concluir",
|
|
7030
7493
|
status: {
|
|
7031
7494
|
idle: "",
|
|
@@ -7049,7 +7512,8 @@ var IN_FLIGHT_STEPS = /* @__PURE__ */ new Set([
|
|
|
7049
7512
|
"submitting",
|
|
7050
7513
|
"submitted",
|
|
7051
7514
|
"signing-submitting",
|
|
7052
|
-
"building-signing-submitting"
|
|
7515
|
+
"building-signing-submitting",
|
|
7516
|
+
"awaiting_cosign"
|
|
7053
7517
|
]);
|
|
7054
7518
|
var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
|
|
7055
7519
|
"built",
|
|
@@ -7058,17 +7522,16 @@ var SHOW_DETAILS_STEPS = /* @__PURE__ */ new Set([
|
|
|
7058
7522
|
"submitting",
|
|
7059
7523
|
"submitted",
|
|
7060
7524
|
"signing-submitting",
|
|
7525
|
+
"awaiting_cosign",
|
|
7061
7526
|
"success"
|
|
7062
7527
|
]);
|
|
7063
7528
|
function TxStatusView({
|
|
7064
7529
|
transaction,
|
|
7065
7530
|
showXdr,
|
|
7066
|
-
copied,
|
|
7067
7531
|
explorerUrl,
|
|
7068
7532
|
walletType,
|
|
7069
7533
|
onSignAndSend,
|
|
7070
7534
|
onToggleXdr,
|
|
7071
|
-
onCopyHash,
|
|
7072
7535
|
onRetry,
|
|
7073
7536
|
onDone,
|
|
7074
7537
|
language: languageProp
|
|
@@ -7082,7 +7545,11 @@ function TxStatusView({
|
|
|
7082
7545
|
const isInFlight = IN_FLIGHT_STEPS.has(transaction.step);
|
|
7083
7546
|
const isSuccess = transaction.step === "success";
|
|
7084
7547
|
const isError = transaction.step === "error";
|
|
7085
|
-
const showDetails =
|
|
7548
|
+
const showDetails = SHOW_DETAILS_STEPS.has(transaction.step);
|
|
7549
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
7550
|
+
const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
|
|
7551
|
+
const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
|
|
7552
|
+
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;
|
|
7086
7553
|
const walletImg = walletType === WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === WalletType.ALBEDO ? LOGO_ALBEDO : null;
|
|
7087
7554
|
const walletAlt = walletType === WalletType.FREIGHTER ? "Freighter" : walletType === WalletType.ALBEDO ? "Albedo" : "Pollar";
|
|
7088
7555
|
const statusBanner = /* @__PURE__ */ jsx(
|
|
@@ -7093,41 +7560,12 @@ function TxStatusView({
|
|
|
7093
7560
|
}
|
|
7094
7561
|
);
|
|
7095
7562
|
const showSpinner = isInFlight || isSuccess || isError;
|
|
7563
|
+
const reviewBlock = showDetails && review && /* @__PURE__ */ jsxs("div", { className: "pollar-tx-review", children: [
|
|
7564
|
+
buildData && /* @__PURE__ */ jsx("p", { className: "pollar-tx-review-title", children: review.title }),
|
|
7565
|
+
/* @__PURE__ */ jsx(TxReview, { data: review, open: showXdr, onToggle: onToggleXdr, language })
|
|
7566
|
+
] });
|
|
7096
7567
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7097
|
-
|
|
7098
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-summary", children: [
|
|
7099
|
-
/* @__PURE__ */ jsx("p", { className: "pollar-tx-summary-title", children: copy.details }),
|
|
7100
|
-
/* @__PURE__ */ jsx("ul", { className: "pollar-tx-summary-lines", children: buildData.summary.lines.map((line, i) => /* @__PURE__ */ jsx("li", { className: "pollar-tx-summary-line", children: line }, i)) })
|
|
7101
|
-
] }),
|
|
7102
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-meta", children: [
|
|
7103
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-meta-item", children: [
|
|
7104
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-meta-label", children: copy.network }),
|
|
7105
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.network })
|
|
7106
|
-
] }),
|
|
7107
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-meta-item", children: [
|
|
7108
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-meta-label", children: copy.fee }),
|
|
7109
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-meta-value", children: buildData.summary.fee })
|
|
7110
|
-
] })
|
|
7111
|
-
] }),
|
|
7112
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-xdr", children: [
|
|
7113
|
-
/* @__PURE__ */ jsxs("button", { className: "pollar-tx-xdr-toggle", onClick: onToggleXdr, children: [
|
|
7114
|
-
/* @__PURE__ */ jsx(
|
|
7115
|
-
"svg",
|
|
7116
|
-
{
|
|
7117
|
-
width: "12",
|
|
7118
|
-
height: "12",
|
|
7119
|
-
viewBox: "0 0 12 12",
|
|
7120
|
-
fill: "none",
|
|
7121
|
-
"aria-hidden": true,
|
|
7122
|
-
style: { transform: showXdr ? "rotate(90deg)" : "rotate(0deg)", transition: "transform 150ms" },
|
|
7123
|
-
children: /* @__PURE__ */ jsx("path", { d: "M4 2l4 4-4 4", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
7124
|
-
}
|
|
7125
|
-
),
|
|
7126
|
-
copy.rawXdr
|
|
7127
|
-
] }),
|
|
7128
|
-
showXdr && /* @__PURE__ */ jsx("pre", { className: "pollar-tx-xdr-content", children: buildData.unsignedXdr })
|
|
7129
|
-
] })
|
|
7130
|
-
] }),
|
|
7568
|
+
!isSuccess && reviewBlock,
|
|
7131
7569
|
isError && errorDetails && /* @__PURE__ */ jsxs("div", { className: "pollar-tx-error-details", children: [
|
|
7132
7570
|
/* @__PURE__ */ jsx("p", { className: "pollar-tx-error-details-label", children: copy.errorDetails }),
|
|
7133
7571
|
/* @__PURE__ */ jsx("pre", { className: "pollar-tx-error-details-content", children: errorDetails })
|
|
@@ -7169,69 +7607,10 @@ function TxStatusView({
|
|
|
7169
7607
|
] }) })
|
|
7170
7608
|
] }),
|
|
7171
7609
|
statusBanner,
|
|
7172
|
-
isInFlight && /* @__PURE__ */ jsx("p", { className: "pollar-tx-spinner-label", children: walletType === WalletType.FREIGHTER ? copy.waitingFreighter : walletType === WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
|
|
7610
|
+
isInFlight && transaction.step !== "awaiting_cosign" && /* @__PURE__ */ jsx("p", { className: "pollar-tx-spinner-label", children: walletType === WalletType.FREIGHTER ? copy.waitingFreighter : walletType === WalletType.ALBEDO ? copy.waitingAlbedo : copy.signingAndSending }),
|
|
7173
7611
|
isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain })
|
|
7174
7612
|
] }),
|
|
7175
|
-
isSuccess &&
|
|
7176
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-result-label", children: copy.txHash }),
|
|
7177
|
-
/* @__PURE__ */ jsx("span", { className: "pollar-tx-result-hash", children: hash }),
|
|
7178
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-tx-result-actions", children: [
|
|
7179
|
-
/* @__PURE__ */ jsx("button", { className: "pollar-tx-result-btn", onClick: onCopyHash, children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7180
|
-
/* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
|
|
7181
|
-
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
|
|
7182
|
-
/* @__PURE__ */ jsx(
|
|
7183
|
-
"path",
|
|
7184
|
-
{
|
|
7185
|
-
d: "M3.5 7l2.5 2.5 4.5-5",
|
|
7186
|
-
stroke: "white",
|
|
7187
|
-
strokeWidth: "1.5",
|
|
7188
|
-
strokeLinecap: "round",
|
|
7189
|
-
strokeLinejoin: "round"
|
|
7190
|
-
}
|
|
7191
|
-
)
|
|
7192
|
-
] }),
|
|
7193
|
-
copy.copied
|
|
7194
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7195
|
-
/* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
7196
|
-
/* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
|
|
7197
|
-
/* @__PURE__ */ jsx(
|
|
7198
|
-
"path",
|
|
7199
|
-
{
|
|
7200
|
-
d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
|
|
7201
|
-
stroke: "currentColor",
|
|
7202
|
-
strokeWidth: "1.5",
|
|
7203
|
-
strokeLinecap: "round"
|
|
7204
|
-
}
|
|
7205
|
-
)
|
|
7206
|
-
] }),
|
|
7207
|
-
copy.copyHash
|
|
7208
|
-
] }) }),
|
|
7209
|
-
explorerUrl && /* @__PURE__ */ jsxs("a", { className: "pollar-tx-result-btn", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", children: [
|
|
7210
|
-
/* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
|
|
7211
|
-
/* @__PURE__ */ jsx(
|
|
7212
|
-
"path",
|
|
7213
|
-
{
|
|
7214
|
-
d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8",
|
|
7215
|
-
stroke: "currentColor",
|
|
7216
|
-
strokeWidth: "1.5",
|
|
7217
|
-
strokeLinecap: "round"
|
|
7218
|
-
}
|
|
7219
|
-
),
|
|
7220
|
-
/* @__PURE__ */ jsx(
|
|
7221
|
-
"path",
|
|
7222
|
-
{
|
|
7223
|
-
d: "M8 1h4m0 0v4m0-4L6 7",
|
|
7224
|
-
stroke: "currentColor",
|
|
7225
|
-
strokeWidth: "1.5",
|
|
7226
|
-
strokeLinecap: "round",
|
|
7227
|
-
strokeLinejoin: "round"
|
|
7228
|
-
}
|
|
7229
|
-
)
|
|
7230
|
-
] }),
|
|
7231
|
-
copy.viewOnExplorer
|
|
7232
|
-
] })
|
|
7233
|
-
] })
|
|
7234
|
-
] }),
|
|
7613
|
+
isSuccess && reviewBlock,
|
|
7235
7614
|
isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done }),
|
|
7236
7615
|
!showSpinner && statusBanner
|
|
7237
7616
|
] });
|
|
@@ -8460,7 +8839,7 @@ function toBaseUnits2(amount, decimals) {
|
|
|
8460
8839
|
const units = BigInt(`${whole}${fraction.padEnd(decimals, "0")}`);
|
|
8461
8840
|
return units > 0n ? units.toString() : null;
|
|
8462
8841
|
}
|
|
8463
|
-
function
|
|
8842
|
+
function fromBaseUnits3(units, decimals) {
|
|
8464
8843
|
if (decimals === 0) return units;
|
|
8465
8844
|
const padded = units.padStart(decimals + 1, "0");
|
|
8466
8845
|
const fraction = padded.slice(-decimals).replace(/0+$/, "");
|
|
@@ -8652,8 +9031,8 @@ function SwapModal({ onClose }) {
|
|
|
8652
9031
|
const solanaQuote = solanaQuotes[0] ?? null;
|
|
8653
9032
|
const quoteView = chain === "SOLANA" ? solanaQuote && selectedBuy?.decimals !== void 0 ? {
|
|
8654
9033
|
provider: solanaQuote.provider,
|
|
8655
|
-
amountOut:
|
|
8656
|
-
minReceived:
|
|
9034
|
+
amountOut: fromBaseUnits3(solanaQuote.outAmount, selectedBuy.decimals),
|
|
9035
|
+
minReceived: fromBaseUnits3(solanaQuote.minOut, selectedBuy.decimals),
|
|
8657
9036
|
priceImpactPct: solanaQuote.priceImpactPct
|
|
8658
9037
|
} : null : quote;
|
|
8659
9038
|
useEffect(() => {
|
|
@@ -9380,6 +9759,16 @@ var CARD_COPY = {
|
|
|
9380
9759
|
CREDITED: { title: "Credited to your card" },
|
|
9381
9760
|
FAILED: { title: "Failed" }
|
|
9382
9761
|
},
|
|
9762
|
+
fundingSolana: {
|
|
9763
|
+
CREATED: {
|
|
9764
|
+
title: "Confirming your payment",
|
|
9765
|
+
hint: "Your USDC payment is being confirmed on Solana. This takes a few seconds."
|
|
9766
|
+
},
|
|
9767
|
+
SENT: {
|
|
9768
|
+
title: "Arrived, crediting your card",
|
|
9769
|
+
hint: "The USDC reached the card provider, which is adding it to your card. This can take a few minutes."
|
|
9770
|
+
}
|
|
9771
|
+
},
|
|
9383
9772
|
incomeRanges: {
|
|
9384
9773
|
"0-1000": "Up to 1,000 USD",
|
|
9385
9774
|
"1000-5000": "1,000 to 5,000 USD",
|
|
@@ -9528,6 +9917,16 @@ var CARD_COPY = {
|
|
|
9528
9917
|
CREDITED: { title: "Acreditado en tu tarjeta" },
|
|
9529
9918
|
FAILED: { title: "Fall\xF3" }
|
|
9530
9919
|
},
|
|
9920
|
+
fundingSolana: {
|
|
9921
|
+
CREATED: {
|
|
9922
|
+
title: "Confirmando tu pago",
|
|
9923
|
+
hint: "Tu pago en USDC se est\xE1 confirmando en Solana. Esto toma unos segundos."
|
|
9924
|
+
},
|
|
9925
|
+
SENT: {
|
|
9926
|
+
title: "Lleg\xF3, acreditando tu tarjeta",
|
|
9927
|
+
hint: "Los USDC llegaron al proveedor de la tarjeta, que los est\xE1 sumando a tu tarjeta. Esto puede tardar unos minutos."
|
|
9928
|
+
}
|
|
9929
|
+
},
|
|
9531
9930
|
incomeRanges: {
|
|
9532
9931
|
"0-1000": "Hasta 1,000 USD",
|
|
9533
9932
|
"1000-5000": "De 1,000 a 5,000 USD",
|
|
@@ -9676,6 +10075,16 @@ var CARD_COPY = {
|
|
|
9676
10075
|
CREDITED: { title: "Creditado no seu cart\xE3o" },
|
|
9677
10076
|
FAILED: { title: "Falhou" }
|
|
9678
10077
|
},
|
|
10078
|
+
fundingSolana: {
|
|
10079
|
+
CREATED: {
|
|
10080
|
+
title: "Confirmando seu pagamento",
|
|
10081
|
+
hint: "Seu pagamento em USDC est\xE1 sendo confirmado na Solana. Isso leva alguns segundos."
|
|
10082
|
+
},
|
|
10083
|
+
SENT: {
|
|
10084
|
+
title: "Chegou, creditando seu cart\xE3o",
|
|
10085
|
+
hint: "Os USDC chegaram ao provedor do cart\xE3o, que est\xE1 adicionando ao seu cart\xE3o. Isso pode levar alguns minutos."
|
|
10086
|
+
}
|
|
10087
|
+
},
|
|
9679
10088
|
incomeRanges: {
|
|
9680
10089
|
"0-1000": "At\xE9 1.000 USD",
|
|
9681
10090
|
"1000-5000": "De 1.000 a 5.000 USD",
|
|
@@ -9846,9 +10255,16 @@ var KYC_POLL_MS = 5e3;
|
|
|
9846
10255
|
var REVEAL_MS = 3e4;
|
|
9847
10256
|
var TX_LIMIT = 10;
|
|
9848
10257
|
var FUNDING_POLL_MS = 5e3;
|
|
9849
|
-
var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "BURNED", "ATTESTED", "MINTED"]);
|
|
9850
|
-
|
|
9851
|
-
|
|
10258
|
+
var FUNDING_INFLIGHT = /* @__PURE__ */ new Set(["CREATED", "SENT", "BURNED", "ATTESTED", "MINTED"]);
|
|
10259
|
+
function newFundingKey() {
|
|
10260
|
+
return `fund-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
10261
|
+
}
|
|
10262
|
+
var FUNDING_STEPS = {
|
|
10263
|
+
STELLAR: ["CREATED", "BURNED", "ATTESTED", "MINTED"],
|
|
10264
|
+
SOLANA: ["CREATED", "SENT"]
|
|
10265
|
+
};
|
|
10266
|
+
var FUNDING_CHAINS = ["STELLAR", "SOLANA"];
|
|
10267
|
+
var isFundingChain = (chain) => FUNDING_CHAINS.includes(chain);
|
|
9852
10268
|
var INCOME_RANGES = ["0-1000", "1000-5000", "5000-10000", "10000+"];
|
|
9853
10269
|
var KYC_PENDING = /* @__PURE__ */ new Set(["PENDING", "NEEDS_ACTION", "IN_REVIEW"]);
|
|
9854
10270
|
var KYC_FINAL = /* @__PURE__ */ new Set(["DENIED", "LOCKED", "CANCELED"]);
|
|
@@ -9910,6 +10326,8 @@ function CardModal({ onClose }) {
|
|
|
9910
10326
|
const [deposit, setDeposit] = useState(null);
|
|
9911
10327
|
const [fundings, setFundings] = useState(null);
|
|
9912
10328
|
const [fundAmount, setFundAmount] = useState("");
|
|
10329
|
+
const fundKey = useRef(null);
|
|
10330
|
+
const [fundChain, setFundChain] = useState(null);
|
|
9913
10331
|
const [showManual, setShowManual] = useState(false);
|
|
9914
10332
|
const [occupations, setOccupations] = useState([]);
|
|
9915
10333
|
const [kyc, setKyc] = useState(emptyKyc);
|
|
@@ -9922,7 +10340,9 @@ function CardModal({ onClose }) {
|
|
|
9922
10340
|
const revealTimer = useRef(null);
|
|
9923
10341
|
const provider = providers?.[0] ?? null;
|
|
9924
10342
|
const fundingAsset = provider?.fundingAssets[0] ?? "USDC";
|
|
9925
|
-
const
|
|
10343
|
+
const fundChains = useChains().chains.filter(isFundingChain);
|
|
10344
|
+
const selectedFundChain = fundChain ?? fundChains[0] ?? "STELLAR";
|
|
10345
|
+
const fundAvailable = useWalletAvailable(panel === "fund" ? { chain: selectedFundChain, code: fundingAsset } : null);
|
|
9926
10346
|
const card = cards?.[0] ?? null;
|
|
9927
10347
|
const expiry = card?.expMonth && card.expYear ? `${card.expMonth}/${card.expYear.slice(-2)}` : null;
|
|
9928
10348
|
const loadHolder = useCallback(async () => {
|
|
@@ -10088,7 +10508,19 @@ function CardModal({ onClose }) {
|
|
|
10088
10508
|
const fund = () => run(
|
|
10089
10509
|
"fund-send",
|
|
10090
10510
|
async () => {
|
|
10091
|
-
|
|
10511
|
+
fundKey.current ?? (fundKey.current = newFundingKey());
|
|
10512
|
+
let outcome;
|
|
10513
|
+
try {
|
|
10514
|
+
outcome = await getClient().fundCard({
|
|
10515
|
+
amount: fundAmount.trim(),
|
|
10516
|
+
chain: selectedFundChain,
|
|
10517
|
+
idempotencyKey: fundKey.current
|
|
10518
|
+
});
|
|
10519
|
+
} catch (e) {
|
|
10520
|
+
if (isPollarApiError(e)) fundKey.current = null;
|
|
10521
|
+
throw e;
|
|
10522
|
+
}
|
|
10523
|
+
fundKey.current = null;
|
|
10092
10524
|
if (outcome.status === "cancelled") {
|
|
10093
10525
|
setError(copy.notSigned);
|
|
10094
10526
|
return;
|
|
@@ -10463,6 +10895,16 @@ function CardModal({ onClose }) {
|
|
|
10463
10895
|
] }),
|
|
10464
10896
|
!loading && provider && card && panel === "fund" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10465
10897
|
/* @__PURE__ */ jsx("p", { children: copy.fundIntro(provider.fundingAssets.join(` ${copy.or} `) || "USDC") }),
|
|
10898
|
+
/* @__PURE__ */ jsx(
|
|
10899
|
+
ChainSelect,
|
|
10900
|
+
{
|
|
10901
|
+
value: selectedFundChain,
|
|
10902
|
+
options: fundChains,
|
|
10903
|
+
onChange: (chain) => setFundChain(chain),
|
|
10904
|
+
disabled: busy !== null,
|
|
10905
|
+
language
|
|
10906
|
+
}
|
|
10907
|
+
),
|
|
10466
10908
|
/* @__PURE__ */ jsx(
|
|
10467
10909
|
AmountField,
|
|
10468
10910
|
{
|
|
@@ -10489,8 +10931,9 @@ function CardModal({ onClose }) {
|
|
|
10489
10931
|
fundings && fundings.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10490
10932
|
/* @__PURE__ */ jsx("p", { className: "pollar-card-section-title", children: copy.yourFundings }),
|
|
10491
10933
|
fundings.map((f) => {
|
|
10492
|
-
const state = copy.funding[f.status];
|
|
10493
|
-
const
|
|
10934
|
+
const state = (f.chain === "SOLANA" ? copy.fundingSolana[f.status] : void 0) ?? copy.funding[f.status];
|
|
10935
|
+
const steps = FUNDING_STEPS[isFundingChain(f.chain) ? f.chain : "STELLAR"];
|
|
10936
|
+
const step = steps.indexOf(f.status) + 1;
|
|
10494
10937
|
const inflight = FUNDING_INFLIGHT.has(f.status);
|
|
10495
10938
|
return /* @__PURE__ */ jsxs("div", { className: "pollar-card-tx", "aria-busy": inflight, children: [
|
|
10496
10939
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
@@ -10498,8 +10941,8 @@ function CardModal({ onClose }) {
|
|
|
10498
10941
|
inflight && /* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
10499
10942
|
state?.title ?? f.status
|
|
10500
10943
|
] }),
|
|
10501
|
-
inflight && step && /* @__PURE__ */ jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
|
|
10502
|
-
copy.stepOf(step,
|
|
10944
|
+
inflight && step > 0 && /* @__PURE__ */ jsxs("span", { className: "pollar-card-tx-meta", role: "status", children: [
|
|
10945
|
+
copy.stepOf(step, steps.length),
|
|
10503
10946
|
" \xB7 ",
|
|
10504
10947
|
state?.hint
|
|
10505
10948
|
] }),
|
|
@@ -10947,7 +11390,6 @@ var COSIGN_COPY = {
|
|
|
10947
11390
|
approving: "Approving...",
|
|
10948
11391
|
genericError: "Something went wrong. Please try again.",
|
|
10949
11392
|
transaction: "Transaction",
|
|
10950
|
-
rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
|
|
10951
11393
|
operations: {
|
|
10952
11394
|
payment: "Send",
|
|
10953
11395
|
path_payment_strict_send: "Swap",
|
|
@@ -10955,7 +11397,10 @@ var COSIGN_COPY = {
|
|
|
10955
11397
|
create_account: "Create account",
|
|
10956
11398
|
invoke_contract: "Contract call",
|
|
10957
11399
|
soroban_auth: "Authorize a contract call",
|
|
10958
|
-
manage_data: "Manage data"
|
|
11400
|
+
manage_data: "Manage data",
|
|
11401
|
+
transfer: "Send",
|
|
11402
|
+
ramp_payment: "Ramp payment",
|
|
11403
|
+
cctp_burn: "Move USDC"
|
|
10959
11404
|
}
|
|
10960
11405
|
},
|
|
10961
11406
|
es: {
|
|
@@ -10984,7 +11429,6 @@ var COSIGN_COPY = {
|
|
|
10984
11429
|
approving: "Aprobando...",
|
|
10985
11430
|
genericError: "Algo sali\xF3 mal. Intenta de nuevo.",
|
|
10986
11431
|
transaction: "Transacci\xF3n",
|
|
10987
|
-
rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
|
|
10988
11432
|
operations: {
|
|
10989
11433
|
payment: "Enviar",
|
|
10990
11434
|
path_payment_strict_send: "Intercambiar",
|
|
@@ -10992,7 +11436,10 @@ var COSIGN_COPY = {
|
|
|
10992
11436
|
create_account: "Crear cuenta",
|
|
10993
11437
|
invoke_contract: "Llamada a contrato",
|
|
10994
11438
|
soroban_auth: "Autorizar una llamada a contrato",
|
|
10995
|
-
manage_data: "Gestionar datos"
|
|
11439
|
+
manage_data: "Gestionar datos",
|
|
11440
|
+
transfer: "Enviar",
|
|
11441
|
+
ramp_payment: "Pago de rampa",
|
|
11442
|
+
cctp_burn: "Mover USDC"
|
|
10996
11443
|
}
|
|
10997
11444
|
},
|
|
10998
11445
|
pt: {
|
|
@@ -11021,7 +11468,6 @@ var COSIGN_COPY = {
|
|
|
11021
11468
|
approving: "Aprovando...",
|
|
11022
11469
|
genericError: "Algo deu errado. Tente novamente.",
|
|
11023
11470
|
transaction: "Transa\xE7\xE3o",
|
|
11024
|
-
rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
|
|
11025
11471
|
operations: {
|
|
11026
11472
|
payment: "Enviar",
|
|
11027
11473
|
path_payment_strict_send: "Trocar",
|
|
@@ -11029,7 +11475,10 @@ var COSIGN_COPY = {
|
|
|
11029
11475
|
create_account: "Criar conta",
|
|
11030
11476
|
invoke_contract: "Chamada de contrato",
|
|
11031
11477
|
soroban_auth: "Autorizar uma chamada de contrato",
|
|
11032
|
-
manage_data: "Gerenciar dados"
|
|
11478
|
+
manage_data: "Gerenciar dados",
|
|
11479
|
+
transfer: "Enviar",
|
|
11480
|
+
ramp_payment: "Pagamento de rampa",
|
|
11481
|
+
cctp_burn: "Mover USDC"
|
|
11033
11482
|
}
|
|
11034
11483
|
}
|
|
11035
11484
|
};
|
|
@@ -11044,32 +11493,6 @@ function expiresIn(request, copy) {
|
|
|
11044
11493
|
const m = Math.floor(ms % 36e5 / 6e4);
|
|
11045
11494
|
return h > 0 ? `${h}h ${m}m` : `${m}m`;
|
|
11046
11495
|
}
|
|
11047
|
-
function readableAmount(details) {
|
|
11048
|
-
const { amount, decimals, symbol } = details;
|
|
11049
|
-
if (typeof amount !== "string" || typeof decimals !== "number" || typeof symbol !== "string") return null;
|
|
11050
|
-
try {
|
|
11051
|
-
return { amount: fromBaseUnits(amount, decimals), symbol };
|
|
11052
|
-
} catch {
|
|
11053
|
-
return null;
|
|
11054
|
-
}
|
|
11055
|
-
}
|
|
11056
|
-
function detailRows(request, copy) {
|
|
11057
|
-
const details = request.details ?? {};
|
|
11058
|
-
const rows = [];
|
|
11059
|
-
const push = (label, value) => {
|
|
11060
|
-
if (value === void 0 || value === null || value === "") return;
|
|
11061
|
-
rows.push([
|
|
11062
|
-
label,
|
|
11063
|
-
typeof value === "string" && value.length > 24 && /^[GC][A-Z2-7]{55}$/.test(value) ? cropAddress(value) : String(value)
|
|
11064
|
-
]);
|
|
11065
|
-
};
|
|
11066
|
-
push(copy.rows.destination, details.destination);
|
|
11067
|
-
const readable = readableAmount(details);
|
|
11068
|
-
push(copy.rows.amount, readable ? `${readable.amount} ${readable.symbol}` : details.amount);
|
|
11069
|
-
push(copy.rows.asset, details.asset ?? details.assetCode ?? readable?.symbol);
|
|
11070
|
-
push(copy.rows.network, request.network);
|
|
11071
|
-
return rows;
|
|
11072
|
-
}
|
|
11073
11496
|
function CloseIcon2() {
|
|
11074
11497
|
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
11075
11498
|
}
|
|
@@ -11094,6 +11517,7 @@ function CosignModalTemplate({
|
|
|
11094
11517
|
closesIn = null,
|
|
11095
11518
|
nextStep = null,
|
|
11096
11519
|
language: languageProp,
|
|
11520
|
+
network,
|
|
11097
11521
|
onSelect,
|
|
11098
11522
|
onApprove,
|
|
11099
11523
|
onReject,
|
|
@@ -11106,6 +11530,22 @@ function CosignModalTemplate({
|
|
|
11106
11530
|
const canVote = !!current && verified && !busy && !approveBlocked;
|
|
11107
11531
|
const [verifiedOpenFor, setVerifiedOpenFor] = useState(null);
|
|
11108
11532
|
const verifiedOpen = !!current && verifiedOpenFor === current.id;
|
|
11533
|
+
const reviewOf = (request) => reviewFromRequest(
|
|
11534
|
+
{
|
|
11535
|
+
chain: request.network,
|
|
11536
|
+
network,
|
|
11537
|
+
operation: request.operation,
|
|
11538
|
+
summary: request.summary,
|
|
11539
|
+
details: request.details,
|
|
11540
|
+
signWith: request.account ?? request.signWith,
|
|
11541
|
+
raw: request.unsignedPayload,
|
|
11542
|
+
fallbackTitle: labelOf(request, copy),
|
|
11543
|
+
extraRows: [{ label: copy.expiresIn, value: expiresIn(request, copy) }],
|
|
11544
|
+
appPaysFee: request.appPaysFee
|
|
11545
|
+
},
|
|
11546
|
+
TX_REVIEW_COPY[language]
|
|
11547
|
+
);
|
|
11548
|
+
const review = current ? reviewOf(current) : null;
|
|
11109
11549
|
return /* @__PURE__ */ jsxs(
|
|
11110
11550
|
"div",
|
|
11111
11551
|
{
|
|
@@ -11146,7 +11586,8 @@ function CosignModalTemplate({
|
|
|
11146
11586
|
className: "pollar-copy-btn-sm pollar-cosign-copy"
|
|
11147
11587
|
}
|
|
11148
11588
|
)
|
|
11149
|
-
] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned })
|
|
11589
|
+
] }) : lastResolved.signedXdr ? copy.signedAppSends : copy.nothingSigned }),
|
|
11590
|
+
lastResolved.submit?.sponsored !== void 0 && /* @__PURE__ */ jsx("p", { className: "pollar-cosign-fee", children: /* @__PURE__ */ jsx(TxFeeBadge, { sponsored: lastResolved.submit.sponsored, language }) })
|
|
11150
11591
|
] }) : /* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted", children: copy.nothingWaiting }),
|
|
11151
11592
|
nextStep && /* @__PURE__ */ jsxs("p", { className: "pollar-cosign-next", children: [
|
|
11152
11593
|
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
@@ -11162,14 +11603,14 @@ function CosignModalTemplate({
|
|
|
11162
11603
|
className: `pollar-cosign-item${current?.id === r.id ? " pollar-cosign-item-active" : ""}`,
|
|
11163
11604
|
onClick: () => onSelect(r),
|
|
11164
11605
|
children: [
|
|
11165
|
-
/* @__PURE__ */ jsx("span", { children:
|
|
11606
|
+
/* @__PURE__ */ jsx("span", { children: reviewOf(r).title }),
|
|
11166
11607
|
/* @__PURE__ */ jsx("span", { className: "pollar-cosign-muted", children: expiresIn(r, copy) })
|
|
11167
11608
|
]
|
|
11168
11609
|
}
|
|
11169
11610
|
) }, r.id)) }),
|
|
11170
|
-
current && /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-detail"
|
|
11611
|
+
current && review && /* @__PURE__ */ jsxs("div", { className: `pollar-cosign-detail${pending.length > 1 ? " pollar-cosign-detail-grouped" : ""}`, children: [
|
|
11171
11612
|
/* @__PURE__ */ jsxs("div", { className: "pollar-cosign-detail-head", children: [
|
|
11172
|
-
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-detail-title", children:
|
|
11613
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
|
|
11173
11614
|
!verification && /* @__PURE__ */ jsxs("span", { className: "pollar-cosign-chip", children: [
|
|
11174
11615
|
/* @__PURE__ */ jsx("span", { className: "pollar-spinner pollar-spinner-sm", "aria-hidden": true }),
|
|
11175
11616
|
copy.checking
|
|
@@ -11188,17 +11629,7 @@ function CosignModalTemplate({
|
|
|
11188
11629
|
}
|
|
11189
11630
|
)
|
|
11190
11631
|
] }),
|
|
11191
|
-
|
|
11192
|
-
/* @__PURE__ */ jsxs("dl", { className: "pollar-cosign-rows", children: [
|
|
11193
|
-
detailRows(current, copy).map(([k, v]) => /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-row", children: [
|
|
11194
|
-
/* @__PURE__ */ jsx("dt", { children: k }),
|
|
11195
|
-
/* @__PURE__ */ jsx("dd", { children: v })
|
|
11196
|
-
] }, k)),
|
|
11197
|
-
/* @__PURE__ */ jsxs("div", { className: "pollar-cosign-row", children: [
|
|
11198
|
-
/* @__PURE__ */ jsx("dt", { children: copy.expiresIn }),
|
|
11199
|
-
/* @__PURE__ */ jsx("dd", { children: expiresIn(current, copy) })
|
|
11200
|
-
] })
|
|
11201
|
-
] }),
|
|
11632
|
+
/* @__PURE__ */ jsx(TxReview, { data: review, language }, current.id),
|
|
11202
11633
|
verification?.ok && verifiedOpen && /* @__PURE__ */ jsx("div", { className: "pollar-cosign-verify pollar-cosign-verify-ok", children: copy.checkedAgainstTurnkey }),
|
|
11203
11634
|
verification && !verification.ok && /* @__PURE__ */ jsxs("div", { className: "pollar-cosign-verify pollar-cosign-verify-bad", children: [
|
|
11204
11635
|
copy.notVerified,
|
|
@@ -11344,6 +11775,7 @@ function CosignModal({ nextStep = null, onClose }) {
|
|
|
11344
11775
|
closesIn,
|
|
11345
11776
|
nextStep: awaitingNext ? nextStep : null,
|
|
11346
11777
|
language,
|
|
11778
|
+
network,
|
|
11347
11779
|
explorerUrl: lastResolved?.submit?.hash ? explorerTxUrl(lastResolved.network, lastResolved.submit.hash, network) : null,
|
|
11348
11780
|
onSelect: (r) => setSelectedId(r.id),
|
|
11349
11781
|
onApprove: (r) => void run("approving", r, approve),
|
|
@@ -12102,7 +12534,6 @@ var CONFIRM_COPY = {
|
|
|
12102
12534
|
confirm: "Confirm",
|
|
12103
12535
|
close: "Close",
|
|
12104
12536
|
transaction: "Transaction",
|
|
12105
|
-
rows: { destination: "Destination", amount: "Amount", asset: "Asset", network: "Network" },
|
|
12106
12537
|
operations: {
|
|
12107
12538
|
payment: "Send",
|
|
12108
12539
|
path_payment_strict_send: "Swap",
|
|
@@ -12120,7 +12551,6 @@ var CONFIRM_COPY = {
|
|
|
12120
12551
|
confirm: "Confirmar",
|
|
12121
12552
|
close: "Cerrar",
|
|
12122
12553
|
transaction: "Transacci\xF3n",
|
|
12123
|
-
rows: { destination: "Destino", amount: "Monto", asset: "Activo", network: "Red" },
|
|
12124
12554
|
operations: {
|
|
12125
12555
|
payment: "Enviar",
|
|
12126
12556
|
path_payment_strict_send: "Intercambiar",
|
|
@@ -12138,7 +12568,6 @@ var CONFIRM_COPY = {
|
|
|
12138
12568
|
confirm: "Confirmar",
|
|
12139
12569
|
close: "Fechar",
|
|
12140
12570
|
transaction: "Transa\xE7\xE3o",
|
|
12141
|
-
rows: { destination: "Destino", amount: "Valor", asset: "Ativo", network: "Rede" },
|
|
12142
12571
|
operations: {
|
|
12143
12572
|
payment: "Enviar",
|
|
12144
12573
|
path_payment_strict_send: "Trocar",
|
|
@@ -12154,26 +12583,26 @@ function labelOf2(confirmation, copy) {
|
|
|
12154
12583
|
const op = confirmation.operation ?? "";
|
|
12155
12584
|
return copy.operations[op] ?? (op ? op.replace(/_/g, " ") : copy.transaction);
|
|
12156
12585
|
}
|
|
12157
|
-
function detailRows2(confirmation, copy) {
|
|
12158
|
-
const details = confirmation.details ?? {};
|
|
12159
|
-
const rows = [];
|
|
12160
|
-
const push = (label, value) => {
|
|
12161
|
-
if (value === void 0 || value === null || value === "") return;
|
|
12162
|
-
const text = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
12163
|
-
rows.push([label, /^[GC][A-Z2-7]{55}$/.test(text) ? cropAddress(text) : text]);
|
|
12164
|
-
};
|
|
12165
|
-
push(copy.rows.destination, details.destination);
|
|
12166
|
-
push(copy.rows.amount, details.amount);
|
|
12167
|
-
push(copy.rows.asset, details.asset ?? details.assetCode ?? details.mint);
|
|
12168
|
-
push(copy.rows.network, confirmation.network);
|
|
12169
|
-
return rows;
|
|
12170
|
-
}
|
|
12171
12586
|
function CloseIcon4() {
|
|
12172
12587
|
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "m3 3 8 8M11 3l-8 8", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round" }) });
|
|
12173
12588
|
}
|
|
12174
12589
|
function ConfirmModal({ confirmation }) {
|
|
12175
|
-
const { getClient, styles } = usePollar();
|
|
12176
|
-
const
|
|
12590
|
+
const { getClient, styles, network } = usePollar();
|
|
12591
|
+
const language = useModalLanguage();
|
|
12592
|
+
const copy = CONFIRM_COPY[language];
|
|
12593
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
12594
|
+
const raw = confirmation.unsignedXdr ?? confirmation.authEntryXdr;
|
|
12595
|
+
const review = confirmation.buildData ? reviewFromBuild(confirmation.buildData, reviewCopy, labelOf2(confirmation, copy)) : reviewFromRequest(
|
|
12596
|
+
{
|
|
12597
|
+
chain: confirmation.network,
|
|
12598
|
+
network,
|
|
12599
|
+
operation: confirmation.operation,
|
|
12600
|
+
details: confirmation.details,
|
|
12601
|
+
raw,
|
|
12602
|
+
fallbackTitle: labelOf2(confirmation, copy)
|
|
12603
|
+
},
|
|
12604
|
+
reviewCopy
|
|
12605
|
+
);
|
|
12177
12606
|
const { theme, accentColor, styleOverrides, overlayStyle } = modalChrome(styles);
|
|
12178
12607
|
const cssVars = buildModalCssVars(theme, accentColor, styleOverrides);
|
|
12179
12608
|
const rejectRef = useRef(confirmation.reject);
|
|
@@ -12206,15 +12635,12 @@ function ConfirmModal({ confirmation }) {
|
|
|
12206
12635
|
) })
|
|
12207
12636
|
] }),
|
|
12208
12637
|
/* @__PURE__ */ jsxs("div", { className: "pollar-cosign-detail", children: [
|
|
12209
|
-
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-detail-title", children:
|
|
12638
|
+
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-detail-title", children: review.title }),
|
|
12210
12639
|
/* @__PURE__ */ jsx("p", { className: "pollar-cosign-muted", children: copy.intro }),
|
|
12211
|
-
/* @__PURE__ */ jsx(
|
|
12212
|
-
/* @__PURE__ */ jsx("dt", { children: k }),
|
|
12213
|
-
/* @__PURE__ */ jsx("dd", { children: v })
|
|
12214
|
-
] }, k)) }),
|
|
12640
|
+
/* @__PURE__ */ jsx(TxReview, { data: review, language }),
|
|
12215
12641
|
/* @__PURE__ */ jsxs("div", { className: "pollar-cosign-actions", children: [
|
|
12216
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children:
|
|
12217
|
-
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children:
|
|
12642
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-secondary", onClick: confirmation.reject, children: copy.cancel }),
|
|
12643
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "pollar-cosign-btn pollar-cosign-btn-primary", onClick: confirmation.confirm, children: copy.confirm })
|
|
12218
12644
|
] })
|
|
12219
12645
|
] }),
|
|
12220
12646
|
/* @__PURE__ */ jsx(PollarModalFooter, {})
|