@flapsdk/vault-runtime 0.1.37 → 0.1.38
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/README.md +13 -2
- package/{chunk-HYBZWS6U.js → chunk-DY34U27M.js} +90 -252
- package/chunk-DY34U27M.js.map +1 -0
- package/{chunk-22KTLOYH.js → chunk-FWYBGHBX.js} +17 -4
- package/chunk-FWYBGHBX.js.map +1 -0
- package/chunk-GY7YY67I.js +78 -0
- package/chunk-GY7YY67I.js.map +1 -0
- package/{chunk-SDCB3RJS.js → chunk-JJJSK6HF.js} +3 -3
- package/{chunk-SDCB3RJS.js.map → chunk-JJJSK6HF.js.map} +1 -1
- package/{chunk-3X2K7YYU.js → chunk-NWBIKFHH.js} +218 -76
- package/chunk-NWBIKFHH.js.map +1 -0
- package/chunk-QS475ZC7.js +583 -0
- package/chunk-QS475ZC7.js.map +1 -0
- package/{chunk-SRZFHGSO.js → chunk-WN4MIMCY.js} +3 -3
- package/{chunk-SRZFHGSO.js.map → chunk-WN4MIMCY.js.map} +1 -1
- package/host-client.d.mts +9 -2
- package/host-client.js +5 -6
- package/host.d.mts +5 -5
- package/host.js +7 -7
- package/{hostRuntimeConfig-DM6JjbeO.d.mts → hostRuntimeConfig-CKjug1-9.d.mts} +1 -1
- package/{mpegts-536UQHCG.js → mpegts-J2J6JTD7.js} +6 -6
- package/{mpegts-536UQHCG.js.map → mpegts-J2J6JTD7.js.map} +1 -1
- package/package.json +4 -3
- package/runtime-contract.json +5 -1
- package/sdk.d.mts +42 -4
- package/sdk.js +41 -9
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/server.js +4 -5
- package/server.js.map +1 -1
- package/{txError-vvvBIsa-.d.mts → txError-BTuW38It.d.mts} +15 -2
- package/{types-cyAEoeXa.d.mts → types-BolUPLIE.d.mts} +101 -2
- package/ui.d.mts +13 -2
- package/ui.js +2 -3
- package/chunk-22KTLOYH.js.map +0 -1
- package/chunk-27VBKY3J.js +0 -36
- package/chunk-27VBKY3J.js.map +0 -1
- package/chunk-3X2K7YYU.js.map +0 -1
- package/chunk-AGLB72HK.js +0 -61
- package/chunk-AGLB72HK.js.map +0 -1
- package/chunk-FUOBTZMQ.js +0 -47
- package/chunk-FUOBTZMQ.js.map +0 -1
- package/chunk-HYBZWS6U.js.map +0 -1
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a1 as OracleReader, $ as OracleProvision, a as Address, A as ActionAvailabilityStage, aa as TokenMarketPhase, n as FlapTokenInfo, ag as VaultHostContext, m as FlapTaxInfo, p as FlapVaultPortalInfo, g as FeeMode, at as VaultRenderSurface, ao as VaultManifest, i as FlapFeeVaultInfo, M as ManifestBindingEntry } from './types-BolUPLIE.mjs';
|
|
2
|
+
|
|
3
|
+
declare const MINI_APP_SLUG_PATTERN: RegExp;
|
|
4
|
+
declare function isMiniAppSlug(value: unknown): value is string;
|
|
5
|
+
declare function isStandaloneMiniApp(manifest: unknown): manifest is {
|
|
6
|
+
schemaVersion: 2;
|
|
7
|
+
mode: "mini-app";
|
|
8
|
+
appModel: "standalone";
|
|
9
|
+
slug: string;
|
|
10
|
+
artifactId: string;
|
|
11
|
+
match: {
|
|
12
|
+
bindings: [];
|
|
13
|
+
};
|
|
14
|
+
};
|
|
2
15
|
|
|
3
16
|
declare const standardErc20Abi: readonly [{
|
|
4
17
|
readonly type: "event";
|
|
@@ -237,4 +250,4 @@ type TxErrorMessageMap = Partial<Record<TxErrorKind, string>>;
|
|
|
237
250
|
declare function getTxErrorKind(error: unknown): TxErrorKind;
|
|
238
251
|
declare function handleTxError(error: unknown, messages?: TxErrorMessageMap): string;
|
|
239
252
|
|
|
240
|
-
export {
|
|
253
|
+
export { parseTokenAmount as A, parseVaultPortalInfo as B, type CreateTaxInfoHostContextInput as C, readTaxVaultHostContext as D, resolveFeeMode as E, resolveManifestBinding as F, resolveTaxInfoRenderSurface as G, resolveTokenMarketPhase as H, resolveVaultBinding as I, shortenAddress as J, standardErc20Abi as K, MINI_APP_SLUG_PATTERN as M, OracleReadError as O, type ResolveRenderSurfaceInput as R, type TaxVaultHostSnapshot as T, type VaultBindingPolicy as V, ZERO_ADDRESS as Z, type RuntimeMatchInput as a, type TxErrorKind as b, buildLocalOracleUrl as c, createLocalOracleReader as d, createTaxInfoHostContext as e, fetchOracleJson as f, fetchProvisionedOracle as g, formatCountdown as h, formatPercentBps as i, formatTokenAmount as j, getTupleField as k, getTxErrorKind as l, handleTxError as m, isActionAvailableForPhase as n, isCustomVaultTaxToken as o, isManifestRuntimeMatch as p, isMiniAppSlug as q, isSameAddress as r, isStandaloneMiniApp as s, isValidAddress as t, isVaultBindingMatch as u, normalizeAddress as v, normalizeOnchainPortalTokenVersion as w, parseFeeVaultInfo as x, parsePortalTokenInfo as y, parseTaxTokenInfo as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbiFunction, Abi, PublicClient } from 'viem';
|
|
1
|
+
import { AbiFunction, TransactionReceipt, Abi, PublicClient } from 'viem';
|
|
2
2
|
|
|
3
3
|
type ResolvedContractCheck = {
|
|
4
4
|
kind: "owner";
|
|
@@ -46,6 +46,98 @@ interface ParsedResolvedContract {
|
|
|
46
46
|
reads: "any" | AbiFunction[];
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
declare const FLAP_WALLET_RUNTIME_VERSION = 1;
|
|
50
|
+
interface FlapSendTransactionRequest {
|
|
51
|
+
to: Address;
|
|
52
|
+
value?: bigint;
|
|
53
|
+
data?: `0x${string}`;
|
|
54
|
+
gas?: bigint;
|
|
55
|
+
gasPrice?: bigint;
|
|
56
|
+
}
|
|
57
|
+
interface FlapTransactionReceipt {
|
|
58
|
+
hash: Address;
|
|
59
|
+
status: "success" | "reverted";
|
|
60
|
+
blockNumber: bigint;
|
|
61
|
+
logs: TransactionReceipt["logs"];
|
|
62
|
+
}
|
|
63
|
+
interface FlapChainSdk {
|
|
64
|
+
context: {
|
|
65
|
+
chainId: number;
|
|
66
|
+
manifest: VaultManifest;
|
|
67
|
+
};
|
|
68
|
+
i18n: FlapI18n;
|
|
69
|
+
notify: FlapNotify;
|
|
70
|
+
wallet: Omit<FlapWallet, "balance">;
|
|
71
|
+
resolveContract(id: string, args: readonly unknown[]): Promise<ResolvedContractHandle>;
|
|
72
|
+
readContract<T = unknown>(request: ContractReadRequest): Promise<T>;
|
|
73
|
+
simulateContract(request: ContractWriteRequest): Promise<SimulateResult>;
|
|
74
|
+
writeContract(request: ContractWriteRequest): Promise<Address>;
|
|
75
|
+
sendTransaction(request: FlapSendTransactionRequest): Promise<Address>;
|
|
76
|
+
waitForTx(hash: Address): Promise<FlapTransactionReceipt>;
|
|
77
|
+
getGasPrice(): Promise<bigint>;
|
|
78
|
+
getBlockNumber(): Promise<bigint>;
|
|
79
|
+
getBalance(address?: Address): Promise<bigint>;
|
|
80
|
+
getContractEvents<T = unknown>(request: ContractEventRequest): Promise<T[]>;
|
|
81
|
+
readIpfsText(cid: string, path?: string): Promise<string>;
|
|
82
|
+
readFsi<T = unknown>(path: string, params?: Record<string, string>): Promise<T>;
|
|
83
|
+
uploadImage(file: Blob, options?: MediaUploadOptions): ReturnType<MediaUploader>;
|
|
84
|
+
uploadText(text: string, options?: MediaUploadOptions): ReturnType<MediaUploader>;
|
|
85
|
+
openExplorerTx(hash: Address): void;
|
|
86
|
+
}
|
|
87
|
+
interface FlapWalletAccount {
|
|
88
|
+
address?: Address;
|
|
89
|
+
chainId?: number;
|
|
90
|
+
isConnected: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Host-only transport: never supplied by uploaded components. */
|
|
93
|
+
interface FlapWalletRuntime {
|
|
94
|
+
chains: readonly {
|
|
95
|
+
id: number;
|
|
96
|
+
name: string;
|
|
97
|
+
explorerBaseUrl?: string;
|
|
98
|
+
}[];
|
|
99
|
+
readOnly?: boolean;
|
|
100
|
+
generation?: string;
|
|
101
|
+
assertActive?(): void;
|
|
102
|
+
getAccount(): FlapWalletAccount;
|
|
103
|
+
connect(): void;
|
|
104
|
+
disconnect(): void;
|
|
105
|
+
switchChain(chainId: number): Promise<void>;
|
|
106
|
+
readContract(chainId: number, request: ContractReadRequest): Promise<unknown>;
|
|
107
|
+
simulateContract(chainId: number, request: ContractWriteRequest & {
|
|
108
|
+
account: Address;
|
|
109
|
+
}): Promise<unknown>;
|
|
110
|
+
writeContract(chainId: number, request: ContractWriteRequest & {
|
|
111
|
+
account: Address;
|
|
112
|
+
}): Promise<Address>;
|
|
113
|
+
sendTransaction(chainId: number, request: FlapSendTransactionRequest & {
|
|
114
|
+
account: Address;
|
|
115
|
+
}): Promise<Address>;
|
|
116
|
+
waitForTx(chainId: number, hash: Address): Promise<FlapTransactionReceipt>;
|
|
117
|
+
getCode(chainId: number, address: Address): Promise<`0x${string}` | undefined>;
|
|
118
|
+
getGasPrice(chainId: number): Promise<bigint>;
|
|
119
|
+
getBlockNumber(chainId: number): Promise<bigint>;
|
|
120
|
+
getBalance(chainId: number, address: Address): Promise<bigint>;
|
|
121
|
+
getContractEvents(chainId: number, request: ContractEventRequest): Promise<unknown[]>;
|
|
122
|
+
upload: MediaUploader;
|
|
123
|
+
openUrl(url: string): void;
|
|
124
|
+
}
|
|
125
|
+
declare function createFlapChainSdk(runtime: FlapWalletRuntime, input: {
|
|
126
|
+
chainId: number;
|
|
127
|
+
manifest: VaultManifest;
|
|
128
|
+
writableChains: readonly number[];
|
|
129
|
+
i18n: FlapI18n;
|
|
130
|
+
notify: FlapNotify;
|
|
131
|
+
readIpfsText?: (cid: string, path?: string) => Promise<string>;
|
|
132
|
+
}): FlapChainSdk;
|
|
133
|
+
|
|
134
|
+
interface AppWalletPermissions { id: string; allow?: string[]; read?: string[]; maxValueWei?: string; approvalSpenders?: Address[]; maxApprovalWei?: string; codeHash?: `0x${string}` }
|
|
135
|
+
interface AppResolvedContract extends AppWalletPermissions { resolver: string }
|
|
136
|
+
interface AppWalletContract extends AppWalletPermissions { chainId: number; address: Address; resolvedContracts?: AppResolvedContract[] }
|
|
137
|
+
interface ParsedAppWalletPermissions { definition: AppWalletPermissions; writes: AbiFunction[]; reads: AbiFunction[] }
|
|
138
|
+
interface ParsedAppWalletContract extends ParsedAppWalletPermissions { definition: AppWalletContract; resolved: (ParsedAppWalletPermissions & { resolver: AbiFunction })[] }
|
|
139
|
+
declare function parseAppWalletContracts(value: unknown): ParsedAppWalletContract[];
|
|
140
|
+
|
|
49
141
|
/** A request for review, never an authorization. No caller-supplied addresses. */
|
|
50
142
|
interface ManifestNftAccountWithdrawal {
|
|
51
143
|
policyId: string;
|
|
@@ -266,6 +358,12 @@ interface VaultManifestDisplayTitle {
|
|
|
266
358
|
en: string;
|
|
267
359
|
}
|
|
268
360
|
interface VaultManifest {
|
|
361
|
+
schemaVersion?: 2;
|
|
362
|
+
appModel?: "standalone";
|
|
363
|
+
slug?: string;
|
|
364
|
+
/** Standalone App networks that may request wallet writes. Omitted means read-only. */
|
|
365
|
+
walletChains?: number[];
|
|
366
|
+
walletContracts?: AppWalletContract[];
|
|
269
367
|
artifactId: string;
|
|
270
368
|
name: string;
|
|
271
369
|
displayTitle?: VaultManifestDisplayTitle;
|
|
@@ -465,6 +563,7 @@ interface MediaUploadRequest extends MediaUploadOptions {
|
|
|
465
563
|
/** Optional host override for the controlled upload service. */
|
|
466
564
|
type MediaUploader = (request: MediaUploadRequest) => Promise<IpfsUploadResult>;
|
|
467
565
|
interface FlapVaultSdk {
|
|
566
|
+
forChain(chainId: number): FlapChainSdk;
|
|
468
567
|
context: VaultRuntimeContext;
|
|
469
568
|
i18n: FlapI18n;
|
|
470
569
|
notify: FlapNotify;
|
|
@@ -511,4 +610,4 @@ interface VaultComponentProps {
|
|
|
511
610
|
context?: VaultRuntimeContext;
|
|
512
611
|
}
|
|
513
612
|
|
|
514
|
-
export type
|
|
613
|
+
export { type OracleProvision as $, type ActionAvailabilityStage as A, type HostRuntimeResult as B, type ContractEventRequest as C, type HostRuntimeSources as D, type EndpointPolicy as E, FLAP_WALLET_RUNTIME_VERSION as F, type HostRuntimeStatus as G, type HostRuntimeAddresses as H, type HostRuntimeWarning as I, type HostTokenPresentation as J, type IpfsUploadResult as K, type ManifestExternalContract as L, type ManifestBindingEntry as M, type ManifestNftAccountWithdrawal as N, type ManifestResolvedContract as O, type MediaUploadOptions as P, type MediaUploadRequest as Q, type MediaUploader as R, type NftAccountWithdrawalPolicy as S, type NftAccountWithdrawalReceipt as T, type NftAccountWithdrawalRequest as U, type NftMetadataAttribute as V, type NftMetadataReadRequest as W, type NftMetadataReader as X, type NftMetadataReaderRequest as Y, type NftMetadataSnapshot as Z, type NftMetadataSource as _, type Address as a, type OracleReadRequest as a0, type OracleReader as a1, type ParsedResolvedContract as a2, type PaymentToken as a3, type ResolvedContractCheck as a4, type ResolvedContractHandle as a5, type ReviewedBeaconPin as a6, type ReviewedContractPin as a7, type RuntimeOracleRegistry as a8, type SimulateResult as a9, type TokenMarketPhase as aa, type TokenMetadataSnapshot as ab, type TokenRuntimeSnapshot as ac, type TxReceipt as ad, type VaultArtifactSurface as ae, type VaultComponentProps as af, type VaultHostContext as ag, type VaultLaunchConfigComponentProps as ah, type VaultLaunchConfigContext as ai, type VaultLaunchConfigResult as aj, type VaultLaunchConfigSummaryItem as ak, type VaultLaunchConfigValues as al, type VaultLaunchSchema as am, type VaultLaunchSchemaField as an, type VaultManifest as ao, type VaultManifestCapability as ap, type VaultManifestDisplayTitle as aq, type VaultManifestLayout as ar, type VaultManifestMode as as, type VaultRenderSurface as at, type VaultRuntimeContext as au, type VaultRuntimeContextOverrides as av, type VaultRuntimeExtraConfig as aw, createFlapChainSdk as ax, parseAppWalletContracts as ay, type AppResolvedContract as b, type AppWalletContract as c, type ContractReadRequest as d, type ContractWriteRequest as e, type CreateVaultRuntimeContextInput as f, type FeeMode as g, type FlapChainSdk as h, type FlapFeeVaultInfo as i, type FlapI18n as j, type FlapNotify as k, type FlapSendTransactionRequest as l, type FlapTaxInfo as m, type FlapTokenInfo as n, type FlapTransactionReceipt as o, type FlapVaultPortalInfo as p, type FlapVaultSdk as q, type FlapWallet as r, type FlapWalletAccount as s, type FlapWalletRuntime as t, type HostRuntimeDataSource as u, type HostRuntimeDegradeReason as v, type HostRuntimeInput as w, type HostRuntimePolicy as x, type HostRuntimePresentationFetcher as y, type HostRuntimePresentationRequest as z };
|
package/ui.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
|
-
import { a as Address } from './types-
|
|
5
|
+
import { a as Address } from './types-BolUPLIE.mjs';
|
|
6
6
|
import 'viem';
|
|
7
7
|
|
|
8
8
|
interface AddressLinkProps {
|
|
@@ -48,6 +48,17 @@ declare function Countdown({ targetTimeMs, fallback }: {
|
|
|
48
48
|
fallback?: string;
|
|
49
49
|
}): React.JSX.Element;
|
|
50
50
|
|
|
51
|
+
interface CopyButtonProps {
|
|
52
|
+
/** Plain text copied exactly as provided, at most 1,048,576 UTF-16 code units (JavaScript string.length). */
|
|
53
|
+
value: string;
|
|
54
|
+
/** Optional localized visible label. Omit for an icon-only button. */
|
|
55
|
+
label?: string;
|
|
56
|
+
disabled?: boolean;
|
|
57
|
+
className?: string;
|
|
58
|
+
}
|
|
59
|
+
/** Shared host-owned copy action for Vault UI and Mini App v2; no wallet/chain required. */
|
|
60
|
+
declare function CopyButton({ value, label, disabled, className }: CopyButtonProps): React.JSX.Element;
|
|
61
|
+
|
|
51
62
|
interface DataRowProps {
|
|
52
63
|
label: ReactNode;
|
|
53
64
|
value: ReactNode;
|
|
@@ -211,4 +222,4 @@ type VideoSessionPlayerProps = VideoClipSessionPlayerProps | (ConsumerVideoSessi
|
|
|
211
222
|
});
|
|
212
223
|
declare function VideoSessionPlayer(props: VideoSessionPlayerProps): React.JSX.Element;
|
|
213
224
|
|
|
214
|
-
export { AddressLink, Alert, BinanceImage, type BinanceImageProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink, type ExternalLinkProps, Input, type InputProps, IpfsBackground, type IpfsBackgroundProps, IpfsImage, type IpfsImageProps, IpfsText, type IpfsTextProps, Metric, NftMetadataImage, type NftMetadataImageProps, ReviewedFrame, type ReviewedFrameProps, type ReviewedFrameProvider, StatusBadge, type StatusTone, TxButton, type TxButtonState, VaultBanner, type VideoClipSessionPlayerProps, type VideoSessionClip, VideoSessionPlayer, type VideoSessionPlayerProps, type VideoSessionState, buttonVariants };
|
|
225
|
+
export { AddressLink, Alert, BinanceImage, type BinanceImageProps, Button, type ButtonProps, Card, CardContent, CardDescription, CardHeader, CardTitle, CopyButton, type CopyButtonProps, Countdown, DataRow, DetailTile, ExternalLink, type ExternalLinkProps, Input, type InputProps, IpfsBackground, type IpfsBackgroundProps, IpfsImage, type IpfsImageProps, IpfsText, type IpfsTextProps, Metric, NftMetadataImage, type NftMetadataImageProps, ReviewedFrame, type ReviewedFrameProps, type ReviewedFrameProvider, StatusBadge, type StatusTone, TxButton, type TxButtonState, VaultBanner, type VideoClipSessionPlayerProps, type VideoSessionClip, VideoSessionPlayer, type VideoSessionPlayerProps, type VideoSessionState, buttonVariants };
|
package/ui.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink, Input, IpfsBackground, IpfsImage, IpfsText, Metric, NftMetadataImage, ReviewedFrame, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, buttonVariants } from './chunk-
|
|
2
|
+
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, CopyButton, Countdown, DataRow, DetailTile, ExternalLink, Input, IpfsBackground, IpfsImage, IpfsText, Metric, NftMetadataImage, ReviewedFrame, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, buttonVariants } from './chunk-NWBIKFHH.js';
|
|
3
3
|
import './chunk-B4WKI3EW.js';
|
|
4
|
-
import './chunk-
|
|
5
|
-
import './chunk-FUOBTZMQ.js';
|
|
4
|
+
import './chunk-GY7YY67I.js';
|
|
6
5
|
import './chunk-BUSYA2B4.js';
|
|
7
6
|
//# sourceMappingURL=ui.js.map
|
|
8
7
|
//# sourceMappingURL=ui.js.map
|
package/chunk-22KTLOYH.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sdk/erc20.ts","../../src/sdk/txError.ts"],"names":[],"mappings":";;;;AAGO,IAAM,gBAAA,GAAmB;;;ACChC,IAAM,eAAA,GAA+C;AAAA,EACnD,YAAA,EAAc,kCAAA;AAAA,EACd,kBAAA,EAAoB,mDAAA;AAAA,EACpB,YAAA,EAAc,0EAAA;AAAA,EACd,iBAAA,EAAmB,2DAAA;AAAA,EACnB,gBAAA,EAAkB,4CAAA;AAAA,EAClB,QAAA,EAAU,yCAAA;AAAA,EACV,OAAA,EAAS;AACX,CAAA;AAEA,SAAS,SAAS,KAAA,EAAkD;AAClE,EAAA,OAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,OAAO,KAAA,KAAU,QAAA;AAC5C;AAEA,SAAS,WAAW,KAAA,EAAgB;AAClC,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,GAAW,KAAA,GAAQ,EAAA;AAC7C;AAEA,SAAS,gBAAgB,KAAA,EAAgB,KAAA,GAAQ,GAAG,IAAA,mBAAO,IAAI,KAAa,EAAa;AACvF,EAAA,IAAI,KAAA,GAAQ,KAAK,KAAA,IAAS,IAAA,IAAQ,KAAK,GAAA,CAAI,KAAK,CAAA,EAAG,OAAO,EAAC;AAC3D,EAAA,IAAA,CAAK,IAAI,KAAK,CAAA;AAEd,EAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,OAAO,CAAC,KAAK,CAAA;AAC5C,EAAA,IAAI,CAAC,QAAA,C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A,CAC3D,KAAK,GAAG,CAAA;AAEX,EAAA,IACE,KAAA,CAAM,QAAA,CAAS,MAAM,CAAA,IACrB,MAAM,QAAA,CAAS,iBAAiB,CAAA,IAChC,KAAA,CAAM,SAAS,0BAA0B,CAAA,IACzC,+FAAA,CAAgG,IAAA,CAAK,OAAO,CAAA,EAC5G;AACA,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,IAAI,qFAAA,CAAsF,IAAA,CAAK,OAAO,CAAA,EAAG;AACvG,IAAA,OAAO,oBAAA;AAAA,EACT;AAEA,EAAA,IAAI,kEAAA,CAAmE,IAAA,CAAK,OAAO,CAAA,EAAG;AACpF,IAAA,OAAO,cAAA;AAAA,EACT;AAEA,EAAA,IAAI,+DAAA,CAAgE,IAAA,CAAK,OAAO,CAAA,EAAG;AACjF,IAAA,OAAO,mBAAA;AAAA,EACT;AAEA,EAAA,IAAI,0EAAA,CAA2E,IAAA,CAAK,OAAO,CAAA,EAAG;AAC5F,IAAA,OAAO,kBAAA;AAAA,EACT;AAEA,EAAA,IAAI,qGAAA,CAAsG,IAAA,CAAK,OAAO,CAAA,EAAG;AACvH,IAAA,OAAO,UAAA;AAAA,EACT;AAEA,EAAA,OAAO,SAAA;AACT;AAEO,SAAS,aAAA,CAAc,OAAgB,QAAA,EAA8B;AAC1E,EAAA,MAAM,IAAA,GAAO,eAAe,KAAK,CAAA;AACjC,EAAA,OAAO,QAAA,GAAW,IAAI,CAAA,IAAK,eAAA,CAAgB,IAAI,CAAA;AACjD","file":"chunk-22KTLOYH.js","sourcesContent":["import { erc20Abi } from \"viem\";\n\nexport { erc20Abi };\nexport const standardErc20Abi = erc20Abi;\n","export type TxErrorKind = \"userRejected\" | \"walletDisconnected\" | \"wrongNetwork\" | \"insufficientFunds\" | \"simulationFailed\" | \"reverted\" | \"unknown\";\n\ntype TxErrorMessageMap = Partial<Record<TxErrorKind, string>>;\n\nconst defaultMessages: Record<TxErrorKind, string> = {\n userRejected: \"You rejected the wallet request.\",\n walletDisconnected: \"Connect a wallet before sending this transaction.\",\n wrongNetwork: \"Switch the wallet to the required chain before sending this transaction.\",\n insufficientFunds: \"Insufficient wallet balance to complete this transaction.\",\n simulationFailed: \"The transaction could not pass simulation.\",\n reverted: \"The contract rejected this transaction.\",\n unknown: \"Transaction failed. Please check your wallet and try again.\",\n};\n\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === \"object\";\n}\n\nfunction readString(value: unknown) {\n return typeof value === \"string\" ? value : \"\";\n}\n\nfunction collectMessages(error: unknown, depth = 0, seen = new Set<unknown>()): string[] {\n if (depth > 4 || error == null || seen.has(error)) return [];\n seen.add(error);\n\n if (typeof error === \"string\") return [error];\n if (!isObject(error)) return [];\n\n const messages = [\n readString(error.shortMessage),\n readString(error.message),\n readString(error.details),\n readString(error.reason),\n ].filter(Boolean);\n\n return [...messages, ...collectMessages(error.cause, depth + 1, seen)];\n}\n\nfunction collectCodes(error: unknown, depth = 0, seen = new Set<unknown>()): Array<string | number> {\n if (depth > 4 || error == null || seen.has(error)) return [];\n seen.add(error);\n if (!isObject(error)) return [];\n\n const codes = [error.code, error.name].filter((value) => typeof value === \"string\" || typeof value === \"number\");\n return [...codes, ...collectCodes(error.cause, depth + 1, seen)];\n}\n\nexport function getTxErrorKind(error: unknown): TxErrorKind {\n const message = collectMessages(error).join(\" \").toLowerCase();\n const codes = collectCodes(error)\n .map((value: string | number) => String(value).toLowerCase())\n .join(\" \");\n\n if (\n codes.includes(\"4001\") ||\n codes.includes(\"action_rejected\") ||\n codes.includes(\"userrejectedrequesterror\") ||\n /user rejected|user denied|rejected the request|denied transaction|request rejected|cancelled/i.test(message)\n ) {\n return \"userRejected\";\n }\n\n if (/wallet is not connected|connector not connected|account not found|no wallet client/i.test(message)) {\n return \"walletDisconnected\";\n }\n\n if (/wrong network|switch wallet to|switch network to|required chain/i.test(message)) {\n return \"wrongNetwork\";\n }\n\n if (/insufficient funds|exceeds the balance|gas \\* price \\+ value/i.test(message)) {\n return \"insufficientFunds\";\n }\n\n if (/simulation failed|simulatecontract|execution reverted during simulation/i.test(message)) {\n return \"simulationFailed\";\n }\n\n if (/execution reverted|reverted with the following reason|contract function .* reverted|call exception/i.test(message)) {\n return \"reverted\";\n }\n\n return \"unknown\";\n}\n\nexport function handleTxError(error: unknown, messages?: TxErrorMessageMap) {\n const kind = getTxErrorKind(error);\n return messages?.[kind] ?? defaultMessages[kind];\n}\n"]}
|
package/chunk-27VBKY3J.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { getTaxVaultHostChainConfig } from './chunk-FUOBTZMQ.js';
|
|
2
|
-
|
|
3
|
-
// src/sdk/ipfsImage.ts
|
|
4
|
-
var DEFAULT_IPFS_IMAGE_GATEWAY = "https://flap.mypinata.cloud";
|
|
5
|
-
var IPFS_IMAGE_GATEWAYS = ["https://flap.mypinata.cloud", "https://magenta-naval-penguin-822.mypinata.cloud"];
|
|
6
|
-
var CID_RE = /^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/;
|
|
7
|
-
var PATH_SEGMENT_RE = /^[A-Za-z0-9._~-]+$/;
|
|
8
|
-
function isIpfsImageCid(value) {
|
|
9
|
-
return typeof value === "string" && value.length <= 128 && CID_RE.test(value.trim());
|
|
10
|
-
}
|
|
11
|
-
function normalizeIpfsImagePath(value) {
|
|
12
|
-
if (value === void 0) return "";
|
|
13
|
-
if (typeof value !== "string") return void 0;
|
|
14
|
-
const trimmed = value.trim();
|
|
15
|
-
if (!trimmed || trimmed.length > 512 || trimmed.startsWith("/") || trimmed.endsWith("/")) return void 0;
|
|
16
|
-
const segments = trimmed.split("/");
|
|
17
|
-
if (segments.some((segment) => !segment || segment === "." || segment === ".." || !PATH_SEGMENT_RE.test(segment))) return void 0;
|
|
18
|
-
return segments.join("/");
|
|
19
|
-
}
|
|
20
|
-
function resolveIpfsImageUrl(cid, chainId = 56, path) {
|
|
21
|
-
const normalizedPath = normalizeIpfsImagePath(path);
|
|
22
|
-
if (!isIpfsImageCid(cid) || normalizedPath === void 0) return void 0;
|
|
23
|
-
const gateway = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\/+$/, "");
|
|
24
|
-
return `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : ""}`;
|
|
25
|
-
}
|
|
26
|
-
function resolveIpfsImageUrls(cid, chainId = 56, path) {
|
|
27
|
-
const normalizedPath = normalizeIpfsImagePath(path);
|
|
28
|
-
if (!isIpfsImageCid(cid) || normalizedPath === void 0) return [];
|
|
29
|
-
const preferred = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\/+$/, "");
|
|
30
|
-
const gateways = [preferred, ...IPFS_IMAGE_GATEWAYS.map((gateway) => gateway.replace(/\/+$/, ""))];
|
|
31
|
-
return [...new Set(gateways)].map((gateway) => `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : ""}`);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { isIpfsImageCid, normalizeIpfsImagePath, resolveIpfsImageUrl, resolveIpfsImageUrls };
|
|
35
|
-
//# sourceMappingURL=chunk-27VBKY3J.js.map
|
|
36
|
-
//# sourceMappingURL=chunk-27VBKY3J.js.map
|
package/chunk-27VBKY3J.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sdk/ipfsImage.ts"],"names":[],"mappings":";;;AAEA,IAAM,0BAAA,GAA6B,6BAAA;AACnC,IAAM,mBAAA,GAAsB,CAAC,6BAAA,EAA+B,kDAAkD,CAAA;AAC9G,IAAM,MAAA,GAAS,iDAAA;AACf,IAAM,eAAA,GAAkB,oBAAA;AAEjB,SAAS,eAAe,KAAA,EAAe;AAC5C,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,CAAM,MAAA,IAAU,OAAO,MAAA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AAqB,GAAA,EAAa,OAAA,GAAU,EAAA,EAAI,IAAA,EAAe;AAC7E,EAAA,MAAM,cAAA,GAAiB,uBAAuB,IAAI,CAAA;AAClD,EAAA,IAAI,CAAC,cAAA,CAAe,GAAG,KAAK,cAAA,KAAmB,MAAA,SAAkB,EAAC;AAClE,EAAA,MAAM,SAAA,GAAA,CAAa,2BAA2B,OAAO,CAAA,EAAG,eAAe,0BAAA,EAA4B,OAAA,CAAQ,QAAQ,EAAE,CAAA;AACrH,EAAA,MAAM,QAAA,GAAW,CAAC,SAAA,EAAW,GAAG,mBAAA,CAAoB,GAAA,CAAI,CAAC,OAAA,KAAY,OAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAC,CAAA;AACjG,EAAA,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,QAAQ,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,OAAA,KAAY,CAAA,EAAG,OAAO,CAAA,MAAA,EAAS,GAAA,CAAI,MAAM,CAAA,EAAG,iBAAiB,CAAA,CAAA,EAAI,cAAc,CAAA,CAAA,GAAK,EAAE,CAAA,CAAE,CAAA;AAC7H","file":"chunk-27VBKY3J.js","sourcesContent":["import { getTaxVaultHostChainConfig } from \"./hostRuntimeConfig\";\n\nconst DEFAULT_IPFS_IMAGE_GATEWAY = \"https://flap.mypinata.cloud\";\nconst IPFS_IMAGE_GATEWAYS = [\"https://flap.mypinata.cloud\", \"https://magenta-naval-penguin-822.mypinata.cloud\"] as const;\nconst CID_RE = /^(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|b[a-z2-7]{20,})$/;\nconst PATH_SEGMENT_RE = /^[A-Za-z0-9._~-]+$/;\n\nexport function isIpfsImageCid(value: string) {\n return typeof value === \"string\" && value.length <= 128 && CID_RE.test(value.trim());\n}\n\nexport function normalizeIpfsImagePath(value: string | undefined) {\n if (value === undefined) return \"\";\n if (typeof value !== \"string\") return undefined;\n const trimmed = value.trim();\n if (!trimmed || trimmed.length > 512 || trimmed.startsWith(\"/\") || trimmed.endsWith(\"/\")) return undefined;\n const segments = trimmed.split(\"/\");\n if (segments.some((segment) => !segment || segment === \".\" || segment === \"..\" || !PATH_SEGMENT_RE.test(segment))) return undefined;\n return segments.join(\"/\");\n}\n\nexport function resolveIpfsImageUrl(cid: string, chainId = 56, path?: string) {\n const normalizedPath = normalizeIpfsImagePath(path);\n if (!isIpfsImageCid(cid) || normalizedPath === undefined) return undefined;\n const gateway = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\\/+$/, \"\");\n return `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : \"\"}`;\n}\n\nexport function resolveIpfsImageUrls(cid: string, chainId = 56, path?: string) {\n const normalizedPath = normalizeIpfsImagePath(path);\n if (!isIpfsImageCid(cid) || normalizedPath === undefined) return [];\n const preferred = (getTaxVaultHostChainConfig(chainId)?.ipfsGateway ?? DEFAULT_IPFS_IMAGE_GATEWAY).replace(/\\/+$/, \"\");\n const gateways = [preferred, ...IPFS_IMAGE_GATEWAYS.map((gateway) => gateway.replace(/\\/+$/, \"\"))];\n return [...new Set(gateways)].map((gateway) => `${gateway}/ipfs/${cid.trim()}${normalizedPath ? `/${normalizedPath}` : \"\"}`);\n}\n"]}
|