@arkade-os/sdk 0.4.0-next.5 → 0.4.0-next.7

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.
@@ -13,6 +13,9 @@ class DelegatorManagerImpl {
13
13
  this.arkInfoProvider = arkInfoProvider;
14
14
  this.identity = identity;
15
15
  }
16
+ async getDelegateInfo() {
17
+ return this.delegatorProvider.getDelegateInfo();
18
+ }
16
19
  async delegate(vtxos, destination, delegateAt) {
17
20
  if (vtxos.length === 0) {
18
21
  return { delegated: [], failed: [] };
@@ -215,6 +215,9 @@ class ExpoWallet {
215
215
  getContractManager() {
216
216
  return this.wallet.getContractManager();
217
217
  }
218
+ getDelegatorManager() {
219
+ return this.wallet.getDelegatorManager();
220
+ }
218
221
  sendBitcoin(params) {
219
222
  return this.wallet.sendBitcoin(params);
220
223
  }
@@ -293,6 +293,19 @@ class WalletMessageHandler {
293
293
  const response = await this.handleDelegate(message);
294
294
  return this.tagged({ id, ...response });
295
295
  }
296
+ case "GET_DELEGATE_INFO": {
297
+ const wallet = this.requireWallet();
298
+ const delegatorManager = await wallet.getDelegatorManager();
299
+ if (!delegatorManager) {
300
+ throw new Error("Delegator not configured");
301
+ }
302
+ const info = await delegatorManager.getDelegateInfo();
303
+ return this.tagged({
304
+ id,
305
+ type: "DELEGATE_INFO",
306
+ payload: { info },
307
+ });
308
+ }
296
309
  default:
297
310
  console.error("Unknown message type", message);
298
311
  throw new Error("Unknown message");
@@ -508,14 +521,15 @@ class WalletMessageHandler {
508
521
  }
509
522
  async handleDelegate(message) {
510
523
  const wallet = this.requireWallet();
511
- if (!wallet.delegatorManager) {
524
+ const delegatorManager = await wallet.getDelegatorManager();
525
+ if (!delegatorManager) {
512
526
  throw new Error("Delegator not configured");
513
527
  }
514
528
  const { vtxoOutpoints, destination, delegateAt } = message.payload;
515
529
  const allVtxos = await wallet.getVtxos();
516
530
  const outpointSet = new Set(vtxoOutpoints.map((o) => `${o.txid}:${o.vout}`));
517
531
  const filtered = allVtxos.filter((v) => outpointSet.has(`${v.txid}:${v.vout}`));
518
- const result = await wallet.delegatorManager.delegate(filtered, destination, delegateAt !== undefined ? new Date(delegateAt) : undefined);
532
+ const result = await delegatorManager.delegate(filtered, destination, delegateAt !== undefined ? new Date(delegateAt) : undefined);
519
533
  return {
520
534
  tag: this.messageTag,
521
535
  type: "DELEGATE_SUCCESS",
@@ -501,13 +501,14 @@ class ServiceWorkerReadonlyWallet {
501
501
  }
502
502
  exports.ServiceWorkerReadonlyWallet = ServiceWorkerReadonlyWallet;
503
503
  class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
504
- constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag) {
504
+ constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegator) {
505
505
  super(serviceWorker, identity, walletRepository, contractRepository, messageTag);
506
506
  this.serviceWorker = serviceWorker;
507
507
  this.identity = identity;
508
508
  this.walletRepository = walletRepository;
509
509
  this.contractRepository = contractRepository;
510
510
  this._assetManager = new ServiceWorkerAssetManager((msg) => this.sendMessage(msg), messageTag);
511
+ this.hasDelegator = hasDelegator;
511
512
  }
512
513
  get assetManager() {
513
514
  return this._assetManager;
@@ -528,7 +529,7 @@ class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
528
529
  const privateKey = identity.toHex();
529
530
  const messageTag = options.walletUpdaterTag ?? wallet_message_handler_1.DEFAULT_MESSAGE_TAG;
530
531
  // Create the wallet instance
531
- const wallet = new ServiceWorkerWallet(options.serviceWorker, identity, walletRepository, contractRepository, messageTag);
532
+ const wallet = new ServiceWorkerWallet(options.serviceWorker, identity, walletRepository, contractRepository, messageTag, !!options.delegatorUrl);
532
533
  const initConfig = {
533
534
  key: { privateKey },
534
535
  arkServerUrl: options.arkServerUrl,
@@ -656,24 +657,58 @@ class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
656
657
  throw new Error(`Send failed: ${error}`);
657
658
  }
658
659
  }
659
- async delegate(vtxoOutpoints, destination, delegateAt) {
660
- const message = {
661
- tag: this.messageTag,
662
- type: "DELEGATE",
663
- id: (0, utils_2.getRandomId)(),
664
- payload: {
665
- vtxoOutpoints,
666
- destination,
667
- delegateAt: delegateAt?.getTime(),
660
+ async getDelegatorManager() {
661
+ if (!this.hasDelegator) {
662
+ return undefined;
663
+ }
664
+ const wallet = this;
665
+ const messageTag = this.messageTag;
666
+ const manager = {
667
+ async delegate(vtxos, destination, delegateAt) {
668
+ const message = {
669
+ tag: messageTag,
670
+ type: "DELEGATE",
671
+ id: (0, utils_2.getRandomId)(),
672
+ payload: {
673
+ vtxoOutpoints: vtxos.map((v) => ({
674
+ txid: v.txid,
675
+ vout: v.vout,
676
+ })),
677
+ destination,
678
+ delegateAt: delegateAt?.getTime(),
679
+ },
680
+ };
681
+ try {
682
+ const response = await wallet.sendMessage(message);
683
+ const payload = response.payload;
684
+ return {
685
+ delegated: payload.delegated,
686
+ failed: payload.failed.map((f) => ({
687
+ outpoints: f.outpoints,
688
+ error: f.error,
689
+ })),
690
+ };
691
+ }
692
+ catch (error) {
693
+ throw new Error(`Delegation failed: ${error}`);
694
+ }
695
+ },
696
+ async getDelegateInfo() {
697
+ const message = {
698
+ type: "GET_DELEGATE_INFO",
699
+ id: (0, utils_2.getRandomId)(),
700
+ tag: messageTag,
701
+ };
702
+ try {
703
+ const response = await wallet.sendMessage(message);
704
+ return response.payload.info;
705
+ }
706
+ catch (e) {
707
+ throw new Error("Failed to get delegate info");
708
+ }
668
709
  },
669
710
  };
670
- try {
671
- const response = await this.sendMessage(message);
672
- return response.payload;
673
- }
674
- catch (error) {
675
- throw new Error(`Delegation failed: ${error}`);
676
- }
711
+ return manager;
677
712
  }
678
713
  }
679
714
  exports.ServiceWorkerWallet = ServiceWorkerWallet;
@@ -273,21 +273,6 @@ class ReadonlyWallet {
273
273
  await this.walletRepository.saveVtxos(address, allExtended);
274
274
  return allExtended;
275
275
  }
276
- async getVirtualCoins(filter = { withRecoverable: true, withUnrolled: false }) {
277
- const scripts = [base_1.hex.encode(this.offchainTapscript.pkScript)];
278
- const response = await this.indexerProvider.getVtxos({ scripts });
279
- const allVtxos = response.vtxos;
280
- let vtxos = allVtxos.filter(_1.isSpendable);
281
- // all recoverable vtxos are spendable by definition
282
- if (!filter.withRecoverable) {
283
- vtxos = vtxos.filter((vtxo) => !(0, _1.isRecoverable)(vtxo) && !(0, _1.isExpired)(vtxo));
284
- }
285
- if (filter.withUnrolled) {
286
- const spentVtxos = allVtxos.filter((vtxo) => !(0, _1.isSpendable)(vtxo));
287
- vtxos.push(...spentVtxos.filter((vtxo) => vtxo.isUnrolled));
288
- }
289
- return vtxos;
290
- }
291
276
  async getTransactionHistory() {
292
277
  const scripts = await this.getWalletScripts();
293
278
  const response = await this.indexerProvider.getVtxos({ scripts });
@@ -459,9 +444,13 @@ class ReadonlyWallet {
459
444
  * Falls back to only the current script if ContractManager is not yet initialized.
460
445
  */
461
446
  async getWalletScripts() {
462
- if (this._contractManager) {
447
+ // Only use the contract manager if it's already initialized or
448
+ // currently initializing — never trigger initialization here to
449
+ // avoid blocking callers that don't need it.
450
+ if (this._contractManager || this._contractManagerInitializing) {
463
451
  try {
464
- const contracts = await this._contractManager.getContracts({
452
+ const manager = await this.getContractManager();
453
+ const contracts = await manager.getContracts({
465
454
  type: ["default", "delegate"],
466
455
  });
467
456
  if (contracts.length > 0) {
@@ -676,7 +665,7 @@ class Wallet extends ReadonlyWallet {
676
665
  ...vtxo_manager_1.DEFAULT_RENEWAL_CONFIG,
677
666
  ...renewalConfig,
678
667
  };
679
- this.delegatorManager = delegatorProvider
668
+ this._delegatorManager = delegatorProvider
680
669
  ? new delegator_1.DelegatorManagerImpl(delegatorProvider, arkProvider, identity)
681
670
  : undefined;
682
671
  }
@@ -731,6 +720,13 @@ class Wallet extends ReadonlyWallet {
731
720
  : this.identity; // Identity extends ReadonlyIdentity, so this is safe
732
721
  return new ReadonlyWallet(readonlyIdentity, this.network, this.onchainProvider, this.indexerProvider, this.arkServerPublicKey, this.offchainTapscript, this.boardingTapscript, this.dustAmount, this.walletRepository, this.contractRepository, this.delegatorProvider, this.watcherConfig);
733
722
  }
723
+ async getDelegatorManager() {
724
+ return this._delegatorManager;
725
+ }
726
+ /**
727
+ * @deprecated Use `send`
728
+ * @param params
729
+ */
734
730
  async sendBitcoin(params) {
735
731
  if (params.amount <= 0) {
736
732
  throw new Error("Amount must be positive");
@@ -964,7 +960,7 @@ class Wallet extends ReadonlyWallet {
964
960
  async handleSettlementFinalizationEvent(event, inputs, forfeitOutputScript, connectorsGraph) {
965
961
  // the signed forfeits transactions to submit
966
962
  const signedForfeits = [];
967
- const vtxos = await this.getVirtualCoins();
963
+ const vtxos = await this.getVtxos();
968
964
  let settlementPsbt = btc_signer_1.Transaction.fromPSBT(base_1.base64.decode(event.commitmentTx));
969
965
  let hasBoardingUtxos = false;
970
966
  let connectorIndex = 0;
@@ -1283,7 +1279,7 @@ class Wallet extends ReadonlyWallet {
1283
1279
  const recipients = (0, utils_1.validateRecipients)(args, Number(this.dustAmount));
1284
1280
  const address = await this.getAddress();
1285
1281
  const outputAddress = address_1.ArkAddress.decode(address);
1286
- const virtualCoins = await this.getVirtualCoins({
1282
+ const virtualCoins = await this.getVtxos({
1287
1283
  withRecoverable: false,
1288
1284
  });
1289
1285
  // keep track of asset changes
@@ -1418,16 +1414,12 @@ class Wallet extends ReadonlyWallet {
1418
1414
  * @returns The ark transaction id and server-signed checkpoint PSBTs (for bookkeeping)
1419
1415
  */
1420
1416
  async buildAndSubmitOffchainTx(inputs, outputs) {
1421
- const tapLeafScript = this.offchainTapscript.forfeit();
1422
- if (!tapLeafScript) {
1423
- throw new Error("Selected leaf not found");
1424
- }
1425
- const tapTree = this.offchainTapscript.encode();
1426
- const offchainTx = (0, arkTransaction_1.buildOffchainTx)(inputs.map((input) => ({
1427
- ...input,
1428
- tapLeafScript,
1429
- tapTree,
1430
- })), outputs, this.serverUnrollScript);
1417
+ const offchainTx = (0, arkTransaction_1.buildOffchainTx)(inputs.map((input) => {
1418
+ return {
1419
+ ...input,
1420
+ tapLeafScript: input.forfeitTapLeafScript,
1421
+ };
1422
+ }), outputs, this.serverUnrollScript);
1431
1423
  const signedVirtualTx = await this.identity.sign(offchainTx.arkTx);
1432
1424
  const { arkTxid, signedCheckpointTxs } = await this.arkProvider.submitTx(base_1.base64.encode(signedVirtualTx.toPSBT()), offchainTx.checkpoints.map((c) => base_1.base64.encode(c.toPSBT())));
1433
1425
  const finalCheckpoints = await Promise.all(signedCheckpointTxs.map(async (c) => {
@@ -10,6 +10,9 @@ export class DelegatorManagerImpl {
10
10
  this.arkInfoProvider = arkInfoProvider;
11
11
  this.identity = identity;
12
12
  }
13
+ async getDelegateInfo() {
14
+ return this.delegatorProvider.getDelegateInfo();
15
+ }
13
16
  async delegate(vtxos, destination, delegateAt) {
14
17
  if (vtxos.length === 0) {
15
18
  return { delegated: [], failed: [] };
@@ -179,6 +179,9 @@ export class ExpoWallet {
179
179
  getContractManager() {
180
180
  return this.wallet.getContractManager();
181
181
  }
182
+ getDelegatorManager() {
183
+ return this.wallet.getDelegatorManager();
184
+ }
182
185
  sendBitcoin(params) {
183
186
  return this.wallet.sendBitcoin(params);
184
187
  }
@@ -290,6 +290,19 @@ export class WalletMessageHandler {
290
290
  const response = await this.handleDelegate(message);
291
291
  return this.tagged({ id, ...response });
292
292
  }
293
+ case "GET_DELEGATE_INFO": {
294
+ const wallet = this.requireWallet();
295
+ const delegatorManager = await wallet.getDelegatorManager();
296
+ if (!delegatorManager) {
297
+ throw new Error("Delegator not configured");
298
+ }
299
+ const info = await delegatorManager.getDelegateInfo();
300
+ return this.tagged({
301
+ id,
302
+ type: "DELEGATE_INFO",
303
+ payload: { info },
304
+ });
305
+ }
293
306
  default:
294
307
  console.error("Unknown message type", message);
295
308
  throw new Error("Unknown message");
@@ -505,14 +518,15 @@ export class WalletMessageHandler {
505
518
  }
506
519
  async handleDelegate(message) {
507
520
  const wallet = this.requireWallet();
508
- if (!wallet.delegatorManager) {
521
+ const delegatorManager = await wallet.getDelegatorManager();
522
+ if (!delegatorManager) {
509
523
  throw new Error("Delegator not configured");
510
524
  }
511
525
  const { vtxoOutpoints, destination, delegateAt } = message.payload;
512
526
  const allVtxos = await wallet.getVtxos();
513
527
  const outpointSet = new Set(vtxoOutpoints.map((o) => `${o.txid}:${o.vout}`));
514
528
  const filtered = allVtxos.filter((v) => outpointSet.has(`${v.txid}:${v.vout}`));
515
- const result = await wallet.delegatorManager.delegate(filtered, destination, delegateAt !== undefined ? new Date(delegateAt) : undefined);
529
+ const result = await delegatorManager.delegate(filtered, destination, delegateAt !== undefined ? new Date(delegateAt) : undefined);
516
530
  return {
517
531
  tag: this.messageTag,
518
532
  type: "DELEGATE_SUCCESS",
@@ -497,13 +497,14 @@ export class ServiceWorkerReadonlyWallet {
497
497
  }
498
498
  }
499
499
  export class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
500
- constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag) {
500
+ constructor(serviceWorker, identity, walletRepository, contractRepository, messageTag, hasDelegator) {
501
501
  super(serviceWorker, identity, walletRepository, contractRepository, messageTag);
502
502
  this.serviceWorker = serviceWorker;
503
503
  this.identity = identity;
504
504
  this.walletRepository = walletRepository;
505
505
  this.contractRepository = contractRepository;
506
506
  this._assetManager = new ServiceWorkerAssetManager((msg) => this.sendMessage(msg), messageTag);
507
+ this.hasDelegator = hasDelegator;
507
508
  }
508
509
  get assetManager() {
509
510
  return this._assetManager;
@@ -524,7 +525,7 @@ export class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
524
525
  const privateKey = identity.toHex();
525
526
  const messageTag = options.walletUpdaterTag ?? DEFAULT_MESSAGE_TAG;
526
527
  // Create the wallet instance
527
- const wallet = new ServiceWorkerWallet(options.serviceWorker, identity, walletRepository, contractRepository, messageTag);
528
+ const wallet = new ServiceWorkerWallet(options.serviceWorker, identity, walletRepository, contractRepository, messageTag, !!options.delegatorUrl);
528
529
  const initConfig = {
529
530
  key: { privateKey },
530
531
  arkServerUrl: options.arkServerUrl,
@@ -652,23 +653,57 @@ export class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet {
652
653
  throw new Error(`Send failed: ${error}`);
653
654
  }
654
655
  }
655
- async delegate(vtxoOutpoints, destination, delegateAt) {
656
- const message = {
657
- tag: this.messageTag,
658
- type: "DELEGATE",
659
- id: getRandomId(),
660
- payload: {
661
- vtxoOutpoints,
662
- destination,
663
- delegateAt: delegateAt?.getTime(),
656
+ async getDelegatorManager() {
657
+ if (!this.hasDelegator) {
658
+ return undefined;
659
+ }
660
+ const wallet = this;
661
+ const messageTag = this.messageTag;
662
+ const manager = {
663
+ async delegate(vtxos, destination, delegateAt) {
664
+ const message = {
665
+ tag: messageTag,
666
+ type: "DELEGATE",
667
+ id: getRandomId(),
668
+ payload: {
669
+ vtxoOutpoints: vtxos.map((v) => ({
670
+ txid: v.txid,
671
+ vout: v.vout,
672
+ })),
673
+ destination,
674
+ delegateAt: delegateAt?.getTime(),
675
+ },
676
+ };
677
+ try {
678
+ const response = await wallet.sendMessage(message);
679
+ const payload = response.payload;
680
+ return {
681
+ delegated: payload.delegated,
682
+ failed: payload.failed.map((f) => ({
683
+ outpoints: f.outpoints,
684
+ error: f.error,
685
+ })),
686
+ };
687
+ }
688
+ catch (error) {
689
+ throw new Error(`Delegation failed: ${error}`);
690
+ }
691
+ },
692
+ async getDelegateInfo() {
693
+ const message = {
694
+ type: "GET_DELEGATE_INFO",
695
+ id: getRandomId(),
696
+ tag: messageTag,
697
+ };
698
+ try {
699
+ const response = await wallet.sendMessage(message);
700
+ return response.payload.info;
701
+ }
702
+ catch (e) {
703
+ throw new Error("Failed to get delegate info");
704
+ }
664
705
  },
665
706
  };
666
- try {
667
- const response = await this.sendMessage(message);
668
- return response.payload;
669
- }
670
- catch (error) {
671
- throw new Error(`Delegation failed: ${error}`);
672
- }
707
+ return manager;
673
708
  }
674
709
  }
@@ -268,21 +268,6 @@ export class ReadonlyWallet {
268
268
  await this.walletRepository.saveVtxos(address, allExtended);
269
269
  return allExtended;
270
270
  }
271
- async getVirtualCoins(filter = { withRecoverable: true, withUnrolled: false }) {
272
- const scripts = [hex.encode(this.offchainTapscript.pkScript)];
273
- const response = await this.indexerProvider.getVtxos({ scripts });
274
- const allVtxos = response.vtxos;
275
- let vtxos = allVtxos.filter(isSpendable);
276
- // all recoverable vtxos are spendable by definition
277
- if (!filter.withRecoverable) {
278
- vtxos = vtxos.filter((vtxo) => !isRecoverable(vtxo) && !isExpired(vtxo));
279
- }
280
- if (filter.withUnrolled) {
281
- const spentVtxos = allVtxos.filter((vtxo) => !isSpendable(vtxo));
282
- vtxos.push(...spentVtxos.filter((vtxo) => vtxo.isUnrolled));
283
- }
284
- return vtxos;
285
- }
286
271
  async getTransactionHistory() {
287
272
  const scripts = await this.getWalletScripts();
288
273
  const response = await this.indexerProvider.getVtxos({ scripts });
@@ -454,9 +439,13 @@ export class ReadonlyWallet {
454
439
  * Falls back to only the current script if ContractManager is not yet initialized.
455
440
  */
456
441
  async getWalletScripts() {
457
- if (this._contractManager) {
442
+ // Only use the contract manager if it's already initialized or
443
+ // currently initializing — never trigger initialization here to
444
+ // avoid blocking callers that don't need it.
445
+ if (this._contractManager || this._contractManagerInitializing) {
458
446
  try {
459
- const contracts = await this._contractManager.getContracts({
447
+ const manager = await this.getContractManager();
448
+ const contracts = await manager.getContracts({
460
449
  type: ["default", "delegate"],
461
450
  });
462
451
  if (contracts.length > 0) {
@@ -670,7 +659,7 @@ export class Wallet extends ReadonlyWallet {
670
659
  ...DEFAULT_RENEWAL_CONFIG,
671
660
  ...renewalConfig,
672
661
  };
673
- this.delegatorManager = delegatorProvider
662
+ this._delegatorManager = delegatorProvider
674
663
  ? new DelegatorManagerImpl(delegatorProvider, arkProvider, identity)
675
664
  : undefined;
676
665
  }
@@ -725,6 +714,13 @@ export class Wallet extends ReadonlyWallet {
725
714
  : this.identity; // Identity extends ReadonlyIdentity, so this is safe
726
715
  return new ReadonlyWallet(readonlyIdentity, this.network, this.onchainProvider, this.indexerProvider, this.arkServerPublicKey, this.offchainTapscript, this.boardingTapscript, this.dustAmount, this.walletRepository, this.contractRepository, this.delegatorProvider, this.watcherConfig);
727
716
  }
717
+ async getDelegatorManager() {
718
+ return this._delegatorManager;
719
+ }
720
+ /**
721
+ * @deprecated Use `send`
722
+ * @param params
723
+ */
728
724
  async sendBitcoin(params) {
729
725
  if (params.amount <= 0) {
730
726
  throw new Error("Amount must be positive");
@@ -958,7 +954,7 @@ export class Wallet extends ReadonlyWallet {
958
954
  async handleSettlementFinalizationEvent(event, inputs, forfeitOutputScript, connectorsGraph) {
959
955
  // the signed forfeits transactions to submit
960
956
  const signedForfeits = [];
961
- const vtxos = await this.getVirtualCoins();
957
+ const vtxos = await this.getVtxos();
962
958
  let settlementPsbt = Transaction.fromPSBT(base64.decode(event.commitmentTx));
963
959
  let hasBoardingUtxos = false;
964
960
  let connectorIndex = 0;
@@ -1277,7 +1273,7 @@ export class Wallet extends ReadonlyWallet {
1277
1273
  const recipients = validateRecipients(args, Number(this.dustAmount));
1278
1274
  const address = await this.getAddress();
1279
1275
  const outputAddress = ArkAddress.decode(address);
1280
- const virtualCoins = await this.getVirtualCoins({
1276
+ const virtualCoins = await this.getVtxos({
1281
1277
  withRecoverable: false,
1282
1278
  });
1283
1279
  // keep track of asset changes
@@ -1412,16 +1408,12 @@ export class Wallet extends ReadonlyWallet {
1412
1408
  * @returns The ark transaction id and server-signed checkpoint PSBTs (for bookkeeping)
1413
1409
  */
1414
1410
  async buildAndSubmitOffchainTx(inputs, outputs) {
1415
- const tapLeafScript = this.offchainTapscript.forfeit();
1416
- if (!tapLeafScript) {
1417
- throw new Error("Selected leaf not found");
1418
- }
1419
- const tapTree = this.offchainTapscript.encode();
1420
- const offchainTx = buildOffchainTx(inputs.map((input) => ({
1421
- ...input,
1422
- tapLeafScript,
1423
- tapTree,
1424
- })), outputs, this.serverUnrollScript);
1411
+ const offchainTx = buildOffchainTx(inputs.map((input) => {
1412
+ return {
1413
+ ...input,
1414
+ tapLeafScript: input.forfeitTapLeafScript,
1415
+ };
1416
+ }), outputs, this.serverUnrollScript);
1425
1417
  const signedVirtualTx = await this.identity.sign(offchainTx.arkTx);
1426
1418
  const { arkTxid, signedCheckpointTxs } = await this.arkProvider.submitTx(base64.encode(signedVirtualTx.toPSBT()), offchainTx.checkpoints.map((c) => base64.encode(c.toPSBT())));
1427
1419
  const finalCheckpoints = await Promise.all(signedCheckpointTxs.map(async (c) => {
@@ -39,7 +39,7 @@ import { validateVtxoTxGraph, validateConnectorsTxGraph } from "./tree/validatio
39
39
  import { buildForfeitTx } from "./forfeit";
40
40
  import { IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, WalletRepository, ContractRepository } from "./repositories";
41
41
  import type { MigrationStatus } from "./repositories";
42
- import { DelegatorManagerImpl, DelegatorManager } from "./wallet/delegator";
42
+ import { DelegatorManagerImpl, IDelegatorManager } from "./wallet/delegator";
43
43
  export * from "./arkfee";
44
44
  export * as asset from "./extension/asset";
45
45
  import { ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract } from "./contracts";
@@ -48,4 +48,4 @@ import { IContractManager } from "./contracts/contractManager";
48
48
  import { closeDatabase, openDatabase } from "./repositories/indexedDB/manager";
49
49
  import { WalletMessageHandler } from "./wallet/serviceWorker/wallet-message-handler";
50
50
  export { Wallet, ReadonlyWallet, SingleKey, ReadonlySingleKey, SeedIdentity, MnemonicIdentity, ReadonlyDescriptorIdentity, OnchainWallet, Ramps, VtxoManager, DelegatorManagerImpl, RestDelegatorProvider, ESPLORA_URL, EsploraProvider, RestArkProvider, RestIndexerProvider, ArkAddress, DefaultVtxo, DelegateVtxo, VtxoScript, VHTLC, TxType, IndexerTxType, ChainTxType, SettlementEventType, setupServiceWorker, MessageBus, WalletMessageHandler, ServiceWorkerWallet, ServiceWorkerReadonlyWallet, decodeTapscript, MultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CLTVMultisigTapscript, TapTreeCoder, ArkPsbtFieldKey, ArkPsbtFieldKeyType, setArkPsbtField, getArkPsbtFields, CosignerPublicKey, VtxoTreeExpiry, VtxoTaprootTree, ConditionWitness, buildOffchainTx, verifyTapscriptSignatures, waitForIncomingFunds, hasBoardingTxExpired, combineTapscriptSigs, isVtxoExpiringSoon, isValidArkAddress, ArkNote, networks, closeDatabase, openDatabase, IndexedDBWalletRepository, IndexedDBContractRepository, InMemoryWalletRepository, InMemoryContractRepository, MIGRATION_KEY, migrateWalletRepository, requiresMigration, getMigrationStatus, rollbackMigration, WalletRepositoryImpl, ContractRepositoryImpl, Intent, BIP322, TxTree, P2A, Unroll, Transaction, ArkError, maybeArkError, Batch, validateVtxoTxGraph, validateConnectorsTxGraph, buildForfeitTx, isRecoverable, isSpendable, isSubdust, isExpired, getSequence, ContractManager, ContractWatcher, contractHandlers, DefaultContractHandler, DelegateContractHandler, VHTLCContractHandler, encodeArkContract, decodeArkContract, contractFromArkContract, contractFromArkContractWithAddress, isArkContract, };
51
- export type { Identity, ReadonlyIdentity, IWallet, IReadonlyWallet, BaseWalletConfig, WalletConfig, ReadonlyWalletConfig, ProviderClass, ArkTransaction, Coin, ExtendedCoin, ExtendedVirtualCoin, WalletBalance, SendBitcoinParams, SettleParams, Status, VirtualStatus, Outpoint, VirtualCoin, TxKey, TapscriptType, ArkTxInput, OffchainTx, TapLeaves, IncomingFunds, SeedIdentityOptions, MnemonicOptions, NetworkOptions, DescriptorOptions, IndexerProvider, PageResponse, BatchInfo, ChainTx, CommitmentTx, TxHistoryRecord, Vtxo, VtxoChain, Tx, OnchainProvider, ArkProvider, SettlementEvent, FeeInfo, ArkInfo, SignedIntent, Output, TxNotification, ExplorerTransaction, BatchFinalizationEvent, BatchFinalizedEvent, BatchFailedEvent, TreeSigningStartedEvent, TreeNoncesEvent, BatchStartedEvent, TreeTxEvent, TreeSignatureEvent, ScheduledSession, PaginationOptions, SubscriptionResponse, SubscriptionHeartbeat, SubscriptionEvent, Network, NetworkName, ArkTapscript, RelativeTimelock, EncodedVtxoScript, TapLeafScript, SignerSession, TreeNonces, TreePartialSigs, GetVtxosFilter, Asset, Recipient, IssuanceParams, IssuanceResult, ReissuanceParams, BurnParams, AssetDetails, AssetMetadata, KnownMetadata, Nonces, PartialSig, ArkPsbtFieldCoder, TxTreeNode, AnchorBumper, StorageConfig, Contract, ContractVtxo, ContractState, ContractEvent, ContractEventCallback, ContractBalance, ContractWithVtxos, ContractHandler, IContractManager, PathSelection, PathContext, ContractManagerConfig, CreateContractParams, ContractWatcherConfig, ParsedArkContract, DefaultContractParams, DelegateContractParams, VHTLCContractParams, MessageHandler, RequestEnvelope, ResponseEnvelope, DelegatorManager, DelegatorProvider, DelegateInfo, DelegateOptions, WalletRepository, ContractRepository, MigrationStatus, };
51
+ export type { Identity, ReadonlyIdentity, IWallet, IReadonlyWallet, BaseWalletConfig, WalletConfig, ReadonlyWalletConfig, ProviderClass, ArkTransaction, Coin, ExtendedCoin, ExtendedVirtualCoin, WalletBalance, SendBitcoinParams, SettleParams, Status, VirtualStatus, Outpoint, VirtualCoin, TxKey, TapscriptType, ArkTxInput, OffchainTx, TapLeaves, IncomingFunds, SeedIdentityOptions, MnemonicOptions, NetworkOptions, DescriptorOptions, IndexerProvider, PageResponse, BatchInfo, ChainTx, CommitmentTx, TxHistoryRecord, Vtxo, VtxoChain, Tx, OnchainProvider, ArkProvider, SettlementEvent, FeeInfo, ArkInfo, SignedIntent, Output, TxNotification, ExplorerTransaction, BatchFinalizationEvent, BatchFinalizedEvent, BatchFailedEvent, TreeSigningStartedEvent, TreeNoncesEvent, BatchStartedEvent, TreeTxEvent, TreeSignatureEvent, ScheduledSession, PaginationOptions, SubscriptionResponse, SubscriptionHeartbeat, SubscriptionEvent, Network, NetworkName, ArkTapscript, RelativeTimelock, EncodedVtxoScript, TapLeafScript, SignerSession, TreeNonces, TreePartialSigs, GetVtxosFilter, Asset, Recipient, IssuanceParams, IssuanceResult, ReissuanceParams, BurnParams, AssetDetails, AssetMetadata, KnownMetadata, Nonces, PartialSig, ArkPsbtFieldCoder, TxTreeNode, AnchorBumper, StorageConfig, Contract, ContractVtxo, ContractState, ContractEvent, ContractEventCallback, ContractBalance, ContractWithVtxos, ContractHandler, IContractManager, PathSelection, PathContext, ContractManagerConfig, CreateContractParams, ContractWatcherConfig, ParsedArkContract, DefaultContractParams, DelegateContractParams, VHTLCContractParams, MessageHandler, RequestEnvelope, ResponseEnvelope, IDelegatorManager, DelegatorProvider, DelegateInfo, DelegateOptions, WalletRepository, ContractRepository, MigrationStatus, };
@@ -1,5 +1,5 @@
1
1
  import { Packet } from "../extension/asset";
2
- import { Asset, Recipient, VirtualCoin } from "./index";
2
+ import { Asset, ExtendedVirtualCoin, Recipient, VirtualCoin } from "./index";
3
3
  /**
4
4
  * Creates an asset packet from asset inputs and receivers.
5
5
  * Groups inputs and outputs by asset ID and creates the Packet object
@@ -13,8 +13,8 @@ export declare function createAssetPacket(assetInputs: Map<number, Asset[]>, rec
13
13
  * Selects coins that contain a specific asset.
14
14
  * Returns coins sorted by amount (smallest first for better coin selection).
15
15
  */
16
- export declare function selectCoinsWithAsset(coins: VirtualCoin[], assetId: string, requiredAmount: bigint): {
17
- selected: VirtualCoin[];
16
+ export declare function selectCoinsWithAsset(coins: ExtendedVirtualCoin[], assetId: string, requiredAmount: bigint): {
17
+ selected: ExtendedVirtualCoin[];
18
18
  totalAssetAmount: bigint;
19
19
  };
20
20
  export declare function computeAssetChange(inputAssets: Map<string, bigint>, outputAssets: Map<string, bigint>): Map<string, bigint>;
@@ -1,6 +1,6 @@
1
- import { ArkProvider, ExtendedVirtualCoin, Identity, Outpoint } from "..";
1
+ import { ArkProvider, DelegateInfo, ExtendedVirtualCoin, Identity, Outpoint } from "..";
2
2
  import { DelegatorProvider } from "../providers/delegator";
3
- export interface DelegatorManager {
3
+ export interface IDelegatorManager {
4
4
  delegate(vtxos: ExtendedVirtualCoin[], destination: string, delegateAt?: Date): Promise<{
5
5
  delegated: Outpoint[];
6
6
  failed: {
@@ -8,12 +8,14 @@ export interface DelegatorManager {
8
8
  error: unknown;
9
9
  }[];
10
10
  }>;
11
+ getDelegateInfo(): Promise<DelegateInfo>;
11
12
  }
12
- export declare class DelegatorManagerImpl implements DelegatorManager {
13
+ export declare class DelegatorManagerImpl implements IDelegatorManager {
13
14
  readonly delegatorProvider: DelegatorProvider;
14
15
  readonly arkInfoProvider: Pick<ArkProvider, "getInfo">;
15
16
  readonly identity: Identity;
16
17
  constructor(delegatorProvider: DelegatorProvider, arkInfoProvider: Pick<ArkProvider, "getInfo">, identity: Identity);
18
+ getDelegateInfo(): Promise<DelegateInfo>;
17
19
  delegate(vtxos: ExtendedVirtualCoin[], destination: string, delegateAt?: Date): Promise<{
18
20
  delegated: Outpoint[];
19
21
  failed: {
@@ -3,6 +3,7 @@ import type { IWallet, IAssetManager, WalletBalance, WalletConfig, SendBitcoinPa
3
3
  import type { SettlementEvent } from "../../providers/ark";
4
4
  import type { Identity } from "../../identity";
5
5
  import type { IContractManager } from "../../contracts/contractManager";
6
+ import type { IDelegatorManager } from "../delegator";
6
7
  import type { TaskQueue } from "../../worker/expo/taskQueue";
7
8
  import type { TaskProcessor } from "../../worker/expo/taskRunner";
8
9
  /**
@@ -90,6 +91,7 @@ export declare class ExpoWallet implements IWallet {
90
91
  getBoardingUtxos(): Promise<ExtendedCoin[]>;
91
92
  getTransactionHistory(): Promise<ArkTransaction[]>;
92
93
  getContractManager(): Promise<IContractManager>;
94
+ getDelegatorManager(): Promise<IDelegatorManager | undefined>;
93
95
  sendBitcoin(params: SendBitcoinParams): Promise<string>;
94
96
  settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise<string>;
95
97
  send(...recipients: Recipient[]): Promise<string>;
@@ -9,6 +9,7 @@ import { OnchainProvider } from "../providers/onchain";
9
9
  import { ContractWatcherConfig } from "../contracts/contractWatcher";
10
10
  import { ContractRepository, WalletRepository } from "../repositories";
11
11
  import { IContractManager } from "../contracts/contractManager";
12
+ import { IDelegatorManager } from "./delegator";
12
13
  import { DelegatorProvider } from "../providers/delegator";
13
14
  /**
14
15
  * Base configuration options shared by all wallet types.
@@ -139,7 +140,7 @@ export interface SendBitcoinParams {
139
140
  amount: number;
140
141
  feeRate?: number;
141
142
  memo?: string;
142
- selectedVtxos?: VirtualCoin[];
143
+ selectedVtxos?: ExtendedVirtualCoin[];
143
144
  }
144
145
  export interface Asset {
145
146
  assetId: string;
@@ -276,6 +277,7 @@ export interface IWallet extends IReadonlyWallet {
276
277
  settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise<string>;
277
278
  send(...recipients: Recipient[]): Promise<string>;
278
279
  assetManager: IAssetManager;
280
+ getDelegatorManager(): Promise<IDelegatorManager | undefined>;
279
281
  }
280
282
  /**
281
283
  * Readonly wallet interface for Bitcoin transactions with Ark protocol support.
@@ -2,6 +2,7 @@ import { SettlementEvent } from "../../providers/ark";
2
2
  import type { Contract, ContractEvent, ContractWithVtxos, GetContractsFilter, PathSelection } from "../../contracts";
3
3
  import type { CreateContractParams, GetAllSpendingPathsOptions, GetSpendablePathsOptions } from "../../contracts/contractManager";
4
4
  import { ArkTransaction, AssetDetails, BurnParams, ExtendedCoin, GetVtxosFilter, IssuanceParams, IssuanceResult, IWallet, Recipient, ReissuanceParams, SendBitcoinParams, SettleParams, WalletBalance } from "../index";
5
+ import { DelegateInfo } from "../../providers/delegator";
5
6
  import { MessageHandler, RequestEnvelope, ResponseEnvelope } from "../../worker/messageBus";
6
7
  import { Transaction } from "../../utils/transaction";
7
8
  export declare const DEFAULT_MESSAGE_TAG = "WALLET_UPDATER";
@@ -345,8 +346,17 @@ export type ResponseDelegate = ResponseEnvelope & {
345
346
  }[];
346
347
  };
347
348
  };
348
- export type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate;
349
- export type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate);
349
+ export type RequestGetDelegateInfo = RequestEnvelope & {
350
+ type: "GET_DELEGATE_INFO";
351
+ };
352
+ export type ResponseGetDelegateInfo = ResponseEnvelope & {
353
+ type: "DELEGATE_INFO";
354
+ payload: {
355
+ info: DelegateInfo;
356
+ };
357
+ };
358
+ export type WalletUpdaterRequest = RequestInitWallet | RequestSettle | RequestSendBitcoin | RequestGetAddress | RequestGetBoardingAddress | RequestGetBalance | RequestGetVtxos | RequestGetBoardingUtxos | RequestGetTransactionHistory | RequestGetStatus | RequestClear | RequestReloadWallet | RequestSignTransaction | RequestCreateContract | RequestGetContracts | RequestGetContractsWithVtxos | RequestUpdateContract | RequestDeleteContract | RequestGetSpendablePaths | RequestGetAllSpendingPaths | RequestIsContractManagerWatching | RequestSend | RequestGetAssetDetails | RequestIssue | RequestReissue | RequestBurn | RequestDelegate | RequestGetDelegateInfo;
359
+ export type WalletUpdaterResponse = ResponseEnvelope & (ResponseInitWallet | ResponseSettle | ResponseSettleEvent | ResponseSendBitcoin | ResponseGetAddress | ResponseGetBoardingAddress | ResponseGetBalance | ResponseGetVtxos | ResponseGetBoardingUtxos | ResponseGetTransactionHistory | ResponseGetStatus | ResponseClear | ResponseReloadWallet | ResponseUtxoUpdate | ResponseVtxoUpdate | ResponseSignTransaction | ResponseCreateContract | ResponseGetContracts | ResponseGetContractsWithVtxos | ResponseUpdateContract | ResponseDeleteContract | ResponseGetSpendablePaths | ResponseGetAllSpendingPaths | ResponseIsContractManagerWatching | ResponseContractEvent | ResponseSend | ResponseGetAssetDetails | ResponseIssue | ResponseReissue | ResponseBurn | ResponseDelegate | ResponseGetDelegateInfo);
350
360
  export declare class WalletMessageHandler implements MessageHandler<WalletUpdaterRequest, WalletUpdaterResponse> {
351
361
  readonly messageTag: string;
352
362
  private wallet;
@@ -3,8 +3,9 @@ import { SettlementEvent } from "../../providers/ark";
3
3
  import { Identity, ReadonlyIdentity } from "../../identity";
4
4
  import { WalletRepository } from "../../repositories/walletRepository";
5
5
  import { ContractRepository } from "../../repositories/contractRepository";
6
- import { ResponseGetStatus, WalletUpdaterRequest, WalletUpdaterResponse, ResponseDelegate } from "./wallet-message-handler";
6
+ import { ResponseGetStatus, WalletUpdaterRequest, WalletUpdaterResponse } from "./wallet-message-handler";
7
7
  import type { IContractManager } from "../../contracts/contractManager";
8
+ import type { IDelegatorManager } from "../delegator";
8
9
  type PrivateKeyIdentity = Identity & {
9
10
  toHex(): string;
10
11
  };
@@ -106,7 +107,8 @@ export declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet imp
106
107
  readonly contractRepository: ContractRepository;
107
108
  readonly identity: Identity;
108
109
  private readonly _assetManager;
109
- protected constructor(serviceWorker: ServiceWorker, identity: PrivateKeyIdentity, walletRepository: WalletRepository, contractRepository: ContractRepository, messageTag: string);
110
+ private readonly hasDelegator;
111
+ protected constructor(serviceWorker: ServiceWorker, identity: PrivateKeyIdentity, walletRepository: WalletRepository, contractRepository: ContractRepository, messageTag: string, hasDelegator: boolean);
110
112
  get assetManager(): IAssetManager;
111
113
  static create(options: ServiceWorkerWalletCreateOptions): Promise<ServiceWorkerWallet>;
112
114
  /**
@@ -134,9 +136,6 @@ export declare class ServiceWorkerWallet extends ServiceWorkerReadonlyWallet imp
134
136
  sendBitcoin(params: SendBitcoinParams): Promise<string>;
135
137
  settle(params?: SettleParams, callback?: (event: SettlementEvent) => void): Promise<string>;
136
138
  send(...recipients: Recipient[]): Promise<string>;
137
- delegate(vtxoOutpoints: {
138
- txid: string;
139
- vout: number;
140
- }[], destination: string, delegateAt?: Date): Promise<ResponseDelegate["payload"]>;
139
+ getDelegatorManager(): Promise<IDelegatorManager | undefined>;
141
140
  }
142
141
  export {};
@@ -7,7 +7,7 @@ import { OnchainProvider } from "../providers/onchain";
7
7
  import { ArkProvider, SettlementEvent, SignedIntent } from "../providers/ark";
8
8
  import { SignerSession } from "../tree/signingSession";
9
9
  import { Identity, ReadonlyIdentity } from "../identity";
10
- import { ArkTransaction, Recipient, Coin, ExtendedCoin, ExtendedVirtualCoin, GetVtxosFilter, IReadonlyWallet, IWallet, ReadonlyWalletConfig, SendBitcoinParams, SettleParams, VirtualCoin, WalletBalance, WalletConfig, IAssetManager, IReadonlyAssetManager } from ".";
10
+ import { ArkTransaction, Recipient, Coin, ExtendedCoin, ExtendedVirtualCoin, GetVtxosFilter, IReadonlyWallet, IWallet, ReadonlyWalletConfig, SendBitcoinParams, SettleParams, WalletBalance, WalletConfig, IAssetManager, IReadonlyAssetManager } from ".";
11
11
  import { CSVMultisigTapscript } from "../script/tapscript";
12
12
  import { Intent } from "../intent";
13
13
  import { IndexerProvider } from "../providers/indexer";
@@ -16,7 +16,7 @@ import { ContractRepository } from "../repositories/contractRepository";
16
16
  import { Batch } from "./batch";
17
17
  import { DelegatorProvider } from "../providers/delegator";
18
18
  import { DelegateVtxo } from "../script/delegate";
19
- import { DelegatorManager } from "./delegator";
19
+ import { IDelegatorManager } from "./delegator";
20
20
  import { ContractManager } from "../contracts/contractManager";
21
21
  export type IncomingFunds = {
22
22
  type: "utxo";
@@ -74,7 +74,6 @@ export declare class ReadonlyWallet implements IReadonlyWallet {
74
74
  getBoardingAddress(): Promise<string>;
75
75
  getBalance(): Promise<WalletBalance>;
76
76
  getVtxos(filter?: GetVtxosFilter): Promise<ExtendedVirtualCoin[]>;
77
- protected getVirtualCoins(filter?: GetVtxosFilter): Promise<VirtualCoin[]>;
78
77
  getTransactionHistory(): Promise<ArkTransaction[]>;
79
78
  getBoardingTxs(): Promise<{
80
79
  boardingTxs: ArkTransaction[];
@@ -165,7 +164,7 @@ export declare class Wallet extends ReadonlyWallet implements IWallet {
165
164
  readonly forfeitPubkey: Bytes;
166
165
  static MIN_FEE_RATE: number;
167
166
  readonly identity: Identity;
168
- readonly delegatorManager?: DelegatorManager;
167
+ private readonly _delegatorManager?;
169
168
  private _walletAssetManager?;
170
169
  readonly renewalConfig: Required<Omit<WalletConfig["renewalConfig"], "enabled">> & {
171
170
  enabled: boolean;
@@ -192,6 +191,11 @@ export declare class Wallet extends ReadonlyWallet implements IWallet {
192
191
  * ```
193
192
  */
194
193
  toReadonly(): Promise<ReadonlyWallet>;
194
+ getDelegatorManager(): Promise<IDelegatorManager | undefined>;
195
+ /**
196
+ * @deprecated Use `send`
197
+ * @param params
198
+ */
195
199
  sendBitcoin(params: SendBitcoinParams): Promise<string>;
196
200
  settle(params?: SettleParams, eventCallback?: (event: SettlementEvent) => void): Promise<string>;
197
201
  private handleSettlementFinalizationEvent;
@@ -237,7 +241,7 @@ export declare class Wallet extends ReadonlyWallet implements IWallet {
237
241
  * sign it, submit to the ark provider, and finalize.
238
242
  * @returns The ark transaction id and server-signed checkpoint PSBTs (for bookkeeping)
239
243
  */
240
- buildAndSubmitOffchainTx(inputs: VirtualCoin[], outputs: TransactionOutput[]): Promise<{
244
+ buildAndSubmitOffchainTx(inputs: ExtendedVirtualCoin[], outputs: TransactionOutput[]): Promise<{
241
245
  arkTxid: string;
242
246
  signedCheckpointTxs: string[];
243
247
  }>;
@@ -250,8 +254,8 @@ export declare class Wallet extends ReadonlyWallet implements IWallet {
250
254
  * @param targetAmount Target amount to reach in satoshis
251
255
  * @returns Selected coins and change amount
252
256
  */
253
- export declare function selectVirtualCoins(coins: VirtualCoin[], targetAmount: number): {
254
- inputs: VirtualCoin[];
257
+ export declare function selectVirtualCoins(coins: ExtendedVirtualCoin[], targetAmount: number): {
258
+ inputs: ExtendedVirtualCoin[];
255
259
  changeAmount: bigint;
256
260
  };
257
261
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkade-os/sdk",
3
- "version": "0.4.0-next.5",
3
+ "version": "0.4.0-next.7",
4
4
  "description": "Bitcoin wallet SDK with Taproot and Ark integration",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",