@rhinestone/deposit-modal 0.3.0 → 0.3.1
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-6SUEC5IU.mjs → DepositModalReown-G7UX4IBZ.mjs} +5 -3
- package/dist/{DepositModalReown-DNW4GH6L.cjs → DepositModalReown-MECHBE6P.cjs} +8 -6
- package/dist/{WithdrawModalReown-7UAGSOSU.mjs → WithdrawModalReown-CUJAFUQM.mjs} +4 -3
- package/dist/{WithdrawModalReown-OUWBSKSM.cjs → WithdrawModalReown-WJ6VBZKK.cjs} +7 -6
- package/dist/{caip-CrQ2KKU-.d.cts → caip-CsslyHGL.d.cts} +1 -1
- package/dist/{caip-CrQ2KKU-.d.ts → caip-CsslyHGL.d.ts} +1 -1
- package/dist/{chunk-KAWJABTW.mjs → chunk-3C35DVPE.mjs} +2 -291
- package/dist/chunk-AJHFNHG3.cjs +295 -0
- package/dist/chunk-BAEB5AFZ.mjs +212 -0
- package/dist/{chunk-TKQYTBU6.mjs → chunk-DZQD3DAV.mjs} +7 -5
- package/dist/{chunk-2SMS542Q.cjs → chunk-LEL6GMEQ.cjs} +56 -54
- package/dist/{chunk-RABZINV3.cjs → chunk-MQIJZNTP.cjs} +3 -292
- package/dist/{chunk-KJ2RR2D4.mjs → chunk-QYSCCX4K.mjs} +534 -413
- package/dist/chunk-R5CPOBCF.cjs +212 -0
- package/dist/{chunk-GPSBM66J.mjs → chunk-R5WDHHVM.mjs} +1 -1
- package/dist/{chunk-VVJAIMKB.cjs → chunk-SPUZLWQS.cjs} +783 -662
- package/dist/chunk-TQ2AYMWS.mjs +295 -0
- package/dist/{chunk-33H6O5UU.cjs → chunk-ULEAK63T.cjs} +2 -2
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/deposit.cjs +5 -3
- package/dist/deposit.d.cts +4 -4
- package/dist/deposit.d.ts +4 -4
- package/dist/deposit.mjs +4 -2
- package/dist/index.cjs +6 -4
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.mjs +5 -3
- package/dist/polymarket.cjs +64 -0
- package/dist/polymarket.d.cts +57 -0
- package/dist/polymarket.d.ts +57 -0
- package/dist/polymarket.mjs +64 -0
- package/dist/styles.css +34 -0
- package/dist/{types-BMcGO5k_.d.cts → types-RzfAD14B.d.cts} +9 -0
- package/dist/{types-BMcGO5k_.d.ts → types-RzfAD14B.d.ts} +9 -0
- package/dist/withdraw.cjs +4 -3
- package/dist/withdraw.d.cts +4 -4
- package/dist/withdraw.d.ts +4 -4
- package/dist/withdraw.mjs +3 -2
- package/package.json +15 -2
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DepositModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QYSCCX4K.mjs";
|
|
4
|
+
import "./chunk-BAEB5AFZ.mjs";
|
|
4
5
|
import {
|
|
5
6
|
ReownWalletProvider,
|
|
6
7
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-R5WDHHVM.mjs";
|
|
9
|
+
import "./chunk-3C35DVPE.mjs";
|
|
10
|
+
import "./chunk-TQ2AYMWS.mjs";
|
|
9
11
|
import "./chunk-6YRDD462.mjs";
|
|
10
12
|
|
|
11
13
|
// src/DepositModalReown.tsx
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSPUZLWQScjs = require('./chunk-SPUZLWQS.cjs');
|
|
4
|
+
require('./chunk-R5CPOBCF.cjs');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
8
|
+
var _chunkULEAK63Tcjs = require('./chunk-ULEAK63T.cjs');
|
|
9
|
+
require('./chunk-MQIJZNTP.cjs');
|
|
10
|
+
require('./chunk-AJHFNHG3.cjs');
|
|
9
11
|
require('./chunk-MILJQWPT.cjs');
|
|
10
12
|
|
|
11
13
|
// src/DepositModalReown.tsx
|
|
@@ -14,7 +16,7 @@ var _react3 = require('@reown/appkit/react');
|
|
|
14
16
|
var _react5 = require('@reown/appkit-adapter-solana/react');
|
|
15
17
|
var _jsxruntime = require('react/jsx-runtime');
|
|
16
18
|
function DepositModalWithReown(props) {
|
|
17
|
-
const reown =
|
|
19
|
+
const reown = _chunkULEAK63Tcjs.useReownWallet.call(void 0, );
|
|
18
20
|
const enableSolana = _nullishCoalesce(props.enableSolana, () => ( true));
|
|
19
21
|
const { walletProvider: solanaWalletProvider } = _react3.useAppKitProvider.call(void 0,
|
|
20
22
|
enableSolana ? "solana" : "eip155"
|
|
@@ -35,7 +37,7 @@ function DepositModalWithReown(props) {
|
|
|
35
37
|
reown.disconnect();
|
|
36
38
|
}, [reown.disconnect]);
|
|
37
39
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
38
|
-
|
|
40
|
+
_chunkSPUZLWQScjs.DepositModalInner,
|
|
39
41
|
{
|
|
40
42
|
...props,
|
|
41
43
|
reownWallet: reownWithSolana,
|
|
@@ -46,7 +48,7 @@ function DepositModalWithReown(props) {
|
|
|
46
48
|
}
|
|
47
49
|
function DepositModalReown(props) {
|
|
48
50
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
49
|
-
|
|
51
|
+
_chunkULEAK63Tcjs.ReownWalletProvider,
|
|
50
52
|
{
|
|
51
53
|
projectId: props.reownAppId,
|
|
52
54
|
theme: props.theme,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModalInner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DZQD3DAV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ReownWalletProvider,
|
|
6
6
|
useReownWallet
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-R5WDHHVM.mjs";
|
|
8
|
+
import "./chunk-3C35DVPE.mjs";
|
|
9
|
+
import "./chunk-TQ2AYMWS.mjs";
|
|
9
10
|
import "./chunk-6YRDD462.mjs";
|
|
10
11
|
|
|
11
12
|
// src/WithdrawModalReown.tsx
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLEL6GMEQcjs = require('./chunk-LEL6GMEQ.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunkULEAK63Tcjs = require('./chunk-ULEAK63T.cjs');
|
|
8
|
+
require('./chunk-MQIJZNTP.cjs');
|
|
9
|
+
require('./chunk-AJHFNHG3.cjs');
|
|
9
10
|
require('./chunk-MILJQWPT.cjs');
|
|
10
11
|
|
|
11
12
|
// src/WithdrawModalReown.tsx
|
|
12
13
|
var _react = require('react');
|
|
13
14
|
var _jsxruntime = require('react/jsx-runtime');
|
|
14
15
|
function WithdrawModalWithReown(props) {
|
|
15
|
-
const reown =
|
|
16
|
+
const reown = _chunkULEAK63Tcjs.useReownWallet.call(void 0, );
|
|
16
17
|
const handleConnect = _react.useCallback.call(void 0, () => {
|
|
17
18
|
reown.openConnect();
|
|
18
19
|
}, [reown.openConnect]);
|
|
@@ -20,7 +21,7 @@ function WithdrawModalWithReown(props) {
|
|
|
20
21
|
reown.disconnect();
|
|
21
22
|
}, [reown.disconnect]);
|
|
22
23
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
23
|
-
|
|
24
|
+
_chunkLEL6GMEQcjs.WithdrawModalInner,
|
|
24
25
|
{
|
|
25
26
|
...props,
|
|
26
27
|
reownWallet: reown,
|
|
@@ -30,7 +31,7 @@ function WithdrawModalWithReown(props) {
|
|
|
30
31
|
);
|
|
31
32
|
}
|
|
32
33
|
function WithdrawModalReown(props) {
|
|
33
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
34
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkULEAK63Tcjs.ReownWalletProvider, { projectId: props.reownAppId, theme: props.theme, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, WithdrawModalWithReown, { ...props }) });
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
|
|
@@ -59,4 +59,4 @@ declare const HYPERCORE_CHAIN_ID = 1337;
|
|
|
59
59
|
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
60
60
|
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
61
61
|
|
|
62
|
-
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c,
|
|
62
|
+
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c, type SupportedTokenOption as d, chainRegistry as e, findChainIdForToken as f, getChainBadge as g, getChainIcon as h, getChainId as i, getChainName as j, getChainObject as k, getExplorerName as l, getExplorerTxUrl as m, getExplorerUrl as n, getSupportedChainIds as o, getSupportedTargetTokens as p, getSupportedTokenSymbolsForChain as q, getTargetTokenSymbolsForChain as r, getTokenAddress as s, getTokenDecimals as t, getTokenDecimalsByAddress as u, getTokenIcon as v, getTokenSymbol as w, getUsdcAddress as x, getUsdcDecimals as y, isSupportedTokenAddressForChain as z };
|
|
@@ -59,4 +59,4 @@ declare const HYPERCORE_CHAIN_ID = 1337;
|
|
|
59
59
|
/** Canonical USDC on HyperEVM (999), the HyperCore settlement chain. */
|
|
60
60
|
declare const HYPERCORE_USDC_ADDRESS = "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
61
61
|
|
|
62
|
-
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c,
|
|
62
|
+
export { CHAIN_BY_ID as C, DEFAULT_BACKEND_URL as D, HYPERCORE_CHAIN_ID as H, NATIVE_TOKEN_ADDRESS as N, SOURCE_CHAINS as S, DEFAULT_SIGNER_ADDRESS as a, HYPERCORE_USDC_ADDRESS as b, SUPPORTED_CHAINS as c, type SupportedTokenOption as d, chainRegistry as e, findChainIdForToken as f, getChainBadge as g, getChainIcon as h, getChainId as i, getChainName as j, getChainObject as k, getExplorerName as l, getExplorerTxUrl as m, getExplorerUrl as n, getSupportedChainIds as o, getSupportedTargetTokens as p, getSupportedTokenSymbolsForChain as q, getTargetTokenSymbolsForChain as r, getTokenAddress as s, getTokenDecimals as t, getTokenDecimalsByAddress as u, getTokenIcon as v, getTokenSymbol as w, getUsdcAddress as x, getUsdcDecimals as y, isSupportedTokenAddressForChain as z };
|
|
@@ -3201,7 +3201,7 @@ function ProcessingStep({
|
|
|
3201
3201
|
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
3202
3202
|
/* @__PURE__ */ jsx18("span", { children: sourceChainName }),
|
|
3203
3203
|
sourceChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: sourceChainIcon, alt: "" }) }),
|
|
3204
|
-
|
|
3204
|
+
sourceExplorerUrl && /* @__PURE__ */ jsx18(
|
|
3205
3205
|
"a",
|
|
3206
3206
|
{
|
|
3207
3207
|
href: sourceExplorerUrl,
|
|
@@ -3219,7 +3219,7 @@ function ProcessingStep({
|
|
|
3219
3219
|
/* @__PURE__ */ jsxs16("span", { className: "rs-review-detail-value", children: [
|
|
3220
3220
|
/* @__PURE__ */ jsx18("span", { children: targetChainName }),
|
|
3221
3221
|
targetChainIcon && /* @__PURE__ */ jsx18("span", { className: "rs-review-detail-icon", children: /* @__PURE__ */ jsx18("img", { src: targetChainIcon, alt: "" }) }),
|
|
3222
|
-
|
|
3222
|
+
destExplorerUrl && /* @__PURE__ */ jsx18(
|
|
3223
3223
|
"a",
|
|
3224
3224
|
{
|
|
3225
3225
|
href: destExplorerUrl,
|
|
@@ -3371,291 +3371,6 @@ function ProcessingStep({
|
|
|
3371
3371
|
] });
|
|
3372
3372
|
}
|
|
3373
3373
|
|
|
3374
|
-
// src/core/safe.ts
|
|
3375
|
-
import {
|
|
3376
|
-
concat,
|
|
3377
|
-
encodeFunctionData,
|
|
3378
|
-
erc20Abi,
|
|
3379
|
-
hashTypedData,
|
|
3380
|
-
pad,
|
|
3381
|
-
parseEventLogs,
|
|
3382
|
-
toHex,
|
|
3383
|
-
zeroAddress
|
|
3384
|
-
} from "viem";
|
|
3385
|
-
var SAFE_ABI = [
|
|
3386
|
-
{
|
|
3387
|
-
type: "function",
|
|
3388
|
-
name: "isOwner",
|
|
3389
|
-
stateMutability: "view",
|
|
3390
|
-
inputs: [{ name: "owner", type: "address" }],
|
|
3391
|
-
outputs: [{ name: "", type: "bool" }]
|
|
3392
|
-
},
|
|
3393
|
-
{
|
|
3394
|
-
type: "function",
|
|
3395
|
-
name: "nonce",
|
|
3396
|
-
stateMutability: "view",
|
|
3397
|
-
inputs: [],
|
|
3398
|
-
outputs: [{ type: "uint256" }]
|
|
3399
|
-
},
|
|
3400
|
-
{
|
|
3401
|
-
type: "function",
|
|
3402
|
-
name: "execTransaction",
|
|
3403
|
-
stateMutability: "payable",
|
|
3404
|
-
inputs: [
|
|
3405
|
-
{ name: "to", type: "address" },
|
|
3406
|
-
{ name: "value", type: "uint256" },
|
|
3407
|
-
{ name: "data", type: "bytes" },
|
|
3408
|
-
{ name: "operation", type: "uint8" },
|
|
3409
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
3410
|
-
{ name: "baseGas", type: "uint256" },
|
|
3411
|
-
{ name: "gasPrice", type: "uint256" },
|
|
3412
|
-
{ name: "gasToken", type: "address" },
|
|
3413
|
-
{ name: "refundReceiver", type: "address" },
|
|
3414
|
-
{ name: "signatures", type: "bytes" }
|
|
3415
|
-
],
|
|
3416
|
-
outputs: [{ name: "success", type: "bool" }]
|
|
3417
|
-
},
|
|
3418
|
-
{
|
|
3419
|
-
type: "event",
|
|
3420
|
-
name: "ExecutionSuccess",
|
|
3421
|
-
inputs: [
|
|
3422
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
3423
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
3424
|
-
],
|
|
3425
|
-
anonymous: false
|
|
3426
|
-
},
|
|
3427
|
-
{
|
|
3428
|
-
type: "event",
|
|
3429
|
-
name: "ExecutionFailure",
|
|
3430
|
-
inputs: [
|
|
3431
|
-
{ name: "txHash", type: "bytes32", indexed: true },
|
|
3432
|
-
{ name: "payment", type: "uint256", indexed: false }
|
|
3433
|
-
],
|
|
3434
|
-
anonymous: false
|
|
3435
|
-
}
|
|
3436
|
-
];
|
|
3437
|
-
async function executeSafeEthTransfer(params) {
|
|
3438
|
-
const {
|
|
3439
|
-
walletClient,
|
|
3440
|
-
publicClient,
|
|
3441
|
-
safeAddress,
|
|
3442
|
-
recipient,
|
|
3443
|
-
amount,
|
|
3444
|
-
chainId
|
|
3445
|
-
} = params;
|
|
3446
|
-
const account = walletClient.account;
|
|
3447
|
-
const chain = walletClient.chain;
|
|
3448
|
-
if (!account || !chain) {
|
|
3449
|
-
throw new Error("Wallet not connected");
|
|
3450
|
-
}
|
|
3451
|
-
if (chain.id !== chainId) {
|
|
3452
|
-
throw new Error(`Switch to ${getChainName(chainId)} to sign`);
|
|
3453
|
-
}
|
|
3454
|
-
const isOwner = await publicClient.readContract({
|
|
3455
|
-
address: safeAddress,
|
|
3456
|
-
abi: SAFE_ABI,
|
|
3457
|
-
functionName: "isOwner",
|
|
3458
|
-
args: [account.address]
|
|
3459
|
-
});
|
|
3460
|
-
if (!isOwner) {
|
|
3461
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
3462
|
-
}
|
|
3463
|
-
const safeTx = {
|
|
3464
|
-
to: recipient,
|
|
3465
|
-
value: amount,
|
|
3466
|
-
data: "0x",
|
|
3467
|
-
operation: 0,
|
|
3468
|
-
safeTxGas: 0n,
|
|
3469
|
-
baseGas: 0n,
|
|
3470
|
-
gasPrice: 0n,
|
|
3471
|
-
gasToken: zeroAddress,
|
|
3472
|
-
refundReceiver: zeroAddress
|
|
3473
|
-
};
|
|
3474
|
-
const signature = concat([
|
|
3475
|
-
pad(account.address, { size: 32 }),
|
|
3476
|
-
pad(toHex(0), { size: 32 }),
|
|
3477
|
-
toHex(1, { size: 1 })
|
|
3478
|
-
]);
|
|
3479
|
-
const txHash = await walletClient.writeContract({
|
|
3480
|
-
account,
|
|
3481
|
-
chain,
|
|
3482
|
-
address: safeAddress,
|
|
3483
|
-
abi: SAFE_ABI,
|
|
3484
|
-
functionName: "execTransaction",
|
|
3485
|
-
args: [
|
|
3486
|
-
safeTx.to,
|
|
3487
|
-
safeTx.value,
|
|
3488
|
-
safeTx.data,
|
|
3489
|
-
safeTx.operation,
|
|
3490
|
-
safeTx.safeTxGas,
|
|
3491
|
-
safeTx.baseGas,
|
|
3492
|
-
safeTx.gasPrice,
|
|
3493
|
-
safeTx.gasToken,
|
|
3494
|
-
safeTx.refundReceiver,
|
|
3495
|
-
signature
|
|
3496
|
-
]
|
|
3497
|
-
});
|
|
3498
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
3499
|
-
hash: txHash
|
|
3500
|
-
});
|
|
3501
|
-
const safeLogs = receipt.logs.filter(
|
|
3502
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3503
|
-
);
|
|
3504
|
-
const parsed = parseEventLogs({
|
|
3505
|
-
abi: SAFE_ABI,
|
|
3506
|
-
logs: safeLogs,
|
|
3507
|
-
strict: false
|
|
3508
|
-
});
|
|
3509
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
3510
|
-
if (failed) {
|
|
3511
|
-
throw new Error("Safe transaction failed");
|
|
3512
|
-
}
|
|
3513
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
3514
|
-
if (!succeeded) {
|
|
3515
|
-
throw new Error("Safe transaction status unavailable");
|
|
3516
|
-
}
|
|
3517
|
-
return { txHash };
|
|
3518
|
-
}
|
|
3519
|
-
async function executeSafeErc20Transfer(params) {
|
|
3520
|
-
const {
|
|
3521
|
-
walletClient,
|
|
3522
|
-
publicClient,
|
|
3523
|
-
safeAddress,
|
|
3524
|
-
tokenAddress,
|
|
3525
|
-
recipient,
|
|
3526
|
-
amount,
|
|
3527
|
-
chainId
|
|
3528
|
-
} = params;
|
|
3529
|
-
const account = walletClient.account;
|
|
3530
|
-
const chain = walletClient.chain;
|
|
3531
|
-
if (!account || !chain) {
|
|
3532
|
-
throw new Error("Wallet not connected");
|
|
3533
|
-
}
|
|
3534
|
-
if (chain.id !== chainId) {
|
|
3535
|
-
throw new Error(`Switch to ${getChainName(chainId)} to sign`);
|
|
3536
|
-
}
|
|
3537
|
-
const isOwner = await publicClient.readContract({
|
|
3538
|
-
address: safeAddress,
|
|
3539
|
-
abi: SAFE_ABI,
|
|
3540
|
-
functionName: "isOwner",
|
|
3541
|
-
args: [account.address]
|
|
3542
|
-
});
|
|
3543
|
-
if (!isOwner) {
|
|
3544
|
-
throw new Error("Connected wallet is not a Safe owner");
|
|
3545
|
-
}
|
|
3546
|
-
const data = encodeFunctionData({
|
|
3547
|
-
abi: erc20Abi,
|
|
3548
|
-
functionName: "transfer",
|
|
3549
|
-
args: [recipient, amount]
|
|
3550
|
-
});
|
|
3551
|
-
const safeTx = {
|
|
3552
|
-
to: tokenAddress,
|
|
3553
|
-
value: 0n,
|
|
3554
|
-
data,
|
|
3555
|
-
operation: 0,
|
|
3556
|
-
safeTxGas: 0n,
|
|
3557
|
-
baseGas: 0n,
|
|
3558
|
-
gasPrice: 0n,
|
|
3559
|
-
gasToken: zeroAddress,
|
|
3560
|
-
refundReceiver: zeroAddress
|
|
3561
|
-
};
|
|
3562
|
-
const signature = concat([
|
|
3563
|
-
pad(account.address, { size: 32 }),
|
|
3564
|
-
pad(toHex(0), { size: 32 }),
|
|
3565
|
-
toHex(1, { size: 1 })
|
|
3566
|
-
]);
|
|
3567
|
-
const txHash = await walletClient.writeContract({
|
|
3568
|
-
account,
|
|
3569
|
-
chain,
|
|
3570
|
-
address: safeAddress,
|
|
3571
|
-
abi: SAFE_ABI,
|
|
3572
|
-
functionName: "execTransaction",
|
|
3573
|
-
args: [
|
|
3574
|
-
safeTx.to,
|
|
3575
|
-
safeTx.value,
|
|
3576
|
-
safeTx.data,
|
|
3577
|
-
safeTx.operation,
|
|
3578
|
-
safeTx.safeTxGas,
|
|
3579
|
-
safeTx.baseGas,
|
|
3580
|
-
safeTx.gasPrice,
|
|
3581
|
-
safeTx.gasToken,
|
|
3582
|
-
safeTx.refundReceiver,
|
|
3583
|
-
signature
|
|
3584
|
-
]
|
|
3585
|
-
});
|
|
3586
|
-
const receipt = await publicClient.waitForTransactionReceipt({
|
|
3587
|
-
hash: txHash
|
|
3588
|
-
});
|
|
3589
|
-
const safeLogs = receipt.logs.filter(
|
|
3590
|
-
(log) => log.address.toLowerCase() === safeAddress.toLowerCase()
|
|
3591
|
-
);
|
|
3592
|
-
const parsed = parseEventLogs({
|
|
3593
|
-
abi: SAFE_ABI,
|
|
3594
|
-
logs: safeLogs,
|
|
3595
|
-
strict: false
|
|
3596
|
-
});
|
|
3597
|
-
const failed = parsed.find((log) => log.eventName === "ExecutionFailure");
|
|
3598
|
-
if (failed) {
|
|
3599
|
-
throw new Error("Safe transaction failed");
|
|
3600
|
-
}
|
|
3601
|
-
const succeeded = parsed.find((log) => log.eventName === "ExecutionSuccess");
|
|
3602
|
-
if (!succeeded) {
|
|
3603
|
-
throw new Error("Safe transaction status unavailable");
|
|
3604
|
-
}
|
|
3605
|
-
return { txHash };
|
|
3606
|
-
}
|
|
3607
|
-
var SAFE_TX_TYPES = {
|
|
3608
|
-
SafeTx: [
|
|
3609
|
-
{ name: "to", type: "address" },
|
|
3610
|
-
{ name: "value", type: "uint256" },
|
|
3611
|
-
{ name: "data", type: "bytes" },
|
|
3612
|
-
{ name: "operation", type: "uint8" },
|
|
3613
|
-
{ name: "safeTxGas", type: "uint256" },
|
|
3614
|
-
{ name: "baseGas", type: "uint256" },
|
|
3615
|
-
{ name: "gasPrice", type: "uint256" },
|
|
3616
|
-
{ name: "gasToken", type: "address" },
|
|
3617
|
-
{ name: "refundReceiver", type: "address" },
|
|
3618
|
-
{ name: "nonce", type: "uint256" }
|
|
3619
|
-
]
|
|
3620
|
-
};
|
|
3621
|
-
async function buildSafeTransaction(params) {
|
|
3622
|
-
const { publicClient, safeAddress, to, value, data, chainId } = params;
|
|
3623
|
-
const nonce = await publicClient.readContract({
|
|
3624
|
-
address: safeAddress,
|
|
3625
|
-
abi: SAFE_ABI,
|
|
3626
|
-
functionName: "nonce"
|
|
3627
|
-
});
|
|
3628
|
-
const message = {
|
|
3629
|
-
to,
|
|
3630
|
-
value,
|
|
3631
|
-
data,
|
|
3632
|
-
operation: 0,
|
|
3633
|
-
safeTxGas: 0n,
|
|
3634
|
-
baseGas: 0n,
|
|
3635
|
-
gasPrice: 0n,
|
|
3636
|
-
gasToken: zeroAddress,
|
|
3637
|
-
refundReceiver: zeroAddress,
|
|
3638
|
-
nonce
|
|
3639
|
-
};
|
|
3640
|
-
const safeTxHash = hashTypedData({
|
|
3641
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
3642
|
-
types: SAFE_TX_TYPES,
|
|
3643
|
-
primaryType: "SafeTx",
|
|
3644
|
-
message
|
|
3645
|
-
});
|
|
3646
|
-
return {
|
|
3647
|
-
chainId,
|
|
3648
|
-
safeAddress,
|
|
3649
|
-
safeTxHash,
|
|
3650
|
-
typedData: {
|
|
3651
|
-
domain: { chainId, verifyingContract: safeAddress },
|
|
3652
|
-
types: SAFE_TX_TYPES,
|
|
3653
|
-
primaryType: "SafeTx",
|
|
3654
|
-
message
|
|
3655
|
-
}
|
|
3656
|
-
};
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
3374
|
// src/core/session-owner.ts
|
|
3660
3375
|
import { isAddress } from "viem";
|
|
3661
3376
|
import {
|
|
@@ -3751,10 +3466,6 @@ export {
|
|
|
3751
3466
|
txRefsMatch,
|
|
3752
3467
|
failureMessageForEvent,
|
|
3753
3468
|
ProcessingStep,
|
|
3754
|
-
SAFE_ABI,
|
|
3755
|
-
executeSafeEthTransfer,
|
|
3756
|
-
executeSafeErc20Transfer,
|
|
3757
|
-
buildSafeTransaction,
|
|
3758
3469
|
getPublicClient,
|
|
3759
3470
|
getHyperEvmReadClient,
|
|
3760
3471
|
loadSessionOwnerFromStorage,
|