@swype-org/react-sdk 0.1.293 → 0.1.301
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.cjs +409 -428
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +398 -417
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -7,9 +7,9 @@ var chains = require('wagmi/chains');
|
|
|
7
7
|
var connectors = require('wagmi/connectors');
|
|
8
8
|
var reactQuery = require('@tanstack/react-query');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
|
+
var core = require('@wagmi/core');
|
|
10
11
|
var viem = require('viem');
|
|
11
12
|
var utils = require('viem/utils');
|
|
12
|
-
var actions = require('viem/actions');
|
|
13
13
|
|
|
14
14
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
15
15
|
var __defProp = Object.defineProperty;
|
|
@@ -916,304 +916,6 @@ function useTransferPolling(intervalMs = 3e3) {
|
|
|
916
916
|
react.useEffect(() => () => stopPolling(), [stopPolling]);
|
|
917
917
|
return { transfer, error, isPolling, startPolling, stopPolling };
|
|
918
918
|
}
|
|
919
|
-
|
|
920
|
-
// node_modules/@wagmi/core/dist/esm/utils/getAction.js
|
|
921
|
-
function getAction(client, actionFn, name) {
|
|
922
|
-
const action_implicit = client[actionFn.name];
|
|
923
|
-
if (typeof action_implicit === "function")
|
|
924
|
-
return action_implicit;
|
|
925
|
-
const action_explicit = client[name];
|
|
926
|
-
if (typeof action_explicit === "function")
|
|
927
|
-
return action_explicit;
|
|
928
|
-
return (params) => actionFn(client, params);
|
|
929
|
-
}
|
|
930
|
-
|
|
931
|
-
// node_modules/@wagmi/core/dist/esm/version.js
|
|
932
|
-
var version = "2.22.1";
|
|
933
|
-
|
|
934
|
-
// node_modules/@wagmi/core/dist/esm/utils/getVersion.js
|
|
935
|
-
var getVersion = () => `@wagmi/core@${version}`;
|
|
936
|
-
|
|
937
|
-
// node_modules/@wagmi/core/dist/esm/errors/base.js
|
|
938
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
939
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
940
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
941
|
-
};
|
|
942
|
-
var _BaseError_instances;
|
|
943
|
-
var _BaseError_walk;
|
|
944
|
-
var BaseError = class _BaseError extends Error {
|
|
945
|
-
get docsBaseUrl() {
|
|
946
|
-
return "https://wagmi.sh/core";
|
|
947
|
-
}
|
|
948
|
-
get version() {
|
|
949
|
-
return getVersion();
|
|
950
|
-
}
|
|
951
|
-
constructor(shortMessage, options = {}) {
|
|
952
|
-
super();
|
|
953
|
-
_BaseError_instances.add(this);
|
|
954
|
-
Object.defineProperty(this, "details", {
|
|
955
|
-
enumerable: true,
|
|
956
|
-
configurable: true,
|
|
957
|
-
writable: true,
|
|
958
|
-
value: void 0
|
|
959
|
-
});
|
|
960
|
-
Object.defineProperty(this, "docsPath", {
|
|
961
|
-
enumerable: true,
|
|
962
|
-
configurable: true,
|
|
963
|
-
writable: true,
|
|
964
|
-
value: void 0
|
|
965
|
-
});
|
|
966
|
-
Object.defineProperty(this, "metaMessages", {
|
|
967
|
-
enumerable: true,
|
|
968
|
-
configurable: true,
|
|
969
|
-
writable: true,
|
|
970
|
-
value: void 0
|
|
971
|
-
});
|
|
972
|
-
Object.defineProperty(this, "shortMessage", {
|
|
973
|
-
enumerable: true,
|
|
974
|
-
configurable: true,
|
|
975
|
-
writable: true,
|
|
976
|
-
value: void 0
|
|
977
|
-
});
|
|
978
|
-
Object.defineProperty(this, "name", {
|
|
979
|
-
enumerable: true,
|
|
980
|
-
configurable: true,
|
|
981
|
-
writable: true,
|
|
982
|
-
value: "WagmiCoreError"
|
|
983
|
-
});
|
|
984
|
-
const details = options.cause instanceof _BaseError ? options.cause.details : options.cause?.message ? options.cause.message : options.details;
|
|
985
|
-
const docsPath = options.cause instanceof _BaseError ? options.cause.docsPath || options.docsPath : options.docsPath;
|
|
986
|
-
this.message = [
|
|
987
|
-
shortMessage || "An error occurred.",
|
|
988
|
-
"",
|
|
989
|
-
...options.metaMessages ? [...options.metaMessages, ""] : [],
|
|
990
|
-
...docsPath ? [
|
|
991
|
-
`Docs: ${this.docsBaseUrl}${docsPath}.html${options.docsSlug ? `#${options.docsSlug}` : ""}`
|
|
992
|
-
] : [],
|
|
993
|
-
...details ? [`Details: ${details}`] : [],
|
|
994
|
-
`Version: ${this.version}`
|
|
995
|
-
].join("\n");
|
|
996
|
-
if (options.cause)
|
|
997
|
-
this.cause = options.cause;
|
|
998
|
-
this.details = details;
|
|
999
|
-
this.docsPath = docsPath;
|
|
1000
|
-
this.metaMessages = options.metaMessages;
|
|
1001
|
-
this.shortMessage = shortMessage;
|
|
1002
|
-
}
|
|
1003
|
-
walk(fn) {
|
|
1004
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk).call(this, this, fn);
|
|
1005
|
-
}
|
|
1006
|
-
};
|
|
1007
|
-
_BaseError_instances = /* @__PURE__ */ new WeakSet(), _BaseError_walk = function _BaseError_walk2(err, fn) {
|
|
1008
|
-
if (fn?.(err))
|
|
1009
|
-
return err;
|
|
1010
|
-
if (err.cause)
|
|
1011
|
-
return __classPrivateFieldGet(this, _BaseError_instances, "m", _BaseError_walk2).call(this, err.cause, fn);
|
|
1012
|
-
return err;
|
|
1013
|
-
};
|
|
1014
|
-
|
|
1015
|
-
// node_modules/@wagmi/core/dist/esm/errors/config.js
|
|
1016
|
-
var ConnectorNotConnectedError = class extends BaseError {
|
|
1017
|
-
constructor() {
|
|
1018
|
-
super("Connector not connected.");
|
|
1019
|
-
Object.defineProperty(this, "name", {
|
|
1020
|
-
enumerable: true,
|
|
1021
|
-
configurable: true,
|
|
1022
|
-
writable: true,
|
|
1023
|
-
value: "ConnectorNotConnectedError"
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
};
|
|
1027
|
-
var ConnectorAccountNotFoundError = class extends BaseError {
|
|
1028
|
-
constructor({ address, connector }) {
|
|
1029
|
-
super(`Account "${address}" not found for connector "${connector.name}".`);
|
|
1030
|
-
Object.defineProperty(this, "name", {
|
|
1031
|
-
enumerable: true,
|
|
1032
|
-
configurable: true,
|
|
1033
|
-
writable: true,
|
|
1034
|
-
value: "ConnectorAccountNotFoundError"
|
|
1035
|
-
});
|
|
1036
|
-
}
|
|
1037
|
-
};
|
|
1038
|
-
var ConnectorChainMismatchError = class extends BaseError {
|
|
1039
|
-
constructor({ connectionChainId, connectorChainId }) {
|
|
1040
|
-
super(`The current chain of the connector (id: ${connectorChainId}) does not match the connection's chain (id: ${connectionChainId}).`, {
|
|
1041
|
-
metaMessages: [
|
|
1042
|
-
`Current Chain ID: ${connectorChainId}`,
|
|
1043
|
-
`Expected Chain ID: ${connectionChainId}`
|
|
1044
|
-
]
|
|
1045
|
-
});
|
|
1046
|
-
Object.defineProperty(this, "name", {
|
|
1047
|
-
enumerable: true,
|
|
1048
|
-
configurable: true,
|
|
1049
|
-
writable: true,
|
|
1050
|
-
value: "ConnectorChainMismatchError"
|
|
1051
|
-
});
|
|
1052
|
-
}
|
|
1053
|
-
};
|
|
1054
|
-
var ConnectorUnavailableReconnectingError = class extends BaseError {
|
|
1055
|
-
constructor({ connector }) {
|
|
1056
|
-
super(`Connector "${connector.name}" unavailable while reconnecting.`, {
|
|
1057
|
-
details: [
|
|
1058
|
-
"During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.",
|
|
1059
|
-
"All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.",
|
|
1060
|
-
"This error commonly occurs for connectors that asynchronously inject after reconnection has already started."
|
|
1061
|
-
].join(" ")
|
|
1062
|
-
});
|
|
1063
|
-
Object.defineProperty(this, "name", {
|
|
1064
|
-
enumerable: true,
|
|
1065
|
-
configurable: true,
|
|
1066
|
-
writable: true,
|
|
1067
|
-
value: "ConnectorUnavailableReconnectingError"
|
|
1068
|
-
});
|
|
1069
|
-
}
|
|
1070
|
-
};
|
|
1071
|
-
async function getConnectorClient(config, parameters = {}) {
|
|
1072
|
-
const { assertChainId = true } = parameters;
|
|
1073
|
-
let connection;
|
|
1074
|
-
if (parameters.connector) {
|
|
1075
|
-
const { connector: connector2 } = parameters;
|
|
1076
|
-
if (config.state.status === "reconnecting" && !connector2.getAccounts && !connector2.getChainId)
|
|
1077
|
-
throw new ConnectorUnavailableReconnectingError({ connector: connector2 });
|
|
1078
|
-
const [accounts, chainId2] = await Promise.all([
|
|
1079
|
-
connector2.getAccounts().catch((e) => {
|
|
1080
|
-
if (parameters.account === null)
|
|
1081
|
-
return [];
|
|
1082
|
-
throw e;
|
|
1083
|
-
}),
|
|
1084
|
-
connector2.getChainId()
|
|
1085
|
-
]);
|
|
1086
|
-
connection = {
|
|
1087
|
-
accounts,
|
|
1088
|
-
chainId: chainId2,
|
|
1089
|
-
connector: connector2
|
|
1090
|
-
};
|
|
1091
|
-
} else
|
|
1092
|
-
connection = config.state.connections.get(config.state.current);
|
|
1093
|
-
if (!connection)
|
|
1094
|
-
throw new ConnectorNotConnectedError();
|
|
1095
|
-
const chainId = parameters.chainId ?? connection.chainId;
|
|
1096
|
-
const connectorChainId = await connection.connector.getChainId();
|
|
1097
|
-
if (assertChainId && connectorChainId !== chainId)
|
|
1098
|
-
throw new ConnectorChainMismatchError({
|
|
1099
|
-
connectionChainId: chainId,
|
|
1100
|
-
connectorChainId
|
|
1101
|
-
});
|
|
1102
|
-
const connector = connection.connector;
|
|
1103
|
-
if (connector.getClient)
|
|
1104
|
-
return connector.getClient({ chainId });
|
|
1105
|
-
const account = utils.parseAccount(parameters.account ?? connection.accounts[0]);
|
|
1106
|
-
if (account)
|
|
1107
|
-
account.address = utils.getAddress(account.address);
|
|
1108
|
-
if (parameters.account && !connection.accounts.some((x) => x.toLowerCase() === account.address.toLowerCase()))
|
|
1109
|
-
throw new ConnectorAccountNotFoundError({
|
|
1110
|
-
address: account.address,
|
|
1111
|
-
connector
|
|
1112
|
-
});
|
|
1113
|
-
const chain = config.chains.find((chain2) => chain2.id === chainId);
|
|
1114
|
-
const provider = await connection.connector.getProvider({ chainId });
|
|
1115
|
-
return viem.createClient({
|
|
1116
|
-
account,
|
|
1117
|
-
chain,
|
|
1118
|
-
name: "Connector Client",
|
|
1119
|
-
transport: (opts) => viem.custom(provider)({ ...opts, retryCount: 0 })
|
|
1120
|
-
});
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
// node_modules/@wagmi/core/dist/esm/actions/getAccount.js
|
|
1124
|
-
function getAccount(config) {
|
|
1125
|
-
const uid = config.state.current;
|
|
1126
|
-
const connection = config.state.connections.get(uid);
|
|
1127
|
-
const addresses = connection?.accounts;
|
|
1128
|
-
const address = addresses?.[0];
|
|
1129
|
-
const chain = config.chains.find((chain2) => chain2.id === connection?.chainId);
|
|
1130
|
-
const status = config.state.status;
|
|
1131
|
-
switch (status) {
|
|
1132
|
-
case "connected":
|
|
1133
|
-
return {
|
|
1134
|
-
address,
|
|
1135
|
-
addresses,
|
|
1136
|
-
chain,
|
|
1137
|
-
chainId: connection?.chainId,
|
|
1138
|
-
connector: connection?.connector,
|
|
1139
|
-
isConnected: true,
|
|
1140
|
-
isConnecting: false,
|
|
1141
|
-
isDisconnected: false,
|
|
1142
|
-
isReconnecting: false,
|
|
1143
|
-
status
|
|
1144
|
-
};
|
|
1145
|
-
case "reconnecting":
|
|
1146
|
-
return {
|
|
1147
|
-
address,
|
|
1148
|
-
addresses,
|
|
1149
|
-
chain,
|
|
1150
|
-
chainId: connection?.chainId,
|
|
1151
|
-
connector: connection?.connector,
|
|
1152
|
-
isConnected: !!address,
|
|
1153
|
-
isConnecting: false,
|
|
1154
|
-
isDisconnected: false,
|
|
1155
|
-
isReconnecting: true,
|
|
1156
|
-
status
|
|
1157
|
-
};
|
|
1158
|
-
case "connecting":
|
|
1159
|
-
return {
|
|
1160
|
-
address,
|
|
1161
|
-
addresses,
|
|
1162
|
-
chain,
|
|
1163
|
-
chainId: connection?.chainId,
|
|
1164
|
-
connector: connection?.connector,
|
|
1165
|
-
isConnected: false,
|
|
1166
|
-
isConnecting: true,
|
|
1167
|
-
isDisconnected: false,
|
|
1168
|
-
isReconnecting: false,
|
|
1169
|
-
status
|
|
1170
|
-
};
|
|
1171
|
-
case "disconnected":
|
|
1172
|
-
return {
|
|
1173
|
-
address: void 0,
|
|
1174
|
-
addresses: void 0,
|
|
1175
|
-
chain: void 0,
|
|
1176
|
-
chainId: void 0,
|
|
1177
|
-
connector: void 0,
|
|
1178
|
-
isConnected: false,
|
|
1179
|
-
isConnecting: false,
|
|
1180
|
-
isDisconnected: true,
|
|
1181
|
-
isReconnecting: false,
|
|
1182
|
-
status
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1186
|
-
async function getWalletClient(config, parameters = {}) {
|
|
1187
|
-
const client = await getConnectorClient(config, parameters);
|
|
1188
|
-
return client.extend(viem.walletActions);
|
|
1189
|
-
}
|
|
1190
|
-
async function waitForTransactionReceipt(config, parameters) {
|
|
1191
|
-
const { chainId, timeout = 0, ...rest } = parameters;
|
|
1192
|
-
const client = config.getClient({ chainId });
|
|
1193
|
-
const action = getAction(client, actions.waitForTransactionReceipt, "waitForTransactionReceipt");
|
|
1194
|
-
const receipt = await action({ ...rest, timeout });
|
|
1195
|
-
if (receipt.status === "reverted") {
|
|
1196
|
-
const action_getTransaction = getAction(client, actions.getTransaction, "getTransaction");
|
|
1197
|
-
const { from: account, ...txn } = await action_getTransaction({
|
|
1198
|
-
hash: receipt.transactionHash
|
|
1199
|
-
});
|
|
1200
|
-
const action_call = getAction(client, actions.call, "call");
|
|
1201
|
-
const code = await action_call({
|
|
1202
|
-
...txn,
|
|
1203
|
-
account,
|
|
1204
|
-
data: txn.input,
|
|
1205
|
-
gasPrice: txn.type !== "eip1559" ? txn.gasPrice : void 0,
|
|
1206
|
-
maxFeePerGas: txn.type === "eip1559" ? txn.maxFeePerGas : void 0,
|
|
1207
|
-
maxPriorityFeePerGas: txn.type === "eip1559" ? txn.maxPriorityFeePerGas : void 0
|
|
1208
|
-
});
|
|
1209
|
-
const reason = code?.data ? viem.hexToString(`0x${code.data.substring(138)}`) : "unknown reason";
|
|
1210
|
-
throw new Error(reason);
|
|
1211
|
-
}
|
|
1212
|
-
return {
|
|
1213
|
-
...receipt,
|
|
1214
|
-
chainId: client.chain.id
|
|
1215
|
-
};
|
|
1216
|
-
}
|
|
1217
919
|
var ERC_6492_MAGIC_SUFFIX = "6492649264926492649264926492649264926492649264926492649264926492";
|
|
1218
920
|
function normalizeSignature(sig) {
|
|
1219
921
|
const hex = sig.startsWith("0x") ? sig.slice(2) : sig;
|
|
@@ -1282,9 +984,9 @@ function isUserRejection(msg) {
|
|
|
1282
984
|
async function waitForWalletClient(wagmiConfig2, params = {}) {
|
|
1283
985
|
for (let i = 0; i < WALLET_CLIENT_MAX_ATTEMPTS; i++) {
|
|
1284
986
|
try {
|
|
1285
|
-
const account = getAccount(wagmiConfig2);
|
|
987
|
+
const account = core.getAccount(wagmiConfig2);
|
|
1286
988
|
const enrichedParams = account.connector ? { ...params, connector: account.connector } : params;
|
|
1287
|
-
return await getWalletClient(wagmiConfig2, enrichedParams);
|
|
989
|
+
return await core.getWalletClient(wagmiConfig2, enrichedParams);
|
|
1288
990
|
} catch {
|
|
1289
991
|
if (i === WALLET_CLIENT_MAX_ATTEMPTS - 1) {
|
|
1290
992
|
throw new Error("Wallet not ready. Please try again.");
|
|
@@ -1320,7 +1022,7 @@ function getPendingActions(session, completedIds) {
|
|
|
1320
1022
|
}
|
|
1321
1023
|
async function executeOpenProvider(action, wagmiConfig2, connectors, connectAsync) {
|
|
1322
1024
|
try {
|
|
1323
|
-
const account = getAccount(wagmiConfig2);
|
|
1025
|
+
const account = core.getAccount(wagmiConfig2);
|
|
1324
1026
|
if (account.isConnected && account.address) {
|
|
1325
1027
|
const hexChainId2 = account.chainId ? `0x${account.chainId.toString(16)}` : void 0;
|
|
1326
1028
|
return actionSuccess(
|
|
@@ -1387,7 +1089,7 @@ async function executeSelectSource(action, waitForSelection) {
|
|
|
1387
1089
|
}
|
|
1388
1090
|
async function executeSwitchChain(action, wagmiConfig2, switchChainAsync) {
|
|
1389
1091
|
try {
|
|
1390
|
-
const account = getAccount(wagmiConfig2);
|
|
1092
|
+
const account = core.getAccount(wagmiConfig2);
|
|
1391
1093
|
const targetChainIdHex = action.metadata?.targetChainId;
|
|
1392
1094
|
if (!targetChainIdHex) {
|
|
1393
1095
|
return actionError(action, "No targetChainId in action metadata.");
|
|
@@ -1429,7 +1131,7 @@ async function executeSwitchChain(action, wagmiConfig2, switchChainAsync) {
|
|
|
1429
1131
|
async function executeApprovePermit2(action, wagmiConfig2) {
|
|
1430
1132
|
try {
|
|
1431
1133
|
const walletClient = await waitForWalletClient(wagmiConfig2);
|
|
1432
|
-
const account = getAccount(wagmiConfig2);
|
|
1134
|
+
const account = core.getAccount(wagmiConfig2);
|
|
1433
1135
|
const sender = account.address ?? walletClient.account?.address;
|
|
1434
1136
|
const expectedWallet = action.metadata?.walletAddress;
|
|
1435
1137
|
if (!sender) {
|
|
@@ -1482,7 +1184,7 @@ async function executeSignPermit2(action, wagmiConfig2, apiBaseUrl, sessionId) {
|
|
|
1482
1184
|
wagmiConfig2,
|
|
1483
1185
|
expectedWallet ? { account: expectedWallet } : {}
|
|
1484
1186
|
);
|
|
1485
|
-
const account = getAccount(wagmiConfig2);
|
|
1187
|
+
const account = core.getAccount(wagmiConfig2);
|
|
1486
1188
|
const connectedAddress = account.address ?? walletClient.account?.address;
|
|
1487
1189
|
const sender = expectedWallet ?? connectedAddress;
|
|
1488
1190
|
if (!sender) {
|
|
@@ -2086,8 +1788,8 @@ function resolvePhase(state) {
|
|
|
2086
1788
|
const needsPasskeyBootstrap = state.privyAuthenticated && !state.activeCredentialId;
|
|
2087
1789
|
const guestPreauthPinsCurrentPhase = transferCompleted && state.guestPreauthorizing && !state.verificationTarget && isGuestPreauthCompletedTransferPinPhase(currentPhase);
|
|
2088
1790
|
const guestPostPayLogin = transferCompleted && state.isGuestFlow && state.guestPreauthSessionId != null && !state.guestPreauthorizing && !state.verificationTarget && !state.privyAuthenticated;
|
|
2089
|
-
const isFundingSourceSubflow = !state.loginRequested && (currentPhase.step === "token-picker" || currentPhase.step === "one-tap-setup" || currentPhase.step === "select-source" || currentPhase.step === "confirm-sign" || currentPhase.step === "guest-token-picker");
|
|
2090
1791
|
const guestTokenPickerEligible = state.isGuestFlow && state.selectedProviderId != null && !state.transfer && !state.guestPreauthAccountId;
|
|
1792
|
+
const isFundingSourceSubflow = !state.loginRequested && (currentPhase.step === "token-picker" || currentPhase.step === "one-tap-setup" || currentPhase.step === "select-source" || currentPhase.step === "confirm-sign" || currentPhase.step === "guest-token-picker" && guestTokenPickerEligible);
|
|
2091
1793
|
const walletPickerSwitchEligible = currentPhase.step === "wallet-picker" && currentPhase.reason === "switch" && !state.creatingTransfer && !(state.mobileFlow && state.deeplinkUri);
|
|
2092
1794
|
const missingActivePasskeyCredential = state.passkeyConfigLoaded && !state.activeCredentialId;
|
|
2093
1795
|
const shouldPromptPasskeyVerification = missingActivePasskeyCredential && state.knownCredentialIds.length > 0 && state.passkeyPopupNeeded;
|
|
@@ -4382,6 +4084,9 @@ var loginButtonStyle = (accentColor) => ({
|
|
|
4382
4084
|
var DEFAULT_MAX = 1e7;
|
|
4383
4085
|
var ABSOLUTE_MIN = 0.01;
|
|
4384
4086
|
var PRESETS = [100, 250, 1e3];
|
|
4087
|
+
function tokenOptionKey(opt) {
|
|
4088
|
+
return `${opt.chainName}-${opt.symbol}`;
|
|
4089
|
+
}
|
|
4385
4090
|
function SetupScreen({
|
|
4386
4091
|
availableBalance,
|
|
4387
4092
|
onSetupOneTap,
|
|
@@ -4390,16 +4095,43 @@ function SetupScreen({
|
|
|
4390
4095
|
onAdvanced,
|
|
4391
4096
|
loading,
|
|
4392
4097
|
error,
|
|
4393
|
-
selectedTokenSymbol
|
|
4098
|
+
selectedTokenSymbol,
|
|
4099
|
+
tokenOptions,
|
|
4100
|
+
onSelectToken
|
|
4394
4101
|
}) {
|
|
4395
4102
|
const { tokens } = useBlinkConfig();
|
|
4396
4103
|
const effectiveMax = DEFAULT_MAX;
|
|
4397
4104
|
const effectiveMin = Math.min(ABSOLUTE_MIN, effectiveMax);
|
|
4398
4105
|
const [limit, setLimit] = react.useState(() => Math.min(availableBalance, effectiveMax));
|
|
4399
4106
|
const [activePreset, setActivePreset] = react.useState(null);
|
|
4107
|
+
const [showAdvanced, setShowAdvanced] = react.useState(false);
|
|
4400
4108
|
const [editing, setEditing] = react.useState(false);
|
|
4401
4109
|
const [inputValue, setInputValue] = react.useState("");
|
|
4402
4110
|
const inputRef = react.useRef(null);
|
|
4111
|
+
const hasDropdown = tokenOptions != null && tokenOptions.length > 0 && onSelectToken != null;
|
|
4112
|
+
const [tokenDropdownOpen, setTokenDropdownOpen] = react.useState(false);
|
|
4113
|
+
const pickerRef = react.useRef(null);
|
|
4114
|
+
react.useEffect(() => {
|
|
4115
|
+
if (!tokenDropdownOpen) return;
|
|
4116
|
+
const handleMouseDown = (e) => {
|
|
4117
|
+
if (pickerRef.current && !pickerRef.current.contains(e.target)) {
|
|
4118
|
+
setTokenDropdownOpen(false);
|
|
4119
|
+
}
|
|
4120
|
+
};
|
|
4121
|
+
document.addEventListener("mousedown", handleMouseDown);
|
|
4122
|
+
return () => document.removeEventListener("mousedown", handleMouseDown);
|
|
4123
|
+
}, [tokenDropdownOpen]);
|
|
4124
|
+
const handleTokenRowClick = react.useCallback(() => {
|
|
4125
|
+
if (hasDropdown) {
|
|
4126
|
+
setTokenDropdownOpen((v) => !v);
|
|
4127
|
+
} else {
|
|
4128
|
+
onAdvanced?.();
|
|
4129
|
+
}
|
|
4130
|
+
}, [hasDropdown, onAdvanced]);
|
|
4131
|
+
const handlePickToken = react.useCallback((opt) => {
|
|
4132
|
+
onSelectToken?.(opt.symbol, opt.chainName, opt.walletId);
|
|
4133
|
+
setTokenDropdownOpen(false);
|
|
4134
|
+
}, [onSelectToken]);
|
|
4403
4135
|
const startEditing = react.useCallback(() => {
|
|
4404
4136
|
setInputValue(limit.toFixed(2));
|
|
4405
4137
|
setEditing(true);
|
|
@@ -4422,6 +4154,7 @@ function SetupScreen({
|
|
|
4422
4154
|
setLimit(Math.min(availableBalance, effectiveMax));
|
|
4423
4155
|
setActivePreset("max");
|
|
4424
4156
|
};
|
|
4157
|
+
const selectedOption = tokenOptions?.find((o) => o.symbol === selectedTokenSymbol);
|
|
4425
4158
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4426
4159
|
ScreenLayout,
|
|
4427
4160
|
{
|
|
@@ -4432,17 +4165,90 @@ function SetupScreen({
|
|
|
4432
4165
|
onClick: () => onSetupOneTap(limit),
|
|
4433
4166
|
disabled: loading,
|
|
4434
4167
|
loading,
|
|
4435
|
-
children: "
|
|
4168
|
+
children: "Continue"
|
|
4436
4169
|
}
|
|
4437
4170
|
),
|
|
4438
4171
|
/* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {})
|
|
4439
4172
|
] }),
|
|
4440
4173
|
children: [
|
|
4441
4174
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
4442
|
-
/* @__PURE__ */ jsxRuntime.jsx("
|
|
4175
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: BLINK_LOGO, alt: "Blink", width: 56, height: 56, style: mascotStyle2 }),
|
|
4176
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { style: descriptionStyle(tokens.text), children: "Set a limit for one-tap deposits. You'll still confirm each one with your passkey." }),
|
|
4443
4177
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle4(tokens), children: error }),
|
|
4444
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
4445
|
-
/* @__PURE__ */ jsxRuntime.
|
|
4178
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: pickerRef, children: [
|
|
4179
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4180
|
+
"button",
|
|
4181
|
+
{
|
|
4182
|
+
type: "button",
|
|
4183
|
+
onClick: handleTokenRowClick,
|
|
4184
|
+
style: tokenRowTriggerStyle(tokens, hasDropdown || !!onAdvanced),
|
|
4185
|
+
"aria-expanded": hasDropdown ? tokenDropdownOpen : void 0,
|
|
4186
|
+
"aria-haspopup": hasDropdown ? "listbox" : void 0,
|
|
4187
|
+
children: [
|
|
4188
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: tokenRowLabelStyle(tokens.text), children: "Token for one tap" }),
|
|
4189
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: tokenRowRightStyle, children: [
|
|
4190
|
+
selectedOption && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: tokenRowSymbolStyle(tokens.textSecondary), children: [
|
|
4191
|
+
selectedOption.symbol,
|
|
4192
|
+
" \xB7 ",
|
|
4193
|
+
selectedOption.chainName
|
|
4194
|
+
] }),
|
|
4195
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconWrapStyle, children: selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
|
|
4196
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
|
|
4197
|
+
/* @__PURE__ */ jsxRuntime.jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
|
|
4198
|
+
] }) }),
|
|
4199
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.5 }, children: tokenDropdownOpen ? /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18 15l-6-6-6 6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) : /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 9l6 6 6-6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4200
|
+
] })
|
|
4201
|
+
]
|
|
4202
|
+
}
|
|
4203
|
+
),
|
|
4204
|
+
tokenDropdownOpen && tokenOptions && tokenOptions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownOuterStyle(tokens), children: [
|
|
4205
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownLabelStyle(tokens.textMuted), children: "Choose token" }),
|
|
4206
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownInnerStyle(tokens), children: tokenOptions.map((opt, index) => {
|
|
4207
|
+
const selected = opt.symbol === selectedTokenSymbol;
|
|
4208
|
+
const isLast = index === tokenOptions.length - 1;
|
|
4209
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4210
|
+
"button",
|
|
4211
|
+
{
|
|
4212
|
+
type: "button",
|
|
4213
|
+
onClick: () => handlePickToken(opt),
|
|
4214
|
+
style: dropdownRowStyle(tokens, selected, isLast),
|
|
4215
|
+
children: [
|
|
4216
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownRowLeftStyle, children: [
|
|
4217
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownTokenIconStyle(tokens, !!TOKEN_LOGOS[opt.symbol]), children: TOKEN_LOGOS[opt.symbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[opt.symbol], alt: opt.symbol, style: dropdownTokenLogoStyle }) : /* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownTokenFallbackStyle(tokens.textMuted), children: "$" }) }),
|
|
4218
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownTokenInfoStyle, children: [
|
|
4219
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: dropdownTokenNameRowStyle, children: [
|
|
4220
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownTokenSymbolStyle(tokens.text), children: opt.symbol }),
|
|
4221
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownTokenDotStyle(tokens.textMuted), children: "\xB7" }),
|
|
4222
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: dropdownTokenChainStyle(tokens.textMuted), children: opt.chainName })
|
|
4223
|
+
] }),
|
|
4224
|
+
opt.balance != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: dropdownTokenBalanceStyle(tokens.textMuted), children: [
|
|
4225
|
+
"$",
|
|
4226
|
+
opt.balance.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
4227
|
+
] })
|
|
4228
|
+
] })
|
|
4229
|
+
] }),
|
|
4230
|
+
selected ? /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "22", height: "22", viewBox: "0 0 22 22", fill: "none", children: [
|
|
4231
|
+
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "11", cy: "11", r: "11", fill: tokens.success }),
|
|
4232
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 11l3 3 5-5", stroke: "#fff", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
4233
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: dropdownRadioEmptyStyle(tokens.border) })
|
|
4234
|
+
]
|
|
4235
|
+
},
|
|
4236
|
+
tokenOptionKey(opt)
|
|
4237
|
+
);
|
|
4238
|
+
}) })
|
|
4239
|
+
] })
|
|
4240
|
+
] }),
|
|
4241
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4242
|
+
"button",
|
|
4243
|
+
{
|
|
4244
|
+
type: "button",
|
|
4245
|
+
onClick: () => setShowAdvanced((v) => !v),
|
|
4246
|
+
style: advancedToggleStyle(tokens.accent),
|
|
4247
|
+
children: "Advanced"
|
|
4248
|
+
}
|
|
4249
|
+
),
|
|
4250
|
+
showAdvanced && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4251
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: amountSectionStyle, children: editing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: limitValueStyle(tokens.text), children: [
|
|
4446
4252
|
"$",
|
|
4447
4253
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4448
4254
|
"input",
|
|
@@ -4467,62 +4273,93 @@ function SetupScreen({
|
|
|
4467
4273
|
onClick: startEditing,
|
|
4468
4274
|
children: [
|
|
4469
4275
|
"$",
|
|
4470
|
-
limit.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
4276
|
+
limit.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 }),
|
|
4277
|
+
/* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", style: { marginLeft: 8, opacity: 0.45 }, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.47 3.53a2.74 2.74 0 0 1 3.88 0l.12.12a2.74 2.74 0 0 1 0 3.88L8.84 19.16a2 2 0 0 1-.9.52l-4.56 1.3a.75.75 0 0 1-.93-.93l1.3-4.56a2 2 0 0 1 .52-.9L16.47 3.53Z", stroke: tokens.textMuted, strokeWidth: "1.8", strokeLinecap: "round", strokeLinejoin: "round" }) })
|
|
4471
4278
|
]
|
|
4472
4279
|
}
|
|
4473
4280
|
) }),
|
|
4474
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
]
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
"$",
|
|
4499
|
-
value.toLocaleString()
|
|
4500
|
-
]
|
|
4501
|
-
},
|
|
4502
|
-
value
|
|
4503
|
-
)),
|
|
4504
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4505
|
-
"button",
|
|
4506
|
-
{
|
|
4507
|
-
type: "button",
|
|
4508
|
-
onClick: selectMax,
|
|
4509
|
-
style: presetButtonStyle(tokens, activePreset === "max"),
|
|
4510
|
-
children: "Max"
|
|
4511
|
-
}
|
|
4512
|
-
)
|
|
4281
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: presetsRowStyle, children: [
|
|
4282
|
+
PRESETS.map((value) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4283
|
+
"button",
|
|
4284
|
+
{
|
|
4285
|
+
type: "button",
|
|
4286
|
+
onClick: () => selectPreset(value),
|
|
4287
|
+
style: presetButtonStyle(tokens, activePreset === value),
|
|
4288
|
+
children: [
|
|
4289
|
+
"$",
|
|
4290
|
+
value.toLocaleString()
|
|
4291
|
+
]
|
|
4292
|
+
},
|
|
4293
|
+
value
|
|
4294
|
+
)),
|
|
4295
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4296
|
+
"button",
|
|
4297
|
+
{
|
|
4298
|
+
type: "button",
|
|
4299
|
+
onClick: selectMax,
|
|
4300
|
+
style: presetButtonStyle(tokens, activePreset === "max"),
|
|
4301
|
+
children: "Max"
|
|
4302
|
+
}
|
|
4303
|
+
)
|
|
4304
|
+
] })
|
|
4513
4305
|
] })
|
|
4514
4306
|
]
|
|
4515
4307
|
}
|
|
4516
4308
|
);
|
|
4517
4309
|
}
|
|
4518
|
-
var
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4310
|
+
var mascotStyle2 = {
|
|
4311
|
+
display: "block",
|
|
4312
|
+
margin: "0 auto 12px"
|
|
4313
|
+
};
|
|
4314
|
+
var descriptionStyle = (color) => ({
|
|
4315
|
+
fontSize: "1.05rem",
|
|
4316
|
+
fontWeight: 600,
|
|
4317
|
+
lineHeight: 1.45,
|
|
4522
4318
|
color,
|
|
4523
|
-
margin: "
|
|
4319
|
+
margin: "0 0 24px",
|
|
4524
4320
|
textAlign: "center"
|
|
4525
4321
|
});
|
|
4322
|
+
var tokenRowTriggerStyle = (themeTokens, clickable) => ({
|
|
4323
|
+
display: "flex",
|
|
4324
|
+
alignItems: "center",
|
|
4325
|
+
justifyContent: "space-between",
|
|
4326
|
+
width: "100%",
|
|
4327
|
+
padding: "10px 14px",
|
|
4328
|
+
borderRadius: 999,
|
|
4329
|
+
background: themeTokens.bgCard,
|
|
4330
|
+
border: `1px solid ${themeTokens.border}`,
|
|
4331
|
+
cursor: clickable ? "pointer" : "default",
|
|
4332
|
+
fontFamily: "inherit",
|
|
4333
|
+
marginBottom: 8
|
|
4334
|
+
});
|
|
4335
|
+
var tokenRowLabelStyle = (color) => ({
|
|
4336
|
+
fontSize: "0.95rem",
|
|
4337
|
+
fontWeight: 500,
|
|
4338
|
+
color
|
|
4339
|
+
});
|
|
4340
|
+
var tokenRowRightStyle = {
|
|
4341
|
+
display: "flex",
|
|
4342
|
+
alignItems: "center",
|
|
4343
|
+
gap: 6,
|
|
4344
|
+
flexShrink: 0
|
|
4345
|
+
};
|
|
4346
|
+
var tokenRowSymbolStyle = (color) => ({
|
|
4347
|
+
fontSize: "0.84rem",
|
|
4348
|
+
fontWeight: 500,
|
|
4349
|
+
color
|
|
4350
|
+
});
|
|
4351
|
+
var advancedToggleStyle = (accentColor) => ({
|
|
4352
|
+
display: "block",
|
|
4353
|
+
margin: "4px auto 24px",
|
|
4354
|
+
background: "transparent",
|
|
4355
|
+
border: "none",
|
|
4356
|
+
color: accentColor,
|
|
4357
|
+
fontSize: "0.92rem",
|
|
4358
|
+
fontWeight: 600,
|
|
4359
|
+
fontFamily: "inherit",
|
|
4360
|
+
cursor: "pointer",
|
|
4361
|
+
padding: "4px 8px"
|
|
4362
|
+
});
|
|
4526
4363
|
var errorBannerStyle4 = (tokens) => ({
|
|
4527
4364
|
background: tokens.errorBg,
|
|
4528
4365
|
border: `1px solid ${tokens.error}66`,
|
|
@@ -4533,27 +4370,25 @@ var errorBannerStyle4 = (tokens) => ({
|
|
|
4533
4370
|
marginBottom: 14,
|
|
4534
4371
|
lineHeight: 1.5
|
|
4535
4372
|
});
|
|
4536
|
-
var
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
justifyContent: "space-between",
|
|
4540
|
-
marginBottom: 24,
|
|
4541
|
-
gap: 12
|
|
4373
|
+
var amountSectionStyle = {
|
|
4374
|
+
textAlign: "center",
|
|
4375
|
+
marginBottom: 16
|
|
4542
4376
|
};
|
|
4543
4377
|
var limitValueStyle = (color) => ({
|
|
4544
|
-
fontSize: "2.
|
|
4378
|
+
fontSize: "2.8rem",
|
|
4545
4379
|
fontWeight: 700,
|
|
4546
4380
|
color,
|
|
4547
4381
|
letterSpacing: "-0.02em",
|
|
4548
4382
|
display: "flex",
|
|
4549
|
-
alignItems: "
|
|
4383
|
+
alignItems: "center",
|
|
4384
|
+
justifyContent: "center"
|
|
4550
4385
|
});
|
|
4551
4386
|
var editableLimitStyle = (color) => ({
|
|
4552
4387
|
...limitValueStyle(color),
|
|
4553
4388
|
cursor: "pointer"
|
|
4554
4389
|
});
|
|
4555
4390
|
var limitInputStyle = (color) => ({
|
|
4556
|
-
fontSize: "2.
|
|
4391
|
+
fontSize: "2.8rem",
|
|
4557
4392
|
fontWeight: 700,
|
|
4558
4393
|
color,
|
|
4559
4394
|
background: "transparent",
|
|
@@ -4563,25 +4398,117 @@ var limitInputStyle = (color) => ({
|
|
|
4563
4398
|
width: "6ch",
|
|
4564
4399
|
fontFamily: "inherit",
|
|
4565
4400
|
padding: 0,
|
|
4566
|
-
letterSpacing: "-0.02em"
|
|
4401
|
+
letterSpacing: "-0.02em",
|
|
4402
|
+
textAlign: "center"
|
|
4567
4403
|
});
|
|
4568
|
-
var
|
|
4404
|
+
var tokenIconWrapStyle = {
|
|
4405
|
+
position: "relative",
|
|
4406
|
+
width: 36,
|
|
4407
|
+
height: 36
|
|
4408
|
+
};
|
|
4409
|
+
var dropdownOuterStyle = (themeTokens) => ({
|
|
4410
|
+
marginTop: 4,
|
|
4411
|
+
marginBottom: 12,
|
|
4412
|
+
background: themeTokens.bgCard,
|
|
4413
|
+
border: `1px solid ${themeTokens.border}`,
|
|
4414
|
+
borderRadius: themeTokens.radiusLg,
|
|
4415
|
+
boxShadow: themeTokens.shadowLg,
|
|
4416
|
+
padding: "12px 14px 14px"
|
|
4417
|
+
});
|
|
4418
|
+
var dropdownLabelStyle = (color) => ({
|
|
4419
|
+
fontSize: "0.78rem",
|
|
4420
|
+
fontWeight: 500,
|
|
4421
|
+
color,
|
|
4422
|
+
marginBottom: 8
|
|
4423
|
+
});
|
|
4424
|
+
var dropdownInnerStyle = (themeTokens) => ({
|
|
4425
|
+
background: themeTokens.bgInput,
|
|
4426
|
+
border: `1px solid ${themeTokens.border}`,
|
|
4427
|
+
borderRadius: themeTokens.radiusLg,
|
|
4428
|
+
overflow: "hidden"
|
|
4429
|
+
});
|
|
4430
|
+
var dropdownRowStyle = (themeTokens, isSelected, isLast) => ({
|
|
4569
4431
|
display: "flex",
|
|
4570
4432
|
alignItems: "center",
|
|
4571
|
-
|
|
4572
|
-
|
|
4433
|
+
justifyContent: "space-between",
|
|
4434
|
+
width: "100%",
|
|
4435
|
+
padding: "14px 16px",
|
|
4436
|
+
background: isSelected ? `${themeTokens.accent}18` : "transparent",
|
|
4573
4437
|
border: "none",
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4438
|
+
borderBottom: isLast ? "none" : `1px solid ${themeTokens.border}`,
|
|
4439
|
+
cursor: "pointer",
|
|
4440
|
+
fontFamily: "inherit",
|
|
4441
|
+
textAlign: "left",
|
|
4442
|
+
outline: "none"
|
|
4577
4443
|
});
|
|
4578
|
-
var
|
|
4579
|
-
|
|
4444
|
+
var dropdownRowLeftStyle = {
|
|
4445
|
+
display: "flex",
|
|
4446
|
+
alignItems: "center",
|
|
4447
|
+
gap: 12,
|
|
4448
|
+
minWidth: 0,
|
|
4449
|
+
flex: 1
|
|
4450
|
+
};
|
|
4451
|
+
var dropdownTokenIconStyle = (themeTokens, hasLogo) => ({
|
|
4580
4452
|
width: 36,
|
|
4581
|
-
height: 36
|
|
4453
|
+
height: 36,
|
|
4454
|
+
borderRadius: "50%",
|
|
4455
|
+
border: hasLogo ? "none" : `1.5px solid ${themeTokens.border}`,
|
|
4456
|
+
display: "flex",
|
|
4457
|
+
alignItems: "center",
|
|
4458
|
+
justifyContent: "center",
|
|
4459
|
+
flexShrink: 0,
|
|
4460
|
+
overflow: "hidden"
|
|
4461
|
+
});
|
|
4462
|
+
var dropdownTokenLogoStyle = {
|
|
4463
|
+
width: 36,
|
|
4464
|
+
height: 36,
|
|
4465
|
+
borderRadius: "50%",
|
|
4466
|
+
objectFit: "cover"
|
|
4467
|
+
};
|
|
4468
|
+
var dropdownTokenFallbackStyle = (color) => ({
|
|
4469
|
+
fontSize: "1rem",
|
|
4470
|
+
fontWeight: 700,
|
|
4471
|
+
color
|
|
4472
|
+
});
|
|
4473
|
+
var dropdownTokenInfoStyle = {
|
|
4474
|
+
display: "flex",
|
|
4475
|
+
flexDirection: "column",
|
|
4476
|
+
gap: 2,
|
|
4477
|
+
minWidth: 0
|
|
4478
|
+
};
|
|
4479
|
+
var dropdownTokenNameRowStyle = {
|
|
4480
|
+
display: "flex",
|
|
4481
|
+
alignItems: "center",
|
|
4482
|
+
gap: 4
|
|
4582
4483
|
};
|
|
4484
|
+
var dropdownTokenSymbolStyle = (color) => ({
|
|
4485
|
+
fontSize: "0.92rem",
|
|
4486
|
+
fontWeight: 600,
|
|
4487
|
+
color
|
|
4488
|
+
});
|
|
4489
|
+
var dropdownTokenDotStyle = (color) => ({
|
|
4490
|
+
fontSize: "0.8rem",
|
|
4491
|
+
color
|
|
4492
|
+
});
|
|
4493
|
+
var dropdownTokenChainStyle = (color) => ({
|
|
4494
|
+
fontSize: "0.84rem",
|
|
4495
|
+
fontWeight: 400,
|
|
4496
|
+
color
|
|
4497
|
+
});
|
|
4498
|
+
var dropdownTokenBalanceStyle = (color) => ({
|
|
4499
|
+
fontSize: "0.78rem",
|
|
4500
|
+
color
|
|
4501
|
+
});
|
|
4502
|
+
var dropdownRadioEmptyStyle = (borderColor) => ({
|
|
4503
|
+
width: 22,
|
|
4504
|
+
height: 22,
|
|
4505
|
+
borderRadius: "50%",
|
|
4506
|
+
border: `2px solid ${borderColor}`,
|
|
4507
|
+
flexShrink: 0
|
|
4508
|
+
});
|
|
4583
4509
|
var presetsRowStyle = {
|
|
4584
4510
|
display: "flex",
|
|
4511
|
+
justifyContent: "center",
|
|
4585
4512
|
gap: 10,
|
|
4586
4513
|
marginBottom: 24
|
|
4587
4514
|
};
|
|
@@ -4615,8 +4542,8 @@ function SetupStatusScreen({
|
|
|
4615
4542
|
return /* @__PURE__ */ jsxRuntime.jsxs(ScreenLayout, { footer: /* @__PURE__ */ jsxRuntime.jsx(PoweredByFooter, {}), children: [
|
|
4616
4543
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack: onContinue }),
|
|
4617
4544
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle5, children: [
|
|
4618
|
-
/* @__PURE__ */ jsxRuntime.jsx("img", { src: BLINK_LOGO, alt: "Blink", style:
|
|
4619
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
4545
|
+
/* @__PURE__ */ jsxRuntime.jsx("img", { src: BLINK_LOGO, alt: "Blink", style: mascotStyle3 }),
|
|
4546
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "Done!" }),
|
|
4620
4547
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle6(tokens.textSecondary), children: "Return to the app to try one-tap deposits." })
|
|
4621
4548
|
] })
|
|
4622
4549
|
] });
|
|
@@ -4629,7 +4556,7 @@ function SetupStatusScreen({
|
|
|
4629
4556
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
4630
4557
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle5, children: [
|
|
4631
4558
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
4632
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
4559
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle6(tokens.text), children: "Setting up One-Tap..." }),
|
|
4633
4560
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle5(tokens), children: error }),
|
|
4634
4561
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: stepsWrapStyle, children: /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps }) }),
|
|
4635
4562
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: waitHintStyle(tokens.textMuted), children: "Usually takes a few seconds" })
|
|
@@ -4645,11 +4572,11 @@ var contentStyle5 = {
|
|
|
4645
4572
|
textAlign: "center",
|
|
4646
4573
|
padding: "0 24px 32px"
|
|
4647
4574
|
};
|
|
4648
|
-
var
|
|
4575
|
+
var mascotStyle3 = {
|
|
4649
4576
|
width: 56,
|
|
4650
4577
|
height: 56
|
|
4651
4578
|
};
|
|
4652
|
-
var
|
|
4579
|
+
var headingStyle6 = (color) => ({
|
|
4653
4580
|
fontSize: "1.45rem",
|
|
4654
4581
|
fontWeight: 700,
|
|
4655
4582
|
letterSpacing: "-0.02em",
|
|
@@ -4743,7 +4670,7 @@ function DepositScreen({
|
|
|
4743
4670
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: pickerRef, style: depositCardWrapStyle, children: [
|
|
4744
4671
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
4745
4672
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: depositLabelStyle(tokens.textMuted), children: "Depositing" }),
|
|
4746
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { style:
|
|
4673
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountRowStyle, children: [
|
|
4747
4674
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: amountValueStyle(tokens.text), children: [
|
|
4748
4675
|
"$",
|
|
4749
4676
|
amount.toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
@@ -4753,7 +4680,7 @@ function DepositScreen({
|
|
|
4753
4680
|
{
|
|
4754
4681
|
type: "button",
|
|
4755
4682
|
onClick: onSelectToken,
|
|
4756
|
-
style:
|
|
4683
|
+
style: tokenIconButtonStyle(!!onSelectToken),
|
|
4757
4684
|
children: [
|
|
4758
4685
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconWrapStyle2, children: selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
|
|
4759
4686
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
|
|
@@ -4883,7 +4810,7 @@ var depositLabelStyle = (color) => ({
|
|
|
4883
4810
|
color,
|
|
4884
4811
|
marginBottom: 4
|
|
4885
4812
|
});
|
|
4886
|
-
var
|
|
4813
|
+
var amountRowStyle = {
|
|
4887
4814
|
display: "flex",
|
|
4888
4815
|
alignItems: "center",
|
|
4889
4816
|
justifyContent: "space-between",
|
|
@@ -4895,7 +4822,7 @@ var amountValueStyle = (color) => ({
|
|
|
4895
4822
|
letterSpacing: "-0.02em",
|
|
4896
4823
|
color
|
|
4897
4824
|
});
|
|
4898
|
-
var
|
|
4825
|
+
var tokenIconButtonStyle = (clickable) => ({
|
|
4899
4826
|
display: "flex",
|
|
4900
4827
|
alignItems: "center",
|
|
4901
4828
|
gap: 4,
|
|
@@ -5102,7 +5029,7 @@ function SuccessScreen({
|
|
|
5102
5029
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle6, children: [
|
|
5103
5030
|
succeeded ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5104
5031
|
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "success", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: tokens.success }) }) }),
|
|
5105
|
-
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style:
|
|
5032
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style: headingStyle7(tokens.text), children: [
|
|
5106
5033
|
"$",
|
|
5107
5034
|
amount.toFixed(2),
|
|
5108
5035
|
" deposited"
|
|
@@ -5113,7 +5040,7 @@ function SuccessScreen({
|
|
|
5113
5040
|
] })
|
|
5114
5041
|
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5115
5042
|
/* @__PURE__ */ jsxRuntime.jsx(IconCircle, { variant: "error", size: 64, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z", fill: tokens.error }) }) }),
|
|
5116
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
5043
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle7(tokens.text), children: "Transfer failed" }),
|
|
5117
5044
|
error && /* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle7(tokens.error), children: error })
|
|
5118
5045
|
] }),
|
|
5119
5046
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: summaryCardStyle(tokens), children: [
|
|
@@ -5153,7 +5080,7 @@ var contentStyle6 = {
|
|
|
5153
5080
|
alignItems: "center",
|
|
5154
5081
|
paddingTop: 16
|
|
5155
5082
|
};
|
|
5156
|
-
var
|
|
5083
|
+
var headingStyle7 = (color) => ({
|
|
5157
5084
|
fontSize: "1.5rem",
|
|
5158
5085
|
fontWeight: 700,
|
|
5159
5086
|
letterSpacing: "-0.02em",
|
|
@@ -5477,7 +5404,7 @@ function AdvancedSourceScreen({
|
|
|
5477
5404
|
right: /* @__PURE__ */ jsxRuntime.jsx("span", { style: advancedBadgeStyle(tokens.accent), children: "Advanced" })
|
|
5478
5405
|
}
|
|
5479
5406
|
),
|
|
5480
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
5407
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle8(tokens.text), children: "Set up One-Tap deposits" }),
|
|
5481
5408
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle9(tokens.textSecondary), children: "Select a token source for your One-Tap deposits." }),
|
|
5482
5409
|
/* @__PURE__ */ jsxRuntime.jsx("label", { style: labelStyle5(tokens.textSecondary), children: "Select tokens to approve" }),
|
|
5483
5410
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: chainListStyle, children: choices.map((chain) => {
|
|
@@ -5541,7 +5468,7 @@ var advancedBadgeStyle = (color) => ({
|
|
|
5541
5468
|
padding: "3px 10px",
|
|
5542
5469
|
letterSpacing: "0.02em"
|
|
5543
5470
|
});
|
|
5544
|
-
var
|
|
5471
|
+
var headingStyle8 = (color) => ({
|
|
5545
5472
|
fontSize: "1.3rem",
|
|
5546
5473
|
fontWeight: 700,
|
|
5547
5474
|
letterSpacing: "-0.02em",
|
|
@@ -5678,7 +5605,7 @@ function TransferStatusScreen({
|
|
|
5678
5605
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5679
5606
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle7, children: [
|
|
5680
5607
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 64 }),
|
|
5681
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
5608
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle9(tokens.text), children: "Depositing your money..." }),
|
|
5682
5609
|
error && /* @__PURE__ */ jsxRuntime.jsx("div", { style: errorBannerStyle7(tokens), children: error }),
|
|
5683
5610
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: stepsWrapStyle2, children: /* @__PURE__ */ jsxRuntime.jsx(StepList, { steps }) })
|
|
5684
5611
|
] })
|
|
@@ -5693,7 +5620,7 @@ var contentStyle7 = {
|
|
|
5693
5620
|
textAlign: "center",
|
|
5694
5621
|
padding: "0 24px"
|
|
5695
5622
|
};
|
|
5696
|
-
var
|
|
5623
|
+
var headingStyle9 = (color) => ({
|
|
5697
5624
|
fontSize: "1.45rem",
|
|
5698
5625
|
fontWeight: 700,
|
|
5699
5626
|
letterSpacing: "-0.02em",
|
|
@@ -5756,7 +5683,7 @@ function OpenWalletScreen({
|
|
|
5756
5683
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5757
5684
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle8, children: [
|
|
5758
5685
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 32 }) }),
|
|
5759
|
-
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style:
|
|
5686
|
+
/* @__PURE__ */ jsxRuntime.jsxs("h2", { style: headingStyle10(tokens.text), children: [
|
|
5760
5687
|
"Setting up ",
|
|
5761
5688
|
displayName,
|
|
5762
5689
|
"..."
|
|
@@ -5789,7 +5716,7 @@ function OpenWalletScreen({
|
|
|
5789
5716
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onBack, onLogout }),
|
|
5790
5717
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle8, children: [
|
|
5791
5718
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: logoCircleStyle(tokens.bgInput), children: logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle2 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 32 }) }),
|
|
5792
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
5719
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle10(tokens.text), children: loading ? "Connecting..." : `Open ${displayName}` }),
|
|
5793
5720
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle10(tokens.textSecondary), children: loading ? "Creating transfer and preparing your wallet link..." : `Continue in ${displayName} to authorize this connection.` }),
|
|
5794
5721
|
!loading && /* @__PURE__ */ jsxRuntime.jsxs("div", { style: waitingBadgeStyle(tokens), children: [
|
|
5795
5722
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 14 }),
|
|
@@ -5830,7 +5757,7 @@ var logoStyle2 = {
|
|
|
5830
5757
|
borderRadius: 12,
|
|
5831
5758
|
objectFit: "contain"
|
|
5832
5759
|
};
|
|
5833
|
-
var
|
|
5760
|
+
var headingStyle10 = (color) => ({
|
|
5834
5761
|
fontSize: "1.45rem",
|
|
5835
5762
|
fontWeight: 700,
|
|
5836
5763
|
letterSpacing: "-0.02em",
|
|
@@ -5888,7 +5815,7 @@ function ConfirmSignScreen({
|
|
|
5888
5815
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
5889
5816
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle9, children: [
|
|
5890
5817
|
logoSrc ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logoSrc, alt: displayName, style: logoStyle3 }) : /* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
5891
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
5818
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle11(tokens.text), children: "Wallet authorized" }),
|
|
5892
5819
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { style: subtitleStyle11(tokens.textSecondary), children: [
|
|
5893
5820
|
displayName,
|
|
5894
5821
|
" approved the connection. Tap below to confirm your payment."
|
|
@@ -5917,7 +5844,7 @@ var logoStyle3 = {
|
|
|
5917
5844
|
borderRadius: 14,
|
|
5918
5845
|
objectFit: "contain"
|
|
5919
5846
|
};
|
|
5920
|
-
var
|
|
5847
|
+
var headingStyle11 = (color) => ({
|
|
5921
5848
|
fontSize: "1.45rem",
|
|
5922
5849
|
fontWeight: 700,
|
|
5923
5850
|
letterSpacing: "-0.02em",
|
|
@@ -6008,7 +5935,7 @@ function TokenPickerScreen({
|
|
|
6008
5935
|
{
|
|
6009
5936
|
type: "button",
|
|
6010
5937
|
onClick: onBack,
|
|
6011
|
-
style:
|
|
5938
|
+
style: tokenIconButtonStyle2,
|
|
6012
5939
|
children: [
|
|
6013
5940
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: tokenIconWrapStyle3, children: selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
|
|
6014
5941
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
|
|
@@ -6071,7 +5998,7 @@ var depositAmountStyle = (color) => ({
|
|
|
6071
5998
|
letterSpacing: "-0.02em",
|
|
6072
5999
|
color
|
|
6073
6000
|
});
|
|
6074
|
-
var
|
|
6001
|
+
var tokenIconButtonStyle2 = {
|
|
6075
6002
|
display: "flex",
|
|
6076
6003
|
alignItems: "center",
|
|
6077
6004
|
gap: 4,
|
|
@@ -6197,6 +6124,16 @@ var selectCircleSelectedStyle = (color) => ({
|
|
|
6197
6124
|
function entryKey(entry) {
|
|
6198
6125
|
return `${entry.sourceChainId}-${entry.tokenAddress.toLowerCase()}`;
|
|
6199
6126
|
}
|
|
6127
|
+
function isPreciseMoneyNonPositive(fee) {
|
|
6128
|
+
const raw = fee.value.trim();
|
|
6129
|
+
if (!/^-?\d+(\.\d*)?$/.test(raw)) return false;
|
|
6130
|
+
const n = Number(raw);
|
|
6131
|
+
return Number.isFinite(n) && n <= 0;
|
|
6132
|
+
}
|
|
6133
|
+
function formatNonPositiveFeeDisplay(fee) {
|
|
6134
|
+
if (fee.currency === "USD") return "Under $0.01";
|
|
6135
|
+
return `Less than 0.01 ${fee.currency}`;
|
|
6136
|
+
}
|
|
6200
6137
|
function formatPreciseMoneyForDisplay(fee) {
|
|
6201
6138
|
const raw = fee.value.trim();
|
|
6202
6139
|
if (fee.currency === "USD") {
|
|
@@ -6249,12 +6186,13 @@ function GuestTokenPickerScreen({
|
|
|
6249
6186
|
const canConfirm = Boolean(quoteFee && pendingEntry && !quoteLoading);
|
|
6250
6187
|
const feeLine = (() => {
|
|
6251
6188
|
if (quoteLoading && pendingEntry) {
|
|
6252
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { style:
|
|
6189
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: feeRowContainerStyle, "aria-live": "polite", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowLabelStyle(t.textMuted), children: "Getting fee estimate\u2026" }) });
|
|
6253
6190
|
}
|
|
6254
6191
|
if (quoteFee) {
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6192
|
+
const feeText = isPreciseMoneyNonPositive(quoteFee) ? formatNonPositiveFeeDisplay(quoteFee) : formatPreciseMoneyForDisplay(quoteFee);
|
|
6193
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: feeRowContainerStyle, "aria-live": "polite", children: [
|
|
6194
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowLabelStyle(t.textMuted), children: "Fee estimate: " }),
|
|
6195
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { style: feeRowAmountStyle(t.textSecondary), children: feeText })
|
|
6258
6196
|
] });
|
|
6259
6197
|
}
|
|
6260
6198
|
return null;
|
|
@@ -6459,11 +6397,15 @@ var depositAmountStyle2 = (color) => ({
|
|
|
6459
6397
|
color,
|
|
6460
6398
|
lineHeight: 1.05
|
|
6461
6399
|
});
|
|
6462
|
-
var
|
|
6400
|
+
var feeRowContainerStyle = {
|
|
6463
6401
|
fontSize: "0.84rem",
|
|
6464
6402
|
fontWeight: 500,
|
|
6465
|
-
color,
|
|
6466
6403
|
marginTop: 6
|
|
6404
|
+
};
|
|
6405
|
+
var feeRowLabelStyle = (color) => ({ color });
|
|
6406
|
+
var feeRowAmountStyle = (color) => ({
|
|
6407
|
+
color,
|
|
6408
|
+
fontVariantNumeric: "tabular-nums"
|
|
6467
6409
|
});
|
|
6468
6410
|
var tokenTriggerStyle = (tokens, interactive) => ({
|
|
6469
6411
|
display: "flex",
|
|
@@ -6627,7 +6569,7 @@ function GuestPreauthSetupCompleteScreen({
|
|
|
6627
6569
|
fill: tokens.success
|
|
6628
6570
|
}
|
|
6629
6571
|
) }) }),
|
|
6630
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
6572
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle12(tokens.text), children: "Setup complete" }),
|
|
6631
6573
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle12(tokens.textSecondary), children: "Your account is linked and ready. You can close this window or make another deposit." })
|
|
6632
6574
|
] })
|
|
6633
6575
|
]
|
|
@@ -6642,7 +6584,7 @@ var contentStyle10 = {
|
|
|
6642
6584
|
gap: 12,
|
|
6643
6585
|
paddingTop: 8
|
|
6644
6586
|
};
|
|
6645
|
-
function
|
|
6587
|
+
function headingStyle12(color) {
|
|
6646
6588
|
return {
|
|
6647
6589
|
margin: 0,
|
|
6648
6590
|
fontSize: 22,
|
|
@@ -6665,7 +6607,7 @@ function GuestPreauthLinkingScreen({ onLogout }) {
|
|
|
6665
6607
|
/* @__PURE__ */ jsxRuntime.jsx(ScreenHeader, { onLogout }),
|
|
6666
6608
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { style: contentStyle11, children: [
|
|
6667
6609
|
/* @__PURE__ */ jsxRuntime.jsx(Spinner, { size: 48 }),
|
|
6668
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
6610
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle13(tokens.text), children: "Setting up your account..." }),
|
|
6669
6611
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: subtitleStyle13(tokens.textSecondary), children: "Linking your wallet to your Blink account. This usually takes a few seconds." })
|
|
6670
6612
|
] })
|
|
6671
6613
|
] });
|
|
@@ -6679,7 +6621,7 @@ var contentStyle11 = {
|
|
|
6679
6621
|
textAlign: "center",
|
|
6680
6622
|
padding: "0 24px 32px"
|
|
6681
6623
|
};
|
|
6682
|
-
function
|
|
6624
|
+
function headingStyle13(color) {
|
|
6683
6625
|
return {
|
|
6684
6626
|
margin: "20px 0 8px",
|
|
6685
6627
|
fontSize: "1.45rem",
|
|
@@ -6727,6 +6669,10 @@ function resolveHeaderFlowPhase(screen, phase, authenticated) {
|
|
|
6727
6669
|
return raw;
|
|
6728
6670
|
}
|
|
6729
6671
|
var DEFAULT_MIN_DEPOSIT_USD = 0.25;
|
|
6672
|
+
var GUEST_PREAUTH_LOGIN_HERO_TITLE = "Create an account to complete one tap setup";
|
|
6673
|
+
function isGuestPreauthLogin(state) {
|
|
6674
|
+
return state.isGuestFlow && (state.guestPreauthSessionId != null || state.guestPreauthAccountId != null);
|
|
6675
|
+
}
|
|
6730
6676
|
function StepRenderer(props) {
|
|
6731
6677
|
const screen = screenForPhase(props.flow.state.phase);
|
|
6732
6678
|
const flowPhase = resolveHeaderFlowPhase(
|
|
@@ -6806,7 +6752,8 @@ function StepRendererContent({
|
|
|
6806
6752
|
sending: activeOtpStatus === "sending-code",
|
|
6807
6753
|
error: state.error,
|
|
6808
6754
|
onBack,
|
|
6809
|
-
merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0
|
|
6755
|
+
merchantInitials: merchantName ? merchantName.slice(0, 2).toUpperCase() : void 0,
|
|
6756
|
+
heroTitle: isGuestPreauthLogin(state) ? GUEST_PREAUTH_LOGIN_HERO_TITLE : void 0
|
|
6810
6757
|
}
|
|
6811
6758
|
);
|
|
6812
6759
|
case "otp-verify":
|
|
@@ -6906,6 +6853,28 @@ function StepRendererContent({
|
|
|
6906
6853
|
);
|
|
6907
6854
|
const effectiveTokenCount = tokenCount > 0 ? tokenCount : selectSourceTokenCount;
|
|
6908
6855
|
const effectiveSourceLabel = selectedSourceLabel ?? (selectSourceChainName && selectSourceTokenSymbol ? `${selectSourceTokenSymbol} on ${selectSourceChainName}` : void 0);
|
|
6856
|
+
const setupTokenOptions = selectedAccount ? selectedAccount.wallets.flatMap(
|
|
6857
|
+
(w) => w.sources.filter((s) => s.balance.total.amount > 0).map((s) => ({
|
|
6858
|
+
symbol: s.token.symbol,
|
|
6859
|
+
chainName: w.chain.name,
|
|
6860
|
+
balance: s.balance.available.amount,
|
|
6861
|
+
walletId: w.id
|
|
6862
|
+
}))
|
|
6863
|
+
) : selectSourceChoices.flatMap(
|
|
6864
|
+
(chain) => chain.tokens.map((t) => ({
|
|
6865
|
+
symbol: t.tokenSymbol,
|
|
6866
|
+
chainName: chain.chainName,
|
|
6867
|
+
balance: t.balance
|
|
6868
|
+
}))
|
|
6869
|
+
);
|
|
6870
|
+
const handleSetupSelectToken = (symbol, chainName, walletId) => {
|
|
6871
|
+
if (walletId) {
|
|
6872
|
+
handlers.onSelectAuthorizedToken(walletId, symbol);
|
|
6873
|
+
} else {
|
|
6874
|
+
handlers.onSelectSourceChainChange(chainName);
|
|
6875
|
+
handlers.onSetSelectSourceTokenSymbol(symbol);
|
|
6876
|
+
}
|
|
6877
|
+
};
|
|
6909
6878
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6910
6879
|
SetupScreen,
|
|
6911
6880
|
{
|
|
@@ -6919,7 +6888,9 @@ function StepRendererContent({
|
|
|
6919
6888
|
selectedSourceLabel: effectiveSourceLabel,
|
|
6920
6889
|
loading: savingOneTapLimit,
|
|
6921
6890
|
error: state.error,
|
|
6922
|
-
selectedTokenSymbol: selectedSource?.token.symbol ?? selectSourceTokenSymbol
|
|
6891
|
+
selectedTokenSymbol: selectedSource?.token.symbol ?? selectSourceTokenSymbol,
|
|
6892
|
+
tokenOptions: setupTokenOptions,
|
|
6893
|
+
onSelectToken: handleSetupSelectToken
|
|
6923
6894
|
}
|
|
6924
6895
|
);
|
|
6925
6896
|
}
|
|
@@ -7129,7 +7100,7 @@ var PaymentErrorBoundary = class extends react.Component {
|
|
|
7129
7100
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 8v5", stroke: "#ef4444", strokeWidth: "1.5", strokeLinecap: "round" }),
|
|
7130
7101
|
/* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "16", r: "0.75", fill: "#ef4444" })
|
|
7131
7102
|
] }) }),
|
|
7132
|
-
/* @__PURE__ */ jsxRuntime.jsx("h2", { style:
|
|
7103
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { style: headingStyle14, children: "Something went wrong" }),
|
|
7133
7104
|
/* @__PURE__ */ jsxRuntime.jsx("p", { style: messageStyle, children: "An unexpected error occurred. Please try again." }),
|
|
7134
7105
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: this.handleReset, style: buttonStyle3, children: "Try again" })
|
|
7135
7106
|
] });
|
|
@@ -7149,7 +7120,7 @@ var containerStyle9 = {
|
|
|
7149
7120
|
var iconStyle3 = {
|
|
7150
7121
|
marginBottom: 20
|
|
7151
7122
|
};
|
|
7152
|
-
var
|
|
7123
|
+
var headingStyle14 = {
|
|
7153
7124
|
fontSize: "1.25rem",
|
|
7154
7125
|
fontWeight: 700,
|
|
7155
7126
|
color: "#1a1a1a",
|
|
@@ -7909,7 +7880,7 @@ function useProviderHandlers(deps) {
|
|
|
7909
7880
|
guestSessionToken: result.guestSessionToken
|
|
7910
7881
|
});
|
|
7911
7882
|
} else {
|
|
7912
|
-
const account = getAccount(wagmiConfig2);
|
|
7883
|
+
const account = core.getAccount(wagmiConfig2);
|
|
7913
7884
|
if (!account.isConnected) {
|
|
7914
7885
|
const connector = connectors.find((c) => c.type === "injected") ?? connectors[0];
|
|
7915
7886
|
if (!connector) {
|
|
@@ -7959,9 +7930,6 @@ function useProviderHandlers(deps) {
|
|
|
7959
7930
|
useWalletConnector: useWalletConnectorProp,
|
|
7960
7931
|
userAgent: typeof navigator === "undefined" ? void 0 : navigator.userAgent
|
|
7961
7932
|
});
|
|
7962
|
-
if (!isMobile) {
|
|
7963
|
-
dispatch({ type: "PAY_STARTED" });
|
|
7964
|
-
}
|
|
7965
7933
|
try {
|
|
7966
7934
|
let accountId;
|
|
7967
7935
|
let sessionId;
|
|
@@ -8000,6 +7968,11 @@ function useProviderHandlers(deps) {
|
|
|
8000
7968
|
triggerDeeplink(sessionUri);
|
|
8001
7969
|
dispatch({ type: "MOBILE_DEEPLINK_READY", deeplinkUri: sessionUri });
|
|
8002
7970
|
} else {
|
|
7971
|
+
dispatch({
|
|
7972
|
+
type: "SELECT_ACCOUNT",
|
|
7973
|
+
accountId,
|
|
7974
|
+
walletId: null
|
|
7975
|
+
});
|
|
8003
7976
|
await authExecutor.executeSessionById(sessionId);
|
|
8004
7977
|
await reloadAccounts();
|
|
8005
7978
|
}
|
|
@@ -8008,10 +7981,6 @@ function useProviderHandlers(deps) {
|
|
|
8008
7981
|
const msg = err instanceof Error ? err.message : "Failed to set up wallet";
|
|
8009
7982
|
dispatch({ type: "PAY_ERROR", error: msg });
|
|
8010
7983
|
onError?.(msg);
|
|
8011
|
-
} finally {
|
|
8012
|
-
if (!isMobile) {
|
|
8013
|
-
dispatch({ type: "PAY_ENDED" });
|
|
8014
|
-
}
|
|
8015
7984
|
}
|
|
8016
7985
|
}, [
|
|
8017
7986
|
authenticated,
|
|
@@ -8390,9 +8359,18 @@ function useGuestTransferHandlers(deps) {
|
|
|
8390
8359
|
const executingBridgeRef = react.useRef(false);
|
|
8391
8360
|
const fetchedRef = react.useRef(false);
|
|
8392
8361
|
const selectedGuestTokenRef = react.useRef(null);
|
|
8362
|
+
react.useEffect(() => {
|
|
8363
|
+
if (guestTransferId != null) return;
|
|
8364
|
+
fetchedRef.current = false;
|
|
8365
|
+
setGuestTokenEntries([]);
|
|
8366
|
+
setPendingGuestEntry(null);
|
|
8367
|
+
setGuestFee(null);
|
|
8368
|
+
setGuestQuoteLoading(false);
|
|
8369
|
+
setLoadingBalances(false);
|
|
8370
|
+
}, [guestTransferId]);
|
|
8393
8371
|
react.useEffect(() => {
|
|
8394
8372
|
if (!isGuestFlow || !guestTransferId || !guestSessionToken || fetchedRef.current) return;
|
|
8395
|
-
const account = getAccount(wagmiConfig2);
|
|
8373
|
+
const account = core.getAccount(wagmiConfig2);
|
|
8396
8374
|
if (!account.address) return;
|
|
8397
8375
|
fetchedRef.current = true;
|
|
8398
8376
|
setLoadingBalances(true);
|
|
@@ -8459,7 +8437,7 @@ function useGuestTransferHandlers(deps) {
|
|
|
8459
8437
|
}, [isGuestFlow]);
|
|
8460
8438
|
const handleSelectGuestToken = react.useCallback(async (entry) => {
|
|
8461
8439
|
if (!guestTransferId || !guestSessionToken) return;
|
|
8462
|
-
const account = getAccount(wagmiConfig2);
|
|
8440
|
+
const account = core.getAccount(wagmiConfig2);
|
|
8463
8441
|
if (!account.address) {
|
|
8464
8442
|
dispatch({ type: "SET_ERROR", error: "Wallet not connected." });
|
|
8465
8443
|
return;
|
|
@@ -8494,7 +8472,7 @@ function useGuestTransferHandlers(deps) {
|
|
|
8494
8472
|
}, [guestTransferId, guestSessionToken, wagmiConfig2, apiBaseUrl, dispatch, onError]);
|
|
8495
8473
|
const handleConfirmGuestToken = react.useCallback(async () => {
|
|
8496
8474
|
if (!guestTransferId || !guestSessionToken || !pendingGuestEntry) return;
|
|
8497
|
-
const account = getAccount(wagmiConfig2);
|
|
8475
|
+
const account = core.getAccount(wagmiConfig2);
|
|
8498
8476
|
if (!account.address) {
|
|
8499
8477
|
dispatch({ type: "SET_ERROR", error: "Wallet not connected." });
|
|
8500
8478
|
return;
|
|
@@ -8564,7 +8542,7 @@ function useGuestTransferHandlers(deps) {
|
|
|
8564
8542
|
`[blink-sdk] type=guest Bridge quote ready: ${signPayload.bridgeSteps.length} step(s), token=${signPayload.tokenSymbol}, chain=${signPayload.chainName}`
|
|
8565
8543
|
);
|
|
8566
8544
|
const selectedToken = selectedGuestTokenRef.current;
|
|
8567
|
-
const account = getAccount(wagmiConfig2);
|
|
8545
|
+
const account = core.getAccount(wagmiConfig2);
|
|
8568
8546
|
const targetChainId = selectedToken?.chainId;
|
|
8569
8547
|
if (targetChainId) {
|
|
8570
8548
|
const numericChainId = Number(targetChainId);
|
|
@@ -8573,7 +8551,7 @@ function useGuestTransferHandlers(deps) {
|
|
|
8573
8551
|
await switchChainAsync({ chainId: numericChainId });
|
|
8574
8552
|
}
|
|
8575
8553
|
}
|
|
8576
|
-
const walletClient = await getWalletClient(wagmiConfig2);
|
|
8554
|
+
const walletClient = await core.getWalletClient(wagmiConfig2);
|
|
8577
8555
|
const sender = account.address;
|
|
8578
8556
|
if (!sender) {
|
|
8579
8557
|
dispatch({ type: "PAY_ERROR", error: "Wallet not connected." });
|
|
@@ -8595,7 +8573,7 @@ function useGuestTransferHandlers(deps) {
|
|
|
8595
8573
|
}]
|
|
8596
8574
|
});
|
|
8597
8575
|
console.info(`[blink-sdk] type=guest Bridge step ${stepIdx + 1} tx sent: ${txHash}`);
|
|
8598
|
-
await waitForTransactionReceipt(wagmiConfig2, {
|
|
8576
|
+
await core.waitForTransactionReceipt(wagmiConfig2, {
|
|
8599
8577
|
hash: txHash
|
|
8600
8578
|
});
|
|
8601
8579
|
lastTxHash = txHash;
|
|
@@ -9739,7 +9717,9 @@ function useGuestDesktopPreauthSessionEffect(deps) {
|
|
|
9739
9717
|
function useGuestPreauthPhaseSyncEffect(deps) {
|
|
9740
9718
|
const { state, dispatch, authExecutor, isDesktop, privyAuthenticated } = deps;
|
|
9741
9719
|
react.useEffect(() => {
|
|
9742
|
-
if (!
|
|
9720
|
+
if (!isDesktop) return;
|
|
9721
|
+
const standardDesktopAuth = privyAuthenticated && state.activeCredentialId != null && !state.guestPreauthorizing;
|
|
9722
|
+
if (!state.guestPreauthorizing && !standardDesktopAuth) return;
|
|
9743
9723
|
const pending = authExecutor.pendingSelectSource;
|
|
9744
9724
|
if (pending) {
|
|
9745
9725
|
if (state.phase.step === "token-picker") {
|
|
@@ -9763,7 +9743,7 @@ function useGuestPreauthPhaseSyncEffect(deps) {
|
|
|
9763
9743
|
dispatch({ type: "SET_USER_INTENT", intent: { step: "one-tap-setup", action: null } });
|
|
9764
9744
|
return;
|
|
9765
9745
|
}
|
|
9766
|
-
if (!privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
|
|
9746
|
+
if (state.guestPreauthorizing && !privyAuthenticated && authExecutor.executing && state.guestPreauthAccountId) {
|
|
9767
9747
|
const accountId = state.guestPreauthAccountId;
|
|
9768
9748
|
const p = state.phase;
|
|
9769
9749
|
if (p.step === "wallet-setup" && p.mobile == null && p.guestDesktopExtension && p.accountId === accountId) {
|
|
@@ -9791,6 +9771,7 @@ function useGuestPreauthPhaseSyncEffect(deps) {
|
|
|
9791
9771
|
state.guestPreauthorizing,
|
|
9792
9772
|
state.phase,
|
|
9793
9773
|
state.guestPreauthAccountId,
|
|
9774
|
+
state.activeCredentialId,
|
|
9794
9775
|
isDesktop,
|
|
9795
9776
|
privyAuthenticated,
|
|
9796
9777
|
authExecutor.pendingSelectSource,
|