@trustware/sdk-staging 1.1.9-staging.7 → 1.1.10-staging.0
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/constants.cjs +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{core-gNyi5xsp.d.cts → core-B7Ez-5-r.d.cts} +1 -1
- package/dist/{core-DzqVEWwP.d.ts → core-BPLiD1UG.d.ts} +1 -1
- package/dist/core.cjs +131 -2
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.mjs +132 -2
- package/dist/core.mjs.map +1 -1
- package/dist/index.cjs +147 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.mjs +173 -34
- package/dist/index.mjs.map +1 -1
- package/dist/{manager-Dn4muk74.d.ts → manager-B6NNV-E_.d.ts} +89 -1
- package/dist/{manager-DWFNyouP.d.cts → manager-BwjyFjjz.d.cts} +89 -1
- package/dist/{detect-Cprq6X9o.d.ts → metadata-BiTMMvlY.d.ts} +5 -2
- package/dist/{detect-DWL4uExV.d.cts → metadata-HCflXcsF.d.cts} +5 -2
- package/dist/smart-account.cjs +1 -1
- package/dist/smart-account.cjs.map +1 -1
- package/dist/smart-account.d.cts +235 -222
- package/dist/smart-account.d.ts +235 -222
- package/dist/smart-account.mjs +1 -1
- package/dist/smart-account.mjs.map +1 -1
- package/dist/wallet.cjs +1 -1
- package/dist/wallet.cjs.map +1 -1
- package/dist/wallet.d.cts +4 -7
- package/dist/wallet.d.ts +4 -7
- package/dist/wallet.mjs +1 -1
- package/dist/wallet.mjs.map +1 -1
- package/dist/widget.cjs +121 -6
- package/dist/widget.cjs.map +1 -1
- package/dist/widget.mjs +149 -33
- package/dist/widget.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { T as Trustware } from './core-
|
|
2
|
-
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-
|
|
3
|
-
import { R as RateLimitInfo, T as TrustwareConfigOptions,
|
|
4
|
-
export { B as BuildRouteResult,
|
|
1
|
+
import { T as Trustware } from './core-B7Ez-5-r.cjs';
|
|
2
|
+
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-B7Ez-5-r.cjs';
|
|
3
|
+
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-BwjyFjjz.cjs';
|
|
4
|
+
export { B as BuildRouteBody, m as BuildRouteResponse, n as BuildRouteResult, o as DEFAULT_AUTO_DETECT_PROVIDER, p as DEFAULT_FEATURE_FLAGS, q as DEFAULT_MESSAGES, r as DEFAULT_RETRY_CONFIG, s as DEFAULT_SLIPPAGE, D as DetectedWallet, E as EIP1193, t as EIP6963ProviderDetail, v as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, P as PostHookRequest, x as ResolvedFeatureFlags, y as ResolvedRetryConfig, z as ResolvedTrustwareConfig, A as ResolvedWalletConnectConfig, C as RetryConfig, G as RouteApproval, H as RouteEstimate, J as RouteIntent, K as RouteParams, L as RoutePlan, M as RouteSponsorship, N as RoutesConfig, O as SimpleWalletInterface, S as SolanaProviderLike, b as SolanaWalletInterface, Q as SponsorshipApproval, U as SwapTokenRef, V as TrustwareTheme, X as TrustwareWidgetMessages, c as WagmiBridge, d as WagmiConnector, Y as WalletAddressResolution, Z as WalletAddressSource, _ as WalletCategory, $ as WalletConnectConfig, a0 as WalletEcosystem, a as WalletId, a1 as WalletIdentity, a2 as WalletIdentityAddress, a3 as WalletIdentityChainLike, W as WalletMeta, a4 as buildWalletIdentityAddress, a5 as createWalletIdentity, a6 as resolveWalletAddressForChain, a7 as upsertWalletIdentityAddress, f as useWalletExternalDisconnect, g as useWalletInfo, h as useWireDetectionIntoManager, w as walletManager } from './manager-BwjyFjjz.cjs';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default from 'react';
|
|
7
7
|
import { C as ChainDef } from './blockchain-BxAFzp0s.cjs';
|
|
8
8
|
export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, G as GetBalancesOptions, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.cjs';
|
|
9
9
|
import { T as Token, Y as YourTokenData } from './types-DX3HtFcn.cjs';
|
|
10
|
-
export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193,
|
|
10
|
+
export { P as POPULAR_ORDER, W as WALLETS, c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './metadata-HCflXcsF.cjs';
|
|
11
11
|
export { TrustwareWidget } from './widget.cjs';
|
|
12
12
|
export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, GTM_ID, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID } from './constants.cjs';
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { T as Trustware } from './core-
|
|
2
|
-
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-
|
|
3
|
-
import { R as RateLimitInfo, T as TrustwareConfigOptions,
|
|
4
|
-
export { B as BuildRouteResult,
|
|
1
|
+
import { T as Trustware } from './core-BPLiD1UG.js';
|
|
2
|
+
export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateCosmosAddress, d as validateEvmAddress, e as validateRouteAddresses, f as validateSeiAddress, g as validateSolanaAddress } from './core-BPLiD1UG.js';
|
|
3
|
+
import { R as RateLimitInfo, T as TrustwareConfigOptions, i as WalletInterFaceAPI, j as TrustwareError, k as Transaction, l as TrustwareEvent } from './manager-B6NNV-E_.js';
|
|
4
|
+
export { B as BuildRouteBody, m as BuildRouteResponse, n as BuildRouteResult, o as DEFAULT_AUTO_DETECT_PROVIDER, p as DEFAULT_FEATURE_FLAGS, q as DEFAULT_MESSAGES, r as DEFAULT_RETRY_CONFIG, s as DEFAULT_SLIPPAGE, D as DetectedWallet, E as EIP1193, t as EIP6963ProviderDetail, v as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, P as PostHookRequest, x as ResolvedFeatureFlags, y as ResolvedRetryConfig, z as ResolvedTrustwareConfig, A as ResolvedWalletConnectConfig, C as RetryConfig, G as RouteApproval, H as RouteEstimate, J as RouteIntent, K as RouteParams, L as RoutePlan, M as RouteSponsorship, N as RoutesConfig, O as SimpleWalletInterface, S as SolanaProviderLike, b as SolanaWalletInterface, Q as SponsorshipApproval, U as SwapTokenRef, V as TrustwareTheme, X as TrustwareWidgetMessages, c as WagmiBridge, d as WagmiConnector, Y as WalletAddressResolution, Z as WalletAddressSource, _ as WalletCategory, $ as WalletConnectConfig, a0 as WalletEcosystem, a as WalletId, a1 as WalletIdentity, a2 as WalletIdentityAddress, a3 as WalletIdentityChainLike, W as WalletMeta, a4 as buildWalletIdentityAddress, a5 as createWalletIdentity, a6 as resolveWalletAddressForChain, a7 as upsertWalletIdentityAddress, f as useWalletExternalDisconnect, g as useWalletInfo, h as useWireDetectionIntoManager, w as walletManager } from './manager-B6NNV-E_.js';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import React__default from 'react';
|
|
7
7
|
import { C as ChainDef } from './blockchain-BxAFzp0s.js';
|
|
8
8
|
export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, G as GetBalancesOptions, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.js';
|
|
9
9
|
import { T as Token, Y as YourTokenData } from './types-BJY9r-mz.js';
|
|
10
|
-
export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193,
|
|
10
|
+
export { P as POPULAR_ORDER, W as WALLETS, c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './metadata-BiTMMvlY.js';
|
|
11
11
|
export { TrustwareWidget } from './widget.js';
|
|
12
12
|
export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, GTM_ID, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID } from './constants.js';
|
|
13
13
|
|
package/dist/index.mjs
CHANGED
|
@@ -473,7 +473,7 @@ var init_constants = __esm({
|
|
|
473
473
|
"src/constants.ts"() {
|
|
474
474
|
"use strict";
|
|
475
475
|
SDK_NAME = "@trustware/sdk";
|
|
476
|
-
SDK_VERSION = "1.1.
|
|
476
|
+
SDK_VERSION = "1.1.10-staging.0";
|
|
477
477
|
API_ROOT = "https://bv-staging-api.trustware.io";
|
|
478
478
|
GTM_ID = "GTM-TZDGNCXB";
|
|
479
479
|
API_PREFIX = "/api";
|
|
@@ -1114,12 +1114,33 @@ var init_deepLink = __esm({
|
|
|
1114
1114
|
});
|
|
1115
1115
|
|
|
1116
1116
|
// src/wallets/metadata.ts
|
|
1117
|
-
var WALLETS;
|
|
1117
|
+
var POPULAR_ORDER, WALLETS;
|
|
1118
1118
|
var init_metadata = __esm({
|
|
1119
1119
|
"src/wallets/metadata.ts"() {
|
|
1120
1120
|
"use strict";
|
|
1121
1121
|
init_deepLink();
|
|
1122
1122
|
init_constants();
|
|
1123
|
+
POPULAR_ORDER = [
|
|
1124
|
+
"rabby",
|
|
1125
|
+
"metamask",
|
|
1126
|
+
"walletconnect",
|
|
1127
|
+
"rainbow",
|
|
1128
|
+
"phantom-evm",
|
|
1129
|
+
"phantom-solana",
|
|
1130
|
+
"metamask-solana",
|
|
1131
|
+
"solflare",
|
|
1132
|
+
"okx",
|
|
1133
|
+
"brave",
|
|
1134
|
+
"coinbase",
|
|
1135
|
+
"zerion",
|
|
1136
|
+
"taho",
|
|
1137
|
+
"trust",
|
|
1138
|
+
"bitget",
|
|
1139
|
+
"backpack",
|
|
1140
|
+
"imtoken",
|
|
1141
|
+
"safe",
|
|
1142
|
+
"kucoin"
|
|
1143
|
+
];
|
|
1123
1144
|
WALLETS = [
|
|
1124
1145
|
{
|
|
1125
1146
|
id: "metamask",
|
|
@@ -4356,6 +4377,27 @@ var init_wallets = __esm({
|
|
|
4356
4377
|
});
|
|
4357
4378
|
|
|
4358
4379
|
// src/core/routes.ts
|
|
4380
|
+
function assertValidPostHook(hooks) {
|
|
4381
|
+
const postHook = hooks?.postHook;
|
|
4382
|
+
if (!postHook) return;
|
|
4383
|
+
if (!postHook.target?.trim()) {
|
|
4384
|
+
throw new Error("hooks.postHook.target is required.");
|
|
4385
|
+
}
|
|
4386
|
+
if (!postHook.callData?.trim()) {
|
|
4387
|
+
throw new Error("hooks.postHook.callData is required.");
|
|
4388
|
+
}
|
|
4389
|
+
if (postHook.fullAmount) {
|
|
4390
|
+
if (postHook.amountInputPos === void 0) {
|
|
4391
|
+
throw new Error(
|
|
4392
|
+
"hooks.postHook.amountInputPos is required when fullAmount is true."
|
|
4393
|
+
);
|
|
4394
|
+
}
|
|
4395
|
+
} else if (!postHook.fundAmount?.trim()) {
|
|
4396
|
+
throw new Error(
|
|
4397
|
+
"hooks.postHook.fundAmount is required unless fullAmount is set."
|
|
4398
|
+
);
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4359
4401
|
function isEvmTxRequest(txReq) {
|
|
4360
4402
|
return Boolean(txReq?.data && (txReq.to || txReq.target));
|
|
4361
4403
|
}
|
|
@@ -4374,6 +4416,7 @@ async function buildRoute(body, signal) {
|
|
|
4374
4416
|
if (!addressValidation.isValid) {
|
|
4375
4417
|
throw new Error(addressValidation.error || "Invalid route addresses.");
|
|
4376
4418
|
}
|
|
4419
|
+
assertValidPostHook(body.hooks);
|
|
4377
4420
|
const cfg = TrustwareConfigStore.get();
|
|
4378
4421
|
const url = `${apiBase()}/v1/routes/route`;
|
|
4379
4422
|
const payload = {
|
|
@@ -4412,6 +4455,7 @@ async function buildRoute(body, signal) {
|
|
|
4412
4455
|
return { intentId, txReq, actions, finalExchangeRate, route, sponsorship };
|
|
4413
4456
|
}
|
|
4414
4457
|
async function buildDepositAddress(body, signal) {
|
|
4458
|
+
assertValidPostHook(body.hooks);
|
|
4415
4459
|
const cfg = TrustwareConfigStore.get();
|
|
4416
4460
|
const url = `${apiBase()}/v1/routes/deposit-address`;
|
|
4417
4461
|
const payload = {
|
|
@@ -5160,11 +5204,92 @@ var init_registryClient = __esm({
|
|
|
5160
5204
|
});
|
|
5161
5205
|
|
|
5162
5206
|
// src/core/tx.ts
|
|
5163
|
-
import { keccak256 } from "viem";
|
|
5207
|
+
import { keccak256, encodeFunctionData, parseAbi } from "viem";
|
|
5164
5208
|
function backendChainId(chain, fallback) {
|
|
5165
5209
|
const preferred = chain?.networkIdentifier ?? chain?.chainId ?? chain?.id;
|
|
5166
5210
|
return String(preferred ?? fallback ?? "");
|
|
5167
5211
|
}
|
|
5212
|
+
function sleep2(ms) {
|
|
5213
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5214
|
+
}
|
|
5215
|
+
async function sendEvmTx(w, tx) {
|
|
5216
|
+
if (w.type === "eip1193") {
|
|
5217
|
+
const from = await w.getAddress();
|
|
5218
|
+
const params = {
|
|
5219
|
+
from,
|
|
5220
|
+
to: tx.to,
|
|
5221
|
+
data: tx.data,
|
|
5222
|
+
value: tx.value ? `0x${tx.value.toString(16)}` : "0x0"
|
|
5223
|
+
};
|
|
5224
|
+
if (tx.chainId !== void 0) {
|
|
5225
|
+
params.chainId = `0x${tx.chainId.toString(16)}`;
|
|
5226
|
+
}
|
|
5227
|
+
const hash = await w.request({
|
|
5228
|
+
method: "eth_sendTransaction",
|
|
5229
|
+
params: [params]
|
|
5230
|
+
});
|
|
5231
|
+
return hash;
|
|
5232
|
+
}
|
|
5233
|
+
const response = await w.sendTransaction({
|
|
5234
|
+
to: tx.to,
|
|
5235
|
+
data: tx.data,
|
|
5236
|
+
value: tx.value,
|
|
5237
|
+
chainId: tx.chainId
|
|
5238
|
+
});
|
|
5239
|
+
return response.hash;
|
|
5240
|
+
}
|
|
5241
|
+
async function waitForTxConfirmation(chainId, txHash) {
|
|
5242
|
+
const timeoutMs = 12e4;
|
|
5243
|
+
const intervalMs = 2e3;
|
|
5244
|
+
const started = Date.now();
|
|
5245
|
+
while (Date.now() - started < timeoutMs) {
|
|
5246
|
+
const status = await getEVMTxStatus({ chainId, txHash });
|
|
5247
|
+
if (status.status === "success") return;
|
|
5248
|
+
if (status.status === "reverted") {
|
|
5249
|
+
throw new Error("Approval transaction reverted");
|
|
5250
|
+
}
|
|
5251
|
+
await sleep2(intervalMs);
|
|
5252
|
+
}
|
|
5253
|
+
throw new Error("Timed out waiting for approval confirmation");
|
|
5254
|
+
}
|
|
5255
|
+
async function ensureApprovals(w, approvals, fallbackChainId) {
|
|
5256
|
+
if (!approvals || approvals.length === 0) return;
|
|
5257
|
+
const owner = await w.getAddress();
|
|
5258
|
+
for (const approval of approvals) {
|
|
5259
|
+
const spender = approval.spender;
|
|
5260
|
+
const tokenAddress = approval.tokenAddress;
|
|
5261
|
+
const amount = approval.amount;
|
|
5262
|
+
if (!spender || !tokenAddress || !amount) continue;
|
|
5263
|
+
const chainId = approval.chainId || String(fallbackChainId ?? "");
|
|
5264
|
+
if (!chainId) continue;
|
|
5265
|
+
const amountWei = BigInt(amount);
|
|
5266
|
+
if (amountWei === 0n) continue;
|
|
5267
|
+
let currentAllowance = 0n;
|
|
5268
|
+
try {
|
|
5269
|
+
const { allowance } = await getEVMAllowance({
|
|
5270
|
+
chainId,
|
|
5271
|
+
tokenAddress,
|
|
5272
|
+
ownerAddress: owner,
|
|
5273
|
+
spenderAddress: spender
|
|
5274
|
+
});
|
|
5275
|
+
currentAllowance = BigInt(allowance || "0");
|
|
5276
|
+
} catch {
|
|
5277
|
+
}
|
|
5278
|
+
if (currentAllowance >= amountWei) continue;
|
|
5279
|
+
const data = encodeFunctionData({
|
|
5280
|
+
abi: erc20ApproveAbi,
|
|
5281
|
+
functionName: "approve",
|
|
5282
|
+
args: [spender, amountWei]
|
|
5283
|
+
});
|
|
5284
|
+
const hash = await sendEvmTx(w, {
|
|
5285
|
+
to: tokenAddress,
|
|
5286
|
+
data,
|
|
5287
|
+
value: 0n,
|
|
5288
|
+
chainId: Number.isFinite(Number(chainId)) ? Number(chainId) : void 0
|
|
5289
|
+
});
|
|
5290
|
+
await waitForTxConfirmation(chainId, hash);
|
|
5291
|
+
}
|
|
5292
|
+
}
|
|
5168
5293
|
function isUserRejected(e2) {
|
|
5169
5294
|
const code = e2?.code ?? e2?.data?.code;
|
|
5170
5295
|
if (code === 4001) return true;
|
|
@@ -5198,6 +5323,13 @@ async function sendRouteTransaction(b, fallbackChainId) {
|
|
|
5198
5323
|
}
|
|
5199
5324
|
}
|
|
5200
5325
|
}
|
|
5326
|
+
if (!validatedSponsorship) {
|
|
5327
|
+
await ensureApprovals(
|
|
5328
|
+
w,
|
|
5329
|
+
b.route?.execution?.approvals,
|
|
5330
|
+
Number.isFinite(target) ? target : void 0
|
|
5331
|
+
);
|
|
5332
|
+
}
|
|
5201
5333
|
if (w.type === "eip1193") {
|
|
5202
5334
|
const from = await w.getAddress();
|
|
5203
5335
|
const hexValue = value ? `0x${value.toString(16)}` : "0x0";
|
|
@@ -5294,11 +5426,16 @@ async function runTopUp(params) {
|
|
|
5294
5426
|
}
|
|
5295
5427
|
}
|
|
5296
5428
|
}
|
|
5429
|
+
var erc20ApproveAbi;
|
|
5297
5430
|
var init_tx = __esm({
|
|
5298
5431
|
"src/core/tx.ts"() {
|
|
5299
5432
|
"use strict";
|
|
5300
5433
|
init_wallets();
|
|
5301
5434
|
init_routes();
|
|
5435
|
+
init_sdkRpc();
|
|
5436
|
+
erc20ApproveAbi = parseAbi([
|
|
5437
|
+
"function approve(address spender, uint256 amount) returns (bool)"
|
|
5438
|
+
]);
|
|
5302
5439
|
}
|
|
5303
5440
|
});
|
|
5304
5441
|
|
|
@@ -28385,7 +28522,7 @@ var init_utils5 = __esm({
|
|
|
28385
28522
|
});
|
|
28386
28523
|
|
|
28387
28524
|
// node_modules/@account-kit/smart-contracts/dist/esm/src/light-account/accounts/base.js
|
|
28388
|
-
import { concat as concat5, encodeFunctionData, fromHex as fromHex4, hashMessage, hashTypedData, trim } from "viem";
|
|
28525
|
+
import { concat as concat5, encodeFunctionData as encodeFunctionData2, fromHex as fromHex4, hashMessage, hashTypedData, trim } from "viem";
|
|
28389
28526
|
async function createLightAccountBase({ transport, chain, signer, abi, version, type, entryPoint, accountAddress, getAccountInitCode }) {
|
|
28390
28527
|
const client = createBundlerClient({
|
|
28391
28528
|
transport,
|
|
@@ -28404,7 +28541,7 @@ async function createLightAccountBase({ transport, chain, signer, abi, version,
|
|
|
28404
28541
|
if (fromHex4(storage, "number") !== 0 && !implementationAddresses.some((x) => x === trim(storage))) {
|
|
28405
28542
|
throw new Error(`could not determine if smart account implementation is ${type} ${String(version)}`);
|
|
28406
28543
|
}
|
|
28407
|
-
return
|
|
28544
|
+
return encodeFunctionData2({
|
|
28408
28545
|
abi,
|
|
28409
28546
|
functionName: "upgradeToAndCall",
|
|
28410
28547
|
args: [upgradeToAddress, upgradeToInitData]
|
|
@@ -28463,7 +28600,7 @@ async function createLightAccountBase({ transport, chain, signer, abi, version,
|
|
|
28463
28600
|
prepareSign,
|
|
28464
28601
|
formatSign,
|
|
28465
28602
|
encodeExecute: async ({ target, data, value }) => {
|
|
28466
|
-
return
|
|
28603
|
+
return encodeFunctionData2({
|
|
28467
28604
|
abi,
|
|
28468
28605
|
functionName: "execute",
|
|
28469
28606
|
args: [target, value ?? 0n, data]
|
|
@@ -28476,7 +28613,7 @@ async function createLightAccountBase({ transport, chain, signer, abi, version,
|
|
|
28476
28613
|
accum[2].push(curr.data);
|
|
28477
28614
|
return accum;
|
|
28478
28615
|
}, [[], [], []]);
|
|
28479
|
-
return
|
|
28616
|
+
return encodeFunctionData2({
|
|
28480
28617
|
abi,
|
|
28481
28618
|
functionName: "executeBatch",
|
|
28482
28619
|
args: [targets, values, datas]
|
|
@@ -28570,7 +28707,7 @@ var init_OZ_ERC1967Proxy = __esm({
|
|
|
28570
28707
|
});
|
|
28571
28708
|
|
|
28572
28709
|
// node_modules/@account-kit/smart-contracts/dist/esm/src/light-account/accounts/predictAddress.js
|
|
28573
|
-
import { encodeAbiParameters as encodeAbiParameters4, encodeDeployData, keccak256 as keccak2565, getContractAddress, toHex as toHex6, encodeFunctionData as
|
|
28710
|
+
import { encodeAbiParameters as encodeAbiParameters4, encodeDeployData, keccak256 as keccak2565, getContractAddress, toHex as toHex6, encodeFunctionData as encodeFunctionData3 } from "viem";
|
|
28574
28711
|
function predictLightAccountAddress({ factoryAddress, salt, ownerAddress, version }) {
|
|
28575
28712
|
const implementationAddress = (
|
|
28576
28713
|
// If we aren't using the default factory address, we compute the implementation address from the factory's `create` deployment.
|
|
@@ -28594,7 +28731,7 @@ function predictLightAccountAddress({ factoryAddress, salt, ownerAddress, versio
|
|
|
28594
28731
|
abi: OZ_ERC1967Proxy_ConstructorAbi,
|
|
28595
28732
|
args: [
|
|
28596
28733
|
implementationAddress,
|
|
28597
|
-
|
|
28734
|
+
encodeFunctionData3({
|
|
28598
28735
|
abi: LightAccountAbi_v1,
|
|
28599
28736
|
functionName: "initialize",
|
|
28600
28737
|
args: [ownerAddress]
|
|
@@ -28631,7 +28768,7 @@ var init_predictAddress = __esm({
|
|
|
28631
28768
|
});
|
|
28632
28769
|
|
|
28633
28770
|
// node_modules/@account-kit/smart-contracts/dist/esm/src/light-account/accounts/account.js
|
|
28634
|
-
import { concatHex as concatHex2, encodeFunctionData as
|
|
28771
|
+
import { concatHex as concatHex2, encodeFunctionData as encodeFunctionData4 } from "viem";
|
|
28635
28772
|
async function createLightAccount({ transport, chain, signer, initCode, version = defaultLightAccountVersion(), entryPoint = getEntryPoint(chain, {
|
|
28636
28773
|
version: AccountVersionRegistry["LightAccount"][version].entryPointVersion
|
|
28637
28774
|
}), accountAddress, factoryAddress = getDefaultLightAccountFactoryAddress(chain, version), salt: salt_ = 0n }) {
|
|
@@ -28648,7 +28785,7 @@ async function createLightAccount({ transport, chain, signer, initCode, version
|
|
|
28648
28785
|
return initCode;
|
|
28649
28786
|
return concatHex2([
|
|
28650
28787
|
factoryAddress,
|
|
28651
|
-
|
|
28788
|
+
encodeFunctionData4({
|
|
28652
28789
|
abi: factoryAbi,
|
|
28653
28790
|
functionName: "createAccount",
|
|
28654
28791
|
args: [signerAddress, salt]
|
|
@@ -28675,7 +28812,7 @@ async function createLightAccount({ transport, chain, signer, initCode, version
|
|
|
28675
28812
|
return {
|
|
28676
28813
|
...account,
|
|
28677
28814
|
encodeTransferOwnership: (newOwner) => {
|
|
28678
|
-
return
|
|
28815
|
+
return encodeFunctionData4({
|
|
28679
28816
|
abi: accountAbi,
|
|
28680
28817
|
functionName: "transferOwnership",
|
|
28681
28818
|
args: [newOwner]
|
|
@@ -29983,7 +30120,7 @@ var init_feeEstimator2 = __esm({
|
|
|
29983
30120
|
});
|
|
29984
30121
|
|
|
29985
30122
|
// node_modules/@account-kit/infra/dist/esm/gas-manager.js
|
|
29986
|
-
import { encodeFunctionData as
|
|
30123
|
+
import { encodeFunctionData as encodeFunctionData5 } from "viem";
|
|
29987
30124
|
var AlchemyPaymasterAddressV06Unify, AlchemyPaymasterAddressV07Unify, AlchemyPaymasterAddressV4, AlchemyPaymasterAddressV3, AlchemyPaymasterAddressV2, ArbSepoliaPaymasterAddress, AlchemyPaymasterAddressV1, AlchemyPaymasterAddressV07V2, AlchemyPaymasterAddressV07V1, getAlchemyPaymasterAddress, PermitTypes, ERC20Abis, EIP7597Abis;
|
|
29988
30125
|
var init_gas_manager = __esm({
|
|
29989
30126
|
"node_modules/@account-kit/infra/dist/esm/gas-manager.js"() {
|
|
@@ -30172,7 +30309,7 @@ var init_invalidSignedPermit = __esm({
|
|
|
30172
30309
|
});
|
|
30173
30310
|
|
|
30174
30311
|
// node_modules/@account-kit/infra/dist/esm/middleware/gasManager.js
|
|
30175
|
-
import { fromHex as fromHex5, isHex as isHex2, encodeAbiParameters as encodeAbiParameters5, encodeFunctionData as
|
|
30312
|
+
import { fromHex as fromHex5, isHex as isHex2, encodeAbiParameters as encodeAbiParameters5, encodeFunctionData as encodeFunctionData6, parseAbi as parseAbi2 } from "viem";
|
|
30176
30313
|
function alchemyGasManagerMiddleware(policyId, policyToken, webhookData) {
|
|
30177
30314
|
const buildContext = async (args) => {
|
|
30178
30315
|
const context = { policyId };
|
|
@@ -30354,16 +30491,16 @@ var init_gasManager = __esm({
|
|
|
30354
30491
|
}
|
|
30355
30492
|
let allowanceFuture = client.call({
|
|
30356
30493
|
to: policyToken.address,
|
|
30357
|
-
data:
|
|
30358
|
-
abi:
|
|
30494
|
+
data: encodeFunctionData6({
|
|
30495
|
+
abi: parseAbi2(ERC20Abis),
|
|
30359
30496
|
functionName: "allowance",
|
|
30360
30497
|
args: [account.address, paymasterAddress]
|
|
30361
30498
|
})
|
|
30362
30499
|
});
|
|
30363
30500
|
let nonceFuture = client.call({
|
|
30364
30501
|
to: policyToken.address,
|
|
30365
|
-
data:
|
|
30366
|
-
abi:
|
|
30502
|
+
data: encodeFunctionData6({
|
|
30503
|
+
abi: parseAbi2(EIP7597Abis),
|
|
30367
30504
|
functionName: "nonces",
|
|
30368
30505
|
args: [account.address]
|
|
30369
30506
|
})
|
|
@@ -30816,7 +30953,7 @@ var init_fee_utils = __esm({
|
|
|
30816
30953
|
|
|
30817
30954
|
// src/smart-account/permit2.ts
|
|
30818
30955
|
import {
|
|
30819
|
-
encodeFunctionData as
|
|
30956
|
+
encodeFunctionData as encodeFunctionData7,
|
|
30820
30957
|
keccak256 as keccak2567,
|
|
30821
30958
|
encodeAbiParameters as encodeAbiParameters6,
|
|
30822
30959
|
concat as concat6,
|
|
@@ -30940,7 +31077,7 @@ async function signPermit2(eip1193Request, params) {
|
|
|
30940
31077
|
return sig;
|
|
30941
31078
|
}
|
|
30942
31079
|
function encodePermitTransferFrom(token, amount, nonce, deadline, saAddress, eoaAddress, sig) {
|
|
30943
|
-
return
|
|
31080
|
+
return encodeFunctionData7({
|
|
30944
31081
|
abi: PERMIT2_ABI,
|
|
30945
31082
|
functionName: "permitTransferFrom",
|
|
30946
31083
|
args: [
|
|
@@ -30952,28 +31089,28 @@ function encodePermitTransferFrom(token, amount, nonce, deadline, saAddress, eoa
|
|
|
30952
31089
|
});
|
|
30953
31090
|
}
|
|
30954
31091
|
function encodeErc20Approve(spender, amount) {
|
|
30955
|
-
return
|
|
31092
|
+
return encodeFunctionData7({
|
|
30956
31093
|
abi: ERC20_APPROVE_ABI,
|
|
30957
31094
|
functionName: "approve",
|
|
30958
31095
|
args: [spender, amount]
|
|
30959
31096
|
});
|
|
30960
31097
|
}
|
|
30961
31098
|
function encodeErc20Allowance(owner, spender) {
|
|
30962
|
-
return
|
|
31099
|
+
return encodeFunctionData7({
|
|
30963
31100
|
abi: ERC20_ALLOWANCE_ABI,
|
|
30964
31101
|
functionName: "allowance",
|
|
30965
31102
|
args: [owner, spender]
|
|
30966
31103
|
});
|
|
30967
31104
|
}
|
|
30968
31105
|
function encodeErc20BalanceOf(owner) {
|
|
30969
|
-
return
|
|
31106
|
+
return encodeFunctionData7({
|
|
30970
31107
|
abi: ERC20_BALANCE_OF_ABI,
|
|
30971
31108
|
functionName: "balanceOf",
|
|
30972
31109
|
args: [owner]
|
|
30973
31110
|
});
|
|
30974
31111
|
}
|
|
30975
31112
|
function encodeWethWithdraw(amount) {
|
|
30976
|
-
return
|
|
31113
|
+
return encodeFunctionData7({
|
|
30977
31114
|
abi: WETH_ABI,
|
|
30978
31115
|
functionName: "withdraw",
|
|
30979
31116
|
args: [amount]
|
|
@@ -31066,9 +31203,9 @@ var init_permit2 = __esm({
|
|
|
31066
31203
|
});
|
|
31067
31204
|
|
|
31068
31205
|
// src/smart-account/uniswap.ts
|
|
31069
|
-
import { encodeFunctionData as
|
|
31206
|
+
import { encodeFunctionData as encodeFunctionData8 } from "viem";
|
|
31070
31207
|
function encodeUniswapExactOutputSingle(tokenIn, tokenOut, fee, recipient, amountOut, amountInMaximum) {
|
|
31071
|
-
return
|
|
31208
|
+
return encodeFunctionData8({
|
|
31072
31209
|
abi: SWAP_ROUTER_ABI,
|
|
31073
31210
|
functionName: "exactOutputSingle",
|
|
31074
31211
|
args: [
|
|
@@ -31596,14 +31733,14 @@ var init_smart_account2 = __esm({
|
|
|
31596
31733
|
|
|
31597
31734
|
// src/widget/features/transaction/hooks/useTransactionActionModel.ts
|
|
31598
31735
|
import { useCallback as useCallback19, useEffect as useEffect26, useMemo as useMemo20, useRef as useRef13, useState as useState26 } from "react";
|
|
31599
|
-
import { encodeFunctionData as
|
|
31736
|
+
import { encodeFunctionData as encodeFunctionData9, erc20Abi } from "viem";
|
|
31600
31737
|
function normalizeTokenAddressForCompare(chain, addr) {
|
|
31601
31738
|
const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
|
|
31602
31739
|
const value = (addr ?? "").trim();
|
|
31603
31740
|
if (chainType === "solana") return value;
|
|
31604
31741
|
return value.toLowerCase();
|
|
31605
31742
|
}
|
|
31606
|
-
function
|
|
31743
|
+
function sleep3(ms) {
|
|
31607
31744
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
31608
31745
|
}
|
|
31609
31746
|
function useTransactionActionModel({
|
|
@@ -31721,7 +31858,7 @@ function useTransactionActionModel({
|
|
|
31721
31858
|
if (status.status === "reverted") {
|
|
31722
31859
|
throw new Error("Approval transaction reverted");
|
|
31723
31860
|
}
|
|
31724
|
-
await
|
|
31861
|
+
await sleep3(intervalMs);
|
|
31725
31862
|
}
|
|
31726
31863
|
throw new Error("Timed out waiting for approval confirmation");
|
|
31727
31864
|
},
|
|
@@ -31761,7 +31898,7 @@ function useTransactionActionModel({
|
|
|
31761
31898
|
}
|
|
31762
31899
|
}
|
|
31763
31900
|
}
|
|
31764
|
-
const data =
|
|
31901
|
+
const data = encodeFunctionData9({
|
|
31765
31902
|
abi: erc20Abi,
|
|
31766
31903
|
functionName: "approve",
|
|
31767
31904
|
args: [spender, amountWei]
|
|
@@ -33371,7 +33508,7 @@ var init_useSwapRoute = __esm({
|
|
|
33371
33508
|
|
|
33372
33509
|
// src/modes/swap/hooks/useSwapExecution.ts
|
|
33373
33510
|
import { useCallback as useCallback21, useRef as useRef16, useState as useState29 } from "react";
|
|
33374
|
-
import { encodeFunctionData as
|
|
33511
|
+
import { encodeFunctionData as encodeFunctionData10, erc20Abi as erc20Abi2 } from "viem";
|
|
33375
33512
|
function normalizeTx(raw) {
|
|
33376
33513
|
const r = raw;
|
|
33377
33514
|
return {
|
|
@@ -33382,7 +33519,7 @@ function normalizeTx(raw) {
|
|
|
33382
33519
|
toChainTxUrl: r.toChainTxUrl || r.to_chain_tx_url || void 0
|
|
33383
33520
|
};
|
|
33384
33521
|
}
|
|
33385
|
-
function
|
|
33522
|
+
function sleep4(ms) {
|
|
33386
33523
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
33387
33524
|
}
|
|
33388
33525
|
function isUserRejection(err) {
|
|
@@ -33400,7 +33537,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
|
|
|
33400
33537
|
if (status.status === "success") return;
|
|
33401
33538
|
if (status.status === "reverted")
|
|
33402
33539
|
throw new Error("Approval transaction reverted");
|
|
33403
|
-
await
|
|
33540
|
+
await sleep4(2e3);
|
|
33404
33541
|
}
|
|
33405
33542
|
throw new Error("Timed out waiting for approval confirmation");
|
|
33406
33543
|
}
|
|
@@ -33640,7 +33777,7 @@ function useSwapExecution(fromChain) {
|
|
|
33640
33777
|
const approveAmount = maxApproval ? BigInt(
|
|
33641
33778
|
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"
|
|
33642
33779
|
) : fromAmountWei;
|
|
33643
|
-
const data =
|
|
33780
|
+
const data = encodeFunctionData10({
|
|
33644
33781
|
abi: erc20Abi2,
|
|
33645
33782
|
functionName: "approve",
|
|
33646
33783
|
args: [spender, approveAmount]
|
|
@@ -39945,6 +40082,7 @@ export {
|
|
|
39945
40082
|
DEFAULT_SLIPPAGE2 as DEFAULT_SLIPPAGE,
|
|
39946
40083
|
GTM_ID,
|
|
39947
40084
|
IdentityStore,
|
|
40085
|
+
POPULAR_ORDER,
|
|
39948
40086
|
RateLimitError,
|
|
39949
40087
|
SDK_NAME,
|
|
39950
40088
|
SDK_VERSION,
|
|
@@ -39953,6 +40091,7 @@ export {
|
|
|
39953
40091
|
TrustwareProvider,
|
|
39954
40092
|
TrustwareWidgetV2 as TrustwareWidget,
|
|
39955
40093
|
WALLETCONNECT_PROJECT_ID,
|
|
40094
|
+
WALLETS,
|
|
39956
40095
|
buildWalletIdentityAddress,
|
|
39957
40096
|
connectDetectedWallet,
|
|
39958
40097
|
createWalletIdentity,
|