@ab-org/predicate-market-sdk 1.0.0 → 2.0.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.
Files changed (91) hide show
  1. package/dist/index.d.ts +706 -22
  2. package/dist/index.js +43009 -23
  3. package/package.json +11 -5
  4. package/dist/auth/autoReconnect.d.ts +0 -11
  5. package/dist/auth/autoReconnect.js +0 -36
  6. package/dist/auth/bundledConfig.d.ts +0 -2
  7. package/dist/auth/bundledConfig.js +0 -19
  8. package/dist/auth/config.d.ts +0 -29
  9. package/dist/auth/config.js +0 -53
  10. package/dist/auth/google.d.ts +0 -43
  11. package/dist/auth/google.js +0 -147
  12. package/dist/auth/oidcRelay.d.ts +0 -11
  13. package/dist/auth/oidcRelay.js +0 -107
  14. package/dist/auth/twitter.d.ts +0 -7
  15. package/dist/auth/twitter.js +0 -94
  16. package/dist/auth/walletAccount.d.ts +0 -20
  17. package/dist/auth/walletAccount.js +0 -267
  18. package/dist/constants/chains.d.ts +0 -2
  19. package/dist/constants/chains.js +0 -3
  20. package/dist/modules/api.d.ts +0 -149
  21. package/dist/modules/api.js +0 -95
  22. package/dist/modules/balanceQuery.d.ts +0 -27
  23. package/dist/modules/balanceQuery.js +0 -60
  24. package/dist/modules/deposit.d.ts +0 -31
  25. package/dist/modules/deposit.js +0 -58
  26. package/dist/modules/marketData.d.ts +0 -8
  27. package/dist/modules/marketData.js +0 -107
  28. package/dist/modules/withdraw.d.ts +0 -31
  29. package/dist/modules/withdraw.js +0 -61
  30. package/dist/modules/withdrawDirect.d.ts +0 -14
  31. package/dist/modules/withdrawDirect.js +0 -33
  32. package/dist/modules/withdrawExecutor.d.ts +0 -56
  33. package/dist/modules/withdrawExecutor.js +0 -210
  34. package/dist/policyAdapter.d.ts +0 -11
  35. package/dist/policyAdapter.js +0 -38
  36. package/dist/types.d.ts +0 -62
  37. package/dist/types.js +0 -1
  38. package/dist/ui/DepositModal.d.ts +0 -36
  39. package/dist/ui/DepositModal.js +0 -354
  40. package/dist/ui/SignInModal.d.ts +0 -22
  41. package/dist/ui/SignInModal.js +0 -77
  42. package/dist/ui/SignInModal.sections.d.ts +0 -33
  43. package/dist/ui/SignInModal.sections.js +0 -45
  44. package/dist/ui/SignInModal.shared.d.ts +0 -15
  45. package/dist/ui/SignInModal.shared.js +0 -126
  46. package/dist/ui/WalletSelectionModal.d.ts +0 -14
  47. package/dist/ui/WalletSelectionModal.js +0 -54
  48. package/dist/ui/WithdrawModal.d.ts +0 -57
  49. package/dist/ui/WithdrawModal.js +0 -574
  50. package/dist/ui/components/CloseButton.d.ts +0 -4
  51. package/dist/ui/components/CloseButton.js +0 -15
  52. package/dist/ui/components/Countdown.d.ts +0 -16
  53. package/dist/ui/components/Countdown.js +0 -42
  54. package/dist/ui/components/DepositDetailsPanel.d.ts +0 -8
  55. package/dist/ui/components/DepositDetailsPanel.js +0 -143
  56. package/dist/ui/components/DropdownField.d.ts +0 -19
  57. package/dist/ui/components/DropdownField.js +0 -81
  58. package/dist/ui/components/Field.d.ts +0 -10
  59. package/dist/ui/components/Field.js +0 -21
  60. package/dist/ui/components/LoginRequiredOverlay.d.ts +0 -6
  61. package/dist/ui/components/LoginRequiredOverlay.js +0 -31
  62. package/dist/ui/components/ModalCard.d.ts +0 -9
  63. package/dist/ui/components/ModalCard.js +0 -14
  64. package/dist/ui/components/ModalFrame.d.ts +0 -9
  65. package/dist/ui/components/ModalFrame.js +0 -18
  66. package/dist/ui/components/PrimaryButton.d.ts +0 -2
  67. package/dist/ui/components/PrimaryButton.js +0 -14
  68. package/dist/ui/components/QRCodePanel.d.ts +0 -4
  69. package/dist/ui/components/QRCodePanel.js +0 -43
  70. package/dist/ui/components/Select.d.ts +0 -12
  71. package/dist/ui/components/Select.js +0 -29
  72. package/dist/ui/components/StepIndicator.d.ts +0 -7
  73. package/dist/ui/components/StepIndicator.js +0 -35
  74. package/dist/ui/components/Success.d.ts +0 -1
  75. package/dist/ui/components/Success.js +0 -4
  76. package/dist/ui/components/Toast.d.ts +0 -8
  77. package/dist/ui/components/Toast.js +0 -51
  78. package/dist/ui/hooks/useSession.d.ts +0 -2
  79. package/dist/ui/hooks/useSession.js +0 -10
  80. package/dist/ui/signInTypes.d.ts +0 -28
  81. package/dist/ui/signInTypes.js +0 -1
  82. package/dist/ui/theme.d.ts +0 -31
  83. package/dist/ui/theme.js +0 -31
  84. package/dist/ui/useSignInModalController.d.ts +0 -25
  85. package/dist/ui/useSignInModalController.js +0 -119
  86. package/dist/utils/env.d.ts +0 -1
  87. package/dist/utils/env.js +0 -63
  88. package/dist/utils/explorer.d.ts +0 -3
  89. package/dist/utils/explorer.js +0 -47
  90. package/dist/walletUtils.d.ts +0 -3
  91. package/dist/walletUtils.js +0 -3
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from "react";
3
- import { colors, radii } from "../theme.js";
4
- const variantStyles = {
5
- success: { bg: "rgba(41, 255, 155, 0.82)", border: "rgba(41, 255, 155, 0.53)" },
6
- error: { bg: "rgba(255, 107, 107, 0.82)", border: "rgba(255, 107, 107, 0.53)" },
7
- info: { bg: "rgba(126, 135, 162, 0.82)", border: "rgba(126, 135, 162, 0.55)" },
8
- };
9
- export const Toast = ({ message, variant = "info", duration, onClose }) => {
10
- const style = variantStyles[variant];
11
- useEffect(() => {
12
- if (duration != null && duration > 0 && onClose) {
13
- const timer = setTimeout(onClose, duration);
14
- return () => clearTimeout(timer);
15
- }
16
- }, [duration, onClose]);
17
- return (_jsx("div", { style: {
18
- position: "fixed",
19
- top: 0,
20
- left: 0,
21
- right: 0,
22
- display: "flex",
23
- justifyContent: "center",
24
- paddingTop: 16,
25
- zIndex: 10000,
26
- pointerEvents: "none",
27
- }, children: _jsxs("div", { role: "alert", style: {
28
- pointerEvents: "auto",
29
- display: "flex",
30
- alignItems: "center",
31
- gap: 10,
32
- padding: "12px 16px",
33
- borderRadius: radii.card,
34
- background: style.bg,
35
- border: `1px solid ${style.border}`,
36
- color: colors.textPrimary,
37
- fontSize: 14,
38
- lineHeight: 1.4,
39
- maxWidth: 360,
40
- boxSizing: "border-box",
41
- }, children: [_jsx("span", { style: { flex: 1 }, children: message }), onClose ? (_jsx("button", { type: "button", "aria-label": "Dismiss", onClick: onClose, style: {
42
- padding: 4,
43
- margin: -4,
44
- border: "none",
45
- background: "transparent",
46
- color: colors.textSecondary,
47
- cursor: "pointer",
48
- borderRadius: 4,
49
- lineHeight: 1,
50
- }, children: _jsx("svg", { width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", children: _jsx("path", { d: "M3.5 3.5L10.5 10.5M10.5 3.5L3.5 10.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }) }) })) : null] }) }));
51
- };
@@ -1,2 +0,0 @@
1
- import { type WalletSession } from "@ab-org/sdk-core";
2
- export declare function useSession(): WalletSession | null;
@@ -1,10 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { sessionStore } from "@ab-org/sdk-core";
3
- export function useSession() {
4
- const [session, setSession] = useState(() => sessionStore.getState().session);
5
- useEffect(() => {
6
- const unsub = sessionStore.on("session:changed", setSession);
7
- return () => { unsub(); };
8
- }, []);
9
- return session;
10
- }
@@ -1,28 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { SessionCapabilityPolicy } from "@ab-org/sdk-core";
3
- export interface WalletItem {
4
- id: string;
5
- name: string;
6
- icon?: ReactNode;
7
- installed?: boolean;
8
- installUrl?: string;
9
- }
10
- export interface SocialProvider {
11
- id: string;
12
- label: string;
13
- icon?: ReactNode;
14
- }
15
- export interface SignInUiConfig {
16
- socialProviders?: SocialProvider[];
17
- wallets?: WalletItem[];
18
- initialVisibleCount?: number;
19
- /**
20
- * @deprecated Ignored by `SignInModal` / `useSignInModalController`: social login creates the session without `window.confirm`.
21
- */
22
- sessionConfirmation?: {
23
- enabled?: boolean;
24
- title?: string;
25
- message?: string;
26
- };
27
- sessionPolicy?: Partial<SessionCapabilityPolicy>;
28
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,31 +0,0 @@
1
- export declare const colors: {
2
- background: string;
3
- card: string;
4
- cardRaised: string;
5
- border: string;
6
- borderStrong: string;
7
- borderFocused: string;
8
- textPrimary: string;
9
- textSecondary: string;
10
- accent: string;
11
- accentStrong: string;
12
- warning: string;
13
- danger: string;
14
- stepActive: string;
15
- stepInactive: string;
16
- buttonDisabledBg: string;
17
- buttonDisabledBorder: string;
18
- };
19
- export declare const radii: {
20
- xl: string;
21
- lg: string;
22
- md: string;
23
- sm: string;
24
- pill: string;
25
- full: string;
26
- card: string;
27
- input: string;
28
- };
29
- export declare const fonts: {
30
- family: string;
31
- };
package/dist/ui/theme.js DELETED
@@ -1,31 +0,0 @@
1
- export const colors = {
2
- background: "#050608",
3
- card: "#121214",
4
- cardRaised: "#151821",
5
- border: "rgba(126,135,162,0.2)",
6
- borderStrong: "rgba(255,255,255,0.16)",
7
- borderFocused: "#FFFFFF",
8
- textPrimary: "#FFFFFF",
9
- textSecondary: "#737477",
10
- accent: "#29FF9B",
11
- accentStrong: "#4AD481",
12
- warning: "#FFB547",
13
- danger: "#FF6B6B",
14
- stepActive: "#FFFFFF",
15
- stepInactive: "#36383D",
16
- buttonDisabledBg: "rgba(255,255,255,0.14)",
17
- buttonDisabledBorder: "#444444",
18
- };
19
- export const radii = {
20
- xl: "28px",
21
- lg: "20px",
22
- md: "14px",
23
- sm: "10px",
24
- pill: "99px",
25
- full: "9999px",
26
- card: "12px",
27
- input: "8px",
28
- };
29
- export const fonts = {
30
- family: '"Switzer", "Inter", "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
31
- };
@@ -1,25 +0,0 @@
1
- import type { GoogleCredential } from "../auth/google.js";
2
- import type { TwitterAuthResult } from "../auth/twitter.js";
3
- import { type CubeSignerSession, type WalletSession } from "@ab-org/sdk-core";
4
- import type { WalletItem } from "./signInTypes.js";
5
- export interface SignInModalControllerOptions {
6
- wallets: WalletItem[] | undefined;
7
- initialVisibleCount: number;
8
- onGoogleLogin?: (credential: GoogleCredential) => void;
9
- onTwitterLogin?: (result: TwitterAuthResult) => void;
10
- onCubeSignerSession?: (session: CubeSignerSession) => void;
11
- onWalletConnected?: (session: WalletSession, walletId: string) => void;
12
- onSocialLogin?: (providerId: string) => void;
13
- onWalletSelect?: (walletId: string) => void | Promise<void>;
14
- }
15
- export declare const useSignInModalController: ({ wallets, initialVisibleCount, onGoogleLogin, onTwitterLogin, onCubeSignerSession, onWalletConnected, onSocialLogin, onWalletSelect, }: SignInModalControllerOptions) => {
16
- expanded: boolean;
17
- loadingProvider: string | null;
18
- loadingWalletId: string | null;
19
- visibleWallets: WalletItem[];
20
- showExpandToggle: boolean;
21
- isBusy: boolean;
22
- handleSocialClick: (providerId: string) => Promise<WalletSession | null>;
23
- handleWalletClick: (walletId: string) => Promise<WalletSession | null>;
24
- toggleExpanded: () => void;
25
- };
@@ -1,119 +0,0 @@
1
- import { useMemo, useState } from "react";
2
- import { getSDKConfig } from "../auth/config.js";
3
- import { createOidcRelayAuth } from "../auth/oidcRelay.js";
4
- import WalletAccount from "../auth/walletAccount.js";
5
- import { getEnv } from "../utils/env.js";
6
- import { WalletConnector, createDefaultInjectedWalletRegistry, } from "@ab-org/sdk-core";
7
- import { resolveWalletItems } from "./SignInModal.shared.js";
8
- function resolveOidcStage() {
9
- return getEnv("STAGE").toLowerCase() === "prod" ? "prod" : "dev";
10
- }
11
- export const useSignInModalController = ({ wallets, initialVisibleCount, onGoogleLogin, onTwitterLogin, onCubeSignerSession, onWalletConnected, onSocialLogin, onWalletSelect, }) => {
12
- const [expanded, setExpanded] = useState(false);
13
- const [loadingProvider, setLoadingProvider] = useState(null);
14
- const [loadingWalletId, setLoadingWalletId] = useState(null);
15
- const defaultWalletRegistry = useMemo(() => createDefaultInjectedWalletRegistry(), []);
16
- const defaultWalletConnector = useMemo(() => new WalletConnector([
17
- ...defaultWalletRegistry.map((item) => item.provider),
18
- ]), [defaultWalletRegistry]);
19
- const resolvedWallets = useMemo(() => resolveWalletItems(wallets, defaultWalletRegistry), [defaultWalletRegistry, wallets]);
20
- const showExpandToggle = resolvedWallets.length > initialVisibleCount;
21
- const visibleWallets = expanded ? resolvedWallets : resolvedWallets.slice(0, initialVisibleCount);
22
- const isBusy = !!loadingProvider || !!loadingWalletId;
23
- const handleSocialClick = async (providerId) => {
24
- setLoadingProvider(providerId);
25
- try {
26
- const config = getSDKConfig();
27
- if (!config.cubeSigner) {
28
- throw new Error("cubeSigner config is required for social login");
29
- }
30
- const auth = createOidcRelayAuth({
31
- stage: resolveOidcStage(),
32
- googleClientId: config.googleClientId ?? "",
33
- xClientId: config.twitterClientId ?? "",
34
- });
35
- if (providerId === "google") {
36
- if (!config.googleClientId) {
37
- throw new Error("googleClientId is required for Google sign-in");
38
- }
39
- const oidcToken = await auth.loginByGoogle();
40
- const authSource = "google";
41
- WalletAccount.clearInstance();
42
- await WalletAccount.getInstance(oidcToken, authSource, config.cubeSigner);
43
- const session = WalletAccount.getWalletSession();
44
- const cubeSignerSession = WalletAccount.getCubeSignerSession();
45
- onGoogleLogin?.({ idToken: oidcToken });
46
- if (cubeSignerSession)
47
- onCubeSignerSession?.(cubeSignerSession);
48
- onSocialLogin?.(providerId);
49
- if (!session) {
50
- throw new Error("Failed to build wallet session from Google login");
51
- }
52
- return session;
53
- }
54
- if (providerId === "x") {
55
- if (!config.twitterClientId) {
56
- throw new Error("twitterClientId is required for X sign-in");
57
- }
58
- const oidcToken = await auth.loginByX();
59
- const authSource = "twitter";
60
- WalletAccount.clearInstance();
61
- await WalletAccount.getInstance(oidcToken, authSource, config.cubeSigner);
62
- const session = WalletAccount.getWalletSession();
63
- const cubeSignerSession = WalletAccount.getCubeSignerSession();
64
- onTwitterLogin?.({ code: "", codeVerifier: "", state: "" });
65
- if (cubeSignerSession)
66
- onCubeSignerSession?.(cubeSignerSession);
67
- onSocialLogin?.(providerId);
68
- if (!session) {
69
- throw new Error("Failed to build wallet session from X login");
70
- }
71
- return session;
72
- }
73
- throw new Error(`Unsupported social provider: ${providerId}`);
74
- }
75
- finally {
76
- setLoadingProvider(null);
77
- }
78
- };
79
- const handleWalletClick = async (walletId) => {
80
- if (isBusy)
81
- return null;
82
- const targetWallet = resolvedWallets.find((wallet) => wallet.id === walletId);
83
- if (!targetWallet)
84
- return null;
85
- if (targetWallet.installed === false && targetWallet.installUrl)
86
- return null;
87
- setLoadingWalletId(walletId);
88
- try {
89
- if (onWalletSelect) {
90
- await onWalletSelect(walletId);
91
- return null;
92
- }
93
- const builtInWallet = defaultWalletRegistry.find((item) => item.id === walletId);
94
- if (!builtInWallet || !builtInWallet.installed)
95
- return null;
96
- const session = await defaultWalletConnector.connect(walletId);
97
- onWalletConnected?.(session, walletId);
98
- return session;
99
- }
100
- catch (error) {
101
- console.error(`[predicate-market-sdk] Wallet connect failed for ${walletId}:`, error);
102
- throw error;
103
- }
104
- finally {
105
- setLoadingWalletId(null);
106
- }
107
- };
108
- return {
109
- expanded,
110
- loadingProvider,
111
- loadingWalletId,
112
- visibleWallets,
113
- showExpandToggle,
114
- isBusy,
115
- handleSocialClick,
116
- handleWalletClick,
117
- toggleExpanded: () => setExpanded((value) => !value),
118
- };
119
- };
@@ -1 +0,0 @@
1
- export declare function getEnv(key: string): string;
package/dist/utils/env.js DELETED
@@ -1,63 +0,0 @@
1
- function pick(...candidates) {
2
- for (const candidate of candidates) {
3
- if (candidate != null && candidate !== "")
4
- return candidate;
5
- }
6
- return undefined;
7
- }
8
- function nextPublicProcessEnvKey(logicalKey) {
9
- return `NEXT_PUBLIC_${logicalKey}`;
10
- }
11
- function readProcessEnvStatic(key) {
12
- if (typeof process === "undefined" || !process.env)
13
- return undefined;
14
- switch (key) {
15
- case "STAGE":
16
- return pick(process.env.NEXT_PUBLIC_STAGE, process.env.STAGE);
17
- case "GOOGLE_CLIENT_ID":
18
- return pick(process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID, process.env.GOOGLE_CLIENT_ID);
19
- case "X_CLIENT_ID":
20
- return pick(process.env.NEXT_PUBLIC_X_CLIENT_ID, process.env.X_CLIENT_ID);
21
- case "MERCHANT_BASE_URL":
22
- return pick(process.env.NEXT_PUBLIC_MERCHANT_BASE_URL, process.env.MERCHANT_BASE_URL);
23
- case "CUBE_SIGNER_ENV":
24
- return pick(process.env.NEXT_PUBLIC_CUBE_SIGNER_ENV, process.env.CUBE_SIGNER_ENV);
25
- case "CUBE_SIGNER_ORG_ID":
26
- return pick(process.env.NEXT_PUBLIC_CUBE_SIGNER_ORG_ID, process.env.CUBE_SIGNER_ORG_ID);
27
- case "CUBE_REG":
28
- return pick(process.env.NEXT_PUBLIC_CUBE_REG, process.env.CUBE_REG);
29
- case "RELAY_ORIGIN":
30
- return pick(process.env.NEXT_PUBLIC_RELAY_ORIGIN, process.env.RELAY_ORIGIN);
31
- case "FUNDING_TOKEN_SYMBOL":
32
- return pick(process.env.NEXT_PUBLIC_FUNDING_TOKEN_SYMBOL, process.env.FUNDING_TOKEN_SYMBOL) || "USDT";
33
- default:
34
- return undefined;
35
- }
36
- }
37
- export function getEnv(key) {
38
- const staticVal = readProcessEnvStatic(key);
39
- if (staticVal != null && staticVal !== "")
40
- return staticVal;
41
- const globalEnv = globalThis
42
- .process?.env;
43
- if (globalEnv) {
44
- const pub = nextPublicProcessEnvKey(key);
45
- const val = globalEnv[key] ?? globalEnv[pub];
46
- if (val != null && val !== "")
47
- return val;
48
- }
49
- try {
50
- const metaEnv = import.meta.env;
51
- if (metaEnv) {
52
- const pub = nextPublicProcessEnvKey(key);
53
- const val = metaEnv[key] ?? metaEnv[pub];
54
- if (val != null && val !== "")
55
- return val;
56
- }
57
- }
58
- catch {
59
- // Ignore unavailable import.meta.env in some runtimes.
60
- }
61
- console.error(`${key} is not set`);
62
- return "";
63
- }
@@ -1,3 +0,0 @@
1
- export declare function getExplorerUrl(chainId: string, data: {
2
- txId: string;
3
- }): string;
@@ -1,47 +0,0 @@
1
- const explorerTemplates = {
2
- "0": "",
3
- "1": "https://etherscan.io/tx/{txId}",
4
- "3": "https://dogechain.info/tx/{txId}",
5
- "10": "https://optimistic.etherscan.io/tx/{txId}",
6
- "56": "https://bscscan.com/tx/{txId}",
7
- "110": "",
8
- "126": "https://explorer.movementnetwork.xyz/txn/{txId}?network=mainnet",
9
- "137": "https://polygonscan.com/tx/{txId}",
10
- "204": "https://opbnb.bscscan.com/tx/{txId}",
11
- "223": "https://explorer.bsquared.network/tx/{txId}",
12
- "227": "https://promscan.io/tx/{txId}",
13
- "324": "https://mainnet.era.zksync.io/tx/{txId}",
14
- "400": "",
15
- "420": "https://scan.merlinchain.io/tx/{txId}",
16
- "480": "https://worldchain-mainnet.explorer.alchemy.com/tx/{txId}",
17
- "501": "https://solscan.io/tx/{txId}",
18
- "784": "",
19
- "1329": "https://seitrace.com/tx/{txId}",
20
- "1514": "https://mainnet.storyscan.xyz/tx/{txId}",
21
- "1625": "https://explorer.gravity.xyz/tx/{txId}",
22
- "2649": "https://mainnet-explorer.ailayer.xyz/tx/{txId}",
23
- "3030": "https://dashboard.tenderly.co/explorer/vnet/bd8df763-9888-4be3-9a78-26f1d5ab8d3d/tx/{txId}",
24
- "3131": "https://dashboard.tenderly.co/explorer/vnet/6593bc72-f548-497d-bff9-5be061436a48/tx/{txId}",
25
- "5545": "https://scan.duckchain.io/tx/{txId}",
26
- "8333": "https://mainnet-rpc.b3.fun/http/tx/{txId}",
27
- "8453": "https://base.blockscout.com/tx/{txId}",
28
- "19484": "https://tronscan.org/#/transaction/{txId}",
29
- "21000": "https://maizenet-explorer.usecorn.com/tx/{txId}",
30
- "42161": "https://arbiscan.io/tx/{txId}",
31
- "43114": "https://snowtrace.io/tx/{txId}",
32
- "47763": "https://neotube.io/transaction/{txId}",
33
- "59144": "https://lineascan.build/tx/{txId}",
34
- "60808": "https://rpc.gobob.xyz/tx/{txId}",
35
- "80094": "https://berascan.com/tx/{txId}",
36
- "81457": "https://blastscan.io/tx/{txId}",
37
- "200901": "https://rpc.bitlayer.org/tx/{txId}",
38
- "221122420": "https://blockscout.devnet.doge.xyz/tx/{txId}",
39
- "534352": "https://scrollscan.com/tx/{txId}",
40
- };
41
- export function getExplorerUrl(chainId, data) {
42
- const template = explorerTemplates[chainId] ?? "";
43
- if (template === "") {
44
- throw new Error(`chainId ${chainId} tpl not found`);
45
- }
46
- return template.replace("{txId}", data.txId);
47
- }
@@ -1,3 +0,0 @@
1
- export { getEnv } from "./utils/env.js";
2
- export { getExplorerUrl } from "./utils/explorer.js";
3
- export { ClientIds, DEFAULT_FUNDING_TOKEN_ADDRESS, DEFAULT_FUNDING_CHAIN_ID, getFundingTokenAddress, getChainInfo, type EvmChainInfo, } from "./constants/chains.js";
@@ -1,3 +0,0 @@
1
- export { getEnv } from "./utils/env.js";
2
- export { getExplorerUrl } from "./utils/explorer.js";
3
- export { ClientIds, DEFAULT_FUNDING_TOKEN_ADDRESS, DEFAULT_FUNDING_CHAIN_ID, getFundingTokenAddress, getChainInfo, } from "./constants/chains.js";