@pollar/react 0.12.1-rc.13 → 0.12.1-rc.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +43 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +355 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +355 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1286,7 +1286,7 @@ var PollarModalFooter = ({ language: languageProp }) => {
|
|
|
1286
1286
|
/* @__PURE__ */ jsxRuntime.jsx("img", { src: LOGO_POLLAR_WORDMARK_ON_DARK, alt: "Pollar", className: "pollar-footer-logo pollar-logo-on-dark" }),
|
|
1287
1287
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-footer-version", children: [
|
|
1288
1288
|
"v",
|
|
1289
|
-
"0.12.1-rc.
|
|
1289
|
+
"0.12.1-rc.14"
|
|
1290
1290
|
] })
|
|
1291
1291
|
] });
|
|
1292
1292
|
};
|
|
@@ -4680,6 +4680,7 @@ function AmountField({
|
|
|
4680
4680
|
value,
|
|
4681
4681
|
onChange,
|
|
4682
4682
|
unit,
|
|
4683
|
+
unitIcon,
|
|
4683
4684
|
available,
|
|
4684
4685
|
onMax,
|
|
4685
4686
|
placeholder = "0.00",
|
|
@@ -4727,6 +4728,7 @@ function AmountField({
|
|
|
4727
4728
|
children: copy.max
|
|
4728
4729
|
}
|
|
4729
4730
|
),
|
|
4731
|
+
unitIcon,
|
|
4730
4732
|
unit && /* @__PURE__ */ jsxRuntime.jsx("span", { children: unit })
|
|
4731
4733
|
] })
|
|
4732
4734
|
] })
|
|
@@ -7080,11 +7082,24 @@ var TX_REVIEW_COPY = {
|
|
|
7080
7082
|
payment: (amount, to) => `Pay ${amount} to ${to}`,
|
|
7081
7083
|
createAccount: "Create an account"
|
|
7082
7084
|
},
|
|
7085
|
+
earn: {
|
|
7086
|
+
deposit: "Deposit",
|
|
7087
|
+
withdraw: "Withdraw",
|
|
7088
|
+
depositInto: (target) => `Deposit into ${target}`,
|
|
7089
|
+
withdrawFrom: (source) => `Withdraw from ${source}`,
|
|
7090
|
+
depositAmount: (amount) => `Deposit ${amount}`,
|
|
7091
|
+
withdrawAmount: (amount) => `Withdraw ${amount}`,
|
|
7092
|
+
fallbackName: "Earn",
|
|
7093
|
+
deposited: (amount, target, chain) => `Deposited ${amount} into the ${target} on ${chain}`,
|
|
7094
|
+
withdrew: (amount, source, chain) => `Withdrew ${amount} from the ${source} on ${chain}`,
|
|
7095
|
+
depositedOn: (amount, chain) => `Deposited ${amount} on ${chain}`,
|
|
7096
|
+
withdrewOn: (amount, chain) => `Withdrew ${amount} on ${chain}`
|
|
7097
|
+
},
|
|
7083
7098
|
yourWallet: "Your wallet",
|
|
7084
7099
|
newAccount: "New account",
|
|
7085
7100
|
atLeast: "at least",
|
|
7086
7101
|
approveNote: "This only gives permission. Nothing moves yet.",
|
|
7087
|
-
feeSponsored: "
|
|
7102
|
+
feeSponsored: "The app pays the network fee",
|
|
7088
7103
|
feePaid: "You pay the network fee",
|
|
7089
7104
|
showDetails: "Show details",
|
|
7090
7105
|
hideDetails: "Hide details",
|
|
@@ -7099,6 +7114,9 @@ var TX_REVIEW_COPY = {
|
|
|
7099
7114
|
via: "Via",
|
|
7100
7115
|
fee: "Network fee",
|
|
7101
7116
|
feeCovered: "Covered by the app",
|
|
7117
|
+
feeWallet: "Paid by your wallet",
|
|
7118
|
+
opportunity: "Opportunity",
|
|
7119
|
+
apy: "APY after fees",
|
|
7102
7120
|
contract: "Contract",
|
|
7103
7121
|
method: "Method",
|
|
7104
7122
|
asset: "Asset",
|
|
@@ -7119,11 +7137,24 @@ var TX_REVIEW_COPY = {
|
|
|
7119
7137
|
payment: (amount, to) => `Pagar ${amount} a ${to}`,
|
|
7120
7138
|
createAccount: "Crear una cuenta"
|
|
7121
7139
|
},
|
|
7140
|
+
earn: {
|
|
7141
|
+
deposit: "Depositar",
|
|
7142
|
+
withdraw: "Retirar",
|
|
7143
|
+
depositInto: (target) => `Depositar en ${target}`,
|
|
7144
|
+
withdrawFrom: (source) => `Retirar de ${source}`,
|
|
7145
|
+
depositAmount: (amount) => `Depositar ${amount}`,
|
|
7146
|
+
withdrawAmount: (amount) => `Retirar ${amount}`,
|
|
7147
|
+
fallbackName: "Rendimientos",
|
|
7148
|
+
deposited: (amount, target, chain) => `Depositaste ${amount} en ${target}, en ${chain}`,
|
|
7149
|
+
withdrew: (amount, source, chain) => `Retiraste ${amount} de ${source}, en ${chain}`,
|
|
7150
|
+
depositedOn: (amount, chain) => `Depositaste ${amount} en ${chain}`,
|
|
7151
|
+
withdrewOn: (amount, chain) => `Retiraste ${amount} en ${chain}`
|
|
7152
|
+
},
|
|
7122
7153
|
yourWallet: "Tu billetera",
|
|
7123
7154
|
newAccount: "Cuenta nueva",
|
|
7124
7155
|
atLeast: "al menos",
|
|
7125
7156
|
approveNote: "Solo das permiso. Todav\xEDa no se mueve nada.",
|
|
7126
|
-
feeSponsored: "La app
|
|
7157
|
+
feeSponsored: "La app paga la comisi\xF3n de red",
|
|
7127
7158
|
feePaid: "T\xFA pagas la comisi\xF3n de red",
|
|
7128
7159
|
showDetails: "Ver detalles",
|
|
7129
7160
|
hideDetails: "Ocultar detalles",
|
|
@@ -7138,6 +7169,9 @@ var TX_REVIEW_COPY = {
|
|
|
7138
7169
|
via: "V\xEDa",
|
|
7139
7170
|
fee: "Comisi\xF3n de red",
|
|
7140
7171
|
feeCovered: "La cubre la app",
|
|
7172
|
+
feeWallet: "La paga tu billetera",
|
|
7173
|
+
opportunity: "Oportunidad",
|
|
7174
|
+
apy: "APY despu\xE9s de comisiones",
|
|
7141
7175
|
contract: "Contrato",
|
|
7142
7176
|
method: "M\xE9todo",
|
|
7143
7177
|
asset: "Activo",
|
|
@@ -7158,11 +7192,24 @@ var TX_REVIEW_COPY = {
|
|
|
7158
7192
|
payment: (amount, to) => `Pagar ${amount} para ${to}`,
|
|
7159
7193
|
createAccount: "Criar uma conta"
|
|
7160
7194
|
},
|
|
7195
|
+
earn: {
|
|
7196
|
+
deposit: "Depositar",
|
|
7197
|
+
withdraw: "Sacar",
|
|
7198
|
+
depositInto: (target) => `Depositar em ${target}`,
|
|
7199
|
+
withdrawFrom: (source) => `Sacar de ${source}`,
|
|
7200
|
+
depositAmount: (amount) => `Depositar ${amount}`,
|
|
7201
|
+
withdrawAmount: (amount) => `Sacar ${amount}`,
|
|
7202
|
+
fallbackName: "Rendimentos",
|
|
7203
|
+
deposited: (amount, target, chain) => `Voc\xEA depositou ${amount} em ${target}, na ${chain}`,
|
|
7204
|
+
withdrew: (amount, source, chain) => `Voc\xEA sacou ${amount} de ${source}, na ${chain}`,
|
|
7205
|
+
depositedOn: (amount, chain) => `Voc\xEA depositou ${amount} na ${chain}`,
|
|
7206
|
+
withdrewOn: (amount, chain) => `Voc\xEA sacou ${amount} na ${chain}`
|
|
7207
|
+
},
|
|
7161
7208
|
yourWallet: "Sua carteira",
|
|
7162
7209
|
newAccount: "Conta nova",
|
|
7163
7210
|
atLeast: "pelo menos",
|
|
7164
7211
|
approveNote: "Isto s\xF3 d\xE1 permiss\xE3o. Nada se move ainda.",
|
|
7165
|
-
feeSponsored: "O app
|
|
7212
|
+
feeSponsored: "O app paga a taxa de rede",
|
|
7166
7213
|
feePaid: "Voc\xEA paga a taxa de rede",
|
|
7167
7214
|
showDetails: "Ver detalhes",
|
|
7168
7215
|
hideDetails: "Ocultar detalhes",
|
|
@@ -7177,6 +7224,9 @@ var TX_REVIEW_COPY = {
|
|
|
7177
7224
|
via: "Via",
|
|
7178
7225
|
fee: "Taxa de rede",
|
|
7179
7226
|
feeCovered: "Coberta pelo app",
|
|
7227
|
+
feeWallet: "Paga pela sua carteira",
|
|
7228
|
+
opportunity: "Oportunidade",
|
|
7229
|
+
apy: "APY ap\xF3s taxas",
|
|
7180
7230
|
contract: "Contrato",
|
|
7181
7231
|
method: "M\xE9todo",
|
|
7182
7232
|
asset: "Ativo",
|
|
@@ -7242,7 +7292,7 @@ function rampFlow(details) {
|
|
|
7242
7292
|
return out;
|
|
7243
7293
|
};
|
|
7244
7294
|
const from = { ...party(flow.from), self: true };
|
|
7245
|
-
const to = { ...party(flow.to), self: kind === "bridge" || kind === "swap" };
|
|
7295
|
+
const to = { ...party(flow.to), self: (kind === "bridge" || kind === "swap") && !flow.to.label };
|
|
7246
7296
|
return { kind, from, to, via: asString(flow.via) };
|
|
7247
7297
|
}
|
|
7248
7298
|
function readableAmount(details) {
|
|
@@ -7254,8 +7304,83 @@ function readableAmount(details) {
|
|
|
7254
7304
|
return null;
|
|
7255
7305
|
}
|
|
7256
7306
|
}
|
|
7307
|
+
var earnOpportunities = /* @__PURE__ */ new Map();
|
|
7308
|
+
function rememberEarnOpportunities(list) {
|
|
7309
|
+
for (const o of list) {
|
|
7310
|
+
earnOpportunities.set(o.id, {
|
|
7311
|
+
name: o.name,
|
|
7312
|
+
...o.asset?.code ? { asset: o.asset.code } : {},
|
|
7313
|
+
...typeof o.apy === "number" ? { apy: o.apy } : {}
|
|
7314
|
+
});
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
function earnOpportunityLabel(id) {
|
|
7318
|
+
return id ? earnOpportunities.get(id) : void 0;
|
|
7319
|
+
}
|
|
7320
|
+
function reviewForEarn(parts, copy) {
|
|
7321
|
+
const deposit = parts.action === "deposit";
|
|
7322
|
+
const asset = parts.asset ? { asset: parts.asset } : {};
|
|
7323
|
+
const wallet = { chain: parts.chain, self: true, ...asset, ...parts.wallet ? { address: parts.wallet } : {} };
|
|
7324
|
+
const opportunity = { chain: parts.chain, label: parts.name ?? copy.earn.fallbackName, ...asset };
|
|
7325
|
+
const amount = parts.amount ? { amount: parts.amount } : {};
|
|
7326
|
+
const from = deposit ? { ...wallet, ...amount } : { ...opportunity, ...amount };
|
|
7327
|
+
const to = deposit ? opportunity : wallet;
|
|
7328
|
+
const moved = withAsset(from);
|
|
7329
|
+
const rows = [];
|
|
7330
|
+
if (parts.name) rows.push({ label: copy.rows.opportunity, value: parts.name });
|
|
7331
|
+
if (typeof parts.apy === "number") rows.push({ label: copy.rows.apy, value: `${parts.apy.toFixed(2)}%` });
|
|
7332
|
+
if (parts.amount) rows.push({ label: copy.rows.amount, value: moved });
|
|
7333
|
+
rows.push({ label: copy.rows.network, value: [copy.chains[parts.chain], parts.network].filter(Boolean).join(" ") });
|
|
7334
|
+
const walletRow = partyRow(deposit ? copy.rows.from : copy.rows.to, wallet, copy);
|
|
7335
|
+
if (walletRow) rows.push(walletRow);
|
|
7336
|
+
if (parts.sponsored !== void 0)
|
|
7337
|
+
rows.push({ label: copy.rows.fee, value: parts.sponsored ? copy.rows.feeCovered : copy.rows.feeWallet });
|
|
7338
|
+
rows.push(...parts.extraRows ?? []);
|
|
7339
|
+
const title = parts.name ? deposit ? copy.earn.depositInto(parts.name) : copy.earn.withdrawFrom(parts.name) : parts.amount ? deposit ? copy.earn.depositAmount(moved) : copy.earn.withdrawAmount(moved) : deposit ? copy.earn.deposit : copy.earn.withdraw;
|
|
7340
|
+
return {
|
|
7341
|
+
title,
|
|
7342
|
+
kind: deposit ? "deposit" : "withdraw",
|
|
7343
|
+
from,
|
|
7344
|
+
to,
|
|
7345
|
+
...parts.sponsored !== void 0 ? { fee: { sponsored: parts.sponsored } } : {},
|
|
7346
|
+
rows,
|
|
7347
|
+
...parts.raw ? { raw: parts.raw } : {},
|
|
7348
|
+
...parts.hash ? { hash: parts.hash } : {}
|
|
7349
|
+
};
|
|
7350
|
+
}
|
|
7351
|
+
function earnOutcome(parts, copy) {
|
|
7352
|
+
const moved = [parts.amount, parts.asset].filter(Boolean).join(" ");
|
|
7353
|
+
const chain = copy.chains[parts.chain];
|
|
7354
|
+
if (parts.action === "deposit") {
|
|
7355
|
+
return parts.name ? copy.earn.deposited(moved, parts.name, chain) : copy.earn.depositedOn(moved, chain);
|
|
7356
|
+
}
|
|
7357
|
+
return parts.name ? copy.earn.withdrew(moved, parts.name, chain) : copy.earn.withdrewOn(moved, chain);
|
|
7358
|
+
}
|
|
7257
7359
|
function reviewFromRequest(parts, copy) {
|
|
7258
7360
|
const details = parts.details ?? {};
|
|
7361
|
+
const earnAction = parts.operation === "earn_deposit" ? "deposit" : parts.operation === "earn_withdraw" ? "withdraw" : null;
|
|
7362
|
+
if (earnAction) {
|
|
7363
|
+
const known = earnOpportunityLabel(asString(details.opportunityId) ?? asString(details.opportunity));
|
|
7364
|
+
const feePayer = asString(details.feePayer);
|
|
7365
|
+
const sponsored = typeof details.sponsored === "boolean" ? details.sponsored : feePayer && parts.signWith ? feePayer !== parts.signWith : parts.appPaysFee;
|
|
7366
|
+
return reviewForEarn(
|
|
7367
|
+
{
|
|
7368
|
+
action: earnAction,
|
|
7369
|
+
chain: parts.chain,
|
|
7370
|
+
network: parts.network,
|
|
7371
|
+
amount: asString(details.amount),
|
|
7372
|
+
asset: asString(details.assetCode) ?? known?.asset,
|
|
7373
|
+
name: known?.name,
|
|
7374
|
+
apy: known?.apy,
|
|
7375
|
+
wallet: parts.signWith,
|
|
7376
|
+
sponsored,
|
|
7377
|
+
raw: parts.raw,
|
|
7378
|
+
hash: parts.hash,
|
|
7379
|
+
...parts.extraRows ? { extraRows: parts.extraRows } : {}
|
|
7380
|
+
},
|
|
7381
|
+
copy
|
|
7382
|
+
);
|
|
7383
|
+
}
|
|
7259
7384
|
const flow = rampFlow(details);
|
|
7260
7385
|
const rows = [];
|
|
7261
7386
|
let data;
|
|
@@ -7409,11 +7534,26 @@ function ChainBadge({ chain, copy }) {
|
|
|
7409
7534
|
if (!chain) return null;
|
|
7410
7535
|
return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-chain", src: CHAIN_LOGOS[chain], alt: copy.chains[chain], title: copy.chains[chain] });
|
|
7411
7536
|
}
|
|
7412
|
-
function AssetLogo({ asset }) {
|
|
7537
|
+
function AssetLogo({ asset, small = false }) {
|
|
7413
7538
|
const url = TOKEN_LOGOS[asset.toUpperCase()];
|
|
7414
7539
|
const [failed, setFailed] = react.useState(false);
|
|
7415
|
-
|
|
7416
|
-
return /* @__PURE__ */ jsxRuntime.jsx("
|
|
7540
|
+
const size = small ? " pollar-txr-logo-sm" : "";
|
|
7541
|
+
if (url && !failed) return /* @__PURE__ */ jsxRuntime.jsx("img", { className: `pollar-txr-logo${size}`, src: url, alt: asset, onError: () => setFailed(true) });
|
|
7542
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: `pollar-txr-logo pollar-txr-logo-initial${size}`, "aria-hidden": true, children: asset.slice(0, 1).toUpperCase() });
|
|
7543
|
+
}
|
|
7544
|
+
function ChainLogo({ chain }) {
|
|
7545
|
+
return /* @__PURE__ */ jsxRuntime.jsx("img", { className: "pollar-txr-chain-inline", src: CHAIN_LOGOS[chain], alt: "", "aria-hidden": true });
|
|
7546
|
+
}
|
|
7547
|
+
function TxExplorerLink({
|
|
7548
|
+
chain,
|
|
7549
|
+
url,
|
|
7550
|
+
language: languageProp
|
|
7551
|
+
}) {
|
|
7552
|
+
const copy = TX_REVIEW_COPY[useInheritedLanguage(languageProp)];
|
|
7553
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("a", { className: "pollar-txr-link pollar-txr-explorer", href: url, target: "_blank", rel: "noopener noreferrer", children: [
|
|
7554
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChainLogo, { chain }),
|
|
7555
|
+
copy.viewOnExplorer
|
|
7556
|
+
] });
|
|
7417
7557
|
}
|
|
7418
7558
|
function AccountGlyph() {
|
|
7419
7559
|
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: [
|
|
@@ -7498,7 +7638,7 @@ function TxReview({ data, open: openProp, onToggle, language: languageProp }) {
|
|
|
7498
7638
|
const toggle = onToggle ?? (() => setOpenState((v) => !v));
|
|
7499
7639
|
const { from, to, kind } = data;
|
|
7500
7640
|
const toShowsAmount = !!to?.amount && (to.amount !== from?.amount || to.asset !== from?.asset);
|
|
7501
|
-
const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" ? "asset" : "account";
|
|
7641
|
+
const toGlyph = kind === "approve" ? "contract" : kind === "bridge" || kind === "swap" || kind === "deposit" || kind === "withdraw" ? "asset" : "account";
|
|
7502
7642
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr", children: [
|
|
7503
7643
|
from && to && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-txr-flow", children: [
|
|
7504
7644
|
/* @__PURE__ */ jsxRuntime.jsx(Node2, { party: from, showAmount: true, glyph: from.asset ? "asset" : "account", copy }),
|
|
@@ -7659,7 +7799,10 @@ function TxStatusView({
|
|
|
7659
7799
|
onToggleXdr,
|
|
7660
7800
|
onRetry,
|
|
7661
7801
|
onDone,
|
|
7662
|
-
language: languageProp
|
|
7802
|
+
language: languageProp,
|
|
7803
|
+
review: reviewProp,
|
|
7804
|
+
successMessage,
|
|
7805
|
+
successExtra
|
|
7663
7806
|
}) {
|
|
7664
7807
|
const language = useInheritedLanguage(languageProp);
|
|
7665
7808
|
const copy = TRANSACTION_COPY[language];
|
|
@@ -7674,19 +7817,23 @@ function TxStatusView({
|
|
|
7674
7817
|
const reviewCopy = TX_REVIEW_COPY[language];
|
|
7675
7818
|
const hashInfo = hash ? { value: hash, explorerUrl } : void 0;
|
|
7676
7819
|
const sponsored = "sponsored" in transaction ? transaction.sponsored : void 0;
|
|
7677
|
-
const review =
|
|
7820
|
+
const review = reviewProp ? {
|
|
7821
|
+
...reviewProp,
|
|
7822
|
+
...hashInfo && { hash: hashInfo },
|
|
7823
|
+
...sponsored !== void 0 && { fee: { sponsored } }
|
|
7824
|
+
} : buildData ? reviewFromBuild(buildData, reviewCopy, copy.title, hashInfo, sponsored) : hashInfo ? { title: copy.title, kind: "other", rows: [], hash: hashInfo, ...sponsored !== void 0 && { fee: { sponsored } } } : null;
|
|
7678
7825
|
const walletImg = walletType === core.WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === core.WalletType.ALBEDO ? LOGO_ALBEDO : null;
|
|
7679
7826
|
const walletAlt = walletType === core.WalletType.FREIGHTER ? "Freighter" : walletType === core.WalletType.ALBEDO ? "Albedo" : "Pollar";
|
|
7680
7827
|
const statusBanner = /* @__PURE__ */ jsxRuntime.jsx(
|
|
7681
7828
|
ModalStatusBanner,
|
|
7682
7829
|
{
|
|
7683
|
-
message: copy.status[transaction.step],
|
|
7830
|
+
message: isSuccess && successMessage ? successMessage : copy.status[transaction.step],
|
|
7684
7831
|
status: isError ? "ERROR" : isInFlight ? "LOADING" : isSuccess ? "SUCCESS" : "NONE"
|
|
7685
7832
|
}
|
|
7686
7833
|
);
|
|
7687
7834
|
const showSpinner = isInFlight || isSuccess || isError;
|
|
7688
7835
|
const reviewBlock = showDetails && review && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-tx-review", children: [
|
|
7689
|
-
buildData && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-review-title", children: review.title }),
|
|
7836
|
+
(buildData || reviewProp) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-tx-review-title", children: review.title }),
|
|
7690
7837
|
/* @__PURE__ */ jsxRuntime.jsx(TxReview, { data: review, open: showXdr, onToggle: onToggleXdr, language })
|
|
7691
7838
|
] });
|
|
7692
7839
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -7736,6 +7883,7 @@ function TxStatusView({
|
|
|
7736
7883
|
isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: copy.tryAgain })
|
|
7737
7884
|
] }),
|
|
7738
7885
|
isSuccess && reviewBlock,
|
|
7886
|
+
isSuccess && successExtra,
|
|
7739
7887
|
isSuccess && /* @__PURE__ */ jsxRuntime.jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: copy.done }),
|
|
7740
7888
|
!showSpinner && statusBanner
|
|
7741
7889
|
] });
|
|
@@ -10295,7 +10443,11 @@ var EARN_COPY = {
|
|
|
10295
10443
|
apyAfterFees: "APY after fees",
|
|
10296
10444
|
profit: "Earned after fees",
|
|
10297
10445
|
stale: "Last known figures; they refresh on their own.",
|
|
10298
|
-
actionUnavailable: (action) => `This opportunity does not take ${action === "deposit" ? "deposits" : "withdrawals"} right now
|
|
10446
|
+
actionUnavailable: (action) => `This opportunity does not take ${action === "deposit" ? "deposits" : "withdrawals"} right now.`,
|
|
10447
|
+
deposited: "Deposited",
|
|
10448
|
+
depositDone: "Deposit complete",
|
|
10449
|
+
withdrawDone: "Withdrawal complete",
|
|
10450
|
+
positionNow: "Your position now"
|
|
10299
10451
|
},
|
|
10300
10452
|
es: {
|
|
10301
10453
|
title: "Rendimientos",
|
|
@@ -10336,7 +10488,11 @@ var EARN_COPY = {
|
|
|
10336
10488
|
apyAfterFees: "APY despu\xE9s de comisiones",
|
|
10337
10489
|
profit: "Ganado despu\xE9s de comisiones",
|
|
10338
10490
|
stale: "\xDAltimas cifras conocidas; se actualizan solas.",
|
|
10339
|
-
actionUnavailable: (action) => `Esta oportunidad no acepta ${action === "deposit" ? "dep\xF3sitos" : "retiros"} en este momento
|
|
10491
|
+
actionUnavailable: (action) => `Esta oportunidad no acepta ${action === "deposit" ? "dep\xF3sitos" : "retiros"} en este momento.`,
|
|
10492
|
+
deposited: "Depositado",
|
|
10493
|
+
depositDone: "Dep\xF3sito completado",
|
|
10494
|
+
withdrawDone: "Retiro completado",
|
|
10495
|
+
positionNow: "Tu posici\xF3n ahora"
|
|
10340
10496
|
},
|
|
10341
10497
|
pt: {
|
|
10342
10498
|
title: "Rendimentos",
|
|
@@ -10377,7 +10533,11 @@ var EARN_COPY = {
|
|
|
10377
10533
|
apyAfterFees: "APY ap\xF3s taxas",
|
|
10378
10534
|
profit: "Ganho ap\xF3s taxas",
|
|
10379
10535
|
stale: "\xDAltimos valores conhecidos; eles se atualizam sozinhos.",
|
|
10380
|
-
actionUnavailable: (action) => `Esta oportunidade n\xE3o aceita ${action === "deposit" ? "dep\xF3sitos" : "saques"} no momento
|
|
10536
|
+
actionUnavailable: (action) => `Esta oportunidade n\xE3o aceita ${action === "deposit" ? "dep\xF3sitos" : "saques"} no momento.`,
|
|
10537
|
+
deposited: "Depositado",
|
|
10538
|
+
depositDone: "Dep\xF3sito conclu\xEDdo",
|
|
10539
|
+
withdrawDone: "Saque conclu\xEDdo",
|
|
10540
|
+
positionNow: "Sua posi\xE7\xE3o agora"
|
|
10381
10541
|
}
|
|
10382
10542
|
};
|
|
10383
10543
|
var POSITION_POLL_MS = 1e4;
|
|
@@ -10397,6 +10557,38 @@ function formatAmount3(value) {
|
|
|
10397
10557
|
const n = parseFloat(value);
|
|
10398
10558
|
return isNaN(n) ? value : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
|
|
10399
10559
|
}
|
|
10560
|
+
function PositionCard({
|
|
10561
|
+
copy,
|
|
10562
|
+
assetCode,
|
|
10563
|
+
name,
|
|
10564
|
+
apy,
|
|
10565
|
+
apyLabel,
|
|
10566
|
+
rows,
|
|
10567
|
+
stale
|
|
10568
|
+
}) {
|
|
10569
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote pollar-earn-card", children: [
|
|
10570
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-earn-card-head", children: [
|
|
10571
|
+
assetCode && /* @__PURE__ */ jsxRuntime.jsx(AssetLogo, { asset: assetCode, small: true }),
|
|
10572
|
+
/* @__PURE__ */ jsxRuntime.jsx("strong", { className: "pollar-earn-card-name", children: name }),
|
|
10573
|
+
typeof apy === "number" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
|
|
10574
|
+
apy.toFixed(2),
|
|
10575
|
+
"% APY"
|
|
10576
|
+
] })
|
|
10577
|
+
] }),
|
|
10578
|
+
rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
10579
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: row.label }),
|
|
10580
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: row.value == null ? "..." : `${formatAmount3(row.value)} ${assetCode}`.trim() })
|
|
10581
|
+
] }, row.label)),
|
|
10582
|
+
typeof apy === "number" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
10583
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: apyLabel }),
|
|
10584
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
|
|
10585
|
+
apy.toFixed(2),
|
|
10586
|
+
"%"
|
|
10587
|
+
] })
|
|
10588
|
+
] }),
|
|
10589
|
+
stale && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: copy.stale })
|
|
10590
|
+
] });
|
|
10591
|
+
}
|
|
10400
10592
|
function EarnModal({ onClose, initial }) {
|
|
10401
10593
|
const {
|
|
10402
10594
|
getEarnProviders,
|
|
@@ -10411,6 +10603,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
10411
10603
|
earnSolanaWithdraw,
|
|
10412
10604
|
tx: transaction,
|
|
10413
10605
|
wallet,
|
|
10606
|
+
wallets,
|
|
10414
10607
|
refreshWalletBalance,
|
|
10415
10608
|
enabledAssets,
|
|
10416
10609
|
refreshAssets,
|
|
@@ -10418,7 +10611,9 @@ function EarnModal({ onClose, initial }) {
|
|
|
10418
10611
|
network,
|
|
10419
10612
|
styles
|
|
10420
10613
|
} = usePollar();
|
|
10421
|
-
const
|
|
10614
|
+
const language = useModalLanguage();
|
|
10615
|
+
const copy = EARN_COPY[language];
|
|
10616
|
+
const reviewCopy = TX_REVIEW_COPY[language];
|
|
10422
10617
|
const walletType = wallet?.custody === "external" ? wallet.provider : null;
|
|
10423
10618
|
const [earnChain, setEarnChain] = react.useState(
|
|
10424
10619
|
() => oneOf(["STELLAR", "SOLANA"], initial?.chain) ?? "STELLAR"
|
|
@@ -10443,6 +10638,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
10443
10638
|
const [formError, setFormError] = react.useState("");
|
|
10444
10639
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
10445
10640
|
const [showXdr, setShowXdr] = react.useState(false);
|
|
10641
|
+
const [submission, setSubmission] = react.useState(null);
|
|
10446
10642
|
const [copied, setCopied] = react.useState(false);
|
|
10447
10643
|
const copyTimerRef = react.useRef(null);
|
|
10448
10644
|
const loadProviders = react.useCallback(() => {
|
|
@@ -10554,7 +10750,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
10554
10750
|
const explorerUrl = !hash ? null : onSolana ? `https://solscan.io/tx/${hash}${network === "testnet" ? "?cluster=devnet" : ""}` : `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}`;
|
|
10555
10751
|
const isInProgress = IN_FLIGHT_STEPS2.includes(transaction.step);
|
|
10556
10752
|
const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
|
|
10557
|
-
const txTitle = isInProgress ? tab === "deposit" ? copy.depositing : copy.withdrawing : transaction.step === "success" ? copy.
|
|
10753
|
+
const txTitle = isInProgress ? tab === "deposit" ? copy.depositing : copy.withdrawing : transaction.step === "success" ? tab === "deposit" ? copy.depositDone : copy.withdrawDone : transaction.step === "error" ? tab === "deposit" ? copy.depositFailed : copy.withdrawFailed : copy.confirm;
|
|
10558
10754
|
const parsedAmount = parseFloat(amount);
|
|
10559
10755
|
const exceedsAvailable = tab === "deposit" ? walletAvailable != null && parsedAmount > parseFloat(walletAvailable) : withdrawable != null && parsedAmount > parseFloat(withdrawable);
|
|
10560
10756
|
const canSubmit = !smartUnsupported && (onSolana || !!provider) && !actionUnavailable && !!opportunityId && !!amount && parsedAmount > 0 && !exceedsAvailable && !providersLoading && !loadingOpps;
|
|
@@ -10586,6 +10782,16 @@ function EarnModal({ onClose, initial }) {
|
|
|
10586
10782
|
setFormError(copy.exceedsPosition);
|
|
10587
10783
|
return;
|
|
10588
10784
|
}
|
|
10785
|
+
const chosen = onSolana ? selectedSolana : selectedOpportunity;
|
|
10786
|
+
setSubmission({
|
|
10787
|
+
action: tab,
|
|
10788
|
+
chain: earnChain,
|
|
10789
|
+
amount,
|
|
10790
|
+
// A DeFindex withdrawal is counted in shares, not in the asset.
|
|
10791
|
+
asset: tab === "withdraw" && withdrawUnit === "shares" ? copy.shares : assetCode,
|
|
10792
|
+
name: chosen?.name,
|
|
10793
|
+
apy: onSolana ? solanaPosition?.apy ?? selectedSolana?.apy ?? void 0 : selectedOpportunity?.apy
|
|
10794
|
+
});
|
|
10589
10795
|
setStep("tx");
|
|
10590
10796
|
if (tab === "deposit" && depositNeedsTrustline && selectedOpportunity?.asset.issuer) {
|
|
10591
10797
|
const tl = await setTrustline({ code: assetCode, issuer: selectedOpportunity.asset.issuer });
|
|
@@ -10599,6 +10805,8 @@ function EarnModal({ onClose, initial }) {
|
|
|
10599
10805
|
const outcome = await runEarn();
|
|
10600
10806
|
if (outcome && (outcome.status === "success" || outcome.status === "pending")) {
|
|
10601
10807
|
setAmount("");
|
|
10808
|
+
setPosition(null);
|
|
10809
|
+
setSolanaPosition(null);
|
|
10602
10810
|
refreshPosition();
|
|
10603
10811
|
}
|
|
10604
10812
|
}
|
|
@@ -10653,6 +10861,44 @@ function EarnModal({ onClose, initial }) {
|
|
|
10653
10861
|
}
|
|
10654
10862
|
}
|
|
10655
10863
|
const title = step === "form" ? copy.title : txTitle;
|
|
10864
|
+
const submissionReview = submission ? reviewForEarn(
|
|
10865
|
+
{
|
|
10866
|
+
action: submission.action,
|
|
10867
|
+
chain: submission.chain,
|
|
10868
|
+
network,
|
|
10869
|
+
amount: submission.amount,
|
|
10870
|
+
asset: submission.asset,
|
|
10871
|
+
name: submission.name,
|
|
10872
|
+
apy: submission.apy,
|
|
10873
|
+
wallet: wallets.find((w) => (w.chain ?? "STELLAR") === submission.chain)?.address
|
|
10874
|
+
},
|
|
10875
|
+
reviewCopy
|
|
10876
|
+
) : null;
|
|
10877
|
+
const resultPosition = submission?.chain === "SOLANA" && selectedSolana && solanaPosition ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10878
|
+
PositionCard,
|
|
10879
|
+
{
|
|
10880
|
+
copy,
|
|
10881
|
+
assetCode,
|
|
10882
|
+
name: copy.positionNow,
|
|
10883
|
+
apy: solanaPosition.apy ?? selectedSolana.apy,
|
|
10884
|
+
apyLabel: copy.apyAfterFees,
|
|
10885
|
+
rows: [
|
|
10886
|
+
{ label: copy.deposited, value: solanaPosition.principal },
|
|
10887
|
+
...solanaPosition.profit != null ? [{ label: copy.profit, value: solanaPosition.profit }] : [],
|
|
10888
|
+
{ label: copy.yourPosition, value: solanaPosition.balance }
|
|
10889
|
+
]
|
|
10890
|
+
}
|
|
10891
|
+
) : submission?.chain === "STELLAR" && selectedOpportunity && position ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10892
|
+
PositionCard,
|
|
10893
|
+
{
|
|
10894
|
+
copy,
|
|
10895
|
+
assetCode,
|
|
10896
|
+
name: copy.positionNow,
|
|
10897
|
+
apy: selectedOpportunity.apy,
|
|
10898
|
+
apyLabel: "APY",
|
|
10899
|
+
rows: [{ label: copy.yourPosition, value: position.balance }]
|
|
10900
|
+
}
|
|
10901
|
+
) : null;
|
|
10656
10902
|
return /* @__PURE__ */ jsxRuntime.jsx(PollarOverlay, { style: overlayStyle, onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10657
10903
|
"div",
|
|
10658
10904
|
{
|
|
@@ -10733,21 +10979,30 @@ function EarnModal({ onClose, initial }) {
|
|
|
10733
10979
|
)
|
|
10734
10980
|
] }),
|
|
10735
10981
|
networks.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
10736
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
10737
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10738
|
-
"
|
|
10982
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-label", children: copy.network }),
|
|
10983
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-tabs pollar-earn-networks", role: "radiogroup", "aria-label": copy.network, children: networks.map((n) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10984
|
+
"button",
|
|
10739
10985
|
{
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10986
|
+
type: "button",
|
|
10987
|
+
role: "radio",
|
|
10988
|
+
"aria-checked": earnChain === n,
|
|
10989
|
+
className: "pollar-tab pollar-earn-network",
|
|
10990
|
+
"data-active": earnChain === n,
|
|
10991
|
+
"data-chain": n,
|
|
10992
|
+
onClick: () => {
|
|
10993
|
+
if (n === earnChain) return;
|
|
10994
|
+
setEarnChain(n);
|
|
10744
10995
|
setOpportunityId("");
|
|
10745
10996
|
setAmount("");
|
|
10746
10997
|
setFormError("");
|
|
10747
10998
|
},
|
|
10748
|
-
children:
|
|
10749
|
-
|
|
10750
|
-
|
|
10999
|
+
children: [
|
|
11000
|
+
/* @__PURE__ */ jsxRuntime.jsx(ChainLogo, { chain: n }),
|
|
11001
|
+
reviewCopy.chains[n]
|
|
11002
|
+
]
|
|
11003
|
+
},
|
|
11004
|
+
n
|
|
11005
|
+
)) })
|
|
10751
11006
|
] }),
|
|
10752
11007
|
!onSolana && providers && providers.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-send-field", children: [
|
|
10753
11008
|
/* @__PURE__ */ jsxRuntime.jsx("label", { className: "pollar-send-label", children: copy.provider }),
|
|
@@ -10782,66 +11037,34 @@ function EarnModal({ onClose, initial }) {
|
|
|
10782
11037
|
}
|
|
10783
11038
|
)
|
|
10784
11039
|
] }),
|
|
10785
|
-
selectedSolana && /* @__PURE__ */ jsxRuntime.
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
] }),
|
|
10802
|
-
solanaPosition?.profit != null && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
10803
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: copy.profit }),
|
|
10804
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10805
|
-
formatAmount3(solanaPosition.profit),
|
|
10806
|
-
" ",
|
|
10807
|
-
assetCode
|
|
10808
|
-
] })
|
|
10809
|
-
] }),
|
|
10810
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
10811
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: copy.apyAfterFees }),
|
|
10812
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
|
|
10813
|
-
(solanaPosition?.apy ?? selectedSolana.apy).toFixed(2),
|
|
10814
|
-
"%"
|
|
10815
|
-
] })
|
|
10816
|
-
] }),
|
|
10817
|
-
solanaPosition?.stale && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: copy.stale })
|
|
10818
|
-
] }),
|
|
11040
|
+
selectedSolana && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11041
|
+
PositionCard,
|
|
11042
|
+
{
|
|
11043
|
+
copy,
|
|
11044
|
+
assetCode,
|
|
11045
|
+
name: selectedSolana.name,
|
|
11046
|
+
apy: solanaPosition?.apy ?? selectedSolana.apy,
|
|
11047
|
+
apyLabel: copy.apyAfterFees,
|
|
11048
|
+
rows: [
|
|
11049
|
+
{ label: copy.deposited, value: solanaPosition?.principal },
|
|
11050
|
+
...solanaPosition?.profit != null ? [{ label: copy.profit, value: solanaPosition.profit }] : [],
|
|
11051
|
+
{ label: copy.yourPosition, value: solanaPosition?.balance }
|
|
11052
|
+
],
|
|
11053
|
+
stale: solanaPosition?.stale
|
|
11054
|
+
}
|
|
11055
|
+
),
|
|
10819
11056
|
actionUnavailable && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-send-hint", children: copy.actionUnavailable(tab) }),
|
|
10820
|
-
selectedOpportunity && /* @__PURE__ */ jsxRuntime.
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
10832
|
-
position ? formatAmount3(position.balance) : "\u2026",
|
|
10833
|
-
" ",
|
|
10834
|
-
assetCode
|
|
10835
|
-
] })
|
|
10836
|
-
] }),
|
|
10837
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pollar-swap-quote-row", children: [
|
|
10838
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "pollar-send-hint", children: "APY" }),
|
|
10839
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "pollar-earn-live", children: [
|
|
10840
|
-
selectedOpportunity.apy.toFixed(2),
|
|
10841
|
-
"%"
|
|
10842
|
-
] })
|
|
10843
|
-
] })
|
|
10844
|
-
] }),
|
|
11057
|
+
selectedOpportunity && /* @__PURE__ */ jsxRuntime.jsx(
|
|
11058
|
+
PositionCard,
|
|
11059
|
+
{
|
|
11060
|
+
copy,
|
|
11061
|
+
assetCode,
|
|
11062
|
+
name: selectedOpportunity.name,
|
|
11063
|
+
apy: selectedOpportunity.apy,
|
|
11064
|
+
apyLabel: "APY",
|
|
11065
|
+
rows: [{ label: copy.yourPosition, value: position?.balance }]
|
|
11066
|
+
}
|
|
11067
|
+
),
|
|
10845
11068
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10846
11069
|
AmountField,
|
|
10847
11070
|
{
|
|
@@ -10850,6 +11073,7 @@ function EarnModal({ onClose, initial }) {
|
|
|
10850
11073
|
value: amount,
|
|
10851
11074
|
onChange: setAmount,
|
|
10852
11075
|
unit: amountUnitLabel,
|
|
11076
|
+
unitIcon: amountUnitLabel === assetCode && assetCode ? /* @__PURE__ */ jsxRuntime.jsx(AssetLogo, { asset: assetCode, small: true }) : void 0,
|
|
10853
11077
|
available: tab === "deposit" ? walletAvailable : withdrawable ?? void 0
|
|
10854
11078
|
}
|
|
10855
11079
|
),
|
|
@@ -10870,7 +11094,14 @@ function EarnModal({ onClose, initial }) {
|
|
|
10870
11094
|
onToggleXdr: () => setShowXdr((v) => !v),
|
|
10871
11095
|
onCopyHash: handleCopyHash,
|
|
10872
11096
|
onRetry: () => void handleRetry(),
|
|
10873
|
-
onDone: onClose
|
|
11097
|
+
onDone: onClose,
|
|
11098
|
+
language,
|
|
11099
|
+
review: submissionReview,
|
|
11100
|
+
successMessage: submission ? earnOutcome(submission, reviewCopy) : void 0,
|
|
11101
|
+
successExtra: submission && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11102
|
+
resultPosition,
|
|
11103
|
+
explorerUrl && /* @__PURE__ */ jsxRuntime.jsx(TxExplorerLink, { chain: submission.chain, url: explorerUrl, language })
|
|
11104
|
+
] })
|
|
10874
11105
|
}
|
|
10875
11106
|
),
|
|
10876
11107
|
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, {})
|
|
@@ -11047,7 +11278,9 @@ var CARD_COPY = {
|
|
|
11047
11278
|
delayed: "Taking longer than usual. We are following up with the card provider.",
|
|
11048
11279
|
crossing: "Your USDC crosses to the card network. It takes a few minutes, and the network fees are covered.",
|
|
11049
11280
|
noRoute: "Your wallets cannot fund this card right now."
|
|
11050
|
-
}
|
|
11281
|
+
},
|
|
11282
|
+
networkError: "We could not reach the card service. Check your connection and try again.",
|
|
11283
|
+
retry: "Try again"
|
|
11051
11284
|
},
|
|
11052
11285
|
es: {
|
|
11053
11286
|
funding: {
|
|
@@ -11215,7 +11448,9 @@ var CARD_COPY = {
|
|
|
11215
11448
|
delayed: "Est\xE1 tardando m\xE1s de lo normal. Estamos haciendo seguimiento con el emisor de la tarjeta.",
|
|
11216
11449
|
crossing: "Tus USDC cruzan a la red de la tarjeta. Toma unos minutos y las comisiones de red est\xE1n cubiertas.",
|
|
11217
11450
|
noRoute: "Tus wallets no pueden fondear esta tarjeta por ahora."
|
|
11218
|
-
}
|
|
11451
|
+
},
|
|
11452
|
+
networkError: "No pudimos conectar con el servicio de la tarjeta. Revisa tu conexi\xF3n e intenta de nuevo.",
|
|
11453
|
+
retry: "Intentar de nuevo"
|
|
11219
11454
|
},
|
|
11220
11455
|
pt: {
|
|
11221
11456
|
funding: {
|
|
@@ -11383,7 +11618,9 @@ var CARD_COPY = {
|
|
|
11383
11618
|
delayed: "Est\xE1 demorando mais que o normal. Estamos acompanhando com o emissor do cart\xE3o.",
|
|
11384
11619
|
crossing: "Seus USDC atravessam para a rede do cart\xE3o. Leva alguns minutos, e as taxas de rede est\xE3o cobertas.",
|
|
11385
11620
|
noRoute: "Suas carteiras n\xE3o podem recarregar este cart\xE3o por enquanto."
|
|
11386
|
-
}
|
|
11621
|
+
},
|
|
11622
|
+
networkError: "N\xE3o conseguimos conectar ao servi\xE7o do cart\xE3o. Verifique sua conex\xE3o e tente novamente.",
|
|
11623
|
+
retry: "Tentar novamente"
|
|
11387
11624
|
}
|
|
11388
11625
|
};
|
|
11389
11626
|
var CREDIT_DELAYED = "provider_credit_delayed";
|
|
@@ -11394,7 +11631,7 @@ function fundingProblemText(error, copy) {
|
|
|
11394
11631
|
return /token balance/i.test(raw) ? copy.fundingProblem.noBalance : copy.fundingProblem.noGas;
|
|
11395
11632
|
}
|
|
11396
11633
|
if (/insufficient_usdc/.test(raw)) return copy.fundingProblem.noBalance;
|
|
11397
|
-
if (/^(payment_not_received|cosign_rejected|cosign_expired)
|
|
11634
|
+
if (/^(payment_not_received|cosign_rejected|cosign_expired)/i.test(raw)) return copy.fundingProblem.notPaid;
|
|
11398
11635
|
return copy.fundingProblem.failed;
|
|
11399
11636
|
}
|
|
11400
11637
|
|
|
@@ -11499,6 +11736,7 @@ function errorText2(e, fallback, copy) {
|
|
|
11499
11736
|
if (typeof message === "string" && message) return message;
|
|
11500
11737
|
return e.code;
|
|
11501
11738
|
}
|
|
11739
|
+
if (core.isPollarNetworkError(e)) return copy.networkError;
|
|
11502
11740
|
return e instanceof Error && e.message ? e.message : fallback;
|
|
11503
11741
|
}
|
|
11504
11742
|
function CardModal({ onClose, initial }) {
|
|
@@ -11518,6 +11756,8 @@ function CardModal({ onClose, initial }) {
|
|
|
11518
11756
|
const [deposit, setDeposit] = react.useState(null);
|
|
11519
11757
|
const [fundings, setFundings] = react.useState(null);
|
|
11520
11758
|
const [fundAmount, setFundAmount] = react.useState(() => seededAmount(initial?.amount));
|
|
11759
|
+
const [loadAttempt, setLoadAttempt] = react.useState(0);
|
|
11760
|
+
const [loadFailed, setLoadFailed] = react.useState(false);
|
|
11521
11761
|
const fundKey = react.useRef(null);
|
|
11522
11762
|
const [fundChain, setFundChain] = react.useState(initial?.chain ?? null);
|
|
11523
11763
|
const [fundRoutes, setFundRoutes] = react.useState(null);
|
|
@@ -11586,13 +11826,19 @@ function CardModal({ onClose, initial }) {
|
|
|
11586
11826
|
if (!cancelled) {
|
|
11587
11827
|
setProviders((cur) => cur ?? []);
|
|
11588
11828
|
setError(errorText2(e, copy.failed.load, copy));
|
|
11829
|
+
setLoadFailed(true);
|
|
11589
11830
|
}
|
|
11590
11831
|
}
|
|
11591
11832
|
})();
|
|
11592
11833
|
return () => {
|
|
11593
11834
|
cancelled = true;
|
|
11594
11835
|
};
|
|
11595
|
-
}, [getClient, loadHolder, loadRequirements, loadCardData]);
|
|
11836
|
+
}, [getClient, loadHolder, loadRequirements, loadCardData, loadAttempt]);
|
|
11837
|
+
const retryLoad = () => {
|
|
11838
|
+
setLoadFailed(false);
|
|
11839
|
+
setError("");
|
|
11840
|
+
setLoadAttempt((n) => n + 1);
|
|
11841
|
+
};
|
|
11596
11842
|
const stage = cardStage(holder, requirements);
|
|
11597
11843
|
react.useEffect(() => {
|
|
11598
11844
|
if (stage !== "provider-form") return;
|
|
@@ -12192,6 +12438,7 @@ function CardModal({ onClose, initial }) {
|
|
|
12192
12438
|
showManual && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "pollar-card-note", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-card-link", onClick: () => setShowManual(false), children: copy.hideDeposit }) })
|
|
12193
12439
|
] }),
|
|
12194
12440
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-error", children: error }),
|
|
12441
|
+
loadFailed && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", className: "pollar-btn-primary", onClick: retryLoad, children: copy.retry }) }),
|
|
12195
12442
|
/* @__PURE__ */ jsxRuntime.jsx(PollarModalFooter, { language })
|
|
12196
12443
|
]
|
|
12197
12444
|
}
|
|
@@ -13804,7 +14051,9 @@ var CONFIRM_COPY = {
|
|
|
13804
14051
|
create_account: "Create account",
|
|
13805
14052
|
invoke_contract: "Contract call",
|
|
13806
14053
|
transfer: "Authorize payment",
|
|
13807
|
-
manage_data: "Manage data"
|
|
14054
|
+
manage_data: "Manage data",
|
|
14055
|
+
earn_deposit: "Deposit",
|
|
14056
|
+
earn_withdraw: "Withdraw"
|
|
13808
14057
|
}
|
|
13809
14058
|
},
|
|
13810
14059
|
es: {
|
|
@@ -13821,7 +14070,9 @@ var CONFIRM_COPY = {
|
|
|
13821
14070
|
create_account: "Crear cuenta",
|
|
13822
14071
|
invoke_contract: "Llamada a contrato",
|
|
13823
14072
|
transfer: "Autorizar pago",
|
|
13824
|
-
manage_data: "Gestionar datos"
|
|
14073
|
+
manage_data: "Gestionar datos",
|
|
14074
|
+
earn_deposit: "Depositar",
|
|
14075
|
+
earn_withdraw: "Retirar"
|
|
13825
14076
|
}
|
|
13826
14077
|
},
|
|
13827
14078
|
pt: {
|
|
@@ -13838,7 +14089,9 @@ var CONFIRM_COPY = {
|
|
|
13838
14089
|
create_account: "Criar conta",
|
|
13839
14090
|
invoke_contract: "Chamada de contrato",
|
|
13840
14091
|
transfer: "Autorizar pagamento",
|
|
13841
|
-
manage_data: "Gerenciar dados"
|
|
14092
|
+
manage_data: "Gerenciar dados",
|
|
14093
|
+
earn_deposit: "Depositar",
|
|
14094
|
+
earn_withdraw: "Sacar"
|
|
13842
14095
|
}
|
|
13843
14096
|
}
|
|
13844
14097
|
};
|
|
@@ -14732,6 +14985,10 @@ var browserRecoveryPasskey = {
|
|
|
14732
14985
|
};
|
|
14733
14986
|
}
|
|
14734
14987
|
};
|
|
14988
|
+
function remembered(list) {
|
|
14989
|
+
rememberEarnOpportunities(list);
|
|
14990
|
+
return list;
|
|
14991
|
+
}
|
|
14735
14992
|
var DEFAULT_APP_CONFIG = {
|
|
14736
14993
|
application: { name: "", network: "testnet", chains: [] },
|
|
14737
14994
|
styles: {}
|
|
@@ -15087,12 +15344,12 @@ function PollarProvider({
|
|
|
15087
15344
|
},
|
|
15088
15345
|
// earn
|
|
15089
15346
|
getEarnProviders: () => pollarClient.getEarnProviders(),
|
|
15090
|
-
getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider),
|
|
15347
|
+
getEarnOpportunities: (provider) => pollarClient.getEarnOpportunities(provider).then(remembered),
|
|
15091
15348
|
getEarnPosition: (params) => pollarClient.getEarnPosition(params),
|
|
15092
15349
|
earnDeposit: (params) => pollarClient.earnDeposit(params),
|
|
15093
15350
|
earnWithdraw: (params) => pollarClient.earnWithdraw(params),
|
|
15094
15351
|
getSolanaEarnProviders: () => pollarClient.getSolanaEarnProviders(),
|
|
15095
|
-
getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities(),
|
|
15352
|
+
getSolanaEarnOpportunities: () => pollarClient.getSolanaEarnOpportunities().then(remembered),
|
|
15096
15353
|
getSolanaEarnPosition: (opportunity) => pollarClient.getSolanaEarnPosition(opportunity),
|
|
15097
15354
|
earnSolanaDeposit: (params) => pollarClient.earnSolanaDeposit(params),
|
|
15098
15355
|
earnSolanaWithdraw: (params) => pollarClient.earnSolanaWithdraw(params),
|