@arkade-os/sdk 0.0.16
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 +312 -0
- package/dist/cjs/arknote/index.js +86 -0
- package/dist/cjs/forfeit.js +38 -0
- package/dist/cjs/identity/inMemoryKey.js +40 -0
- package/dist/cjs/identity/index.js +2 -0
- package/dist/cjs/index.js +48 -0
- package/dist/cjs/musig2/index.js +10 -0
- package/dist/cjs/musig2/keys.js +57 -0
- package/dist/cjs/musig2/nonces.js +44 -0
- package/dist/cjs/musig2/sign.js +102 -0
- package/dist/cjs/networks.js +26 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/providers/ark.js +530 -0
- package/dist/cjs/providers/onchain.js +61 -0
- package/dist/cjs/script/address.js +45 -0
- package/dist/cjs/script/base.js +51 -0
- package/dist/cjs/script/default.js +40 -0
- package/dist/cjs/script/tapscript.js +528 -0
- package/dist/cjs/script/vhtlc.js +84 -0
- package/dist/cjs/tree/signingSession.js +238 -0
- package/dist/cjs/tree/validation.js +184 -0
- package/dist/cjs/tree/vtxoTree.js +197 -0
- package/dist/cjs/utils/bip21.js +114 -0
- package/dist/cjs/utils/coinselect.js +73 -0
- package/dist/cjs/utils/psbt.js +124 -0
- package/dist/cjs/utils/transactionHistory.js +148 -0
- package/dist/cjs/utils/txSizeEstimator.js +95 -0
- package/dist/cjs/wallet/index.js +8 -0
- package/dist/cjs/wallet/serviceWorker/db/vtxo/idb.js +153 -0
- package/dist/cjs/wallet/serviceWorker/db/vtxo/index.js +2 -0
- package/dist/cjs/wallet/serviceWorker/request.js +75 -0
- package/dist/cjs/wallet/serviceWorker/response.js +187 -0
- package/dist/cjs/wallet/serviceWorker/wallet.js +332 -0
- package/dist/cjs/wallet/serviceWorker/worker.js +452 -0
- package/dist/cjs/wallet/wallet.js +720 -0
- package/dist/esm/arknote/index.js +81 -0
- package/dist/esm/forfeit.js +35 -0
- package/dist/esm/identity/inMemoryKey.js +36 -0
- package/dist/esm/identity/index.js +1 -0
- package/dist/esm/index.js +39 -0
- package/dist/esm/musig2/index.js +3 -0
- package/dist/esm/musig2/keys.js +21 -0
- package/dist/esm/musig2/nonces.js +8 -0
- package/dist/esm/musig2/sign.js +63 -0
- package/dist/esm/networks.js +22 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/providers/ark.js +526 -0
- package/dist/esm/providers/onchain.js +57 -0
- package/dist/esm/script/address.js +41 -0
- package/dist/esm/script/base.js +46 -0
- package/dist/esm/script/default.js +37 -0
- package/dist/esm/script/tapscript.js +491 -0
- package/dist/esm/script/vhtlc.js +81 -0
- package/dist/esm/tree/signingSession.js +200 -0
- package/dist/esm/tree/validation.js +179 -0
- package/dist/esm/tree/vtxoTree.js +157 -0
- package/dist/esm/utils/bip21.js +110 -0
- package/dist/esm/utils/coinselect.js +69 -0
- package/dist/esm/utils/psbt.js +118 -0
- package/dist/esm/utils/transactionHistory.js +145 -0
- package/dist/esm/utils/txSizeEstimator.js +91 -0
- package/dist/esm/wallet/index.js +5 -0
- package/dist/esm/wallet/serviceWorker/db/vtxo/idb.js +149 -0
- package/dist/esm/wallet/serviceWorker/db/vtxo/index.js +1 -0
- package/dist/esm/wallet/serviceWorker/request.js +72 -0
- package/dist/esm/wallet/serviceWorker/response.js +184 -0
- package/dist/esm/wallet/serviceWorker/wallet.js +328 -0
- package/dist/esm/wallet/serviceWorker/worker.js +448 -0
- package/dist/esm/wallet/wallet.js +716 -0
- package/dist/types/arknote/index.d.ts +17 -0
- package/dist/types/forfeit.d.ts +15 -0
- package/dist/types/identity/inMemoryKey.d.ts +12 -0
- package/dist/types/identity/index.d.ts +7 -0
- package/dist/types/index.d.ts +22 -0
- package/dist/types/musig2/index.d.ts +4 -0
- package/dist/types/musig2/keys.d.ts +9 -0
- package/dist/types/musig2/nonces.d.ts +13 -0
- package/dist/types/musig2/sign.d.ts +27 -0
- package/dist/types/networks.d.ts +16 -0
- package/dist/types/providers/ark.d.ts +126 -0
- package/dist/types/providers/onchain.d.ts +36 -0
- package/dist/types/script/address.d.ts +10 -0
- package/dist/types/script/base.d.ts +26 -0
- package/dist/types/script/default.d.ts +19 -0
- package/dist/types/script/tapscript.d.ts +94 -0
- package/dist/types/script/vhtlc.d.ts +31 -0
- package/dist/types/tree/signingSession.d.ts +32 -0
- package/dist/types/tree/validation.d.ts +22 -0
- package/dist/types/tree/vtxoTree.d.ts +32 -0
- package/dist/types/utils/bip21.d.ts +21 -0
- package/dist/types/utils/coinselect.d.ts +21 -0
- package/dist/types/utils/psbt.d.ts +11 -0
- package/dist/types/utils/transactionHistory.d.ts +2 -0
- package/dist/types/utils/txSizeEstimator.d.ts +27 -0
- package/dist/types/wallet/index.d.ts +122 -0
- package/dist/types/wallet/serviceWorker/db/vtxo/idb.d.ts +18 -0
- package/dist/types/wallet/serviceWorker/db/vtxo/index.d.ts +12 -0
- package/dist/types/wallet/serviceWorker/request.d.ts +68 -0
- package/dist/types/wallet/serviceWorker/response.d.ts +107 -0
- package/dist/types/wallet/serviceWorker/wallet.d.ts +23 -0
- package/dist/types/wallet/serviceWorker/worker.d.ts +26 -0
- package/dist/types/wallet/wallet.d.ts +42 -0
- package/package.json +88 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { base58 } from "@scure/base";
|
|
2
|
+
// ArkNoteData is the unsigned data part of a note
|
|
3
|
+
export class ArkNoteData {
|
|
4
|
+
constructor(id, value) {
|
|
5
|
+
this.id = id;
|
|
6
|
+
this.value = value;
|
|
7
|
+
}
|
|
8
|
+
encode() {
|
|
9
|
+
const array = new Uint8Array(12);
|
|
10
|
+
writeBigUInt64BE(array, this.id, 0);
|
|
11
|
+
writeUInt32BE(array, this.value, 8);
|
|
12
|
+
return array;
|
|
13
|
+
}
|
|
14
|
+
static decode(data) {
|
|
15
|
+
if (data.length !== 12) {
|
|
16
|
+
throw new Error(`invalid data length: expected 12 bytes, got ${data.length}`);
|
|
17
|
+
}
|
|
18
|
+
const id = readBigUInt64BE(data, 0);
|
|
19
|
+
const value = readUInt32BE(data, 8);
|
|
20
|
+
return new ArkNoteData(id, value);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
// ArkNote is a note with the issuer's signature
|
|
24
|
+
export class ArkNote {
|
|
25
|
+
constructor(data, signature) {
|
|
26
|
+
this.data = data;
|
|
27
|
+
this.signature = signature;
|
|
28
|
+
}
|
|
29
|
+
encode() {
|
|
30
|
+
const detailsBytes = this.data.encode();
|
|
31
|
+
const result = new Uint8Array(detailsBytes.length + this.signature.length);
|
|
32
|
+
result.set(detailsBytes);
|
|
33
|
+
result.set(this.signature, detailsBytes.length);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
static decode(data) {
|
|
37
|
+
if (data.length < 12) {
|
|
38
|
+
throw new Error(`invalid data length: expected at least 12 bytes, got ${data.length}`);
|
|
39
|
+
}
|
|
40
|
+
const noteData = ArkNoteData.decode(data.subarray(0, 12));
|
|
41
|
+
const signature = data.subarray(12);
|
|
42
|
+
if (signature.length !== 64) {
|
|
43
|
+
throw new Error(`invalid signature length: expected 64 bytes, got ${signature.length}`);
|
|
44
|
+
}
|
|
45
|
+
return new ArkNote(noteData, signature);
|
|
46
|
+
}
|
|
47
|
+
static fromString(noteStr) {
|
|
48
|
+
if (!noteStr.startsWith(ArkNote.HRP)) {
|
|
49
|
+
throw new Error(`invalid human-readable part: expected ${ArkNote.HRP} prefix (note '${noteStr}')`);
|
|
50
|
+
}
|
|
51
|
+
const encoded = noteStr.slice(ArkNote.HRP.length);
|
|
52
|
+
if (encoded.length < 103 || encoded.length > 104) {
|
|
53
|
+
throw new Error(`invalid note length: expected 103 or 104 chars, got ${encoded.length}`);
|
|
54
|
+
}
|
|
55
|
+
const decoded = base58.decode(encoded);
|
|
56
|
+
if (decoded.length === 0) {
|
|
57
|
+
throw new Error("failed to decode base58 string");
|
|
58
|
+
}
|
|
59
|
+
return ArkNote.decode(new Uint8Array(decoded));
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
62
|
+
return ArkNote.HRP + base58.encode(this.encode());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
ArkNote.HRP = "arknote";
|
|
66
|
+
function writeBigUInt64BE(array, value, offset) {
|
|
67
|
+
const view = new DataView(array.buffer, array.byteOffset + offset, 8);
|
|
68
|
+
view.setBigUint64(0, value, false);
|
|
69
|
+
}
|
|
70
|
+
function readBigUInt64BE(array, offset) {
|
|
71
|
+
const view = new DataView(array.buffer, array.byteOffset + offset, 8);
|
|
72
|
+
return view.getBigUint64(0, false);
|
|
73
|
+
}
|
|
74
|
+
function writeUInt32BE(array, value, offset) {
|
|
75
|
+
const view = new DataView(array.buffer, array.byteOffset + offset, 4);
|
|
76
|
+
view.setUint32(0, value, false);
|
|
77
|
+
}
|
|
78
|
+
function readUInt32BE(array, offset) {
|
|
79
|
+
const view = new DataView(array.buffer, array.byteOffset + offset, 4);
|
|
80
|
+
return view.getUint32(0, false);
|
|
81
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SigHash, Transaction } from "@scure/btc-signer";
|
|
2
|
+
export function buildForfeitTx({ connectorInput, vtxoInput, vtxoAmount, connectorAmount, feeAmount, vtxoPkScript, connectorPkScript, serverPkScript, txLocktime, }) {
|
|
3
|
+
const tx = new Transaction({
|
|
4
|
+
version: 2,
|
|
5
|
+
lockTime: txLocktime,
|
|
6
|
+
});
|
|
7
|
+
// Add connector input
|
|
8
|
+
tx.addInput({
|
|
9
|
+
txid: connectorInput.txid,
|
|
10
|
+
index: connectorInput.vout,
|
|
11
|
+
witnessUtxo: {
|
|
12
|
+
script: connectorPkScript,
|
|
13
|
+
amount: connectorAmount,
|
|
14
|
+
},
|
|
15
|
+
sequence: 0xffffffff,
|
|
16
|
+
});
|
|
17
|
+
// Add VTXO input
|
|
18
|
+
tx.addInput({
|
|
19
|
+
txid: vtxoInput.txid,
|
|
20
|
+
index: vtxoInput.vout,
|
|
21
|
+
witnessUtxo: {
|
|
22
|
+
script: vtxoPkScript,
|
|
23
|
+
amount: vtxoAmount,
|
|
24
|
+
},
|
|
25
|
+
sequence: txLocktime ? 0xfffffffe : 0xffffffff, // MAX_SEQUENCE - 1 if locktime is set
|
|
26
|
+
sighashType: SigHash.DEFAULT,
|
|
27
|
+
});
|
|
28
|
+
const amount = BigInt(vtxoAmount) + BigInt(connectorAmount) - BigInt(feeAmount);
|
|
29
|
+
// Add main output to server
|
|
30
|
+
tx.addOutput({
|
|
31
|
+
script: serverPkScript,
|
|
32
|
+
amount,
|
|
33
|
+
});
|
|
34
|
+
return tx;
|
|
35
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { pubSchnorr, randomPrivateKeyBytes } from "@scure/btc-signer/utils";
|
|
2
|
+
import { hex } from "@scure/base";
|
|
3
|
+
import { TreeSignerSession } from '../tree/signingSession.js';
|
|
4
|
+
const ZERO_32 = new Uint8Array(32).fill(0);
|
|
5
|
+
export class InMemoryKey {
|
|
6
|
+
constructor(key) {
|
|
7
|
+
this.key = key || randomPrivateKeyBytes();
|
|
8
|
+
}
|
|
9
|
+
static fromPrivateKey(privateKey) {
|
|
10
|
+
return new InMemoryKey(privateKey);
|
|
11
|
+
}
|
|
12
|
+
static fromHex(privateKeyHex) {
|
|
13
|
+
return new InMemoryKey(hex.decode(privateKeyHex));
|
|
14
|
+
}
|
|
15
|
+
async sign(tx, inputIndexes) {
|
|
16
|
+
const txCpy = tx.clone();
|
|
17
|
+
if (!inputIndexes) {
|
|
18
|
+
if (!txCpy.sign(this.key, undefined, ZERO_32)) {
|
|
19
|
+
throw new Error("Failed to sign transaction");
|
|
20
|
+
}
|
|
21
|
+
return txCpy;
|
|
22
|
+
}
|
|
23
|
+
for (const inputIndex of inputIndexes) {
|
|
24
|
+
if (!txCpy.signIdx(this.key, inputIndex, undefined, ZERO_32)) {
|
|
25
|
+
throw new Error(`Failed to sign input #${inputIndex}`);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return txCpy;
|
|
29
|
+
}
|
|
30
|
+
xOnlyPublicKey() {
|
|
31
|
+
return pubSchnorr(this.key);
|
|
32
|
+
}
|
|
33
|
+
signerSession() {
|
|
34
|
+
return TreeSignerSession.random();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { InMemoryKey } from './identity/inMemoryKey.js';
|
|
2
|
+
import { ArkAddress } from './script/address.js';
|
|
3
|
+
import { VHTLC } from './script/vhtlc.js';
|
|
4
|
+
import { DefaultVtxo } from './script/default.js';
|
|
5
|
+
import { VtxoScript } from './script/base.js';
|
|
6
|
+
import { TxType, } from './wallet/index.js';
|
|
7
|
+
import { Wallet } from './wallet/wallet.js';
|
|
8
|
+
import { ServiceWorkerWallet } from './wallet/serviceWorker/wallet.js';
|
|
9
|
+
import { Worker } from './wallet/serviceWorker/worker.js';
|
|
10
|
+
import { Request } from './wallet/serviceWorker/request.js';
|
|
11
|
+
import { Response } from './wallet/serviceWorker/response.js';
|
|
12
|
+
import { ESPLORA_URL, EsploraProvider } from './providers/onchain.js';
|
|
13
|
+
import { RestArkProvider } from './providers/ark.js';
|
|
14
|
+
import { CLTVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CSVMultisigTapscript, decodeTapscript, MultisigTapscript, } from './script/tapscript.js';
|
|
15
|
+
import { addConditionWitness, CONDITION_WITNESS_KEY_PREFIX, createVirtualTx, } from './utils/psbt.js';
|
|
16
|
+
import { ArkNote, ArkNoteData } from './arknote/index.js';
|
|
17
|
+
import { IndexedDBVtxoRepository } from './wallet/serviceWorker/db/vtxo/idb.js';
|
|
18
|
+
import { networks } from './networks.js';
|
|
19
|
+
export {
|
|
20
|
+
// Classes
|
|
21
|
+
Wallet, ServiceWorkerWallet, InMemoryKey,
|
|
22
|
+
// Providers
|
|
23
|
+
ESPLORA_URL, EsploraProvider, RestArkProvider,
|
|
24
|
+
// Script-related
|
|
25
|
+
ArkAddress, DefaultVtxo, VtxoScript, VHTLC,
|
|
26
|
+
// Enums
|
|
27
|
+
TxType,
|
|
28
|
+
// Service Worker
|
|
29
|
+
Worker, Request, Response,
|
|
30
|
+
// Tapscript
|
|
31
|
+
decodeTapscript, MultisigTapscript, CSVMultisigTapscript, ConditionCSVMultisigTapscript, ConditionMultisigTapscript, CLTVMultisigTapscript,
|
|
32
|
+
// Utils
|
|
33
|
+
addConditionWitness, CONDITION_WITNESS_KEY_PREFIX, createVirtualTx,
|
|
34
|
+
// Arknote
|
|
35
|
+
ArkNote, ArkNoteData,
|
|
36
|
+
// Network
|
|
37
|
+
networks,
|
|
38
|
+
// Database
|
|
39
|
+
IndexedDBVtxoRepository, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as musig from "@scure/btc-signer/musig2";
|
|
2
|
+
import { schnorr } from "@noble/curves/secp256k1";
|
|
3
|
+
// Aggregates multiple public keys according to the MuSig2 algorithm
|
|
4
|
+
export function aggregateKeys(publicKeys, sort, options = {}) {
|
|
5
|
+
if (sort) {
|
|
6
|
+
publicKeys = musig.sortKeys(publicKeys);
|
|
7
|
+
}
|
|
8
|
+
const { aggPublicKey: preTweakedKey } = musig.keyAggregate(publicKeys);
|
|
9
|
+
if (!options.taprootTweak) {
|
|
10
|
+
return {
|
|
11
|
+
preTweakedKey: preTweakedKey.toRawBytes(true),
|
|
12
|
+
finalKey: preTweakedKey.toRawBytes(true),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const tweakBytes = schnorr.utils.taggedHash("TapTweak", preTweakedKey.toRawBytes(true).subarray(1), options.taprootTweak ?? new Uint8Array(0));
|
|
16
|
+
const { aggPublicKey: finalKey } = musig.keyAggregate(publicKeys, [tweakBytes], [true]);
|
|
17
|
+
return {
|
|
18
|
+
preTweakedKey: preTweakedKey.toRawBytes(true),
|
|
19
|
+
finalKey: finalKey.toRawBytes(true),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as musig from "@scure/btc-signer/musig2";
|
|
2
|
+
/**
|
|
3
|
+
* Generates a pair of public and secret nonces for MuSig2 signing
|
|
4
|
+
*/
|
|
5
|
+
export function generateNonces(publicKey) {
|
|
6
|
+
const nonces = musig.nonceGen(publicKey);
|
|
7
|
+
return { secNonce: nonces.secret, pubNonce: nonces.public };
|
|
8
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as musig from "@scure/btc-signer/musig2";
|
|
2
|
+
import { bytesToNumberBE } from "@noble/curves/abstract/utils";
|
|
3
|
+
import { CURVE } from "@noble/secp256k1";
|
|
4
|
+
import { aggregateKeys } from './keys.js';
|
|
5
|
+
import { schnorr } from "@noble/curves/secp256k1";
|
|
6
|
+
// Add this error type for decode failures
|
|
7
|
+
export class PartialSignatureError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = "PartialSignatureError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
// Implement a concrete class for PartialSignature
|
|
14
|
+
export class PartialSig {
|
|
15
|
+
constructor(s, R) {
|
|
16
|
+
this.s = s;
|
|
17
|
+
this.R = R;
|
|
18
|
+
if (s.length !== 32) {
|
|
19
|
+
throw new PartialSignatureError("Invalid s length");
|
|
20
|
+
}
|
|
21
|
+
if (R.length !== 33) {
|
|
22
|
+
throw new PartialSignatureError("Invalid R length");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Encodes the partial signature into bytes
|
|
27
|
+
* Returns a 32-byte array containing just the s value
|
|
28
|
+
*/
|
|
29
|
+
encode() {
|
|
30
|
+
// Return copy of s bytes
|
|
31
|
+
return new Uint8Array(this.s);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Decodes a partial signature from bytes
|
|
35
|
+
* @param bytes - 32-byte array containing s value
|
|
36
|
+
*/
|
|
37
|
+
static decode(bytes) {
|
|
38
|
+
if (bytes.length !== 32) {
|
|
39
|
+
throw new PartialSignatureError("Invalid partial signature length");
|
|
40
|
+
}
|
|
41
|
+
// Verify s is less than curve order
|
|
42
|
+
const s = bytesToNumberBE(bytes);
|
|
43
|
+
if (s >= CURVE.n) {
|
|
44
|
+
throw new PartialSignatureError("s value overflows curve order");
|
|
45
|
+
}
|
|
46
|
+
// For decode we don't have R, so we'll need to compute it later
|
|
47
|
+
const R = new Uint8Array(33); // Zero R for now
|
|
48
|
+
return new PartialSig(bytes, R);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Generates a MuSig2 partial signature
|
|
53
|
+
*/
|
|
54
|
+
export function sign(secNonce, privateKey, combinedNonce, publicKeys, message, options) {
|
|
55
|
+
let tweakBytes;
|
|
56
|
+
if (options?.taprootTweak !== undefined) {
|
|
57
|
+
const { preTweakedKey } = aggregateKeys(options?.sortKeys ? musig.sortKeys(publicKeys) : publicKeys, true);
|
|
58
|
+
tweakBytes = schnorr.utils.taggedHash("TapTweak", preTweakedKey.subarray(1), options.taprootTweak);
|
|
59
|
+
}
|
|
60
|
+
const session = new musig.Session(combinedNonce, options?.sortKeys ? musig.sortKeys(publicKeys) : publicKeys, message, tweakBytes ? [tweakBytes] : undefined, tweakBytes ? [true] : undefined);
|
|
61
|
+
const partialSig = session.sign(secNonce, privateKey);
|
|
62
|
+
return PartialSig.decode(partialSig);
|
|
63
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { NETWORK, TEST_NETWORK } from "@scure/btc-signer";
|
|
2
|
+
export const getNetwork = (network) => {
|
|
3
|
+
return networks[network];
|
|
4
|
+
};
|
|
5
|
+
export const networks = {
|
|
6
|
+
bitcoin: withArkPrefix(NETWORK, "ark"),
|
|
7
|
+
testnet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
8
|
+
signet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
9
|
+
mutinynet: withArkPrefix(TEST_NETWORK, "tark"),
|
|
10
|
+
regtest: withArkPrefix({
|
|
11
|
+
...TEST_NETWORK,
|
|
12
|
+
bech32: "bcrt",
|
|
13
|
+
pubKeyHash: 0x6f,
|
|
14
|
+
scriptHash: 0xc4,
|
|
15
|
+
}, "tark"),
|
|
16
|
+
};
|
|
17
|
+
function withArkPrefix(network, prefix) {
|
|
18
|
+
return {
|
|
19
|
+
...network,
|
|
20
|
+
hrp: prefix,
|
|
21
|
+
};
|
|
22
|
+
}
|