@lunatest/core 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.ts +6 -0
- package/dist/browser.js +5 -0
- package/dist/config/lua-config.js +2 -43
- package/dist/config/read-source.d.ts +3 -0
- package/dist/config/read-source.js +56 -0
- package/dist/coverage/catalog.d.ts +14 -0
- package/dist/coverage/catalog.js +91 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +3 -0
- package/dist/mocks/provider.js +1 -3
- package/dist/presets/__tests__/registry.test.ts +213 -0
- package/dist/presets/loader.d.ts +6 -0
- package/dist/presets/loader.js +40 -0
- package/dist/presets/loader.ts +58 -0
- package/dist/presets/project-sources.node.d.ts +2 -0
- package/dist/presets/project-sources.node.js +44 -0
- package/dist/presets/project-sources.node.ts +57 -0
- package/dist/presets/protocol/aave.lua +82 -0
- package/dist/presets/protocol/curve.lua +82 -0
- package/dist/presets/protocol/uniswap_v2.lua +92 -0
- package/dist/presets/protocol/uniswap_v3.lua +144 -0
- package/dist/presets/registry.d.ts +59 -0
- package/dist/presets/registry.js +483 -0
- package/dist/presets/registry.ts +784 -0
- package/dist/presets/wallet/demo_sepolia.lua +66 -0
- package/dist/presets/wallet/empty_wallet.lua +54 -0
- package/dist/provider/luna-provider.d.ts +3 -0
- package/dist/provider/luna-provider.js +66 -5
- package/dist/runner/assert.js +23 -1
- package/dist/runtime/bridge.js +10 -2
- package/dist/runtime/engine.js +6 -2
- package/dist/runtime/scenario-runtime.d.ts +8 -0
- package/dist/runtime/scenario-runtime.js +9 -0
- package/dist/scenario/index.d.ts +7 -1
- package/dist/scenario/index.js +8 -0
- package/package.json +13 -3
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ProjectPresetSources, PresetSourceInput } from "./registry.js";
|
|
2
|
+
|
|
3
|
+
async function readPresetDir(
|
|
4
|
+
root: string,
|
|
5
|
+
bucket: Record<string, PresetSourceInput>,
|
|
6
|
+
baseDir = root,
|
|
7
|
+
): Promise<void> {
|
|
8
|
+
const { readdir } = await import("node:fs/promises");
|
|
9
|
+
const path = await import("node:path");
|
|
10
|
+
const entries = await readdir(root, { withFileTypes: true });
|
|
11
|
+
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
const absolutePath = path.join(root, entry.name);
|
|
14
|
+
if (entry.isDirectory()) {
|
|
15
|
+
await readPresetDir(absolutePath, bucket, baseDir);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!entry.isFile() || !entry.name.endsWith(".lua")) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const relativePath = path.relative(baseDir, absolutePath).replace(/\\/g, "/");
|
|
24
|
+
const id = relativePath.replace(/\.lua$/u, "");
|
|
25
|
+
bucket[id] = absolutePath;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function loadProjectPresetSources(
|
|
30
|
+
projectRoot: string,
|
|
31
|
+
): Promise<ProjectPresetSources> {
|
|
32
|
+
const path = await import("node:path");
|
|
33
|
+
const fs = await import("node:fs/promises");
|
|
34
|
+
const protocolRoot = path.join(projectRoot, "lunatest", "presets", "protocol");
|
|
35
|
+
const walletRoot = path.join(projectRoot, "lunatest", "presets", "wallet");
|
|
36
|
+
const protocol: Record<string, PresetSourceInput> = {};
|
|
37
|
+
const wallet: Record<string, PresetSourceInput> = {};
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
await fs.access(protocolRoot);
|
|
41
|
+
await readPresetDir(protocolRoot, protocol);
|
|
42
|
+
} catch {
|
|
43
|
+
// ignore missing local protocol preset directory
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
await fs.access(walletRoot);
|
|
48
|
+
await readPresetDir(walletRoot, wallet);
|
|
49
|
+
} catch {
|
|
50
|
+
// ignore missing local wallet preset directory
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
protocol,
|
|
55
|
+
wallet,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
return {
|
|
2
|
+
manifest = {
|
|
3
|
+
id = "aave",
|
|
4
|
+
label = "Aave",
|
|
5
|
+
description = "Built-in lending market preset.",
|
|
6
|
+
kind = "lending",
|
|
7
|
+
supportedChains = { 1 },
|
|
8
|
+
protocol = "aave",
|
|
9
|
+
version = "v3",
|
|
10
|
+
components = {
|
|
11
|
+
pool = "v3_pool",
|
|
12
|
+
oracle = "price_oracle",
|
|
13
|
+
},
|
|
14
|
+
defaultWalletPreset = {
|
|
15
|
+
id = "empty_wallet",
|
|
16
|
+
},
|
|
17
|
+
defaultInterceptState = {
|
|
18
|
+
protocol = {
|
|
19
|
+
id = "aave",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultRouteMocks = {},
|
|
23
|
+
builtinScenarios = {
|
|
24
|
+
{
|
|
25
|
+
id = "health_factor_warning",
|
|
26
|
+
label = "Health Factor Warning",
|
|
27
|
+
lua = "scenario { name = 'health_factor_warning', given = { wallet = { healthFactor = 1.02 } } }",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
paramsSchema = {
|
|
31
|
+
{
|
|
32
|
+
key = "chainId",
|
|
33
|
+
label = "Chain",
|
|
34
|
+
type = "chainId",
|
|
35
|
+
required = true,
|
|
36
|
+
default = 1,
|
|
37
|
+
options = { 1 },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key = "reserve",
|
|
41
|
+
label = "Reserve",
|
|
42
|
+
type = "string",
|
|
43
|
+
required = true,
|
|
44
|
+
default = "USDC",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
recommendedControls = { "reserve" },
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
materialize = function(params)
|
|
51
|
+
local chainId = tonumber(params.chainId or 1)
|
|
52
|
+
local reserve = tostring(params.reserve or "USDC")
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
resolvedParams = {
|
|
56
|
+
chainId = chainId,
|
|
57
|
+
reserve = reserve,
|
|
58
|
+
},
|
|
59
|
+
walletPreset = {
|
|
60
|
+
id = "empty_wallet",
|
|
61
|
+
overrides = {
|
|
62
|
+
chainId = string.format("0x%x", chainId),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
interceptState = {
|
|
66
|
+
chain = { id = chainId },
|
|
67
|
+
protocol = {
|
|
68
|
+
id = "aave",
|
|
69
|
+
version = "v3",
|
|
70
|
+
components = {
|
|
71
|
+
pool = "v3_pool",
|
|
72
|
+
oracle = "price_oracle",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
market = {
|
|
76
|
+
reserve = reserve,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
routeMocks = {},
|
|
80
|
+
}
|
|
81
|
+
end,
|
|
82
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
return {
|
|
2
|
+
manifest = {
|
|
3
|
+
id = "curve",
|
|
4
|
+
label = "Curve",
|
|
5
|
+
description = "Built-in stable swap preset.",
|
|
6
|
+
kind = "dex",
|
|
7
|
+
supportedChains = { 1 },
|
|
8
|
+
protocol = "curve",
|
|
9
|
+
version = "v1",
|
|
10
|
+
components = {
|
|
11
|
+
invariant = "stable_swap",
|
|
12
|
+
router = "pool_router",
|
|
13
|
+
},
|
|
14
|
+
defaultWalletPreset = {
|
|
15
|
+
id = "empty_wallet",
|
|
16
|
+
},
|
|
17
|
+
defaultInterceptState = {
|
|
18
|
+
protocol = {
|
|
19
|
+
id = "curve",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultRouteMocks = {},
|
|
23
|
+
builtinScenarios = {
|
|
24
|
+
{
|
|
25
|
+
id = "imbalanced_pool",
|
|
26
|
+
label = "Imbalanced Pool",
|
|
27
|
+
lua = "scenario { name = 'imbalanced_pool', given = { pool = { imbalance = true } } }",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
paramsSchema = {
|
|
31
|
+
{
|
|
32
|
+
key = "chainId",
|
|
33
|
+
label = "Chain",
|
|
34
|
+
type = "chainId",
|
|
35
|
+
required = true,
|
|
36
|
+
default = 1,
|
|
37
|
+
options = { 1 },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key = "poolName",
|
|
41
|
+
label = "Pool",
|
|
42
|
+
type = "string",
|
|
43
|
+
required = true,
|
|
44
|
+
default = "3pool",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
recommendedControls = { "poolName" },
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
materialize = function(params)
|
|
51
|
+
local chainId = tonumber(params.chainId or 1)
|
|
52
|
+
local poolName = tostring(params.poolName or "3pool")
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
resolvedParams = {
|
|
56
|
+
chainId = chainId,
|
|
57
|
+
poolName = poolName,
|
|
58
|
+
},
|
|
59
|
+
walletPreset = {
|
|
60
|
+
id = "empty_wallet",
|
|
61
|
+
overrides = {
|
|
62
|
+
chainId = string.format("0x%x", chainId),
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
interceptState = {
|
|
66
|
+
chain = { id = chainId },
|
|
67
|
+
protocol = {
|
|
68
|
+
id = "curve",
|
|
69
|
+
version = "v1",
|
|
70
|
+
components = {
|
|
71
|
+
invariant = "stable_swap",
|
|
72
|
+
router = "pool_router",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
pool = {
|
|
76
|
+
name = poolName,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
routeMocks = {},
|
|
80
|
+
}
|
|
81
|
+
end,
|
|
82
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
return {
|
|
2
|
+
manifest = {
|
|
3
|
+
id = "uniswap_v2",
|
|
4
|
+
label = "Uniswap V2",
|
|
5
|
+
description = "Built-in constant product DEX preset.",
|
|
6
|
+
kind = "dex",
|
|
7
|
+
supportedChains = { 1, 11155111 },
|
|
8
|
+
protocol = "uniswap",
|
|
9
|
+
version = "v2",
|
|
10
|
+
components = {
|
|
11
|
+
router = "router_02",
|
|
12
|
+
pricing = "pair_reserves",
|
|
13
|
+
},
|
|
14
|
+
defaultWalletPreset = {
|
|
15
|
+
id = "demo_sepolia",
|
|
16
|
+
},
|
|
17
|
+
defaultInterceptState = {
|
|
18
|
+
protocol = {
|
|
19
|
+
id = "uniswap_v2",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultRouteMocks = {},
|
|
23
|
+
builtinScenarios = {
|
|
24
|
+
{
|
|
25
|
+
id = "price_impact_warning",
|
|
26
|
+
label = "Price Impact Warning",
|
|
27
|
+
lua = "scenario { name = 'price_impact_warning', given = { chaos = { slippagePctOverride = 12 } } }",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
paramsSchema = {
|
|
31
|
+
{
|
|
32
|
+
key = "chainId",
|
|
33
|
+
label = "Chain",
|
|
34
|
+
type = "chainId",
|
|
35
|
+
required = true,
|
|
36
|
+
default = 11155111,
|
|
37
|
+
options = { 1, 11155111 },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key = "tokenIn",
|
|
41
|
+
label = "Token In",
|
|
42
|
+
type = "address",
|
|
43
|
+
required = true,
|
|
44
|
+
default = "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
key = "tokenOut",
|
|
48
|
+
label = "Token Out",
|
|
49
|
+
type = "address",
|
|
50
|
+
required = true,
|
|
51
|
+
default = "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
recommendedControls = { "chainId", "tokenIn", "tokenOut" },
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
materialize = function(params)
|
|
58
|
+
local chainId = tonumber(params.chainId or 11155111)
|
|
59
|
+
local tokenIn = tostring(params.tokenIn or "0xfff9976782d46cc05630d1f6ebab18b2324d6b14")
|
|
60
|
+
local tokenOut = tostring(params.tokenOut or "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238")
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
resolvedParams = {
|
|
64
|
+
chainId = chainId,
|
|
65
|
+
tokenIn = tokenIn,
|
|
66
|
+
tokenOut = tokenOut,
|
|
67
|
+
},
|
|
68
|
+
walletPreset = {
|
|
69
|
+
id = "demo_sepolia",
|
|
70
|
+
overrides = {
|
|
71
|
+
chainId = string.format("0x%x", chainId),
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
interceptState = {
|
|
75
|
+
chain = { id = chainId },
|
|
76
|
+
protocol = {
|
|
77
|
+
id = "uniswap_v2",
|
|
78
|
+
version = "v2",
|
|
79
|
+
components = {
|
|
80
|
+
router = "router_02",
|
|
81
|
+
pricing = "pair_reserves",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
pair = {
|
|
85
|
+
tokenIn = tokenIn,
|
|
86
|
+
tokenOut = tokenOut,
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
routeMocks = {},
|
|
90
|
+
}
|
|
91
|
+
end,
|
|
92
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
return {
|
|
2
|
+
manifest = {
|
|
3
|
+
id = "uniswap_v3",
|
|
4
|
+
label = "Uniswap V3",
|
|
5
|
+
description = "Built-in concentrated liquidity DEX preset.",
|
|
6
|
+
kind = "dex",
|
|
7
|
+
supportedChains = { 1, 11155111 },
|
|
8
|
+
protocol = "uniswap",
|
|
9
|
+
version = "v3",
|
|
10
|
+
components = {
|
|
11
|
+
quoter = "v2",
|
|
12
|
+
router = "swap_router_02",
|
|
13
|
+
},
|
|
14
|
+
defaultWalletPreset = {
|
|
15
|
+
id = "demo_sepolia",
|
|
16
|
+
},
|
|
17
|
+
defaultInterceptState = {
|
|
18
|
+
chain = {
|
|
19
|
+
id = 11155111,
|
|
20
|
+
gasPriceGwei = 30,
|
|
21
|
+
},
|
|
22
|
+
protocol = {
|
|
23
|
+
id = "uniswap_v3",
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
defaultRouteMocks = {},
|
|
27
|
+
builtinScenarios = {
|
|
28
|
+
{
|
|
29
|
+
id = "approval_required",
|
|
30
|
+
label = "Approval Required",
|
|
31
|
+
lua = "scenario { name = 'approval_required', given = { wallet = { connected = true } } }",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id = "swap_pending",
|
|
35
|
+
label = "Swap Pending",
|
|
36
|
+
lua = "scenario { name = 'swap_pending', given = { chaos = { pendingForMs = 600000 } } }",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
paramsSchema = {
|
|
40
|
+
{
|
|
41
|
+
key = "chainId",
|
|
42
|
+
label = "Chain",
|
|
43
|
+
type = "chainId",
|
|
44
|
+
required = true,
|
|
45
|
+
default = 11155111,
|
|
46
|
+
options = { 1, 11155111 },
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
key = "tokenIn",
|
|
50
|
+
label = "Token In",
|
|
51
|
+
type = "address",
|
|
52
|
+
required = true,
|
|
53
|
+
default = "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key = "tokenOut",
|
|
57
|
+
label = "Token Out",
|
|
58
|
+
type = "address",
|
|
59
|
+
required = true,
|
|
60
|
+
default = "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
key = "feeTier",
|
|
64
|
+
label = "Fee Tier",
|
|
65
|
+
type = "enum",
|
|
66
|
+
required = true,
|
|
67
|
+
default = 3000,
|
|
68
|
+
options = { 500, 3000, 10000 },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key = "quoter",
|
|
72
|
+
label = "Quoter",
|
|
73
|
+
type = "enum",
|
|
74
|
+
required = true,
|
|
75
|
+
default = "v2",
|
|
76
|
+
options = { "v1", "v2" },
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
recommendedControls = { "chainId", "tokenIn", "tokenOut", "feeTier", "quoter" },
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
materialize = function(params)
|
|
83
|
+
local chainId = tonumber(params.chainId or 11155111)
|
|
84
|
+
local tokenIn = tostring(params.tokenIn or "0xfff9976782d46cc05630d1f6ebab18b2324d6b14")
|
|
85
|
+
local tokenOut = tostring(params.tokenOut or "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238")
|
|
86
|
+
local feeTier = tonumber(params.feeTier or 3000)
|
|
87
|
+
local quoter = tostring(params.quoter or "v2")
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
resolvedParams = {
|
|
91
|
+
chainId = chainId,
|
|
92
|
+
tokenIn = tokenIn,
|
|
93
|
+
tokenOut = tokenOut,
|
|
94
|
+
feeTier = feeTier,
|
|
95
|
+
quoter = quoter,
|
|
96
|
+
},
|
|
97
|
+
walletPreset = {
|
|
98
|
+
id = "demo_sepolia",
|
|
99
|
+
overrides = {
|
|
100
|
+
chainId = string.format("0x%x", chainId),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
walletSessionOverrides = {
|
|
104
|
+
assets = {
|
|
105
|
+
nativeBalance = "1",
|
|
106
|
+
tokens = {
|
|
107
|
+
[string.lower(tokenIn)] = {
|
|
108
|
+
balance = "25",
|
|
109
|
+
allowance = "0",
|
|
110
|
+
symbol = "TOKEN_IN",
|
|
111
|
+
decimals = 18,
|
|
112
|
+
},
|
|
113
|
+
[string.lower(tokenOut)] = {
|
|
114
|
+
balance = "0",
|
|
115
|
+
allowance = "0",
|
|
116
|
+
symbol = "TOKEN_OUT",
|
|
117
|
+
decimals = 18,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
interceptState = {
|
|
123
|
+
chain = {
|
|
124
|
+
id = chainId,
|
|
125
|
+
gasPriceGwei = 30,
|
|
126
|
+
},
|
|
127
|
+
protocol = {
|
|
128
|
+
id = "uniswap_v3",
|
|
129
|
+
version = "v3",
|
|
130
|
+
components = {
|
|
131
|
+
quoter = quoter,
|
|
132
|
+
router = "swap_router_02",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
pool = {
|
|
136
|
+
tokenIn = tokenIn,
|
|
137
|
+
tokenOut = tokenOut,
|
|
138
|
+
feeTier = feeTier,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
routeMocks = {},
|
|
142
|
+
}
|
|
143
|
+
end,
|
|
144
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type PresetDiagnostic, type PresetSource, type ProtocolPresetCatalogEntry, type ProtocolPresetMaterialization, type WalletPresetCatalogEntry, type WalletPresetMaterialization } from "@lunatest/contracts";
|
|
2
|
+
export type PresetSourceInput = string | URL;
|
|
3
|
+
export type ProjectPresetSources = {
|
|
4
|
+
protocol?: Record<string, PresetSourceInput>;
|
|
5
|
+
wallet?: Record<string, PresetSourceInput>;
|
|
6
|
+
};
|
|
7
|
+
export type PresetRegistry = {
|
|
8
|
+
protocolSources: Record<string, {
|
|
9
|
+
source: PresetSource;
|
|
10
|
+
input: PresetSourceInput;
|
|
11
|
+
localId: string;
|
|
12
|
+
}>;
|
|
13
|
+
walletSources: Record<string, {
|
|
14
|
+
source: PresetSource;
|
|
15
|
+
input: PresetSourceInput;
|
|
16
|
+
localId: string;
|
|
17
|
+
}>;
|
|
18
|
+
protocolCache: Map<string, Promise<LoadedProtocolPreset | null>>;
|
|
19
|
+
walletCache: Map<string, Promise<LoadedWalletPreset | null>>;
|
|
20
|
+
diagnostics: Map<string, PresetDiagnostic>;
|
|
21
|
+
protocolQualifiedOwners: Map<string, string>;
|
|
22
|
+
walletQualifiedOwners: Map<string, string>;
|
|
23
|
+
hasProjectSources: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type PresetRegistryOptions = {
|
|
26
|
+
projectSources?: ProjectPresetSources;
|
|
27
|
+
};
|
|
28
|
+
export type ValidatePresetContext = {
|
|
29
|
+
source: PresetSource;
|
|
30
|
+
expectedId: string;
|
|
31
|
+
registry?: PresetRegistry;
|
|
32
|
+
};
|
|
33
|
+
type LoadedProtocolPreset = {
|
|
34
|
+
entry: ProtocolPresetCatalogEntry;
|
|
35
|
+
materialize: (params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
36
|
+
};
|
|
37
|
+
type LoadedWalletPreset = {
|
|
38
|
+
entry: WalletPresetCatalogEntry;
|
|
39
|
+
materialize: (params?: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
40
|
+
};
|
|
41
|
+
export declare function validateProtocolPresetSource(source: PresetSourceInput, context: ValidatePresetContext): Promise<{
|
|
42
|
+
entry: ProtocolPresetCatalogEntry | null;
|
|
43
|
+
diagnostics: PresetDiagnostic[];
|
|
44
|
+
materialize?: LoadedProtocolPreset["materialize"];
|
|
45
|
+
}>;
|
|
46
|
+
export declare function validateWalletPresetSource(source: PresetSourceInput, context: ValidatePresetContext): Promise<{
|
|
47
|
+
entry: WalletPresetCatalogEntry | null;
|
|
48
|
+
diagnostics: PresetDiagnostic[];
|
|
49
|
+
materialize?: LoadedWalletPreset["materialize"];
|
|
50
|
+
}>;
|
|
51
|
+
export declare function createPresetRegistry(options?: PresetRegistryOptions): PresetRegistry;
|
|
52
|
+
export declare function getPresetDiagnostics(registry?: PresetRegistry): Promise<PresetDiagnostic[]>;
|
|
53
|
+
export declare function listProtocolPresets(registry?: PresetRegistry): Promise<ProtocolPresetCatalogEntry[]>;
|
|
54
|
+
export declare function getProtocolPreset(id: string, registry?: PresetRegistry): Promise<ProtocolPresetCatalogEntry | null>;
|
|
55
|
+
export declare function listWalletPresets(registry?: PresetRegistry): Promise<WalletPresetCatalogEntry[]>;
|
|
56
|
+
export declare function getWalletPreset(id: string, registry?: PresetRegistry): Promise<WalletPresetCatalogEntry | null>;
|
|
57
|
+
export declare function materializeWalletPreset(id: string, params?: Record<string, unknown>, registry?: PresetRegistry): Promise<WalletPresetMaterialization>;
|
|
58
|
+
export declare function materializeProtocolPreset(id: string, params?: Record<string, unknown>, registry?: PresetRegistry): Promise<ProtocolPresetMaterialization>;
|
|
59
|
+
export {};
|