@flapsdk/vault-runtime 0.1.36 → 0.1.38-next.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/{chunk-QLVWFL4T.js → chunk-44P2NRRZ.js} +96 -152
- package/chunk-44P2NRRZ.js.map +1 -0
- package/chunk-A3ER7XYN.js +408 -0
- package/chunk-A3ER7XYN.js.map +1 -0
- package/{chunk-22KTLOYH.js → chunk-FWYBGHBX.js} +17 -4
- package/chunk-FWYBGHBX.js.map +1 -0
- package/{chunk-IN34R3DY.js → chunk-JVOFLTLD.js} +207 -72
- package/chunk-JVOFLTLD.js.map +1 -0
- package/host-client.d.mts +9 -2
- package/host-client.js +3 -3
- package/host.d.mts +5 -5
- package/host.js +4 -4
- package/{hostRuntimeConfig-DAz-f577.d.mts → hostRuntimeConfig-DibvcxHE.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 +40 -4
- package/sdk.js +38 -6
- package/sdk.js.map +1 -1
- package/server.d.mts +3 -3
- package/{txError-DmiNOh9R.d.mts → txError-OBuRV8xN.d.mts} +15 -2
- package/{types-BbjEsfiD.d.mts → types-DUZWZ3mC.d.mts} +98 -4
- package/ui.d.mts +13 -2
- package/ui.js +1 -1
- package/chunk-22KTLOYH.js.map +0 -1
- package/chunk-AGLB72HK.js +0 -61
- package/chunk-AGLB72HK.js.map +0 -1
- package/chunk-IN34R3DY.js.map +0 -1
- package/chunk-QLVWFL4T.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flapsdk/vault-runtime",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.38-next.0",
|
|
4
|
+
"gitHead": "7cc5b3c462a889574186d4320da0618519c1c8c9",
|
|
5
5
|
"description": "Shared runtime surface for Flap Vault UI hosts, Workbench preview, and custom Vault components.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"@rainbow-me/rainbowkit": "^2.1.7"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|
|
48
|
-
"access": "public"
|
|
48
|
+
"access": "public",
|
|
49
|
+
"tag": "next"
|
|
49
50
|
}
|
|
50
51
|
}
|
package/runtime-contract.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"runtimeContractVersion": 1,
|
|
3
|
+
"uiFeatures": {
|
|
4
|
+
"copyButton": 1
|
|
5
|
+
},
|
|
3
6
|
"sdkFeatures": {
|
|
7
|
+
"flapWallet": 1,
|
|
4
8
|
"nftAccountWithdrawal": 1,
|
|
5
9
|
"resolvedContracts": 1,
|
|
6
10
|
"strictContractTargets": 1,
|
|
7
11
|
"hostOnlyProvider": 1
|
|
8
12
|
},
|
|
9
13
|
"packageName": "@flapsdk/vault-runtime",
|
|
10
|
-
"packageVersion": "0.1.
|
|
14
|
+
"packageVersion": "0.1.38-next.0",
|
|
11
15
|
"stableAuthoringAliases": [
|
|
12
16
|
"@/src/sdk",
|
|
13
17
|
"@/src/ui"
|
package/sdk.d.mts
CHANGED
|
@@ -1,8 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ActionAvailabilityStage, C as ContractEventRequest,
|
|
3
|
-
export { O as OracleReadError, Z as ZERO_ADDRESS, c as buildLocalOracleUrl, d as createLocalOracleReader, f as fetchOracleJson, g as fetchProvisionedOracle, h as formatCountdown, i as formatPercentBps, j as formatTokenAmount, l as getTxErrorKind, m as handleTxError, n as isActionAvailableForPhase, o as isCustomVaultTaxToken,
|
|
1
|
+
import { ao as VaultManifest, a as Address, j as FlapI18n, k as FlapNotify, t as FlapWalletRuntime, h as FlapChainSdk, am as VaultLaunchSchema, aj as VaultLaunchConfigResult, K as IpfsUploadResult, R as MediaUploader, Q as MediaUploadRequest, X as NftMetadataReader, V as NftMetadataAttribute, q as FlapVaultSdk, au as VaultRuntimeContext, r as FlapWallet } from './types-DUZWZ3mC.mjs';
|
|
2
|
+
export { A as ActionAvailabilityStage, b as AppResolvedContract, c as AppWalletContract, C as ContractEventRequest, d as ContractReadRequest, e as ContractWriteRequest, F as FLAP_WALLET_RUNTIME_VERSION, g as FeeMode, i as FlapFeeVaultInfo, l as FlapSendTransactionRequest, m as FlapTaxInfo, n as FlapTokenInfo, o as FlapTransactionReceipt, p as FlapVaultPortalInfo, M as ManifestBindingEntry, N as ManifestNftAccountWithdrawal, O as ManifestResolvedContract, P as MediaUploadOptions, S as NftAccountWithdrawalPolicy, T as NftAccountWithdrawalReceipt, U as NftAccountWithdrawalRequest, W as NftMetadataReadRequest, Y as NftMetadataReaderRequest, Z as NftMetadataSnapshot, _ as NftMetadataSource, $ as OracleProvision, a0 as OracleReadRequest, a1 as OracleReader, a3 as PaymentToken, a4 as ResolvedContractCheck, a5 as ResolvedContractHandle, a6 as ReviewedBeaconPin, a7 as ReviewedContractPin, a8 as RuntimeOracleRegistry, a9 as SimulateResult, aa as TokenMarketPhase, ad as TxReceipt, ae as VaultArtifactSurface, af as VaultComponentProps, ag as VaultHostContext, ah as VaultLaunchConfigComponentProps, ai as VaultLaunchConfigContext, ak as VaultLaunchConfigSummaryItem, al as VaultLaunchConfigValues, an as VaultLaunchSchemaField, at as VaultRenderSurface, av as VaultRuntimeContextOverrides, aw as VaultRuntimeExtraConfig } from './types-DUZWZ3mC.mjs';
|
|
3
|
+
export { M as MINI_APP_SLUG_PATTERN, O as OracleReadError, Z as ZERO_ADDRESS, c as buildLocalOracleUrl, d as createLocalOracleReader, f as fetchOracleJson, g as fetchProvisionedOracle, h as formatCountdown, i as formatPercentBps, j as formatTokenAmount, l as getTxErrorKind, m as handleTxError, n as isActionAvailableForPhase, o as isCustomVaultTaxToken, q as isMiniAppSlug, s as isStandaloneMiniApp, t as isValidAddress, A as parseTokenAmount, D as readTaxVaultHostContext, H as resolveTokenMarketPhase, J as shortenAddress, K as standardErc20Abi } from './txError-OBuRV8xN.mjs';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
4
6
|
export { erc20Abi } from 'viem';
|
|
5
7
|
|
|
8
|
+
interface MiniAppSession {
|
|
9
|
+
address?: Address;
|
|
10
|
+
isConnected: boolean;
|
|
11
|
+
isAuthenticated: boolean;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
connect(): void;
|
|
14
|
+
/** Uses the host's existing session; only prompts for a signature when needed. */
|
|
15
|
+
signIn(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
interface MiniAppSdk {
|
|
18
|
+
context: {
|
|
19
|
+
appId: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
manifest: VaultManifest;
|
|
22
|
+
};
|
|
23
|
+
session: MiniAppSession;
|
|
24
|
+
i18n: FlapI18n;
|
|
25
|
+
notify: FlapNotify;
|
|
26
|
+
forChain(chainId: number): FlapChainSdk;
|
|
27
|
+
}
|
|
28
|
+
declare function MiniAppRuntimeProvider({ manifest, session, i18n, notify, runtime, children }: {
|
|
29
|
+
manifest: VaultManifest;
|
|
30
|
+
session: MiniAppSession;
|
|
31
|
+
i18n: FlapI18n;
|
|
32
|
+
notify: FlapNotify;
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
runtime?: FlapWalletRuntime;
|
|
35
|
+
}): React.JSX.Element;
|
|
36
|
+
declare function useMiniAppSdk(): MiniAppSdk;
|
|
37
|
+
|
|
6
38
|
declare function isIpfsImageCid(value: string): boolean;
|
|
7
39
|
declare function normalizeIpfsImagePath(value: string | undefined): string | undefined;
|
|
8
40
|
declare function resolveIpfsImageUrl(cid: string, chainId?: number, path?: string): string | undefined;
|
|
@@ -140,7 +172,11 @@ declare function readVideoSessionSlice(sdk: VideoSdk, consumer: Address, start:
|
|
|
140
172
|
/** Uses the host's shared chain client; callers cannot supply a provider or RPC. */
|
|
141
173
|
declare function createConsumerVideoSessionReader(sdk: VideoSdk, consumer: Address): ConsumerVideoSessionReader;
|
|
142
174
|
|
|
175
|
+
/** Existing Vault calls keep their token context. Independent Apps select a chain. */
|
|
143
176
|
declare function useFlapSdk(): FlapVaultSdk;
|
|
177
|
+
declare function useFlapSdk(options: {
|
|
178
|
+
chainId: number;
|
|
179
|
+
}): FlapChainSdk;
|
|
144
180
|
declare function useVaultContext(): VaultRuntimeContext;
|
|
145
181
|
declare function useFlapI18n(): FlapI18n;
|
|
146
182
|
declare function useFlapNotify(): FlapNotify;
|
|
@@ -152,4 +188,4 @@ declare const NFT_ACCOUNT_WITHDRAWAL_VERSION = 1;
|
|
|
152
188
|
|
|
153
189
|
declare const RESOLVED_CONTRACTS_VERSION = 1;
|
|
154
190
|
|
|
155
|
-
export { Address, type ConsumerVideoClip, type ConsumerVideoSessionReader, FlapI18n, FlapNotify, FlapVaultSdk, FlapWallet, IMAGE_UPLOAD_MEDIA_TYPES, IpfsUploadResult, type LocalNftMetadataReaderOptions, MAX_IMAGE_UPLOAD_BYTES, MAX_TEXT_UPLOAD_BYTES, MediaUploadError, MediaUploadRequest, MediaUploader, type MiniApp3DDecoderUrls, NFT_ACCOUNT_WITHDRAWAL_VERSION, NftMetadataAttribute, NftMetadataReader, RESOLVED_CONTRACTS_VERSION, RUNTIME_UPLOAD_ENDPOINT, VAULT_LAUNCH_SCHEMA_ABI, VaultLaunchConfigResult, VaultLaunchSchema, VaultRuntimeContext, VideoSessionReadError, createConsumerVideoSessionReader, createIpfsUploadResult, createLocalMediaUploader, createLocalNftMetadataReader, isIpfsImageCid, isVaultLaunchConfigResultForSchema, nftTokenUriAbi, normalizeInlineNftImage, normalizeIpfsImagePath, parseInlineNftMetadata, parseVaultLaunchSchema, readVideoSessionLength, readVideoSessionSlice, resolveIpfsImageUrl, resolveIpfsImageUrls, resolveMiniApp3DAssetUrl, resolveMiniApp3DDecoderUrls, sanitizeNftMetadataRecord, useVaultContext as useFlapChain, useFlapI18n, useFlapNotify, useFlapSdk, useFlapWallet, useVaultContext, validateMediaUpload, vaultV2NftAbi };
|
|
191
|
+
export { Address, type ConsumerVideoClip, type ConsumerVideoSessionReader, FlapChainSdk, FlapI18n, FlapNotify, FlapVaultSdk, FlapWallet, IMAGE_UPLOAD_MEDIA_TYPES, IpfsUploadResult, type LocalNftMetadataReaderOptions, MAX_IMAGE_UPLOAD_BYTES, MAX_TEXT_UPLOAD_BYTES, MediaUploadError, MediaUploadRequest, MediaUploader, type MiniApp3DDecoderUrls, MiniAppRuntimeProvider, type MiniAppSdk, type MiniAppSession, NFT_ACCOUNT_WITHDRAWAL_VERSION, NftMetadataAttribute, NftMetadataReader, RESOLVED_CONTRACTS_VERSION, RUNTIME_UPLOAD_ENDPOINT, VAULT_LAUNCH_SCHEMA_ABI, VaultLaunchConfigResult, VaultLaunchSchema, VaultManifest, VaultRuntimeContext, VideoSessionReadError, createConsumerVideoSessionReader, createIpfsUploadResult, createLocalMediaUploader, createLocalNftMetadataReader, isIpfsImageCid, isVaultLaunchConfigResultForSchema, nftTokenUriAbi, normalizeInlineNftImage, normalizeIpfsImagePath, parseInlineNftMetadata, parseVaultLaunchSchema, readVideoSessionLength, readVideoSessionSlice, resolveIpfsImageUrl, resolveIpfsImageUrls, resolveMiniApp3DAssetUrl, resolveMiniApp3DDecoderUrls, sanitizeNftMetadataRecord, useVaultContext as useFlapChain, useFlapI18n, useFlapNotify, useFlapSdk, useFlapWallet, useMiniAppSdk, useVaultContext, validateMediaUpload, vaultV2NftAbi };
|
package/sdk.js
CHANGED
|
@@ -1,15 +1,47 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import './chunk-
|
|
2
|
+
import { isStandaloneMiniApp } from './chunk-FWYBGHBX.js';
|
|
3
|
+
export { MINI_APP_SLUG_PATTERN, erc20Abi, getTxErrorKind, handleTxError, isMiniAppSlug, isStandaloneMiniApp, standardErc20Abi } from './chunk-FWYBGHBX.js';
|
|
4
|
+
import './chunk-44P2NRRZ.js';
|
|
5
|
+
import { createFlapChainSdk } from './chunk-A3ER7XYN.js';
|
|
6
|
+
export { FLAP_WALLET_RUNTIME_VERSION } from './chunk-A3ER7XYN.js';
|
|
5
7
|
export { IMAGE_UPLOAD_MEDIA_TYPES, MAX_IMAGE_UPLOAD_BYTES, MAX_TEXT_UPLOAD_BYTES, MediaUploadError, RUNTIME_UPLOAD_ENDPOINT, createIpfsUploadResult, createLocalMediaUploader, createLocalNftMetadataReader, nftTokenUriAbi, normalizeInlineNftImage, parseInlineNftMetadata, sanitizeNftMetadataRecord, validateMediaUpload, vaultV2NftAbi } from './chunk-PU7VEZWA.js';
|
|
6
8
|
export { OracleReadError, buildLocalOracleUrl, createLocalOracleReader, fetchOracleJson, fetchProvisionedOracle } from './chunk-JLI25XFB.js';
|
|
7
|
-
import { useFlapSdk } from './chunk-
|
|
8
|
-
export { VideoSessionReadError, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useVaultContext as useFlapChain, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext } from './chunk-
|
|
9
|
+
import { MiniAppContext, useFlapSdk } from './chunk-JVOFLTLD.js';
|
|
10
|
+
export { VideoSessionReadError, createConsumerVideoSessionReader, readVideoSessionLength, readVideoSessionSlice, useVaultContext as useFlapChain, useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext } from './chunk-JVOFLTLD.js';
|
|
9
11
|
export { ZERO_ADDRESS, formatCountdown, formatPercentBps, formatTokenAmount, isActionAvailableForPhase, isCustomVaultTaxToken, isValidAddress, parseTokenAmount, readTaxVaultHostContext, resolveTokenMarketPhase, shortenAddress } from './chunk-B4WKI3EW.js';
|
|
10
12
|
export { isIpfsImageCid, normalizeIpfsImagePath, resolveIpfsImageUrl, resolveIpfsImageUrls } from './chunk-SAG36LUR.js';
|
|
11
13
|
import './chunk-FUOBTZMQ.js';
|
|
12
14
|
import './chunk-BUSYA2B4.js';
|
|
15
|
+
import { useRef, useMemo, useContext } from 'react';
|
|
16
|
+
import { jsx } from 'react/jsx-runtime';
|
|
17
|
+
|
|
18
|
+
function MiniAppRuntimeProvider({ manifest, session, i18n, notify, runtime, children }) {
|
|
19
|
+
const current = useRef({ manifest, runtime });
|
|
20
|
+
current.current = { manifest, runtime };
|
|
21
|
+
const sdk = useMemo(() => {
|
|
22
|
+
const writableChains = [...manifest.walletChains ?? []];
|
|
23
|
+
const chainSdks = /* @__PURE__ */ new Map();
|
|
24
|
+
return { context: { appId: manifest.artifactId, slug: manifest.slug, manifest: structuredClone(manifest) }, session, i18n, notify, forChain: (chainId) => {
|
|
25
|
+
if (!runtime) throw new Error("This host has not enabled wallet operations for Apps.");
|
|
26
|
+
let chainSdk = chainSdks.get(chainId);
|
|
27
|
+
if (!chainSdk) {
|
|
28
|
+
chainSdk = createFlapChainSdk({ ...runtime, assertActive: () => {
|
|
29
|
+
if (current.current.manifest !== manifest || current.current.runtime !== runtime) throw new Error("The host wallet or App context changed. Review the transaction again.");
|
|
30
|
+
runtime.assertActive?.();
|
|
31
|
+
} }, { chainId, manifest, writableChains, i18n, notify });
|
|
32
|
+
chainSdks.set(chainId, chainSdk);
|
|
33
|
+
}
|
|
34
|
+
return chainSdk;
|
|
35
|
+
} };
|
|
36
|
+
}, [manifest, runtime, session, i18n, notify]);
|
|
37
|
+
if (!isStandaloneMiniApp(manifest)) throw new Error("A standalone Mini App v2 manifest is required.");
|
|
38
|
+
return /* @__PURE__ */ jsx(MiniAppContext.Provider, { value: sdk, children });
|
|
39
|
+
}
|
|
40
|
+
function useMiniAppSdk() {
|
|
41
|
+
const sdk = useContext(MiniAppContext);
|
|
42
|
+
if (!sdk) throw new Error("useMiniAppSdk requires MiniAppRuntimeProvider.");
|
|
43
|
+
return sdk;
|
|
44
|
+
}
|
|
13
45
|
|
|
14
46
|
// src/sdk/launchConfig.ts
|
|
15
47
|
var VAULT_LAUNCH_SCHEMA_ABI = [{
|
|
@@ -90,6 +122,6 @@ function useFlapWallet() {
|
|
|
90
122
|
var NFT_ACCOUNT_WITHDRAWAL_VERSION = 1;
|
|
91
123
|
var RESOLVED_CONTRACTS_VERSION = 1;
|
|
92
124
|
|
|
93
|
-
export { NFT_ACCOUNT_WITHDRAWAL_VERSION, RESOLVED_CONTRACTS_VERSION, VAULT_LAUNCH_SCHEMA_ABI, isVaultLaunchConfigResultForSchema, parseVaultLaunchSchema, resolveMiniApp3DAssetUrl, resolveMiniApp3DDecoderUrls, useFlapWallet };
|
|
125
|
+
export { MiniAppRuntimeProvider, NFT_ACCOUNT_WITHDRAWAL_VERSION, RESOLVED_CONTRACTS_VERSION, VAULT_LAUNCH_SCHEMA_ABI, isVaultLaunchConfigResultForSchema, parseVaultLaunchSchema, resolveMiniApp3DAssetUrl, resolveMiniApp3DDecoderUrls, useFlapWallet, useMiniAppSdk };
|
|
94
126
|
//# sourceMappingURL=sdk.js.map
|
|
95
127
|
//# sourceMappingURL=sdk.js.map
|
package/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sdk/launchConfig.ts","../../src/sdk/three.ts","../../src/sdk/useFlapWallet.ts","../../src/sdk/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAGO,IAAM,0BAA0B,CAAC;AAAA,EACtC,IAAA,EAAM,UAAA;AAAA,EACN,IAAA,EAAM,iBAAA;AAAA,EACN,eAAA,EAAiB,MAAA;AAAA,EACjB,QAAQ,EAAC;AAAA,EACT,SAAS,CAAC;AAAA,IACR,IAAA,EAAM,QAAA;AAAA,IACN,IAAA,EAAM,OAAA;AAAA,IACN,UAAA,EAAY;AAAA,MACV,EAAE,IAAA,EAAM,aAAA,EAAe,IAAA,EAAM,QAAA,EAAS;AAAA,MACtC,EAAE,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,WAAW,UAAA,EAAY;AAAA,QAC7C,EAAE,IAAA,EAAM,MAAA,EAAQ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A,CAAM,CAAA,EAAG,eAAe,QAAA,CAAS,WAAA,CAAY,GAAG,CAAA,GAAI,CAAC,CAAA;AACrG,EAAA,IAAI,KAAA,CAAM,MAAA,KAAW,cAAA,CAAe,MAAA,IAAU,CAAC,KAAA,CAAM,QAAA,CAAS,UAAA,CAAW,CAAA,EAAG,eAAe,CAAA,OAAA,CAAS,CAAA,EAAG;AACrG,IAAA,MAAM,IAAI,MAAM,6EAA6E,CAAA;AAAA,EAC/F;AACA,EAAA,OAAO,KAAA,CAAM,IAAA;AACf;AAGO,SAAS,wBAAA,CAAyB,UAAkB,SAAA,EAAmB;AAC5E,EAAA,OAAO,sBAAA,CAAuB,UAAU,SAAS,CAAA;AACnD;AAGO,SAAS,2BAAA,CAA4B,MAA4B,SAAA,EAAyC;AAC/G,EAAA,OAAO;AAAA,IACL,GAAI,IAAA,CAAK,KAAA,GAAQ,EAAE,KAAA,EAAO,sBAAA,CAAuB,IAAA,CAAK,KAAA,EAAO,SAAS,CAAA,EAAE,GAAI,EAAC;AAAA,IAC7E,GAAI,IAAA,CAAK,IAAA,GAAO,EAAE,IAAA,EAAM,sBAAA,CAAuB,IAAA,CAAK,IAAA,EAAM,SAAS,CAAA,EAAE,GAAI;AAAC,GAC5E;AACF;;;ACxBO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,YAAW,CAAE,MAAA;AACtB;;;ACmEO,IAAM,8BAAA,GAAiC;AAGvC,IAAM,0BAAA,GAA6B","file":"sdk.js","sourcesContent":["import type { VaultLaunchConfigResult, VaultLaunchSchema } from \"./types\";\n\n/** Public IVaultSchemasV1 interface. Reading and encoding belong to the host, not the form. */\nexport const VAULT_LAUNCH_SCHEMA_ABI = [{\n type: \"function\",\n name: \"vaultDataSchema\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{\n name: \"schema\",\n type: \"tuple\",\n components: [\n { name: \"description\", type: \"string\" },\n { name: \"fields\", type: \"tuple[]\", components: [\n { name: \"name\", type: \"string\" },\n { name: \"fieldType\", type: \"string\" },\n { name: \"description\", type: \"string\" },\n { name: \"decimals\", type: \"uint8\" },\n ] },\n { name: \"isArray\", type: \"bool\" },\n ],\n }],\n}] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n/** Normalize decoded chain data and fail closed on malformed/ambiguous field definitions. */\nexport function parseVaultLaunchSchema(value: unknown): VaultLaunchSchema {\n if (!isRecord(value) || typeof value.isArray !== \"boolean\" || typeof value.description !== \"string\"\n || !Array.isArray(value.fields) || value.fields.length > 100) {\n throw new Error(\"Invalid vault launch schema.\");\n }\n const names = new Set<string>();\n const fields = value.fields.map((field: unknown) => {\n if (!isRecord(field) || typeof field.name !== \"string\" || !/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(field.name)\n || names.has(field.name) || [\"__proto__\", \"constructor\", \"prototype\"].includes(field.name)\n || typeof field.fieldType !== \"string\" || !field.fieldType.trim() || field.fieldType.length > 100\n || typeof field.description !== \"string\" || !Number.isInteger(field.decimals)\n || (field.decimals as number) < 0 || (field.decimals as number) > 255) {\n throw new Error(\"Invalid vault launch schema field.\");\n }\n names.add(field.name);\n return { name: field.name, fieldType: field.fieldType, description: field.description, decimals: field.decimals as number };\n });\n return { description: value.description, isArray: value.isArray, fields };\n}\n\n/** Shape gate shared by preview hosts. Hosts must still validate field types/policies and ABI-encode. */\nexport function isVaultLaunchConfigResultForSchema(value: unknown, schema: VaultLaunchSchema): value is VaultLaunchConfigResult {\n if (!isRecord(value)) return false;\n if (value.status === \"invalid\") return value.errors === undefined\n || (Array.isArray(value.errors) && value.errors.length <= 100 && value.errors.every((error) => typeof error === \"string\"));\n if (value.status !== \"valid\") return false;\n if (value.summary !== undefined && (!Array.isArray(value.summary) || value.summary.length > 12\n || !value.summary.every((item) => isRecord(item) && typeof item.label === \"string\" && item.label.length <= 160\n && typeof item.value === \"string\" && item.value.length <= 160))) return false;\n if (schema.isArray !== Array.isArray(value.values)) return false;\n const rows = schema.isArray ? value.values as unknown[] : [value.values];\n if (rows.length === 0 || rows.length > 100) return false;\n const names = schema.fields.map((field) => field.name);\n return rows.every((row) => isRecord(row) && Object.keys(row).length === names.length\n && names.every((name) => Object.hasOwn(row, name) && row[name] !== undefined));\n}\n","export interface MiniApp3DDecoderUrls {\n draco?: string;\n ktx2?: string;\n}\n\nfunction assertArtifactAssetUrl(assetUrl: string, moduleUrl: string) {\n const moduleLocation = new URL(moduleUrl);\n const asset = new URL(assetUrl, moduleLocation);\n const moduleDirectory = moduleLocation.pathname.slice(0, moduleLocation.pathname.lastIndexOf(\"/\") + 1);\n if (asset.origin !== moduleLocation.origin || !asset.pathname.startsWith(`${moduleDirectory}assets/`)) {\n throw new Error(\"Mini App 3D assets must resolve from the current artifact assets/ manifest.\");\n }\n return asset.href;\n}\n\n/** Resolve a statically imported 3D asset without permitting remote/CDN fallback. */\nexport function resolveMiniApp3DAssetUrl(assetUrl: string, moduleUrl: string) {\n return assertArtifactAssetUrl(assetUrl, moduleUrl);\n}\n\n/** Return artifact-relative decoder URLs for DRACO/KTX2 loader configuration. */\nexport function resolveMiniApp3DDecoderUrls(urls: MiniApp3DDecoderUrls, moduleUrl: string): MiniApp3DDecoderUrls {\n return {\n ...(urls.draco ? { draco: assertArtifactAssetUrl(urls.draco, moduleUrl) } : {}),\n ...(urls.ktx2 ? { ktx2: assertArtifactAssetUrl(urls.ktx2, moduleUrl) } : {}),\n };\n}\n","import { useFlapSdk } from \"./runtime\";\n\nexport function useFlapWallet() {\n return useFlapSdk().wallet;\n}\n","\"use client\";\n\nexport * from \"./contract\";\nexport * from \"./erc20\";\nexport * from \"./format\";\nexport * from \"./ipfsImage\";\nexport * from \"./launchConfig\";\nexport * from \"./mediaUpload\";\nexport * from \"./nftMetadata\";\nexport * from \"./oracle\";\nexport * from \"./three\";\nexport * from \"./videoSession\";\nexport { useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext } from \"./runtimeStore\";\nexport { ZERO_ADDRESS, isActionAvailableForPhase, isCustomVaultTaxToken, isValidAddress, readTaxVaultHostContext, resolveTokenMarketPhase } from \"./taxInfo\";\nexport { getTxErrorKind, handleTxError } from \"./txError\";\nexport { useFlapChain } from \"./useFlapChain\";\nexport { useFlapWallet } from \"./useFlapWallet\";\nexport type {\n ActionAvailabilityStage,\n Address,\n ContractEventRequest,\n ContractReadRequest,\n ContractWriteRequest,\n FeeMode,\n FlapFeeVaultInfo,\n FlapI18n,\n FlapNotify,\n FlapTaxInfo,\n FlapTokenInfo,\n FlapVaultPortalInfo,\n FlapVaultSdk,\n FlapWallet,\n ManifestBindingEntry,\n IpfsUploadResult,\n MediaUploader,\n MediaUploadOptions,\n MediaUploadRequest,\n NftMetadataAttribute,\n NftMetadataReader,\n NftMetadataReaderRequest,\n NftMetadataReadRequest,\n NftMetadataSnapshot,\n NftMetadataSource,\n OracleProvision,\n OracleReadRequest,\n OracleReader,\n PaymentToken,\n RuntimeOracleRegistry,\n SimulateResult,\n TokenMarketPhase,\n TxReceipt,\n VaultComponentProps,\n VaultHostContext,\n VaultArtifactSurface,\n VaultLaunchConfigComponentProps,\n VaultLaunchConfigContext,\n VaultLaunchConfigResult,\n VaultLaunchConfigSummaryItem,\n VaultLaunchConfigValues,\n VaultLaunchSchema,\n VaultLaunchSchemaField,\n VaultManifest,\n VaultRenderSurface,\n VaultRuntimeContext,\n VaultRuntimeContextOverrides,\n VaultRuntimeExtraConfig,\n} from \"./types\";\n\nexport type { ManifestNftAccountWithdrawal, NftAccountWithdrawalPolicy, NftAccountWithdrawalRequest, NftAccountWithdrawalReceipt, ReviewedContractPin, ReviewedBeaconPin } from \"./nftAccountTypes\";\n\n/** Host feature check; declarations must fail closed on older runtimes. */\nexport const NFT_ACCOUNT_WITHDRAWAL_VERSION = 1;\n\nexport type { ManifestResolvedContract, ResolvedContractCheck, ResolvedContractHandle } from \"./resolvedContractTypes\";\nexport const RESOLVED_CONTRACTS_VERSION = 1;\n"]}
|
|
1
|
+
{"version":3,"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A,OAAA,CAAS,CAAA,EAAG;AACrG,IAAA,MAAM,IAAI,MAAM,6EAA6E,CAAA;AAAA,EAC/F;AACA,EAAA,OAAO,KAAA,CAAM,IAAA;AACf;AAGO,SAAS,wBAAA,CAAyB,UAAkB,SAAA,EAAmB;AAC5E,EAAA,OAAO,sBAAA,CAAuB,UAAU,SAAS,CAAA;AACnD;AAGO,SAAS,2BAAA,CAA4B,MAA4B,SAAA,EAAyC;AAC/G,EAAA,OAAO;AAAA,IACL,GAAI,IAAA,CAAK,KAAA,GAAQ,EAAE,KAAA,EAAO,sBAAA,CAAuB,IAAA,CAAK,KAAA,EAAO,SAAS,CAAA,EAAE,GAAI,EAAC;AAAA,IAC7E,GAAI,IAAA,CAAK,IAAA,GAAO,EAAE,IAAA,EAAM,sBAAA,CAAuB,IAAA,CAAK,IAAA,EAAM,SAAS,CAAA,EAAE,GAAI;AAAC,GAC5E;AACF;;;ACxBO,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAO,YAAW,CAAE,MAAA;AACtB;;;ACqEO,IAAM,8BAAA,GAAiC;AAGvC,IAAM,0BAAA,GAA6B","file":"sdk.js","sourcesContent":["\"use client\";\nimport { useContext, useMemo, useRef, type ReactNode } from \"react\";\nimport type { Address, FlapI18n, FlapNotify, VaultManifest } from \"./types\";\nimport { MiniAppContext } from \"./runtimeStore\";\nimport { createFlapChainSdk, type FlapChainSdk, type FlapWalletRuntime } from \"./flapChainRuntime\";\nimport { isStandaloneMiniApp } from \"./miniApp\";\n\nexport interface MiniAppSession {\n address?: Address;\n isConnected: boolean;\n isAuthenticated: boolean;\n isLoading: boolean;\n connect(): void;\n /** Uses the host's existing session; only prompts for a signature when needed. */\n signIn(): Promise<void>;\n}\nexport interface MiniAppSdk {\n context: { appId: string; slug: string; manifest: VaultManifest };\n session: MiniAppSession;\n i18n: FlapI18n;\n notify: FlapNotify;\n forChain(chainId: number): FlapChainSdk;\n}\nexport function MiniAppRuntimeProvider({ manifest, session, i18n, notify, runtime, children }: {\n manifest: VaultManifest; session: MiniAppSession; i18n: FlapI18n; notify: FlapNotify; children: ReactNode; runtime?: FlapWalletRuntime;\n}) {\n const current = useRef({ manifest, runtime }); current.current = { manifest, runtime };\n const sdk = useMemo<MiniAppSdk>(() => {\n const writableChains = [...(manifest.walletChains ?? [])];\n const chainSdks = new Map<number, FlapChainSdk>();\n return { context: { appId: manifest.artifactId, slug: manifest.slug!, manifest: structuredClone(manifest) }, session, i18n, notify, forChain: (chainId) => {\n if (!runtime) throw new Error(\"This host has not enabled wallet operations for Apps.\");\n let chainSdk = chainSdks.get(chainId);\n if (!chainSdk) { chainSdk = createFlapChainSdk({ ...runtime, assertActive: () => { if (current.current.manifest !== manifest || current.current.runtime !== runtime) throw new Error(\"The host wallet or App context changed. Review the transaction again.\"); runtime.assertActive?.(); } }, { chainId, manifest, writableChains, i18n, notify }); chainSdks.set(chainId, chainSdk); }\n return chainSdk;\n } };\n }, [manifest, runtime, session, i18n, notify]);\n if (!isStandaloneMiniApp(manifest)) throw new Error(\"A standalone Mini App v2 manifest is required.\");\n return <MiniAppContext.Provider value={sdk}>{children}</MiniAppContext.Provider>;\n}\nexport function useMiniAppSdk(): MiniAppSdk {\n const sdk = useContext(MiniAppContext);\n if (!sdk) throw new Error(\"useMiniAppSdk requires MiniAppRuntimeProvider.\");\n return sdk;\n}\n","import type { VaultLaunchConfigResult, VaultLaunchSchema } from \"./types\";\n\n/** Public IVaultSchemasV1 interface. Reading and encoding belong to the host, not the form. */\nexport const VAULT_LAUNCH_SCHEMA_ABI = [{\n type: \"function\",\n name: \"vaultDataSchema\",\n stateMutability: \"view\",\n inputs: [],\n outputs: [{\n name: \"schema\",\n type: \"tuple\",\n components: [\n { name: \"description\", type: \"string\" },\n { name: \"fields\", type: \"tuple[]\", components: [\n { name: \"name\", type: \"string\" },\n { name: \"fieldType\", type: \"string\" },\n { name: \"description\", type: \"string\" },\n { name: \"decimals\", type: \"uint8\" },\n ] },\n { name: \"isArray\", type: \"bool\" },\n ],\n }],\n}] as const;\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\n/** Normalize decoded chain data and fail closed on malformed/ambiguous field definitions. */\nexport function parseVaultLaunchSchema(value: unknown): VaultLaunchSchema {\n if (!isRecord(value) || typeof value.isArray !== \"boolean\" || typeof value.description !== \"string\"\n || !Array.isArray(value.fields) || value.fields.length > 100) {\n throw new Error(\"Invalid vault launch schema.\");\n }\n const names = new Set<string>();\n const fields = value.fields.map((field: unknown) => {\n if (!isRecord(field) || typeof field.name !== \"string\" || !/^[A-Za-z_][A-Za-z0-9_]{0,63}$/.test(field.name)\n || names.has(field.name) || [\"__proto__\", \"constructor\", \"prototype\"].includes(field.name)\n || typeof field.fieldType !== \"string\" || !field.fieldType.trim() || field.fieldType.length > 100\n || typeof field.description !== \"string\" || !Number.isInteger(field.decimals)\n || (field.decimals as number) < 0 || (field.decimals as number) > 255) {\n throw new Error(\"Invalid vault launch schema field.\");\n }\n names.add(field.name);\n return { name: field.name, fieldType: field.fieldType, description: field.description, decimals: field.decimals as number };\n });\n return { description: value.description, isArray: value.isArray, fields };\n}\n\n/** Shape gate shared by preview hosts. Hosts must still validate field types/policies and ABI-encode. */\nexport function isVaultLaunchConfigResultForSchema(value: unknown, schema: VaultLaunchSchema): value is VaultLaunchConfigResult {\n if (!isRecord(value)) return false;\n if (value.status === \"invalid\") return value.errors === undefined\n || (Array.isArray(value.errors) && value.errors.length <= 100 && value.errors.every((error) => typeof error === \"string\"));\n if (value.status !== \"valid\") return false;\n if (value.summary !== undefined && (!Array.isArray(value.summary) || value.summary.length > 12\n || !value.summary.every((item) => isRecord(item) && typeof item.label === \"string\" && item.label.length <= 160\n && typeof item.value === \"string\" && item.value.length <= 160))) return false;\n if (schema.isArray !== Array.isArray(value.values)) return false;\n const rows = schema.isArray ? value.values as unknown[] : [value.values];\n if (rows.length === 0 || rows.length > 100) return false;\n const names = schema.fields.map((field) => field.name);\n return rows.every((row) => isRecord(row) && Object.keys(row).length === names.length\n && names.every((name) => Object.hasOwn(row, name) && row[name] !== undefined));\n}\n","export interface MiniApp3DDecoderUrls {\n draco?: string;\n ktx2?: string;\n}\n\nfunction assertArtifactAssetUrl(assetUrl: string, moduleUrl: string) {\n const moduleLocation = new URL(moduleUrl);\n const asset = new URL(assetUrl, moduleLocation);\n const moduleDirectory = moduleLocation.pathname.slice(0, moduleLocation.pathname.lastIndexOf(\"/\") + 1);\n if (asset.origin !== moduleLocation.origin || !asset.pathname.startsWith(`${moduleDirectory}assets/`)) {\n throw new Error(\"Mini App 3D assets must resolve from the current artifact assets/ manifest.\");\n }\n return asset.href;\n}\n\n/** Resolve a statically imported 3D asset without permitting remote/CDN fallback. */\nexport function resolveMiniApp3DAssetUrl(assetUrl: string, moduleUrl: string) {\n return assertArtifactAssetUrl(assetUrl, moduleUrl);\n}\n\n/** Return artifact-relative decoder URLs for DRACO/KTX2 loader configuration. */\nexport function resolveMiniApp3DDecoderUrls(urls: MiniApp3DDecoderUrls, moduleUrl: string): MiniApp3DDecoderUrls {\n return {\n ...(urls.draco ? { draco: assertArtifactAssetUrl(urls.draco, moduleUrl) } : {}),\n ...(urls.ktx2 ? { ktx2: assertArtifactAssetUrl(urls.ktx2, moduleUrl) } : {}),\n };\n}\n","import { useFlapSdk } from \"./runtime\";\n\nexport function useFlapWallet() {\n return useFlapSdk().wallet;\n}\n","\"use client\";\n\nexport * from \"./contract\";\nexport * from \"./miniApp\";\nexport * from \"./miniAppRuntime\";\nexport * from \"./erc20\";\nexport * from \"./format\";\nexport * from \"./ipfsImage\";\nexport * from \"./launchConfig\";\nexport * from \"./mediaUpload\";\nexport * from \"./nftMetadata\";\nexport * from \"./oracle\";\nexport * from \"./three\";\nexport * from \"./videoSession\";\nexport { useFlapI18n, useFlapNotify, useFlapSdk, useVaultContext } from \"./runtimeStore\";\nexport { ZERO_ADDRESS, isActionAvailableForPhase, isCustomVaultTaxToken, isValidAddress, readTaxVaultHostContext, resolveTokenMarketPhase } from \"./taxInfo\";\nexport { getTxErrorKind, handleTxError } from \"./txError\";\nexport { useFlapChain } from \"./useFlapChain\";\nexport { useFlapWallet } from \"./useFlapWallet\";\nexport type {\n ActionAvailabilityStage,\n Address,\n ContractEventRequest,\n ContractReadRequest,\n ContractWriteRequest,\n FeeMode,\n FlapFeeVaultInfo,\n FlapI18n,\n FlapNotify,\n FlapTaxInfo,\n FlapTokenInfo,\n FlapVaultPortalInfo,\n FlapVaultSdk,\n FlapWallet,\n ManifestBindingEntry,\n IpfsUploadResult,\n MediaUploader,\n MediaUploadOptions,\n MediaUploadRequest,\n NftMetadataAttribute,\n NftMetadataReader,\n NftMetadataReaderRequest,\n NftMetadataReadRequest,\n NftMetadataSnapshot,\n NftMetadataSource,\n OracleProvision,\n OracleReadRequest,\n OracleReader,\n PaymentToken,\n RuntimeOracleRegistry,\n SimulateResult,\n TokenMarketPhase,\n TxReceipt,\n VaultComponentProps,\n VaultHostContext,\n VaultArtifactSurface,\n VaultLaunchConfigComponentProps,\n VaultLaunchConfigContext,\n VaultLaunchConfigResult,\n VaultLaunchConfigSummaryItem,\n VaultLaunchConfigValues,\n VaultLaunchSchema,\n VaultLaunchSchemaField,\n VaultManifest,\n VaultRenderSurface,\n VaultRuntimeContext,\n VaultRuntimeContextOverrides,\n VaultRuntimeExtraConfig,\n} from \"./types\";\n\nexport type { ManifestNftAccountWithdrawal, NftAccountWithdrawalPolicy, NftAccountWithdrawalRequest, NftAccountWithdrawalReceipt, ReviewedContractPin, ReviewedBeaconPin } from \"./nftAccountTypes\";\n\n/** Host feature check; declarations must fail closed on older runtimes. */\nexport const NFT_ACCOUNT_WITHDRAWAL_VERSION = 1;\n\nexport type { ManifestResolvedContract, ResolvedContractCheck, ResolvedContractHandle } from \"./resolvedContractTypes\";\nexport const RESOLVED_CONTRACTS_VERSION = 1;\n\nexport { FLAP_WALLET_RUNTIME_VERSION } from \"./flapChainRuntime\";\nexport type { FlapChainSdk, FlapSendTransactionRequest, FlapTransactionReceipt } from \"./flapChainRuntime\";\n\nexport type { AppWalletContract, AppResolvedContract } from \"./appWalletPolicy.mjs\";\n"]}
|
package/server.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { L as LocalHostPresentationFetcherOptions, R as ResolveHostPresentationBatchInput, a as ResolveHostPresentationInput, T as TaxVaultHostChainConfig, c as createLocalHostPresentationFetcher, g as getTaxVaultHostChainConfig, l as loadFlapHostTokenPresentation, b as loadFlapHostTokenPresentationBatch } from './hostRuntimeConfig-
|
|
2
|
-
import {
|
|
3
|
-
export { A as ActionAvailabilityStage, a as Address, C as ContractEventRequest,
|
|
1
|
+
export { L as LocalHostPresentationFetcherOptions, R as ResolveHostPresentationBatchInput, a as ResolveHostPresentationInput, T as TaxVaultHostChainConfig, c as createLocalHostPresentationFetcher, g as getTaxVaultHostChainConfig, l as loadFlapHostTokenPresentation, b as loadFlapHostTokenPresentationBatch } from './hostRuntimeConfig-DibvcxHE.mjs';
|
|
2
|
+
import { a8 as RuntimeOracleRegistry, $ as OracleProvision, Z as NftMetadataSnapshot } from './types-DUZWZ3mC.mjs';
|
|
3
|
+
export { A as ActionAvailabilityStage, a as Address, C as ContractEventRequest, d as ContractReadRequest, e as ContractWriteRequest, f as CreateVaultRuntimeContextInput, E as EndpointPolicy, g as FeeMode, i as FlapFeeVaultInfo, j as FlapI18n, k as FlapNotify, m as FlapTaxInfo, n as FlapTokenInfo, p as FlapVaultPortalInfo, q as FlapVaultSdk, r as FlapWallet, H as HostRuntimeAddresses, u as HostRuntimeDataSource, v as HostRuntimeDegradeReason, w as HostRuntimeInput, x as HostRuntimePolicy, y as HostRuntimePresentationFetcher, z as HostRuntimePresentationRequest, B as HostRuntimeResult, D as HostRuntimeSources, G as HostRuntimeStatus, I as HostRuntimeWarning, J as HostTokenPresentation, K as IpfsUploadResult, M as ManifestBindingEntry, L as ManifestExternalContract, P as MediaUploadOptions, Q as MediaUploadRequest, R as MediaUploader, V as NftMetadataAttribute, W as NftMetadataReadRequest, X as NftMetadataReader, Y as NftMetadataReaderRequest, _ as NftMetadataSource, a0 as OracleReadRequest, a1 as OracleReader, a3 as PaymentToken, a9 as SimulateResult, aa as TokenMarketPhase, ab as TokenMetadataSnapshot, ac as TokenRuntimeSnapshot, ad as TxReceipt, ae as VaultArtifactSurface, af as VaultComponentProps, ag as VaultHostContext, ah as VaultLaunchConfigComponentProps, ai as VaultLaunchConfigContext, aj as VaultLaunchConfigResult, ak as VaultLaunchConfigSummaryItem, al as VaultLaunchConfigValues, am as VaultLaunchSchema, an as VaultLaunchSchemaField, ao as VaultManifest, ap as VaultManifestCapability, aq as VaultManifestDisplayTitle, ar as VaultManifestLayout, as as VaultManifestMode, at as VaultRenderSurface, au as VaultRuntimeContext, av as VaultRuntimeContextOverrides, aw as VaultRuntimeExtraConfig } from './types-DUZWZ3mC.mjs';
|
|
4
4
|
import 'viem';
|
|
5
5
|
|
|
6
6
|
declare const FLAP_RUNTIME_ORACLE_REGISTRY_ENV = "FLAP_RUNTIME_ORACLE_REGISTRY";
|
|
@@ -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-DUZWZ3mC.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,95 @@ 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
|
+
uploadImage(file: Blob, options?: MediaUploadOptions): ReturnType<MediaUploader>;
|
|
82
|
+
uploadText(text: string, options?: MediaUploadOptions): ReturnType<MediaUploader>;
|
|
83
|
+
openExplorerTx(hash: Address): void;
|
|
84
|
+
}
|
|
85
|
+
interface FlapWalletAccount {
|
|
86
|
+
address?: Address;
|
|
87
|
+
chainId?: number;
|
|
88
|
+
isConnected: boolean;
|
|
89
|
+
}
|
|
90
|
+
/** Host-only transport: never supplied by uploaded components. */
|
|
91
|
+
interface FlapWalletRuntime {
|
|
92
|
+
chains: readonly {
|
|
93
|
+
id: number;
|
|
94
|
+
name: string;
|
|
95
|
+
explorerBaseUrl?: string;
|
|
96
|
+
}[];
|
|
97
|
+
readOnly?: boolean;
|
|
98
|
+
generation?: string;
|
|
99
|
+
assertActive?(): void;
|
|
100
|
+
getAccount(): FlapWalletAccount;
|
|
101
|
+
connect(): void;
|
|
102
|
+
disconnect(): void;
|
|
103
|
+
switchChain(chainId: number): Promise<void>;
|
|
104
|
+
readContract(chainId: number, request: ContractReadRequest): Promise<unknown>;
|
|
105
|
+
simulateContract(chainId: number, request: ContractWriteRequest & {
|
|
106
|
+
account: Address;
|
|
107
|
+
}): Promise<unknown>;
|
|
108
|
+
writeContract(chainId: number, request: ContractWriteRequest & {
|
|
109
|
+
account: Address;
|
|
110
|
+
}): Promise<Address>;
|
|
111
|
+
sendTransaction(chainId: number, request: FlapSendTransactionRequest & {
|
|
112
|
+
account: Address;
|
|
113
|
+
}): Promise<Address>;
|
|
114
|
+
waitForTx(chainId: number, hash: Address): Promise<FlapTransactionReceipt>;
|
|
115
|
+
getCode(chainId: number, address: Address): Promise<`0x${string}` | undefined>;
|
|
116
|
+
getGasPrice(chainId: number): Promise<bigint>;
|
|
117
|
+
getBlockNumber(chainId: number): Promise<bigint>;
|
|
118
|
+
getBalance(chainId: number, address: Address): Promise<bigint>;
|
|
119
|
+
getContractEvents(chainId: number, request: ContractEventRequest): Promise<unknown[]>;
|
|
120
|
+
upload: MediaUploader;
|
|
121
|
+
openUrl(url: string): void;
|
|
122
|
+
}
|
|
123
|
+
declare function createFlapChainSdk(runtime: FlapWalletRuntime, input: {
|
|
124
|
+
chainId: number;
|
|
125
|
+
manifest: VaultManifest;
|
|
126
|
+
writableChains: readonly number[];
|
|
127
|
+
i18n: FlapI18n;
|
|
128
|
+
notify: FlapNotify;
|
|
129
|
+
}): FlapChainSdk;
|
|
130
|
+
|
|
131
|
+
interface AppWalletPermissions { id: string; allow?: string[]; read?: string[]; maxValueWei?: string; approvalSpenders?: Address[]; maxApprovalWei?: string; codeHash?: `0x${string}` }
|
|
132
|
+
interface AppResolvedContract extends AppWalletPermissions { resolver: string }
|
|
133
|
+
interface AppWalletContract extends AppWalletPermissions { chainId: number; address: Address; resolvedContracts?: AppResolvedContract[] }
|
|
134
|
+
interface ParsedAppWalletPermissions { definition: AppWalletPermissions; writes: AbiFunction[]; reads: AbiFunction[] }
|
|
135
|
+
interface ParsedAppWalletContract extends ParsedAppWalletPermissions { definition: AppWalletContract; resolved: (ParsedAppWalletPermissions & { resolver: AbiFunction })[] }
|
|
136
|
+
declare function parseAppWalletContracts(value: unknown): ParsedAppWalletContract[];
|
|
137
|
+
|
|
49
138
|
/** A request for review, never an authorization. No caller-supplied addresses. */
|
|
50
139
|
interface ManifestNftAccountWithdrawal {
|
|
51
140
|
policyId: string;
|
|
@@ -266,6 +355,12 @@ interface VaultManifestDisplayTitle {
|
|
|
266
355
|
en: string;
|
|
267
356
|
}
|
|
268
357
|
interface VaultManifest {
|
|
358
|
+
schemaVersion?: 2;
|
|
359
|
+
appModel?: "standalone";
|
|
360
|
+
slug?: string;
|
|
361
|
+
/** Standalone App networks that may request wallet writes. Omitted means read-only. */
|
|
362
|
+
walletChains?: number[];
|
|
363
|
+
walletContracts?: AppWalletContract[];
|
|
269
364
|
artifactId: string;
|
|
270
365
|
name: string;
|
|
271
366
|
displayTitle?: VaultManifestDisplayTitle;
|
|
@@ -465,6 +560,7 @@ interface MediaUploadRequest extends MediaUploadOptions {
|
|
|
465
560
|
/** Optional host override for the controlled upload service. */
|
|
466
561
|
type MediaUploader = (request: MediaUploadRequest) => Promise<IpfsUploadResult>;
|
|
467
562
|
interface FlapVaultSdk {
|
|
563
|
+
forChain(chainId: number): FlapChainSdk;
|
|
468
564
|
context: VaultRuntimeContext;
|
|
469
565
|
i18n: FlapI18n;
|
|
470
566
|
notify: FlapNotify;
|
|
@@ -483,8 +579,6 @@ interface FlapVaultSdk {
|
|
|
483
579
|
/** Reviewed NULL profile only; returns after receipt and balance refresh. */
|
|
484
580
|
withdrawNftAccount(request: NftAccountWithdrawalRequest): Promise<NftAccountWithdrawalReceipt>;
|
|
485
581
|
readOracle<T = unknown>(oracleId: string, params?: Record<string, string>): Promise<T>;
|
|
486
|
-
/** GET JSON under the reviewed FSI /fsi/v1 prefix; path is relative, query values are strings. */
|
|
487
|
-
readFsi<T = unknown>(path: string, params?: Record<string, string>): Promise<T>;
|
|
488
582
|
readNftMetadata(request: NftMetadataReadRequest): Promise<NftMetadataSnapshot>;
|
|
489
583
|
/** Uploads PNG/JPEG/GIF/WebP (up to 3 MiB) and returns the file CID. */
|
|
490
584
|
uploadImage(file: Blob, options?: MediaUploadOptions): Promise<IpfsUploadResult>;
|
|
@@ -509,4 +603,4 @@ interface VaultComponentProps {
|
|
|
509
603
|
context?: VaultRuntimeContext;
|
|
510
604
|
}
|
|
511
605
|
|
|
512
|
-
export type
|
|
606
|
+
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-DUZWZ3mC.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 4096 characters. */
|
|
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;
|
|
@@ -203,4 +214,4 @@ type VideoSessionPlayerProps = VideoClipSessionPlayerProps | (ConsumerVideoSessi
|
|
|
203
214
|
});
|
|
204
215
|
declare function VideoSessionPlayer(props: VideoSessionPlayerProps): React.JSX.Element;
|
|
205
216
|
|
|
206
|
-
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, 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 };
|
|
217
|
+
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, 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,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
export { AddressLink, Alert, BinanceImage, Button, Card, CardContent, CardDescription, CardHeader, CardTitle, Countdown, DataRow, DetailTile, ExternalLink, Input, IpfsBackground, IpfsImage, 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, Metric, NftMetadataImage, ReviewedFrame, StatusBadge, TxButton, VaultBanner, VideoSessionPlayer, buttonVariants } from './chunk-JVOFLTLD.js';
|
|
3
3
|
import './chunk-B4WKI3EW.js';
|
|
4
4
|
import './chunk-SAG36LUR.js';
|
|
5
5
|
import './chunk-FUOBTZMQ.js';
|
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,4CAA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5F,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-AGLB72HK.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { resolveManifestBinding } from './chunk-B4WKI3EW.js';
|
|
2
|
-
|
|
3
|
-
// src/sdk/runtimeContext.ts
|
|
4
|
-
var zeroAddress = "0x0000000000000000000000000000000000000000";
|
|
5
|
-
function explorerForChain(chainId) {
|
|
6
|
-
if (chainId === 56) return "https://bscscan.com";
|
|
7
|
-
if (chainId === 97) return "https://testnet.bscscan.com";
|
|
8
|
-
if (chainId === 4663) return "https://robinhoodchain.blockscout.com";
|
|
9
|
-
if (chainId === 46630) return "https://explorer.testnet.chain.robinhood.com";
|
|
10
|
-
return void 0;
|
|
11
|
-
}
|
|
12
|
-
function chainLabelForChain(chainId) {
|
|
13
|
-
if (chainId === 56) return "BNB Chain";
|
|
14
|
-
if (chainId === 97) return "BNB Testnet";
|
|
15
|
-
if (chainId === 4663) return "Robinhood Chain";
|
|
16
|
-
if (chainId === 46630) return "Robinhood Chain Testnet";
|
|
17
|
-
return `Chain ${chainId}`;
|
|
18
|
-
}
|
|
19
|
-
function buildRuntimeExtraConfig(input) {
|
|
20
|
-
const hostRuntimeResult = input.hostRuntimeResult;
|
|
21
|
-
const runtimeOverrides = input.runtimeOverrides;
|
|
22
|
-
return {
|
|
23
|
-
...hostRuntimeResult ? {
|
|
24
|
-
hostRuntimeStatus: hostRuntimeResult.status,
|
|
25
|
-
hostRuntimePolicy: hostRuntimeResult.policy,
|
|
26
|
-
hostRuntimeDegradeReason: hostRuntimeResult.degradeReason,
|
|
27
|
-
hostRuntimeWarnings: hostRuntimeResult.warnings
|
|
28
|
-
} : {},
|
|
29
|
-
...hostRuntimeResult?.presentation?.extraConfig ?? {},
|
|
30
|
-
...runtimeOverrides?.extraConfig ?? {}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function createVaultRuntimeContext(input) {
|
|
34
|
-
const runtimeOverrides = input.runtimeOverrides;
|
|
35
|
-
const resolvedBinding = resolveManifestBinding(input.manifest, {
|
|
36
|
-
chainId: runtimeOverrides?.chainId ?? input.connectedChainId ?? input.hostRuntimeResult?.addresses.chainId,
|
|
37
|
-
factoryAddress: runtimeOverrides?.factoryAddress ?? input.hostRuntimeResult?.addresses.factoryAddress,
|
|
38
|
-
vaultAddress: runtimeOverrides?.vaultAddress ?? input.hostRuntimeResult?.addresses.vaultAddress,
|
|
39
|
-
tokenAddress: runtimeOverrides?.tokenAddress ?? input.hostRuntimeResult?.addresses.tokenAddress
|
|
40
|
-
});
|
|
41
|
-
const effectiveChainId = runtimeOverrides?.chainId ?? input.hostRuntimeResult?.addresses.chainId ?? input.connectedChainId ?? resolvedBinding?.chainId ?? input.manifest.match.bindings[0]?.chainId ?? 56;
|
|
42
|
-
return {
|
|
43
|
-
chainId: effectiveChainId,
|
|
44
|
-
factoryAddress: runtimeOverrides?.factoryAddress ?? input.hostRuntimeResult?.addresses.factoryAddress ?? resolvedBinding?.factoryAddress ?? zeroAddress,
|
|
45
|
-
tokenAddress: runtimeOverrides?.tokenAddress ?? input.hostRuntimeResult?.addresses.tokenAddress ?? zeroAddress,
|
|
46
|
-
vaultAddress: runtimeOverrides?.vaultAddress ?? input.hostRuntimeResult?.addresses.vaultAddress ?? zeroAddress,
|
|
47
|
-
userAddress: runtimeOverrides?.userAddress,
|
|
48
|
-
tokenSymbol: runtimeOverrides?.tokenSymbol ?? input.hostRuntimeResult?.tokenSymbol,
|
|
49
|
-
tokenName: runtimeOverrides?.tokenName ?? input.hostRuntimeResult?.tokenName,
|
|
50
|
-
tokenImageUrl: runtimeOverrides?.tokenImageUrl ?? input.hostRuntimeResult?.tokenImageUrl,
|
|
51
|
-
explorerBaseUrl: runtimeOverrides?.explorerBaseUrl ?? explorerForChain(effectiveChainId),
|
|
52
|
-
paymentToken: runtimeOverrides?.paymentToken ?? input.hostRuntimeResult?.paymentToken,
|
|
53
|
-
host: runtimeOverrides?.host ?? input.hostRuntimeResult?.host,
|
|
54
|
-
extraConfig: buildRuntimeExtraConfig(input),
|
|
55
|
-
manifest: input.manifest
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export { chainLabelForChain, createVaultRuntimeContext, explorerForChain };
|
|
60
|
-
//# sourceMappingURL=chunk-AGLB72HK.js.map
|
|
61
|
-
//# sourceMappingURL=chunk-AGLB72HK.js.map
|
package/chunk-AGLB72HK.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sdk/runtimeContext.ts"],"names":[],"mappings":";;;AA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C3E,eAAA,EAAiB,gBAAA,EAAkB,eAAA,IAAmB,gBAAA,CAAiB,gBAAgB,CAAA;AAAA,IACvF,YAAA,EAAc,gBAAA,EAAkB,YAAA,IAAgB,KAAA,CAAM,iBAAA,EAAmB,YAAA;AAAA,IACzE,IAAA,EAAM,gBAAA,EAAkB,IAAA,IAAQ,KAAA,CAAM,iBAAA,EAAmB,IAAA;AAAA,IACzD,WAAA,EAAa,wBAAwB,KAAK,CAAA;AAAA,IAC1C,UAAU,KAAA,CAAM;AAAA,GAClB;AACF","file":"chunk-AGLB72HK.js","sourcesContent":["import { resolveManifestBinding } from \"./taxInfo\";\nimport type { Address, CreateVaultRuntimeContextInput, VaultRuntimeContext, VaultRuntimeExtraConfig } from \"./types\";\n\nconst zeroAddress = \"0x0000000000000000000000000000000000000000\" as Address;\n\nexport function explorerForChain(chainId: number) {\n if (chainId === 56) return \"https://bscscan.com\";\n if (chainId === 97) return \"https://testnet.bscscan.com\";\n if (chainId === 4663) return \"https://robinhoodchain.blockscout.com\";\n if (chainId === 46630) return \"https://explorer.testnet.chain.robinhood.com\";\n return undefined;\n}\n\nexport function chainLabelForChain(chainId: number) {\n if (chainId === 56) return \"BNB Chain\";\n if (chainId === 97) return \"BNB Testnet\";\n if (chainId === 4663) return \"Robinhood Chain\";\n if (chainId === 46630) return \"Robinhood Chain Testnet\";\n return `Chain ${chainId}`;\n}\n\nfunction buildRuntimeExtraConfig(input: CreateVaultRuntimeContextInput): VaultRuntimeExtraConfig {\n const hostRuntimeResult = input.hostRuntimeResult;\n const runtimeOverrides = input.runtimeOverrides;\n\n return {\n ...(hostRuntimeResult\n ? {\n hostRuntimeStatus: hostRuntimeResult.status,\n hostRuntimePolicy: hostRuntimeResult.policy,\n hostRuntimeDegradeReason: hostRuntimeResult.degradeReason,\n hostRuntimeWarnings: hostRuntimeResult.warnings,\n }\n : {}),\n ...(hostRuntimeResult?.presentation?.extraConfig ?? {}),\n ...(runtimeOverrides?.extraConfig ?? {}),\n };\n}\n\nexport function createVaultRuntimeContext(input: CreateVaultRuntimeContextInput): VaultRuntimeContext {\n const runtimeOverrides = input.runtimeOverrides;\n const resolvedBinding = resolveManifestBinding(input.manifest, {\n chainId: runtimeOverrides?.chainId ?? input.connectedChainId ?? input.hostRuntimeResult?.addresses.chainId,\n factoryAddress: runtimeOverrides?.factoryAddress ?? input.hostRuntimeResult?.addresses.factoryAddress,\n vaultAddress: runtimeOverrides?.vaultAddress ?? input.hostRuntimeResult?.addresses.vaultAddress,\n tokenAddress: runtimeOverrides?.tokenAddress ?? input.hostRuntimeResult?.addresses.tokenAddress,\n });\n const effectiveChainId =\n runtimeOverrides?.chainId ?? input.hostRuntimeResult?.addresses.chainId ?? input.connectedChainId ?? resolvedBinding?.chainId ?? input.manifest.match.bindings[0]?.chainId ?? 56;\n\n return {\n chainId: effectiveChainId,\n factoryAddress: runtimeOverrides?.factoryAddress ?? input.hostRuntimeResult?.addresses.factoryAddress ?? resolvedBinding?.factoryAddress ?? zeroAddress,\n tokenAddress: runtimeOverrides?.tokenAddress ?? input.hostRuntimeResult?.addresses.tokenAddress ?? zeroAddress,\n vaultAddress: runtimeOverrides?.vaultAddress ?? input.hostRuntimeResult?.addresses.vaultAddress ?? zeroAddress,\n userAddress: runtimeOverrides?.userAddress,\n tokenSymbol: runtimeOverrides?.tokenSymbol ?? input.hostRuntimeResult?.tokenSymbol,\n tokenName: runtimeOverrides?.tokenName ?? input.hostRuntimeResult?.tokenName,\n tokenImageUrl: runtimeOverrides?.tokenImageUrl ?? input.hostRuntimeResult?.tokenImageUrl,\n explorerBaseUrl: runtimeOverrides?.explorerBaseUrl ?? explorerForChain(effectiveChainId),\n paymentToken: runtimeOverrides?.paymentToken ?? input.hostRuntimeResult?.paymentToken,\n host: runtimeOverrides?.host ?? input.hostRuntimeResult?.host,\n extraConfig: buildRuntimeExtraConfig(input),\n manifest: input.manifest,\n };\n}\n"]}
|