@buildonspark/issuer-sdk 0.1.2 → 0.1.4
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 +109 -0
- package/dist/index.browser.d.ts +133 -9
- package/dist/index.browser.js +341 -83
- package/dist/index.node.cjs +348 -90
- package/dist/index.node.d.cts +133 -9
- package/dist/index.node.d.ts +133 -9
- package/dist/index.node.js +341 -83
- package/dist/native/index.react-native.cjs +345 -87
- package/dist/native/index.react-native.d.cts +133 -9
- package/dist/native/index.react-native.d.ts +133 -9
- package/dist/native/index.react-native.js +341 -83
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/package.json +2 -2
- package/src/issuer-wallet/issuer-spark-wallet.ts +528 -58
- package/src/issuer-wallet/types.ts +25 -0
- package/src/tests/integration/multi-token-issuer.test.ts +437 -0
- package/src/tests/integration/nft-creation.test.ts +32 -17
package/dist/index.node.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SparkWallet, ConfigOptions, SparkSigner,
|
|
1
|
+
import { Bech32mTokenIdentifier, SparkWallet, ConfigOptions, SparkSigner, WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
2
2
|
export { AggregateFrostParams, ConfigOptions, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService } from '@buildonspark/spark-sdk';
|
|
3
3
|
import { OutputWithPreviousTransactionData } from '@buildonspark/spark-sdk/proto/spark_token';
|
|
4
4
|
|
|
@@ -40,6 +40,8 @@ type IssuerTokenMetadata = {
|
|
|
40
40
|
isFreezable: boolean;
|
|
41
41
|
/** Extra metadata of the token */
|
|
42
42
|
extraMetadata?: Uint8Array;
|
|
43
|
+
/** Bech32m encoded token identifier */
|
|
44
|
+
bech32mTokenIdentifier: Bech32mTokenIdentifier;
|
|
43
45
|
};
|
|
44
46
|
interface TokenDistribution {
|
|
45
47
|
totalCirculatingSupply: bigint;
|
|
@@ -48,6 +50,26 @@ interface TokenDistribution {
|
|
|
48
50
|
numHoldingAddress: number;
|
|
49
51
|
numConfirmedTransactions: bigint;
|
|
50
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Details of a token creation.
|
|
55
|
+
*
|
|
56
|
+
* tokenIdentifier: The Bech32m encoded token identifier.
|
|
57
|
+
* transactionHash: The hash of the transaction that created the token.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const tokenCreationDetails: TokenCreationDetails = {
|
|
62
|
+
* tokenIdentifier: "btkn1...",
|
|
63
|
+
* transactionHash: "1234567890abcdef...",
|
|
64
|
+
* };
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
interface TokenCreationDetails {
|
|
68
|
+
/** Bech32m encoded token identifier */
|
|
69
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
70
|
+
/** Transaction hash of the announcement */
|
|
71
|
+
transactionHash: string;
|
|
72
|
+
}
|
|
51
73
|
|
|
52
74
|
/**
|
|
53
75
|
* Represents a Spark wallet with minting capabilities.
|
|
@@ -65,24 +87,51 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
|
65
87
|
constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
66
88
|
/**
|
|
67
89
|
* Gets the token balance for the issuer's token.
|
|
90
|
+
* @deprecated Use getIssuerTokenBalances() instead. This method will be removed in a future version.
|
|
68
91
|
* @returns An object containing the token balance as a bigint
|
|
92
|
+
*
|
|
93
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
69
94
|
*/
|
|
70
95
|
getIssuerTokenBalance(): Promise<{
|
|
71
96
|
tokenIdentifier: Bech32mTokenIdentifier | undefined;
|
|
72
97
|
balance: bigint;
|
|
73
98
|
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the token balances for the tokens that were issued by this user.
|
|
101
|
+
* @returns An array of objects containing the token identifier and balance
|
|
102
|
+
*/
|
|
103
|
+
getIssuerTokenBalances(): Promise<{
|
|
104
|
+
tokenIdentifier: Bech32mTokenIdentifier | undefined;
|
|
105
|
+
balance: bigint;
|
|
106
|
+
}[]>;
|
|
74
107
|
/**
|
|
75
108
|
* Retrieves information about the issuer's token.
|
|
76
|
-
* @
|
|
109
|
+
* @deprecated Use getIssuerTokensMetadata() instead. This method will be removed in a future version.
|
|
110
|
+
* @returns An object containing token information including public key, name, symbol, decimals, max supply, freeze status, and extra metadata
|
|
77
111
|
* @throws {SparkRequestError} If the token metadata cannot be retrieved
|
|
112
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
78
113
|
*/
|
|
79
114
|
getIssuerTokenMetadata(): Promise<IssuerTokenMetadata>;
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves information about the tokens that were issued by this user.
|
|
117
|
+
* @returns An array of objects containing token information including public key, name, symbol, decimals, max supply, freeze status, and extra metadata
|
|
118
|
+
* @throws {SparkRequestError} If the token metadata cannot be retrieved
|
|
119
|
+
*/
|
|
120
|
+
getIssuerTokensMetadata(): Promise<IssuerTokenMetadata[]>;
|
|
80
121
|
/**
|
|
81
122
|
* Retrieves the bech32m encoded token identifier for the issuer's token.
|
|
123
|
+
* @deprecated Use getIssuerTokenIdentifiers() instead. This method will be removed in a future version.
|
|
82
124
|
* @returns The bech32m encoded token identifier for the issuer's token
|
|
83
125
|
* @throws {SparkRequestError} If the token identifier cannot be retrieved
|
|
126
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
84
127
|
*/
|
|
85
128
|
getIssuerTokenIdentifier(): Promise<Bech32mTokenIdentifier>;
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the bech32m encoded token identifier for the issuer's token.
|
|
131
|
+
* @returns The bech32m encoded token identifier for the issuer's token
|
|
132
|
+
* @throws {SparkRequestError} If the token identifier cannot be retrieved
|
|
133
|
+
*/
|
|
134
|
+
getIssuerTokenIdentifiers(): Promise<Bech32mTokenIdentifier[]>;
|
|
86
135
|
/**
|
|
87
136
|
* Create a new token on Spark.
|
|
88
137
|
*
|
|
@@ -93,51 +142,126 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
|
93
142
|
* @param params.isFreezable - Whether the token can be frozen.
|
|
94
143
|
* @param [params.maxSupply=0n] - (Optional) The maximum supply of the token. Defaults to <code>0n</code>.
|
|
95
144
|
* @param params.extraMetadata - (Optional) This can be used to store additional bytes data to be associated with a token, like image data.
|
|
96
|
-
*
|
|
97
|
-
* @returns The transaction
|
|
98
|
-
*
|
|
145
|
+
* @param params.returnIdentifierForCreate - (Optional) Whether to return the token identifier in addition to the transaction hash. Defaults to <code>false</code>.
|
|
146
|
+
* @returns The transaction hash of the announcement or TokenCreationDetails if `returnIdentifierForCreate` is true.
|
|
99
147
|
* @throws {SparkValidationError} If `decimals` is not a safe integer or other validation fails.
|
|
100
148
|
* @throws {SparkRequestError} If the announcement transaction cannot be broadcast.
|
|
101
149
|
*/
|
|
102
|
-
createToken(
|
|
150
|
+
createToken(params: {
|
|
103
151
|
tokenName: string;
|
|
104
152
|
tokenTicker: string;
|
|
105
153
|
decimals: number;
|
|
106
154
|
isFreezable: boolean;
|
|
107
155
|
maxSupply?: bigint;
|
|
108
156
|
extraMetadata?: Uint8Array;
|
|
157
|
+
returnIdentifierForCreate?: false;
|
|
109
158
|
}): Promise<string>;
|
|
159
|
+
createToken(params: {
|
|
160
|
+
tokenName: string;
|
|
161
|
+
tokenTicker: string;
|
|
162
|
+
decimals: number;
|
|
163
|
+
isFreezable: boolean;
|
|
164
|
+
maxSupply?: bigint;
|
|
165
|
+
extraMetadata?: Uint8Array;
|
|
166
|
+
returnIdentifierForCreate: true;
|
|
167
|
+
}): Promise<TokenCreationDetails>;
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Use mintTokens({ tokenAmount, tokenIdentifier }) instead. This method will be removed in a future version.
|
|
170
|
+
* @param amount - The amount of tokens to mint
|
|
171
|
+
* @returns The transaction ID of the mint operation
|
|
172
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
173
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
174
|
+
*/
|
|
175
|
+
mintTokens(amount: bigint): Promise<string>;
|
|
110
176
|
/**
|
|
111
177
|
* Mints new tokens
|
|
112
|
-
* @param
|
|
178
|
+
* @param params - Object containing token minting parameters.
|
|
179
|
+
* @param params.tokenAmount - The amount of tokens to mint
|
|
180
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
113
181
|
* @returns The transaction ID of the mint operation
|
|
182
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
114
183
|
*/
|
|
115
|
-
mintTokens(tokenAmount
|
|
184
|
+
mintTokens({ tokenAmount, tokenIdentifier, }: {
|
|
185
|
+
tokenAmount: bigint;
|
|
186
|
+
tokenIdentifier?: Bech32mTokenIdentifier;
|
|
187
|
+
}): Promise<string>;
|
|
116
188
|
/**
|
|
117
189
|
* Burns issuer's tokens
|
|
190
|
+
* @deprecated Use burnTokens({ tokenAmount, tokenIdentifier, selectedOutputs }) instead. This method will be removed in a future version.
|
|
118
191
|
* @param tokenAmount - The amount of tokens to burn
|
|
119
192
|
* @param selectedOutputs - Optional array of outputs to use for the burn operation
|
|
120
193
|
* @returns The transaction ID of the burn operation
|
|
194
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
195
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
121
196
|
*/
|
|
122
197
|
burnTokens(tokenAmount: bigint, selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Burns issuer's tokens
|
|
200
|
+
* @param params - Object containing token burning parameters.
|
|
201
|
+
* @param params.tokenAmount - The amount of tokens to burn
|
|
202
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
203
|
+
* @param params.selectedOutputs - Optional array of outputs to use for the burn operation
|
|
204
|
+
* @returns The transaction ID of the burn operation
|
|
205
|
+
*/
|
|
206
|
+
burnTokens({ tokenAmount, tokenIdentifier, selectedOutputs, }: {
|
|
207
|
+
tokenAmount: bigint;
|
|
208
|
+
tokenIdentifier?: Bech32mTokenIdentifier;
|
|
209
|
+
selectedOutputs?: OutputWithPreviousTransactionData[];
|
|
210
|
+
}): Promise<string>;
|
|
123
211
|
/**
|
|
124
212
|
* Freezes tokens associated with a specific Spark address.
|
|
213
|
+
* @deprecated Use freezeToken({ tokenIdentifier, sparkAddress }) instead. This method will be removed in a future version.
|
|
125
214
|
* @param sparkAddress - The Spark address whose tokens should be frozen
|
|
126
215
|
* @returns An object containing the IDs of impacted outputs and the total amount of frozen tokens
|
|
216
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
217
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
127
218
|
*/
|
|
128
219
|
freezeTokens(sparkAddress: string): Promise<{
|
|
129
220
|
impactedOutputIds: string[];
|
|
130
221
|
impactedTokenAmount: bigint;
|
|
131
222
|
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Freezes tokens associated with a specific Spark address.
|
|
225
|
+
* @param params - Object containing token freezing parameters.
|
|
226
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
227
|
+
* @param params.sparkAddress - The Spark address whose tokens should be frozen
|
|
228
|
+
* @returns An object containing the IDs of impacted outputs and the total amount of frozen tokens
|
|
229
|
+
*/
|
|
230
|
+
freezeTokens({ tokenIdentifier, sparkAddress, }: {
|
|
231
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
232
|
+
sparkAddress: string;
|
|
233
|
+
}): Promise<{
|
|
234
|
+
impactedOutputIds: string[];
|
|
235
|
+
impactedTokenAmount: bigint;
|
|
236
|
+
}>;
|
|
132
237
|
/**
|
|
133
238
|
* Unfreezes previously frozen tokens associated with a specific Spark address.
|
|
239
|
+
* @deprecated Use unfreezeToken({ tokenIdentifier, sparkAddress }) instead. This method will be removed in a future version.
|
|
134
240
|
* @param sparkAddress - The Spark address whose tokens should be unfrozen
|
|
135
241
|
* @returns An object containing the IDs of impacted outputs and the total amount of unfrozen tokens
|
|
242
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
243
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
136
244
|
*/
|
|
137
245
|
unfreezeTokens(sparkAddress: string): Promise<{
|
|
138
246
|
impactedOutputIds: string[];
|
|
139
247
|
impactedTokenAmount: bigint;
|
|
140
248
|
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Unfreezes previously frozen tokens associated with a specific Spark address.
|
|
251
|
+
* @param params - Object containing token unfreezing parameters.
|
|
252
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
253
|
+
* @param params.sparkAddress - The Spark address whose tokens should be unfrozen
|
|
254
|
+
* @returns An object containing the IDs of impacted outputs and the total amount of unfrozen tokens
|
|
255
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
256
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
257
|
+
*/
|
|
258
|
+
unfreezeTokens({ tokenIdentifier, sparkAddress, }: {
|
|
259
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
260
|
+
sparkAddress: string;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
impactedOutputIds: string[];
|
|
263
|
+
impactedTokenAmount: bigint;
|
|
264
|
+
}>;
|
|
141
265
|
/**
|
|
142
266
|
* Retrieves the distribution information for the issuer's token.
|
|
143
267
|
* @throws {SparkError} This feature is not yet supported
|
|
@@ -153,4 +277,4 @@ declare class IssuerSparkWalletNodeJS extends IssuerSparkWallet {
|
|
|
153
277
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
154
278
|
}
|
|
155
279
|
|
|
156
|
-
export { IssuerSparkWalletNodeJS as IssuerSparkWallet, type IssuerTokenMetadata, type TokenDistribution };
|
|
280
|
+
export { IssuerSparkWalletNodeJS as IssuerSparkWallet, type IssuerTokenMetadata, type TokenCreationDetails, type TokenDistribution };
|
package/dist/index.node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SparkWallet, ConfigOptions, SparkSigner,
|
|
1
|
+
import { Bech32mTokenIdentifier, SparkWallet, ConfigOptions, SparkSigner, WalletConfigService, ConnectionManager } from '@buildonspark/spark-sdk';
|
|
2
2
|
export { AggregateFrostParams, ConfigOptions, DefaultSparkSigner, DerivedHDKey, DummyTx, IKeyPackage, KeyDerivation, KeyDerivationType, KeyPair, SignFrostParams, SigningCommitment, SigningCommitmentWithOptionalNonce, SigningNonce, SparkSigner, SplitSecretWithProofsParams, SubtractSplitAndEncryptParams, SubtractSplitAndEncryptResult, UnsafeStatelessSparkSigner, WalletConfig, WalletConfigService } from '@buildonspark/spark-sdk';
|
|
3
3
|
import { OutputWithPreviousTransactionData } from '@buildonspark/spark-sdk/proto/spark_token';
|
|
4
4
|
|
|
@@ -40,6 +40,8 @@ type IssuerTokenMetadata = {
|
|
|
40
40
|
isFreezable: boolean;
|
|
41
41
|
/** Extra metadata of the token */
|
|
42
42
|
extraMetadata?: Uint8Array;
|
|
43
|
+
/** Bech32m encoded token identifier */
|
|
44
|
+
bech32mTokenIdentifier: Bech32mTokenIdentifier;
|
|
43
45
|
};
|
|
44
46
|
interface TokenDistribution {
|
|
45
47
|
totalCirculatingSupply: bigint;
|
|
@@ -48,6 +50,26 @@ interface TokenDistribution {
|
|
|
48
50
|
numHoldingAddress: number;
|
|
49
51
|
numConfirmedTransactions: bigint;
|
|
50
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Details of a token creation.
|
|
55
|
+
*
|
|
56
|
+
* tokenIdentifier: The Bech32m encoded token identifier.
|
|
57
|
+
* transactionHash: The hash of the transaction that created the token.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const tokenCreationDetails: TokenCreationDetails = {
|
|
62
|
+
* tokenIdentifier: "btkn1...",
|
|
63
|
+
* transactionHash: "1234567890abcdef...",
|
|
64
|
+
* };
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
interface TokenCreationDetails {
|
|
68
|
+
/** Bech32m encoded token identifier */
|
|
69
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
70
|
+
/** Transaction hash of the announcement */
|
|
71
|
+
transactionHash: string;
|
|
72
|
+
}
|
|
51
73
|
|
|
52
74
|
/**
|
|
53
75
|
* Represents a Spark wallet with minting capabilities.
|
|
@@ -65,24 +87,51 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
|
65
87
|
constructor(configOptions?: ConfigOptions, signer?: SparkSigner);
|
|
66
88
|
/**
|
|
67
89
|
* Gets the token balance for the issuer's token.
|
|
90
|
+
* @deprecated Use getIssuerTokenBalances() instead. This method will be removed in a future version.
|
|
68
91
|
* @returns An object containing the token balance as a bigint
|
|
92
|
+
*
|
|
93
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
69
94
|
*/
|
|
70
95
|
getIssuerTokenBalance(): Promise<{
|
|
71
96
|
tokenIdentifier: Bech32mTokenIdentifier | undefined;
|
|
72
97
|
balance: bigint;
|
|
73
98
|
}>;
|
|
99
|
+
/**
|
|
100
|
+
* Gets the token balances for the tokens that were issued by this user.
|
|
101
|
+
* @returns An array of objects containing the token identifier and balance
|
|
102
|
+
*/
|
|
103
|
+
getIssuerTokenBalances(): Promise<{
|
|
104
|
+
tokenIdentifier: Bech32mTokenIdentifier | undefined;
|
|
105
|
+
balance: bigint;
|
|
106
|
+
}[]>;
|
|
74
107
|
/**
|
|
75
108
|
* Retrieves information about the issuer's token.
|
|
76
|
-
* @
|
|
109
|
+
* @deprecated Use getIssuerTokensMetadata() instead. This method will be removed in a future version.
|
|
110
|
+
* @returns An object containing token information including public key, name, symbol, decimals, max supply, freeze status, and extra metadata
|
|
77
111
|
* @throws {SparkRequestError} If the token metadata cannot be retrieved
|
|
112
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
78
113
|
*/
|
|
79
114
|
getIssuerTokenMetadata(): Promise<IssuerTokenMetadata>;
|
|
115
|
+
/**
|
|
116
|
+
* Retrieves information about the tokens that were issued by this user.
|
|
117
|
+
* @returns An array of objects containing token information including public key, name, symbol, decimals, max supply, freeze status, and extra metadata
|
|
118
|
+
* @throws {SparkRequestError} If the token metadata cannot be retrieved
|
|
119
|
+
*/
|
|
120
|
+
getIssuerTokensMetadata(): Promise<IssuerTokenMetadata[]>;
|
|
80
121
|
/**
|
|
81
122
|
* Retrieves the bech32m encoded token identifier for the issuer's token.
|
|
123
|
+
* @deprecated Use getIssuerTokenIdentifiers() instead. This method will be removed in a future version.
|
|
82
124
|
* @returns The bech32m encoded token identifier for the issuer's token
|
|
83
125
|
* @throws {SparkRequestError} If the token identifier cannot be retrieved
|
|
126
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
84
127
|
*/
|
|
85
128
|
getIssuerTokenIdentifier(): Promise<Bech32mTokenIdentifier>;
|
|
129
|
+
/**
|
|
130
|
+
* Retrieves the bech32m encoded token identifier for the issuer's token.
|
|
131
|
+
* @returns The bech32m encoded token identifier for the issuer's token
|
|
132
|
+
* @throws {SparkRequestError} If the token identifier cannot be retrieved
|
|
133
|
+
*/
|
|
134
|
+
getIssuerTokenIdentifiers(): Promise<Bech32mTokenIdentifier[]>;
|
|
86
135
|
/**
|
|
87
136
|
* Create a new token on Spark.
|
|
88
137
|
*
|
|
@@ -93,51 +142,126 @@ declare abstract class IssuerSparkWallet extends SparkWallet {
|
|
|
93
142
|
* @param params.isFreezable - Whether the token can be frozen.
|
|
94
143
|
* @param [params.maxSupply=0n] - (Optional) The maximum supply of the token. Defaults to <code>0n</code>.
|
|
95
144
|
* @param params.extraMetadata - (Optional) This can be used to store additional bytes data to be associated with a token, like image data.
|
|
96
|
-
*
|
|
97
|
-
* @returns The transaction
|
|
98
|
-
*
|
|
145
|
+
* @param params.returnIdentifierForCreate - (Optional) Whether to return the token identifier in addition to the transaction hash. Defaults to <code>false</code>.
|
|
146
|
+
* @returns The transaction hash of the announcement or TokenCreationDetails if `returnIdentifierForCreate` is true.
|
|
99
147
|
* @throws {SparkValidationError} If `decimals` is not a safe integer or other validation fails.
|
|
100
148
|
* @throws {SparkRequestError} If the announcement transaction cannot be broadcast.
|
|
101
149
|
*/
|
|
102
|
-
createToken(
|
|
150
|
+
createToken(params: {
|
|
103
151
|
tokenName: string;
|
|
104
152
|
tokenTicker: string;
|
|
105
153
|
decimals: number;
|
|
106
154
|
isFreezable: boolean;
|
|
107
155
|
maxSupply?: bigint;
|
|
108
156
|
extraMetadata?: Uint8Array;
|
|
157
|
+
returnIdentifierForCreate?: false;
|
|
109
158
|
}): Promise<string>;
|
|
159
|
+
createToken(params: {
|
|
160
|
+
tokenName: string;
|
|
161
|
+
tokenTicker: string;
|
|
162
|
+
decimals: number;
|
|
163
|
+
isFreezable: boolean;
|
|
164
|
+
maxSupply?: bigint;
|
|
165
|
+
extraMetadata?: Uint8Array;
|
|
166
|
+
returnIdentifierForCreate: true;
|
|
167
|
+
}): Promise<TokenCreationDetails>;
|
|
168
|
+
/**
|
|
169
|
+
* @deprecated Use mintTokens({ tokenAmount, tokenIdentifier }) instead. This method will be removed in a future version.
|
|
170
|
+
* @param amount - The amount of tokens to mint
|
|
171
|
+
* @returns The transaction ID of the mint operation
|
|
172
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
173
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
174
|
+
*/
|
|
175
|
+
mintTokens(amount: bigint): Promise<string>;
|
|
110
176
|
/**
|
|
111
177
|
* Mints new tokens
|
|
112
|
-
* @param
|
|
178
|
+
* @param params - Object containing token minting parameters.
|
|
179
|
+
* @param params.tokenAmount - The amount of tokens to mint
|
|
180
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
113
181
|
* @returns The transaction ID of the mint operation
|
|
182
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
114
183
|
*/
|
|
115
|
-
mintTokens(tokenAmount
|
|
184
|
+
mintTokens({ tokenAmount, tokenIdentifier, }: {
|
|
185
|
+
tokenAmount: bigint;
|
|
186
|
+
tokenIdentifier?: Bech32mTokenIdentifier;
|
|
187
|
+
}): Promise<string>;
|
|
116
188
|
/**
|
|
117
189
|
* Burns issuer's tokens
|
|
190
|
+
* @deprecated Use burnTokens({ tokenAmount, tokenIdentifier, selectedOutputs }) instead. This method will be removed in a future version.
|
|
118
191
|
* @param tokenAmount - The amount of tokens to burn
|
|
119
192
|
* @param selectedOutputs - Optional array of outputs to use for the burn operation
|
|
120
193
|
* @returns The transaction ID of the burn operation
|
|
194
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
195
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
121
196
|
*/
|
|
122
197
|
burnTokens(tokenAmount: bigint, selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
198
|
+
/**
|
|
199
|
+
* Burns issuer's tokens
|
|
200
|
+
* @param params - Object containing token burning parameters.
|
|
201
|
+
* @param params.tokenAmount - The amount of tokens to burn
|
|
202
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
203
|
+
* @param params.selectedOutputs - Optional array of outputs to use for the burn operation
|
|
204
|
+
* @returns The transaction ID of the burn operation
|
|
205
|
+
*/
|
|
206
|
+
burnTokens({ tokenAmount, tokenIdentifier, selectedOutputs, }: {
|
|
207
|
+
tokenAmount: bigint;
|
|
208
|
+
tokenIdentifier?: Bech32mTokenIdentifier;
|
|
209
|
+
selectedOutputs?: OutputWithPreviousTransactionData[];
|
|
210
|
+
}): Promise<string>;
|
|
123
211
|
/**
|
|
124
212
|
* Freezes tokens associated with a specific Spark address.
|
|
213
|
+
* @deprecated Use freezeToken({ tokenIdentifier, sparkAddress }) instead. This method will be removed in a future version.
|
|
125
214
|
* @param sparkAddress - The Spark address whose tokens should be frozen
|
|
126
215
|
* @returns An object containing the IDs of impacted outputs and the total amount of frozen tokens
|
|
216
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
217
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
127
218
|
*/
|
|
128
219
|
freezeTokens(sparkAddress: string): Promise<{
|
|
129
220
|
impactedOutputIds: string[];
|
|
130
221
|
impactedTokenAmount: bigint;
|
|
131
222
|
}>;
|
|
223
|
+
/**
|
|
224
|
+
* Freezes tokens associated with a specific Spark address.
|
|
225
|
+
* @param params - Object containing token freezing parameters.
|
|
226
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
227
|
+
* @param params.sparkAddress - The Spark address whose tokens should be frozen
|
|
228
|
+
* @returns An object containing the IDs of impacted outputs and the total amount of frozen tokens
|
|
229
|
+
*/
|
|
230
|
+
freezeTokens({ tokenIdentifier, sparkAddress, }: {
|
|
231
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
232
|
+
sparkAddress: string;
|
|
233
|
+
}): Promise<{
|
|
234
|
+
impactedOutputIds: string[];
|
|
235
|
+
impactedTokenAmount: bigint;
|
|
236
|
+
}>;
|
|
132
237
|
/**
|
|
133
238
|
* Unfreezes previously frozen tokens associated with a specific Spark address.
|
|
239
|
+
* @deprecated Use unfreezeToken({ tokenIdentifier, sparkAddress }) instead. This method will be removed in a future version.
|
|
134
240
|
* @param sparkAddress - The Spark address whose tokens should be unfrozen
|
|
135
241
|
* @returns An object containing the IDs of impacted outputs and the total amount of unfrozen tokens
|
|
242
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
243
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
136
244
|
*/
|
|
137
245
|
unfreezeTokens(sparkAddress: string): Promise<{
|
|
138
246
|
impactedOutputIds: string[];
|
|
139
247
|
impactedTokenAmount: bigint;
|
|
140
248
|
}>;
|
|
249
|
+
/**
|
|
250
|
+
* Unfreezes previously frozen tokens associated with a specific Spark address.
|
|
251
|
+
* @param params - Object containing token unfreezing parameters.
|
|
252
|
+
* @param params.tokenIdentifier - The bech32m encoded token identifier
|
|
253
|
+
* @param params.sparkAddress - The Spark address whose tokens should be unfrozen
|
|
254
|
+
* @returns An object containing the IDs of impacted outputs and the total amount of unfrozen tokens
|
|
255
|
+
* @throws {SparkValidationError} If multiple tokens are found for this issuer
|
|
256
|
+
* @throws {SparkValidationError} If no tokens are found for this issuer
|
|
257
|
+
*/
|
|
258
|
+
unfreezeTokens({ tokenIdentifier, sparkAddress, }: {
|
|
259
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
260
|
+
sparkAddress: string;
|
|
261
|
+
}): Promise<{
|
|
262
|
+
impactedOutputIds: string[];
|
|
263
|
+
impactedTokenAmount: bigint;
|
|
264
|
+
}>;
|
|
141
265
|
/**
|
|
142
266
|
* Retrieves the distribution information for the issuer's token.
|
|
143
267
|
* @throws {SparkError} This feature is not yet supported
|
|
@@ -153,4 +277,4 @@ declare class IssuerSparkWalletNodeJS extends IssuerSparkWallet {
|
|
|
153
277
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<IssuerSparkWallet["initializeTracerEnv"]>[0]): void;
|
|
154
278
|
}
|
|
155
279
|
|
|
156
|
-
export { IssuerSparkWalletNodeJS as IssuerSparkWallet, type IssuerTokenMetadata, type TokenDistribution };
|
|
280
|
+
export { IssuerSparkWalletNodeJS as IssuerSparkWallet, type IssuerTokenMetadata, type TokenCreationDetails, type TokenDistribution };
|