@invisible-labs/sdk 0.6.0-devnet.3 → 0.6.0-devnet.4
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 +67 -10
- package/dist/.invisible-sdk-build-target.json +7 -0
- package/dist/{chunk-BWCGNTN5.js → chunk-5NNEO7IK.js} +31 -34
- package/dist/chunk-5NNEO7IK.js.map +1 -0
- package/dist/chunk-BRDLLGCZ.js +59 -0
- package/dist/chunk-BRDLLGCZ.js.map +1 -0
- package/dist/{chunk-NKRVQXRP.js → chunk-E4DCEDAG.js} +121 -11
- package/dist/chunk-E4DCEDAG.js.map +1 -0
- package/dist/{chunk-QQSI3ZD7.js → chunk-UADJCUPK.js} +106 -15
- package/dist/chunk-UADJCUPK.js.map +1 -0
- package/dist/{coordinator-VVJ33WF2.js → coordinator-ZNLGAYXD.js} +3 -3
- package/dist/{coordinator-VVJ33WF2.js.map → coordinator-ZNLGAYXD.js.map} +1 -1
- package/dist/events.js +1 -1
- package/dist/index.d.ts +59 -353
- package/dist/index.js +94 -39
- package/dist/index.js.map +1 -1
- package/dist/lp.d.ts +44 -10
- package/dist/lp.js +211 -71
- package/dist/lp.js.map +1 -1
- package/dist/presets.d.ts +5 -42
- package/dist/presets.js +10 -68
- package/dist/presets.js.map +1 -1
- package/dist/{errors-N2touVm4.d.ts → types.generated-DJBTjLpP.d.ts} +37 -1
- package/dist/user.d.ts +107 -8
- package/dist/user.js +613 -224
- package/dist/user.js.map +1 -1
- package/package.json +2 -31
- package/dist/chunk-BWCGNTN5.js.map +0 -1
- package/dist/chunk-NKRVQXRP.js.map +0 -1
- package/dist/chunk-QQSI3ZD7.js.map +0 -1
- package/dist/types.generated-BSEBz4jR.d.ts +0 -68
package/dist/presets.d.ts
CHANGED
|
@@ -1,43 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** Public coordinator URL conveniences. Policy construction stays internal. */
|
|
2
|
+
declare function invisibleProd(): string;
|
|
3
|
+
declare function invisibleProdAzure(): string;
|
|
4
|
+
declare function invisibleDevnet(): string;
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
* `@invisible-labs/sdk/presets` - optional Invisible coordinator endpoint presets.
|
|
5
|
-
*
|
|
6
|
-
* This is the ONLY module permitted to name an `invisible.exchange` host (spec
|
|
7
|
-
* section 6.2). Partners who self-host ignore it entirely and pass their own
|
|
8
|
-
* `CoordinatorEndpoint[]` to `createSession`. The core never imports this module.
|
|
9
|
-
*
|
|
10
|
-
* Production presets embed an approved Azure TDX boot measurement and trust
|
|
11
|
-
* roots. The caller must provide the separately approved coordinator binary
|
|
12
|
-
* hash before a production endpoint can be constructed. Dormant or
|
|
13
|
-
* development targets keep placeholders until approval.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Production GCP TDX coordinator endpoint.
|
|
18
|
-
*
|
|
19
|
-
* Currently dormant: GCP is neither the live production nor development TEE
|
|
20
|
-
* path. Kept only for a future explicit GCP relight, or a partner self-hosting
|
|
21
|
-
* on GCP.
|
|
22
|
-
*/
|
|
23
|
-
declare function invisibleProdGcp(): CoordinatorEndpoint[];
|
|
24
|
-
/** Production Azure TDX coordinator endpoint for the current prod/devnet release. */
|
|
25
|
-
declare function invisibleProdAzure(approvedBinaryHash: string): CoordinatorEndpoint[];
|
|
26
|
-
/**
|
|
27
|
-
* The currently-active Invisible production preset. Integrators that just want
|
|
28
|
-
* "Invisible prod" use this and stay on whichever cloud is live.
|
|
29
|
-
*
|
|
30
|
-
* Switching the prod target between Azure and GCP is this one line:
|
|
31
|
-
* `export const invisibleProd = invisibleProdAzure` -> `invisibleProdGcp`.
|
|
32
|
-
*/
|
|
33
|
-
declare const invisibleProd: typeof invisibleProdAzure;
|
|
34
|
-
/** Public Invisible devnet, served by the simplified Azure prod coordinator. */
|
|
35
|
-
declare const invisibleDevnet: typeof invisibleProdAzure;
|
|
36
|
-
/** Dormant GCP development coordinator endpoint. Not the active dev target today. */
|
|
37
|
-
declare function invisibleDevGcp(): CoordinatorEndpoint[];
|
|
38
|
-
/** Azure development coordinator endpoint. The active dev TEE today. */
|
|
39
|
-
declare function invisibleDevAzure(): CoordinatorEndpoint[];
|
|
40
|
-
/** The currently-active Invisible development preset. */
|
|
41
|
-
declare const invisibleDev: typeof invisibleDevAzure;
|
|
42
|
-
|
|
43
|
-
export { invisibleDev, invisibleDevAzure, invisibleDevGcp, invisibleDevnet, invisibleProd, invisibleProdAzure, invisibleProdGcp };
|
|
6
|
+
export { invisibleDevnet, invisibleProd, invisibleProdAzure };
|
package/dist/presets.js
CHANGED
|
@@ -1,77 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AZURE_PROD_COORDINATOR_URL } from './chunk-BRDLLGCZ.js';
|
|
2
|
+
import './chunk-DIA6U2CV.js';
|
|
2
3
|
import './chunk-GHBQF3A7.js';
|
|
3
4
|
import './chunk-VR6T6OJS.js';
|
|
4
5
|
|
|
5
|
-
// src/presets
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
jwksUrl: "https://sharedweu.weu.attest.azure.net/certs",
|
|
9
|
-
policyHash: "9NY0VnTQ-IiBriBplVUpFbczcDaEBUwsiFYAzHu_gco"};
|
|
10
|
-
|
|
11
|
-
// src/presets/index.ts
|
|
12
|
-
var PLACEHOLDER_PIN = {
|
|
13
|
-
mrtd: "",
|
|
14
|
-
intelRootFingerprint: ""
|
|
15
|
-
};
|
|
16
|
-
var BINARY_HASH_HEX = /^[0-9a-f]{64}$/i;
|
|
17
|
-
var AZURE_PROD_RELEASE_PIN = {
|
|
18
|
-
mrtd: "a2e61f1316e9e367e9c1f7a0adc98c48eb13875c399c85d286cee5ea2b05e57f2df9f61d903b0ae7ac5607d843dfffc1",
|
|
19
|
-
runtimeProfile: "prod-devnet-simplified",
|
|
20
|
-
intelRootFingerprint: INTEL_SGX_ROOT_CA_FINGERPRINT_SHA256,
|
|
21
|
-
azureMaa: {
|
|
22
|
-
issuer: AZURE_PROD_MAA_TRUST.issuer,
|
|
23
|
-
jwksUrl: AZURE_PROD_MAA_TRUST.jwksUrl,
|
|
24
|
-
policyHash: AZURE_PROD_MAA_TRUST.policyHash
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
function invisibleProdGcp() {
|
|
28
|
-
return [
|
|
29
|
-
{
|
|
30
|
-
wsUrl: "wss://tee.invisible.exchange/ws-noise",
|
|
31
|
-
expectedHostname: "tee.invisible.exchange",
|
|
32
|
-
releasePin: { ...PLACEHOLDER_PIN },
|
|
33
|
-
requiredMode: "prod"
|
|
34
|
-
}
|
|
35
|
-
];
|
|
36
|
-
}
|
|
37
|
-
function invisibleProdAzure(approvedBinaryHash) {
|
|
38
|
-
const binaryHash = typeof approvedBinaryHash === "string" ? approvedBinaryHash.toLowerCase() : "";
|
|
39
|
-
if (!BINARY_HASH_HEX.test(binaryHash)) {
|
|
40
|
-
throw new Error("invisibleProdAzure requires an approved 64-character binary SHA-256 hash");
|
|
41
|
-
}
|
|
42
|
-
return [
|
|
43
|
-
{
|
|
44
|
-
wsUrl: "wss://tee-azure.invisible.exchange/ws-noise",
|
|
45
|
-
expectedHostname: "tee-azure.invisible.exchange",
|
|
46
|
-
releasePin: { ...AZURE_PROD_RELEASE_PIN, binaryHash },
|
|
47
|
-
requiredMode: "prod"
|
|
48
|
-
}
|
|
49
|
-
];
|
|
6
|
+
// src/public-presets.ts
|
|
7
|
+
function invisibleProd() {
|
|
8
|
+
return AZURE_PROD_COORDINATOR_URL;
|
|
50
9
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
function invisibleDevGcp() {
|
|
54
|
-
return [
|
|
55
|
-
{
|
|
56
|
-
wsUrl: "wss://tee-dev.invisible.exchange/ws-noise",
|
|
57
|
-
expectedHostname: "tee-dev.invisible.exchange",
|
|
58
|
-
releasePin: { ...PLACEHOLDER_PIN },
|
|
59
|
-
requiredMode: "dev"
|
|
60
|
-
}
|
|
61
|
-
];
|
|
10
|
+
function invisibleProdAzure() {
|
|
11
|
+
return AZURE_PROD_COORDINATOR_URL;
|
|
62
12
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
-
{
|
|
66
|
-
wsUrl: "wss://tee-azure-dev.invisible.exchange/ws-noise",
|
|
67
|
-
expectedHostname: "tee-azure-dev.invisible.exchange",
|
|
68
|
-
releasePin: { ...PLACEHOLDER_PIN },
|
|
69
|
-
requiredMode: "dev"
|
|
70
|
-
}
|
|
71
|
-
];
|
|
13
|
+
function invisibleDevnet() {
|
|
14
|
+
return AZURE_PROD_COORDINATOR_URL;
|
|
72
15
|
}
|
|
73
|
-
var invisibleDev = invisibleDevAzure;
|
|
74
16
|
|
|
75
|
-
export {
|
|
17
|
+
export { invisibleDevnet, invisibleProd, invisibleProdAzure };
|
|
76
18
|
//# sourceMappingURL=presets.js.map
|
|
77
19
|
//# sourceMappingURL=presets.js.map
|
package/dist/presets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/public-presets.ts"],"names":[],"mappings":";;;;;;AAIO,SAAS,aAAA,GAAwB;AACtC,EAAA,OAAO,0BAAA;AACT;AAEO,SAAS,kBAAA,GAA6B;AAC3C,EAAA,OAAO,0BAAA;AACT;AAEO,SAAS,eAAA,GAA0B;AACxC,EAAA,OAAO,0BAAA;AACT","file":"presets.js","sourcesContent":["/** Public coordinator URL conveniences. Policy construction stays internal. */\n\nimport { AZURE_PROD_COORDINATOR_URL } from \"./presets/production.js\";\n\nexport function invisibleProd(): string {\n return AZURE_PROD_COORDINATOR_URL;\n}\n\nexport function invisibleProdAzure(): string {\n return AZURE_PROD_COORDINATOR_URL;\n}\n\nexport function invisibleDevnet(): string {\n return AZURE_PROD_COORDINATOR_URL;\n}\n"]}
|
|
@@ -122,4 +122,40 @@ declare function isInvisibleError(value: unknown): value is InvisibleError;
|
|
|
122
122
|
*/
|
|
123
123
|
declare function normalizeError(error: unknown, fallback?: string): string;
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
type LpPositionView = {
|
|
126
|
+
readonly id: string;
|
|
127
|
+
readonly status: "dkg_pending" | "active" | "withdrawing" | "closed";
|
|
128
|
+
readonly targetShardCount: number;
|
|
129
|
+
readonly authPublicKey: string;
|
|
130
|
+
readonly refillPublicKey: string;
|
|
131
|
+
readonly withdrawalCommitment: string;
|
|
132
|
+
readonly committedLamports: number;
|
|
133
|
+
readonly earnedLamports: number;
|
|
134
|
+
readonly refillThreshold: number;
|
|
135
|
+
readonly shards: readonly {
|
|
136
|
+
readonly [key: string]: unknown;
|
|
137
|
+
}[];
|
|
138
|
+
readonly createdAt: number;
|
|
139
|
+
};
|
|
140
|
+
type PayoutDestination = {
|
|
141
|
+
readonly address: string;
|
|
142
|
+
readonly sharePercent: number;
|
|
143
|
+
readonly minDelayMs?: number;
|
|
144
|
+
readonly maxDelayMs?: number;
|
|
145
|
+
readonly minLamports?: number;
|
|
146
|
+
};
|
|
147
|
+
type PayoutPolicy = {
|
|
148
|
+
readonly destinations: readonly PayoutDestination[];
|
|
149
|
+
readonly totalDeadlineMs?: number;
|
|
150
|
+
readonly batchExclusionId?: string;
|
|
151
|
+
};
|
|
152
|
+
type StorageEnvelope = {
|
|
153
|
+
readonly namespace: string;
|
|
154
|
+
readonly key: string;
|
|
155
|
+
readonly alg: "AES-GCM" | "none";
|
|
156
|
+
readonly ciphertext: string;
|
|
157
|
+
readonly iv?: string;
|
|
158
|
+
readonly createdAtMs: number;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export { AttestationError as A, CommandError as C, InvalidDepositAmountError as I, LpLifecycleError as L, NotImplementedError as N, type PayoutPolicy as P, RoutingError as R, type StorageEnvelope as S, TransportError as T, WalletError as W, type AttestationErrorCode as a, type CommandErrorCode as b, type CommandErrorOptions as c, type CoordinatorWireErrorCode as d, InvisibleError as e, type InvisibleErrorCode as f, type InvisibleErrorOptions as g, type LpLifecycleErrorCode as h, type LpPositionView as i, type NotImplementedErrorCode as j, type PayoutDestination as k, PolicyValidationError as l, type PolicyValidationErrorCode as m, type RoutingErrorCode as n, StorageError as o, type StorageErrorCode as p, type TransportErrorCode as q, type WalletErrorCode as r, isInvisibleError as s, normalizeError as t };
|
package/dist/user.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { S as Session } from './session-DFuy54C-.js';
|
|
2
|
-
import { P as PayoutPolicy } from './types.generated-
|
|
3
|
-
export { I as InvalidDepositAmountError } from './
|
|
2
|
+
import { P as PayoutPolicy } from './types.generated-DJBTjLpP.js';
|
|
3
|
+
export { I as InvalidDepositAmountError } from './types.generated-DJBTjLpP.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Acceptance receipts (spec section 8.2).
|
|
@@ -19,6 +19,15 @@ interface AcceptanceReceipt {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
type ClientSwapState = "new" | "awaiting_dkg" | "awaiting_deposit" | "awaiting_delegation" | "awaiting_delegate_ack" | "awaiting_delegate_ack_after_deposit" | "ready_for_settlement" | "settling" | "completed" | "refunded" | "failed";
|
|
22
|
+
type PayoutSpec = {
|
|
23
|
+
readonly mode: "instant";
|
|
24
|
+
readonly destination_address: string;
|
|
25
|
+
} | {
|
|
26
|
+
readonly mode: "scheduled";
|
|
27
|
+
readonly num_fragments: number;
|
|
28
|
+
readonly window_seconds: number;
|
|
29
|
+
readonly destination_addresses: readonly string[];
|
|
30
|
+
};
|
|
22
31
|
type SpendingPolicySnapshot = {
|
|
23
32
|
readonly asset: "SOL";
|
|
24
33
|
readonly entry_amount_lamports: number;
|
|
@@ -62,14 +71,16 @@ type PayoutWindowSyncSnapshot = {
|
|
|
62
71
|
readonly deadline_ms: number | null;
|
|
63
72
|
};
|
|
64
73
|
type NormalUserContractStatus = "deposit" | "activating" | "active" | "settling" | "completed" | "refunded" | "expired";
|
|
65
|
-
type NormalUserSettlementPhase = "awaiting_deposit" | "activating" | "waiting_for_liquidity" | "matched_scheduled" | "locked_pending_payout" | "submitted" | "confirming" | "completed" | "refund_pending" | "refunded" | "expired";
|
|
74
|
+
type NormalUserSettlementPhase = "awaiting_deposit" | "activating" | "waiting_for_liquidity" | "retry_delayed" | "recovery_required" | "matched_scheduled" | "locked_pending_payout" | "submitted" | "confirming" | "completed" | "refund_pending" | "refunded" | "expired";
|
|
66
75
|
type NormalUserRefundability = "available_now" | "request_pending" | "blocked_by_lock" | "stale" | "unavailable";
|
|
76
|
+
type NormalUserRefundStatus = "queued" | "reserved" | "submitted" | "confirming" | "retrying" | "finalized" | "failed" | "partial" | "canceled";
|
|
67
77
|
type SourceLiquidityUse = "not_materialized" | "available" | "locked_for_payout" | "pending_finality" | "spent" | "released";
|
|
68
78
|
type NormalUserContractSyncSnapshot = {
|
|
69
79
|
readonly contract_id: string;
|
|
70
80
|
readonly status: NormalUserContractStatus;
|
|
71
81
|
readonly settlement_phase: NormalUserSettlementPhase;
|
|
72
82
|
readonly refundability: NormalUserRefundability;
|
|
83
|
+
readonly refund_status: NormalUserRefundStatus | null;
|
|
73
84
|
readonly source_liquidity_use: SourceLiquidityUse;
|
|
74
85
|
readonly destination_wallet: string | null;
|
|
75
86
|
readonly deposit_amount_lamports: number;
|
|
@@ -79,6 +90,7 @@ type NormalUserContractSyncSnapshot = {
|
|
|
79
90
|
readonly settled_amount_lamports: number;
|
|
80
91
|
readonly protocol_fee_lamports: number;
|
|
81
92
|
readonly network_fee_lost_lamports: readonly number[];
|
|
93
|
+
readonly recovery_refund_remaining_lamports: number;
|
|
82
94
|
readonly withdrawal_requested_lamports: number;
|
|
83
95
|
readonly withdrawal_landed_lamports: number;
|
|
84
96
|
readonly withdrawal_landed_fee_lamports: number;
|
|
@@ -115,6 +127,45 @@ type RefundAcceptanceReceipt = AcceptanceReceipt & {
|
|
|
115
127
|
readonly amountLamports: number;
|
|
116
128
|
readonly acceptedAtMs?: number;
|
|
117
129
|
};
|
|
130
|
+
type RunSwapParams = {
|
|
131
|
+
amountLamports: number;
|
|
132
|
+
payoutSpec: PayoutSpec;
|
|
133
|
+
payoutDeadlineMs?: number;
|
|
134
|
+
onPolicySnapshot?: (policy: SpendingPolicySnapshot) => void;
|
|
135
|
+
recoveryCommitment?: Uint8Array;
|
|
136
|
+
syncSecret?: Uint8Array;
|
|
137
|
+
onSyncSecretReady?: (info: {
|
|
138
|
+
secretHex: string;
|
|
139
|
+
}) => void | Promise<void>;
|
|
140
|
+
resumeSecret?: Uint8Array;
|
|
141
|
+
onResumeSecretReady?: (info: {
|
|
142
|
+
secretHex: string;
|
|
143
|
+
}) => void | Promise<void>;
|
|
144
|
+
onSwapAllocated?: (info: {
|
|
145
|
+
swapId: string;
|
|
146
|
+
syncSecretHex: string;
|
|
147
|
+
resumeSecretHex: string;
|
|
148
|
+
}) => void | Promise<void>;
|
|
149
|
+
onRecoveryCodeReady?: (info: {
|
|
150
|
+
codeHex: string;
|
|
151
|
+
}) => void | Promise<void>;
|
|
152
|
+
onDelegateShareReady?: (info: {
|
|
153
|
+
swapId: string;
|
|
154
|
+
delegateShare: Uint8Array;
|
|
155
|
+
}) => void | Promise<void>;
|
|
156
|
+
delegateShare?: Uint8Array;
|
|
157
|
+
onDepositAddressReady?: (info: {
|
|
158
|
+
swapId: string;
|
|
159
|
+
jointPublicKey: Uint8Array;
|
|
160
|
+
amountLamports: number;
|
|
161
|
+
depositExpiresAtMs: number;
|
|
162
|
+
coordinatorTimestampMs: number;
|
|
163
|
+
}) => void | Promise<void>;
|
|
164
|
+
onDepositConfirmed?: (info: {
|
|
165
|
+
originAddress: string | undefined;
|
|
166
|
+
}) => void | Promise<void>;
|
|
167
|
+
payoutWindowMs?: number;
|
|
168
|
+
};
|
|
118
169
|
/**
|
|
119
170
|
* Details returned once the coordinator has accepted, initialized, and
|
|
120
171
|
* durably delegated a contract, but before the user's deposit is observed.
|
|
@@ -134,11 +185,34 @@ type ContractRequestResult = {
|
|
|
134
185
|
/** The read-only status secret. The caller must persist it if it needs sync. */
|
|
135
186
|
readonly syncSecret: Uint8Array;
|
|
136
187
|
readonly syncSecretHex: string;
|
|
188
|
+
/** The pre-delegation mutation secret. Persist it only for resume/recovery workflows. */
|
|
189
|
+
readonly resumeSecret: Uint8Array;
|
|
190
|
+
readonly resumeSecretHex: string;
|
|
137
191
|
/** Present when the SDK generated the Recovery Code for this request. */
|
|
138
192
|
readonly recoveryCodeHex?: string;
|
|
139
193
|
readonly policySnapshot: SpendingPolicySnapshot;
|
|
140
194
|
readonly delegatePolicySnapshot: SpendingPolicySnapshot;
|
|
141
195
|
};
|
|
196
|
+
/** Inputs for resuming an already allocated pre-delegation contract. */
|
|
197
|
+
type ResumePreDelegationParams = {
|
|
198
|
+
readonly swapId: string;
|
|
199
|
+
readonly resumeSecret: Uint8Array;
|
|
200
|
+
readonly syncSecret?: Uint8Array;
|
|
201
|
+
readonly recoveryCommitment: Uint8Array;
|
|
202
|
+
/** The policy snapshot persisted when the contract was first allocated. */
|
|
203
|
+
readonly policySnapshot: SpendingPolicySnapshot;
|
|
204
|
+
/** Called before DkgRound2 so recovery can persist the generated Alice share. */
|
|
205
|
+
readonly onDelegateShareReady?: RunSwapParams["onDelegateShareReady"];
|
|
206
|
+
/** Supply the previously generated Alice share when DKG was already sealed. */
|
|
207
|
+
readonly delegateShare?: Uint8Array;
|
|
208
|
+
};
|
|
209
|
+
type ResumePreDelegationResult = {
|
|
210
|
+
readonly swapId: string;
|
|
211
|
+
readonly jointPublicKey?: Uint8Array;
|
|
212
|
+
readonly depositExpiresAtMs?: number;
|
|
213
|
+
readonly coordinatorTimestampMs?: number;
|
|
214
|
+
readonly delegatedAtMs: number;
|
|
215
|
+
};
|
|
142
216
|
|
|
143
217
|
/**
|
|
144
218
|
* Payout policy validation (spec sections 4.3.1 and 10.1).
|
|
@@ -214,12 +288,29 @@ interface ContractRequestArgs {
|
|
|
214
288
|
readonly onSyncSecretReady?: (info: {
|
|
215
289
|
secretHex: string;
|
|
216
290
|
}) => void | Promise<void>;
|
|
291
|
+
/** Optional precomputed pre-delegation mutation secret, copied before it reaches the wire. */
|
|
292
|
+
readonly resumeSecret?: Uint8Array;
|
|
293
|
+
/** Called before ContractRequest so the caller can persist the resume secret. */
|
|
294
|
+
readonly onResumeSecretReady?: (info: {
|
|
295
|
+
secretHex: string;
|
|
296
|
+
}) => void | Promise<void>;
|
|
297
|
+
/** Called after allocation so the caller can persist both secrets with the swap id. */
|
|
298
|
+
readonly onSwapAllocated?: (info: {
|
|
299
|
+
swapId: string;
|
|
300
|
+
syncSecretHex: string;
|
|
301
|
+
resumeSecretHex: string;
|
|
302
|
+
}) => void | Promise<void>;
|
|
217
303
|
/** Optional precomputed Recovery Code commitment for caller-managed recovery. */
|
|
218
304
|
readonly recoveryCommitment?: Uint8Array;
|
|
219
305
|
/** Called before DelegateShare so the caller can persist the generated code. */
|
|
220
306
|
readonly onRecoveryCodeReady?: (info: {
|
|
221
307
|
codeHex: string;
|
|
222
308
|
}) => void | Promise<void>;
|
|
309
|
+
/** Called before DkgRound2 so the caller can persist the generated Alice share. */
|
|
310
|
+
readonly onDelegateShareReady?: (info: {
|
|
311
|
+
swapId: string;
|
|
312
|
+
delegateShare: Uint8Array;
|
|
313
|
+
}) => void | Promise<void>;
|
|
223
314
|
}
|
|
224
315
|
/**
|
|
225
316
|
* Start a new pool entry through the current normal-user coordinator flow.
|
|
@@ -235,18 +326,26 @@ interface ContractRequestArgs {
|
|
|
235
326
|
* session cannot complete the DKG/delegation boundary.
|
|
236
327
|
*/
|
|
237
328
|
declare function contractRequest(session: Session, args: ContractRequestArgs): Promise<ContractRequestResult>;
|
|
329
|
+
/** Resume pre-delegation DKG or delegation on a caller-owned Session. */
|
|
330
|
+
declare function resumePreDelegation(session: Session, args: ResumePreDelegationParams): Promise<ResumePreDelegationResult>;
|
|
238
331
|
/** Read the actor-scoped lifecycle projection for a normal-user contract. */
|
|
239
332
|
declare function sync(session: Session, contractId: string, syncSecret: Uint8Array, timeoutMs?: number): Promise<SyncUserResponse>;
|
|
240
333
|
/** Arguments to refund a pool entry with the Recovery Code preimage. */
|
|
241
334
|
interface RequestRefundArgs {
|
|
335
|
+
/** Optional contract correlation required when multiple contracts share one Session. */
|
|
336
|
+
readonly swapId?: string;
|
|
337
|
+
/** Optional status secret used to restore the correlated contract context. */
|
|
338
|
+
readonly syncSecret?: Uint8Array;
|
|
242
339
|
/** The 32-byte Recovery Code preimage. */
|
|
243
340
|
readonly recoveryCode: Uint8Array;
|
|
244
341
|
}
|
|
245
342
|
/**
|
|
246
|
-
* Submit a normal-user `withdraw_request` with
|
|
247
|
-
* (`{ recovery_code }`).
|
|
248
|
-
*
|
|
249
|
-
*
|
|
343
|
+
* Submit a normal-user `withdraw_request` with the Recovery Code preimage
|
|
344
|
+
* (`{ recovery_code }`). Pass `swapId` and `syncSecret` when multiple contracts
|
|
345
|
+
* share one Session so the request is correlated to the intended contract.
|
|
346
|
+
* The coordinator queues a durable origin-bound withdrawal intent and terminal
|
|
347
|
+
* outcome is recovered through sync/status reads. No caller-supplied destination
|
|
348
|
+
* is accepted.
|
|
250
349
|
*
|
|
251
350
|
* @returns An acceptance receipt keyed by the resolved V0 `swapId`, including
|
|
252
351
|
* the coordinator-authoritative amount accepted for withdrawal. The
|
|
@@ -257,4 +356,4 @@ interface RequestRefundArgs {
|
|
|
257
356
|
*/
|
|
258
357
|
declare function requestRefund(session: Session, args: RequestRefundArgs): Promise<RefundAcceptanceReceipt>;
|
|
259
358
|
|
|
260
|
-
export { type ContractRequestArgs, type ContractRequestResult, INSTANT_PAYOUT_WINDOW_MS, MAX_ENTRY_AMOUNT_LAMPORTS, MIN_ENTRY_AMOUNT_LAMPORTS, type NormalUserActorSyncSnapshot, type NormalUserRefundability, type NormalUserSettlementPhase, PAYOUT_WINDOW_MILLISECONDS_PER_SECOND, type PayoutExecutedPayload, RECOVERY_CODE_BYTE_LENGTH, type RefundAcceptanceReceipt, type RefundExecutedPayload, type RequestRefundArgs, SUPPORTED_TOTAL_DEADLINE_MS, type SourceLiquidityUse, type SpendingPolicySnapshot, type SyncUserResponse, type SyncUserResponsePayload, type WithdrawExecutedPayload, commitmentFromCode, contractRequest, generateRecoveryCode, recoveryCodeFromHex, recoveryCodeFromUserInput, recoveryCodeToHex, requestRefund, sync };
|
|
359
|
+
export { type ContractRequestArgs, type ContractRequestResult, INSTANT_PAYOUT_WINDOW_MS, MAX_ENTRY_AMOUNT_LAMPORTS, MIN_ENTRY_AMOUNT_LAMPORTS, type NormalUserActorSyncSnapshot, type NormalUserRefundability, type NormalUserSettlementPhase, PAYOUT_WINDOW_MILLISECONDS_PER_SECOND, type PayoutExecutedPayload, RECOVERY_CODE_BYTE_LENGTH, type RefundAcceptanceReceipt, type RefundExecutedPayload, type RequestRefundArgs, type ResumePreDelegationParams, type ResumePreDelegationResult, SUPPORTED_TOTAL_DEADLINE_MS, type SourceLiquidityUse, type SpendingPolicySnapshot, type SyncUserResponse, type SyncUserResponsePayload, type WithdrawExecutedPayload, commitmentFromCode, contractRequest, generateRecoveryCode, recoveryCodeFromHex, recoveryCodeFromUserInput, recoveryCodeToHex, requestRefund, resumePreDelegation, sync };
|