@arkade-os/sdk 0.5.2 → 0.5.3
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/{asyncStorageTaskQueue-DIn7bTqN.d.ts → asyncStorageTaskQueue-B3U5gQ-i.d.ts} +1 -1
- package/dist/{asyncStorageTaskQueue-BtEc3Qca.d.cts → asyncStorageTaskQueue-C9PkPcW_.d.cts} +1 -1
- package/dist/{chunk-PVFQFQBY.cjs → chunk-5WRA66RV.cjs} +10 -10
- package/dist/{chunk-PVFQFQBY.cjs.map → chunk-5WRA66RV.cjs.map} +1 -1
- package/dist/{chunk-U5XG7SWA.js → chunk-6FL4N4S2.js} +3 -3
- package/dist/{chunk-U5XG7SWA.js.map → chunk-6FL4N4S2.js.map} +1 -1
- package/dist/{chunk-OM6FJ76H.cjs → chunk-BYPBVHVA.cjs} +48 -48
- package/dist/{chunk-OM6FJ76H.cjs.map → chunk-BYPBVHVA.cjs.map} +1 -1
- package/dist/{chunk-AJWXVQYG.js → chunk-HAQAWBYG.js} +95 -47
- package/dist/chunk-HAQAWBYG.js.map +1 -0
- package/dist/{chunk-GGKR4O5X.cjs → chunk-KW7ZEWYS.cjs} +6 -3
- package/dist/chunk-KW7ZEWYS.cjs.map +1 -0
- package/dist/{chunk-HKG26NUT.js → chunk-OPX2HRWM.js} +6 -3
- package/dist/chunk-OPX2HRWM.js.map +1 -0
- package/dist/{chunk-2OCYL6BJ.cjs → chunk-OUTWUYJ4.cjs} +589 -541
- package/dist/chunk-OUTWUYJ4.cjs.map +1 -0
- package/dist/{chunk-LWRMSC4M.js → chunk-P7B4LQ3H.js} +3 -3
- package/dist/{chunk-LWRMSC4M.js.map → chunk-P7B4LQ3H.js.map} +1 -1
- package/dist/{chunk-2QRUQXLS.js → chunk-T7C3E2HL.js} +4 -4
- package/dist/{chunk-2QRUQXLS.js.map → chunk-T7C3E2HL.js.map} +1 -1
- package/dist/{chunk-MOBDJ7U2.js → chunk-Y4BL3YYX.js} +4 -4
- package/dist/{chunk-MOBDJ7U2.js.map → chunk-Y4BL3YYX.js.map} +1 -1
- package/dist/{chunk-64R7CRKN.cjs → chunk-ZMSM3NOH.cjs} +18 -18
- package/dist/{chunk-64R7CRKN.cjs.map → chunk-ZMSM3NOH.cjs.map} +1 -1
- package/dist/{chunk-TAIWH3HG.cjs → chunk-ZPF4I3K2.cjs} +16 -16
- package/dist/{chunk-TAIWH3HG.cjs.map → chunk-ZPF4I3K2.cjs.map} +1 -1
- package/dist/contracts/handlers/index.cjs +9 -9
- 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-CaL8EN4Q.d.cts → delegate-ByfKszb6.d.cts} +1 -1
- package/dist/{delegate-Jd4zs88Q.d.ts → delegate-Cd28gxpM.d.ts} +1 -1
- package/dist/{index-D-xqVzf8.d.ts → index-B6X2E7W_.d.ts} +2 -2
- package/dist/{index-DdKxfC29.d.cts → index-BURzbRup.d.cts} +12 -0
- package/dist/{index-DdKxfC29.d.ts → index-BURzbRup.d.ts} +12 -0
- package/dist/{index-BwdGzNSn.d.cts → index-DgH_0j14.d.cts} +2 -2
- package/dist/index.cjs +313 -313
- package/dist/index.d.cts +22 -9
- package/dist/index.d.ts +22 -9
- package/dist/index.js +4 -4
- package/dist/repositories/realm/index.cjs +35 -35
- 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 +33 -33
- 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-ZyGGjtIq.d.ts → taskRunner-BaNCSxqK.d.ts} +1 -1
- package/dist/{taskRunner-67YSEpsz.d.cts → taskRunner-i56-drQV.d.cts} +1 -1
- 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 +18 -15
- package/dist/wallet/expo/index.cjs.map +1 -1
- package/dist/wallet/expo/index.d.cts +5 -4
- package/dist/wallet/expo/index.d.ts +5 -4
- package/dist/wallet/expo/index.js +8 -5
- package/dist/wallet/expo/index.js.map +1 -1
- package/dist/{wallet-B8LW7cV1.d.cts → wallet-BjQugVUt.d.cts} +7 -3
- package/dist/{wallet-bFS7VybL.d.ts → wallet-BnmhohgZ.d.ts} +7 -3
- 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-2OCYL6BJ.cjs.map +0 -1
- package/dist/chunk-AJWXVQYG.js.map +0 -1
- package/dist/chunk-GGKR4O5X.cjs.map +0 -1
- package/dist/chunk-HKG26NUT.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Packet, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, RestIndexerProvider, BufferReader, BufferWriter, AssetRef } from './chunk-
|
|
2
|
-
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, UnsupportedProgramVersionError, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, toXOnly, ARKADE_TYPE_ENCODINGS, validateParamValue, contractHandlers, speculativeReceiveMetadata, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, normalizeToDescriptor, extractPubKey, parseHDDescriptor, identityDescriptor, DefaultVtxo, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-
|
|
3
|
-
import { VtxoScript, __export, Transaction, requiresForfeit, CSVMultisigTapscript, networks, getNetwork, DEFAULT_NETWORK, resolveEmulatorPubkey, timelockToSequence, isVtxoSpent, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness,
|
|
1
|
+
import { Packet, AssetId, AssetGroup, AssetInput, AssetOutput, Metadata, RestIndexerProvider, BufferReader, BufferWriter, AssetRef } from './chunk-6FL4N4S2.js';
|
|
2
|
+
import { witnessRefToBytes, validateProgram, toASM, stringifyArtifact, serializeArkadeContractParams, resolveAsm, parseArtifact, getOpcodeValue, getOpcodeName, fromASM, deserializeArkadeContractParams, computeArkadeScriptPublicKey, bytesToASM, asmToBytes, arkadeWitnessHash, arkadeScriptHash, UnsupportedProgramVersionError, SUPPORTED_PROGRAM_VERSION, OPCODE_VALUES, OPCODE_NAMES, bignum_exports, ArkadeScript, ArkadeProgramScript, ARKADE_OPS, ARKADE_OPCODE_VALUES, ARKADE_OPCODE_NAMES, ARKADE_OPCODES, ARKADE_OP, toXOnly, ARKADE_TYPE_ENCODINGS, validateParamValue, contractHandlers, speculativeReceiveMetadata, isMainnetDescriptor, descriptorIsOurs, deriveDescriptorLeafPubKey, deriveDescriptorLeafCompressedPubKey, normalizeToDescriptor, extractPubKey, parseHDDescriptor, identityDescriptor, DefaultVtxo, DelegateVtxo, WALLET_RECEIVE_SOURCE, BoardingContractHandler } from './chunk-P7B4LQ3H.js';
|
|
3
|
+
import { VtxoScript, __export, Transaction, requiresForfeit, CSVMultisigTapscript, networks, getNetwork, DEFAULT_NETWORK, resolveEmulatorPubkey, timelockToSequence, isVtxoSpent, getNormalizedVtxos, setArkPsbtField, PrevArkTxField, ConditionWitness, craftToSpendTx, RestArkProvider, ArkAddress, isVirtualCoin, getArkPsbtFields, CosignerPublicKey, ServerResponseMismatchError, assertNonNegativeMs, isRetryableProviderError, getAllNormalizedVtxos, DEFAULT_PAGE_SIZE, assertAllowedSighashTypes, OP_RETURN_EMPTY_PKSCRIPT, canSweepOnchain, sequenceToTimelock, DEFAULT_ARKADE_SERVER_URL, baseFetch, DEFAULT_NETWORK_NAME, sequenceToCanonicalTimelock, assertTimerMs, isEventSourceError, isEventSourceUnavailableError, normalizeVtxo, isPastExpiry, decodeTapscript, scriptFromTapLeafScript, CLTVMultisigTapscript, VtxoTaprootTree, formatSighash, isArkError, ArkErrorName, Intent, rateGate, getSequence, maybeArkError, toOffchainInputFeeParams, canRecoverOnchain, MultisigTapscript, DEFAULT_ARKADE_EMULATOR_URL, networkFromArkadeInfo, ArkError, toBIP371TapTree, resolveTimeHeight, canSpendOffchain, INFO_FETCH_TIMEOUT_MS, PrevoutTxField, fetchVtxoCreatedAtByTxid, EXPIRY_MIN_PLAUSIBLE_MS, ProviderUnavailableError } from './chunk-OPX2HRWM.js';
|
|
4
4
|
import { sha256, equalBytes, hash160, sha256x2, concatBytes, randomPrivateKeyBytes, pubECDSA, pubSchnorr } from '@scure/btc-signer/utils.js';
|
|
5
5
|
import { SigHash, Script, OP, OutScript, Address, RawWitness, p2tr, p2wpkh, TaprootControlBlock, DEFAULT_SEQUENCE, Transaction as Transaction$1 } from '@scure/btc-signer';
|
|
6
6
|
import { hex, base58, base64, bech32m } from '@scure/base';
|
|
@@ -3833,32 +3833,36 @@ function assertCheckpointsMatchInputs(checkpoints, inputs, unrollCandidates, con
|
|
|
3833
3833
|
}
|
|
3834
3834
|
}
|
|
3835
3835
|
async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
|
|
3836
|
-
const
|
|
3836
|
+
const oneShot = options?.oneShot !== false;
|
|
3837
|
+
const { arkTx: signedArkTx, userSignedCheckpoints: batchSigned } = await signer.signArkTx(
|
|
3837
3838
|
offchainTx.arkTx,
|
|
3838
3839
|
offchainTx.checkpoints
|
|
3839
3840
|
);
|
|
3840
|
-
if (
|
|
3841
|
+
if (batchSigned && batchSigned.length !== offchainTx.checkpoints.length) {
|
|
3841
3842
|
throw new Error(
|
|
3842
|
-
`signer returned ${
|
|
3843
|
+
`signer returned ${batchSigned.length} signed checkpoints, expected ${offchainTx.checkpoints.length}`
|
|
3843
3844
|
);
|
|
3844
3845
|
}
|
|
3846
|
+
const userSignedCheckpoints = (batchSigned ?? (oneShot ? await Promise.all(offchainTx.checkpoints.map((c) => signer.signCheckpoint(c.clone()))) : void 0))?.map((c) => withArkInputWitness(c, signedArkTx));
|
|
3845
3847
|
await hooks?.beforeSubmit?.();
|
|
3846
3848
|
const response = await provider.submitTx(
|
|
3847
3849
|
base64.encode(signedArkTx.toPSBT()),
|
|
3848
|
-
offchainTx.checkpoints.map((c) => base64.encode(c.toPSBT()))
|
|
3850
|
+
(oneShot ? userSignedCheckpoints : offchainTx.checkpoints.map((c) => withArkInputWitness(c, signedArkTx))).map((c) => base64.encode(c.toPSBT()))
|
|
3849
3851
|
);
|
|
3850
3852
|
assertSubmittedArkTxid(response, signedArkTx, "submitTx");
|
|
3851
3853
|
const { arkTxid, signedCheckpointTxs } = response;
|
|
3852
3854
|
const matched = matchServerCheckpoints(signedCheckpointTxs, offchainTx.checkpoints, "submitTx");
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3855
|
+
if (!oneShot) {
|
|
3856
|
+
matched.forEach(({ server }, index) => {
|
|
3857
|
+
try {
|
|
3858
|
+
assertAllowedSighashTypes(server);
|
|
3859
|
+
} catch (error) {
|
|
3860
|
+
throw new ServerResponseMismatchError(
|
|
3861
|
+
`submitTx checkpoint ${index}: ${error instanceof Error ? error.message : String(error)}`
|
|
3862
|
+
);
|
|
3863
|
+
}
|
|
3864
|
+
});
|
|
3865
|
+
}
|
|
3862
3866
|
const verify = options?.verifyServerSignatures;
|
|
3863
3867
|
if (verify) {
|
|
3864
3868
|
if (response.finalArkTx === void 0) {
|
|
@@ -3885,26 +3889,62 @@ async function submitOffchainTx(provider, offchainTx, signer, hooks, options) {
|
|
|
3885
3889
|
({ server, local }, index) => assertServerSignedLeaf(server, local, 0, serverPubkeys, `submitTx checkpoint ${index}`)
|
|
3886
3890
|
);
|
|
3887
3891
|
}
|
|
3892
|
+
const result = { arkTxid, finalArkTx: response.finalArkTx, signedCheckpointTxs };
|
|
3888
3893
|
let finalCheckpoints;
|
|
3889
3894
|
if (userSignedCheckpoints) {
|
|
3890
3895
|
const userByTxid = new Map(
|
|
3891
3896
|
userSignedCheckpoints.map((c, i) => [offchainTx.checkpoints[i].id, c])
|
|
3892
3897
|
);
|
|
3898
|
+
if (oneShot && matched.every(
|
|
3899
|
+
({ server, local }) => carriesTapscriptSigs(server, userByTxid.get(local.id))
|
|
3900
|
+
)) {
|
|
3901
|
+
await hooks?.afterFinalize?.();
|
|
3902
|
+
return result;
|
|
3903
|
+
}
|
|
3893
3904
|
finalCheckpoints = matched.map(({ server, local }) => {
|
|
3894
|
-
|
|
3905
|
+
const userSigned = userByTxid.get(local.id);
|
|
3906
|
+
combineTapscriptSigs(userSigned, server);
|
|
3907
|
+
carryConditionWitness(userSigned, server);
|
|
3895
3908
|
return base64.encode(server.toPSBT());
|
|
3896
3909
|
});
|
|
3897
3910
|
} else {
|
|
3898
3911
|
finalCheckpoints = await Promise.all(
|
|
3899
|
-
matched.map(async ({ server }) => {
|
|
3912
|
+
matched.map(async ({ server, local }) => {
|
|
3900
3913
|
const signed = await signer.signCheckpoint(server);
|
|
3914
|
+
carryConditionWitness(local, signed);
|
|
3901
3915
|
return base64.encode(signed.toPSBT());
|
|
3902
3916
|
})
|
|
3903
3917
|
);
|
|
3904
3918
|
}
|
|
3905
3919
|
await provider.finalizeTx(arkTxid, finalCheckpoints);
|
|
3906
3920
|
await hooks?.afterFinalize?.();
|
|
3907
|
-
return
|
|
3921
|
+
return result;
|
|
3922
|
+
}
|
|
3923
|
+
function carryConditionWitness(ours, server) {
|
|
3924
|
+
if (getArkPsbtFields(server, 0, ConditionWitness).length > 0) return;
|
|
3925
|
+
const [witness] = getArkPsbtFields(ours, 0, ConditionWitness);
|
|
3926
|
+
if (witness) setArkPsbtField(server, 0, ConditionWitness, witness);
|
|
3927
|
+
}
|
|
3928
|
+
function withArkInputWitness(checkpoint, signedArkTx) {
|
|
3929
|
+
if (getArkPsbtFields(checkpoint, 0, ConditionWitness).length > 0) return checkpoint;
|
|
3930
|
+
for (let i = 0; i < signedArkTx.inputsLength; i++) {
|
|
3931
|
+
const { txid } = signedArkTx.getInput(i);
|
|
3932
|
+
if (!txid || hex.encode(txid) !== checkpoint.id) continue;
|
|
3933
|
+
const [witness] = getArkPsbtFields(signedArkTx, i, ConditionWitness);
|
|
3934
|
+
if (!witness) return checkpoint;
|
|
3935
|
+
const carried = checkpoint.clone();
|
|
3936
|
+
setArkPsbtField(carried, 0, ConditionWitness, witness);
|
|
3937
|
+
return carried;
|
|
3938
|
+
}
|
|
3939
|
+
return checkpoint;
|
|
3940
|
+
}
|
|
3941
|
+
function carriesTapscriptSigs(server, userSigned) {
|
|
3942
|
+
const entries = (tx) => (tx.getInput(0).tapScriptSig ?? []).map(
|
|
3943
|
+
([{ pubKey, leafHash }, sig]) => hex.encode(pubKey) + hex.encode(leafHash) + hex.encode(sig)
|
|
3944
|
+
);
|
|
3945
|
+
const have = new Set(entries(server));
|
|
3946
|
+
const want = entries(userSigned);
|
|
3947
|
+
return want.length > 0 && want.every((entry) => have.has(entry));
|
|
3908
3948
|
}
|
|
3909
3949
|
async function signAndSubmitOffchainTx(params) {
|
|
3910
3950
|
const offchainTx = buildOffchainTx(params.inputs, params.outputs, params.serverUnrollScript);
|
|
@@ -3913,7 +3953,8 @@ async function signAndSubmitOffchainTx(params) {
|
|
|
3913
3953
|
signCheckpoint: (checkpoint) => params.identity.sign(checkpoint)
|
|
3914
3954
|
};
|
|
3915
3955
|
const { arkTxid } = await submitOffchainTx(params.provider, offchainTx, signer, void 0, {
|
|
3916
|
-
verifyServerSignatures: params.verifyServerSignatures
|
|
3956
|
+
verifyServerSignatures: params.verifyServerSignatures,
|
|
3957
|
+
oneShot: params.oneShot
|
|
3917
3958
|
});
|
|
3918
3959
|
return arkTxid;
|
|
3919
3960
|
}
|
|
@@ -14413,7 +14454,7 @@ var ReadonlyWallet = class _ReadonlyWallet {
|
|
|
14413
14454
|
}
|
|
14414
14455
|
};
|
|
14415
14456
|
var Wallet2 = class extends ReadonlyWallet {
|
|
14416
|
-
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, keyring, lookAheadWindow, batchExpiryPolicy) {
|
|
14457
|
+
constructor(identity, network, onchainProvider, arkProvider, indexerProvider, arkServerPublicKey, offchainTapscript, boardingTapscript, serverUnrollScript, forfeitOutputScript, forfeitPubkey, dustAmount, walletRepository, contractRepository, delegateProvider, watcherConfig, settlementConfig, walletContractTimelocks, receiveRotator, descriptorProvider, keyring, lookAheadWindow, batchExpiryPolicy, oneShotSubmit = true) {
|
|
14417
14458
|
super(
|
|
14418
14459
|
identity,
|
|
14419
14460
|
network,
|
|
@@ -14433,6 +14474,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
14433
14474
|
this.forfeitOutputScript = forfeitOutputScript;
|
|
14434
14475
|
this.forfeitPubkey = forfeitPubkey;
|
|
14435
14476
|
this.batchExpiryPolicy = batchExpiryPolicy;
|
|
14477
|
+
this.oneShotSubmit = oneShotSubmit;
|
|
14436
14478
|
this.identity = identity;
|
|
14437
14479
|
this.settlementConfig = settlementConfig !== void 0 ? settlementConfig : { ...DEFAULT_SETTLEMENT_CONFIG };
|
|
14438
14480
|
this._delegateManager = delegateProvider ? new DelegateManagerImpl(delegateProvider, arkProvider, identity) : void 0;
|
|
@@ -14454,6 +14496,7 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
14454
14496
|
forfeitOutputScript;
|
|
14455
14497
|
forfeitPubkey;
|
|
14456
14498
|
batchExpiryPolicy;
|
|
14499
|
+
oneShotSubmit;
|
|
14457
14500
|
static MIN_FEE_RATE = 1;
|
|
14458
14501
|
// sats/vbyte
|
|
14459
14502
|
identity;
|
|
@@ -15299,7 +15342,8 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
15299
15342
|
{
|
|
15300
15343
|
advertisedVtxoTreeExpiry: setup.info.vtxoTreeExpiry,
|
|
15301
15344
|
...config.minBatchExpirySeconds !== void 0 ? { minSeconds: config.minBatchExpirySeconds } : {}
|
|
15302
|
-
}
|
|
15345
|
+
},
|
|
15346
|
+
config.oneShotSubmit
|
|
15303
15347
|
);
|
|
15304
15348
|
wallet.lazyInitialization = config.lazyInitialization ?? false;
|
|
15305
15349
|
wallet._serverInfoSource = setup.serverInfoSource;
|
|
@@ -16340,7 +16384,8 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
16340
16384
|
}
|
|
16341
16385
|
],
|
|
16342
16386
|
outputs: [{ script: myPkScript, amount: BigInt(vtxo.value) }],
|
|
16343
|
-
serverUnrollScript
|
|
16387
|
+
serverUnrollScript,
|
|
16388
|
+
oneShot: this.oneShotSubmit
|
|
16344
16389
|
});
|
|
16345
16390
|
swept += vtxo.value;
|
|
16346
16391
|
} catch (error) {
|
|
@@ -17182,7 +17227,8 @@ var Wallet2 = class extends ReadonlyWallet {
|
|
|
17182
17227
|
deprecatedServerPubkeys: [...this._deprecatedSigners.keys()].map(
|
|
17183
17228
|
(h) => hex.decode(h)
|
|
17184
17229
|
)
|
|
17185
|
-
}
|
|
17230
|
+
},
|
|
17231
|
+
oneShot: this.oneShotSubmit
|
|
17186
17232
|
}
|
|
17187
17233
|
);
|
|
17188
17234
|
} finally {
|
|
@@ -17830,6 +17876,7 @@ var MessageBus = class {
|
|
|
17830
17876
|
lazyInitialization: config.lazyInitialization,
|
|
17831
17877
|
watcherConfig: config.watcherConfig,
|
|
17832
17878
|
lookAheadWindow: config.lookAheadWindow,
|
|
17879
|
+
oneShotSubmit: config.oneShotSubmit,
|
|
17833
17880
|
minBatchExpirySeconds: config.minBatchExpirySeconds
|
|
17834
17881
|
});
|
|
17835
17882
|
return { wallet, arkProvider, readonlyWallet: wallet };
|
|
@@ -21071,9 +21118,10 @@ var ServiceWorkerReadonlyWallet = class _ServiceWorkerReadonlyWallet {
|
|
|
21071
21118
|
}
|
|
21072
21119
|
};
|
|
21073
21120
|
var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
|
|
21074
|
-
constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegate) {
|
|
21121
|
+
constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegate, oneShotSubmit) {
|
|
21075
21122
|
super(serviceWorker, identity, walletRepository, contractRepository, messageTag);
|
|
21076
21123
|
this.serviceWorker = serviceWorker;
|
|
21124
|
+
this.oneShotSubmit = oneShotSubmit;
|
|
21077
21125
|
this.identity = identity;
|
|
21078
21126
|
this.walletRepository = walletRepository;
|
|
21079
21127
|
this.contractRepository = contractRepository;
|
|
@@ -21084,6 +21132,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
21084
21132
|
this.hasDelegate = hasDelegate;
|
|
21085
21133
|
}
|
|
21086
21134
|
serviceWorker;
|
|
21135
|
+
oneShotSubmit;
|
|
21087
21136
|
walletRepository;
|
|
21088
21137
|
contractRepository;
|
|
21089
21138
|
identity;
|
|
@@ -21120,7 +21169,8 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
21120
21169
|
walletRepository,
|
|
21121
21170
|
contractRepository,
|
|
21122
21171
|
messageTag,
|
|
21123
|
-
!!options.delegateUrl
|
|
21172
|
+
!!options.delegateUrl,
|
|
21173
|
+
options.oneShotSubmit
|
|
21124
21174
|
);
|
|
21125
21175
|
wallet._concurrentSpending = options.concurrentSpending === true;
|
|
21126
21176
|
return _ServiceWorkerWallet.bootstrap(wallet, options, serializedWallet, {
|
|
@@ -21131,6 +21181,7 @@ var ServiceWorkerWallet = class _ServiceWorkerWallet extends ServiceWorkerReadon
|
|
|
21131
21181
|
lazyInitialization: options.lazyInitialization,
|
|
21132
21182
|
watcherConfig: options.watcherConfig,
|
|
21133
21183
|
lookAheadWindow: options.lookAheadWindow,
|
|
21184
|
+
oneShotSubmit: options.oneShotSubmit,
|
|
21134
21185
|
minBatchExpirySeconds: options.minBatchExpirySeconds
|
|
21135
21186
|
});
|
|
21136
21187
|
}
|
|
@@ -24760,6 +24811,7 @@ var Arkade = class _Arkade {
|
|
|
24760
24811
|
userKey;
|
|
24761
24812
|
/** The contract manager, when contract persistence is wired up (passed in or owned). */
|
|
24762
24813
|
contractManager;
|
|
24814
|
+
oneShotSubmit;
|
|
24763
24815
|
/** Whether {@link connect} built {@link contractManager}, so {@link dispose} must stop it. */
|
|
24764
24816
|
ownsContractManager;
|
|
24765
24817
|
/** {@link ArkadeContract.on} handles by contract script (hex). */
|
|
@@ -24779,6 +24831,7 @@ var Arkade = class _Arkade {
|
|
|
24779
24831
|
this.identity = fields.identity;
|
|
24780
24832
|
this.userKey = fields.userKey;
|
|
24781
24833
|
this.contractManager = fields.contractManager;
|
|
24834
|
+
this.oneShotSubmit = fields.oneShotSubmit;
|
|
24782
24835
|
this.ownsContractManager = fields.ownsContractManager ?? false;
|
|
24783
24836
|
}
|
|
24784
24837
|
/**
|
|
@@ -24855,7 +24908,8 @@ var Arkade = class _Arkade {
|
|
|
24855
24908
|
identity: opts.identity,
|
|
24856
24909
|
userKey,
|
|
24857
24910
|
contractManager,
|
|
24858
|
-
ownsContractManager
|
|
24911
|
+
ownsContractManager,
|
|
24912
|
+
oneShotSubmit: opts.oneShotSubmit
|
|
24859
24913
|
});
|
|
24860
24914
|
}
|
|
24861
24915
|
/**
|
|
@@ -25392,7 +25446,8 @@ var ArkadeTransactionBuilder = class {
|
|
|
25392
25446
|
inputIndexes: userInputs
|
|
25393
25447
|
});
|
|
25394
25448
|
}
|
|
25395
|
-
|
|
25449
|
+
const identity = client.identity;
|
|
25450
|
+
if (!identity) {
|
|
25396
25451
|
throw new Error("a signing identity is required for non-covenant spends");
|
|
25397
25452
|
}
|
|
25398
25453
|
const ark = client.arkProvider;
|
|
@@ -25401,26 +25456,19 @@ var ArkadeTransactionBuilder = class {
|
|
|
25401
25456
|
"broadcasting requires an `arkade` provider with `submitTx`/`finalizeTx` on the Arkade client"
|
|
25402
25457
|
);
|
|
25403
25458
|
}
|
|
25404
|
-
const
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
const signed = await client.identity.sign(server, [0]);
|
|
25414
|
-
const [condition] = getArkPsbtFields(local, 0, ConditionWitness);
|
|
25415
|
-
if (condition && getArkPsbtFields(signed, 0, ConditionWitness).length === 0) {
|
|
25416
|
-
setArkPsbtField(signed, 0, ConditionWitness, condition);
|
|
25417
|
-
}
|
|
25418
|
-
return base64.encode(signed.toPSBT());
|
|
25419
|
-
})
|
|
25459
|
+
const res = await submitOffchainTx(
|
|
25460
|
+
ark,
|
|
25461
|
+
{ arkTx, checkpoints },
|
|
25462
|
+
{
|
|
25463
|
+
signArkTx: async (tx) => ({ arkTx: await this.signArk(tx, userInputs) }),
|
|
25464
|
+
signCheckpoint: (checkpoint) => identity.sign(checkpoint, [0])
|
|
25465
|
+
},
|
|
25466
|
+
void 0,
|
|
25467
|
+
{ oneShot: client.oneShotSubmit }
|
|
25420
25468
|
);
|
|
25421
|
-
await ark.finalizeTx(res.arkTxid, finalCps);
|
|
25422
25469
|
return {
|
|
25423
25470
|
txid: res.arkTxid,
|
|
25471
|
+
// Required by ArkadeBroadcaster; RestArkProvider.submitTx rejects a response without it.
|
|
25424
25472
|
signedArkTx: res.finalArkTx,
|
|
25425
25473
|
signedCheckpointTxs: res.signedCheckpointTxs
|
|
25426
25474
|
};
|
|
@@ -25987,5 +26035,5 @@ function createDefaultPaymentRouter(wallet) {
|
|
|
25987
26035
|
}
|
|
25988
26036
|
|
|
25989
26037
|
export { ARKADE_MAGIC, ARKADE_SALTED_PREIMAGE_TAG, ARKADE_SWAP_PREIMAGE_TAG, ASSET_CARRIER_SATS, AbortError, ActivityRegistry, AmbiguousRouteError, ArkNote, Arkade, ArkadeCash, ArkadeCashCreateError, ArkadeCashOperatorMismatchError, AssetManager, BIP21, BIP21Error, BIP322, BLOCKED_UPGRADE_TIMEOUT_MS, Batch, CachingArkProvider, ChainedTxType, ConnectionDisposedError, ContractManager, ContractWatcher, DEFAULT_MESSAGE_TIMEOUTS, DEFAULT_MIN_BATCH_EXPIRY_SECONDS, DatabaseUpgradeBlockedError, DelegateManagerImpl, DelegateNotConfiguredError, DescriptorIdentity, DescriptorSigningProviderMissingError, DustChangeError, ELECTRUM_TCP_HOST, ELECTRUM_WS_URL, ESPLORA_URL, ElectrumOnchainProvider, EmulatorPacket, EsploraProvider, Estimator, Extension, ExtensionNotFoundError, ForeignDescriptorError, HDDescriptorProvider, INTENT_TERMINAL_STATES, InMemoryContractRepository, InMemoryIntentRepository, InMemoryVirtualTxRepository, InMemoryWalletRepository, IndexedDBContractRepository, IndexedDBIntentRepository, IndexedDBVirtualTxRepository, IndexedDBWalletRepository, KeyringDescriptorProvider, MAX_PAGE_SIZE, MAX_USED_SIGNING_DESCRIPTORS_LOOK_AHEAD, MESSAGE_BUS_INITIALIZING, MESSAGE_BUS_NOT_INITIALIZED, MessageBus, MessageBusInitializingError, MessageBusNotInitializedError, MissingSigningDescriptorError, MnemonicIdentity, OnchainWallet, OversizedChangeError, P2A, PaymentRouter, PrevTxUnavailableError, REGTEST_MIN_BATCH_EXPIRY_SECONDS, Ramps, ReadonlyAssetManager, ReadonlyDescriptorIdentity, ReadonlySingleKey, ReadonlyWallet, ReadonlyWalletError, RestDelegateProvider, RestEmulatorProvider, SeedIdentity, SendDeadlineExceededError, ServiceWorkerReadonlyWallet, ServiceWorkerTimeoutError, ServiceWorkerWallet, SingleKey, StaticDescriptorProvider, TxTree, TxType, TxWeightEstimator, UnannotatableInputError, UnilateralExit, UnknownPacket, Unroll, VtxoManager, VtxoReservedError, Wallet2 as Wallet, WalletCannotAllocateAddressError, WalletCannotSignError, WalletMessageHandler, WalletNotInitializedError, WsElectrumChainSource, adoptContractDescriptor, arkAssetRail, arkRail, arkTarget, arkade_exports, assertFinalCommitmentMatchesValidated, assertHistoryPageFilter, assertIntentIdUnique, assertNoAssets, assertNoSelection, assertPageRequest, assertRecipientArkadeAddress, assertSendDeadline, assertSendableAmount, assertSubmittedArkTxid, assertValidBatchExpiry, assertValidServerUnrollScript, assetMintResolver, assetsOf, attachPrevArkTxs, attachPrevoutTxs, awaitTransaction, boardingResolver, btcTarget, buildForfeitTx, buildOffchainTx, buildPreimageMessage, buildSaltedPreimageMessage, captureSendDeadline, checkSaveVtxosForScript, claimWithPreimageIdentity, classifyAgainstSignerSet, classifyContractSigner, closeDatabase, collabExitResolver, collectContracts, collectIntents, collectPages, collectScriptVtxos, collectTransactionHistory, collectUtxos, collectVtxos, combineTapscriptSigs, compareHistoryCursors, contractFilterMatchesNothing, contractFromArkContract, contractFromArkContractWithAddress, contractPreimage, contractSigner, createAssetPacket, createDefaultActivityRegistry, createDefaultPaymentRouter, createExitChainResolver, createManagedConnection, createdAtToIso, decodeArkContract, defaultBatchExpiryPolicy, deleteByIndex, deserializeAssets, deserializeExitPackage, deserializeUtxo, deserializeVtxo, encodeArkContract, exitObserverFor, extendVirtualCoinForContract, extractArkProviderUrl, gateExclusion, gatedContracts, getAllByIndexValues, getRandomId, hasBoardingTxExpired, hasCandidates, intentMatchesFilter, invoiceTarget, isAddressAllocationCapable, isArkContract, isBatchSignable, isBtcAddress, isContractGenericallySpendable, isContractVtxoEvent, isCooperativelyMigratable, isDeterministicSigner, isDiscoverable, isHDAllocationCapable, isHDDeterministicSignCapable, isHDWalletCapable, isLightningInvoice, isLnurl, isMessageBusInitializingError, isMessageBusNotInitializedError, isPerArtifactDescriptor, isSigningIdentity, isSubdust, isTerminalIntentState, isValidArkAddress, isVtxoExpiringSoon, iteratePages, legacyVtxoFacts, logExcludedVtxos, makeHandle, matchServerCheckpoints, mergeChainedTxType, notifyExitObserved, onchainRail, openDatabase, outpointExclusion, outpointReasons, pageResult, promisifyRequest, provisionClaimSecret, provisionRefundKey, registerWalletRestoreHook, resolveAssetAmount, resolveBatchExpiryPolicy, resolveDescriptorSigner, resolvePrevTxs, resolveSendAmount, saveVtxosForContract, scriptFromArkAddress, selectCoinsWithAsset, selectVirtualCoins, selectionOf, serializeAssets, serializeExitPackage, serializeUtxo, serializeVtxo, setupServiceWorker, signAndSubmitOffchainTx, signerSetFromInfo, signingDescriptorIndex, strictSigningDescriptorIndex, submitViaEmulator, toXOnlySignerHex, tryResolveSendAmount, utxoEntries, validateBatchRecipients, validateConnectorsTxGraph, validateVtxoTxGraph, verifyTapscriptSignatures, waitForIncomingFunds, walletFeeSource, warnAndFilterVtxosForScript, withPrevTxs };
|
|
25990
|
-
//# sourceMappingURL=chunk-
|
|
25991
|
-
//# sourceMappingURL=chunk-
|
|
26038
|
+
//# sourceMappingURL=chunk-HAQAWBYG.js.map
|
|
26039
|
+
//# sourceMappingURL=chunk-HAQAWBYG.js.map
|