@rhinestone/deposit-modal 0.1.25 → 0.1.27
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/{DepositModalReown-QQ6WI265.cjs → DepositModalReown-NGYZ4G7Q.cjs} +3 -3
- package/dist/{DepositModalReown-4A5HJK74.mjs → DepositModalReown-PFKTSKDS.mjs} +2 -2
- package/dist/{WithdrawModalReown-HBORIX2O.mjs → WithdrawModalReown-6AAWH35J.mjs} +2 -2
- package/dist/{WithdrawModalReown-L77OC26X.cjs → WithdrawModalReown-BA6ECON3.cjs} +3 -3
- package/dist/{chunk-VBNFP3JF.cjs → chunk-7MQU2SR7.cjs} +73 -83
- package/dist/{chunk-JAR372KJ.mjs → chunk-AJALMXW4.mjs} +31 -41
- package/dist/{chunk-B3HMNWR4.mjs → chunk-QCRZCGAE.mjs} +30 -34
- package/dist/{chunk-CZWAKYDR.cjs → chunk-QWYZJL3L.cjs} +116 -192
- package/dist/{chunk-4QDHXCPG.cjs → chunk-XIS33BZ6.cjs} +66 -70
- package/dist/{chunk-GAFLOODV.mjs → chunk-YOFGP4FV.mjs} +94 -170
- package/dist/deposit.cjs +3 -3
- package/dist/deposit.mjs +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +3 -3
- package/dist/reown.cjs +4 -4
- package/dist/reown.mjs +3 -3
- package/dist/withdraw.cjs +3 -3
- package/dist/withdraw.mjs +2 -2
- package/package.json +1 -2
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
11
|
var _chunkCEIWN53Ncjs = require('./chunk-CEIWN53N.cjs');
|
|
14
12
|
|
|
15
13
|
// src/components/ui/Modal.tsx
|
|
@@ -146,6 +144,67 @@ Modal.displayName = "Modal";
|
|
|
146
144
|
function jsonReplacer(_key, value) {
|
|
147
145
|
return typeof value === "bigint" ? value.toString() : value;
|
|
148
146
|
}
|
|
147
|
+
function asRecord(value) {
|
|
148
|
+
return typeof value === "object" && value !== null ? value : null;
|
|
149
|
+
}
|
|
150
|
+
function toBigInt(value) {
|
|
151
|
+
if (typeof value === "bigint") return value;
|
|
152
|
+
if (typeof value === "number" && Number.isInteger(value)) return BigInt(value);
|
|
153
|
+
if (typeof value === "string" && value.trim() !== "") return BigInt(value);
|
|
154
|
+
throw new Error("Invalid bigint value");
|
|
155
|
+
}
|
|
156
|
+
function normalizeSessionTypedData(raw) {
|
|
157
|
+
const data = structuredClone(raw);
|
|
158
|
+
const domain = asRecord(data.domain);
|
|
159
|
+
if (domain && domain.chainId !== void 0 && domain.chainId !== null) {
|
|
160
|
+
domain.chainId = toBigInt(domain.chainId);
|
|
161
|
+
}
|
|
162
|
+
const message = asRecord(data.message);
|
|
163
|
+
if (!message || !Array.isArray(message.sessionsAndChainIds)) {
|
|
164
|
+
return data;
|
|
165
|
+
}
|
|
166
|
+
for (const entry of message.sessionsAndChainIds) {
|
|
167
|
+
const chainSession = asRecord(entry);
|
|
168
|
+
if (!chainSession) continue;
|
|
169
|
+
if (chainSession.chainId !== void 0 && chainSession.chainId !== null) {
|
|
170
|
+
chainSession.chainId = toBigInt(chainSession.chainId);
|
|
171
|
+
}
|
|
172
|
+
const session = asRecord(chainSession.session);
|
|
173
|
+
if (!session) continue;
|
|
174
|
+
if (session.nonce !== void 0 && session.nonce !== null) {
|
|
175
|
+
session.nonce = toBigInt(session.nonce);
|
|
176
|
+
}
|
|
177
|
+
if (session.expires !== void 0 && session.expires !== null) {
|
|
178
|
+
session.expires = toBigInt(session.expires);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return data;
|
|
182
|
+
}
|
|
183
|
+
function normalizePrepareAccountResponse(raw) {
|
|
184
|
+
const data = raw;
|
|
185
|
+
return {
|
|
186
|
+
smartAccount: data.smartAccount,
|
|
187
|
+
accountParams: data.accountParams,
|
|
188
|
+
sessionDetailsUnsigned: {
|
|
189
|
+
hashesAndChainIds: data.sessionDetailsUnsigned.hashesAndChainIds.map(
|
|
190
|
+
(h) => ({
|
|
191
|
+
chainId: toBigInt(h.chainId),
|
|
192
|
+
sessionDigest: h.sessionDigest
|
|
193
|
+
})
|
|
194
|
+
),
|
|
195
|
+
data: normalizeSessionTypedData(data.sessionDetailsUnsigned.data)
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function buildSessionDetails(unsigned, signature) {
|
|
200
|
+
return {
|
|
201
|
+
hashesAndChainIds: unsigned.hashesAndChainIds.map((h) => ({
|
|
202
|
+
chainId: toBigInt(h.chainId),
|
|
203
|
+
sessionDigest: h.sessionDigest
|
|
204
|
+
})),
|
|
205
|
+
signature
|
|
206
|
+
};
|
|
207
|
+
}
|
|
149
208
|
function createDepositService(baseUrl) {
|
|
150
209
|
const normalizedBaseUrl = baseUrl.replace(/\/$/, "");
|
|
151
210
|
function apiUrl(path) {
|
|
@@ -153,6 +212,34 @@ function createDepositService(baseUrl) {
|
|
|
153
212
|
return `${normalizedBaseUrl}${normalizedPath}`;
|
|
154
213
|
}
|
|
155
214
|
return {
|
|
215
|
+
async computeAddress(ownerAddress, sessionOwnerAddress) {
|
|
216
|
+
const response = await fetch(apiUrl("/compute-address"), {
|
|
217
|
+
method: "POST",
|
|
218
|
+
headers: { "Content-Type": "application/json" },
|
|
219
|
+
body: JSON.stringify({ ownerAddress, sessionOwnerAddress })
|
|
220
|
+
});
|
|
221
|
+
if (!response.ok) {
|
|
222
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
223
|
+
throw new Error(
|
|
224
|
+
error.error || `Compute address failed: ${response.status}`
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
return response.json();
|
|
228
|
+
},
|
|
229
|
+
async prepareAccount(params) {
|
|
230
|
+
const response = await fetch(apiUrl("/prepare-account"), {
|
|
231
|
+
method: "POST",
|
|
232
|
+
headers: { "Content-Type": "application/json" },
|
|
233
|
+
body: JSON.stringify(params)
|
|
234
|
+
});
|
|
235
|
+
if (!response.ok) {
|
|
236
|
+
const error = await response.json().catch(() => ({ error: "Unknown error" }));
|
|
237
|
+
throw new Error(
|
|
238
|
+
error.error || `Prepare account failed: ${response.status}`
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
return normalizePrepareAccountResponse(await response.json());
|
|
242
|
+
},
|
|
156
243
|
async registerAccount(params) {
|
|
157
244
|
const { eoaAddress, sessionOwner, ...account } = params;
|
|
158
245
|
const response = await fetch(apiUrl("/register"), {
|
|
@@ -803,171 +890,12 @@ function ConnectStep({
|
|
|
803
890
|
}
|
|
804
891
|
ConnectStep.displayName = "ConnectStep";
|
|
805
892
|
|
|
806
|
-
// src/core/account.ts
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
var _sdk = require('@rhinestone/sdk');
|
|
810
|
-
var _viem = require('viem');
|
|
811
|
-
var _accounts = require('viem/accounts');
|
|
812
|
-
function createViewOnlyAccount(address) {
|
|
813
|
-
if (!address || address === _viem.zeroAddress) {
|
|
814
|
-
throw new Error("Address is required");
|
|
815
|
-
}
|
|
816
|
-
return _accounts.toAccount.call(void 0, {
|
|
817
|
-
address,
|
|
818
|
-
signMessage: async () => {
|
|
819
|
-
throw new Error("Account is view-only");
|
|
820
|
-
},
|
|
821
|
-
signTransaction: async () => {
|
|
822
|
-
throw new Error("Account is view-only");
|
|
823
|
-
},
|
|
824
|
-
signTypedData: async () => {
|
|
825
|
-
throw new Error("Account is view-only");
|
|
826
|
-
}
|
|
827
|
-
});
|
|
828
|
-
}
|
|
829
|
-
function getSessionSignerAccount(signerAddress) {
|
|
830
|
-
if (!signerAddress || signerAddress === _viem.zeroAddress) {
|
|
831
|
-
throw new Error("Signer address is required");
|
|
832
|
-
}
|
|
833
|
-
return _accounts.toAccount.call(void 0, {
|
|
834
|
-
address: signerAddress,
|
|
835
|
-
signMessage: async () => {
|
|
836
|
-
throw new Error("Session signer is view-only");
|
|
837
|
-
},
|
|
838
|
-
signTransaction: async () => {
|
|
839
|
-
throw new Error("Session signer is view-only");
|
|
840
|
-
},
|
|
841
|
-
signTypedData: async () => {
|
|
842
|
-
throw new Error("Session signer is view-only");
|
|
843
|
-
}
|
|
844
|
-
});
|
|
845
|
-
}
|
|
846
|
-
function buildSession(chain, signerAddress) {
|
|
847
|
-
const sessionSignerAccount = getSessionSignerAccount(signerAddress);
|
|
848
|
-
return {
|
|
849
|
-
owners: {
|
|
850
|
-
type: "ecdsa",
|
|
851
|
-
accounts: [sessionSignerAccount]
|
|
852
|
-
},
|
|
853
|
-
chain
|
|
854
|
-
};
|
|
855
|
-
}
|
|
856
|
-
async function createSmartAccount(userSigner, sessionSigner, sdkApiKey) {
|
|
857
|
-
const rhinestone = new (0, _sdk.RhinestoneSDK)({
|
|
858
|
-
apiKey: _nullishCoalesce(sdkApiKey, () => ( ""))
|
|
859
|
-
});
|
|
860
|
-
const ownerAccounts = sessionSigner ? [userSigner, sessionSigner] : [userSigner];
|
|
861
|
-
const config = {
|
|
862
|
-
account: {
|
|
863
|
-
type: "nexus"
|
|
864
|
-
},
|
|
865
|
-
owners: {
|
|
866
|
-
type: "ecdsa",
|
|
867
|
-
accounts: ownerAccounts,
|
|
868
|
-
...sessionSigner ? { threshold: 1 } : {}
|
|
869
|
-
},
|
|
870
|
-
experimental_sessions: {
|
|
871
|
-
enabled: true
|
|
872
|
-
}
|
|
873
|
-
};
|
|
874
|
-
const account = await rhinestone.createAccount(config);
|
|
875
|
-
return account;
|
|
876
|
-
}
|
|
877
|
-
function getAccountAddress(account) {
|
|
878
|
-
return account.getAddress();
|
|
879
|
-
}
|
|
880
|
-
function getAccountInitData(account) {
|
|
881
|
-
const { factory, factoryData } = account.getInitData();
|
|
882
|
-
if (!factory) {
|
|
883
|
-
throw new Error("Account init data is not available");
|
|
884
|
-
}
|
|
885
|
-
return {
|
|
886
|
-
factory,
|
|
887
|
-
factoryData
|
|
888
|
-
};
|
|
889
|
-
}
|
|
890
|
-
async function signEnableSessionWithOwner(rhinestoneAccount, sessionDetails, signer) {
|
|
891
|
-
const originalOwners = rhinestoneAccount.config.owners;
|
|
892
|
-
rhinestoneAccount.config.owners = {
|
|
893
|
-
type: "ecdsa",
|
|
894
|
-
accounts: [signer],
|
|
895
|
-
threshold: 1,
|
|
896
|
-
..._optionalChain([originalOwners, 'optionalAccess', _41 => _41.type]) === "ecdsa" && originalOwners.module ? { module: originalOwners.module } : {}
|
|
897
|
-
};
|
|
898
|
-
try {
|
|
899
|
-
return await rhinestoneAccount.experimental_signEnableSession(
|
|
900
|
-
sessionDetails
|
|
901
|
-
);
|
|
902
|
-
} finally {
|
|
903
|
-
rhinestoneAccount.config.owners = originalOwners;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
async function getSessionDetails(rhinestoneAccount, targetChain, signerAddress, sessionSigner, targetToken, sessionChainIds) {
|
|
907
|
-
const isTargetTestnet = Boolean(targetChain.testnet);
|
|
908
|
-
const chainsByNetworkType = _chunkCEIWN53Ncjs.SUPPORTED_CHAINS.filter(
|
|
909
|
-
(chain) => Boolean(chain.testnet) === isTargetTestnet
|
|
910
|
-
);
|
|
911
|
-
const chainsById = new Map(
|
|
912
|
-
chainsByNetworkType.map((chain) => [chain.id, chain])
|
|
913
|
-
);
|
|
914
|
-
let selectedChains = [...chainsByNetworkType];
|
|
915
|
-
if (sessionChainIds && sessionChainIds.length > 0) {
|
|
916
|
-
const selectedByCaller = [];
|
|
917
|
-
for (const chainId of sessionChainIds) {
|
|
918
|
-
const chain = chainsById.get(chainId);
|
|
919
|
-
if (chain) {
|
|
920
|
-
selectedByCaller.push(chain);
|
|
921
|
-
}
|
|
922
|
-
}
|
|
923
|
-
if (selectedByCaller.length > 0) {
|
|
924
|
-
selectedChains = selectedByCaller;
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
if (targetToken) {
|
|
928
|
-
const targetSymbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0,
|
|
929
|
-
targetToken,
|
|
930
|
-
targetChain.id
|
|
931
|
-
).toUpperCase();
|
|
932
|
-
if (targetSymbol && targetSymbol !== "TOKEN") {
|
|
933
|
-
const chainsForToken = selectedChains.filter(
|
|
934
|
-
(chain) => _chunkCEIWN53Ncjs.getSupportedTokenSymbolsForChain.call(void 0, chain.id).includes(targetSymbol)
|
|
935
|
-
);
|
|
936
|
-
if (chainsForToken.length > 0) {
|
|
937
|
-
selectedChains = chainsForToken;
|
|
938
|
-
}
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
if (!selectedChains.some((c) => c.id === targetChain.id)) {
|
|
942
|
-
selectedChains.push(targetChain);
|
|
943
|
-
}
|
|
944
|
-
const uniqueChains = Array.from(
|
|
945
|
-
new Map(selectedChains.map((chain) => [chain.id, chain])).values()
|
|
946
|
-
);
|
|
947
|
-
const sessions = uniqueChains.map(
|
|
948
|
-
(chain) => buildSession(chain, signerAddress)
|
|
949
|
-
);
|
|
950
|
-
const sessionDetails = await rhinestoneAccount.experimental_getSessionDetails(sessions);
|
|
951
|
-
const enableSignature = sessionSigner ? await signEnableSessionWithOwner(
|
|
952
|
-
rhinestoneAccount,
|
|
953
|
-
sessionDetails,
|
|
954
|
-
sessionSigner
|
|
955
|
-
) : await rhinestoneAccount.experimental_signEnableSession(sessionDetails);
|
|
956
|
-
if (!_optionalChain([sessionDetails, 'access', _42 => _42.hashesAndChainIds, 'optionalAccess', _43 => _43.length])) {
|
|
957
|
-
throw new Error("Session details missing chain digests");
|
|
958
|
-
}
|
|
959
|
-
return {
|
|
960
|
-
hashesAndChainIds: sessionDetails.hashesAndChainIds,
|
|
961
|
-
signature: enableSignature
|
|
962
|
-
};
|
|
963
|
-
}
|
|
964
|
-
|
|
965
893
|
// src/core/session-owner.ts
|
|
894
|
+
var _viem = require('viem');
|
|
966
895
|
|
|
967
896
|
|
|
968
897
|
|
|
969
|
-
|
|
970
|
-
|
|
898
|
+
var _accounts = require('viem/accounts');
|
|
971
899
|
var STORAGE_PREFIX = "rhinestone:session-owner";
|
|
972
900
|
function storageKey(eoaAddress) {
|
|
973
901
|
return `${STORAGE_PREFIX}:${eoaAddress.toLowerCase()}`;
|
|
@@ -1060,22 +988,22 @@ function asString(value) {
|
|
|
1060
988
|
return typeof value === "string" ? value : void 0;
|
|
1061
989
|
}
|
|
1062
990
|
function getEventTxHash(event) {
|
|
1063
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
991
|
+
if (!_optionalChain([event, 'optionalAccess', _41 => _41.type])) return void 0;
|
|
1064
992
|
if (event.type === "deposit-received") {
|
|
1065
|
-
return asString(_optionalChain([event, 'access',
|
|
993
|
+
return asString(_optionalChain([event, 'access', _42 => _42.data, 'optionalAccess', _43 => _43.transactionHash]));
|
|
1066
994
|
}
|
|
1067
995
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
1068
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1069
|
-
return asString(_optionalChain([deposit, 'optionalAccess',
|
|
996
|
+
const deposit = isRecord(_optionalChain([event, 'access', _44 => _44.data, 'optionalAccess', _45 => _45.deposit])) ? event.data.deposit : void 0;
|
|
997
|
+
return asString(_optionalChain([deposit, 'optionalAccess', _46 => _46.transactionHash]));
|
|
1070
998
|
}
|
|
1071
999
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
1072
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1073
|
-
return asString(_optionalChain([deposit, 'optionalAccess',
|
|
1000
|
+
const deposit = isRecord(_optionalChain([event, 'access', _47 => _47.data, 'optionalAccess', _48 => _48.deposit])) ? event.data.deposit : void 0;
|
|
1001
|
+
return asString(_optionalChain([deposit, 'optionalAccess', _49 => _49.transactionHash]));
|
|
1074
1002
|
}
|
|
1075
1003
|
return void 0;
|
|
1076
1004
|
}
|
|
1077
1005
|
function isDepositEvent(event) {
|
|
1078
|
-
return _optionalChain([event, 'optionalAccess',
|
|
1006
|
+
return _optionalChain([event, 'optionalAccess', _50 => _50.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _51 => _51.type]) === "bridge-started";
|
|
1079
1007
|
}
|
|
1080
1008
|
|
|
1081
1009
|
// src/components/steps/ProcessingStep.tsx
|
|
@@ -1090,7 +1018,7 @@ function isEventForTx(event, txHash) {
|
|
|
1090
1018
|
return eventTxHash.toLowerCase() === txHash.toLowerCase();
|
|
1091
1019
|
}
|
|
1092
1020
|
function formatBridgeFailedMessage(event) {
|
|
1093
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1021
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _52 => _52.data]), () => ( {}));
|
|
1094
1022
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
1095
1023
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1096
1024
|
if (backendMessage.length > 0) {
|
|
@@ -1131,7 +1059,7 @@ function ProcessingStep({
|
|
|
1131
1059
|
const intervalRef = _react.useRef.call(void 0, null);
|
|
1132
1060
|
_react.useEffect.call(void 0, () => {
|
|
1133
1061
|
if (directTransfer) {
|
|
1134
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1062
|
+
_optionalChain([onDepositComplete, 'optionalCall', _53 => _53(txHash)]);
|
|
1135
1063
|
return;
|
|
1136
1064
|
}
|
|
1137
1065
|
}, [directTransfer, txHash, onDepositComplete]);
|
|
@@ -1174,40 +1102,40 @@ function ProcessingStep({
|
|
|
1174
1102
|
console.log("[deposit-modal] status poll", {
|
|
1175
1103
|
type: lastEvent2.type,
|
|
1176
1104
|
matchesTx: eventMatchesTx,
|
|
1177
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
1105
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _54 => _54.intentId]),
|
|
1178
1106
|
data: eventData
|
|
1179
1107
|
});
|
|
1180
1108
|
}
|
|
1181
1109
|
if (!isMounted) return;
|
|
1182
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1110
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _55 => _55.type]) === "bridge-complete") {
|
|
1183
1111
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1184
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
1185
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1112
|
+
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access', _56 => _56.data, 'optionalAccess', _57 => _57.destination, 'optionalAccess', _58 => _58.transactionHash]);
|
|
1113
|
+
_optionalChain([onDepositComplete, 'optionalCall', _59 => _59(txHash, destinationTxHash2)]);
|
|
1186
1114
|
return;
|
|
1187
1115
|
}
|
|
1188
|
-
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1116
|
+
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _60 => _60.type]) === "bridge-started") {
|
|
1189
1117
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1190
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1118
|
+
_optionalChain([onDepositComplete, 'optionalCall', _61 => _61(txHash)]);
|
|
1191
1119
|
return;
|
|
1192
1120
|
}
|
|
1193
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1121
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _62 => _62.type]) === "bridge-failed") {
|
|
1194
1122
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1195
1123
|
setState({
|
|
1196
1124
|
type: "failed",
|
|
1197
1125
|
message: formatted.message,
|
|
1198
1126
|
lastEvent: eventForCurrentTx
|
|
1199
1127
|
});
|
|
1200
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1128
|
+
_optionalChain([onDepositFailed, 'optionalCall', _63 => _63(txHash, formatted.message)]);
|
|
1201
1129
|
return;
|
|
1202
1130
|
}
|
|
1203
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1204
|
-
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access',
|
|
1131
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _64 => _64.type]) === "error") {
|
|
1132
|
+
const errorMessage = _nullishCoalesce(_optionalChain([eventForCurrentTx, 'access', _65 => _65.data, 'optionalAccess', _66 => _66.message]), () => ( "Unknown error"));
|
|
1205
1133
|
setState({
|
|
1206
1134
|
type: "failed",
|
|
1207
1135
|
message: errorMessage,
|
|
1208
1136
|
lastEvent: eventForCurrentTx
|
|
1209
1137
|
});
|
|
1210
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1138
|
+
_optionalChain([onDepositFailed, 'optionalCall', _67 => _67(txHash, errorMessage)]);
|
|
1211
1139
|
return;
|
|
1212
1140
|
}
|
|
1213
1141
|
setState({ type: "processing", lastEvent: eventForCurrentTx });
|
|
@@ -1255,7 +1183,7 @@ function ProcessingStep({
|
|
|
1255
1183
|
processTimeoutRef.current = setTimeout(() => {
|
|
1256
1184
|
const message = "We couldn't confirm your transfer. Please contact support if funds do not arrive.";
|
|
1257
1185
|
setState({ type: "error", message });
|
|
1258
|
-
_optionalChain([onError, 'optionalCall',
|
|
1186
|
+
_optionalChain([onError, 'optionalCall', _68 => _68(message, "PROCESS_TIMEOUT")]);
|
|
1259
1187
|
}, PROCESS_TIMEOUT_MS);
|
|
1260
1188
|
return () => {
|
|
1261
1189
|
if (processTimeoutRef.current) {
|
|
@@ -1268,10 +1196,10 @@ function ProcessingStep({
|
|
|
1268
1196
|
const isComplete = state.type === "complete";
|
|
1269
1197
|
const isProcessing = state.type === "processing";
|
|
1270
1198
|
const lastEvent = state.type === "processing" || state.type === "complete" || state.type === "failed" ? state.lastEvent : void 0;
|
|
1271
|
-
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess',
|
|
1199
|
+
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _69 => _69.type]) === "bridge-started";
|
|
1272
1200
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
1273
1201
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1274
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
1202
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _70 => _70.data, 'optionalAccess', _71 => _71.destination, 'optionalAccess', _72 => _72.transactionHash]) || null;
|
|
1275
1203
|
const sourceExplorerUrl = _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1276
1204
|
const destExplorerUrl = destinationTxHash ? _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1277
1205
|
const truncateHash = (hash) => `${hash.slice(0, 10)}...${hash.slice(-8)}`;
|
|
@@ -1504,7 +1432,7 @@ function ProcessingStep({
|
|
|
1504
1432
|
{
|
|
1505
1433
|
className: `rs-step-description ${isError ? "rs-text-error" : "rs-text-secondary"}`,
|
|
1506
1434
|
children: [
|
|
1507
|
-
state.type === "processing" && (_optionalChain([lastEvent, 'optionalAccess',
|
|
1435
|
+
state.type === "processing" && (_optionalChain([lastEvent, 'optionalAccess', _73 => _73.type]) === "deposit-received" ? "Transfer received. Preparing bridge..." : _optionalChain([lastEvent, 'optionalAccess', _74 => _74.type]) === "bridge-started" ? "Transfer confirmed. Funds arriving shortly..." : `Bridging your ${flowNoun} to ${_chunkCEIWN53Ncjs.getChainName.call(void 0, targetChain)}.`),
|
|
1508
1436
|
state.type === "failed" && state.message,
|
|
1509
1437
|
state.type === "error" && state.message
|
|
1510
1438
|
]
|
|
@@ -1675,8 +1603,4 @@ function getPublicClient(chainId) {
|
|
|
1675
1603
|
|
|
1676
1604
|
|
|
1677
1605
|
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.ConnectStep = ConnectStep; exports.createViewOnlyAccount = createViewOnlyAccount; exports.createSmartAccount = createSmartAccount; exports.getAccountAddress = getAccountAddress; exports.getAccountInitData = getAccountInitData; exports.getSessionDetails = getSessionDetails; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.PoweredBy = PoweredBy; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.formatUserError = formatUserError; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.applyTheme = applyTheme;
|
|
1606
|
+
exports.Modal = Modal; exports.Spinner = Spinner; exports.Button = Button; exports.ConnectStep = ConnectStep; exports.buildSessionDetails = buildSessionDetails; exports.createDepositService = createDepositService; exports.getAssetId = getAssetId; exports.portfolioToAssets = portfolioToAssets; exports.isNativeAsset = isNativeAsset; exports.loadSessionOwnerFromStorage = loadSessionOwnerFromStorage; exports.saveSessionOwnerToStorage = saveSessionOwnerToStorage; exports.createSessionOwnerKey = createSessionOwnerKey; exports.accountFromPrivateKey = accountFromPrivateKey; exports.PoweredBy = PoweredBy; exports.currencyFormatter = currencyFormatter; exports.tokenFormatter = tokenFormatter; exports.formatUserError = formatUserError; exports.getEventTxHash = getEventTxHash; exports.isDepositEvent = isDepositEvent; exports.ProcessingStep = ProcessingStep; exports.getPublicClient = getPublicClient; exports.applyTheme = applyTheme;
|