@arkade-os/sdk 0.4.56 → 0.4.57
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/adapters/expo.cjs +5 -5
- package/dist/adapters/expo.d.cts +2 -2
- package/dist/adapters/expo.d.ts +2 -2
- package/dist/adapters/expo.js +3 -3
- package/dist/adapters/indexedDB.cjs +5 -5
- package/dist/adapters/indexedDB.js +4 -4
- package/dist/{ark-Cgsd9tMd.d.cts → ark-CJgH_pmn.d.cts} +20 -1
- package/dist/{ark-Cgsd9tMd.d.ts → ark-CJgH_pmn.d.ts} +20 -1
- package/dist/{asyncStorageTaskQueue-CXz4PRBW.d.ts → asyncStorageTaskQueue-BeeZbf-Q.d.ts} +2 -2
- package/dist/{asyncStorageTaskQueue-C0ZsDE60.d.cts → asyncStorageTaskQueue-BlrsUUX_.d.cts} +2 -2
- package/dist/{chunk-IMVKQQHU.cjs → chunk-A7TOVUYG.cjs} +9 -9
- package/dist/{chunk-IMVKQQHU.cjs.map → chunk-A7TOVUYG.cjs.map} +1 -1
- package/dist/{chunk-NN7BNNF5.js → chunk-ASUJNZ63.js} +3 -3
- package/dist/{chunk-NN7BNNF5.js.map → chunk-ASUJNZ63.js.map} +1 -1
- package/dist/{chunk-5IMBONCK.js → chunk-C4SVRVNM.js} +4 -4
- package/dist/{chunk-5IMBONCK.js.map → chunk-C4SVRVNM.js.map} +1 -1
- package/dist/{chunk-VNDVUM2W.js → chunk-CPS7V4A3.js} +4 -4
- package/dist/{chunk-VNDVUM2W.js.map → chunk-CPS7V4A3.js.map} +1 -1
- package/dist/{chunk-MXPBHDOI.cjs → chunk-EZBKSWEL.cjs} +17 -17
- package/dist/{chunk-MXPBHDOI.cjs.map → chunk-EZBKSWEL.cjs.map} +1 -1
- package/dist/{chunk-ENRRZFZ4.cjs → chunk-KEG4AAKX.cjs} +511 -409
- package/dist/chunk-KEG4AAKX.cjs.map +1 -0
- package/dist/{chunk-CDWLZQQW.cjs → chunk-KUN5ZRMW.cjs} +4 -3
- package/dist/chunk-KUN5ZRMW.cjs.map +1 -0
- package/dist/{chunk-T22257HW.js → chunk-NIZPFPUM.js} +136 -44
- package/dist/chunk-NIZPFPUM.js.map +1 -0
- package/dist/{chunk-37XKN5DZ.cjs → chunk-OWTKOMJZ.cjs} +40 -40
- package/dist/{chunk-37XKN5DZ.cjs.map → chunk-OWTKOMJZ.cjs.map} +1 -1
- package/dist/{chunk-OOPDT2WV.js → chunk-P6L2W5IL.js} +3 -3
- package/dist/{chunk-OOPDT2WV.js.map → chunk-P6L2W5IL.js.map} +1 -1
- package/dist/{chunk-IFGN2GB2.js → chunk-PUNBWFIV.js} +4 -3
- package/dist/chunk-PUNBWFIV.js.map +1 -0
- package/dist/{chunk-24YNIQSW.cjs → chunk-YK6NP5KX.cjs} +15 -15
- package/dist/{chunk-24YNIQSW.cjs.map → chunk-YK6NP5KX.cjs.map} +1 -1
- package/dist/contracts/handlers/index.cjs +8 -8
- package/dist/contracts/handlers/index.d.cts +3 -3
- package/dist/contracts/handlers/index.d.ts +3 -3
- package/dist/contracts/handlers/index.js +2 -2
- package/dist/{delegate-CZPXtd2F.d.ts → delegate-DM3YECSY.d.ts} +1 -1
- package/dist/{delegate-xXT8O-Kn.d.cts → delegate-Dk-OJVdf.d.cts} +1 -1
- package/dist/{index-BYG2eKOA.d.cts → index-Cig0RkTf.d.cts} +2 -2
- package/dist/{index-BBJ466mM.d.ts → index-CnE7Gnvb.d.ts} +2 -2
- package/dist/index.cjs +253 -213
- package/dist/index.d.cts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +19 -19
- package/dist/repositories/realm/index.d.cts +2 -2
- package/dist/repositories/realm/index.d.ts +2 -2
- package/dist/repositories/realm/index.js +5 -5
- package/dist/repositories/sqlite/index.cjs +18 -18
- package/dist/repositories/sqlite/index.d.cts +2 -2
- package/dist/repositories/sqlite/index.d.ts +2 -2
- package/dist/repositories/sqlite/index.js +5 -5
- package/dist/{taskRunner-BG1PRFps.d.cts → taskRunner-CnGSTaAJ.d.cts} +2 -2
- package/dist/{taskRunner-C46NnRsY.d.ts → taskRunner-F7tWzsrC.d.ts} +2 -2
- package/dist/wallet/expo/background.cjs +14 -14
- package/dist/wallet/expo/background.d.cts +3 -3
- package/dist/wallet/expo/background.d.ts +3 -3
- package/dist/wallet/expo/background.js +6 -6
- package/dist/wallet/expo/index.cjs +14 -14
- package/dist/wallet/expo/index.d.cts +4 -4
- package/dist/wallet/expo/index.d.ts +4 -4
- package/dist/wallet/expo/index.js +5 -5
- package/dist/{wallet-DuCm55EC.d.ts → wallet-D6_S0n6B.d.ts} +107 -4
- package/dist/{wallet-1yWg75gN.d.cts → wallet-DvRIQBBY.d.cts} +107 -4
- package/dist/worker/expo/index.cjs +9 -9
- package/dist/worker/expo/index.d.cts +4 -4
- package/dist/worker/expo/index.d.ts +4 -4
- package/dist/worker/expo/index.js +5 -5
- package/package.json +1 -1
- package/dist/chunk-CDWLZQQW.cjs.map +0 -1
- package/dist/chunk-ENRRZFZ4.cjs.map +0 -1
- package/dist/chunk-IFGN2GB2.js.map +0 -1
- package/dist/chunk-T22257HW.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-
|
|
2
|
-
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-
|
|
3
|
-
import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, canSpendOffchain, toVirtualStatus, ArkError, resolveTimeHeight, parseLegacyExpiry, isExpired, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-
|
|
1
|
+
import { AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, Packet, BufferReader, BufferWriter, AssetRef, RestIndexerProvider } from './chunk-ASUJNZ63.js';
|
|
2
|
+
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, inputName, contractHandlers, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, DefaultVtxo, speculativeReceiveMetadata, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-P6L2W5IL.js';
|
|
3
|
+
import { VtxoScript, Transaction, isRecoverable, CSVMultisigTapscript, DEFAULT_NETWORK, hasTerminalSpend, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, OP_RETURN_EMPTY_PKSCRIPT, sequenceToTimelock, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, timelockToSequence, baseFetch, Intent, rateGate, DEFAULT_NETWORK_NAME, normalizeVtxo, getSequence, toBatchExpiry, maybeArkError, isArkError, ArkErrorName, toOffchainInputFeeParams, canRecoverOnchain, getNetwork, MultisigTapscript, isEventSourceError, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, RestArkProvider, canSpendOffchain, toVirtualStatus, ArkError, resolveTimeHeight, parseLegacyExpiry, isExpired, DEFAULT_ARKADE_SERVER_URL, ProviderUnavailableError, networks as networks$1, isPastExpiry, fetchVtxoCreatedAtByTxid } from './chunk-PUNBWFIV.js';
|
|
4
4
|
import { __export } from './chunk-NSBPE2FW.js';
|
|
5
5
|
import { sha256, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
|
|
6
6
|
import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$2 } from '@scure/btc-signer';
|
|
@@ -2304,6 +2304,83 @@ function classifyContractSigner(contractServerPubKeyHex, info, nowSeconds = Math
|
|
|
2304
2304
|
function isCooperativelyMigratable(status) {
|
|
2305
2305
|
return status === "MIGRATABLE" || status === "DUE_NOW";
|
|
2306
2306
|
}
|
|
2307
|
+
|
|
2308
|
+
// src/wallet/timelockPolicy.ts
|
|
2309
|
+
var isRegtest = (network) => network.bech32 === "bcrt";
|
|
2310
|
+
var NOMINAL_BLOCK_SECONDS = 600n;
|
|
2311
|
+
var toTimelock = (value) => ({
|
|
2312
|
+
value,
|
|
2313
|
+
type: value >= 512n ? "seconds" : "blocks"
|
|
2314
|
+
});
|
|
2315
|
+
var toSeconds = (t) => t.type === "seconds" ? t.value : t.value * NOMINAL_BLOCK_SECONDS;
|
|
2316
|
+
function assertTimelockInPolicy(timelock, policy, label) {
|
|
2317
|
+
if (policy.requireSeconds && timelock.type === "blocks") {
|
|
2318
|
+
throw new ServerResponseMismatchError(
|
|
2319
|
+
`${label} rejected: block-typed timelocks are not accepted (got ${timelock.value})`
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
const seconds = toSeconds(timelock);
|
|
2323
|
+
if (seconds < policy.minSeconds) {
|
|
2324
|
+
throw new ServerResponseMismatchError(
|
|
2325
|
+
`${label} rejected: ${timelock.value} ${timelock.type} is below the ${policy.minSeconds}s floor`
|
|
2326
|
+
);
|
|
2327
|
+
}
|
|
2328
|
+
return timelock;
|
|
2329
|
+
}
|
|
2330
|
+
function assertTimelockWithinFloor(value, policy, label) {
|
|
2331
|
+
return assertTimelockInPolicy(toTimelock(value), policy, label);
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
// src/wallet/batchExpiry.ts
|
|
2335
|
+
var DEFAULT_MIN_BATCH_EXPIRY_SECONDS = 86400n;
|
|
2336
|
+
var REGTEST_MIN_BATCH_EXPIRY_SECONDS = 6000n;
|
|
2337
|
+
function defaultBatchExpiryPolicy(network) {
|
|
2338
|
+
return isRegtest(network) ? { minSeconds: REGTEST_MIN_BATCH_EXPIRY_SECONDS, requireSeconds: false } : { minSeconds: DEFAULT_MIN_BATCH_EXPIRY_SECONDS, requireSeconds: true };
|
|
2339
|
+
}
|
|
2340
|
+
function resolveBatchExpiryPolicy(network, overrides) {
|
|
2341
|
+
return { ...defaultBatchExpiryPolicy(network), ...overrides };
|
|
2342
|
+
}
|
|
2343
|
+
function assertValidBatchExpiry(batchExpiry, policy) {
|
|
2344
|
+
if (policy.advertisedVtxoTreeExpiry !== void 0 && batchExpiry !== policy.advertisedVtxoTreeExpiry) {
|
|
2345
|
+
throw new ServerResponseMismatchError(
|
|
2346
|
+
`batch expiry rejected: ${batchExpiry} does not match the advertised vtxoTreeExpiry ${policy.advertisedVtxoTreeExpiry}`
|
|
2347
|
+
);
|
|
2348
|
+
}
|
|
2349
|
+
return assertTimelockWithinFloor(batchExpiry, policy, "batch expiry");
|
|
2350
|
+
}
|
|
2351
|
+
var DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 86400n;
|
|
2352
|
+
var REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS = 1200n;
|
|
2353
|
+
function defaultCheckpointExitDelayPolicy(network) {
|
|
2354
|
+
return isRegtest(network) ? { minSeconds: REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, requireSeconds: false } : { minSeconds: DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, requireSeconds: true };
|
|
2355
|
+
}
|
|
2356
|
+
function resolveCheckpointExitDelayPolicy(network, overrides) {
|
|
2357
|
+
return { ...defaultCheckpointExitDelayPolicy(network), ...overrides };
|
|
2358
|
+
}
|
|
2359
|
+
function assertValidServerUnrollScript(checkpointTapscript, policy) {
|
|
2360
|
+
let script;
|
|
2361
|
+
try {
|
|
2362
|
+
script = CSVMultisigTapscript.decode(hex.decode(checkpointTapscript));
|
|
2363
|
+
} catch (e) {
|
|
2364
|
+
throw new ServerResponseMismatchError(
|
|
2365
|
+
`checkpoint exit delay rejected: invalid checkpointTapscript from server (${e instanceof Error ? e.message : String(e)})`
|
|
2366
|
+
);
|
|
2367
|
+
}
|
|
2368
|
+
if (policy.advertisedForfeitPubkey !== void 0) {
|
|
2369
|
+
const { pubkeys } = script.params;
|
|
2370
|
+
if (pubkeys.length !== 1) {
|
|
2371
|
+
throw new ServerResponseMismatchError(
|
|
2372
|
+
`checkpoint exit delay rejected: checkpointTapscript must commit to exactly one pubkey, got ${pubkeys.length} [${pubkeys.map(hex.encode).join(", ")}]`
|
|
2373
|
+
);
|
|
2374
|
+
}
|
|
2375
|
+
if (!equalBytes(pubkeys[0], policy.advertisedForfeitPubkey)) {
|
|
2376
|
+
throw new ServerResponseMismatchError(
|
|
2377
|
+
`checkpoint exit delay rejected: checkpointTapscript pubkey ${hex.encode(pubkeys[0])} does not match the advertised forfeitPubkey ${hex.encode(policy.advertisedForfeitPubkey)}`
|
|
2378
|
+
);
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
assertTimelockInPolicy(script.params.timelock, policy, "checkpoint exit delay");
|
|
2382
|
+
return script;
|
|
2383
|
+
}
|
|
2307
2384
|
function buildOffchainTx(inputs, outputs, serverUnrollScript) {
|
|
2308
2385
|
const MAX_OP_RETURN = 2;
|
|
2309
2386
|
let countOpReturn = 0;
|
|
@@ -5218,6 +5295,7 @@ function serializeArkInfoSnapshot(info, savedAt) {
|
|
|
5218
5295
|
forfeitPubkey: info.forfeitPubkey,
|
|
5219
5296
|
unilateralExitDelay: info.unilateralExitDelay.toString(),
|
|
5220
5297
|
boardingExitDelay: info.boardingExitDelay.toString(),
|
|
5298
|
+
vtxoTreeExpiry: info.vtxoTreeExpiry?.toString(),
|
|
5221
5299
|
sessionDuration: info.sessionDuration.toString(),
|
|
5222
5300
|
dust: info.dust.toString(),
|
|
5223
5301
|
fees: info.fees,
|
|
@@ -5267,6 +5345,7 @@ function hydrateArkInfo(snapshot) {
|
|
|
5267
5345
|
sessionDuration: BigInt(a.sessionDuration),
|
|
5268
5346
|
signerPubkey: a.signerPubkey,
|
|
5269
5347
|
unilateralExitDelay: BigInt(a.unilateralExitDelay),
|
|
5348
|
+
vtxoTreeExpiry: a.vtxoTreeExpiry !== void 0 ? BigInt(a.vtxoTreeExpiry) : void 0,
|
|
5270
5349
|
utxoMaxAmount: BigInt(a.utxoMaxAmount),
|
|
5271
5350
|
utxoMinAmount: BigInt(a.utxoMinAmount),
|
|
5272
5351
|
version: a.version,
|
|
@@ -5339,6 +5418,9 @@ function parseStoredArkInfoSnapshot(raw) {
|
|
|
5339
5418
|
]) {
|
|
5340
5419
|
assertDecimalString(a[field], `arkInfo.${field}`);
|
|
5341
5420
|
}
|
|
5421
|
+
if (a.vtxoTreeExpiry !== void 0) {
|
|
5422
|
+
assertDecimalString(a.vtxoTreeExpiry, "arkInfo.vtxoTreeExpiry");
|
|
5423
|
+
}
|
|
5342
5424
|
assertFeeInfo(a.fees, "arkInfo.fees");
|
|
5343
5425
|
if (!Array.isArray(a.deprecatedSigners)) {
|
|
5344
5426
|
throw new MalformedArkInfoSnapshotError("arkInfo.deprecatedSigners must be an array");
|
|
@@ -11911,7 +11993,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
11911
11993
|
}
|
|
11912
11994
|
};
|
|
11913
11995
|
var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
11914
|
-
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, renewalConfig, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, lookAheadWindow) {
|
|
11996
|
+
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, renewalConfig, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, lookAheadWindow, batchExpiryPolicy, checkpointExitDelayPolicy) {
|
|
11915
11997
|
super(
|
|
11916
11998
|
identity,
|
|
11917
11999
|
network,
|
|
@@ -11930,6 +12012,8 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11930
12012
|
this.arkProvider = arkProvider;
|
|
11931
12013
|
this.forfeitOutputScript = forfeitOutputScript;
|
|
11932
12014
|
this.forfeitPubkey = forfeitPubkey;
|
|
12015
|
+
this.batchExpiryPolicy = batchExpiryPolicy;
|
|
12016
|
+
this.checkpointExitDelayPolicy = checkpointExitDelayPolicy;
|
|
11933
12017
|
this.identity = identity;
|
|
11934
12018
|
this.renewalConfig = {
|
|
11935
12019
|
enabled: renewalConfig?.enabled ?? false,
|
|
@@ -11962,6 +12046,8 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
11962
12046
|
arkProvider;
|
|
11963
12047
|
forfeitOutputScript;
|
|
11964
12048
|
forfeitPubkey;
|
|
12049
|
+
batchExpiryPolicy;
|
|
12050
|
+
checkpointExitDelayPolicy;
|
|
11965
12051
|
static MIN_FEE_RATE = 1;
|
|
11966
12052
|
// sats/vbyte
|
|
11967
12053
|
identity;
|
|
@@ -12260,12 +12346,10 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12260
12346
|
*/
|
|
12261
12347
|
async rotateServerSigner(newServerPubKey, checkpointTapscript) {
|
|
12262
12348
|
const xonly = toXOnlyPubKey(newServerPubKey);
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
throw new Error("Invalid checkpointTapscript from server");
|
|
12268
|
-
}
|
|
12349
|
+
const newServerUnrollScript = assertValidServerUnrollScript(
|
|
12350
|
+
checkpointTapscript,
|
|
12351
|
+
resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
|
|
12352
|
+
);
|
|
12269
12353
|
if (equalBytes(xonly, this.arkServerPublicKey)) return;
|
|
12270
12354
|
if (this._receiveRotator) {
|
|
12271
12355
|
await this._receiveRotator.runExclusive(
|
|
@@ -12571,16 +12655,17 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12571
12655
|
throw new Error("Invalid configured public key");
|
|
12572
12656
|
}
|
|
12573
12657
|
const setup = await ReadonlyWallet.setupWalletConfig(config, pubkey);
|
|
12574
|
-
let serverUnrollScript;
|
|
12575
|
-
try {
|
|
12576
|
-
const raw = hex.decode(setup.info.checkpointTapscript);
|
|
12577
|
-
serverUnrollScript = CSVMultisigTapscript.decode(raw);
|
|
12578
|
-
} catch (e) {
|
|
12579
|
-
throw new Error("Invalid checkpointTapscript from server");
|
|
12580
|
-
}
|
|
12581
12658
|
const forfeitPubkey = hex.decode(setup.info.forfeitPubkey).slice(1);
|
|
12582
12659
|
const forfeitAddress = Address(setup.network).decode(setup.info.forfeitAddress);
|
|
12583
12660
|
const forfeitOutputScript = OutScript.encode(forfeitAddress);
|
|
12661
|
+
const checkpointExitDelayOverrides = {
|
|
12662
|
+
advertisedForfeitPubkey: forfeitPubkey,
|
|
12663
|
+
...config.minCheckpointExitDelaySeconds !== void 0 ? { minSeconds: config.minCheckpointExitDelaySeconds } : {}
|
|
12664
|
+
};
|
|
12665
|
+
const serverUnrollScript = assertValidServerUnrollScript(
|
|
12666
|
+
setup.info.checkpointTapscript,
|
|
12667
|
+
resolveCheckpointExitDelayPolicy(setup.network, checkpointExitDelayOverrides)
|
|
12668
|
+
);
|
|
12584
12669
|
const boot = await WalletReceiveRotator.resolveBoot(config, setup);
|
|
12585
12670
|
const wallet = new _Wallet(
|
|
12586
12671
|
config.identity,
|
|
@@ -12604,7 +12689,13 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
12604
12689
|
setup.walletContractTimelocks,
|
|
12605
12690
|
boot?.rotator,
|
|
12606
12691
|
boot?.provider,
|
|
12607
|
-
config.lookAheadWindow
|
|
12692
|
+
config.lookAheadWindow,
|
|
12693
|
+
// Pinned at setup rather than refetched per round.
|
|
12694
|
+
{
|
|
12695
|
+
advertisedVtxoTreeExpiry: setup.info.vtxoTreeExpiry,
|
|
12696
|
+
...config.minBatchExpirySeconds !== void 0 ? { minSeconds: config.minBatchExpirySeconds } : {}
|
|
12697
|
+
},
|
|
12698
|
+
checkpointExitDelayOverrides
|
|
12608
12699
|
);
|
|
12609
12700
|
wallet._serverInfoSource = setup.serverInfoSource;
|
|
12610
12701
|
if (setup.serverInfoSource === "live") {
|
|
@@ -13192,24 +13283,20 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13192
13283
|
const utf8IntentId = new TextEncoder().encode(intentId);
|
|
13193
13284
|
const intentIdHash = sha256(utf8IntentId);
|
|
13194
13285
|
const intentIdHashStr = hex.encode(intentIdHash);
|
|
13195
|
-
|
|
13196
|
-
for (const idHash of event.intentIdHashes) {
|
|
13197
|
-
if (idHash === intentIdHashStr) {
|
|
13198
|
-
if (!this.arkProvider) {
|
|
13199
|
-
throw new Error("Arkade provider not configured");
|
|
13200
|
-
}
|
|
13201
|
-
await this.arkProvider.confirmRegistration(intentId);
|
|
13202
|
-
skip = false;
|
|
13203
|
-
}
|
|
13204
|
-
}
|
|
13286
|
+
const skip = !event.intentIdHashes.includes(intentIdHashStr);
|
|
13205
13287
|
if (skip) {
|
|
13206
13288
|
return { skip };
|
|
13207
13289
|
}
|
|
13290
|
+
if (!this.arkProvider) {
|
|
13291
|
+
throw new Error("Arkade provider not configured");
|
|
13292
|
+
}
|
|
13293
|
+
const timelock = assertValidBatchExpiry(
|
|
13294
|
+
event.batchExpiry,
|
|
13295
|
+
resolveBatchExpiryPolicy(this.network, this.batchExpiryPolicy)
|
|
13296
|
+
);
|
|
13297
|
+
await this.arkProvider.confirmRegistration(intentId);
|
|
13208
13298
|
const sweepTapscript = CSVMultisigTapscript.encode({
|
|
13209
|
-
timelock
|
|
13210
|
-
value: event.batchExpiry,
|
|
13211
|
-
type: event.batchExpiry >= 512n ? "seconds" : "blocks"
|
|
13212
|
-
},
|
|
13299
|
+
timelock,
|
|
13213
13300
|
pubkeys: [this.forfeitPubkey]
|
|
13214
13301
|
}).script;
|
|
13215
13302
|
sweepTapTreeRoot = tapLeafHash(sweepTapscript);
|
|
@@ -13645,8 +13732,9 @@ var Wallet2 = class _Wallet extends ReadonlyWallet {
|
|
|
13645
13732
|
}
|
|
13646
13733
|
if (spendable.length > 0) {
|
|
13647
13734
|
const info = await this.arkProvider.getInfo();
|
|
13648
|
-
const serverUnrollScript =
|
|
13649
|
-
|
|
13735
|
+
const serverUnrollScript = assertValidServerUnrollScript(
|
|
13736
|
+
info.checkpointTapscript,
|
|
13737
|
+
resolveCheckpointExitDelayPolicy(this.network, this.checkpointExitDelayPolicy)
|
|
13650
13738
|
);
|
|
13651
13739
|
for (const vtxo of spendable) {
|
|
13652
13740
|
try {
|
|
@@ -19881,7 +19969,7 @@ __export(arkade_exports, {
|
|
|
19881
19969
|
witnessRefToBytes: () => witnessRefToBytes
|
|
19882
19970
|
});
|
|
19883
19971
|
var isVtxoCoin = (input) => isVirtualCoin(input);
|
|
19884
|
-
function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients) {
|
|
19972
|
+
function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message, session, arkProvider, emulator, network, recipients, batchExpiryPolicy) {
|
|
19885
19973
|
let batchId;
|
|
19886
19974
|
let sweepTapTreeRoot;
|
|
19887
19975
|
let validatedCommitmentTxid;
|
|
@@ -19891,15 +19979,19 @@ function createArkadeBatchHandler(intentId, inputs, signer, signedProof, message
|
|
|
19891
19979
|
const intentIdHash = sha256(utf8IntentId);
|
|
19892
19980
|
const intentIdHashStr = hex.encode(intentIdHash);
|
|
19893
19981
|
if (!event.intentIdHashes.includes(intentIdHashStr)) return { skip: true };
|
|
19982
|
+
const info = await arkProvider.getInfo();
|
|
19983
|
+
const timelock = assertValidBatchExpiry(
|
|
19984
|
+
event.batchExpiry,
|
|
19985
|
+
resolveBatchExpiryPolicy(network, {
|
|
19986
|
+
advertisedVtxoTreeExpiry: info.vtxoTreeExpiry,
|
|
19987
|
+
...batchExpiryPolicy
|
|
19988
|
+
})
|
|
19989
|
+
);
|
|
19894
19990
|
await arkProvider.confirmRegistration(intentId);
|
|
19895
19991
|
batchId = event.id;
|
|
19896
19992
|
const sweepTapscript = CSVMultisigTapscript.encode({
|
|
19897
|
-
timelock
|
|
19898
|
-
|
|
19899
|
-
// BIP-65: values >= 512 are interpreted as seconds, below as blocks
|
|
19900
|
-
type: event.batchExpiry >= 512n ? "seconds" : "blocks"
|
|
19901
|
-
},
|
|
19902
|
-
pubkeys: [hex.decode((await arkProvider.getInfo()).forfeitPubkey).subarray(1)]
|
|
19993
|
+
timelock,
|
|
19994
|
+
pubkeys: [hex.decode(info.forfeitPubkey).subarray(1)]
|
|
19903
19995
|
}).script;
|
|
19904
19996
|
sweepTapTreeRoot = tapLeafHash(sweepTapscript);
|
|
19905
19997
|
return { skip: false };
|
|
@@ -20919,6 +21011,6 @@ function isArkContract(str) {
|
|
|
20919
21011
|
return str.startsWith(ARKCONTRACT_PREFIX + "=");
|
|
20920
21012
|
}
|
|
20921
21013
|
|
|
20922
|
-
export { ARKADE_MAGIC, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertSendableAmount, assertSubmittedArkTxid, assetMintResolver, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, decodeArkContract, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isArkContract, isBatchSignable, isBtcAddress, isCooperativelyMigratable, isDiscoverable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, onchainRail, openDatabase, requiresMigration, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
20923
|
-
//# sourceMappingURL=chunk-
|
|
20924
|
-
//# sourceMappingURL=chunk-
|
|
21014
|
+
export { ARKADE_MAGIC, ActivityRegistry, AmbiguousRouteError, ArkNote, ArkadeCash, ArkadeCashCreateError, AssetManager, BIP21, BIP21Error, BIP322, Batch, ChainedTxType, ContractManager, ContractRepositoryImpl, ContractWatcher, DB_VERSION, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DEFAULT_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, DelegateManagerImpl, DelegateNotConfiguredError, DelegatorManagerImpl, DelegatorNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MIGRATION_KEY, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, P2A, PaymentRouter, REGTEST_MIN_BATCH_EXPIRY_SECONDS, REGTEST_MIN_CHECKPOINT_EXIT_DELAY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestDelegatorProvider, RestEmulatorProvider, SeedIdentity, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, TxTree, TxType, TxWeightEstimator, UnilateralExit, UnknownPacket, Unroll, VtxoManager, Wallet2 as Wallet, WalletMessageHandler, WalletNotInitializedError, WalletRepositoryImpl, WsElectrumChainSource, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertIntentIdUnique, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, combineTapscriptSigs, contractFromArkContract, contractFromArkContractWithAddress, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, decodeArkContract, defaultBatchExpiryPolicy, defaultCheckpointExitDelayPolicy, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, extendVirtualCoinForContract, getMigrationStatus, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, intentPageBounds, invoiceTarget, isArkContract, isBatchSignable, isBtcAddress, isCooperativelyMigratable, isDiscoverable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, isVtxoForScript, makeHandle, matchServerCheckpoints, mergeChainedTxType, migrateWalletRepository, onchainRail, openDatabase, requiresMigration, resolveBatchExpiryPolicy, resolveCheckpointExitDelayPolicy, resolveSendAmount, rollbackMigration, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signerSetFromInfo, toXOnlySignerHex, tryResolveSendAmount, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, warnAndFilterVtxosForScript };
|
|
21015
|
+
//# sourceMappingURL=chunk-NIZPFPUM.js.map
|
|
21016
|
+
//# sourceMappingURL=chunk-NIZPFPUM.js.map
|