@bitgo-beta/sdk-coin-kaspa 0.0.1-alpha.10 → 0.0.1-alpha.11
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/README.md +33 -224
- package/dist/src/kaspa.d.ts +18 -86
- package/dist/src/kaspa.d.ts.map +1 -1
- package/dist/src/kaspa.js +31 -119
- package/dist/src/lib/iface.d.ts +17 -28
- package/dist/src/lib/iface.d.ts.map +1 -1
- package/dist/src/lib/iface.js +1 -1
- package/dist/src/lib/index.d.ts +0 -2
- package/dist/src/lib/index.d.ts.map +1 -1
- package/dist/src/lib/index.js +2 -4
- package/dist/src/lib/sighash.d.ts +5 -9
- package/dist/src/lib/sighash.d.ts.map +1 -1
- package/dist/src/lib/sighash.js +52 -82
- package/dist/src/lib/transaction.d.ts +18 -63
- package/dist/src/lib/transaction.d.ts.map +1 -1
- package/dist/src/lib/transaction.js +32 -108
- package/dist/src/lib/transactionBuilder.d.ts +17 -23
- package/dist/src/lib/transactionBuilder.d.ts.map +1 -1
- package/dist/src/lib/transactionBuilder.js +22 -53
- package/dist/src/lib/utils.d.ts +0 -10
- package/dist/src/lib/utils.d.ts.map +1 -1
- package/dist/src/lib/utils.js +1 -26
- package/dist/src/register.js +2 -2
- package/dist/test/unit/coin.test.js +9 -129
- package/dist/test/unit/transaction.test.js +62 -154
- package/dist/test/unit/transactionBuilder.test.js +31 -3
- package/dist/test/unit/transactionFlow.test.js +2 -67
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -6
- package/dist/src/lib/pskt.d.ts +0 -255
- package/dist/src/lib/pskt.d.ts.map +0 -1
- package/dist/src/lib/pskt.js +0 -436
- package/dist/test/unit/pskt.test.d.ts +0 -15
- package/dist/test/unit/pskt.test.d.ts.map +0 -1
- package/dist/test/unit/pskt.test.js +0 -382
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Supported coin identifiers:
|
|
|
17
17
|
- Address derivation (kaspa bech32 P2PK Schnorr)
|
|
18
18
|
- UTXO transaction building
|
|
19
19
|
- Schnorr signing and verification (Blake2b-256 sighash)
|
|
20
|
-
- TSS/MPC support (ECDSA algorithm
|
|
20
|
+
- TSS/MPC support (ECDSA algorithm)
|
|
21
21
|
- Full serialization round-trip (hex/JSON)
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
@@ -28,273 +28,82 @@ yarn add @bitgo/sdk-coin-kaspa
|
|
|
28
28
|
|
|
29
29
|
## Usage
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### Register with BitGo SDK
|
|
32
32
|
|
|
33
33
|
```typescript
|
|
34
|
-
import { BitGo } from 'bitgo';
|
|
35
34
|
import { register } from '@bitgo/sdk-coin-kaspa';
|
|
36
|
-
|
|
37
|
-
const bitgo = new BitGo({ env: 'prod' });
|
|
38
35
|
register(bitgo);
|
|
39
|
-
|
|
40
|
-
const kaspa = bitgo.coin('kaspa');
|
|
41
|
-
const tkaspa = bitgo.coin('tkaspa'); // testnet
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Alternatively, instantiate directly (useful in tests or scripts):
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
import { Kaspa, Tkaspa } from '@bitgo/sdk-coin-kaspa';
|
|
48
|
-
|
|
49
|
-
const kaspa = Kaspa.createInstance(bitgo);
|
|
50
|
-
const tkaspa = Tkaspa.createInstance(bitgo);
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
---
|
|
54
|
-
|
|
55
|
-
### 2. Key Generation
|
|
56
|
-
|
|
57
|
-
```typescript
|
|
58
|
-
// Random key pair
|
|
59
|
-
const kp = kaspa.generateKeyPair();
|
|
60
|
-
console.log(kp.pub); // 66-char hex compressed secp256k1 public key
|
|
61
|
-
console.log(kp.prv); // 64-char hex private key
|
|
62
|
-
|
|
63
|
-
// Deterministic from a 32-byte seed
|
|
64
|
-
const seed = Buffer.from('...32 bytes...', 'hex');
|
|
65
|
-
const kpFromSeed = kaspa.generateKeyPair(seed);
|
|
66
|
-
|
|
67
|
-
// Validation
|
|
68
|
-
kaspa.isValidPub(kp.pub); // true
|
|
69
|
-
kaspa.isValidPrv(kp.prv); // true
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
Using `KeyPair` directly:
|
|
73
|
-
|
|
74
|
-
```typescript
|
|
75
|
-
import { KeyPair } from '@bitgo/sdk-coin-kaspa';
|
|
76
|
-
|
|
77
|
-
const keyPair = new KeyPair(); // random
|
|
78
|
-
const { pub, prv } = keyPair.getKeys();
|
|
79
36
|
```
|
|
80
37
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
### 3. Address Generation
|
|
38
|
+
### Key Pair
|
|
84
39
|
|
|
85
40
|
```typescript
|
|
86
41
|
import { KeyPair } from '@bitgo/sdk-coin-kaspa';
|
|
87
42
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
const testnetAddress = keyPair.getAddress('testnet'); // kaspatest:qq...
|
|
92
|
-
|
|
93
|
-
kaspa.isValidAddress(mainnetAddress); // true
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Computing the P2PK `scriptPublicKey` for a key (required when constructing UTXO inputs):
|
|
43
|
+
// Generate a random key pair
|
|
44
|
+
const kp = new KeyPair();
|
|
45
|
+
const { pub, prv } = kp.getKeys();
|
|
97
46
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
const xOnlyPub = compressedToXOnly(Buffer.from(pub, 'hex'));
|
|
102
|
-
const scriptPublicKey = buildP2PKScriptPublicKey(xOnlyPub).toString('hex');
|
|
47
|
+
// Derive address
|
|
48
|
+
const mainnetAddress = kp.getAddress('mainnet');
|
|
49
|
+
const testnetAddress = kp.getAddress('testnet');
|
|
103
50
|
```
|
|
104
51
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### 4. Building a Transaction
|
|
52
|
+
### Build and Sign a Transaction
|
|
108
53
|
|
|
109
54
|
```typescript
|
|
110
|
-
import { TransactionBuilderFactory
|
|
55
|
+
import { TransactionBuilderFactory } from '@bitgo/sdk-coin-kaspa';
|
|
111
56
|
import { coins } from '@bitgo/statics';
|
|
112
|
-
import type { KaspaUtxoInput } from '@bitgo/sdk-coin-kaspa';
|
|
113
|
-
|
|
114
|
-
const utxo: KaspaUtxoInput = {
|
|
115
|
-
transactionId: '<64-char-hex-prev-tx-id>',
|
|
116
|
-
transactionIndex: 0,
|
|
117
|
-
amount: '100000000', // 1 KASPA in sompi (1e8)
|
|
118
|
-
scriptPublicKey: '<hex>', // P2PK script of the sender's key
|
|
119
|
-
sequence: '0',
|
|
120
|
-
sigOpCount: 1,
|
|
121
|
-
};
|
|
122
57
|
|
|
123
58
|
const factory = new TransactionBuilderFactory(coins.get('kaspa'));
|
|
124
59
|
const builder = factory.getBuilder();
|
|
125
60
|
|
|
126
61
|
builder
|
|
127
|
-
.addInput(
|
|
128
|
-
|
|
62
|
+
.addInput({
|
|
63
|
+
transactionId: '<prev-tx-id>',
|
|
64
|
+
transactionIndex: 0,
|
|
65
|
+
amount: '100000000', // 1 KASPA in sompi
|
|
66
|
+
scriptPublicKey: '<spk>',
|
|
67
|
+
sequence: '0',
|
|
68
|
+
sigOpCount: 1,
|
|
69
|
+
})
|
|
70
|
+
.to('<recipient-kaspa-address>', '99998000')
|
|
129
71
|
.fee('2000');
|
|
130
72
|
|
|
131
|
-
const tx =
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Multiple inputs:
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
builder
|
|
138
|
-
.addInput(utxo1)
|
|
139
|
-
.addInput(utxo2)
|
|
140
|
-
.to(recipientAddress, '299996000')
|
|
141
|
-
.fee('4000');
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
### 5. Signing — Path A: Direct Private Key (non-TSS)
|
|
147
|
-
|
|
148
|
-
```typescript
|
|
149
|
-
// `tx.sign` takes a 32-byte Buffer (raw private key)
|
|
73
|
+
const tx = await builder.build();
|
|
150
74
|
tx.sign(Buffer.from(privateKeyHex, 'hex'));
|
|
151
75
|
|
|
152
|
-
|
|
153
|
-
const signedTxHex = tx.toHex(); // SDK-internal format for round-trips
|
|
154
|
-
|
|
155
|
-
// Or via the coin interface:
|
|
156
|
-
const result = await kaspa.signTransaction({
|
|
157
|
-
txPrebuild: { txHex: unsignedTxHex },
|
|
158
|
-
prv: privateKeyHex,
|
|
159
|
-
} as any) as { txHex: string };
|
|
76
|
+
const broadcastPayload = tx.toBroadcastFormat(); // JSON string for RPC
|
|
160
77
|
```
|
|
161
78
|
|
|
162
|
-
---
|
|
163
|
-
|
|
164
|
-
### 6. Signing — Path B: TSS / MPC (per-input DKLS sessions)
|
|
165
|
-
|
|
166
|
-
Kaspa is UTXO-based: every input has its own sighash (Blake2b-256, BIP-143-like).
|
|
167
|
-
Each input **requires an independent DKLS session** — there is no way to produce N valid
|
|
168
|
-
Schnorr signatures from a single signing operation.
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
const unsignedTx = (await builder.build()) as Transaction;
|
|
172
|
-
const txHex = unsignedTx.toHex();
|
|
173
|
-
|
|
174
|
-
// Step 1: one sighash Buffer per input — the messages for each DKLS session
|
|
175
|
-
const sighashes: Buffer[] = unsignedTx.signablePayloads; // Buffer[N]
|
|
176
|
-
|
|
177
|
-
// Step 2: run N DKLS sessions in parallel (one per sighash)
|
|
178
|
-
// Each session produces a 64-byte raw Schnorr signature
|
|
179
|
-
|
|
180
|
-
// Step 3: collect results and call signTransaction
|
|
181
|
-
const signatures = sighashes.map((hash, inputIndex) => ({
|
|
182
|
-
inputIndex,
|
|
183
|
-
pubKey: compressedPubKeyHex, // 33-byte hex
|
|
184
|
-
signature: dklsSession(hash), // 64-byte hex Schnorr sig
|
|
185
|
-
}));
|
|
186
|
-
|
|
187
|
-
const result = await kaspa.signTransaction({
|
|
188
|
-
txPrebuild: { txHex },
|
|
189
|
-
signatures,
|
|
190
|
-
} as any) as { txHex: string } | { halfSigned: { txHex: string } };
|
|
191
|
-
|
|
192
|
-
// result.txHex → all inputs signed
|
|
193
|
-
// result.halfSigned → some inputs still unsigned (partial TSS round)
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
---
|
|
197
|
-
|
|
198
|
-
### 7. Broadcasting
|
|
199
|
-
|
|
200
|
-
```typescript
|
|
201
|
-
// toBroadcastFormat() returns the Kaspa RPC-compatible JSON string
|
|
202
|
-
const broadcastPayload = tx.toBroadcastFormat();
|
|
203
|
-
|
|
204
|
-
// toHex() is the SDK-internal round-trip format (preserves amount + scriptPublicKey
|
|
205
|
-
// on inputs for sighash recomputation). Do NOT send this to the Kaspa node directly.
|
|
206
|
-
const internalHex = tx.toHex();
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
### 8. Explaining / Parsing a Transaction
|
|
212
|
-
|
|
213
|
-
```typescript
|
|
214
|
-
// Human-readable breakdown
|
|
215
|
-
const explained = await kaspa.explainTransaction({ txHex });
|
|
216
|
-
console.log(explained.outputs); // [{ address, amount }]
|
|
217
|
-
console.log(explained.outputAmount); // total sent (sompi)
|
|
218
|
-
console.log(explained.fee); // fee (sompi)
|
|
219
|
-
|
|
220
|
-
// Structured parse — inputs and outputs tagged with coin name
|
|
221
|
-
const parsed = await kaspa.parseTransaction({ txHex } as any);
|
|
222
|
-
// { inputs: [{ amount, coin: 'kaspa' }], outputs: [{ address, amount, coin: 'kaspa' }] }
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
---
|
|
226
|
-
|
|
227
|
-
### 9. Verifying a Transaction
|
|
228
|
-
|
|
229
|
-
```typescript
|
|
230
|
-
const valid = await kaspa.verifyTransaction({
|
|
231
|
-
txPrebuild: { txHex },
|
|
232
|
-
txParams: {
|
|
233
|
-
recipients: [{ address: 'kaspa:qq...', amount: '99998000' }],
|
|
234
|
-
},
|
|
235
|
-
} as any);
|
|
236
|
-
|
|
237
|
-
console.log(valid); // true
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
### 10. Coin Properties
|
|
243
|
-
|
|
244
|
-
```typescript
|
|
245
|
-
kaspa.getChain(); // 'kaspa'
|
|
246
|
-
kaspa.getFamily(); // 'kaspa'
|
|
247
|
-
kaspa.getFullName(); // 'Kaspa'
|
|
248
|
-
kaspa.getBaseFactor(); // 100_000_000 (sompi per KASPA)
|
|
249
|
-
kaspa.supportsTss(); // true
|
|
250
|
-
kaspa.getMPCAlgorithm(); // 'ecdsa'
|
|
251
|
-
|
|
252
|
-
tkaspa.getChain(); // 'tkaspa'
|
|
253
|
-
tkaspa.getFullName(); // 'Testnet Kaspa'
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## Key Constants
|
|
259
|
-
|
|
260
|
-
| Property | Value |
|
|
261
|
-
|---|---|
|
|
262
|
-
| 1 KASPA | `100_000_000` sompi |
|
|
263
|
-
| `getBaseFactor()` | `1e8` |
|
|
264
|
-
| Mainnet address prefix | `kaspa:` |
|
|
265
|
-
| Testnet address prefix | `kaspatest:` |
|
|
266
|
-
| Address type | P2PK Schnorr (x-only secp256k1) |
|
|
267
|
-
| Signature algorithm | Schnorr (Blake2b-256 sighash) |
|
|
268
|
-
| TSS algorithm | `ecdsa` (DKLS) |
|
|
269
|
-
| Multisig type | `onchain` |
|
|
270
|
-
|
|
271
|
-
---
|
|
272
|
-
|
|
273
79
|
## Module Structure
|
|
274
80
|
|
|
275
81
|
```
|
|
276
82
|
src/
|
|
277
|
-
├── kaspa.ts #
|
|
278
|
-
├──
|
|
83
|
+
├── kaspa.ts # Kaspa mainnet coin class
|
|
84
|
+
├── tkaspa.ts # Kaspa testnet coin class
|
|
85
|
+
├── register.ts # SDK registration
|
|
279
86
|
├── index.ts
|
|
280
87
|
└── lib/
|
|
281
|
-
├── constants.ts # Chain constants (prefixes, decimals,
|
|
88
|
+
├── constants.ts # Chain constants (prefixes, decimals, fees)
|
|
282
89
|
├── iface.ts # TypeScript interfaces
|
|
283
|
-
├── keyPair.ts # secp256k1 key pair
|
|
284
|
-
├── sighash.ts # Blake2b-256 Schnorr sighash
|
|
285
|
-
├── transaction.ts # Transaction class (sign
|
|
90
|
+
├── keyPair.ts # secp256k1 key pair
|
|
91
|
+
├── sighash.ts # Blake2b-256 Schnorr sighash
|
|
92
|
+
├── transaction.ts # Transaction class (sign/verify/explain)
|
|
286
93
|
├── transactionBuilder.ts # UTXO transaction builder
|
|
287
94
|
├── transactionBuilderFactory.ts
|
|
288
95
|
├── utils.ts # Address validation and encoding
|
|
289
96
|
└── index.ts
|
|
290
97
|
test/
|
|
291
98
|
├── fixtures/
|
|
292
|
-
│
|
|
99
|
+
│ ├── kaspa.fixtures.ts # Deterministic test vectors
|
|
100
|
+
│ └── kaspaFixtures.ts # Synthetic test fixtures
|
|
293
101
|
└── unit/
|
|
294
102
|
├── coin.test.ts
|
|
295
103
|
├── keyPair.test.ts
|
|
296
104
|
├── transaction.test.ts
|
|
297
105
|
├── transactionBuilder.test.ts
|
|
106
|
+
├── transactionFlow.test.ts
|
|
298
107
|
└── utils.test.ts
|
|
299
108
|
```
|
|
300
109
|
|
|
@@ -308,7 +117,7 @@ Kaspa uses a custom cashaddr-like bech32 encoding:
|
|
|
308
117
|
|
|
309
118
|
## Signing
|
|
310
119
|
|
|
311
|
-
Kaspa uses **Schnorr signatures over secp256k1** with a **Blake2b-256** sighash. The sighash preimage follows the Kaspa BIP-143-like specification. Each input is signed independently, producing a 65-byte signature: 64 bytes Schnorr + 1 byte sighash type
|
|
120
|
+
Kaspa uses **Schnorr signatures over secp256k1** with a **Blake2b-256** sighash. The sighash preimage follows the Kaspa BIP-143-like specification. Each input is signed independently, producing a 65-byte signature: 64 bytes Schnorr + 1 byte sighash type.
|
|
312
121
|
|
|
313
122
|
## References
|
|
314
123
|
|
package/dist/src/kaspa.d.ts
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { KaspaVerifyTransactionOptions } from './lib/iface';
|
|
4
|
-
export declare
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* Kaspa family name is 'kaspa' for both mainnet and testnet.
|
|
12
|
-
* Override avoids going through names.ts which only knows Bitcoin-family coins.
|
|
13
|
-
* The cast is required because UtxoCoinNameMainnet is a closed union of Bitcoin-family coins;
|
|
14
|
-
* Kaspa manages its own network stack and is intentionally outside that union.
|
|
15
|
-
*/
|
|
16
|
-
getFamily(): UtxoCoinNameMainnet;
|
|
17
|
-
/**
|
|
18
|
-
* Human-readable name for this coin variant.
|
|
19
|
-
* Implemented in each concrete class to avoid runtime name comparisons.
|
|
20
|
-
*/
|
|
21
|
-
abstract getFullName(): string;
|
|
22
|
-
/**
|
|
23
|
-
* Whether this is a mainnet or testnet coin.
|
|
24
|
-
* Implemented in each concrete class to avoid runtime name comparisons.
|
|
25
|
-
*/
|
|
26
|
-
protected abstract isMainnet(): boolean;
|
|
27
|
-
supportsBlockTarget(): boolean;
|
|
1
|
+
import { BaseCoin as StaticsBaseCoin, CoinFamily } from '@bitgo-beta/statics';
|
|
2
|
+
import { AuditDecryptedKeyParams, BaseCoin, BitGoBase, KeyPair as IKeyPair, MPCAlgorithm, MultisigType, ParsedTransaction, ParseTransactionOptions, SignedTransaction, VerifyAddressOptions } from '@bitgo-beta/sdk-core';
|
|
3
|
+
import { KaspaExplainTransactionOptions, KaspaSignTransactionOptions, KaspaVerifyTransactionOptions, TransactionExplanation } from './lib/iface';
|
|
4
|
+
export declare class Kaspa extends BaseCoin {
|
|
5
|
+
protected readonly _staticsCoin: Readonly<StaticsBaseCoin>;
|
|
6
|
+
constructor(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>);
|
|
7
|
+
static createInstance(bitgo: BitGoBase, staticsCoin?: Readonly<StaticsBaseCoin>): BaseCoin;
|
|
8
|
+
getChain(): string;
|
|
9
|
+
getFamily(): CoinFamily;
|
|
10
|
+
getFullName(): string;
|
|
28
11
|
/**
|
|
29
12
|
* Return the base factor (sompi per KASPA).
|
|
30
13
|
* 1 KASPA = 100,000,000 sompi (8 decimal places)
|
|
31
14
|
*/
|
|
32
|
-
getBaseFactor(): number;
|
|
15
|
+
getBaseFactor(): string | number;
|
|
33
16
|
/** @inheritDoc */
|
|
34
17
|
getDefaultMultisigType(): MultisigType;
|
|
35
18
|
/**
|
|
@@ -47,10 +30,7 @@ export declare abstract class AbstractKaspaLikeCoin extends AbstractUtxoCoin {
|
|
|
47
30
|
/**
|
|
48
31
|
* Generate a Kaspa key pair.
|
|
49
32
|
*/
|
|
50
|
-
generateKeyPair(seed?: Buffer):
|
|
51
|
-
pub: string;
|
|
52
|
-
prv: string;
|
|
53
|
-
};
|
|
33
|
+
generateKeyPair(seed?: Buffer): IKeyPair;
|
|
54
34
|
/**
|
|
55
35
|
* Check if address belongs to wallet by deriving from keychains.
|
|
56
36
|
*/
|
|
@@ -58,75 +38,27 @@ export declare abstract class AbstractKaspaLikeCoin extends AbstractUtxoCoin {
|
|
|
58
38
|
private getBuilder;
|
|
59
39
|
/**
|
|
60
40
|
* Parse a Kaspa transaction from prebuild.
|
|
61
|
-
* Overrides AbstractUtxoCoin's PSBT-based implementation with Kaspa's JSON-hex format.
|
|
62
41
|
*/
|
|
63
|
-
parseTransaction
|
|
42
|
+
parseTransaction(params: ParseTransactionOptions): Promise<ParsedTransaction>;
|
|
64
43
|
/**
|
|
65
44
|
* Verify a Kaspa transaction against expected params.
|
|
66
45
|
*/
|
|
67
46
|
verifyTransaction(params: KaspaVerifyTransactionOptions): Promise<boolean>;
|
|
68
47
|
/**
|
|
69
48
|
* Explain a Kaspa transaction.
|
|
70
|
-
* Overrides AbstractUtxoCoin's PSBT-based implementation with Kaspa's JSON-hex format.
|
|
71
|
-
* The return type cast is necessary because Kaspa uses a custom TransactionExplanation
|
|
72
|
-
* that doesn't include Bitcoin-specific fields (chain, index) on outputs.
|
|
73
49
|
*/
|
|
74
|
-
explainTransaction
|
|
50
|
+
explainTransaction(params: KaspaExplainTransactionOptions): Promise<TransactionExplanation>;
|
|
75
51
|
/**
|
|
76
52
|
* Sign a Kaspa transaction using secp256k1 Schnorr signatures.
|
|
77
|
-
*
|
|
78
|
-
* Kaspa is a UTXO coin: every input has its own sighash.
|
|
79
|
-
* Two signing paths are supported:
|
|
80
|
-
*
|
|
81
|
-
* Path A — `params.prv` (direct key, test / non-TSS):
|
|
82
|
-
* Calls `tx.sign(prv)` which loops every input and produces a Schnorr
|
|
83
|
-
* signature for each one in a single call.
|
|
84
|
-
*
|
|
85
|
-
* Path B — `params.signatures` (TSS multi-input):
|
|
86
|
-
* The caller already ran one independent DKLS session per input, using
|
|
87
|
-
* `tx.signablePayloads[i]` as the message for session i. Each resulting
|
|
88
|
-
* signature is applied to its input via `addSignatureForInput`.
|
|
89
|
-
*
|
|
90
|
-
* Platform flow:
|
|
91
|
-
* 1. Build tx, read `(tx as Transaction).signablePayloads` → Buffer[N]
|
|
92
|
-
* 2. Run N DKLS sessions in parallel, one per sighash
|
|
93
|
-
* 3. Call signTransaction({ signatures: [{ inputIndex, pubKey, signature }, ...] })
|
|
94
|
-
*/
|
|
95
|
-
signTransaction<TNumber extends number | bigint = number>(params: SignTransactionOptions<TNumber>): Promise<SignedTransaction>;
|
|
96
|
-
/**
|
|
97
|
-
* Kaspa's txHex is already the custom JSON-hex format — skip the PSBT
|
|
98
|
-
* re-encode that AbstractUtxoCoin.postProcessPrebuild would otherwise apply.
|
|
99
53
|
*/
|
|
100
|
-
|
|
101
|
-
signMessage(
|
|
54
|
+
signTransaction(params: KaspaSignTransactionOptions): Promise<SignedTransaction>;
|
|
55
|
+
signMessage(key: IKeyPair, message: string | Buffer): Promise<Buffer>;
|
|
102
56
|
/** @inheritDoc */
|
|
103
|
-
auditDecryptedKey(
|
|
57
|
+
auditDecryptedKey(params: AuditDecryptedKeyParams): void;
|
|
104
58
|
/**
|
|
105
|
-
*
|
|
106
|
-
* ECDSA for the off-chain TSS ceremony).
|
|
107
|
-
*
|
|
108
|
-
* Kaspa is a UTXO coin with a BIP-143-like per-input sighash scheme.
|
|
109
|
-
* Each input commits to its own index and produces a distinct hash.
|
|
110
|
-
* One independent DKLS signing session is required per input.
|
|
111
|
-
*
|
|
112
|
-
* Correct multi-input TSS flow:
|
|
113
|
-
* 1. Read `tx.signablePayloads` → Buffer[] (one sighash per input).
|
|
114
|
-
* 2. Run one DKLS signing session per sighash IN PARALLEL.
|
|
115
|
-
* 3. Apply each signature: `tx.addSignatureForInput(i, pubKey, sig)`.
|
|
59
|
+
* MPC support: Kaspa uses secp256k1 (Schnorr variant).
|
|
116
60
|
*/
|
|
117
61
|
supportsTss(): boolean;
|
|
118
62
|
getMPCAlgorithm(): MPCAlgorithm;
|
|
119
63
|
}
|
|
120
|
-
export declare class Kaspa extends AbstractKaspaLikeCoin {
|
|
121
|
-
readonly name: UtxoCoinName;
|
|
122
|
-
getFullName(): string;
|
|
123
|
-
protected isMainnet(): boolean;
|
|
124
|
-
static createInstance(bitgo: BitGoBase): Kaspa;
|
|
125
|
-
}
|
|
126
|
-
export declare class Tkaspa extends AbstractKaspaLikeCoin {
|
|
127
|
-
readonly name: UtxoCoinName;
|
|
128
|
-
getFullName(): string;
|
|
129
|
-
protected isMainnet(): boolean;
|
|
130
|
-
static createInstance(bitgo: BitGoBase): Tkaspa;
|
|
131
|
-
}
|
|
132
64
|
//# sourceMappingURL=kaspa.d.ts.map
|
package/dist/src/kaspa.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kaspa.d.ts","sourceRoot":"","sources":["../../src/kaspa.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kaspa.d.ts","sourceRoot":"","sources":["../../src/kaspa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,eAAe,EAAE,UAAU,EAAS,MAAM,qBAAqB,CAAC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