digirails 0.1.0
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/LICENSE +21 -0
- package/README.md +102 -0
- package/dist/agent.d.ts +72 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +176 -0
- package/dist/agent.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/crypto/base58.d.ts +9 -0
- package/dist/crypto/base58.d.ts.map +1 -0
- package/dist/crypto/base58.js +107 -0
- package/dist/crypto/base58.js.map +1 -0
- package/dist/crypto/bech32.d.ts +9 -0
- package/dist/crypto/bech32.d.ts.map +1 -0
- package/dist/crypto/bech32.js +141 -0
- package/dist/crypto/bech32.js.map +1 -0
- package/dist/crypto/index.d.ts +6 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.js +22 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/crypto/keys.d.ts +25 -0
- package/dist/crypto/keys.d.ts.map +1 -0
- package/dist/crypto/keys.js +129 -0
- package/dist/crypto/keys.js.map +1 -0
- package/dist/crypto/script.d.ts +12 -0
- package/dist/crypto/script.d.ts.map +1 -0
- package/dist/crypto/script.js +105 -0
- package/dist/crypto/script.js.map +1 -0
- package/dist/crypto/transaction.d.ts +47 -0
- package/dist/crypto/transaction.d.ts.map +1 -0
- package/dist/crypto/transaction.js +227 -0
- package/dist/crypto/transaction.js.map +1 -0
- package/dist/discovery/index.d.ts +2 -0
- package/dist/discovery/index.d.ts.map +1 -0
- package/dist/discovery/index.js +6 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/manifest_client.d.ts +9 -0
- package/dist/discovery/manifest_client.d.ts.map +1 -0
- package/dist/discovery/manifest_client.js +29 -0
- package/dist/discovery/manifest_client.js.map +1 -0
- package/dist/exceptions.d.ts +32 -0
- package/dist/exceptions.d.ts.map +1 -0
- package/dist/exceptions.js +72 -0
- package/dist/exceptions.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +135 -0
- package/dist/index.js.map +1 -0
- package/dist/models/enums.d.ts +48 -0
- package/dist/models/enums.d.ts.map +1 -0
- package/dist/models/enums.js +84 -0
- package/dist/models/enums.js.map +1 -0
- package/dist/models/index.d.ts +4 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +20 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/manifest.d.ts +327 -0
- package/dist/models/manifest.d.ts.map +1 -0
- package/dist/models/manifest.js +47 -0
- package/dist/models/manifest.js.map +1 -0
- package/dist/models/messages.d.ts +336 -0
- package/dist/models/messages.d.ts.map +1 -0
- package/dist/models/messages.js +166 -0
- package/dist/models/messages.js.map +1 -0
- package/dist/network/constants.d.ts +51 -0
- package/dist/network/constants.d.ts.map +1 -0
- package/dist/network/constants.js +63 -0
- package/dist/network/constants.js.map +1 -0
- package/dist/network/index.d.ts +3 -0
- package/dist/network/index.d.ts.map +1 -0
- package/dist/network/index.js +19 -0
- package/dist/network/index.js.map +1 -0
- package/dist/network/params.d.ts +21 -0
- package/dist/network/params.d.ts.map +1 -0
- package/dist/network/params.js +57 -0
- package/dist/network/params.js.map +1 -0
- package/dist/opreturn.d.ts +25 -0
- package/dist/opreturn.d.ts.map +1 -0
- package/dist/opreturn.js +118 -0
- package/dist/opreturn.js.map +1 -0
- package/dist/payment/buyer.d.ts +29 -0
- package/dist/payment/buyer.d.ts.map +1 -0
- package/dist/payment/buyer.js +118 -0
- package/dist/payment/buyer.js.map +1 -0
- package/dist/payment/flow.d.ts +20 -0
- package/dist/payment/flow.d.ts.map +1 -0
- package/dist/payment/flow.js +29 -0
- package/dist/payment/flow.js.map +1 -0
- package/dist/payment/index.d.ts +5 -0
- package/dist/payment/index.d.ts.map +1 -0
- package/dist/payment/index.js +13 -0
- package/dist/payment/index.js.map +1 -0
- package/dist/payment/seller.d.ts +27 -0
- package/dist/payment/seller.d.ts.map +1 -0
- package/dist/payment/seller.js +193 -0
- package/dist/payment/seller.js.map +1 -0
- package/dist/payment/verification.d.ts +8 -0
- package/dist/payment/verification.d.ts.map +1 -0
- package/dist/payment/verification.js +89 -0
- package/dist/payment/verification.js.map +1 -0
- package/dist/rpc/client.d.ts +21 -0
- package/dist/rpc/client.d.ts.map +1 -0
- package/dist/rpc/client.js +131 -0
- package/dist/rpc/client.js.map +1 -0
- package/dist/rpc/index.d.ts +2 -0
- package/dist/rpc/index.d.ts.map +1 -0
- package/dist/rpc/index.js +6 -0
- package/dist/rpc/index.js.map +1 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +104 -0
- package/dist/server.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/wallet/index.d.ts +4 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +14 -0
- package/dist/wallet/index.js.map +1 -0
- package/dist/wallet/keystore.d.ts +32 -0
- package/dist/wallet/keystore.d.ts.map +1 -0
- package/dist/wallet/keystore.js +111 -0
- package/dist/wallet/keystore.js.map +1 -0
- package/dist/wallet/utxo.d.ts +32 -0
- package/dist/wallet/utxo.d.ts.map +1 -0
- package/dist/wallet/utxo.js +88 -0
- package/dist/wallet/utxo.js.map +1 -0
- package/dist/wallet/wallet.d.ts +52 -0
- package/dist/wallet/wallet.d.ts.map +1 -0
- package/dist/wallet/wallet.js +249 -0
- package/dist/wallet/wallet.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Transaction = void 0;
|
|
4
|
+
exports.buildPaymentTx = buildPaymentTx;
|
|
5
|
+
const keys_1 = require("./keys");
|
|
6
|
+
const script_1 = require("./script");
|
|
7
|
+
const params_1 = require("../network/params");
|
|
8
|
+
const constants_1 = require("../network/constants");
|
|
9
|
+
const exceptions_1 = require("../exceptions");
|
|
10
|
+
/** Write a varint (Bitcoin compact size) */
|
|
11
|
+
function writeVarint(n) {
|
|
12
|
+
if (n < 0xfd) {
|
|
13
|
+
return Buffer.from([n]);
|
|
14
|
+
}
|
|
15
|
+
else if (n <= 0xffff) {
|
|
16
|
+
const buf = Buffer.alloc(3);
|
|
17
|
+
buf[0] = 0xfd;
|
|
18
|
+
buf.writeUInt16LE(n, 1);
|
|
19
|
+
return buf;
|
|
20
|
+
}
|
|
21
|
+
else if (n <= 0xffffffff) {
|
|
22
|
+
const buf = Buffer.alloc(5);
|
|
23
|
+
buf[0] = 0xfe;
|
|
24
|
+
buf.writeUInt32LE(n, 1);
|
|
25
|
+
return buf;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
const buf = Buffer.alloc(9);
|
|
29
|
+
buf[0] = 0xff;
|
|
30
|
+
buf.writeBigUInt64LE(BigInt(n), 1);
|
|
31
|
+
return buf;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Write a 32-byte txid (reversed from hex) */
|
|
35
|
+
function txidToBytes(txid) {
|
|
36
|
+
const buf = Buffer.from(txid, 'hex');
|
|
37
|
+
buf.reverse();
|
|
38
|
+
return buf;
|
|
39
|
+
}
|
|
40
|
+
/** Write uint32 LE */
|
|
41
|
+
function writeUint32LE(n) {
|
|
42
|
+
const buf = Buffer.alloc(4);
|
|
43
|
+
buf.writeUInt32LE(n);
|
|
44
|
+
return buf;
|
|
45
|
+
}
|
|
46
|
+
/** Write int64 LE (for satoshi amounts) */
|
|
47
|
+
function writeInt64LE(n) {
|
|
48
|
+
const buf = Buffer.alloc(8);
|
|
49
|
+
buf.writeBigInt64LE(n);
|
|
50
|
+
return buf;
|
|
51
|
+
}
|
|
52
|
+
class Transaction {
|
|
53
|
+
version = 2;
|
|
54
|
+
locktime = 0;
|
|
55
|
+
inputs = [];
|
|
56
|
+
outputs = [];
|
|
57
|
+
witnesses = [];
|
|
58
|
+
addInput(input) {
|
|
59
|
+
this.inputs.push(input);
|
|
60
|
+
this.witnesses.push([]);
|
|
61
|
+
}
|
|
62
|
+
addOutput(output) {
|
|
63
|
+
this.outputs.push(output);
|
|
64
|
+
}
|
|
65
|
+
addOpReturn(data) {
|
|
66
|
+
this.outputs.push({
|
|
67
|
+
scriptPubkey: (0, script_1.opReturnScript)(data),
|
|
68
|
+
amountSat: 0n,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Sign a P2WPKH input using BIP-143.
|
|
73
|
+
*/
|
|
74
|
+
signInput(inputIndex, privateKey) {
|
|
75
|
+
const input = this.inputs[inputIndex];
|
|
76
|
+
if (!input)
|
|
77
|
+
throw new Error(`Input ${inputIndex} does not exist`);
|
|
78
|
+
const SIGHASH_ALL = 1;
|
|
79
|
+
// BIP-143 preimage components
|
|
80
|
+
const hashPrevouts = (0, keys_1.doubleSha256)(Buffer.concat(this.inputs.map((inp) => Buffer.concat([txidToBytes(inp.txid), writeUint32LE(inp.vout)]))));
|
|
81
|
+
const hashSequence = (0, keys_1.doubleSha256)(Buffer.concat(this.inputs.map((inp) => writeUint32LE(inp.sequence))));
|
|
82
|
+
const hashOutputs = (0, keys_1.doubleSha256)(Buffer.concat(this.outputs.map((out) => Buffer.concat([
|
|
83
|
+
writeInt64LE(out.amountSat),
|
|
84
|
+
writeVarint(out.scriptPubkey.length),
|
|
85
|
+
out.scriptPubkey,
|
|
86
|
+
]))));
|
|
87
|
+
// Extract keyhash from P2WPKH scriptPubkey (OP_0 0x14 <20B>)
|
|
88
|
+
const keyhash = input.scriptPubkey.slice(2, 22);
|
|
89
|
+
// scriptCode for P2WPKH: OP_DUP OP_HASH160 <20B keyhash> OP_EQUALVERIFY OP_CHECKSIG
|
|
90
|
+
const scriptCode = Buffer.concat([
|
|
91
|
+
Buffer.from([0x19, 0x76, 0xa9, 0x14]),
|
|
92
|
+
keyhash,
|
|
93
|
+
Buffer.from([0x88, 0xac]),
|
|
94
|
+
]);
|
|
95
|
+
// Assemble BIP-143 preimage
|
|
96
|
+
const preimage = Buffer.concat([
|
|
97
|
+
writeUint32LE(this.version),
|
|
98
|
+
hashPrevouts,
|
|
99
|
+
hashSequence,
|
|
100
|
+
txidToBytes(input.txid),
|
|
101
|
+
writeUint32LE(input.vout),
|
|
102
|
+
scriptCode,
|
|
103
|
+
writeInt64LE(input.amountSat),
|
|
104
|
+
writeUint32LE(input.sequence),
|
|
105
|
+
hashOutputs,
|
|
106
|
+
writeUint32LE(this.locktime),
|
|
107
|
+
writeUint32LE(SIGHASH_ALL),
|
|
108
|
+
]);
|
|
109
|
+
const sigHash = (0, keys_1.doubleSha256)(preimage);
|
|
110
|
+
const signature = (0, keys_1.signData)(privateKey, sigHash);
|
|
111
|
+
// Append SIGHASH_ALL byte to signature
|
|
112
|
+
const sigWithHashType = Buffer.concat([signature, Buffer.from([SIGHASH_ALL])]);
|
|
113
|
+
// Derive pubkey for witness
|
|
114
|
+
const pubkey = (0, keys_1.privkeyToPubkey)(privateKey, true);
|
|
115
|
+
this.witnesses[inputIndex] = [sigWithHashType, pubkey];
|
|
116
|
+
}
|
|
117
|
+
/** Serialize the transaction in SegWit format (BIP-144) */
|
|
118
|
+
serialize() {
|
|
119
|
+
const hasWitness = this.witnesses.some((w) => w.length > 0);
|
|
120
|
+
const parts = [];
|
|
121
|
+
// Version
|
|
122
|
+
parts.push(writeUint32LE(this.version));
|
|
123
|
+
// SegWit marker + flag
|
|
124
|
+
if (hasWitness) {
|
|
125
|
+
parts.push(Buffer.from([0x00, 0x01]));
|
|
126
|
+
}
|
|
127
|
+
// Inputs
|
|
128
|
+
parts.push(writeVarint(this.inputs.length));
|
|
129
|
+
for (const input of this.inputs) {
|
|
130
|
+
parts.push(txidToBytes(input.txid));
|
|
131
|
+
parts.push(writeUint32LE(input.vout));
|
|
132
|
+
parts.push(Buffer.from([0x00])); // empty scriptSig for SegWit
|
|
133
|
+
parts.push(writeUint32LE(input.sequence));
|
|
134
|
+
}
|
|
135
|
+
// Outputs
|
|
136
|
+
parts.push(writeVarint(this.outputs.length));
|
|
137
|
+
for (const output of this.outputs) {
|
|
138
|
+
parts.push(writeInt64LE(output.amountSat));
|
|
139
|
+
parts.push(writeVarint(output.scriptPubkey.length));
|
|
140
|
+
parts.push(output.scriptPubkey);
|
|
141
|
+
}
|
|
142
|
+
// Witness data
|
|
143
|
+
if (hasWitness) {
|
|
144
|
+
for (let i = 0; i < this.inputs.length; i++) {
|
|
145
|
+
const witness = this.witnesses[i];
|
|
146
|
+
if (witness.length === 0) {
|
|
147
|
+
parts.push(Buffer.from([0x00])); // empty witness
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
parts.push(writeVarint(witness.length));
|
|
151
|
+
for (const item of witness) {
|
|
152
|
+
parts.push(writeVarint(item.length));
|
|
153
|
+
parts.push(item);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Locktime
|
|
159
|
+
parts.push(writeUint32LE(this.locktime));
|
|
160
|
+
return Buffer.concat(parts);
|
|
161
|
+
}
|
|
162
|
+
/** Compute the transaction ID (non-witness hash, reversed) */
|
|
163
|
+
txid() {
|
|
164
|
+
// Serialize without witness data
|
|
165
|
+
const parts = [];
|
|
166
|
+
parts.push(writeUint32LE(this.version));
|
|
167
|
+
parts.push(writeVarint(this.inputs.length));
|
|
168
|
+
for (const input of this.inputs) {
|
|
169
|
+
parts.push(txidToBytes(input.txid));
|
|
170
|
+
parts.push(writeUint32LE(input.vout));
|
|
171
|
+
parts.push(Buffer.from([0x00])); // empty scriptSig
|
|
172
|
+
parts.push(writeUint32LE(input.sequence));
|
|
173
|
+
}
|
|
174
|
+
parts.push(writeVarint(this.outputs.length));
|
|
175
|
+
for (const output of this.outputs) {
|
|
176
|
+
parts.push(writeInt64LE(output.amountSat));
|
|
177
|
+
parts.push(writeVarint(output.scriptPubkey.length));
|
|
178
|
+
parts.push(output.scriptPubkey);
|
|
179
|
+
}
|
|
180
|
+
parts.push(writeUint32LE(this.locktime));
|
|
181
|
+
const raw = Buffer.concat(parts);
|
|
182
|
+
const hash = (0, keys_1.doubleSha256)(raw);
|
|
183
|
+
// Reverse for display
|
|
184
|
+
const reversed = Buffer.from(hash);
|
|
185
|
+
reversed.reverse();
|
|
186
|
+
return reversed.toString('hex');
|
|
187
|
+
}
|
|
188
|
+
/** Return serialized transaction as hex string */
|
|
189
|
+
hex() {
|
|
190
|
+
return this.serialize().toString('hex');
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
exports.Transaction = Transaction;
|
|
194
|
+
/**
|
|
195
|
+
* Build a payment transaction with automatic change calculation.
|
|
196
|
+
*/
|
|
197
|
+
function buildPaymentTx(params) {
|
|
198
|
+
const { inputs, toAddress, amountSat, changeAddress, feeSat = 20000n, opReturnData, network = params_1.MAINNET, } = params;
|
|
199
|
+
const totalInput = inputs.reduce((sum, inp) => sum + inp.amountSat, 0n);
|
|
200
|
+
const totalRequired = amountSat + feeSat;
|
|
201
|
+
if (totalInput < totalRequired) {
|
|
202
|
+
throw new exceptions_1.InsufficientFundsError(`Insufficient funds: have ${totalInput} sat, need ${totalRequired} sat`);
|
|
203
|
+
}
|
|
204
|
+
const tx = new Transaction();
|
|
205
|
+
for (const input of inputs) {
|
|
206
|
+
tx.addInput(input);
|
|
207
|
+
}
|
|
208
|
+
// Payment output
|
|
209
|
+
tx.addOutput({
|
|
210
|
+
scriptPubkey: (0, script_1.addressToScriptPubkey)(toAddress, network),
|
|
211
|
+
amountSat,
|
|
212
|
+
});
|
|
213
|
+
// OP_RETURN output (if any)
|
|
214
|
+
if (opReturnData) {
|
|
215
|
+
tx.addOpReturn(opReturnData);
|
|
216
|
+
}
|
|
217
|
+
// Change output (if above dust)
|
|
218
|
+
const change = totalInput - totalRequired;
|
|
219
|
+
if (change > constants_1.DUST_THRESHOLD) {
|
|
220
|
+
tx.addOutput({
|
|
221
|
+
scriptPubkey: (0, script_1.addressToScriptPubkey)(changeAddress, network),
|
|
222
|
+
amountSat: change,
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return tx;
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/crypto/transaction.ts"],"names":[],"mappings":";;;AA4PA,wCAuDC;AA/SD,iCAA0E;AAC1E,qCAAqF;AACrF,8CAA2D;AAC3D,oDAAwE;AACxE,8CAAuD;AAiBvD,4CAA4C;AAC5C,SAAS,WAAW,CAAC,CAAS;IAC5B,IAAI,CAAC,GAAG,IAAI,EAAE,CAAC;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;SAAM,IAAI,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC;SAAM,IAAI,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC5B,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;QACd,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,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":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchManifest = void 0;
|
|
4
|
+
var manifest_client_1 = require("./manifest_client");
|
|
5
|
+
Object.defineProperty(exports, "fetchManifest", { enumerable: true, get: function () { return manifest_client_1.fetchManifest; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/discovery/index.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAAzC,gHAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest discovery client — fetches and validates /.well-known/digirails.json.
|
|
3
|
+
*/
|
|
4
|
+
import { Manifest } from '../models/manifest';
|
|
5
|
+
/**
|
|
6
|
+
* Fetch and validate a seller's capabilities manifest.
|
|
7
|
+
*/
|
|
8
|
+
export declare function fetchManifest(baseUrl: string): Promise<Manifest>;
|
|
9
|
+
//# sourceMappingURL=manifest_client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest_client.d.ts","sourceRoot":"","sources":["../../src/discovery/manifest_client.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,QAAQ,EAAkB,MAAM,oBAAoB,CAAC;AAG9D;;GAEG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkBtE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchManifest = fetchManifest;
|
|
4
|
+
/**
|
|
5
|
+
* Manifest discovery client — fetches and validates /.well-known/digirails.json.
|
|
6
|
+
*/
|
|
7
|
+
const manifest_1 = require("../models/manifest");
|
|
8
|
+
const exceptions_1 = require("../exceptions");
|
|
9
|
+
/**
|
|
10
|
+
* Fetch and validate a seller's capabilities manifest.
|
|
11
|
+
*/
|
|
12
|
+
async function fetchManifest(baseUrl) {
|
|
13
|
+
const url = `${baseUrl.replace(/\/$/, '')}/.well-known/digirails.json`;
|
|
14
|
+
let response;
|
|
15
|
+
try {
|
|
16
|
+
response = await fetch(url, {
|
|
17
|
+
headers: { Accept: 'application/json' },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
throw new exceptions_1.NetworkError(`Failed to fetch manifest from ${url}: ${err.message}`);
|
|
22
|
+
}
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
throw new exceptions_1.NetworkError(`Manifest fetch failed with status ${response.status}: ${url}`);
|
|
25
|
+
}
|
|
26
|
+
const data = await response.json();
|
|
27
|
+
return manifest_1.ManifestSchema.parse(data);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=manifest_client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest_client.js","sourceRoot":"","sources":["../../src/discovery/manifest_client.ts"],"names":[],"mappings":";;AASA,sCAkBC;AA3BD;;GAEG;AACH,iDAA8D;AAC9D,8CAA6C;AAE7C;;GAEG;AACI,KAAK,UAAU,aAAa,CAAC,OAAe;IACjD,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,6BAA6B,CAAC;IAEvE,IAAI,QAAkB,CAAC;IACvB,IAAI,CAAC;QACH,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC1B,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;SACxC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,yBAAY,CAAC,iCAAiC,GAAG,KAAM,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,yBAAY,CAAC,qCAAqC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,yBAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DigiRails exception hierarchy.
|
|
3
|
+
*/
|
|
4
|
+
export declare class DigiRailsError extends Error {
|
|
5
|
+
constructor(message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare class NetworkError extends DigiRailsError {
|
|
8
|
+
constructor(message: string);
|
|
9
|
+
}
|
|
10
|
+
export declare class RpcError extends DigiRailsError {
|
|
11
|
+
code: number;
|
|
12
|
+
constructor(code: number, message: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class PaymentError extends DigiRailsError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class InvoiceExpiredError extends PaymentError {
|
|
18
|
+
constructor(message?: string);
|
|
19
|
+
}
|
|
20
|
+
export declare class InsufficientFundsError extends PaymentError {
|
|
21
|
+
constructor(message?: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class VerificationError extends PaymentError {
|
|
24
|
+
constructor(message?: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class TransactionError extends DigiRailsError {
|
|
27
|
+
constructor(message: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class KeystoreError extends DigiRailsError {
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,YAAa,SAAQ,cAAc;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,QAAS,SAAQ,cAAc;IAC1C,IAAI,EAAE,MAAM,CAAC;gBAED,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK1C;AAED,qBAAa,YAAa,SAAQ,cAAc;gBAClC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,YAAY;gBACvC,OAAO,SAAwB;CAI5C;AAED,qBAAa,sBAAuB,SAAQ,YAAY;gBAC1C,OAAO,SAAuB;CAI3C;AAED,qBAAa,iBAAkB,SAAQ,YAAY;gBACrC,OAAO,SAAgC;CAIpD;AAED,qBAAa,gBAAiB,SAAQ,cAAc;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,cAAc;gBACnC,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* DigiRails exception hierarchy.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.KeystoreError = exports.TransactionError = exports.VerificationError = exports.InsufficientFundsError = exports.InvoiceExpiredError = exports.PaymentError = exports.RpcError = exports.NetworkError = exports.DigiRailsError = void 0;
|
|
7
|
+
class DigiRailsError extends Error {
|
|
8
|
+
constructor(message) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.name = 'DigiRailsError';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.DigiRailsError = DigiRailsError;
|
|
14
|
+
class NetworkError extends DigiRailsError {
|
|
15
|
+
constructor(message) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'NetworkError';
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NetworkError = NetworkError;
|
|
21
|
+
class RpcError extends DigiRailsError {
|
|
22
|
+
code;
|
|
23
|
+
constructor(code, message) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = 'RpcError';
|
|
26
|
+
this.code = code;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.RpcError = RpcError;
|
|
30
|
+
class PaymentError extends DigiRailsError {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message);
|
|
33
|
+
this.name = 'PaymentError';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.PaymentError = PaymentError;
|
|
37
|
+
class InvoiceExpiredError extends PaymentError {
|
|
38
|
+
constructor(message = 'Invoice has expired') {
|
|
39
|
+
super(message);
|
|
40
|
+
this.name = 'InvoiceExpiredError';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.InvoiceExpiredError = InvoiceExpiredError;
|
|
44
|
+
class InsufficientFundsError extends PaymentError {
|
|
45
|
+
constructor(message = 'Insufficient funds') {
|
|
46
|
+
super(message);
|
|
47
|
+
this.name = 'InsufficientFundsError';
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.InsufficientFundsError = InsufficientFundsError;
|
|
51
|
+
class VerificationError extends PaymentError {
|
|
52
|
+
constructor(message = 'Payment verification failed') {
|
|
53
|
+
super(message);
|
|
54
|
+
this.name = 'VerificationError';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.VerificationError = VerificationError;
|
|
58
|
+
class TransactionError extends DigiRailsError {
|
|
59
|
+
constructor(message) {
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = 'TransactionError';
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.TransactionError = TransactionError;
|
|
65
|
+
class KeystoreError extends DigiRailsError {
|
|
66
|
+
constructor(message) {
|
|
67
|
+
super(message);
|
|
68
|
+
this.name = 'KeystoreError';
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.KeystoreError = KeystoreError;
|
|
72
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../src/exceptions.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC;AAED,MAAa,YAAa,SAAQ,cAAc;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,MAAa,QAAS,SAAQ,cAAc;IAC1C,IAAI,CAAS;IAEb,YAAY,IAAY,EAAE,OAAe;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AARD,4BAQC;AAED,MAAa,YAAa,SAAQ,cAAc;IAC9C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;AALD,oCAKC;AAED,MAAa,mBAAoB,SAAQ,YAAY;IACnD,YAAY,OAAO,GAAG,qBAAqB;QACzC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AALD,kDAKC;AAED,MAAa,sBAAuB,SAAQ,YAAY;IACtD,YAAY,OAAO,GAAG,oBAAoB;QACxC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AALD,wDAKC;AAED,MAAa,iBAAkB,SAAQ,YAAY;IACjD,YAAY,OAAO,GAAG,6BAA6B;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,8CAKC;AAED,MAAa,gBAAiB,SAAQ,cAAc;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AALD,4CAKC;AAED,MAAa,aAAc,SAAQ,cAAc;IAC/C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AALD,sCAKC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DigiRails — Payment infrastructure for autonomous AI agents on DigiByte L1.
|
|
3
|
+
*
|
|
4
|
+
* @module digirails
|
|
5
|
+
*/
|
|
6
|
+
export { VERSION } from './version';
|
|
7
|
+
export { Agent } from './agent';
|
|
8
|
+
export { DigiRailsConfig, defaultConfig, configFromEnv, regtestConfig } from './config';
|
|
9
|
+
export { NetworkParams, MAINNET, TESTNET, REGTEST, getNetwork } from './network/params';
|
|
10
|
+
export { DR_MAGIC, DR_VERSION, DR_TEST_FLAG, PROTOCOL_VERSION, OP_RETURN_MAX_BYTES, SATOSHIS_PER_DGB, DUST_THRESHOLD, SubProtocol, CoreMessageType, PayMessageType, RepMessageType, } from './network/constants';
|
|
11
|
+
export { ConfirmationTier, ServiceCategory, ErrorCode, tierConfirmations, tierMaxDgb, isRetryable, } from './models/enums';
|
|
12
|
+
export { PaymentRequest, PaymentInvoice, PaymentBroadcast, ServiceDelivery, ErrorResponse, RefundInfo, createPaymentRequest, createPaymentInvoice, createPaymentBroadcast, createServiceDelivery, createErrorResponse, } from './models/messages';
|
|
13
|
+
export { Manifest, Service, Pricing, PaymentTerms, findService } from './models/manifest';
|
|
14
|
+
export { generateKeypair, privkeyToPubkey, pubkeyToP2wpkhAddress, pubkeyToP2pkhAddress, privkeyToWif, wifToPrivkey, validateAddress, hash160, doubleSha256, signData, } from './crypto/keys';
|
|
15
|
+
export { b58encode, b58decode, b58encodeCheck, b58decodeCheck } from './crypto/base58';
|
|
16
|
+
export { encodeSegwitAddress, decodeSegwitAddress } from './crypto/bech32';
|
|
17
|
+
export { p2wpkhScriptPubkey, p2pkhScriptPubkey, opReturnScript, addressToScriptPubkey, scriptPubkeyToKeyhash, } from './crypto/script';
|
|
18
|
+
export { Transaction, TxInput, TxOutput, buildPaymentTx } from './crypto/transaction';
|
|
19
|
+
export { encodeHeader, decodeHeader, DecodedHeader, encodeIdentityDeclaration, encodeIdentityTransfer, encodeServiceDeclaration, encodePaymentMemo, encodeRefundMemo, encodeAttestation, manifestHash, } from './opreturn';
|
|
20
|
+
export { Wallet } from './wallet/wallet';
|
|
21
|
+
export { UtxoSet, Utxo, satToDgb, dgbToSat } from './wallet/utxo';
|
|
22
|
+
export { Keystore, EncryptedKeystore, EnvKeystore, RawKeystore } from './wallet/keystore';
|
|
23
|
+
export { RpcClient } from './rpc/client';
|
|
24
|
+
export { requestService, payInvoice } from './payment/buyer';
|
|
25
|
+
export { SellerFlow, ServiceHandler } from './payment/seller';
|
|
26
|
+
export { buy } from './payment/flow';
|
|
27
|
+
export { verifyRawTxSimple } from './payment/verification';
|
|
28
|
+
export { fetchManifest } from './discovery/manifest_client';
|
|
29
|
+
export { DigiRailsServer } from './server';
|
|
30
|
+
export { DigiRailsError, NetworkError, RpcError, PaymentError, InvoiceExpiredError, InsufficientFundsError, VerificationError, TransactionError, KeystoreError, } from './exceptions';
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;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,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtF,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACxB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG1F,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,OAAO,EACL,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,GACd,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.p2pkhScriptPubkey = exports.p2wpkhScriptPubkey = exports.decodeSegwitAddress = exports.encodeSegwitAddress = exports.b58decodeCheck = exports.b58encodeCheck = exports.b58decode = exports.b58encode = exports.signData = exports.doubleSha256 = exports.hash160 = exports.validateAddress = exports.wifToPrivkey = exports.privkeyToWif = exports.pubkeyToP2pkhAddress = exports.pubkeyToP2wpkhAddress = exports.privkeyToPubkey = exports.generateKeypair = exports.findService = exports.createErrorResponse = exports.createServiceDelivery = exports.createPaymentBroadcast = exports.createPaymentInvoice = exports.createPaymentRequest = exports.isRetryable = exports.tierMaxDgb = exports.tierConfirmations = exports.ErrorCode = exports.ServiceCategory = exports.ConfirmationTier = exports.RepMessageType = exports.PayMessageType = exports.CoreMessageType = exports.SubProtocol = exports.DUST_THRESHOLD = exports.SATOSHIS_PER_DGB = exports.OP_RETURN_MAX_BYTES = exports.PROTOCOL_VERSION = exports.DR_TEST_FLAG = exports.DR_VERSION = exports.DR_MAGIC = exports.getNetwork = exports.REGTEST = exports.TESTNET = exports.MAINNET = exports.regtestConfig = exports.configFromEnv = exports.defaultConfig = exports.Agent = exports.VERSION = void 0;
|
|
4
|
+
exports.KeystoreError = exports.TransactionError = exports.VerificationError = exports.InsufficientFundsError = exports.InvoiceExpiredError = exports.PaymentError = exports.RpcError = exports.NetworkError = exports.DigiRailsError = exports.DigiRailsServer = exports.fetchManifest = exports.verifyRawTxSimple = exports.buy = exports.SellerFlow = exports.payInvoice = exports.requestService = exports.RpcClient = exports.RawKeystore = exports.EnvKeystore = exports.EncryptedKeystore = exports.dgbToSat = exports.satToDgb = exports.UtxoSet = exports.Wallet = exports.manifestHash = exports.encodeAttestation = exports.encodeRefundMemo = exports.encodePaymentMemo = exports.encodeServiceDeclaration = exports.encodeIdentityTransfer = exports.encodeIdentityDeclaration = exports.decodeHeader = exports.encodeHeader = exports.buildPaymentTx = exports.Transaction = exports.scriptPubkeyToKeyhash = exports.addressToScriptPubkey = exports.opReturnScript = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* DigiRails — Payment infrastructure for autonomous AI agents on DigiByte L1.
|
|
7
|
+
*
|
|
8
|
+
* @module digirails
|
|
9
|
+
*/
|
|
10
|
+
var version_1 = require("./version");
|
|
11
|
+
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return version_1.VERSION; } });
|
|
12
|
+
// Agent (high-level API)
|
|
13
|
+
var agent_1 = require("./agent");
|
|
14
|
+
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return agent_1.Agent; } });
|
|
15
|
+
// Config
|
|
16
|
+
var config_1 = require("./config");
|
|
17
|
+
Object.defineProperty(exports, "defaultConfig", { enumerable: true, get: function () { return config_1.defaultConfig; } });
|
|
18
|
+
Object.defineProperty(exports, "configFromEnv", { enumerable: true, get: function () { return config_1.configFromEnv; } });
|
|
19
|
+
Object.defineProperty(exports, "regtestConfig", { enumerable: true, get: function () { return config_1.regtestConfig; } });
|
|
20
|
+
// Network
|
|
21
|
+
var params_1 = require("./network/params");
|
|
22
|
+
Object.defineProperty(exports, "MAINNET", { enumerable: true, get: function () { return params_1.MAINNET; } });
|
|
23
|
+
Object.defineProperty(exports, "TESTNET", { enumerable: true, get: function () { return params_1.TESTNET; } });
|
|
24
|
+
Object.defineProperty(exports, "REGTEST", { enumerable: true, get: function () { return params_1.REGTEST; } });
|
|
25
|
+
Object.defineProperty(exports, "getNetwork", { enumerable: true, get: function () { return params_1.getNetwork; } });
|
|
26
|
+
var constants_1 = require("./network/constants");
|
|
27
|
+
Object.defineProperty(exports, "DR_MAGIC", { enumerable: true, get: function () { return constants_1.DR_MAGIC; } });
|
|
28
|
+
Object.defineProperty(exports, "DR_VERSION", { enumerable: true, get: function () { return constants_1.DR_VERSION; } });
|
|
29
|
+
Object.defineProperty(exports, "DR_TEST_FLAG", { enumerable: true, get: function () { return constants_1.DR_TEST_FLAG; } });
|
|
30
|
+
Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return constants_1.PROTOCOL_VERSION; } });
|
|
31
|
+
Object.defineProperty(exports, "OP_RETURN_MAX_BYTES", { enumerable: true, get: function () { return constants_1.OP_RETURN_MAX_BYTES; } });
|
|
32
|
+
Object.defineProperty(exports, "SATOSHIS_PER_DGB", { enumerable: true, get: function () { return constants_1.SATOSHIS_PER_DGB; } });
|
|
33
|
+
Object.defineProperty(exports, "DUST_THRESHOLD", { enumerable: true, get: function () { return constants_1.DUST_THRESHOLD; } });
|
|
34
|
+
Object.defineProperty(exports, "SubProtocol", { enumerable: true, get: function () { return constants_1.SubProtocol; } });
|
|
35
|
+
Object.defineProperty(exports, "CoreMessageType", { enumerable: true, get: function () { return constants_1.CoreMessageType; } });
|
|
36
|
+
Object.defineProperty(exports, "PayMessageType", { enumerable: true, get: function () { return constants_1.PayMessageType; } });
|
|
37
|
+
Object.defineProperty(exports, "RepMessageType", { enumerable: true, get: function () { return constants_1.RepMessageType; } });
|
|
38
|
+
// Models
|
|
39
|
+
var enums_1 = require("./models/enums");
|
|
40
|
+
Object.defineProperty(exports, "ConfirmationTier", { enumerable: true, get: function () { return enums_1.ConfirmationTier; } });
|
|
41
|
+
Object.defineProperty(exports, "ServiceCategory", { enumerable: true, get: function () { return enums_1.ServiceCategory; } });
|
|
42
|
+
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return enums_1.ErrorCode; } });
|
|
43
|
+
Object.defineProperty(exports, "tierConfirmations", { enumerable: true, get: function () { return enums_1.tierConfirmations; } });
|
|
44
|
+
Object.defineProperty(exports, "tierMaxDgb", { enumerable: true, get: function () { return enums_1.tierMaxDgb; } });
|
|
45
|
+
Object.defineProperty(exports, "isRetryable", { enumerable: true, get: function () { return enums_1.isRetryable; } });
|
|
46
|
+
var messages_1 = require("./models/messages");
|
|
47
|
+
Object.defineProperty(exports, "createPaymentRequest", { enumerable: true, get: function () { return messages_1.createPaymentRequest; } });
|
|
48
|
+
Object.defineProperty(exports, "createPaymentInvoice", { enumerable: true, get: function () { return messages_1.createPaymentInvoice; } });
|
|
49
|
+
Object.defineProperty(exports, "createPaymentBroadcast", { enumerable: true, get: function () { return messages_1.createPaymentBroadcast; } });
|
|
50
|
+
Object.defineProperty(exports, "createServiceDelivery", { enumerable: true, get: function () { return messages_1.createServiceDelivery; } });
|
|
51
|
+
Object.defineProperty(exports, "createErrorResponse", { enumerable: true, get: function () { return messages_1.createErrorResponse; } });
|
|
52
|
+
var manifest_1 = require("./models/manifest");
|
|
53
|
+
Object.defineProperty(exports, "findService", { enumerable: true, get: function () { return manifest_1.findService; } });
|
|
54
|
+
// Crypto
|
|
55
|
+
var keys_1 = require("./crypto/keys");
|
|
56
|
+
Object.defineProperty(exports, "generateKeypair", { enumerable: true, get: function () { return keys_1.generateKeypair; } });
|
|
57
|
+
Object.defineProperty(exports, "privkeyToPubkey", { enumerable: true, get: function () { return keys_1.privkeyToPubkey; } });
|
|
58
|
+
Object.defineProperty(exports, "pubkeyToP2wpkhAddress", { enumerable: true, get: function () { return keys_1.pubkeyToP2wpkhAddress; } });
|
|
59
|
+
Object.defineProperty(exports, "pubkeyToP2pkhAddress", { enumerable: true, get: function () { return keys_1.pubkeyToP2pkhAddress; } });
|
|
60
|
+
Object.defineProperty(exports, "privkeyToWif", { enumerable: true, get: function () { return keys_1.privkeyToWif; } });
|
|
61
|
+
Object.defineProperty(exports, "wifToPrivkey", { enumerable: true, get: function () { return keys_1.wifToPrivkey; } });
|
|
62
|
+
Object.defineProperty(exports, "validateAddress", { enumerable: true, get: function () { return keys_1.validateAddress; } });
|
|
63
|
+
Object.defineProperty(exports, "hash160", { enumerable: true, get: function () { return keys_1.hash160; } });
|
|
64
|
+
Object.defineProperty(exports, "doubleSha256", { enumerable: true, get: function () { return keys_1.doubleSha256; } });
|
|
65
|
+
Object.defineProperty(exports, "signData", { enumerable: true, get: function () { return keys_1.signData; } });
|
|
66
|
+
var base58_1 = require("./crypto/base58");
|
|
67
|
+
Object.defineProperty(exports, "b58encode", { enumerable: true, get: function () { return base58_1.b58encode; } });
|
|
68
|
+
Object.defineProperty(exports, "b58decode", { enumerable: true, get: function () { return base58_1.b58decode; } });
|
|
69
|
+
Object.defineProperty(exports, "b58encodeCheck", { enumerable: true, get: function () { return base58_1.b58encodeCheck; } });
|
|
70
|
+
Object.defineProperty(exports, "b58decodeCheck", { enumerable: true, get: function () { return base58_1.b58decodeCheck; } });
|
|
71
|
+
var bech32_1 = require("./crypto/bech32");
|
|
72
|
+
Object.defineProperty(exports, "encodeSegwitAddress", { enumerable: true, get: function () { return bech32_1.encodeSegwitAddress; } });
|
|
73
|
+
Object.defineProperty(exports, "decodeSegwitAddress", { enumerable: true, get: function () { return bech32_1.decodeSegwitAddress; } });
|
|
74
|
+
var script_1 = require("./crypto/script");
|
|
75
|
+
Object.defineProperty(exports, "p2wpkhScriptPubkey", { enumerable: true, get: function () { return script_1.p2wpkhScriptPubkey; } });
|
|
76
|
+
Object.defineProperty(exports, "p2pkhScriptPubkey", { enumerable: true, get: function () { return script_1.p2pkhScriptPubkey; } });
|
|
77
|
+
Object.defineProperty(exports, "opReturnScript", { enumerable: true, get: function () { return script_1.opReturnScript; } });
|
|
78
|
+
Object.defineProperty(exports, "addressToScriptPubkey", { enumerable: true, get: function () { return script_1.addressToScriptPubkey; } });
|
|
79
|
+
Object.defineProperty(exports, "scriptPubkeyToKeyhash", { enumerable: true, get: function () { return script_1.scriptPubkeyToKeyhash; } });
|
|
80
|
+
var transaction_1 = require("./crypto/transaction");
|
|
81
|
+
Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_1.Transaction; } });
|
|
82
|
+
Object.defineProperty(exports, "buildPaymentTx", { enumerable: true, get: function () { return transaction_1.buildPaymentTx; } });
|
|
83
|
+
// OP_RETURN encoding
|
|
84
|
+
var opreturn_1 = require("./opreturn");
|
|
85
|
+
Object.defineProperty(exports, "encodeHeader", { enumerable: true, get: function () { return opreturn_1.encodeHeader; } });
|
|
86
|
+
Object.defineProperty(exports, "decodeHeader", { enumerable: true, get: function () { return opreturn_1.decodeHeader; } });
|
|
87
|
+
Object.defineProperty(exports, "encodeIdentityDeclaration", { enumerable: true, get: function () { return opreturn_1.encodeIdentityDeclaration; } });
|
|
88
|
+
Object.defineProperty(exports, "encodeIdentityTransfer", { enumerable: true, get: function () { return opreturn_1.encodeIdentityTransfer; } });
|
|
89
|
+
Object.defineProperty(exports, "encodeServiceDeclaration", { enumerable: true, get: function () { return opreturn_1.encodeServiceDeclaration; } });
|
|
90
|
+
Object.defineProperty(exports, "encodePaymentMemo", { enumerable: true, get: function () { return opreturn_1.encodePaymentMemo; } });
|
|
91
|
+
Object.defineProperty(exports, "encodeRefundMemo", { enumerable: true, get: function () { return opreturn_1.encodeRefundMemo; } });
|
|
92
|
+
Object.defineProperty(exports, "encodeAttestation", { enumerable: true, get: function () { return opreturn_1.encodeAttestation; } });
|
|
93
|
+
Object.defineProperty(exports, "manifestHash", { enumerable: true, get: function () { return opreturn_1.manifestHash; } });
|
|
94
|
+
// Wallet
|
|
95
|
+
var wallet_1 = require("./wallet/wallet");
|
|
96
|
+
Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_1.Wallet; } });
|
|
97
|
+
var utxo_1 = require("./wallet/utxo");
|
|
98
|
+
Object.defineProperty(exports, "UtxoSet", { enumerable: true, get: function () { return utxo_1.UtxoSet; } });
|
|
99
|
+
Object.defineProperty(exports, "satToDgb", { enumerable: true, get: function () { return utxo_1.satToDgb; } });
|
|
100
|
+
Object.defineProperty(exports, "dgbToSat", { enumerable: true, get: function () { return utxo_1.dgbToSat; } });
|
|
101
|
+
var keystore_1 = require("./wallet/keystore");
|
|
102
|
+
Object.defineProperty(exports, "EncryptedKeystore", { enumerable: true, get: function () { return keystore_1.EncryptedKeystore; } });
|
|
103
|
+
Object.defineProperty(exports, "EnvKeystore", { enumerable: true, get: function () { return keystore_1.EnvKeystore; } });
|
|
104
|
+
Object.defineProperty(exports, "RawKeystore", { enumerable: true, get: function () { return keystore_1.RawKeystore; } });
|
|
105
|
+
// RPC
|
|
106
|
+
var client_1 = require("./rpc/client");
|
|
107
|
+
Object.defineProperty(exports, "RpcClient", { enumerable: true, get: function () { return client_1.RpcClient; } });
|
|
108
|
+
// Payment
|
|
109
|
+
var buyer_1 = require("./payment/buyer");
|
|
110
|
+
Object.defineProperty(exports, "requestService", { enumerable: true, get: function () { return buyer_1.requestService; } });
|
|
111
|
+
Object.defineProperty(exports, "payInvoice", { enumerable: true, get: function () { return buyer_1.payInvoice; } });
|
|
112
|
+
var seller_1 = require("./payment/seller");
|
|
113
|
+
Object.defineProperty(exports, "SellerFlow", { enumerable: true, get: function () { return seller_1.SellerFlow; } });
|
|
114
|
+
var flow_1 = require("./payment/flow");
|
|
115
|
+
Object.defineProperty(exports, "buy", { enumerable: true, get: function () { return flow_1.buy; } });
|
|
116
|
+
var verification_1 = require("./payment/verification");
|
|
117
|
+
Object.defineProperty(exports, "verifyRawTxSimple", { enumerable: true, get: function () { return verification_1.verifyRawTxSimple; } });
|
|
118
|
+
// Discovery
|
|
119
|
+
var manifest_client_1 = require("./discovery/manifest_client");
|
|
120
|
+
Object.defineProperty(exports, "fetchManifest", { enumerable: true, get: function () { return manifest_client_1.fetchManifest; } });
|
|
121
|
+
// Server
|
|
122
|
+
var server_1 = require("./server");
|
|
123
|
+
Object.defineProperty(exports, "DigiRailsServer", { enumerable: true, get: function () { return server_1.DigiRailsServer; } });
|
|
124
|
+
// Exceptions
|
|
125
|
+
var exceptions_1 = require("./exceptions");
|
|
126
|
+
Object.defineProperty(exports, "DigiRailsError", { enumerable: true, get: function () { return exceptions_1.DigiRailsError; } });
|
|
127
|
+
Object.defineProperty(exports, "NetworkError", { enumerable: true, get: function () { return exceptions_1.NetworkError; } });
|
|
128
|
+
Object.defineProperty(exports, "RpcError", { enumerable: true, get: function () { return exceptions_1.RpcError; } });
|
|
129
|
+
Object.defineProperty(exports, "PaymentError", { enumerable: true, get: function () { return exceptions_1.PaymentError; } });
|
|
130
|
+
Object.defineProperty(exports, "InvoiceExpiredError", { enumerable: true, get: function () { return exceptions_1.InvoiceExpiredError; } });
|
|
131
|
+
Object.defineProperty(exports, "InsufficientFundsError", { enumerable: true, get: function () { return exceptions_1.InsufficientFundsError; } });
|
|
132
|
+
Object.defineProperty(exports, "VerificationError", { enumerable: true, get: function () { return exceptions_1.VerificationError; } });
|
|
133
|
+
Object.defineProperty(exports, "TransactionError", { enumerable: true, get: function () { return exceptions_1.TransactionError; } });
|
|
134
|
+
Object.defineProperty(exports, "KeystoreError", { enumerable: true, get: function () { return exceptions_1.KeystoreError; } });
|
|
135
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA;;;;GAIG;AACH,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAEhB,yBAAyB;AACzB,iCAAgC;AAAvB,8FAAA,KAAK,OAAA;AAEd,SAAS;AACT,mCAAwF;AAA9D,uGAAA,aAAa,OAAA;AAAE,uGAAA,aAAa,OAAA;AAAE,uGAAA,aAAa,OAAA;AAErE,UAAU;AACV,2CAAwF;AAAhE,iGAAA,OAAO,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,iGAAA,OAAO,OAAA;AAAE,oGAAA,UAAU,OAAA;AAC7D,iDAY6B;AAX3B,qGAAA,QAAQ,OAAA;AACR,uGAAA,UAAU,OAAA;AACV,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,gHAAA,mBAAmB,OAAA;AACnB,6GAAA,gBAAgB,OAAA;AAChB,2GAAA,cAAc,OAAA;AACd,wGAAA,WAAW,OAAA;AACX,4GAAA,eAAe,OAAA;AACf,2GAAA,cAAc,OAAA;AACd,2GAAA,cAAc,OAAA;AAGhB,SAAS;AACT,wCAOwB;AANtB,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AACf,kGAAA,SAAS,OAAA;AACT,0GAAA,iBAAiB,OAAA;AACjB,mGAAA,UAAU,OAAA;AACV,oGAAA,WAAW,OAAA;AAEb,8CAY2B;AALzB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