@buildonspark/issuer-sdk 0.0.97 → 0.0.99
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 +14 -0
- package/dist/{chunk-GKBNEYTU.js → chunk-M6QULHGS.js} +2 -23
- package/dist/index.cjs +5 -43
- package/dist/index.d.cts +4 -7
- package/dist/index.d.ts +4 -7
- package/dist/index.js +6 -22
- package/dist/index.node.cjs +5 -43
- package/dist/index.node.d.cts +4 -7
- package/dist/index.node.d.ts +4 -7
- package/dist/index.node.js +6 -22
- package/dist/{issuer-spark-wallet-Bho-WrkK.d.cts → issuer-spark-wallet-BERt0aIi.d.cts} +4 -9
- package/dist/{issuer-spark-wallet-Bho-WrkK.d.ts → issuer-spark-wallet-BERt0aIi.d.ts} +4 -9
- package/package.json +4 -12
- package/src/issuer-wallet/issuer-spark-wallet.browser.ts +4 -24
- package/src/issuer-wallet/issuer-spark-wallet.node.ts +4 -24
- package/src/issuer-wallet/issuer-spark-wallet.ts +3 -28
- package/src/services/freeze.ts +3 -3
- package/src/services/token-transactions.ts +2 -2
- package/src/tests/integration/spark.test.ts +4 -2
- package/src/tests/utils/issuer-test-wallet.ts +1 -23
- package/src/tests/utils/spark-testing-wallet.ts +0 -67
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @buildonspark/issuer-sdk
|
|
2
2
|
|
|
3
|
+
## 0.0.99
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @buildonspark/spark-sdk@0.3.6
|
|
9
|
+
|
|
10
|
+
## 0.0.98
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @buildonspark/spark-sdk@0.3.5
|
|
16
|
+
|
|
3
17
|
## 0.0.97
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -272,35 +272,14 @@ function validateTokenParameters(tokenName, tokenTicker, decimals, maxSupply) {
|
|
|
272
272
|
|
|
273
273
|
// src/issuer-wallet/issuer-spark-wallet.ts
|
|
274
274
|
var BURN_ADDRESS = "02".repeat(33);
|
|
275
|
-
var IssuerSparkWallet = class
|
|
275
|
+
var IssuerSparkWallet = class extends SparkWallet {
|
|
276
276
|
issuerTokenTransactionService;
|
|
277
277
|
tokenFreezeService;
|
|
278
278
|
tracerId = "issuer-sdk";
|
|
279
279
|
/**
|
|
280
280
|
* Initializes a new IssuerSparkWallet instance.
|
|
281
|
-
*
|
|
282
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
281
|
+
* Inherits the generic static initialize from the base class.
|
|
283
282
|
*/
|
|
284
|
-
static async initialize({
|
|
285
|
-
mnemonicOrSeed,
|
|
286
|
-
accountNumber,
|
|
287
|
-
signer,
|
|
288
|
-
options
|
|
289
|
-
}) {
|
|
290
|
-
const wallet = new _IssuerSparkWallet(options, signer);
|
|
291
|
-
wallet.initializeTracer(wallet);
|
|
292
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
293
|
-
await wallet.initWalletWithoutSeed();
|
|
294
|
-
return {
|
|
295
|
-
wallet
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
299
|
-
return {
|
|
300
|
-
wallet,
|
|
301
|
-
...initResponse
|
|
302
|
-
};
|
|
303
|
-
}
|
|
304
283
|
constructor(configOptions, signer) {
|
|
305
284
|
super(configOptions, signer);
|
|
306
285
|
this.issuerTokenTransactionService = new IssuerTokenTransactionService(
|
package/dist/index.cjs
CHANGED
|
@@ -294,35 +294,14 @@ function validateTokenParameters(tokenName, tokenTicker, decimals, maxSupply) {
|
|
|
294
294
|
|
|
295
295
|
// src/issuer-wallet/issuer-spark-wallet.ts
|
|
296
296
|
var BURN_ADDRESS = "02".repeat(33);
|
|
297
|
-
var IssuerSparkWallet = class
|
|
297
|
+
var IssuerSparkWallet = class extends import_spark_sdk5.SparkWallet {
|
|
298
298
|
issuerTokenTransactionService;
|
|
299
299
|
tokenFreezeService;
|
|
300
300
|
tracerId = "issuer-sdk";
|
|
301
301
|
/**
|
|
302
302
|
* Initializes a new IssuerSparkWallet instance.
|
|
303
|
-
*
|
|
304
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
303
|
+
* Inherits the generic static initialize from the base class.
|
|
305
304
|
*/
|
|
306
|
-
static async initialize({
|
|
307
|
-
mnemonicOrSeed,
|
|
308
|
-
accountNumber,
|
|
309
|
-
signer,
|
|
310
|
-
options
|
|
311
|
-
}) {
|
|
312
|
-
const wallet = new _IssuerSparkWallet(options, signer);
|
|
313
|
-
wallet.initializeTracer(wallet);
|
|
314
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
315
|
-
await wallet.initWalletWithoutSeed();
|
|
316
|
-
return {
|
|
317
|
-
wallet
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
321
|
-
return {
|
|
322
|
-
wallet,
|
|
323
|
-
...initResponse
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
305
|
constructor(configOptions, signer) {
|
|
327
306
|
super(configOptions, signer);
|
|
328
307
|
this.issuerTokenTransactionService = new IssuerTokenTransactionService(
|
|
@@ -601,26 +580,9 @@ var IssuerSparkWallet = class _IssuerSparkWallet extends import_spark_sdk5.Spark
|
|
|
601
580
|
|
|
602
581
|
// src/issuer-wallet/issuer-spark-wallet.browser.ts
|
|
603
582
|
var import_spark_sdk6 = require("@buildonspark/spark-sdk");
|
|
604
|
-
var IssuerSparkWalletBrowser = class
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
accountNumber,
|
|
608
|
-
signer,
|
|
609
|
-
options
|
|
610
|
-
}) {
|
|
611
|
-
const wallet = new _IssuerSparkWalletBrowser(options, signer);
|
|
612
|
-
wallet.initializeTracer(wallet);
|
|
613
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
614
|
-
await wallet.initWalletWithoutSeed();
|
|
615
|
-
return {
|
|
616
|
-
wallet
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
620
|
-
return {
|
|
621
|
-
wallet,
|
|
622
|
-
...initResponse
|
|
623
|
-
};
|
|
583
|
+
var IssuerSparkWalletBrowser = class extends IssuerSparkWallet {
|
|
584
|
+
buildConnectionManager(config) {
|
|
585
|
+
return new import_spark_sdk6.ConnectionManager(config);
|
|
624
586
|
}
|
|
625
587
|
initializeTracerEnv({
|
|
626
588
|
spanProcessors,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { I as IssuerSparkWallet } from './issuer-spark-wallet-
|
|
2
|
-
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-
|
|
3
|
-
import {
|
|
1
|
+
import { I as IssuerSparkWallet } from './issuer-spark-wallet-BERt0aIi.cjs';
|
|
2
|
+
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-BERt0aIi.cjs';
|
|
3
|
+
import { WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
4
4
|
import '@buildonspark/spark-sdk/proto/spark';
|
|
5
5
|
|
|
6
6
|
declare class IssuerSparkWalletBrowser extends IssuerSparkWallet {
|
|
7
|
-
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
wallet: IssuerSparkWalletBrowser;
|
|
10
|
-
}>;
|
|
7
|
+
protected buildConnectionManager(config: WalletConfigService): ConnectionManager;
|
|
11
8
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
12
9
|
}
|
|
13
10
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { I as IssuerSparkWallet } from './issuer-spark-wallet-
|
|
2
|
-
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-
|
|
3
|
-
import {
|
|
1
|
+
import { I as IssuerSparkWallet } from './issuer-spark-wallet-BERt0aIi.js';
|
|
2
|
+
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-BERt0aIi.js';
|
|
3
|
+
import { WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
4
4
|
import '@buildonspark/spark-sdk/proto/spark';
|
|
5
5
|
|
|
6
6
|
declare class IssuerSparkWalletBrowser extends IssuerSparkWallet {
|
|
7
|
-
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
wallet: IssuerSparkWalletBrowser;
|
|
10
|
-
}>;
|
|
7
|
+
protected buildConnectionManager(config: WalletConfigService): ConnectionManager;
|
|
11
8
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
12
9
|
}
|
|
13
10
|
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IssuerSparkWallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M6QULHGS.js";
|
|
4
4
|
import "./chunk-7B4B24XF.js";
|
|
5
5
|
|
|
6
6
|
// src/issuer-wallet/issuer-spark-wallet.browser.ts
|
|
7
7
|
import {
|
|
8
|
-
initializeTracerEnv as initializeTracerEnvBrowser
|
|
8
|
+
initializeTracerEnv as initializeTracerEnvBrowser,
|
|
9
|
+
ConnectionManager
|
|
9
10
|
} from "@buildonspark/spark-sdk";
|
|
10
|
-
var IssuerSparkWalletBrowser = class
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
accountNumber,
|
|
14
|
-
signer,
|
|
15
|
-
options
|
|
16
|
-
}) {
|
|
17
|
-
const wallet = new _IssuerSparkWalletBrowser(options, signer);
|
|
18
|
-
wallet.initializeTracer(wallet);
|
|
19
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
20
|
-
await wallet.initWalletWithoutSeed();
|
|
21
|
-
return {
|
|
22
|
-
wallet
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
26
|
-
return {
|
|
27
|
-
wallet,
|
|
28
|
-
...initResponse
|
|
29
|
-
};
|
|
11
|
+
var IssuerSparkWalletBrowser = class extends IssuerSparkWallet {
|
|
12
|
+
buildConnectionManager(config) {
|
|
13
|
+
return new ConnectionManager(config);
|
|
30
14
|
}
|
|
31
15
|
initializeTracerEnv({
|
|
32
16
|
spanProcessors,
|
package/dist/index.node.cjs
CHANGED
|
@@ -294,35 +294,14 @@ function validateTokenParameters(tokenName, tokenTicker, decimals, maxSupply) {
|
|
|
294
294
|
|
|
295
295
|
// src/issuer-wallet/issuer-spark-wallet.ts
|
|
296
296
|
var BURN_ADDRESS = "02".repeat(33);
|
|
297
|
-
var IssuerSparkWallet = class
|
|
297
|
+
var IssuerSparkWallet = class extends import_spark_sdk5.SparkWallet {
|
|
298
298
|
issuerTokenTransactionService;
|
|
299
299
|
tokenFreezeService;
|
|
300
300
|
tracerId = "issuer-sdk";
|
|
301
301
|
/**
|
|
302
302
|
* Initializes a new IssuerSparkWallet instance.
|
|
303
|
-
*
|
|
304
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
303
|
+
* Inherits the generic static initialize from the base class.
|
|
305
304
|
*/
|
|
306
|
-
static async initialize({
|
|
307
|
-
mnemonicOrSeed,
|
|
308
|
-
accountNumber,
|
|
309
|
-
signer,
|
|
310
|
-
options
|
|
311
|
-
}) {
|
|
312
|
-
const wallet = new _IssuerSparkWallet(options, signer);
|
|
313
|
-
wallet.initializeTracer(wallet);
|
|
314
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
315
|
-
await wallet.initWalletWithoutSeed();
|
|
316
|
-
return {
|
|
317
|
-
wallet
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
321
|
-
return {
|
|
322
|
-
wallet,
|
|
323
|
-
...initResponse
|
|
324
|
-
};
|
|
325
|
-
}
|
|
326
305
|
constructor(configOptions, signer) {
|
|
327
306
|
super(configOptions, signer);
|
|
328
307
|
this.issuerTokenTransactionService = new IssuerTokenTransactionService(
|
|
@@ -601,26 +580,9 @@ var IssuerSparkWallet = class _IssuerSparkWallet extends import_spark_sdk5.Spark
|
|
|
601
580
|
|
|
602
581
|
// src/issuer-wallet/issuer-spark-wallet.node.ts
|
|
603
582
|
var import_spark_sdk6 = require("@buildonspark/spark-sdk");
|
|
604
|
-
var IssuerSparkWalletNodeJS = class
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
accountNumber,
|
|
608
|
-
signer,
|
|
609
|
-
options
|
|
610
|
-
}) {
|
|
611
|
-
const wallet = new _IssuerSparkWalletNodeJS(options, signer);
|
|
612
|
-
wallet.initializeTracer(wallet);
|
|
613
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
614
|
-
await wallet.initWalletWithoutSeed();
|
|
615
|
-
return {
|
|
616
|
-
wallet
|
|
617
|
-
};
|
|
618
|
-
}
|
|
619
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
620
|
-
return {
|
|
621
|
-
wallet,
|
|
622
|
-
...initResponse
|
|
623
|
-
};
|
|
583
|
+
var IssuerSparkWalletNodeJS = class extends IssuerSparkWallet {
|
|
584
|
+
buildConnectionManager(config) {
|
|
585
|
+
return new import_spark_sdk6.ConnectionManager(config);
|
|
624
586
|
}
|
|
625
587
|
initializeTracerEnv({
|
|
626
588
|
spanProcessors,
|
package/dist/index.node.d.cts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { I as IssuerSparkWallet } from './issuer-spark-wallet-
|
|
2
|
-
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-
|
|
3
|
-
import {
|
|
1
|
+
import { I as IssuerSparkWallet } from './issuer-spark-wallet-BERt0aIi.cjs';
|
|
2
|
+
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-BERt0aIi.cjs';
|
|
3
|
+
import { WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
4
4
|
import '@buildonspark/spark-sdk/proto/spark';
|
|
5
5
|
|
|
6
6
|
declare class IssuerSparkWalletNodeJS extends IssuerSparkWallet {
|
|
7
|
-
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
wallet: IssuerSparkWalletNodeJS;
|
|
10
|
-
}>;
|
|
7
|
+
protected buildConnectionManager(config: WalletConfigService): ConnectionManager;
|
|
11
8
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
12
9
|
}
|
|
13
10
|
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { I as IssuerSparkWallet } from './issuer-spark-wallet-
|
|
2
|
-
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-
|
|
3
|
-
import {
|
|
1
|
+
import { I as IssuerSparkWallet } from './issuer-spark-wallet-BERt0aIi.js';
|
|
2
|
+
export { a as IssuerTokenMetadata, T as TokenDistribution } from './issuer-spark-wallet-BERt0aIi.js';
|
|
3
|
+
import { WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
4
4
|
import '@buildonspark/spark-sdk/proto/spark';
|
|
5
5
|
|
|
6
6
|
declare class IssuerSparkWalletNodeJS extends IssuerSparkWallet {
|
|
7
|
-
|
|
8
|
-
mnemonic?: string | undefined;
|
|
9
|
-
wallet: IssuerSparkWalletNodeJS;
|
|
10
|
-
}>;
|
|
7
|
+
protected buildConnectionManager(config: WalletConfigService): ConnectionManager;
|
|
11
8
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
12
9
|
}
|
|
13
10
|
|
package/dist/index.node.js
CHANGED
|
@@ -1,32 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IssuerSparkWallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-M6QULHGS.js";
|
|
4
4
|
import "./chunk-7B4B24XF.js";
|
|
5
5
|
|
|
6
6
|
// src/issuer-wallet/issuer-spark-wallet.node.ts
|
|
7
7
|
import {
|
|
8
|
-
initializeTracerEnv as initializeTracerEnvNodeJS
|
|
8
|
+
initializeTracerEnv as initializeTracerEnvNodeJS,
|
|
9
|
+
ConnectionManager
|
|
9
10
|
} from "@buildonspark/spark-sdk";
|
|
10
|
-
var IssuerSparkWalletNodeJS = class
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
accountNumber,
|
|
14
|
-
signer,
|
|
15
|
-
options
|
|
16
|
-
}) {
|
|
17
|
-
const wallet = new _IssuerSparkWalletNodeJS(options, signer);
|
|
18
|
-
wallet.initializeTracer(wallet);
|
|
19
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
20
|
-
await wallet.initWalletWithoutSeed();
|
|
21
|
-
return {
|
|
22
|
-
wallet
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
26
|
-
return {
|
|
27
|
-
wallet,
|
|
28
|
-
...initResponse
|
|
29
|
-
};
|
|
11
|
+
var IssuerSparkWalletNodeJS = class extends IssuerSparkWallet {
|
|
12
|
+
buildConnectionManager(config) {
|
|
13
|
+
return new ConnectionManager(config);
|
|
30
14
|
}
|
|
31
15
|
initializeTracerEnv({
|
|
32
16
|
spanProcessors,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SparkWallet,
|
|
1
|
+
import { SparkWallet, ConfigOptions, SparkSigner, Bech32mTokenIdentifier } from '@buildonspark/spark-sdk';
|
|
2
2
|
import { OutputWithPreviousTransactionData } from '@buildonspark/spark-sdk/proto/spark';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -51,20 +51,15 @@ interface TokenDistribution {
|
|
|
51
51
|
* This class extends the base SparkWallet with additional functionality for token minting,
|
|
52
52
|
* burning, and freezing operations.
|
|
53
53
|
*/
|
|
54
|
-
declare class IssuerSparkWallet extends SparkWallet {
|
|
54
|
+
declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
55
55
|
private issuerTokenTransactionService;
|
|
56
56
|
private tokenFreezeService;
|
|
57
57
|
protected tracerId: string;
|
|
58
58
|
/**
|
|
59
59
|
* Initializes a new IssuerSparkWallet instance.
|
|
60
|
-
*
|
|
61
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
60
|
+
* Inherits the generic static initialize from the base class.
|
|
62
61
|
*/
|
|
63
|
-
|
|
64
|
-
mnemonic?: string | undefined;
|
|
65
|
-
wallet: IssuerSparkWallet;
|
|
66
|
-
}>;
|
|
67
|
-
protected constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
62
|
+
constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
68
63
|
/**
|
|
69
64
|
* Gets the token balance for the issuer's token.
|
|
70
65
|
* @returns An object containing the token balance as a bigint
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SparkWallet,
|
|
1
|
+
import { SparkWallet, ConfigOptions, SparkSigner, Bech32mTokenIdentifier } from '@buildonspark/spark-sdk';
|
|
2
2
|
import { OutputWithPreviousTransactionData } from '@buildonspark/spark-sdk/proto/spark';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -51,20 +51,15 @@ interface TokenDistribution {
|
|
|
51
51
|
* This class extends the base SparkWallet with additional functionality for token minting,
|
|
52
52
|
* burning, and freezing operations.
|
|
53
53
|
*/
|
|
54
|
-
declare class IssuerSparkWallet extends SparkWallet {
|
|
54
|
+
declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
55
55
|
private issuerTokenTransactionService;
|
|
56
56
|
private tokenFreezeService;
|
|
57
57
|
protected tracerId: string;
|
|
58
58
|
/**
|
|
59
59
|
* Initializes a new IssuerSparkWallet instance.
|
|
60
|
-
*
|
|
61
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
60
|
+
* Inherits the generic static initialize from the base class.
|
|
62
61
|
*/
|
|
63
|
-
|
|
64
|
-
mnemonic?: string | undefined;
|
|
65
|
-
wallet: IssuerSparkWallet;
|
|
66
|
-
}>;
|
|
67
|
-
protected constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
62
|
+
constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
68
63
|
/**
|
|
69
64
|
* Gets the token balance for the issuer's token.
|
|
70
65
|
* @returns An object containing the token balance as a bigint
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildonspark/issuer-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.99",
|
|
4
4
|
"description": "Spark Issuer SDK for token issuance",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -35,14 +35,6 @@
|
|
|
35
35
|
"require": "./dist/proto/spark.cjs"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
"browser": {
|
|
39
|
-
"assert": false,
|
|
40
|
-
"crypto": false,
|
|
41
|
-
"fs": false,
|
|
42
|
-
"fs/promises": false,
|
|
43
|
-
"path": false,
|
|
44
|
-
"url": false
|
|
45
|
-
},
|
|
46
38
|
"files": [
|
|
47
39
|
"dist",
|
|
48
40
|
"src",
|
|
@@ -53,7 +45,7 @@
|
|
|
53
45
|
"build:watch": "yarn build --watch --clean=false",
|
|
54
46
|
"clean": "rm -rf dist",
|
|
55
47
|
"circular-deps": "madge --circular --extensions ts,tsx src",
|
|
56
|
-
"depcheck": "depcheck --ignores=buffer,ts-proto,jest,ts-jest
|
|
48
|
+
"depcheck": "depcheck --ignores=buffer,ts-proto,jest,ts-jest",
|
|
57
49
|
"dev": "yarn build -- --watch",
|
|
58
50
|
"docs": "typedoc src",
|
|
59
51
|
"format:fix": "prettier . --write",
|
|
@@ -62,7 +54,7 @@
|
|
|
62
54
|
"lint:fix:continue": "eslint --fix . || exit 0",
|
|
63
55
|
"lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
|
|
64
56
|
"lint": "eslint .",
|
|
65
|
-
"package:checks": "yarn depcheck && yarn attw --pack . && echo \"\nPackage checks passed successfully!\"",
|
|
57
|
+
"package:checks": "yarn depcheck && yarn publint && yarn attw --pack . && echo \"\nPackage checks passed successfully!\"",
|
|
66
58
|
"postversion": "yarn build",
|
|
67
59
|
"test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --detectOpenHandles --forceExit",
|
|
68
60
|
"test": "yarn test-cmd src/tests/*.test.ts",
|
|
@@ -72,7 +64,7 @@
|
|
|
72
64
|
"types": "tsc"
|
|
73
65
|
},
|
|
74
66
|
"dependencies": {
|
|
75
|
-
"@buildonspark/spark-sdk": "0.3.
|
|
67
|
+
"@buildonspark/spark-sdk": "0.3.6",
|
|
76
68
|
"@noble/curves": "^1.8.0",
|
|
77
69
|
"@scure/btc-signer": "^1.5.0",
|
|
78
70
|
"buffer": "^6.0.3"
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
import { IssuerSparkWallet as BaseIssuerSparkWallet } from "./issuer-spark-wallet.js";
|
|
2
2
|
import {
|
|
3
3
|
initializeTracerEnv as initializeTracerEnvBrowser,
|
|
4
|
-
|
|
4
|
+
ConnectionManager,
|
|
5
|
+
type WalletConfigService,
|
|
5
6
|
} from "@buildonspark/spark-sdk";
|
|
6
7
|
|
|
7
8
|
export class IssuerSparkWalletBrowser extends BaseIssuerSparkWallet {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
accountNumber,
|
|
11
|
-
signer,
|
|
12
|
-
options,
|
|
13
|
-
}: SparkWalletProps) {
|
|
14
|
-
const wallet = new IssuerSparkWalletBrowser(options, signer);
|
|
15
|
-
wallet.initializeTracer(wallet);
|
|
16
|
-
|
|
17
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
18
|
-
await wallet.initWalletWithoutSeed();
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
wallet,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
wallet,
|
|
29
|
-
...initResponse,
|
|
30
|
-
};
|
|
9
|
+
protected buildConnectionManager(config: WalletConfigService) {
|
|
10
|
+
return new ConnectionManager(config);
|
|
31
11
|
}
|
|
32
12
|
|
|
33
13
|
protected initializeTracerEnv({
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
import { IssuerSparkWallet as BaseIssuerSparkWallet } from "./issuer-spark-wallet.js";
|
|
2
2
|
import {
|
|
3
3
|
initializeTracerEnv as initializeTracerEnvNodeJS,
|
|
4
|
-
|
|
4
|
+
ConnectionManager,
|
|
5
|
+
type WalletConfigService,
|
|
5
6
|
} from "@buildonspark/spark-sdk";
|
|
6
7
|
|
|
7
8
|
export class IssuerSparkWalletNodeJS extends BaseIssuerSparkWallet {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
accountNumber,
|
|
11
|
-
signer,
|
|
12
|
-
options,
|
|
13
|
-
}: SparkWalletProps) {
|
|
14
|
-
const wallet = new IssuerSparkWalletNodeJS(options, signer);
|
|
15
|
-
wallet.initializeTracer(wallet);
|
|
16
|
-
|
|
17
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
18
|
-
await wallet.initWalletWithoutSeed();
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
wallet,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
wallet,
|
|
29
|
-
...initResponse,
|
|
30
|
-
};
|
|
9
|
+
protected buildConnectionManager(config: WalletConfigService) {
|
|
10
|
+
return new ConnectionManager(config);
|
|
31
11
|
}
|
|
32
12
|
|
|
33
13
|
protected initializeTracerEnv({
|
|
@@ -26,42 +26,17 @@ const BURN_ADDRESS = "02".repeat(33);
|
|
|
26
26
|
* This class extends the base SparkWallet with additional functionality for token minting,
|
|
27
27
|
* burning, and freezing operations.
|
|
28
28
|
*/
|
|
29
|
-
export class IssuerSparkWallet extends SparkWallet {
|
|
29
|
+
export abstract class IssuerSparkWallet extends SparkWallet {
|
|
30
30
|
private issuerTokenTransactionService: IssuerTokenTransactionService;
|
|
31
31
|
private tokenFreezeService: TokenFreezeService;
|
|
32
32
|
protected tracerId = "issuer-sdk";
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
35
|
* Initializes a new IssuerSparkWallet instance.
|
|
36
|
-
*
|
|
37
|
-
* @returns An object containing the initialized wallet and initialization response
|
|
36
|
+
* Inherits the generic static initialize from the base class.
|
|
38
37
|
*/
|
|
39
|
-
public static async initialize({
|
|
40
|
-
mnemonicOrSeed,
|
|
41
|
-
accountNumber,
|
|
42
|
-
signer,
|
|
43
|
-
options,
|
|
44
|
-
}: SparkWalletProps) {
|
|
45
|
-
const wallet = new IssuerSparkWallet(options, signer);
|
|
46
|
-
wallet.initializeTracer(wallet);
|
|
47
|
-
|
|
48
|
-
if (options && options.signerWithPreExistingKeys) {
|
|
49
|
-
await wallet.initWalletWithoutSeed();
|
|
50
38
|
|
|
51
|
-
|
|
52
|
-
wallet,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const initResponse = await wallet.initWallet(mnemonicOrSeed, accountNumber);
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
wallet,
|
|
60
|
-
...initResponse,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected constructor(configOptions?: ConfigOptions, signer?: SparkSigner) {
|
|
39
|
+
constructor(configOptions?: ConfigOptions, signer?: SparkSigner) {
|
|
65
40
|
super(configOptions, signer);
|
|
66
41
|
this.issuerTokenTransactionService = new IssuerTokenTransactionService(
|
|
67
42
|
this.config,
|
package/src/services/freeze.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
type
|
|
2
|
+
type BaseConnectionManager,
|
|
3
3
|
NetworkError,
|
|
4
4
|
WalletConfigService,
|
|
5
5
|
collectResponses,
|
|
@@ -13,11 +13,11 @@ import { hashFreezeTokensPayload } from "../utils/token-hashing.js";
|
|
|
13
13
|
|
|
14
14
|
export class TokenFreezeService {
|
|
15
15
|
private readonly config: WalletConfigService;
|
|
16
|
-
private readonly connectionManager:
|
|
16
|
+
private readonly connectionManager: BaseConnectionManager;
|
|
17
17
|
|
|
18
18
|
constructor(
|
|
19
19
|
config: WalletConfigService,
|
|
20
|
-
connectionManager:
|
|
20
|
+
connectionManager: BaseConnectionManager,
|
|
21
21
|
) {
|
|
22
22
|
this.config = config;
|
|
23
23
|
this.connectionManager = connectionManager;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TokenTransactionService,
|
|
3
3
|
WalletConfigService,
|
|
4
|
-
type
|
|
4
|
+
type BaseConnectionManager,
|
|
5
5
|
} from "@buildonspark/spark-sdk";
|
|
6
6
|
import { TokenTransaction } from "@buildonspark/spark-sdk/proto/spark_token";
|
|
7
7
|
import { numberToBytesBE } from "@noble/curves/utils";
|
|
@@ -9,7 +9,7 @@ import { numberToBytesBE } from "@noble/curves/utils";
|
|
|
9
9
|
export class IssuerTokenTransactionService extends TokenTransactionService {
|
|
10
10
|
constructor(
|
|
11
11
|
config: WalletConfigService,
|
|
12
|
-
connectionManager:
|
|
12
|
+
connectionManager: BaseConnectionManager,
|
|
13
13
|
) {
|
|
14
14
|
super(config, connectionManager);
|
|
15
15
|
}
|
|
@@ -7,8 +7,10 @@ import {
|
|
|
7
7
|
import { jest } from "@jest/globals";
|
|
8
8
|
import { bytesToHex } from "@noble/curves/utils";
|
|
9
9
|
import { IssuerSparkWalletTesting } from "../utils/issuer-test-wallet.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
10
|
+
import {
|
|
11
|
+
BitcoinFaucet,
|
|
12
|
+
SparkWalletTesting,
|
|
13
|
+
} from "@buildonspark/spark-sdk/test-utils";
|
|
12
14
|
import { InvoiceStatus } from "@buildonspark/spark-sdk/proto/spark";
|
|
13
15
|
|
|
14
16
|
export const TOKENS_SCHNORR_CONFIG: Required<ConfigOptions> = {
|
|
@@ -2,30 +2,8 @@ import { SparkWalletProps } from "@buildonspark/spark-sdk";
|
|
|
2
2
|
import { IssuerSparkWallet } from "../../issuer-wallet/issuer-spark-wallet.node.js";
|
|
3
3
|
|
|
4
4
|
export class IssuerSparkWalletTesting extends IssuerSparkWallet {
|
|
5
|
-
private disableEvents: boolean;
|
|
6
|
-
|
|
7
|
-
constructor(props: SparkWalletProps, disableEvents = true) {
|
|
8
|
-
super(props.options);
|
|
9
|
-
this.disableEvents = disableEvents;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static async initialize(props: SparkWalletProps): Promise<{
|
|
13
|
-
mnemonic?: string;
|
|
14
|
-
wallet: IssuerSparkWalletTesting;
|
|
15
|
-
}> {
|
|
16
|
-
const wallet = new IssuerSparkWalletTesting(props, true);
|
|
17
|
-
|
|
18
|
-
const result = await wallet.initWallet(props.mnemonicOrSeed);
|
|
19
|
-
return {
|
|
20
|
-
wallet,
|
|
21
|
-
mnemonic: result?.mnemonic,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
|
|
25
5
|
protected override async setupBackgroundStream() {
|
|
26
|
-
|
|
27
|
-
return super.setupBackgroundStream();
|
|
28
|
-
}
|
|
6
|
+
console.log("IssuerSparkWalletTesting.setupBackgroundStream disabled");
|
|
29
7
|
return;
|
|
30
8
|
}
|
|
31
9
|
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ConfigOptions,
|
|
3
|
-
SparkSigner,
|
|
4
|
-
SparkWallet,
|
|
5
|
-
SparkWalletProps,
|
|
6
|
-
} from "@buildonspark/spark-sdk";
|
|
7
|
-
import {
|
|
8
|
-
type QueryTransfersResponse,
|
|
9
|
-
type Transfer,
|
|
10
|
-
} from "@buildonspark/spark-sdk/proto/spark";
|
|
11
|
-
|
|
12
|
-
interface ISparkWalletTesting extends SparkWallet {
|
|
13
|
-
getSigner(): SparkSigner;
|
|
14
|
-
queryPendingTransfers(): Promise<QueryTransfersResponse>;
|
|
15
|
-
verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class SparkWalletTesting
|
|
19
|
-
extends SparkWallet
|
|
20
|
-
implements ISparkWalletTesting
|
|
21
|
-
{
|
|
22
|
-
private disableEvents: boolean;
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
options?: ConfigOptions,
|
|
26
|
-
signer?: SparkSigner,
|
|
27
|
-
disableEvents = true,
|
|
28
|
-
) {
|
|
29
|
-
super(options, signer);
|
|
30
|
-
this.disableEvents = disableEvents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static async initialize(props: SparkWalletProps, disableEvents = true) {
|
|
34
|
-
const wallet = new SparkWalletTesting(
|
|
35
|
-
props.options,
|
|
36
|
-
props.signer,
|
|
37
|
-
disableEvents,
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
const initResponse = await wallet.initWallet(props.mnemonicOrSeed);
|
|
41
|
-
return {
|
|
42
|
-
wallet,
|
|
43
|
-
mnemonic: initResponse?.mnemonic,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected override async setupBackgroundStream() {
|
|
48
|
-
if (!this.disableEvents) {
|
|
49
|
-
await super.setupBackgroundStream();
|
|
50
|
-
}
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
public getSigner(): SparkSigner {
|
|
55
|
-
return this.config.signer;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public async queryPendingTransfers(): Promise<QueryTransfersResponse> {
|
|
59
|
-
return await this.transferService.queryPendingTransfers();
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public async verifyPendingTransfer(
|
|
63
|
-
transfer: Transfer,
|
|
64
|
-
): Promise<Map<string, Uint8Array>> {
|
|
65
|
-
return await this.transferService.verifyPendingTransfer(transfer);
|
|
66
|
-
}
|
|
67
|
-
}
|