@rhinestone/deposit-modal 0.1.26 → 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-NKDYLTKD.cjs → DepositModalReown-NGYZ4G7Q.cjs} +3 -3
- package/dist/{DepositModalReown-4WZF2HMJ.mjs → DepositModalReown-PFKTSKDS.mjs} +2 -2
- package/dist/{WithdrawModalReown-244RQ5FZ.mjs → WithdrawModalReown-6AAWH35J.mjs} +2 -2
- package/dist/{WithdrawModalReown-GL4TM22D.cjs → WithdrawModalReown-BA6ECON3.cjs} +3 -3
- package/dist/{chunk-7QCFFKB5.cjs → chunk-7MQU2SR7.cjs} +72 -84
- package/dist/{chunk-W42B54IA.mjs → chunk-AJALMXW4.mjs} +30 -42
- package/dist/{chunk-DJAUNNEW.mjs → chunk-QCRZCGAE.mjs} +30 -34
- package/dist/{chunk-4Q6QCALP.cjs → chunk-QWYZJL3L.cjs} +103 -232
- package/dist/{chunk-4WULBRUA.cjs → chunk-XIS33BZ6.cjs} +66 -70
- package/dist/{chunk-3FK5FAUL.mjs → chunk-YOFGP4FV.mjs} +81 -210
- 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,20 @@ 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
|
+
},
|
|
156
229
|
async prepareAccount(params) {
|
|
157
230
|
const response = await fetch(apiUrl("/prepare-account"), {
|
|
158
231
|
method: "POST",
|
|
@@ -165,7 +238,7 @@ function createDepositService(baseUrl) {
|
|
|
165
238
|
error.error || `Prepare account failed: ${response.status}`
|
|
166
239
|
);
|
|
167
240
|
}
|
|
168
|
-
return response.json();
|
|
241
|
+
return normalizePrepareAccountResponse(await response.json());
|
|
169
242
|
},
|
|
170
243
|
async registerAccount(params) {
|
|
171
244
|
const { eoaAddress, sessionOwner, ...account } = params;
|
|
@@ -817,209 +890,12 @@ function ConnectStep({
|
|
|
817
890
|
}
|
|
818
891
|
ConnectStep.displayName = "ConnectStep";
|
|
819
892
|
|
|
820
|
-
// src/core/account.ts
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
var _sdk = require('@rhinestone/sdk');
|
|
824
|
-
var _viem = require('viem');
|
|
825
|
-
var _accounts = require('viem/accounts');
|
|
826
|
-
function createViewOnlyAccount(address) {
|
|
827
|
-
if (!address || address === _viem.zeroAddress) {
|
|
828
|
-
throw new Error("Address is required");
|
|
829
|
-
}
|
|
830
|
-
return _accounts.toAccount.call(void 0, {
|
|
831
|
-
address,
|
|
832
|
-
signMessage: async () => {
|
|
833
|
-
throw new Error("Account is view-only");
|
|
834
|
-
},
|
|
835
|
-
signTransaction: async () => {
|
|
836
|
-
throw new Error("Account is view-only");
|
|
837
|
-
},
|
|
838
|
-
signTypedData: async () => {
|
|
839
|
-
throw new Error("Account is view-only");
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
function getSessionSignerAccount(signerAddress) {
|
|
844
|
-
if (!signerAddress || signerAddress === _viem.zeroAddress) {
|
|
845
|
-
throw new Error("Signer address is required");
|
|
846
|
-
}
|
|
847
|
-
return _accounts.toAccount.call(void 0, {
|
|
848
|
-
address: signerAddress,
|
|
849
|
-
signMessage: async () => {
|
|
850
|
-
throw new Error("Session signer is view-only");
|
|
851
|
-
},
|
|
852
|
-
signTransaction: async () => {
|
|
853
|
-
throw new Error("Session signer is view-only");
|
|
854
|
-
},
|
|
855
|
-
signTypedData: async () => {
|
|
856
|
-
throw new Error("Session signer is view-only");
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
}
|
|
860
|
-
function buildSession(chain, signerAddress) {
|
|
861
|
-
const sessionSignerAccount = getSessionSignerAccount(signerAddress);
|
|
862
|
-
return {
|
|
863
|
-
owners: {
|
|
864
|
-
type: "ecdsa",
|
|
865
|
-
accounts: [sessionSignerAccount]
|
|
866
|
-
},
|
|
867
|
-
chain
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
async function createSmartAccount(userSigner, sessionSigner, sdkApiKey) {
|
|
871
|
-
const rhinestone = new (0, _sdk.RhinestoneSDK)({
|
|
872
|
-
apiKey: _nullishCoalesce(sdkApiKey, () => ( ""))
|
|
873
|
-
});
|
|
874
|
-
const ownerAccounts = sessionSigner ? [userSigner, sessionSigner] : [userSigner];
|
|
875
|
-
const config = {
|
|
876
|
-
account: {
|
|
877
|
-
type: "nexus"
|
|
878
|
-
},
|
|
879
|
-
owners: {
|
|
880
|
-
type: "ecdsa",
|
|
881
|
-
accounts: ownerAccounts,
|
|
882
|
-
...sessionSigner ? { threshold: 1 } : {}
|
|
883
|
-
},
|
|
884
|
-
experimental_sessions: {
|
|
885
|
-
enabled: true
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
const account = await rhinestone.createAccount(config);
|
|
889
|
-
return account;
|
|
890
|
-
}
|
|
891
|
-
function getAccountAddress(account) {
|
|
892
|
-
return account.getAddress();
|
|
893
|
-
}
|
|
894
|
-
function getAccountInitData(account) {
|
|
895
|
-
const { factory, factoryData } = account.getInitData();
|
|
896
|
-
if (!factory) {
|
|
897
|
-
throw new Error("Account init data is not available");
|
|
898
|
-
}
|
|
899
|
-
return {
|
|
900
|
-
factory,
|
|
901
|
-
factoryData
|
|
902
|
-
};
|
|
903
|
-
}
|
|
904
|
-
async function signEnableSessionWithOwner(rhinestoneAccount, sessionDetails, signer) {
|
|
905
|
-
const originalOwners = rhinestoneAccount.config.owners;
|
|
906
|
-
rhinestoneAccount.config.owners = {
|
|
907
|
-
type: "ecdsa",
|
|
908
|
-
accounts: [signer],
|
|
909
|
-
threshold: 1,
|
|
910
|
-
..._optionalChain([originalOwners, 'optionalAccess', _41 => _41.type]) === "ecdsa" && originalOwners.module ? { module: originalOwners.module } : {}
|
|
911
|
-
};
|
|
912
|
-
try {
|
|
913
|
-
return await rhinestoneAccount.experimental_signEnableSession(
|
|
914
|
-
sessionDetails
|
|
915
|
-
);
|
|
916
|
-
} finally {
|
|
917
|
-
rhinestoneAccount.config.owners = originalOwners;
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
async function getSessionDetails(rhinestoneAccount, targetChain, signerAddress, sessionSigner, targetToken, sessionChainIds) {
|
|
921
|
-
const isTargetTestnet = Boolean(targetChain.testnet);
|
|
922
|
-
const chainsByNetworkType = _chunkCEIWN53Ncjs.SUPPORTED_CHAINS.filter(
|
|
923
|
-
(chain) => Boolean(chain.testnet) === isTargetTestnet
|
|
924
|
-
);
|
|
925
|
-
const chainsById = new Map(
|
|
926
|
-
chainsByNetworkType.map((chain) => [chain.id, chain])
|
|
927
|
-
);
|
|
928
|
-
let selectedChains = [...chainsByNetworkType];
|
|
929
|
-
if (sessionChainIds && sessionChainIds.length > 0) {
|
|
930
|
-
const selectedByCaller = [];
|
|
931
|
-
for (const chainId of sessionChainIds) {
|
|
932
|
-
const chain = chainsById.get(chainId);
|
|
933
|
-
if (chain) {
|
|
934
|
-
selectedByCaller.push(chain);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
if (selectedByCaller.length > 0) {
|
|
938
|
-
selectedChains = selectedByCaller;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
if (targetToken) {
|
|
942
|
-
const targetSymbol = _chunkCEIWN53Ncjs.getTokenSymbol.call(void 0,
|
|
943
|
-
targetToken,
|
|
944
|
-
targetChain.id
|
|
945
|
-
).toUpperCase();
|
|
946
|
-
if (targetSymbol && targetSymbol !== "TOKEN") {
|
|
947
|
-
const chainsForToken = selectedChains.filter(
|
|
948
|
-
(chain) => _chunkCEIWN53Ncjs.getSupportedTokenSymbolsForChain.call(void 0, chain.id).includes(targetSymbol)
|
|
949
|
-
);
|
|
950
|
-
if (chainsForToken.length > 0) {
|
|
951
|
-
selectedChains = chainsForToken;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}
|
|
955
|
-
if (!selectedChains.some((c) => c.id === targetChain.id)) {
|
|
956
|
-
selectedChains.push(targetChain);
|
|
957
|
-
}
|
|
958
|
-
const uniqueChains = Array.from(
|
|
959
|
-
new Map(selectedChains.map((chain) => [chain.id, chain])).values()
|
|
960
|
-
);
|
|
961
|
-
const sessions = uniqueChains.map(
|
|
962
|
-
(chain) => buildSession(chain, signerAddress)
|
|
963
|
-
);
|
|
964
|
-
const sessionDetails = await rhinestoneAccount.experimental_getSessionDetails(sessions);
|
|
965
|
-
const enableSignature = sessionSigner ? await signEnableSessionWithOwner(
|
|
966
|
-
rhinestoneAccount,
|
|
967
|
-
sessionDetails,
|
|
968
|
-
sessionSigner
|
|
969
|
-
) : await rhinestoneAccount.experimental_signEnableSession(sessionDetails);
|
|
970
|
-
if (!_optionalChain([sessionDetails, 'access', _42 => _42.hashesAndChainIds, 'optionalAccess', _43 => _43.length])) {
|
|
971
|
-
throw new Error("Session details missing chain digests");
|
|
972
|
-
}
|
|
973
|
-
return {
|
|
974
|
-
hashesAndChainIds: sessionDetails.hashesAndChainIds,
|
|
975
|
-
signature: enableSignature
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
function deserializeSessionData(raw) {
|
|
979
|
-
const data = structuredClone(raw);
|
|
980
|
-
const message = data.message;
|
|
981
|
-
if (!_optionalChain([message, 'optionalAccess', _44 => _44.sessionsAndChainIds])) return data;
|
|
982
|
-
for (const entry of message.sessionsAndChainIds) {
|
|
983
|
-
const chainSession = entry;
|
|
984
|
-
chainSession.chainId = BigInt(chainSession.chainId);
|
|
985
|
-
const session = chainSession.session;
|
|
986
|
-
if (session) {
|
|
987
|
-
session.nonce = BigInt(session.nonce);
|
|
988
|
-
session.expires = BigInt(session.expires);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
return data;
|
|
992
|
-
}
|
|
993
|
-
async function signSessionDetails(rhinestoneAccount, sessionDetailsUnsigned, signer) {
|
|
994
|
-
const data = deserializeSessionData(sessionDetailsUnsigned.data);
|
|
995
|
-
const hashesAndChainIds = sessionDetailsUnsigned.hashesAndChainIds.map(
|
|
996
|
-
(h) => ({
|
|
997
|
-
chainId: BigInt(h.chainId),
|
|
998
|
-
sessionDigest: h.sessionDigest
|
|
999
|
-
})
|
|
1000
|
-
);
|
|
1001
|
-
const sessionDetails = {
|
|
1002
|
-
nonces: [],
|
|
1003
|
-
hashesAndChainIds,
|
|
1004
|
-
data
|
|
1005
|
-
};
|
|
1006
|
-
const signature = await signEnableSessionWithOwner(
|
|
1007
|
-
rhinestoneAccount,
|
|
1008
|
-
sessionDetails,
|
|
1009
|
-
signer
|
|
1010
|
-
);
|
|
1011
|
-
return {
|
|
1012
|
-
hashesAndChainIds,
|
|
1013
|
-
signature
|
|
1014
|
-
};
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
893
|
// src/core/session-owner.ts
|
|
894
|
+
var _viem = require('viem');
|
|
1018
895
|
|
|
1019
896
|
|
|
1020
897
|
|
|
1021
|
-
|
|
1022
|
-
|
|
898
|
+
var _accounts = require('viem/accounts');
|
|
1023
899
|
var STORAGE_PREFIX = "rhinestone:session-owner";
|
|
1024
900
|
function storageKey(eoaAddress) {
|
|
1025
901
|
return `${STORAGE_PREFIX}:${eoaAddress.toLowerCase()}`;
|
|
@@ -1112,22 +988,22 @@ function asString(value) {
|
|
|
1112
988
|
return typeof value === "string" ? value : void 0;
|
|
1113
989
|
}
|
|
1114
990
|
function getEventTxHash(event) {
|
|
1115
|
-
if (!_optionalChain([event, 'optionalAccess',
|
|
991
|
+
if (!_optionalChain([event, 'optionalAccess', _41 => _41.type])) return void 0;
|
|
1116
992
|
if (event.type === "deposit-received") {
|
|
1117
|
-
return asString(_optionalChain([event, 'access',
|
|
993
|
+
return asString(_optionalChain([event, 'access', _42 => _42.data, 'optionalAccess', _43 => _43.transactionHash]));
|
|
1118
994
|
}
|
|
1119
995
|
if (event.type === "bridge-started" || event.type === "bridge-complete") {
|
|
1120
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1121
|
-
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]));
|
|
1122
998
|
}
|
|
1123
999
|
if (event.type === "bridge-failed" || event.type === "error") {
|
|
1124
|
-
const deposit = isRecord(_optionalChain([event, 'access',
|
|
1125
|
-
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]));
|
|
1126
1002
|
}
|
|
1127
1003
|
return void 0;
|
|
1128
1004
|
}
|
|
1129
1005
|
function isDepositEvent(event) {
|
|
1130
|
-
return _optionalChain([event, 'optionalAccess',
|
|
1006
|
+
return _optionalChain([event, 'optionalAccess', _50 => _50.type]) === "deposit-received" || _optionalChain([event, 'optionalAccess', _51 => _51.type]) === "bridge-started";
|
|
1131
1007
|
}
|
|
1132
1008
|
|
|
1133
1009
|
// src/components/steps/ProcessingStep.tsx
|
|
@@ -1142,7 +1018,7 @@ function isEventForTx(event, txHash) {
|
|
|
1142
1018
|
return eventTxHash.toLowerCase() === txHash.toLowerCase();
|
|
1143
1019
|
}
|
|
1144
1020
|
function formatBridgeFailedMessage(event) {
|
|
1145
|
-
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess',
|
|
1021
|
+
const eventData = _nullishCoalesce(_optionalChain([event, 'optionalAccess', _52 => _52.data]), () => ( {}));
|
|
1146
1022
|
const code = typeof eventData.errorCode === "string" ? eventData.errorCode : void 0;
|
|
1147
1023
|
const backendMessage = typeof eventData.message === "string" ? eventData.message.trim() : "";
|
|
1148
1024
|
if (backendMessage.length > 0) {
|
|
@@ -1183,7 +1059,7 @@ function ProcessingStep({
|
|
|
1183
1059
|
const intervalRef = _react.useRef.call(void 0, null);
|
|
1184
1060
|
_react.useEffect.call(void 0, () => {
|
|
1185
1061
|
if (directTransfer) {
|
|
1186
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1062
|
+
_optionalChain([onDepositComplete, 'optionalCall', _53 => _53(txHash)]);
|
|
1187
1063
|
return;
|
|
1188
1064
|
}
|
|
1189
1065
|
}, [directTransfer, txHash, onDepositComplete]);
|
|
@@ -1226,40 +1102,40 @@ function ProcessingStep({
|
|
|
1226
1102
|
console.log("[deposit-modal] status poll", {
|
|
1227
1103
|
type: lastEvent2.type,
|
|
1228
1104
|
matchesTx: eventMatchesTx,
|
|
1229
|
-
intentId: _optionalChain([eventData, 'optionalAccess',
|
|
1105
|
+
intentId: _optionalChain([eventData, 'optionalAccess', _54 => _54.intentId]),
|
|
1230
1106
|
data: eventData
|
|
1231
1107
|
});
|
|
1232
1108
|
}
|
|
1233
1109
|
if (!isMounted) return;
|
|
1234
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1110
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _55 => _55.type]) === "bridge-complete") {
|
|
1235
1111
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1236
|
-
const destinationTxHash2 = _optionalChain([eventForCurrentTx, 'access',
|
|
1237
|
-
_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)]);
|
|
1238
1114
|
return;
|
|
1239
1115
|
}
|
|
1240
|
-
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1116
|
+
if (!waitForFinalTx && _optionalChain([eventForCurrentTx, 'optionalAccess', _60 => _60.type]) === "bridge-started") {
|
|
1241
1117
|
setState({ type: "complete", lastEvent: eventForCurrentTx });
|
|
1242
|
-
_optionalChain([onDepositComplete, 'optionalCall',
|
|
1118
|
+
_optionalChain([onDepositComplete, 'optionalCall', _61 => _61(txHash)]);
|
|
1243
1119
|
return;
|
|
1244
1120
|
}
|
|
1245
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1121
|
+
if (_optionalChain([eventForCurrentTx, 'optionalAccess', _62 => _62.type]) === "bridge-failed") {
|
|
1246
1122
|
const formatted = formatBridgeFailedMessage(eventForCurrentTx);
|
|
1247
1123
|
setState({
|
|
1248
1124
|
type: "failed",
|
|
1249
1125
|
message: formatted.message,
|
|
1250
1126
|
lastEvent: eventForCurrentTx
|
|
1251
1127
|
});
|
|
1252
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1128
|
+
_optionalChain([onDepositFailed, 'optionalCall', _63 => _63(txHash, formatted.message)]);
|
|
1253
1129
|
return;
|
|
1254
1130
|
}
|
|
1255
|
-
if (_optionalChain([eventForCurrentTx, 'optionalAccess',
|
|
1256
|
-
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"));
|
|
1257
1133
|
setState({
|
|
1258
1134
|
type: "failed",
|
|
1259
1135
|
message: errorMessage,
|
|
1260
1136
|
lastEvent: eventForCurrentTx
|
|
1261
1137
|
});
|
|
1262
|
-
_optionalChain([onDepositFailed, 'optionalCall',
|
|
1138
|
+
_optionalChain([onDepositFailed, 'optionalCall', _67 => _67(txHash, errorMessage)]);
|
|
1263
1139
|
return;
|
|
1264
1140
|
}
|
|
1265
1141
|
setState({ type: "processing", lastEvent: eventForCurrentTx });
|
|
@@ -1307,7 +1183,7 @@ function ProcessingStep({
|
|
|
1307
1183
|
processTimeoutRef.current = setTimeout(() => {
|
|
1308
1184
|
const message = "We couldn't confirm your transfer. Please contact support if funds do not arrive.";
|
|
1309
1185
|
setState({ type: "error", message });
|
|
1310
|
-
_optionalChain([onError, 'optionalCall',
|
|
1186
|
+
_optionalChain([onError, 'optionalCall', _68 => _68(message, "PROCESS_TIMEOUT")]);
|
|
1311
1187
|
}, PROCESS_TIMEOUT_MS);
|
|
1312
1188
|
return () => {
|
|
1313
1189
|
if (processTimeoutRef.current) {
|
|
@@ -1320,10 +1196,10 @@ function ProcessingStep({
|
|
|
1320
1196
|
const isComplete = state.type === "complete";
|
|
1321
1197
|
const isProcessing = state.type === "processing";
|
|
1322
1198
|
const lastEvent = state.type === "processing" || state.type === "complete" || state.type === "failed" ? state.lastEvent : void 0;
|
|
1323
|
-
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess',
|
|
1199
|
+
const isEarlyComplete = !waitForFinalTx && _optionalChain([lastEvent, 'optionalAccess', _69 => _69.type]) === "bridge-started";
|
|
1324
1200
|
const flowNoun = flowLabel === "withdraw" ? "withdrawal" : "deposit";
|
|
1325
1201
|
const flowCapitalized = flowLabel === "withdraw" ? "Withdrawal" : "Deposit";
|
|
1326
|
-
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess',
|
|
1202
|
+
const destinationTxHash = _optionalChain([lastEvent, 'optionalAccess', _70 => _70.data, 'optionalAccess', _71 => _71.destination, 'optionalAccess', _72 => _72.transactionHash]) || null;
|
|
1327
1203
|
const sourceExplorerUrl = _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, sourceChain, txHash);
|
|
1328
1204
|
const destExplorerUrl = destinationTxHash ? _chunkCEIWN53Ncjs.getExplorerTxUrl.call(void 0, targetChain, destinationTxHash) : null;
|
|
1329
1205
|
const truncateHash = (hash) => `${hash.slice(0, 10)}...${hash.slice(-8)}`;
|
|
@@ -1556,7 +1432,7 @@ function ProcessingStep({
|
|
|
1556
1432
|
{
|
|
1557
1433
|
className: `rs-step-description ${isError ? "rs-text-error" : "rs-text-secondary"}`,
|
|
1558
1434
|
children: [
|
|
1559
|
-
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)}.`),
|
|
1560
1436
|
state.type === "failed" && state.message,
|
|
1561
1437
|
state.type === "error" && state.message
|
|
1562
1438
|
]
|
|
@@ -1727,9 +1603,4 @@ function getPublicClient(chainId) {
|
|
|
1727
1603
|
|
|
1728
1604
|
|
|
1729
1605
|
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
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.signSessionDetails = signSessionDetails; 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;
|