@buildonspark/issuer-sdk 0.1.34 → 0.1.36

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.
@@ -10,7 +10,7 @@ function hashFreezeTokensPayload(payload) {
10
10
  value: payload,
11
11
  expected: "valid freeze tokens payload"
12
12
  });
13
- let allHashes = [];
13
+ const allHashes = [];
14
14
  const versionHashObj = sha256.create();
15
15
  const versionBytes = new Uint8Array(4);
16
16
  new DataView(versionBytes.buffer).setUint32(0, payload.version, false);
@@ -136,101 +136,109 @@ var IssuerTokenTransactionService = class extends TokenTransactionService {
136
136
  constructor(config, connectionManager) {
137
137
  super(config, connectionManager);
138
138
  }
139
- async constructMintTokenTransaction(rawTokenIdentifierBytes, issuerTokenPublicKey, tokenAmount) {
140
- return {
141
- version: 2,
142
- network: this.config.getNetworkProto(),
143
- tokenInputs: {
144
- $case: "mintInput",
145
- mintInput: {
146
- issuerPublicKey: issuerTokenPublicKey,
147
- tokenIdentifier: rawTokenIdentifierBytes
148
- }
149
- },
150
- tokenOutputs: [{
151
- ownerPublicKey: issuerTokenPublicKey,
152
- tokenIdentifier: rawTokenIdentifierBytes,
153
- tokenAmount: numberToBytesBE(tokenAmount, 16)
154
- }],
155
- clientCreatedTimestamp: /* @__PURE__ */ new Date(),
156
- sparkOperatorIdentityPublicKeys: super.collectOperatorIdentityPublicKeys(),
157
- expiryTime: void 0,
158
- invoiceAttachments: []
159
- };
160
- }
161
- async constructPartialMintTokenTransaction(rawTokenIdentifierBytes, issuerTokenPublicKey, tokenAmount) {
162
- return {
163
- version: 3,
164
- tokenTransactionMetadata: {
139
+ constructMintTokenTransaction(rawTokenIdentifierBytes, issuerTokenPublicKey, tokenAmount) {
140
+ return new Promise((resolve) => {
141
+ resolve({
142
+ version: 2,
165
143
  network: this.config.getNetworkProto(),
166
- sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
167
- validityDurationSeconds: await this.config.getTokenValidityDurationSeconds(),
168
- clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
144
+ tokenInputs: {
145
+ $case: "mintInput",
146
+ mintInput: {
147
+ issuerPublicKey: issuerTokenPublicKey,
148
+ tokenIdentifier: rawTokenIdentifierBytes
149
+ }
150
+ },
151
+ tokenOutputs: [{
152
+ ownerPublicKey: issuerTokenPublicKey,
153
+ tokenIdentifier: rawTokenIdentifierBytes,
154
+ tokenAmount: numberToBytesBE(tokenAmount, 16)
155
+ }],
156
+ clientCreatedTimestamp: /* @__PURE__ */ new Date(),
157
+ sparkOperatorIdentityPublicKeys: super.collectOperatorIdentityPublicKeys(),
158
+ expiryTime: void 0,
169
159
  invoiceAttachments: []
170
- },
171
- tokenInputs: {
172
- $case: "mintInput",
173
- mintInput: {
174
- issuerPublicKey: issuerTokenPublicKey,
175
- tokenIdentifier: rawTokenIdentifierBytes
176
- }
177
- },
178
- partialTokenOutputs: [{
179
- ownerPublicKey: issuerTokenPublicKey,
180
- tokenIdentifier: rawTokenIdentifierBytes,
181
- withdrawBondSats: this.config.getExpectedWithdrawBondSats(),
182
- withdrawRelativeBlockLocktime: this.config.getExpectedWithdrawRelativeBlockLocktime(),
183
- tokenAmount: numberToBytesBE(tokenAmount, 16)
184
- }]
185
- };
160
+ });
161
+ });
186
162
  }
187
- async constructCreateTokenTransaction(tokenPublicKey, tokenName, tokenTicker, decimals, maxSupply, isFreezable, extraMetadata) {
188
- return {
189
- version: 2,
190
- network: this.config.getNetworkProto(),
191
- tokenInputs: {
192
- $case: "createInput",
193
- createInput: {
194
- issuerPublicKey: tokenPublicKey,
195
- tokenName,
196
- tokenTicker,
197
- decimals,
198
- maxSupply: numberToBytesBE(maxSupply, 16),
199
- isFreezable,
200
- extraMetadata
201
- }
202
- },
203
- tokenOutputs: [],
204
- clientCreatedTimestamp: /* @__PURE__ */ new Date(),
205
- sparkOperatorIdentityPublicKeys: super.collectOperatorIdentityPublicKeys(),
206
- expiryTime: void 0,
207
- invoiceAttachments: []
208
- };
163
+ constructPartialMintTokenTransaction(rawTokenIdentifierBytes, issuerTokenPublicKey, tokenAmount) {
164
+ return new Promise((resolve) => {
165
+ resolve({
166
+ version: 3,
167
+ tokenTransactionMetadata: {
168
+ network: this.config.getNetworkProto(),
169
+ sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
170
+ validityDurationSeconds: this.config.getTokenValidityDurationSeconds(),
171
+ clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
172
+ invoiceAttachments: []
173
+ },
174
+ tokenInputs: {
175
+ $case: "mintInput",
176
+ mintInput: {
177
+ issuerPublicKey: issuerTokenPublicKey,
178
+ tokenIdentifier: rawTokenIdentifierBytes
179
+ }
180
+ },
181
+ partialTokenOutputs: [{
182
+ ownerPublicKey: issuerTokenPublicKey,
183
+ tokenIdentifier: rawTokenIdentifierBytes,
184
+ withdrawBondSats: this.config.getExpectedWithdrawBondSats(),
185
+ withdrawRelativeBlockLocktime: this.config.getExpectedWithdrawRelativeBlockLocktime(),
186
+ tokenAmount: numberToBytesBE(tokenAmount, 16)
187
+ }]
188
+ });
189
+ });
209
190
  }
210
- async constructPartialCreateTokenTransaction(tokenPublicKey, tokenName, tokenTicker, decimals, maxSupply, isFreezable, extraMetadata) {
211
- return {
212
- version: 3,
213
- tokenTransactionMetadata: {
191
+ constructCreateTokenTransaction(tokenPublicKey, tokenName, tokenTicker, decimals, maxSupply, isFreezable, extraMetadata) {
192
+ return new Promise((resolve) => {
193
+ resolve({
194
+ version: 2,
214
195
  network: this.config.getNetworkProto(),
215
- sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
216
- validityDurationSeconds: await this.config.getTokenValidityDurationSeconds(),
217
- clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
196
+ tokenInputs: {
197
+ $case: "createInput",
198
+ createInput: {
199
+ issuerPublicKey: tokenPublicKey,
200
+ tokenName,
201
+ tokenTicker,
202
+ decimals,
203
+ maxSupply: numberToBytesBE(maxSupply, 16),
204
+ isFreezable,
205
+ extraMetadata
206
+ }
207
+ },
208
+ tokenOutputs: [],
209
+ clientCreatedTimestamp: /* @__PURE__ */ new Date(),
210
+ sparkOperatorIdentityPublicKeys: super.collectOperatorIdentityPublicKeys(),
211
+ expiryTime: void 0,
218
212
  invoiceAttachments: []
219
- },
220
- tokenInputs: {
221
- $case: "createInput",
222
- createInput: {
223
- issuerPublicKey: tokenPublicKey,
224
- tokenName,
225
- tokenTicker,
226
- decimals,
227
- maxSupply: numberToBytesBE(maxSupply, 16),
228
- isFreezable,
229
- extraMetadata
230
- }
231
- },
232
- partialTokenOutputs: []
233
- };
213
+ });
214
+ });
215
+ }
216
+ constructPartialCreateTokenTransaction(tokenPublicKey, tokenName, tokenTicker, decimals, maxSupply, isFreezable, extraMetadata) {
217
+ return new Promise((resolve) => {
218
+ resolve({
219
+ version: 3,
220
+ tokenTransactionMetadata: {
221
+ network: this.config.getNetworkProto(),
222
+ sparkOperatorIdentityPublicKeys: this.collectOperatorIdentityPublicKeys(),
223
+ validityDurationSeconds: this.config.getTokenValidityDurationSeconds(),
224
+ clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
225
+ invoiceAttachments: []
226
+ },
227
+ tokenInputs: {
228
+ $case: "createInput",
229
+ createInput: {
230
+ issuerPublicKey: tokenPublicKey,
231
+ tokenName,
232
+ tokenTicker,
233
+ decimals,
234
+ maxSupply: numberToBytesBE(maxSupply, 16),
235
+ isFreezable,
236
+ extraMetadata
237
+ }
238
+ },
239
+ partialTokenOutputs: []
240
+ });
241
+ });
234
242
  }
235
243
  };
236
244
 
@@ -619,8 +627,10 @@ var IssuerSparkWallet = class extends SparkWallet {
619
627
  * Retrieves the distribution information for the issuer's token.
620
628
  * @throws {SparkError} This feature is not yet supported
621
629
  */
622
- async getIssuerTokenDistribution() {
623
- throw new SparkError("Token distribution is not yet supported");
630
+ getIssuerTokenDistribution() {
631
+ return new Promise((_, reject) => {
632
+ reject(new SparkError("Token distribution is not yet supported"));
633
+ });
624
634
  }
625
635
  /**
626
636
  * This validates that the token belongs to this issuer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildonspark/issuer-sdk",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "Spark Issuer SDK for token issuance",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -68,10 +68,10 @@
68
68
  "docs": "typedoc src",
69
69
  "format:fix": "prettier . --write",
70
70
  "format": "prettier . --check",
71
- "lint:fix": "echo \"Not implemented yet\"",
72
- "lint:fix:continue": "echo \"Not implemented yet\"",
73
- "lint:watch": "echo \"Not implemented yet\"",
74
- "lint": "echo \"Not implemented yet\"",
71
+ "lint:fix": "eslint --fix .",
72
+ "lint:fix:continue": "eslint --fix . || exit 0",
73
+ "lint:watch": "esw ./src -w --ext .ts,.tsx,.js --color",
74
+ "lint": "eslint .",
75
75
  "package:checks": "yarn depcheck && yarn publint && yarn attw --pack . && echo \"\nPackage checks passed successfully!\"",
76
76
  "postversion": "yarn build",
77
77
  "test-cmd": "node --experimental-vm-modules $(yarn bin jest) --no-cache --runInBand --detectOpenHandles --forceExit",
@@ -82,7 +82,7 @@
82
82
  "types": "tsc"
83
83
  },
84
84
  "dependencies": {
85
- "@buildonspark/spark-sdk": "0.7.16",
85
+ "@buildonspark/spark-sdk": "0.8.0",
86
86
  "@noble/curves": "^1.9.7",
87
87
  "@scure/btc-signer": "^1.5.0",
88
88
  "buffer": "^6.0.3"
@@ -90,9 +90,12 @@
90
90
  "devDependencies": {
91
91
  "@arethetypeswrong/cli": "^0.17.4",
92
92
  "@jest/globals": "^29.7.0",
93
+ "@lightsparkdev/eslint-config": "^0.0.1",
93
94
  "@types/jest": "^29.5.14",
94
95
  "@types/node": "^22.13.2",
95
96
  "depcheck": "^1.4.7",
97
+ "eslint": "^9.25.0",
98
+ "eslint-watch": "^8.0.0",
96
99
  "jest": "^29.7.0",
97
100
  "madge": "^8.0.0",
98
101
  "node-fetch": "^3.3.2",
@@ -1,5 +1,4 @@
1
1
  import { IssuerSparkWallet as BaseIssuerSparkWallet } from "./issuer-spark-wallet.js";
2
- import type { WalletConfigService } from "@buildonspark/spark-sdk";
3
2
 
4
3
  /* We just need this path to exist to prevent RN from importing the default browser version.
5
4
  This extends @buildonspark/spark-sdk ReactNativeSparkWallet due to export paths there. */
@@ -1,19 +1,19 @@
1
1
  import {
2
- Bech32mTokenIdentifier,
2
+ type Bech32mTokenIdentifier,
3
3
  decodeBech32mTokenIdentifier,
4
4
  decodeSparkAddress,
5
5
  encodeBech32mTokenIdentifier,
6
6
  encodeSparkAddress,
7
7
  SparkError,
8
- SparkSigner,
8
+ type SparkSigner,
9
9
  SparkWallet,
10
10
  SparkRequestError,
11
11
  SparkValidationError,
12
12
  type ConfigOptions,
13
13
  } from "@buildonspark/spark-sdk";
14
14
  import {
15
- OutputWithPreviousTransactionData,
16
- TokenOutputRef,
15
+ type OutputWithPreviousTransactionData,
16
+ type TokenOutputRef,
17
17
  } from "@buildonspark/spark-sdk/proto/spark_token";
18
18
  import { bytesToHex, bytesToNumberBE, hexToBytes } from "@noble/curves/utils";
19
19
  import { TokenFreezeService } from "../services/freeze.js";
@@ -21,9 +21,9 @@ import { IssuerTokenTransactionService } from "../services/token-transactions.js
21
21
  import { hashFinalTokenTransaction } from "@buildonspark/spark-sdk";
22
22
  import { validateTokenParameters } from "../utils/create-validation.js";
23
23
  import {
24
- IssuerTokenMetadata,
25
- TokenCreationDetails,
26
- TokenDistribution,
24
+ type IssuerTokenMetadata,
25
+ type TokenCreationDetails,
26
+ type TokenDistribution,
27
27
  } from "./types.js";
28
28
 
29
29
  const BURN_ADDRESS = "02".repeat(33);
@@ -204,8 +204,8 @@ export abstract class IssuerSparkWallet extends SparkWallet {
204
204
  network: this.config.getNetworkType(),
205
205
  });
206
206
 
207
- // query_token_metadata will return metadata for all token identifiers and issuer public keys provided.
208
- // It does not filter by issuer public key if both params are provided.
207
+ // query_token_metadata will return metadata for all token identifiers and issuer public
208
+ // keys provided. It does not filter by issuer public key if both params are provided.
209
209
  // Filter the response by issuer public key to return only the issuer tokens.
210
210
  if (bytesToHex(metadata.issuerPublicKey) !== issuerPublicKey) {
211
211
  continue;
@@ -421,7 +421,7 @@ export abstract class IssuerSparkWallet extends SparkWallet {
421
421
  );
422
422
  }
423
423
  const tokenIdentifier = encodeBech32mTokenIdentifier({
424
- tokenIdentifier: broadcastResponse.tokenIdentifier!,
424
+ tokenIdentifier: broadcastResponse.tokenIdentifier,
425
425
  network: this.config.getNetworkType(),
426
426
  });
427
427
  return {
@@ -711,7 +711,7 @@ export abstract class IssuerSparkWallet extends SparkWallet {
711
711
  this.config.getNetworkType(),
712
712
  ).tokenIdentifier;
713
713
 
714
- const response = await this.tokenFreezeService!.freezeTokens({
714
+ const response = await this.tokenFreezeService.freezeTokens({
715
715
  ownerPublicKey: hexToBytes(decodedOwnerPubkey.identityPublicKey),
716
716
  tokenIdentifier: rawTokenIdentifier,
717
717
  });
@@ -811,7 +811,7 @@ export abstract class IssuerSparkWallet extends SparkWallet {
811
811
  this.config.getNetworkType(),
812
812
  ).tokenIdentifier;
813
813
 
814
- const response = await this.tokenFreezeService!.unfreezeTokens({
814
+ const response = await this.tokenFreezeService.unfreezeTokens({
815
815
  ownerPublicKey: hexToBytes(decodedOwnerPubkey.identityPublicKey),
816
816
  tokenIdentifier: rawTokenIdentifier,
817
817
  });
@@ -827,8 +827,10 @@ export abstract class IssuerSparkWallet extends SparkWallet {
827
827
  * Retrieves the distribution information for the issuer's token.
828
828
  * @throws {SparkError} This feature is not yet supported
829
829
  */
830
- public async getIssuerTokenDistribution(): Promise<TokenDistribution> {
831
- throw new SparkError("Token distribution is not yet supported");
830
+ public getIssuerTokenDistribution(): Promise<TokenDistribution> {
831
+ return new Promise((_, reject) => {
832
+ reject(new SparkError("Token distribution is not yet supported"));
833
+ });
832
834
  }
833
835
 
834
836
  /**
@@ -909,7 +911,7 @@ type AssertNever<T extends never> = T;
909
911
  type IssuerSparkWalletFunctionKeys = Extract<
910
912
  {
911
913
  [K in keyof IssuerSparkWallet]: IssuerSparkWallet[K] extends (
912
- ...args: any[]
914
+ ...args: never[]
913
915
  ) => PromiseLike<unknown>
914
916
  ? /* Exclude SparkWallet methods that are already wrapped by the base class: */
915
917
  K extends keyof SparkWallet
@@ -942,3 +944,6 @@ type _AllIssuerMethodsCovered = AssertNever<
942
944
  (typeof PUBLIC_ISSUER_SPARK_WALLET_METHODS)[number]
943
945
  >
944
946
  >;
947
+
948
+ const allIssuerMethodsCovered: _AllIssuerMethodsCovered = undefined as never;
949
+ void allIssuerMethodsCovered;
@@ -4,7 +4,8 @@ import type { Bech32mTokenIdentifier } from "@buildonspark/spark-sdk";
4
4
  * Token metadata containing essential information about issuer's token.
5
5
  * This is the wallet's internal representation with JavaScript-friendly types.
6
6
  *
7
- * rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
7
+ * rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human
8
+ * readable token identifier.
8
9
  *
9
10
  * tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
10
11
  *
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  type BaseConnectionManager,
3
3
  SparkRequestError,
4
- WalletConfigService,
4
+ type WalletConfigService,
5
5
  collectResponses,
6
6
  } from "@buildonspark/spark-sdk";
7
7
  import {
8
- FreezeTokensPayload,
9
- FreezeTokensResponse,
8
+ type FreezeTokensPayload,
9
+ type FreezeTokensResponse,
10
10
  } from "@buildonspark/spark-sdk/proto/spark_token";
11
11
  import { hexToBytes } from "@noble/curves/utils";
12
12
  import { hashFreezeTokensPayload } from "../utils/token-hashing.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  TokenTransactionService,
3
- WalletConfigService,
3
+ type WalletConfigService,
4
4
  type BaseConnectionManager,
5
5
  } from "@buildonspark/spark-sdk";
6
6
  import {
7
- PartialTokenTransaction,
8
- TokenTransaction,
7
+ type PartialTokenTransaction,
8
+ type TokenTransaction,
9
9
  } from "@buildonspark/spark-sdk/proto/spark_token";
10
10
  import { numberToBytesBE } from "@noble/curves/utils";
11
11
 
@@ -17,73 +17,77 @@ export class IssuerTokenTransactionService extends TokenTransactionService {
17
17
  super(config, connectionManager);
18
18
  }
19
19
 
20
- async constructMintTokenTransaction(
20
+ constructMintTokenTransaction(
21
21
  rawTokenIdentifierBytes: Uint8Array,
22
22
  issuerTokenPublicKey: Uint8Array,
23
23
  tokenAmount: bigint,
24
24
  ): Promise<TokenTransaction> {
25
- return {
26
- version: 2,
27
- network: this.config.getNetworkProto(),
28
- tokenInputs: {
29
- $case: "mintInput",
30
- mintInput: {
31
- issuerPublicKey: issuerTokenPublicKey,
32
- tokenIdentifier: rawTokenIdentifierBytes,
33
- },
34
- },
35
- tokenOutputs: [
36
- {
37
- ownerPublicKey: issuerTokenPublicKey,
38
- tokenIdentifier: rawTokenIdentifierBytes,
39
- tokenAmount: numberToBytesBE(tokenAmount, 16),
25
+ return new Promise((resolve) => {
26
+ resolve({
27
+ version: 2,
28
+ network: this.config.getNetworkProto(),
29
+ tokenInputs: {
30
+ $case: "mintInput",
31
+ mintInput: {
32
+ issuerPublicKey: issuerTokenPublicKey,
33
+ tokenIdentifier: rawTokenIdentifierBytes,
34
+ },
40
35
  },
41
- ],
42
- clientCreatedTimestamp: new Date(),
43
- sparkOperatorIdentityPublicKeys:
44
- super.collectOperatorIdentityPublicKeys(),
45
- expiryTime: undefined,
46
- invoiceAttachments: [],
47
- };
36
+ tokenOutputs: [
37
+ {
38
+ ownerPublicKey: issuerTokenPublicKey,
39
+ tokenIdentifier: rawTokenIdentifierBytes,
40
+ tokenAmount: numberToBytesBE(tokenAmount, 16),
41
+ },
42
+ ],
43
+ clientCreatedTimestamp: new Date(),
44
+ sparkOperatorIdentityPublicKeys:
45
+ super.collectOperatorIdentityPublicKeys(),
46
+ expiryTime: undefined,
47
+ invoiceAttachments: [],
48
+ });
49
+ });
48
50
  }
49
51
 
50
- async constructPartialMintTokenTransaction(
52
+ constructPartialMintTokenTransaction(
51
53
  rawTokenIdentifierBytes: Uint8Array,
52
54
  issuerTokenPublicKey: Uint8Array,
53
55
  tokenAmount: bigint,
54
56
  ): Promise<PartialTokenTransaction> {
55
- return {
56
- version: 3,
57
- tokenTransactionMetadata: {
58
- network: this.config.getNetworkProto(),
59
- sparkOperatorIdentityPublicKeys:
60
- this.collectOperatorIdentityPublicKeys(),
61
- validityDurationSeconds:
62
- await this.config.getTokenValidityDurationSeconds(),
63
- clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
64
- invoiceAttachments: [],
65
- },
66
- tokenInputs: {
67
- $case: "mintInput",
68
- mintInput: {
69
- issuerPublicKey: issuerTokenPublicKey,
70
- tokenIdentifier: rawTokenIdentifierBytes,
57
+ return new Promise((resolve) => {
58
+ resolve({
59
+ version: 3,
60
+ tokenTransactionMetadata: {
61
+ network: this.config.getNetworkProto(),
62
+ sparkOperatorIdentityPublicKeys:
63
+ this.collectOperatorIdentityPublicKeys(),
64
+ validityDurationSeconds:
65
+ this.config.getTokenValidityDurationSeconds(),
66
+ clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
67
+ invoiceAttachments: [],
71
68
  },
72
- },
73
- partialTokenOutputs: [
74
- {
75
- ownerPublicKey: issuerTokenPublicKey,
76
- tokenIdentifier: rawTokenIdentifierBytes,
77
- withdrawBondSats: this.config.getExpectedWithdrawBondSats(),
78
- withdrawRelativeBlockLocktime:
79
- this.config.getExpectedWithdrawRelativeBlockLocktime(),
80
- tokenAmount: numberToBytesBE(tokenAmount, 16),
69
+ tokenInputs: {
70
+ $case: "mintInput",
71
+ mintInput: {
72
+ issuerPublicKey: issuerTokenPublicKey,
73
+ tokenIdentifier: rawTokenIdentifierBytes,
74
+ },
81
75
  },
82
- ],
83
- };
76
+ partialTokenOutputs: [
77
+ {
78
+ ownerPublicKey: issuerTokenPublicKey,
79
+ tokenIdentifier: rawTokenIdentifierBytes,
80
+ withdrawBondSats: this.config.getExpectedWithdrawBondSats(),
81
+ withdrawRelativeBlockLocktime:
82
+ this.config.getExpectedWithdrawRelativeBlockLocktime(),
83
+ tokenAmount: numberToBytesBE(tokenAmount, 16),
84
+ },
85
+ ],
86
+ });
87
+ });
84
88
  }
85
89
 
86
- async constructCreateTokenTransaction(
90
+ constructCreateTokenTransaction(
87
91
  tokenPublicKey: Uint8Array,
88
92
  tokenName: string,
89
93
  tokenTicker: string,
@@ -92,31 +96,33 @@ export class IssuerTokenTransactionService extends TokenTransactionService {
92
96
  isFreezable: boolean,
93
97
  extraMetadata: Uint8Array | undefined,
94
98
  ): Promise<TokenTransaction> {
95
- return {
96
- version: 2,
97
- network: this.config.getNetworkProto(),
98
- tokenInputs: {
99
- $case: "createInput",
100
- createInput: {
101
- issuerPublicKey: tokenPublicKey,
102
- tokenName: tokenName,
103
- tokenTicker: tokenTicker,
104
- decimals: decimals,
105
- maxSupply: numberToBytesBE(maxSupply, 16),
106
- isFreezable: isFreezable,
107
- extraMetadata: extraMetadata,
99
+ return new Promise((resolve) => {
100
+ resolve({
101
+ version: 2,
102
+ network: this.config.getNetworkProto(),
103
+ tokenInputs: {
104
+ $case: "createInput",
105
+ createInput: {
106
+ issuerPublicKey: tokenPublicKey,
107
+ tokenName: tokenName,
108
+ tokenTicker: tokenTicker,
109
+ decimals: decimals,
110
+ maxSupply: numberToBytesBE(maxSupply, 16),
111
+ isFreezable: isFreezable,
112
+ extraMetadata: extraMetadata,
113
+ },
108
114
  },
109
- },
110
- tokenOutputs: [],
111
- clientCreatedTimestamp: new Date(),
112
- sparkOperatorIdentityPublicKeys:
113
- super.collectOperatorIdentityPublicKeys(),
114
- expiryTime: undefined,
115
- invoiceAttachments: [],
116
- };
115
+ tokenOutputs: [],
116
+ clientCreatedTimestamp: new Date(),
117
+ sparkOperatorIdentityPublicKeys:
118
+ super.collectOperatorIdentityPublicKeys(),
119
+ expiryTime: undefined,
120
+ invoiceAttachments: [],
121
+ });
122
+ });
117
123
  }
118
124
 
119
- async constructPartialCreateTokenTransaction(
125
+ constructPartialCreateTokenTransaction(
120
126
  tokenPublicKey: Uint8Array,
121
127
  tokenName: string,
122
128
  tokenTicker: string,
@@ -125,30 +131,32 @@ export class IssuerTokenTransactionService extends TokenTransactionService {
125
131
  isFreezable: boolean,
126
132
  extraMetadata?: Uint8Array,
127
133
  ): Promise<PartialTokenTransaction> {
128
- return {
129
- version: 3,
130
- tokenTransactionMetadata: {
131
- network: this.config.getNetworkProto(),
132
- sparkOperatorIdentityPublicKeys:
133
- this.collectOperatorIdentityPublicKeys(),
134
- validityDurationSeconds:
135
- await this.config.getTokenValidityDurationSeconds(),
136
- clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
137
- invoiceAttachments: [],
138
- },
139
- tokenInputs: {
140
- $case: "createInput",
141
- createInput: {
142
- issuerPublicKey: tokenPublicKey,
143
- tokenName: tokenName,
144
- tokenTicker: tokenTicker,
145
- decimals: decimals,
146
- maxSupply: numberToBytesBE(maxSupply, 16),
147
- isFreezable: isFreezable,
148
- extraMetadata: extraMetadata,
134
+ return new Promise((resolve) => {
135
+ resolve({
136
+ version: 3,
137
+ tokenTransactionMetadata: {
138
+ network: this.config.getNetworkProto(),
139
+ sparkOperatorIdentityPublicKeys:
140
+ this.collectOperatorIdentityPublicKeys(),
141
+ validityDurationSeconds:
142
+ this.config.getTokenValidityDurationSeconds(),
143
+ clientCreatedTimestamp: this.connectionManager.getCurrentServerTime(),
144
+ invoiceAttachments: [],
145
+ },
146
+ tokenInputs: {
147
+ $case: "createInput",
148
+ createInput: {
149
+ issuerPublicKey: tokenPublicKey,
150
+ tokenName: tokenName,
151
+ tokenTicker: tokenTicker,
152
+ decimals: decimals,
153
+ maxSupply: numberToBytesBE(maxSupply, 16),
154
+ isFreezable: isFreezable,
155
+ extraMetadata: extraMetadata,
156
+ },
149
157
  },
150
- },
151
- partialTokenOutputs: [],
152
- };
158
+ partialTokenOutputs: [],
159
+ });
160
+ });
153
161
  }
154
162
  }