@buildonspark/issuer-sdk 0.0.76 → 0.0.78
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 +18 -0
- package/dist/index.cjs +74 -48
- package/dist/index.d.cts +45 -12
- package/dist/index.d.ts +45 -12
- package/dist/index.js +52 -23
- package/package.json +4 -12
- package/src/index.ts +1 -0
- package/src/issuer-wallet/issuer-spark-wallet.ts +54 -39
- package/src/issuer-wallet/types.ts +45 -0
- package/src/services/freeze.ts +6 -4
- package/src/services/token-transactions.ts +3 -3
- package/src/tests/integration/spark.test.ts +21 -41
- package/src/tests/stress/transfers.test.ts +11 -8
- package/src/tests/utils/spark-testing-wallet.ts +8 -5
- package/src/utils/constants.ts +1 -1
- package/dist/proto/lrc20.cjs +0 -40
- package/dist/proto/lrc20.d.cts +0 -2
- package/dist/proto/lrc20.d.ts +0 -2
- package/dist/proto/lrc20.js +0 -4
- package/dist/types.cjs +0 -32
- package/dist/types.d.cts +0 -79
- package/dist/types.d.ts +0 -79
- package/dist/types.js +0 -1
- package/src/proto/lrc20.ts +0 -1
- package/src/types.ts +0 -85
- package/src/utils/type-mappers.ts +0 -148
|
@@ -9,13 +9,13 @@ import { isNode } from "@lightsparkdev/core";
|
|
|
9
9
|
import {
|
|
10
10
|
decodeSparkAddress,
|
|
11
11
|
encodeSparkAddress,
|
|
12
|
-
} from "@buildonspark/spark-sdk
|
|
12
|
+
} from "@buildonspark/spark-sdk";
|
|
13
13
|
import {
|
|
14
14
|
OutputWithPreviousTransactionData,
|
|
15
15
|
TokenTransaction as TokenTransactionV0,
|
|
16
16
|
} from "@buildonspark/spark-sdk/proto/spark";
|
|
17
17
|
import { TokenTransaction } from "@buildonspark/spark-sdk/proto/spark_token";
|
|
18
|
-
import { ConfigOptions } from "@buildonspark/spark-sdk
|
|
18
|
+
import { type ConfigOptions } from "@buildonspark/spark-sdk";
|
|
19
19
|
import {
|
|
20
20
|
bytesToHex,
|
|
21
21
|
bytesToNumberBE,
|
|
@@ -23,28 +23,12 @@ import {
|
|
|
23
23
|
} from "@noble/curves/abstract/utils";
|
|
24
24
|
import { TokenFreezeService } from "../services/freeze.js";
|
|
25
25
|
import { IssuerTokenTransactionService } from "../services/token-transactions.js";
|
|
26
|
-
import {
|
|
27
|
-
import { convertToTokenActivity } from "../utils/type-mappers.js";
|
|
26
|
+
import { TokenDistribution, IssuerTokenMetadata } from "./types.js";
|
|
28
27
|
import { NotImplementedError } from "@buildonspark/spark-sdk";
|
|
29
|
-
import {
|
|
30
|
-
Layer,
|
|
31
|
-
ListAllTokenTransactionsCursor,
|
|
32
|
-
OperationType,
|
|
33
|
-
} from "@buildonspark/spark-sdk/proto/lrc20";
|
|
34
|
-
import { SparkSigner } from "@buildonspark/spark-sdk/signer";
|
|
28
|
+
import { SparkSigner } from "@buildonspark/spark-sdk";
|
|
35
29
|
|
|
36
30
|
const BURN_ADDRESS = "02".repeat(33);
|
|
37
31
|
|
|
38
|
-
export type IssuerTokenInfo = {
|
|
39
|
-
tokenPublicKey: string;
|
|
40
|
-
tokenName: string;
|
|
41
|
-
tokenSymbol: string;
|
|
42
|
-
tokenDecimals: number;
|
|
43
|
-
maxSupply: bigint;
|
|
44
|
-
isFreezable: boolean;
|
|
45
|
-
totalSupply: bigint;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
32
|
/**
|
|
49
33
|
* Represents a Spark wallet with minting capabilities.
|
|
50
34
|
* This class extends the base SparkWallet with additional functionality for token minting,
|
|
@@ -85,9 +69,9 @@ export class IssuerSparkWallet extends SparkWallet {
|
|
|
85
69
|
"SparkIssuerWallet.getIssuerTokenBalance",
|
|
86
70
|
this.getIssuerTokenBalance.bind(this),
|
|
87
71
|
);
|
|
88
|
-
this.
|
|
89
|
-
"SparkIssuerWallet.
|
|
90
|
-
this.
|
|
72
|
+
this.getIssuerTokenMetadata = this.wrapWithOtelSpan(
|
|
73
|
+
"SparkIssuerWallet.getIssuerTokenMetadata",
|
|
74
|
+
this.getIssuerTokenMetadata.bind(this),
|
|
91
75
|
);
|
|
92
76
|
this.mintTokens = this.wrapWithOtelSpan(
|
|
93
77
|
"SparkIssuerWallet.mintTokens",
|
|
@@ -151,31 +135,62 @@ export class IssuerSparkWallet extends SparkWallet {
|
|
|
151
135
|
}
|
|
152
136
|
|
|
153
137
|
/**
|
|
154
|
-
* Retrieves
|
|
138
|
+
* Retrieves metadata about the issuer's token.
|
|
155
139
|
* @returns An object containing token information including public key, name, symbol, decimals, max supply, and freeze status
|
|
156
|
-
* @throws {NetworkError} If the token
|
|
140
|
+
* @throws {NetworkError} If the token metadata cannot be retrieved
|
|
157
141
|
*/
|
|
158
|
-
public async
|
|
159
|
-
const
|
|
142
|
+
public async getIssuerTokenMetadata(): Promise<IssuerTokenMetadata> {
|
|
143
|
+
const issuerPublicKey = await super.getIdentityPublicKey();
|
|
144
|
+
if (this.tokenMetadata.has(issuerPublicKey)) {
|
|
145
|
+
const metadata = this.tokenMetadata.get(issuerPublicKey)!;
|
|
160
146
|
|
|
147
|
+
return {
|
|
148
|
+
tokenPublicKey: bytesToHex(metadata.issuerPublicKey),
|
|
149
|
+
rawTokenIdentifier: metadata.tokenIdentifier,
|
|
150
|
+
tokenName: metadata.tokenName,
|
|
151
|
+
tokenTicker: metadata.tokenTicker,
|
|
152
|
+
decimals: metadata.decimals,
|
|
153
|
+
maxSupply: bytesToNumberBE(metadata.maxSupply),
|
|
154
|
+
isFreezable: metadata.isFreezable,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const sparkTokenClient =
|
|
159
|
+
await this.connectionManager.createSparkTokenClient(
|
|
160
|
+
this.config.getCoordinatorAddress(),
|
|
161
|
+
);
|
|
161
162
|
try {
|
|
162
|
-
const
|
|
163
|
-
|
|
163
|
+
const response = await sparkTokenClient.query_token_metadata({
|
|
164
|
+
issuerPublicKeys: Array.of(hexToBytes(issuerPublicKey)),
|
|
164
165
|
});
|
|
165
166
|
|
|
166
|
-
|
|
167
|
+
if (response.tokenMetadata.length === 0) {
|
|
168
|
+
throw new ValidationError(
|
|
169
|
+
"Token metadata not found - If a token has not yet been announced, please announce. If a token was recently announced, it is being confirmed. Try again in a few seconds.",
|
|
170
|
+
{
|
|
171
|
+
field: "tokenMetadata",
|
|
172
|
+
value: response.tokenMetadata,
|
|
173
|
+
expected: "non-empty array",
|
|
174
|
+
actualLength: response.tokenMetadata.length,
|
|
175
|
+
expectedLength: 1,
|
|
176
|
+
},
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const metadata = response.tokenMetadata[0];
|
|
181
|
+
this.tokenMetadata.set(issuerPublicKey, metadata);
|
|
182
|
+
|
|
167
183
|
return {
|
|
168
|
-
tokenPublicKey: bytesToHex(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
maxSupply: bytesToNumberBE(
|
|
174
|
-
|
|
184
|
+
tokenPublicKey: bytesToHex(metadata.issuerPublicKey),
|
|
185
|
+
rawTokenIdentifier: metadata.tokenIdentifier,
|
|
186
|
+
tokenName: metadata.tokenName,
|
|
187
|
+
tokenTicker: metadata.tokenTicker,
|
|
188
|
+
decimals: metadata.decimals,
|
|
189
|
+
maxSupply: bytesToNumberBE(metadata.maxSupply),
|
|
190
|
+
isFreezable: metadata.isFreezable,
|
|
175
191
|
};
|
|
176
192
|
} catch (error) {
|
|
177
|
-
throw new NetworkError("Failed to
|
|
178
|
-
operation: "getIssuerTokenInfo",
|
|
193
|
+
throw new NetworkError("Failed to fetch token metadata", {
|
|
179
194
|
errorCount: 1,
|
|
180
195
|
errors: error instanceof Error ? error.message : String(error),
|
|
181
196
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token metadata containing essential information about issuer's token.
|
|
3
|
+
* This is the wallet's internal representation with JavaScript-friendly types.
|
|
4
|
+
*
|
|
5
|
+
* rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
|
|
6
|
+
*
|
|
7
|
+
* tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const tokenMetadata: IssuerTokenMetadata = {
|
|
12
|
+
* rawTokenIdentifier: new Uint8Array([1, 2, 3]),
|
|
13
|
+
* tokenPublicKey: "0348fbb...",
|
|
14
|
+
* tokenName: "SparkToken",
|
|
15
|
+
* tokenTicker: "SPK",
|
|
16
|
+
* decimals: 8,
|
|
17
|
+
* maxSupply: 1000000n
|
|
18
|
+
* isFreezable: true
|
|
19
|
+
* };
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export type IssuerTokenMetadata = {
|
|
23
|
+
/** Raw binary token identifier - This is used to encode the human readable token identifier */
|
|
24
|
+
rawTokenIdentifier: Uint8Array;
|
|
25
|
+
/** Public key of the token issuer - Same as issuerPublicKey */
|
|
26
|
+
tokenPublicKey: string;
|
|
27
|
+
/** Human-readable name of the token (e.g., SparkToken)*/
|
|
28
|
+
tokenName: string;
|
|
29
|
+
/** Short ticker symbol for the token (e.g., "SPK") */
|
|
30
|
+
tokenTicker: string;
|
|
31
|
+
/** Number of decimal places for token amounts */
|
|
32
|
+
decimals: number;
|
|
33
|
+
/** Maximum supply of tokens that can ever be minted */
|
|
34
|
+
maxSupply: bigint;
|
|
35
|
+
/** Whether the token is freezable */
|
|
36
|
+
isFreezable: boolean;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface TokenDistribution {
|
|
40
|
+
totalCirculatingSupply: bigint;
|
|
41
|
+
totalIssued: bigint;
|
|
42
|
+
totalBurned: bigint;
|
|
43
|
+
numHoldingAddress: number;
|
|
44
|
+
numConfirmedTransactions: bigint;
|
|
45
|
+
}
|
package/src/services/freeze.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { WalletConfigService } from "@buildonspark/spark-sdk/config";
|
|
2
|
-
import { ConnectionManager } from "@buildonspark/spark-sdk/connection";
|
|
3
1
|
import {
|
|
4
2
|
FreezeTokensPayload,
|
|
5
3
|
FreezeTokensResponse,
|
|
6
4
|
} from "@buildonspark/spark-sdk/proto/spark";
|
|
7
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
type ConnectionManager,
|
|
7
|
+
WalletConfigService,
|
|
8
|
+
NetworkError,
|
|
9
|
+
collectResponses,
|
|
10
|
+
} from "@buildonspark/spark-sdk";
|
|
8
11
|
import { hashFreezeTokensPayload } from "../utils/token-hashing.js";
|
|
9
|
-
import { NetworkError } from "@buildonspark/spark-sdk";
|
|
10
12
|
import { hexToBytes } from "@noble/curves/abstract/utils";
|
|
11
13
|
|
|
12
14
|
export class TokenFreezeService {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WalletConfigService } from "@buildonspark/spark-sdk
|
|
2
|
-
import { ConnectionManager } from "@buildonspark/spark-sdk
|
|
1
|
+
import { WalletConfigService } from "@buildonspark/spark-sdk";
|
|
2
|
+
import { type ConnectionManager } from "@buildonspark/spark-sdk";
|
|
3
3
|
import { TokenTransaction as TokenTransactionV0 } from "@buildonspark/spark-sdk/proto/spark";
|
|
4
4
|
import { TokenTransaction } from "@buildonspark/spark-sdk/proto/spark_token";
|
|
5
|
-
import { TokenTransactionService } from "@buildonspark/spark-sdk
|
|
5
|
+
import { TokenTransactionService } from "@buildonspark/spark-sdk";
|
|
6
6
|
import { numberToBytesBE } from "@noble/curves/abstract/utils";
|
|
7
7
|
|
|
8
8
|
export class IssuerTokenTransactionService extends TokenTransactionService {
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
WalletConfig,
|
|
3
|
+
ConfigOptions,
|
|
4
|
+
filterTokenBalanceForTokenPublicKey,
|
|
5
|
+
encodeSparkAddress,
|
|
6
|
+
} from "@buildonspark/spark-sdk";
|
|
2
7
|
import { jest } from "@jest/globals";
|
|
3
|
-
import {
|
|
4
|
-
import { BitcoinFaucet } from "../../../../spark-sdk/src/tests/utils/test-faucet.js";
|
|
8
|
+
import { BitcoinFaucet } from "@buildonspark/spark-sdk/test-utils";
|
|
5
9
|
import { IssuerSparkWalletTesting } from "../utils/issuer-test-wallet.js";
|
|
6
|
-
import { hexToBytes } from "@noble/curves/abstract/utils";
|
|
10
|
+
import { bytesToHex, hexToBytes } from "@noble/curves/abstract/utils";
|
|
7
11
|
import { SparkWalletTesting } from "../utils/spark-testing-wallet.js";
|
|
8
12
|
import { IssuerSparkWallet } from "../../index.js";
|
|
9
|
-
import { LOCAL_WALLET_CONFIG } from "@buildonspark/spark-sdk/services/wallet-config";
|
|
10
|
-
import { ConfigOptions } from "@buildonspark/spark-sdk/services/wallet-config";
|
|
11
13
|
|
|
12
14
|
export const TOKENS_V0_SCHNORR_CONFIG: Required<ConfigOptions> = {
|
|
13
|
-
...
|
|
15
|
+
...WalletConfig.LOCAL,
|
|
14
16
|
tokenTransactionVersion: "V0",
|
|
15
17
|
tokenSignatures: "SCHNORR",
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
export const TOKENS_V1_SCHNORR_CONFIG: Required<ConfigOptions> = {
|
|
19
|
-
...
|
|
21
|
+
...WalletConfig.LOCAL,
|
|
20
22
|
tokenTransactionVersion: "V1",
|
|
21
23
|
tokenSignatures: "SCHNORR",
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
export const TOKENS_V0_ECDSA_CONFIG: Required<ConfigOptions> = {
|
|
25
|
-
...
|
|
27
|
+
...WalletConfig.LOCAL,
|
|
26
28
|
tokenSignatures: "ECDSA",
|
|
27
29
|
tokenTransactionVersion: "V0",
|
|
28
30
|
};
|
|
29
31
|
|
|
30
32
|
export const TOKENS_V1_ECDSA_CONFIG: Required<ConfigOptions> = {
|
|
31
|
-
...
|
|
33
|
+
...WalletConfig.LOCAL,
|
|
32
34
|
tokenSignatures: "ECDSA",
|
|
33
35
|
tokenTransactionVersion: "V1",
|
|
34
36
|
};
|
|
@@ -113,19 +115,19 @@ describe.each(TEST_CONFIGS)(
|
|
|
113
115
|
it("should mint tokens successfully", async () => {
|
|
114
116
|
const tokenAmount: bigint = 1000n;
|
|
115
117
|
|
|
116
|
-
const
|
|
118
|
+
const tokenMetadata = await sharedIssuerWallet.getIssuerTokenMetadata();
|
|
117
119
|
|
|
118
|
-
// Assert token public key
|
|
120
|
+
// Assert token public key metadata values
|
|
119
121
|
const identityPublicKey = await sharedIssuerWallet.getIdentityPublicKey();
|
|
120
|
-
expect(
|
|
121
|
-
expect(
|
|
122
|
-
expect(
|
|
123
|
-
expect(
|
|
124
|
-
expect(
|
|
122
|
+
expect(tokenMetadata?.tokenName).toEqual(`${name}Shared`);
|
|
123
|
+
expect(tokenMetadata?.tokenTicker).toEqual("SHR");
|
|
124
|
+
expect(tokenMetadata?.decimals).toEqual(0);
|
|
125
|
+
expect(tokenMetadata?.maxSupply).toEqual(1000000n);
|
|
126
|
+
expect(tokenMetadata?.isFreezable).toEqual(false);
|
|
125
127
|
|
|
126
128
|
// Compare the public key using bytesToHex
|
|
127
|
-
const
|
|
128
|
-
expect(
|
|
129
|
+
const metadataPubkey = tokenMetadata?.tokenPublicKey;
|
|
130
|
+
expect(metadataPubkey).toEqual(identityPublicKey);
|
|
129
131
|
|
|
130
132
|
await sharedIssuerWallet.mintTokens(tokenAmount);
|
|
131
133
|
|
|
@@ -520,28 +522,6 @@ describe.each(TEST_CONFIGS)(
|
|
|
520
522
|
);
|
|
521
523
|
});
|
|
522
524
|
|
|
523
|
-
brokenTestFn(
|
|
524
|
-
"should mint and burn tokens and totalSupply has to be equal amount of token minted minus burned tokens",
|
|
525
|
-
async () => {
|
|
526
|
-
const tokenAmount_init: bigint = 2000n;
|
|
527
|
-
const tokenAmount_burn: bigint = 1000n;
|
|
528
|
-
|
|
529
|
-
const existingTotalSupply =
|
|
530
|
-
(await sharedIssuerWallet.getIssuerTokenInfo())?.totalSupply || 0n;
|
|
531
|
-
|
|
532
|
-
await sharedIssuerWallet.mintTokens(tokenAmount_init);
|
|
533
|
-
|
|
534
|
-
await sharedIssuerWallet.burnTokens(tokenAmount_burn);
|
|
535
|
-
|
|
536
|
-
const newTotalSupply =
|
|
537
|
-
(await sharedIssuerWallet.getIssuerTokenInfo())?.totalSupply || 0n;
|
|
538
|
-
|
|
539
|
-
expect(newTotalSupply).toEqual(
|
|
540
|
-
existingTotalSupply + tokenAmount_init - tokenAmount_burn,
|
|
541
|
-
);
|
|
542
|
-
},
|
|
543
|
-
);
|
|
544
|
-
|
|
545
525
|
it("should complete full token lifecycle: announce, mint, transfer, return, burn", async () => {
|
|
546
526
|
const tokenAmount: bigint = 1000n;
|
|
547
527
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { IssuerSparkWallet } from "../../issuer-wallet/issuer-spark-wallet.js";
|
|
2
2
|
import { jest } from "@jest/globals";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
SparkWallet,
|
|
5
|
+
filterTokenBalanceForTokenPublicKey,
|
|
6
|
+
WalletConfig,
|
|
7
|
+
} from "@buildonspark/spark-sdk";
|
|
8
|
+
import { bytesToHex, hexToBytes } from "@noble/curves/abstract/utils";
|
|
6
9
|
|
|
7
10
|
const TEST_TIMEOUT = 600_000; // 10 minutes
|
|
8
11
|
const TOKEN_AMOUNT: bigint = 1000n;
|
|
@@ -31,10 +34,10 @@ describe("Stress test for token transfers", () => {
|
|
|
31
34
|
|
|
32
35
|
const start_time = Date.now();
|
|
33
36
|
const { wallet: issuerWallet } = await IssuerSparkWallet.initialize({
|
|
34
|
-
options:
|
|
37
|
+
options: WalletConfig.LOCAL,
|
|
35
38
|
});
|
|
36
39
|
const { wallet: userWallet } = await SparkWallet.initialize({
|
|
37
|
-
options:
|
|
40
|
+
options: WalletConfig.LOCAL,
|
|
38
41
|
});
|
|
39
42
|
|
|
40
43
|
await issuerWallet.mintTokens(TOKEN_AMOUNT);
|
|
@@ -72,7 +75,7 @@ describe("Stress test for token transfers", () => {
|
|
|
72
75
|
|
|
73
76
|
// Transfer tokens from user to issuer
|
|
74
77
|
await userWallet.transferTokens({
|
|
75
|
-
tokenPublicKey,
|
|
78
|
+
tokenPublicKey: tokenPublicKey,
|
|
76
79
|
tokenAmount: TOKEN_AMOUNT,
|
|
77
80
|
receiverSparkAddress: issuerWalletSparkAddress,
|
|
78
81
|
});
|
|
@@ -116,10 +119,10 @@ describe("Stress test for token transfers", () => {
|
|
|
116
119
|
.fill(0)
|
|
117
120
|
.map(async () => {
|
|
118
121
|
const issuer = await IssuerSparkWallet.initialize({
|
|
119
|
-
options:
|
|
122
|
+
options: WalletConfig.LOCAL,
|
|
120
123
|
});
|
|
121
124
|
const user = await SparkWallet.initialize({
|
|
122
|
-
options:
|
|
125
|
+
options: WalletConfig.LOCAL,
|
|
123
126
|
});
|
|
124
127
|
|
|
125
128
|
await issuer.wallet.mintTokens(TOKEN_AMOUNT);
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { SparkWallet, SparkWalletProps } from "@buildonspark/spark-sdk";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
SparkWallet,
|
|
3
|
+
SparkWalletProps,
|
|
4
|
+
SparkSigner,
|
|
5
|
+
ConfigOptions,
|
|
6
|
+
} from "@buildonspark/spark-sdk";
|
|
7
|
+
import {
|
|
8
|
+
type QueryTransfersResponse,
|
|
9
|
+
type Transfer,
|
|
5
10
|
} from "@buildonspark/spark-sdk/proto/spark";
|
|
6
|
-
import { ConfigOptions } from "@buildonspark/spark-sdk/services/wallet-config";
|
|
7
|
-
import { SparkSigner } from "@buildonspark/spark-sdk/signer";
|
|
8
11
|
|
|
9
12
|
interface ISparkWalletTesting extends SparkWallet {
|
|
10
13
|
getSigner(): SparkSigner;
|
package/src/utils/constants.ts
CHANGED
package/dist/proto/lrc20.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
-
|
|
17
|
-
// src/proto/lrc20.ts
|
|
18
|
-
var lrc20_exports = {};
|
|
19
|
-
module.exports = __toCommonJS(lrc20_exports);
|
|
20
|
-
|
|
21
|
-
// buffer.js
|
|
22
|
-
var import_buffer = require("buffer");
|
|
23
|
-
if (typeof globalThis.Buffer === "undefined") {
|
|
24
|
-
globalThis.Buffer = import_buffer.Buffer;
|
|
25
|
-
}
|
|
26
|
-
if (typeof window !== "undefined") {
|
|
27
|
-
if (typeof window.global === "undefined") {
|
|
28
|
-
window.global = window;
|
|
29
|
-
}
|
|
30
|
-
if (typeof window.globalThis === "undefined") {
|
|
31
|
-
window.globalThis = window;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// src/proto/lrc20.ts
|
|
36
|
-
__reExport(lrc20_exports, require("@buildonspark/spark-sdk/proto/lrc20"), module.exports);
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
...require("@buildonspark/spark-sdk/proto/lrc20")
|
|
40
|
-
});
|
package/dist/proto/lrc20.d.cts
DELETED
package/dist/proto/lrc20.d.ts
DELETED
package/dist/proto/lrc20.js
DELETED
package/dist/types.cjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/types.ts
|
|
17
|
-
var types_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(types_exports);
|
|
19
|
-
|
|
20
|
-
// buffer.js
|
|
21
|
-
var import_buffer = require("buffer");
|
|
22
|
-
if (typeof globalThis.Buffer === "undefined") {
|
|
23
|
-
globalThis.Buffer = import_buffer.Buffer;
|
|
24
|
-
}
|
|
25
|
-
if (typeof window !== "undefined") {
|
|
26
|
-
if (typeof window.global === "undefined") {
|
|
27
|
-
window.global = window;
|
|
28
|
-
}
|
|
29
|
-
if (typeof window.globalThis === "undefined") {
|
|
30
|
-
window.globalThis = window;
|
|
31
|
-
}
|
|
32
|
-
}
|
package/dist/types.d.cts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
type TokenActivityResponse = {
|
|
2
|
-
transactions: Transaction[];
|
|
3
|
-
nextCursor?: ListAllTokenTransactionsCursor | undefined;
|
|
4
|
-
};
|
|
5
|
-
interface Transaction {
|
|
6
|
-
transaction?: {
|
|
7
|
-
$case: "onChain";
|
|
8
|
-
onChain: OnChainTransaction;
|
|
9
|
-
} | {
|
|
10
|
-
$case: "spark";
|
|
11
|
-
spark: SparkTransaction;
|
|
12
|
-
} | undefined;
|
|
13
|
-
}
|
|
14
|
-
interface TokenPubKeyInfoResponse {
|
|
15
|
-
announcement: {
|
|
16
|
-
tokenPubkey: {
|
|
17
|
-
pubkey: string;
|
|
18
|
-
};
|
|
19
|
-
name: string;
|
|
20
|
-
symbol: string;
|
|
21
|
-
decimal: number;
|
|
22
|
-
maxSupply: bigint;
|
|
23
|
-
isFreezable: boolean;
|
|
24
|
-
} | null;
|
|
25
|
-
totalSupply: bigint;
|
|
26
|
-
}
|
|
27
|
-
interface OnChainTokenOutput {
|
|
28
|
-
rawTx: string;
|
|
29
|
-
vout: number;
|
|
30
|
-
amountSats: number;
|
|
31
|
-
tokenPublicKey?: string | undefined;
|
|
32
|
-
tokenAmount?: string | undefined;
|
|
33
|
-
}
|
|
34
|
-
interface OnChainTransaction {
|
|
35
|
-
operationType: string;
|
|
36
|
-
transactionHash: string;
|
|
37
|
-
rawtx: string;
|
|
38
|
-
status: string;
|
|
39
|
-
inputs: OnChainTokenOutput[];
|
|
40
|
-
outputs: OnChainTokenOutput[];
|
|
41
|
-
broadcastedAt: Date | undefined;
|
|
42
|
-
confirmedAt: Date | undefined;
|
|
43
|
-
}
|
|
44
|
-
interface SparkTransaction {
|
|
45
|
-
operationType: string;
|
|
46
|
-
transactionHash: string;
|
|
47
|
-
status: string;
|
|
48
|
-
confirmedAt: Date | undefined;
|
|
49
|
-
leavesToCreate: SparkLeaf[];
|
|
50
|
-
leavesToSpend: SparkLeaf[];
|
|
51
|
-
sparkOperatorIdentityPublicKeys: string[];
|
|
52
|
-
}
|
|
53
|
-
interface SparkLeaf {
|
|
54
|
-
tokenPublicKey: string;
|
|
55
|
-
id: string;
|
|
56
|
-
ownerPublicKey: string;
|
|
57
|
-
revocationPublicKey: string;
|
|
58
|
-
withdrawalBondSats: number;
|
|
59
|
-
withdrawalLocktime: number;
|
|
60
|
-
tokenAmount: string;
|
|
61
|
-
createTxHash: string;
|
|
62
|
-
createTxVoutIndex: number;
|
|
63
|
-
spendTxHash?: string | undefined;
|
|
64
|
-
spendTxVoutIndex?: number | undefined;
|
|
65
|
-
isFrozen?: boolean | undefined;
|
|
66
|
-
}
|
|
67
|
-
interface ListAllTokenTransactionsCursor {
|
|
68
|
-
lastTransactionHash: string;
|
|
69
|
-
layer: string;
|
|
70
|
-
}
|
|
71
|
-
interface TokenDistribution {
|
|
72
|
-
totalCirculatingSupply: bigint;
|
|
73
|
-
totalIssued: bigint;
|
|
74
|
-
totalBurned: bigint;
|
|
75
|
-
numHoldingAddress: number;
|
|
76
|
-
numConfirmedTransactions: bigint;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type { ListAllTokenTransactionsCursor, OnChainTokenOutput, OnChainTransaction, SparkLeaf, SparkTransaction, TokenActivityResponse, TokenDistribution, TokenPubKeyInfoResponse, Transaction };
|
package/dist/types.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
type TokenActivityResponse = {
|
|
2
|
-
transactions: Transaction[];
|
|
3
|
-
nextCursor?: ListAllTokenTransactionsCursor | undefined;
|
|
4
|
-
};
|
|
5
|
-
interface Transaction {
|
|
6
|
-
transaction?: {
|
|
7
|
-
$case: "onChain";
|
|
8
|
-
onChain: OnChainTransaction;
|
|
9
|
-
} | {
|
|
10
|
-
$case: "spark";
|
|
11
|
-
spark: SparkTransaction;
|
|
12
|
-
} | undefined;
|
|
13
|
-
}
|
|
14
|
-
interface TokenPubKeyInfoResponse {
|
|
15
|
-
announcement: {
|
|
16
|
-
tokenPubkey: {
|
|
17
|
-
pubkey: string;
|
|
18
|
-
};
|
|
19
|
-
name: string;
|
|
20
|
-
symbol: string;
|
|
21
|
-
decimal: number;
|
|
22
|
-
maxSupply: bigint;
|
|
23
|
-
isFreezable: boolean;
|
|
24
|
-
} | null;
|
|
25
|
-
totalSupply: bigint;
|
|
26
|
-
}
|
|
27
|
-
interface OnChainTokenOutput {
|
|
28
|
-
rawTx: string;
|
|
29
|
-
vout: number;
|
|
30
|
-
amountSats: number;
|
|
31
|
-
tokenPublicKey?: string | undefined;
|
|
32
|
-
tokenAmount?: string | undefined;
|
|
33
|
-
}
|
|
34
|
-
interface OnChainTransaction {
|
|
35
|
-
operationType: string;
|
|
36
|
-
transactionHash: string;
|
|
37
|
-
rawtx: string;
|
|
38
|
-
status: string;
|
|
39
|
-
inputs: OnChainTokenOutput[];
|
|
40
|
-
outputs: OnChainTokenOutput[];
|
|
41
|
-
broadcastedAt: Date | undefined;
|
|
42
|
-
confirmedAt: Date | undefined;
|
|
43
|
-
}
|
|
44
|
-
interface SparkTransaction {
|
|
45
|
-
operationType: string;
|
|
46
|
-
transactionHash: string;
|
|
47
|
-
status: string;
|
|
48
|
-
confirmedAt: Date | undefined;
|
|
49
|
-
leavesToCreate: SparkLeaf[];
|
|
50
|
-
leavesToSpend: SparkLeaf[];
|
|
51
|
-
sparkOperatorIdentityPublicKeys: string[];
|
|
52
|
-
}
|
|
53
|
-
interface SparkLeaf {
|
|
54
|
-
tokenPublicKey: string;
|
|
55
|
-
id: string;
|
|
56
|
-
ownerPublicKey: string;
|
|
57
|
-
revocationPublicKey: string;
|
|
58
|
-
withdrawalBondSats: number;
|
|
59
|
-
withdrawalLocktime: number;
|
|
60
|
-
tokenAmount: string;
|
|
61
|
-
createTxHash: string;
|
|
62
|
-
createTxVoutIndex: number;
|
|
63
|
-
spendTxHash?: string | undefined;
|
|
64
|
-
spendTxVoutIndex?: number | undefined;
|
|
65
|
-
isFrozen?: boolean | undefined;
|
|
66
|
-
}
|
|
67
|
-
interface ListAllTokenTransactionsCursor {
|
|
68
|
-
lastTransactionHash: string;
|
|
69
|
-
layer: string;
|
|
70
|
-
}
|
|
71
|
-
interface TokenDistribution {
|
|
72
|
-
totalCirculatingSupply: bigint;
|
|
73
|
-
totalIssued: bigint;
|
|
74
|
-
totalBurned: bigint;
|
|
75
|
-
numHoldingAddress: number;
|
|
76
|
-
numConfirmedTransactions: bigint;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export type { ListAllTokenTransactionsCursor, OnChainTokenOutput, OnChainTransaction, SparkLeaf, SparkTransaction, TokenActivityResponse, TokenDistribution, TokenPubKeyInfoResponse, Transaction };
|
package/dist/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./chunk-5MYKP7NN.js";
|
package/src/proto/lrc20.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@buildonspark/spark-sdk/proto/lrc20";
|