@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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
POLYMARKET_POLYGON_CHAIN_ID,
|
|
3
|
+
fetchPolymarketProxyWallet,
|
|
4
|
+
readPolymarketBalances
|
|
5
|
+
} from "./chunk-BAEB5AFZ.mjs";
|
|
6
|
+
import "./chunk-TQ2AYMWS.mjs";
|
|
7
|
+
import "./chunk-6YRDD462.mjs";
|
|
8
|
+
|
|
9
|
+
// src/core/dapp-imports/polymarket/account.ts
|
|
10
|
+
import {
|
|
11
|
+
createPublicClient,
|
|
12
|
+
formatUnits,
|
|
13
|
+
getAddress,
|
|
14
|
+
http,
|
|
15
|
+
isAddress
|
|
16
|
+
} from "viem";
|
|
17
|
+
import { polygon } from "viem/chains";
|
|
18
|
+
async function getPolymarketAccount(params) {
|
|
19
|
+
const { rpcUrl, signal } = params;
|
|
20
|
+
if (typeof params.eoa !== "string" || !isAddress(params.eoa)) {
|
|
21
|
+
throw new TypeError(
|
|
22
|
+
`getPolymarketAccount: invalid EOA address: ${String(params.eoa)}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
const eoa = getAddress(params.eoa);
|
|
26
|
+
const proxyWallet = await fetchPolymarketProxyWallet(eoa, signal);
|
|
27
|
+
if (!proxyWallet) return null;
|
|
28
|
+
throwIfAborted(signal);
|
|
29
|
+
let balances = { pusd: 0n, usdce: 0n };
|
|
30
|
+
try {
|
|
31
|
+
balances = await readPolymarketBalances({
|
|
32
|
+
publicClient: polygonClient(rpcUrl),
|
|
33
|
+
proxyWallet
|
|
34
|
+
});
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
throwIfAborted(signal);
|
|
38
|
+
const pusd = toTokenBalance(balances.pusd);
|
|
39
|
+
const usdce = toTokenBalance(balances.usdce);
|
|
40
|
+
return {
|
|
41
|
+
eoa,
|
|
42
|
+
proxyWallet,
|
|
43
|
+
chainId: POLYMARKET_POLYGON_CHAIN_ID,
|
|
44
|
+
pusd,
|
|
45
|
+
usdce,
|
|
46
|
+
totalUsd: pusd.usd + usdce.usd
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function toTokenBalance(raw) {
|
|
50
|
+
const formatted = formatUnits(raw, 6);
|
|
51
|
+
const usd = Number(formatted);
|
|
52
|
+
return { raw, formatted, usd: Number.isFinite(usd) ? usd : 0 };
|
|
53
|
+
}
|
|
54
|
+
function polygonClient(rpcUrl) {
|
|
55
|
+
return createPublicClient({ chain: polygon, transport: http(rpcUrl) });
|
|
56
|
+
}
|
|
57
|
+
function throwIfAborted(signal) {
|
|
58
|
+
if (signal?.aborted) {
|
|
59
|
+
throw signal.reason ?? new DOMException("Aborted", "AbortError");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
getPolymarketAccount
|
|
64
|
+
};
|
package/dist/styles.css
CHANGED
|
@@ -3378,6 +3378,40 @@
|
|
|
3378
3378
|
border-radius: 8px;
|
|
3379
3379
|
}
|
|
3380
3380
|
|
|
3381
|
+
/* DappImportAssetSelectSkeleton rows. `-fill` floods a shaped container
|
|
3382
|
+
(token icon / chain badge circles); `-text` mimics a one-line text block
|
|
3383
|
+
at the asset row's font sizes. */
|
|
3384
|
+
.rs-skeleton-fill {
|
|
3385
|
+
display: block;
|
|
3386
|
+
width: 100%;
|
|
3387
|
+
height: 100%;
|
|
3388
|
+
border-radius: inherit;
|
|
3389
|
+
}
|
|
3390
|
+
|
|
3391
|
+
.rs-skeleton-text {
|
|
3392
|
+
display: inline-block;
|
|
3393
|
+
height: 12px;
|
|
3394
|
+
border-radius: 6px;
|
|
3395
|
+
}
|
|
3396
|
+
|
|
3397
|
+
.rs-skeleton-text--name {
|
|
3398
|
+
width: 96px;
|
|
3399
|
+
height: 14px;
|
|
3400
|
+
}
|
|
3401
|
+
|
|
3402
|
+
.rs-skeleton-text--balance {
|
|
3403
|
+
width: 64px;
|
|
3404
|
+
}
|
|
3405
|
+
|
|
3406
|
+
.rs-skeleton-text--usd {
|
|
3407
|
+
width: 48px;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
.rs-asset-row--skeleton {
|
|
3411
|
+
cursor: default;
|
|
3412
|
+
pointer-events: none;
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3381
3415
|
/* Inline placeholder sized to the fee value (e.g. "$0.04") while the
|
|
3382
3416
|
pre-deposit quote resolves. Stays put if the quote fails. */
|
|
3383
3417
|
.rs-skeleton-fee {
|
|
@@ -212,6 +212,15 @@ interface DepositModalProps {
|
|
|
212
212
|
* entry screen.
|
|
213
213
|
*/
|
|
214
214
|
dappImports?: DappImportsConfig;
|
|
215
|
+
/**
|
|
216
|
+
* Open the modal pre-routed into a dapp-import provider, skipping the
|
|
217
|
+
* deposit-method home screen. Must name an enabled `dappImports` key
|
|
218
|
+
* (e.g. "polymarket"); disabled/unknown values are a no-op. While the
|
|
219
|
+
* provider's balances are checked the modal shows a loading skeleton;
|
|
220
|
+
* if the flow turns out to be unreachable (no account, no balance, no
|
|
221
|
+
* wallet) it falls back to the home screen.
|
|
222
|
+
*/
|
|
223
|
+
initialDappImport?: keyof DappImportsConfig;
|
|
215
224
|
/** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
|
|
216
225
|
enableFiatOnramp?: boolean;
|
|
217
226
|
/** Show the Transfer Crypto / QR row. Default: true. */
|
|
@@ -212,6 +212,15 @@ interface DepositModalProps {
|
|
|
212
212
|
* entry screen.
|
|
213
213
|
*/
|
|
214
214
|
dappImports?: DappImportsConfig;
|
|
215
|
+
/**
|
|
216
|
+
* Open the modal pre-routed into a dapp-import provider, skipping the
|
|
217
|
+
* deposit-method home screen. Must name an enabled `dappImports` key
|
|
218
|
+
* (e.g. "polymarket"); disabled/unknown values are a no-op. While the
|
|
219
|
+
* provider's balances are checked the modal shows a loading skeleton;
|
|
220
|
+
* if the flow turns out to be unreachable (no account, no balance, no
|
|
221
|
+
* wallet) it falls back to the home screen.
|
|
222
|
+
*/
|
|
223
|
+
initialDappImport?: keyof DappImportsConfig;
|
|
215
224
|
/** Show fiat on-ramp option(s) that embed Swapped's iframe. Default: false. */
|
|
216
225
|
enableFiatOnramp?: boolean;
|
|
217
226
|
/** Show the Transfer Crypto / QR row. Default: true. */
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkLEL6GMEQcjs = require('./chunk-LEL6GMEQ.cjs');
|
|
4
|
+
require('./chunk-MQIJZNTP.cjs');
|
|
5
|
+
require('./chunk-AJHFNHG3.cjs');
|
|
5
6
|
require('./chunk-MILJQWPT.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
|
-
exports.WithdrawModal =
|
|
9
|
+
exports.WithdrawModal = _chunkLEL6GMEQcjs.WithdrawModal;
|
package/dist/withdraw.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as WithdrawModalProps } from './types-
|
|
3
|
-
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { n as WithdrawModalProps } from './types-RzfAD14B.cjs';
|
|
3
|
+
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-RzfAD14B.cjs';
|
|
4
4
|
import 'viem';
|
|
5
5
|
|
|
6
|
-
declare function WithdrawModal(props: WithdrawModalProps):
|
|
6
|
+
declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
|
|
7
7
|
declare namespace WithdrawModal {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
package/dist/withdraw.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { n as WithdrawModalProps } from './types-
|
|
3
|
-
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { n as WithdrawModalProps } from './types-RzfAD14B.js';
|
|
3
|
+
export { A as AssetOption, a as ConnectedEventData, E as ErrorEventData, S as SafeTransactionRequest, k as WithdrawCompleteEventData, l as WithdrawFailedEventData, o as WithdrawSubmittedEventData } from './types-RzfAD14B.js';
|
|
4
4
|
import 'viem';
|
|
5
5
|
|
|
6
|
-
declare function WithdrawModal(props: WithdrawModalProps):
|
|
6
|
+
declare function WithdrawModal(props: WithdrawModalProps): react.JSX.Element;
|
|
7
7
|
declare namespace WithdrawModal {
|
|
8
8
|
var displayName: string;
|
|
9
9
|
}
|
package/dist/withdraw.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhinestone/deposit-modal",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "React modal component for Rhinestone cross-chain deposits",
|
|
5
5
|
"author": "Rhinestone <dev@rhinestone.wtf>",
|
|
6
6
|
"bugs": {
|
|
@@ -51,6 +51,11 @@
|
|
|
51
51
|
"default": "./dist/constants.cjs"
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
|
+
"./polymarket": {
|
|
55
|
+
"types": "./dist/polymarket.d.ts",
|
|
56
|
+
"import": "./dist/polymarket.mjs",
|
|
57
|
+
"require": "./dist/polymarket.cjs"
|
|
58
|
+
},
|
|
54
59
|
"./styles.css": {
|
|
55
60
|
"types": "./dist/styles.d.ts",
|
|
56
61
|
"default": "./dist/styles.css"
|
|
@@ -169,6 +174,14 @@
|
|
|
169
174
|
"porto",
|
|
170
175
|
"porto/internal"
|
|
171
176
|
]
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"name": "Headless Polymarket Account",
|
|
180
|
+
"path": "dist/polymarket.mjs",
|
|
181
|
+
"limit": "3 kB",
|
|
182
|
+
"ignore": [
|
|
183
|
+
"viem"
|
|
184
|
+
]
|
|
172
185
|
}
|
|
173
186
|
],
|
|
174
187
|
"keywords": [
|
|
@@ -187,4 +200,4 @@
|
|
|
187
200
|
"overrides": {
|
|
188
201
|
"@reown/appkit-common": "1.8.20"
|
|
189
202
|
}
|
|
190
|
-
}
|
|
203
|
+
}
|