@buildonspark/issuer-sdk 0.1.8 → 0.1.9

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @buildonspark/issuer-sdk
2
2
 
3
+ ## 0.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - - Freeze/Unfreeze Return Type Change: freezeTokens() and unfreezeTokens() now return impactedTokenOutputs: TokenOutputRef[] instead of impactedOutputIds: string[]. This provides richer output information including the token ID for each affected output.
8
+ - Updated dependencies
9
+ - @buildonspark/spark-sdk@0.5.9
10
+
3
11
  ## 0.1.8
4
12
 
5
13
  ### Patch Changes
package/README.md CHANGED
@@ -1,3 +1,128 @@
1
- # Welcome to Spark!
1
+ # Spark Issuer SDK
2
2
 
3
- You can find our official documentation at https://docs.spark.money/issuing/introduction
3
+ For complete documentation, visit [https://docs.spark.money](https://docs.spark.money)
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @buildonspark/issuer-sdk @buildonspark/spark-sdk
9
+ # or
10
+ yarn add @buildonspark/issuer-sdk @buildonspark/spark-sdk
11
+ # or
12
+ pnpm add @buildonspark/issuer-sdk @buildonspark/spark-sdk
13
+ ```
14
+
15
+ ## Quick Start
16
+
17
+ ### Initialize an Issuer Wallet
18
+
19
+ ```typescript
20
+ import { IssuerSparkWallet } from "@buildonspark/issuer-sdk";
21
+
22
+ // Create a new issuer wallet (generates a new mnemonic)
23
+ const { wallet, mnemonic } = await IssuerSparkWallet.create({
24
+ options: {
25
+ network: "MAINNET", // or "REGTEST" for testing
26
+ },
27
+ });
28
+
29
+ // Or initialize with an existing mnemonic
30
+ const wallet = await IssuerSparkWallet.initialize({
31
+ mnemonicOrSeed: "your twelve word mnemonic phrase here ...",
32
+ options: {
33
+ network: "MAINNET",
34
+ },
35
+ });
36
+ ```
37
+
38
+ ### Create a Token
39
+
40
+ ```typescript
41
+ const token = await wallet.createToken({
42
+ tokenName: "My Token",
43
+ tokenTicker: "MTK",
44
+ decimals: 8,
45
+ maxSupply: 1000000n,
46
+ isFreezable: true,
47
+ });
48
+
49
+ console.log(`Token created: ${token.tokenIdentifier}`);
50
+ ```
51
+
52
+ ### Mint Tokens
53
+
54
+ ```typescript
55
+ // Mint tokens to your own wallet
56
+ const mintResult = await wallet.mintTokens({
57
+ tokenIdentifier: "spark1...",
58
+ tokenAmount: 10000n,
59
+ });
60
+
61
+ // To distribute tokens to others, mint first then transfer
62
+ await wallet.mintTokens({
63
+ tokenIdentifier: "spark1...",
64
+ tokenAmount: 5000n,
65
+ });
66
+
67
+ await wallet.transferTokens({
68
+ tokenIdentifier: "spark1...",
69
+ receiverSparkAddress: "sp1q...",
70
+ tokenAmount: 5000n,
71
+ });
72
+ ```
73
+
74
+ ### Check Issuer Token Balance
75
+
76
+ ```typescript
77
+ // Get balance for all tokens you've issued
78
+ const balances = await wallet.getIssuerTokenBalances();
79
+ for (const [tokenId, info] of balances) {
80
+ console.log(`${info.tokenMetadata.tokenName}: ${info.balance}`);
81
+ }
82
+ ```
83
+
84
+ ### Freeze/Unfreeze Tokens
85
+
86
+ ```typescript
87
+ // Freeze tokens at a Spark address (requires isFreezable: true during creation)
88
+ await wallet.freezeTokens({
89
+ tokenIdentifier: "spark1...",
90
+ sparkAddress: "sp1q...",
91
+ });
92
+
93
+ // Unfreeze tokens at a Spark address
94
+ await wallet.unfreezeTokens({
95
+ tokenIdentifier: "spark1...",
96
+ sparkAddress: "sp1q...",
97
+ });
98
+ ```
99
+
100
+ ### Burn Tokens
101
+
102
+ ```typescript
103
+ const burnResult = await wallet.burnTokens({
104
+ tokenIdentifier: "spark1...",
105
+ tokenAmount: 1000n,
106
+ });
107
+ ```
108
+
109
+ ### Query Token Transactions
110
+
111
+ ```typescript
112
+ const transactions = await wallet.getTokenTransactions({
113
+ tokenIdentifier: "spark1...",
114
+ limit: 50,
115
+ });
116
+
117
+ for (const tx of transactions) {
118
+ console.log(`TX: ${tx.id}, Amount: ${tx.amount}`);
119
+ }
120
+ ```
121
+
122
+ ## Platform Support
123
+
124
+ The SDK supports multiple JavaScript runtimes:
125
+
126
+ - **Browser** - Web applications with WASM crypto
127
+ - **Node.js** - Server-side applications
128
+ - **React Native** - Mobile applications
@@ -1,5 +1,5 @@
1
1
  import { AggregateFrostParams, Bech32mTokenIdentifier, ConfigOptions, ConfigOptions as ConfigOptions$1, ConnectionManager, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SparkSigner as SparkSigner$1, SparkWallet, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService, WalletConfigService as WalletConfigService$1 } from "@buildonspark/spark-sdk";
2
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
2
+ import { OutputWithPreviousTransactionData, TokenOutputRef } from "@buildonspark/spark-sdk/proto/spark_token";
3
3
 
4
4
  //#region src/issuer-wallet/types.d.ts
5
5
  /**
@@ -218,7 +218,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
218
218
  * @throws {SparkValidationError} If no tokens are found for this issuer
219
219
  */
220
220
  freezeTokens(sparkAddress: string): Promise<{
221
- impactedOutputIds: string[];
221
+ impactedTokenOutputs: TokenOutputRef[];
222
222
  impactedTokenAmount: bigint;
223
223
  }>;
224
224
  /**
@@ -235,7 +235,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
235
235
  tokenIdentifier: Bech32mTokenIdentifier;
236
236
  sparkAddress: string;
237
237
  }): Promise<{
238
- impactedOutputIds: string[];
238
+ impactedTokenOutputs: TokenOutputRef[];
239
239
  impactedTokenAmount: bigint;
240
240
  }>;
241
241
  /**
@@ -247,7 +247,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
247
247
  * @throws {SparkValidationError} If no tokens are found for this issuer
248
248
  */
249
249
  unfreezeTokens(sparkAddress: string): Promise<{
250
- impactedOutputIds: string[];
250
+ impactedTokenOutputs: TokenOutputRef[];
251
251
  impactedTokenAmount: bigint;
252
252
  }>;
253
253
  /**
@@ -266,7 +266,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
266
266
  tokenIdentifier: Bech32mTokenIdentifier;
267
267
  sparkAddress: string;
268
268
  }): Promise<{
269
- impactedOutputIds: string[];
269
+ impactedTokenOutputs: TokenOutputRef[];
270
270
  impactedTokenAmount: bigint;
271
271
  }>;
272
272
  /**
@@ -538,7 +538,7 @@ var IssuerSparkWallet = class extends SparkWallet {
538
538
  });
539
539
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
540
540
  return {
541
- impactedOutputIds: response.impactedOutputIds,
541
+ impactedTokenOutputs: response.impactedTokenOutputs,
542
542
  impactedTokenAmount: tokenAmount
543
543
  };
544
544
  }
@@ -569,7 +569,7 @@ var IssuerSparkWallet = class extends SparkWallet {
569
569
  });
570
570
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
571
571
  return {
572
- impactedOutputIds: response.impactedOutputIds,
572
+ impactedTokenOutputs: response.impactedTokenOutputs,
573
573
  impactedTokenAmount: tokenAmount
574
574
  };
575
575
  }
@@ -538,7 +538,7 @@ var IssuerSparkWallet = class extends _buildonspark_spark_sdk.SparkWallet {
538
538
  });
539
539
  const tokenAmount = (0, _noble_curves_utils.bytesToNumberBE)(response.impactedTokenAmount);
540
540
  return {
541
- impactedOutputIds: response.impactedOutputIds,
541
+ impactedTokenOutputs: response.impactedTokenOutputs,
542
542
  impactedTokenAmount: tokenAmount
543
543
  };
544
544
  }
@@ -569,7 +569,7 @@ var IssuerSparkWallet = class extends _buildonspark_spark_sdk.SparkWallet {
569
569
  });
570
570
  const tokenAmount = (0, _noble_curves_utils.bytesToNumberBE)(response.impactedTokenAmount);
571
571
  return {
572
- impactedOutputIds: response.impactedOutputIds,
572
+ impactedTokenOutputs: response.impactedTokenOutputs,
573
573
  impactedTokenAmount: tokenAmount
574
574
  };
575
575
  }
@@ -1,5 +1,5 @@
1
1
  import { AggregateFrostParams, Bech32mTokenIdentifier, ConfigOptions, ConfigOptions as ConfigOptions$1, ConnectionManager, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SparkSigner as SparkSigner$1, SparkWallet, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService, WalletConfigService as WalletConfigService$1 } from "@buildonspark/spark-sdk";
2
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
2
+ import { OutputWithPreviousTransactionData, TokenOutputRef } from "@buildonspark/spark-sdk/proto/spark_token";
3
3
 
4
4
  //#region src/issuer-wallet/types.d.ts
5
5
  /**
@@ -218,7 +218,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
218
218
  * @throws {SparkValidationError} If no tokens are found for this issuer
219
219
  */
220
220
  freezeTokens(sparkAddress: string): Promise<{
221
- impactedOutputIds: string[];
221
+ impactedTokenOutputs: TokenOutputRef[];
222
222
  impactedTokenAmount: bigint;
223
223
  }>;
224
224
  /**
@@ -235,7 +235,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
235
235
  tokenIdentifier: Bech32mTokenIdentifier;
236
236
  sparkAddress: string;
237
237
  }): Promise<{
238
- impactedOutputIds: string[];
238
+ impactedTokenOutputs: TokenOutputRef[];
239
239
  impactedTokenAmount: bigint;
240
240
  }>;
241
241
  /**
@@ -247,7 +247,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
247
247
  * @throws {SparkValidationError} If no tokens are found for this issuer
248
248
  */
249
249
  unfreezeTokens(sparkAddress: string): Promise<{
250
- impactedOutputIds: string[];
250
+ impactedTokenOutputs: TokenOutputRef[];
251
251
  impactedTokenAmount: bigint;
252
252
  }>;
253
253
  /**
@@ -266,7 +266,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
266
266
  tokenIdentifier: Bech32mTokenIdentifier;
267
267
  sparkAddress: string;
268
268
  }): Promise<{
269
- impactedOutputIds: string[];
269
+ impactedTokenOutputs: TokenOutputRef[];
270
270
  impactedTokenAmount: bigint;
271
271
  }>;
272
272
  /**
@@ -1,5 +1,5 @@
1
1
  import { AggregateFrostParams, Bech32mTokenIdentifier, ConfigOptions, ConfigOptions as ConfigOptions$1, ConnectionManager, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SparkSigner as SparkSigner$1, SparkWallet, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService, WalletConfigService as WalletConfigService$1 } from "@buildonspark/spark-sdk";
2
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
2
+ import { OutputWithPreviousTransactionData, TokenOutputRef } from "@buildonspark/spark-sdk/proto/spark_token";
3
3
 
4
4
  //#region src/issuer-wallet/types.d.ts
5
5
  /**
@@ -218,7 +218,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
218
218
  * @throws {SparkValidationError} If no tokens are found for this issuer
219
219
  */
220
220
  freezeTokens(sparkAddress: string): Promise<{
221
- impactedOutputIds: string[];
221
+ impactedTokenOutputs: TokenOutputRef[];
222
222
  impactedTokenAmount: bigint;
223
223
  }>;
224
224
  /**
@@ -235,7 +235,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
235
235
  tokenIdentifier: Bech32mTokenIdentifier;
236
236
  sparkAddress: string;
237
237
  }): Promise<{
238
- impactedOutputIds: string[];
238
+ impactedTokenOutputs: TokenOutputRef[];
239
239
  impactedTokenAmount: bigint;
240
240
  }>;
241
241
  /**
@@ -247,7 +247,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
247
247
  * @throws {SparkValidationError} If no tokens are found for this issuer
248
248
  */
249
249
  unfreezeTokens(sparkAddress: string): Promise<{
250
- impactedOutputIds: string[];
250
+ impactedTokenOutputs: TokenOutputRef[];
251
251
  impactedTokenAmount: bigint;
252
252
  }>;
253
253
  /**
@@ -266,7 +266,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
266
266
  tokenIdentifier: Bech32mTokenIdentifier;
267
267
  sparkAddress: string;
268
268
  }): Promise<{
269
- impactedOutputIds: string[];
269
+ impactedTokenOutputs: TokenOutputRef[];
270
270
  impactedTokenAmount: bigint;
271
271
  }>;
272
272
  /**
@@ -538,7 +538,7 @@ var IssuerSparkWallet = class extends SparkWallet {
538
538
  });
539
539
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
540
540
  return {
541
- impactedOutputIds: response.impactedOutputIds,
541
+ impactedTokenOutputs: response.impactedTokenOutputs,
542
542
  impactedTokenAmount: tokenAmount
543
543
  };
544
544
  }
@@ -569,7 +569,7 @@ var IssuerSparkWallet = class extends SparkWallet {
569
569
  });
570
570
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
571
571
  return {
572
- impactedOutputIds: response.impactedOutputIds,
572
+ impactedTokenOutputs: response.impactedTokenOutputs,
573
573
  impactedTokenAmount: tokenAmount
574
574
  };
575
575
  }
@@ -581,7 +581,7 @@ var IssuerSparkWallet = class extends _buildonspark_spark_sdk.SparkWallet {
581
581
  });
582
582
  const tokenAmount = (0, _noble_curves_utils.bytesToNumberBE)(response.impactedTokenAmount);
583
583
  return {
584
- impactedOutputIds: response.impactedOutputIds,
584
+ impactedTokenOutputs: response.impactedTokenOutputs,
585
585
  impactedTokenAmount: tokenAmount
586
586
  };
587
587
  }
@@ -612,7 +612,7 @@ var IssuerSparkWallet = class extends _buildonspark_spark_sdk.SparkWallet {
612
612
  });
613
613
  const tokenAmount = (0, _noble_curves_utils.bytesToNumberBE)(response.impactedTokenAmount);
614
614
  return {
615
- impactedOutputIds: response.impactedOutputIds,
615
+ impactedTokenOutputs: response.impactedTokenOutputs,
616
616
  impactedTokenAmount: tokenAmount
617
617
  };
618
618
  }
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { AggregateFrostParams, Bech32mTokenIdentifier, ConfigOptions, ConfigOptions as ConfigOptions$1, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SparkSigner as SparkSigner$1, SparkWallet, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService } from "@buildonspark/spark-sdk";
3
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
3
+ import { OutputWithPreviousTransactionData, TokenOutputRef } from "@buildonspark/spark-sdk/proto/spark_token";
4
4
 
5
5
  //#region src/issuer-wallet/types.d.ts
6
6
  /**
@@ -219,7 +219,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
219
219
  * @throws {SparkValidationError} If no tokens are found for this issuer
220
220
  */
221
221
  freezeTokens(sparkAddress: string): Promise<{
222
- impactedOutputIds: string[];
222
+ impactedTokenOutputs: TokenOutputRef[];
223
223
  impactedTokenAmount: bigint;
224
224
  }>;
225
225
  /**
@@ -236,7 +236,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
236
236
  tokenIdentifier: Bech32mTokenIdentifier;
237
237
  sparkAddress: string;
238
238
  }): Promise<{
239
- impactedOutputIds: string[];
239
+ impactedTokenOutputs: TokenOutputRef[];
240
240
  impactedTokenAmount: bigint;
241
241
  }>;
242
242
  /**
@@ -248,7 +248,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
248
248
  * @throws {SparkValidationError} If no tokens are found for this issuer
249
249
  */
250
250
  unfreezeTokens(sparkAddress: string): Promise<{
251
- impactedOutputIds: string[];
251
+ impactedTokenOutputs: TokenOutputRef[];
252
252
  impactedTokenAmount: bigint;
253
253
  }>;
254
254
  /**
@@ -267,7 +267,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
267
267
  tokenIdentifier: Bech32mTokenIdentifier;
268
268
  sparkAddress: string;
269
269
  }): Promise<{
270
- impactedOutputIds: string[];
270
+ impactedTokenOutputs: TokenOutputRef[];
271
271
  impactedTokenAmount: bigint;
272
272
  }>;
273
273
  /**
@@ -1,6 +1,6 @@
1
1
 
2
2
  import { AggregateFrostParams, Bech32mTokenIdentifier, ConfigOptions, ConfigOptions as ConfigOptions$1, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SparkSigner as SparkSigner$1, SparkWallet, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService } from "@buildonspark/spark-sdk";
3
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
3
+ import { OutputWithPreviousTransactionData, TokenOutputRef } from "@buildonspark/spark-sdk/proto/spark_token";
4
4
 
5
5
  //#region src/issuer-wallet/types.d.ts
6
6
  /**
@@ -219,7 +219,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
219
219
  * @throws {SparkValidationError} If no tokens are found for this issuer
220
220
  */
221
221
  freezeTokens(sparkAddress: string): Promise<{
222
- impactedOutputIds: string[];
222
+ impactedTokenOutputs: TokenOutputRef[];
223
223
  impactedTokenAmount: bigint;
224
224
  }>;
225
225
  /**
@@ -236,7 +236,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
236
236
  tokenIdentifier: Bech32mTokenIdentifier;
237
237
  sparkAddress: string;
238
238
  }): Promise<{
239
- impactedOutputIds: string[];
239
+ impactedTokenOutputs: TokenOutputRef[];
240
240
  impactedTokenAmount: bigint;
241
241
  }>;
242
242
  /**
@@ -248,7 +248,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
248
248
  * @throws {SparkValidationError} If no tokens are found for this issuer
249
249
  */
250
250
  unfreezeTokens(sparkAddress: string): Promise<{
251
- impactedOutputIds: string[];
251
+ impactedTokenOutputs: TokenOutputRef[];
252
252
  impactedTokenAmount: bigint;
253
253
  }>;
254
254
  /**
@@ -267,7 +267,7 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
267
267
  tokenIdentifier: Bech32mTokenIdentifier;
268
268
  sparkAddress: string;
269
269
  }): Promise<{
270
- impactedOutputIds: string[];
270
+ impactedTokenOutputs: TokenOutputRef[];
271
271
  impactedTokenAmount: bigint;
272
272
  }>;
273
273
  /**
@@ -581,7 +581,7 @@ var IssuerSparkWallet = class extends SparkWallet {
581
581
  });
582
582
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
583
583
  return {
584
- impactedOutputIds: response.impactedOutputIds,
584
+ impactedTokenOutputs: response.impactedTokenOutputs,
585
585
  impactedTokenAmount: tokenAmount
586
586
  };
587
587
  }
@@ -612,7 +612,7 @@ var IssuerSparkWallet = class extends SparkWallet {
612
612
  });
613
613
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
614
614
  return {
615
- impactedOutputIds: response.impactedOutputIds,
615
+ impactedTokenOutputs: response.impactedTokenOutputs,
616
616
  impactedTokenAmount: tokenAmount
617
617
  };
618
618
  }
package/package.json CHANGED
@@ -1,8 +1,14 @@
1
1
  {
2
2
  "name": "@buildonspark/issuer-sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Spark Issuer SDK for token issuance",
5
5
  "license": "Apache-2.0",
6
+ "keywords": [
7
+ "bitcoin",
8
+ "spark",
9
+ "token",
10
+ "issuing"
11
+ ],
6
12
  "main": "./dist/index.browser.js",
7
13
  "types": "./dist/index.browser.d.ts",
8
14
  "module": "./dist/index.browser.js",
@@ -76,7 +82,7 @@
76
82
  "types": "tsc"
77
83
  },
78
84
  "dependencies": {
79
- "@buildonspark/spark-sdk": "0.5.8",
85
+ "@buildonspark/spark-sdk": "0.5.9",
80
86
  "@noble/curves": "^1.8.0",
81
87
  "@scure/btc-signer": "^1.5.0",
82
88
  "buffer": "^6.0.3"
@@ -11,7 +11,10 @@ import {
11
11
  SparkValidationError,
12
12
  type ConfigOptions,
13
13
  } from "@buildonspark/spark-sdk";
14
- import { OutputWithPreviousTransactionData } from "@buildonspark/spark-sdk/proto/spark_token";
14
+ import {
15
+ OutputWithPreviousTransactionData,
16
+ TokenOutputRef,
17
+ } from "@buildonspark/spark-sdk/proto/spark_token";
15
18
  import { bytesToHex, bytesToNumberBE, hexToBytes } from "@noble/curves/utils";
16
19
  import { TokenFreezeService } from "../services/freeze.js";
17
20
  import { IssuerTokenTransactionService } from "../services/token-transactions.js";
@@ -633,9 +636,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
633
636
  * @throws {SparkValidationError} If multiple tokens are found for this issuer
634
637
  * @throws {SparkValidationError} If no tokens are found for this issuer
635
638
  */
636
- public async freezeTokens(
637
- sparkAddress: string,
638
- ): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }>;
639
+ public async freezeTokens(sparkAddress: string): Promise<{
640
+ impactedTokenOutputs: TokenOutputRef[];
641
+ impactedTokenAmount: bigint;
642
+ }>;
639
643
 
640
644
  /**
641
645
  * Freezes tokens associated with a specific Spark address.
@@ -650,7 +654,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
650
654
  }: {
651
655
  tokenIdentifier: Bech32mTokenIdentifier;
652
656
  sparkAddress: string;
653
- }): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }>;
657
+ }): Promise<{
658
+ impactedTokenOutputs: TokenOutputRef[];
659
+ impactedTokenAmount: bigint;
660
+ }>;
654
661
 
655
662
  public async freezeTokens(
656
663
  sparkAddressOrParams:
@@ -659,7 +666,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
659
666
  tokenIdentifier: Bech32mTokenIdentifier;
660
667
  sparkAddress: string;
661
668
  },
662
- ): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }> {
669
+ ): Promise<{
670
+ impactedTokenOutputs: TokenOutputRef[];
671
+ impactedTokenAmount: bigint;
672
+ }> {
663
673
  let bech32mTokenIdentifier: Bech32mTokenIdentifier | undefined;
664
674
  let sparkAddress: string;
665
675
 
@@ -711,7 +721,7 @@ export abstract class IssuerSparkWallet extends SparkWallet {
711
721
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
712
722
 
713
723
  return {
714
- impactedOutputIds: response.impactedOutputIds,
724
+ impactedTokenOutputs: response.impactedTokenOutputs,
715
725
  impactedTokenAmount: tokenAmount,
716
726
  };
717
727
  }
@@ -724,9 +734,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
724
734
  * @throws {SparkValidationError} If multiple tokens are found for this issuer
725
735
  * @throws {SparkValidationError} If no tokens are found for this issuer
726
736
  */
727
- public async unfreezeTokens(
728
- sparkAddress: string,
729
- ): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }>;
737
+ public async unfreezeTokens(sparkAddress: string): Promise<{
738
+ impactedTokenOutputs: TokenOutputRef[];
739
+ impactedTokenAmount: bigint;
740
+ }>;
730
741
 
731
742
  /**
732
743
  * Unfreezes previously frozen tokens associated with a specific Spark address.
@@ -743,7 +754,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
743
754
  }: {
744
755
  tokenIdentifier: Bech32mTokenIdentifier;
745
756
  sparkAddress: string;
746
- }): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }>;
757
+ }): Promise<{
758
+ impactedTokenOutputs: TokenOutputRef[];
759
+ impactedTokenAmount: bigint;
760
+ }>;
747
761
 
748
762
  public async unfreezeTokens(
749
763
  sparkAddressOrParams:
@@ -752,7 +766,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
752
766
  tokenIdentifier: Bech32mTokenIdentifier;
753
767
  sparkAddress: string;
754
768
  },
755
- ): Promise<{ impactedOutputIds: string[]; impactedTokenAmount: bigint }> {
769
+ ): Promise<{
770
+ impactedTokenOutputs: TokenOutputRef[];
771
+ impactedTokenAmount: bigint;
772
+ }> {
756
773
  let bech32mTokenIdentifier: Bech32mTokenIdentifier | undefined;
757
774
  let sparkAddress: string;
758
775
 
@@ -802,7 +819,7 @@ export abstract class IssuerSparkWallet extends SparkWallet {
802
819
  const tokenAmount = bytesToNumberBE(response.impactedTokenAmount);
803
820
 
804
821
  return {
805
- impactedOutputIds: response.impactedOutputIds,
822
+ impactedTokenOutputs: response.impactedTokenOutputs,
806
823
  impactedTokenAmount: tokenAmount,
807
824
  };
808
825
  }
@@ -248,7 +248,7 @@ describe.each(TEST_CONFIGS)(
248
248
  tokenIdentifier: firstTokenIdentifier,
249
249
  sparkAddress: receiverAddress,
250
250
  });
251
- expect(freezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
251
+ expect(freezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
252
252
  expect(freezeResponse.impactedTokenAmount).toEqual(TOKEN_AMOUNT);
253
253
 
254
254
  // Should fail to transfer tokens because the outputs are frozen
@@ -281,7 +281,7 @@ describe.each(TEST_CONFIGS)(
281
281
  tokenIdentifier: firstTokenIdentifier,
282
282
  sparkAddress: receiverAddress,
283
283
  });
284
- expect(unfreezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
284
+ expect(unfreezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
285
285
  expect(unfreezeResponse.impactedTokenAmount).toEqual(TOKEN_AMOUNT);
286
286
 
287
287
  // Outputs unfrozen, transfer should succeed
@@ -418,7 +418,7 @@ describe.each(TEST_CONFIGS)(
418
418
  // Legacy single token issuer method should succeed when only one token is created
419
419
  const freezeResponse =
420
420
  await issuerWallet.freezeTokens(receiverSparkAddress);
421
- expect(freezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
421
+ expect(freezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
422
422
  expect(freezeResponse.impactedTokenAmount).toEqual(TOKEN_AMOUNT);
423
423
 
424
424
  // Should fail to transfer tokens because the outputs are frozen
@@ -434,7 +434,7 @@ describe.each(TEST_CONFIGS)(
434
434
  // Legacy single token issuer method should succeed when only one token is created
435
435
  const unfreezeResponse =
436
436
  await issuerWallet.unfreezeTokens(receiverSparkAddress);
437
- expect(unfreezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
437
+ expect(unfreezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
438
438
  expect(unfreezeResponse.impactedTokenAmount).toEqual(TOKEN_AMOUNT);
439
439
 
440
440
  const transferBackToIssuerOfUnfrozenToken =
@@ -58,12 +58,12 @@ describe.each(TEST_CONFIGS)(
58
58
  expect(userBalanceAfterTransfer.balance).toEqual(tokenAmount);
59
59
 
60
60
  const freezeResponse = await issuerWallet.freezeTokens(userSparkAddress);
61
- expect(freezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
61
+ expect(freezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
62
62
  expect(freezeResponse.impactedTokenAmount).toEqual(tokenAmount);
63
63
 
64
64
  const unfreezeResponse =
65
65
  await issuerWallet.unfreezeTokens(userSparkAddress);
66
- expect(unfreezeResponse.impactedOutputIds.length).toBeGreaterThan(0);
66
+ expect(unfreezeResponse.impactedTokenOutputs.length).toBeGreaterThan(0);
67
67
  expect(unfreezeResponse.impactedTokenAmount).toEqual(tokenAmount);
68
68
  });
69
69